Documentation ¶
Index ¶
- Constants
- type ETH
- func (e *ETH) CallContractFunction(function string, address string, gas string) (string, error)
- func (e *ETH) CallContractFunctionBigInt(function string, address string) (*big.Int, error)
- func (e *ETH) CallContractFunctionInt64(function string, address string) (int64, error)
- func (e *ETH) GetBalanceAtBlock(address, blockNumber string) (*big.Int, error)
- func (e *ETH) GetBlockByNumber(number string) (b types.Block, err error)
- func (e *ETH) GetBlockNumber() (int64, error)
- func (e *ETH) GetBlockTransactionCountByNumber(number string) (count string, err error)
- func (e *ETH) GetClient() (string, error)
- func (e *ETH) GetCode(a string) ([]byte, error)
- func (e *ETH) GetContractName(address string) (string, error)
- func (e *ETH) GetContractSymbol(address string) (string, error)
- func (e *ETH) GetContractTotalSupply(address string) (*big.Int, error)
- func (e *ETH) GetERC20Decimals(address string) (uint8, error)
- func (e *ETH) GetFilterChanges(id string) (t []interface{}, err error)
- func (e *ETH) GetLatestBlock() (b types.Block, err error)
- func (e *ETH) GetPeerCount() (peers int64, err error)
- func (e *ETH) GetPendingFilterChanges(id string) (t []string, err error)
- func (e *ETH) GetPendingTransactions() ([]types.Transaction, error)
- func (e *ETH) GetRawBalanceAtBlock(address, blockNumber string) (string, error)
- func (e *ETH) GetRawTokenBalanceAtBlock(address, token, blockNumber string) (string, error)
- func (e *ETH) GetTokenBalanceAtBlock(address, token, blockNumber string) (*big.Int, error)
- func (e *ETH) GetTransactionByHash(hash string) (types.Transaction, error)
- func (e *ETH) GetTransactionReceipt(hash string) (r types.Receipt, err error)
- func (e *ETH) GetUncleByBlockHashAndIndex(hash string, index string) (b types.Block, err error)
- func (e *ETH) GetUncleByBlockNumberAndIndex(blockNumber string, index string) (b types.Block, err error)
- func (e *ETH) GetVersion() (ver string, err error)
- func (e *ETH) MakeRequest(result interface{}, method string, params ...interface{}) error
- func (e *ETH) MakeRequestRaw(method string, params ...interface{}) ([]byte, error)
- func (e *ETH) NewBlockNumberSubscription() (r chan *int64, err error)
- func (e *ETH) NewHeadsSubscription() (r chan *types.BlockHeader, err error)
- func (e *ETH) NewPendingTransactionsSubscription() (r chan *string, err error)
- func (e *ETH) SetPendingTransactionsFilter() (id string, err error)
- func (e *ETH) Start() error
- func (e *ETH) Stop()
- func (e *ETH) Subscribe(receiver chan *json.RawMessage, method string, event string, ...) error
- func (e *ETH) TraceBlock(blockNumber string) ([]types.Trace, error)
- func (e *ETH) TraceReplayBlockTransactions(blockNumber string, traceTypes ...string) ([]types.TransactionReplay, error)
- type ETHInterface
Constants ¶
const ( // parity ParitySubscribe = "parity_subscribe" ParityPendingTransactions = "parity_pendingTransactions" // geth GETHTxPoolContent = "txpool_content" // net NetPeerCount = "net_peerCount" // web3 WEB3ClientVersion = "web3_clientVersion" // eth ETHBlockNumber = "eth_blockNumber" ETHCall = "eth_call" ETHGetBalance = "eth_getBalance" ETHGetBlockByNumber = "eth_getBlockByNumber" ETHGetBlockTransactionCountByNumber = "eth_getBlockTransactionCountByNumber" ETHGetCode = "eth_getCode" ETHGetFilterChanges = "eth_getFilterChanges" ETHGetTransactionByHash = "eth_getTransactionByHash" ETHGetTransactionReceipt = "eth_getTransactionReceipt" ETHGetUncleByBlockHashAndIndex = "eth_getUncleByBlockHashAndIndex" ETHGetUncleByBlockNumberAndIndex = "eth_getUncleByBlockNumberAndIndex" ETHPendingTransactionFilter = "eth_newPendingTransactionFilter" ETHSubscribe = "eth_subscribe" // trace TraceBlock = "trace_block" TraceReplayBlockTransactions = "trace_replayBlockTransactions" // eth pubsub ETHNewHeads = "newHeads" ETHNewPendingTransactions = "newPendingTransactions" // consts ClientGETH = "geth" ClientParity = "parity" )
json rpc methods
const ( // functions NameFunction = "0x06fdde03" ApproveFunction = "0x095ea7b3" // mandatory TotalSupplyFunction = "0x18160ddd" // mandatory TransferFromFunction = "0x23b872dd" // mandatory DecimalsFunction = "0x313ce567" IssueTokensFunction = "0x475a9fa9" BalanceOfFunction = "0x70a08231" // mandatory SymbolFunction = "0x95d89b41" TransferFunction = "0xa9059cbb" // mandatory AllowanceFunction = "0xdd62ed3e" // mandatory // events TransferEvent = "0xddf252ad" // mandatory ApprovalEvent = "0x8c5be1e5" // mandatory )
ERC20 signatures
const (
// DefaultCallGas is the default gas to use for eth_calls
DefaultCallGas = "0xffffff"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ETH ¶
type ETH struct {
// contains filtered or unexported fields
}
ETH server interaction
func NewWithDefaults ¶
NewWithDefaults selects the proper provider based on protocol
func (*ETH) CallContractFunction ¶
CallContractFunction calls a contract's function and returns the result as string
func (*ETH) CallContractFunctionBigInt ¶
CallContractFunctionBigInt calls a contract's function and returns a decoded int64
func (*ETH) CallContractFunctionInt64 ¶
CallContractFunctionInt64 calls a contract's function and returns a decoded int64
func (*ETH) GetBalanceAtBlock ¶
GetBalanceAtBlock returns the balance of an address at a given blockNumber as a big.Int
func (*ETH) GetBlockByNumber ¶
GetBlockByNumber gets specified block with full transaction array
func (*ETH) GetBlockNumber ¶
GetBlockNumber returns the number of most recent block.
func (*ETH) GetBlockTransactionCountByNumber ¶
GetBlockTransactionCountByNumber https://wiki.parity.io/JSONRPC-eth-module.html#eth_getblocktransactioncountbynumber
func (*ETH) GetContractName ¶
GetContractName calls a contract's name function
func (*ETH) GetContractSymbol ¶
GetContractSymbol calls a contract's name function
func (*ETH) GetContractTotalSupply ¶
GetContractTotalSupply calls a contract's totalSupply function
func (*ETH) GetERC20Decimals ¶
GetERC20Decimals calls a contract's decimal function
func (*ETH) GetFilterChanges ¶
GetFilterChanges gets filtered entities, since last poll or set filter
func (*ETH) GetLatestBlock ¶
GetLatestBlock with or without full transactions array
func (*ETH) GetPeerCount ¶
GetPeerCount gets current peer count
func (*ETH) GetPendingFilterChanges ¶
GetPendingFilterChanges gets all pending transactions, filtered, since last poll or set filter
func (*ETH) GetPendingTransactions ¶
func (e *ETH) GetPendingTransactions() ([]types.Transaction, error)
GetPendingTransactions gets full array of pending transactions
func (*ETH) GetRawBalanceAtBlock ¶
GetRawBalanceAtBlock returns the balance of an address at a given blockNumber as a hex string
func (*ETH) GetRawTokenBalanceAtBlock ¶
GetRawTokenBalanceAtBlock returns the token balance of an address at a given blockNumber as a hex string
func (*ETH) GetTokenBalanceAtBlock ¶
GetTokenBalanceAtBlock returns the token balance of an address at a given blockNumber as a big.Int
func (*ETH) GetTransactionByHash ¶
func (e *ETH) GetTransactionByHash(hash string) (types.Transaction, error)
GetTransactionByHash gets a transaction by transaction hash
func (*ETH) GetTransactionReceipt ¶
GetTransactionReceipt gets the transaction receipt ofr a specific transaction hash
func (*ETH) GetUncleByBlockHashAndIndex ¶
GetUncleByBlockHashAndIndex retrieves the index-nth uncle of the block with the hash blockHash
func (*ETH) GetUncleByBlockNumberAndIndex ¶
func (e *ETH) GetUncleByBlockNumberAndIndex(blockNumber string, index string) (b types.Block, err error)
GetUncleByBlockNumberAndIndex retrieves the index-nth uncle of the block with the number blockNumber
func (*ETH) GetVersion ¶
GetVersion gets current eth client version string
func (*ETH) MakeRequest ¶
MakeRequest to server
func (*ETH) MakeRequestRaw ¶
MakeRequestRaw to server
func (*ETH) NewBlockNumberSubscription ¶
NewBlockNumberSubscription parity_subscribe to eth_blockNumber
func (*ETH) NewHeadsSubscription ¶
func (e *ETH) NewHeadsSubscription() (r chan *types.BlockHeader, err error)
NewHeadsSubscription eth_subscribe to newHeads
func (*ETH) NewPendingTransactionsSubscription ¶
NewPendingTransactionsSubscription eth_subscribe to newPendingTransactions
func (*ETH) SetPendingTransactionsFilter ¶
SetPendingTransactionsFilter sets pending transaction filter for ETHGetFilterChanges
func (*ETH) Subscribe ¶
func (e *ETH) Subscribe(receiver chan *json.RawMessage, method string, event string, params ...interface{}) error
Subscribe to topic
func (*ETH) TraceReplayBlockTransactions ¶
type ETHInterface ¶
type ETHInterface interface { CallContractFunction(function string, address string, gas string) (string, error) CallContractFunctionBigInt(function string, address string) (*big.Int, error) CallContractFunctionInt64(function string, address string) (int64, error) GetBalanceAtBlock(address, blockNumber string) (*big.Int, error) GetBlockByNumber(number string) (b types.Block, err error) GetBlockNumber() (int64, error) GetBlockTransactionCountByNumber(number string) (count string, err error) GetClient() (string, error) GetCode(a string) ([]byte, error) GetContractName(address string) (string, error) GetContractSymbol(address string) (string, error) GetContractTotalSupply(address string) (*big.Int, error) GetERC20Decimals(address string) (uint8, error) GetFilterChanges(id string) (t []interface{}, err error) GetLatestBlock() (b types.Block, err error) GetPeerCount() (peers int64, err error) GetPendingFilterChanges(id string) (t []string, err error) GetPendingTransactions() ([]types.Transaction, error) GetRawBalanceAtBlock(address, blockNumber string) (string, error) GetRawTokenBalanceAtBlock(address, token, blockNumber string) (string, error) GetTokenBalanceAtBlock(address, token, blockNumber string) (*big.Int, error) GetTransactionByHash(hash string) (types.Transaction, error) GetTransactionReceipt(hash string) (r types.Receipt, err error) GetUncleByBlockHashAndIndex(hash string, index string) (b types.Block, err error) GetUncleByBlockNumberAndIndex(blockNumber string, index string) (b types.Block, err error) GetVersion() (ver string, err error) TraceBlock(blockNumber string) ([]types.Trace, error) TraceReplayBlockTransactions(blockNumber string, traceTypes ...string) ([]types.TransactionReplay, error) MakeRequest(result interface{}, method string, params ...interface{}) error NewBlockNumberSubscription() (r chan *int64, err error) NewHeadsSubscription() (r chan *types.BlockHeader, err error) NewPendingTransactionsSubscription() (r chan *string, err error) SetPendingTransactionsFilter() (id string, err error) Start() error Stop() Subscribe(receiver chan *json.RawMessage, method string, event string, params ...interface{}) error }
ETHInterface defines the packages interface