Class: Bytom::Address
- Inherits:
-
Object
- Object
- Bytom::Address
- Defined in:
- lib/bytom/api/address.rb
Instance Method Summary collapse
-
#get_mining_address ⇒ Object
Query the current mining address.
-
#initialize(client) ⇒ Address
constructor
A new instance of Address.
-
#list_addresses(account_alias:, account_id:, from: 0, count:) ⇒ Hash
Returns the sub list of all available addresses by account.
-
#set_mining_address(mining_address:) ⇒ Hash
Set the current mining address, no matter whethere the address is a local one.
-
#validate_address(address:) ⇒ Hash
Verify the address is valid, and judge the address is own.
Constructor Details
#initialize(client) ⇒ Address
Returns a new instance of Address.
6 7 8 |
# File 'lib/bytom/api/address.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#get_mining_address ⇒ Object
Query the current mining address.
47 48 49 |
# File 'lib/bytom/api/address.rb', line 47 def get_mining_address client.make_request('/get-mining-address', 'post', params: {}) end |
#list_addresses(account_alias:, account_id:, from: 0, count:) ⇒ Hash
Returns the sub list of all available addresses by account.
20 21 22 23 24 25 26 27 28 |
# File 'lib/bytom/api/address.rb', line 20 def list_addresses(account_alias:, account_id:, from: 0, count:) params = { account_alias: account_alias, account_id: account_id, from: from, count: count } client.make_request('/list-addresses', 'post', params: params) end |
#set_mining_address(mining_address:) ⇒ Hash
Set the current mining address, no matter whethere the address is a local one. It returns an error message if the address format is incorrect.
58 59 60 61 62 63 |
# File 'lib/bytom/api/address.rb', line 58 def set_mining_address(mining_address:) params = { mining_address: mining_address } client.make_request('/set-mining-address', 'post', params: params) end |
#validate_address(address:) ⇒ Hash
Verify the address is valid, and judge the address is own.
37 38 39 40 41 42 |
# File 'lib/bytom/api/address.rb', line 37 def validate_address(address:) params = { address: address } client.make_request('/validate-address', 'post', params: params) end |