Class: Bytom::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/bytom/api/address.rb

Instance Method Summary collapse

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_addressObject

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.

Parameters:

  • account_alias (String)
  • account_id (String)
  • from (Fixnum) (defaults to: 0)
  • count (Fixnum)

Returns:

  • (Hash)


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_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.

Parameters:

  • mining_address (String)

Returns:

  • (Hash)


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.

Parameters:

  • address (String)

Returns:

  • (Hash)


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