Module: Harmony::Api::V1::Accounts::Account
- Included in:
- Client
- Defined in:
- lib/harmony/api/v1/accounts/account.rb
Instance Method Summary collapse
- #get_balance(address) ⇒ Object
- #get_balance_by_block_number(address, block_number) ⇒ Object
- #get_transaction_count(address) ⇒ Object
Instance Method Details
#get_balance(address) ⇒ Object
8 9 10 11 12 |
# File 'lib/harmony/api/v1/accounts/account.rb', line 8 def get_balance(address) params = [address, 'latest'] wei = response(post('getBalance', params: params))&.to_i(16) Harmony::Api::Utilities.wei_to_ether(wei) end |
#get_balance_by_block_number(address, block_number) ⇒ Object
14 15 16 17 18 |
# File 'lib/harmony/api/v1/accounts/account.rb', line 14 def get_balance_by_block_number(address, block_number) params = [address, Harmony::Api::Utilities.int_to_hex(block_number)] wei = response(post('getBalanceByBlockNumber', params: params))&.to_i(16) Harmony::Api::Utilities.wei_to_ether(wei) end |
#get_transaction_count(address) ⇒ Object
20 21 22 23 |
# File 'lib/harmony/api/v1/accounts/account.rb', line 20 def get_transaction_count(address) params = [address, 'latest'] response(post('getTransactionCount', params: params))&.to_i(16) end |