Skip to content
A set of helper methods for calling ETH Smart Contracts via JSON RPC.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
test
.formatter.exs
.gitignore
README.md
mix.exs
mix.lock

README.md

EthContract

A set of helper methods to help query ETH smart contracts

Installation

If available in Hex, the package can be installed by adding eth_contract to your list of dependencies in mix.exs:

def deps do
  [
    {:eth_contract, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/eth_contract.

Configuration

Add your JSON RPC provider URL in config.exs

config :ethereumex,
  url: "http://"

Usage

Load and parse the ABI

abi = EthContract.parse_abi("crypto_kitties.json")

Get meta given a token_id and method name

EthContract.meta(%{token_id: 45, method: "getKitty", contract: "0x06012c8cf97BEaD5deAe237070F9587f8E7A266d", abi: abi})

This will return a map with all the meta:

%{                                                                                                                                                                                "birthTime" => 1511417999,
  "cooldownIndex" => 0,  
  "generation" => 0,
  "genes" => 626837621154801616088980922659877168609154386318304496692374110716999053,
  "isGestating" => false,
  "isReady" => true,
  "matronId" => 0,
  "nextActionAt" => 0,
  "sireId" => 0,
  "siringWithId" => 0
}
You can’t perform that action at this time.