Class: Peatio::Transaction
- Inherits:
-
Object
- Object
- Peatio::Transaction
- Includes:
- ActiveModel::Model
- Defined in:
- lib/peatio/transaction.rb
Overview
This class represents blockchain transaction.
Using the instant of this class the peatio application will send/recieve income/outcome transactions from a peatio pluggable blockchain.
Constant Summary collapse
- STATUSES =
Note:
Statuses list:
pending - the transaction is unconfirmed in the blockchain or wasn’t created yet.
success - the transaction is a successfull, the transaction amount has been successfully transferred
failed - the transaction is failed in the blockchain.
rejected - the transaction is rejected by user.
List of statuses supported by peatio.
%w[success pending failed rejected].freeze
- DEFAULT_STATUS =
'pending'.freeze
Instance Attribute Summary collapse
-
#amount ⇒ Object
return [Decimal] amount of the transaction.
-
#block_number ⇒ Object
return [Integer] transaction block number.
-
#currency_id ⇒ Object
return [String] transaction currency id.
-
#fee ⇒ Object
return [Decimal] fee of the transaction.
-
#fee_currency_id ⇒ Object
return [String] transaction fee currency id.
-
#from_address ⇒ Object
return [Array<String>] transaction source addresses.
-
#from_addresses ⇒ Object
return [Array<String>] transaction source addresses.
-
#hash ⇒ Object
return [String] transaction hash.
-
#options ⇒ Object
return [JSON] transaction options.
-
#to_address ⇒ Object
return [String] transaction recepient address.
-
#txout ⇒ Object
return [Integer] transaction number in send-to-many request.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Transaction
constructor
A new instance of Transaction.
-
#status ⇒ Object
Status for specific transaction.
- #status=(s) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Transaction
Returns a new instance of Transaction.
116 117 118 119 |
# File 'lib/peatio/transaction.rb', line 116 def initialize(attributes={}) super @status = @status.present? ? @status.to_s : DEFAULT_STATUS end |
Instance Attribute Details
#amount ⇒ Object
return [Decimal] amount of the transaction
70 71 72 |
# File 'lib/peatio/transaction.rb', line 70 def amount @amount end |
#block_number ⇒ Object
return [Integer] transaction block number
78 79 80 |
# File 'lib/peatio/transaction.rb', line 78 def block_number @block_number end |
#currency_id ⇒ Object
return [String] transaction currency id
82 83 84 |
# File 'lib/peatio/transaction.rb', line 82 def currency_id @currency_id end |
#fee ⇒ Object
return [Decimal] fee of the transaction
74 75 76 |
# File 'lib/peatio/transaction.rb', line 74 def fee @fee end |
#fee_currency_id ⇒ Object
return [String] transaction fee currency id
86 87 88 |
# File 'lib/peatio/transaction.rb', line 86 def fee_currency_id @fee_currency_id end |
#from_address ⇒ Object
return [Array<String>] transaction source addresses
62 |
# File 'lib/peatio/transaction.rb', line 62 attr_accessor :from_addresses |
#from_addresses ⇒ Object
return [Array<String>] transaction source addresses
62 63 64 |
# File 'lib/peatio/transaction.rb', line 62 def from_addresses @from_addresses end |
#hash ⇒ Object
return [String] transaction hash
54 55 56 |
# File 'lib/peatio/transaction.rb', line 54 def hash @hash end |
#options ⇒ Object
return [JSON] transaction options
90 91 92 |
# File 'lib/peatio/transaction.rb', line 90 def end |
#to_address ⇒ Object
return [String] transaction recepient address
66 67 68 |
# File 'lib/peatio/transaction.rb', line 66 def to_address @to_address end |
#txout ⇒ Object
return [Integer] transaction number in send-to-many request
58 59 60 |
# File 'lib/peatio/transaction.rb', line 58 def txout @txout end |
Instance Method Details
#status ⇒ Object
Status for specific transaction.
129 130 131 |
# File 'lib/peatio/transaction.rb', line 129 def status @status&.inquiry end |
#status=(s) ⇒ Object
133 134 135 |
# File 'lib/peatio/transaction.rb', line 133 def status=(s) @status = s.to_s end |