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.
-
#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.
103 104 105 106 |
# File 'lib/peatio/transaction.rb', line 103 def initialize(attributes={}) super @status = @status.present? ? @status.to_s : DEFAULT_STATUS end |
Instance Attribute Details
#amount ⇒ Object
return [Decimal] amount of the transaction
68 69 70 |
# File 'lib/peatio/transaction.rb', line 68 def amount @amount end |
#block_number ⇒ Object
return [Integer] transaction block number
72 73 74 |
# File 'lib/peatio/transaction.rb', line 72 def block_number @block_number end |
#currency_id ⇒ Object
return [String] transaction currency id
76 77 78 |
# File 'lib/peatio/transaction.rb', line 76 def currency_id @currency_id end |
#from_address ⇒ Object
return [Array<String>] transaction source addresses
60 |
# File 'lib/peatio/transaction.rb', line 60 attr_accessor :from_addresses |
#from_addresses ⇒ Object
return [Array<String>] transaction source addresses
60 61 62 |
# File 'lib/peatio/transaction.rb', line 60 def from_addresses @from_addresses end |
#hash ⇒ Object
return [String] transaction hash
52 53 54 |
# File 'lib/peatio/transaction.rb', line 52 def hash @hash end |
#options ⇒ Object
return [JSON] transaction options
80 81 82 |
# File 'lib/peatio/transaction.rb', line 80 def @options end |
#to_address ⇒ Object
return [String] transaction recepient address
64 65 66 |
# File 'lib/peatio/transaction.rb', line 64 def to_address @to_address end |
#txout ⇒ Object
return [Integer] transaction number in send-to-many request
56 57 58 |
# File 'lib/peatio/transaction.rb', line 56 def txout @txout end |
Instance Method Details
#status ⇒ Object
Status for specific transaction.
116 117 118 |
# File 'lib/peatio/transaction.rb', line 116 def status @status&.inquiry end |
#status=(s) ⇒ Object
120 121 122 |
# File 'lib/peatio/transaction.rb', line 120 def status=(s) @status = s.to_s end |