Module: NanoRpc::AccountHelper
Instance Method Summary collapse
- #balance ⇒ Object
- #block_count ⇒ Object
- #history(count:) ⇒ Object
- #info ⇒ Object
- #key ⇒ Object
- #move(from:, to:) ⇒ Object
- #pending_balance ⇒ Object (also: #balance_pending)
- #pending_blocks(count: 100, threshold: nil, source: nil) ⇒ Object (also: #blocks_pending)
- #remove(wallet:) ⇒ Object
- #representative ⇒ Object
- #representative_set(wallet:, representative:) ⇒ Object
- #valid? ⇒ Boolean
- #wallet_work_set(wallet:, work:) ⇒ Object
- #weight ⇒ Object
Instance Method Details
#balance ⇒ Object
5 6 7 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 5 def balance account_balance.balance end |
#block_count ⇒ Object
9 10 11 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 9 def block_count account_block_count.block_count end |
#history(count:) ⇒ Object
13 14 15 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 13 def history(count:) account_history(count: count).history end |
#info ⇒ Object
17 18 19 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 17 def info account_info end |
#key ⇒ Object
21 22 23 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 21 def key account_key['key'] end |
#move(from:, to:) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 25 def move(from:, to:) account_move( source: from, wallet: to, accounts: [address] ).moved == 1 end |
#pending_balance ⇒ Object Also known as: balance_pending
37 38 39 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 37 def pending_balance account_balance.pending end |
#pending_blocks(count: 100, threshold: nil, source: nil) ⇒ Object Also known as: blocks_pending
42 43 44 45 46 47 48 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 42 def pending_blocks(count: 100, threshold: nil, source: nil) pending( count: count, threshold: threshold, source: source ).blocks end |
#remove(wallet:) ⇒ Object
51 52 53 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 51 def remove(wallet:) account_remove(wallet: wallet).removed == 1 end |
#representative ⇒ Object
55 56 57 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 55 def representative account_representative.representative end |
#representative_set(wallet:, representative:) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 59 def representative_set(wallet:, representative:) account_representative_set( wallet: wallet, representative: representative ).set == 1 end |
#valid? ⇒ Boolean
66 67 68 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 66 def valid? validate_account_number.valid == 1 end |
#wallet_work_set(wallet:, work:) ⇒ Object
33 34 35 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 33 def wallet_work_set(wallet:, work:) work_set(wallet: wallet, work: work).success == '' end |
#weight ⇒ Object
70 71 72 |
# File 'lib/nano_rpc/helpers/account_helper.rb', line 70 def weight account_weight.weight end |