Module: Harmony::Api::V1::Contracts::Contract
- Included in:
- Harmony::Api::V1::Client
- Defined in:
- lib/harmony/api/v1/contracts/contract.rb
Instance Method Summary collapse
-
#call(address) ⇒ Object
call contract method.
- #estimate_gas ⇒ Object
-
#get_code(address) ⇒ Object
get deployed contract’s byte code.
-
#get_storage_at(address, key, block_number) ⇒ Object
get storage position at a given address.
Instance Method Details
#call(address) ⇒ Object
call contract method
19 20 21 22 |
# File 'lib/harmony/api/v1/contracts/contract.rb', line 19 def call(address) params = [{ to: address }, 'latest'] response(post('call', params: params)) end |
#estimate_gas ⇒ Object
8 9 10 |
# File 'lib/harmony/api/v1/contracts/contract.rb', line 8 def estimate_gas response(post('estimateGas')) end |
#get_code(address) ⇒ Object
get deployed contract’s byte code
25 26 27 28 |
# File 'lib/harmony/api/v1/contracts/contract.rb', line 25 def get_code(address) params = [address, 'latest'] response(post('getCode', params: params)) end |
#get_storage_at(address, key, block_number) ⇒ Object
get storage position at a given address
13 14 15 16 |
# File 'lib/harmony/api/v1/contracts/contract.rb', line 13 def get_storage_at(address, key, block_number) params = [address, key, Harmony::Api::Utilities.int_to_hex(block_number)] response(post('getStorageAt', params: params)) end |