Class: SafeEthRuby::Contract
- Inherits:
-
Object
- Object
- SafeEthRuby::Contract
- Defined in:
- lib/safe_eth_ruby/contract.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#safe_contract ⇒ Object
readonly
Returns the value of attribute safe_contract.
Instance Method Summary collapse
-
#initialize(safe_address:, rpc:) ⇒ Contract
constructor
A new instance of Contract.
-
#nonce ⇒ Object
Fetch nonce from the contract.
Constructor Details
#initialize(safe_address:, rpc:) ⇒ Contract
Returns a new instance of Contract.
9 10 11 12 13 14 15 16 |
# File 'lib/safe_eth_ruby/contract.rb', line 9 def initialize(safe_address:, rpc:) @client = Eth::Client.create(rpc) @safe_contract = Eth::Contract.from_abi( name: "SafeContract", address: safe_address, abi: SafeEthRuby::ABI::PROXY, ) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/safe_eth_ruby/contract.rb', line 7 def client @client end |
#safe_contract ⇒ Object (readonly)
Returns the value of attribute safe_contract.
7 8 9 |
# File 'lib/safe_eth_ruby/contract.rb', line 7 def safe_contract @safe_contract end |
Instance Method Details
#nonce ⇒ Object
Fetch nonce from the contract
19 20 21 22 23 |
# File 'lib/safe_eth_ruby/contract.rb', line 19 def nonce @client.call(@safe_contract, "nonce") rescue StandardError => e warn("Error fetching nonce: #{e.}") end |