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.
List of statuses supported by peatio.
%w[success pending failed].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.
-
#hash ⇒ Object
return [String] transaction hash.
-
#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.
93 94 95 96 |
# File 'lib/peatio/transaction.rb', line 93 def initialize(attributes={}) super @status = @status.present? ? @status.to_s : DEFAULT_STATUS end |
Instance Attribute Details
#amount ⇒ Object
return [Decimal] amount of the transaction
62 63 64 |
# File 'lib/peatio/transaction.rb', line 62 def amount @amount end |
#block_number ⇒ Object
return [Integer] transaction block number
66 67 68 |
# File 'lib/peatio/transaction.rb', line 66 def block_number @block_number end |
#currency_id ⇒ Object
return [String] transaction currency id
70 71 72 |
# File 'lib/peatio/transaction.rb', line 70 def currency_id @currency_id end |
#hash ⇒ Object
return [String] transaction hash
50 51 52 |
# File 'lib/peatio/transaction.rb', line 50 def hash @hash end |
#to_address ⇒ Object
return [String] transaction recepient address
58 59 60 |
# File 'lib/peatio/transaction.rb', line 58 def to_address @to_address end |
#txout ⇒ Object
return [Integer] transaction number in send-to-many request
54 55 56 |
# File 'lib/peatio/transaction.rb', line 54 def txout @txout end |
Instance Method Details
#status ⇒ Object
Status for specific transaction.
106 107 108 |
# File 'lib/peatio/transaction.rb', line 106 def status @status&.inquiry end |
#status=(s) ⇒ Object
110 111 112 |
# File 'lib/peatio/transaction.rb', line 110 def status=(s) @status = s.to_s end |