Class: Round::Transaction
- Inherits:
-
Base
- Object
- Base
- Round::Transaction
show all
- Defined in:
- lib/round/transaction.rb
Instance Attribute Summary
Attributes inherited from Base
#resource
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
association, #hash_identifier, #initialize, #method_missing, #refresh
Constructor Details
This class inherits a constructor from Round::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Round::Base
Class Method Details
.hash_identifier ⇒ Object
30
31
32
|
# File 'lib/round/transaction.rb', line 30
def self.hash_identifier
'hash'
end
|
Instance Method Details
#approve(mfa_token) ⇒ Object
21
22
23
24
|
# File 'lib/round/transaction.rb', line 21
def approve(mfa_token)
@client.context.mfa_token = mfa_token
@resource.approve({})
end
|
#sign(wallet, network:) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/round/transaction.rb', line 4
def sign(wallet, network:)
raise 'transaction is already signed' unless @resource['status'] == 'unsigned'
raise 'a wallet is required to sign a transaction' unless wallet
network = :testnet3 if network == :bitcoin_testnet
transaction = CoinOp::Bit::Transaction.data(@resource, network: network)
raise 'bad change address' unless wallet.valid_output?(transaction.outputs.last)
@resource = @resource.update(
signatures: {
transaction_hash: transaction.hex_hash,
inputs: wallet.signatures(transaction)
}
)
self
end
|
#transaction_hash ⇒ Object
26
27
28
|
# File 'lib/round/transaction.rb', line 26
def transaction_hash
@resource[:hash]
end
|