class

EthereumRpc

Inherits Reference < Object

Minimal Ethereum JSON-RPC client backed by the Crystal stdlib.

Constants

TransferTopic = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"

keccak256("Transfer(address,address,uint256)")

Constructors

new(endpoint : String, api_key : String | Nil = nil, timeout : Time::Span = 30.seconds)
Source

Class methods

json_to_u64(v : JSON::Any) : UInt64
Source

Instance methods

balance(address : String, block : String = "latest") : BigInt
Source
block_number
Source
call(method : String, params : String) : JSON::Any

Sends a JSON-RPC request. params must be raw JSON (an array).

Source
close
Source
endpoint
Source
eth_call(to : String, calldata : String, block : String = "latest") : String
Source
hex_to_big(hex : String) : BigInt
Source
hex_to_u64(hex : String) : UInt64
Source
hex_to_utf8(hex : String) : String
Source
json_to_u64(v : JSON::Any) : UInt64
Source
progress=(reporter : Progress | Nil)

Ticked once per completed JSON-RPC request; see Progress.

Source
token_decimals(address : String) : Int32 | Nil
Source
token_symbol(address : String) : String | Nil
Source