Skip to content

Latest commit

 

History

History
190 lines (110 loc) · 4.31 KB

eth.mdx

File metadata and controls

190 lines (110 loc) · 4.31 KB

import GoDocLink from '../../components/godoc' import {Address, Hash, Blocktag, Block, Transaction, Receipt} from '../../components/primitives'

Ethereum

GetCode

GetCode returns code at a given address.

code, err := client.Eth().GetCode(address, block)

Params:

  • address : Address of the contract to query.
  • block : Block reference to query the data.

Output:

  • code ([]byte): Bytecode of the contract.

Accounts

Accounts returns a list of addresses owned by client. This endpoint is not enabled in infrastructure providers.

accounts, err := client.Eth().Accounts()

Output:

  • accounts : List of addresses registered in the client.

GetStorageAt

GetStorageAt returns the value from a storage position at a given address.

storage, err := client.Eth().GetStorageAt(addr, slot, block)

Params:

  • addr : Address to query.
  • slot : Slot storage for the address.
  • block : Block reference to query the data.

Output:

  • storage ([]byte): Content of the storage.

BlockNumber

BlockNumber returns the number of most recent block.

number, err := client.Eth().BlockNumber()

Output:

  • number (uint): Number of the most recent block.

GetBlockByNumber

GetBlockByNumber returns information about a block by block number.

block, err := client.Eth().GetBlockByNumber(num, full)

Params:

  • number (uint): Number of the block to query.
  • full (bool): Whether the ouput block should include transactions.

Output:

  • block : Block queried.

GetBlockByHash

GetBlockByHash returns information about a block by hash.

block, err := client.Eth().GetBlockByHash(hash, full)

Params:

  • hash : Hash of the block to query.
  • full (bool): Whether the ouput block should include transactions.

Output:

  • block : Block queried.

GetTransactionByHash

GetTransactionByHash returns a transaction by his hash

transaction, err := client.Eth().GetTransactionByHash(hash)

Params:

  • hash : Hash of the transaction to query.

Output:

  • transaction : Transaction being queried.

SendRawTransaction

SendRawTransaction creates new message call transaction or a contract creation for signed transactions.

hash, err := client.Eth().SendRawTransaction(transaction)

Params:

  • transaction ([]byte): Signed transaction and encoded in RLP format.

Output:

  • hash : Hash of the transaction created.

GetTransactionReceipt

GetTransactionReceipt returns the receipt of a transaction by transaction hash.

receipt, err := client.Eth().GetTransactionReceipt(hash)

Params:

  • hash : Hash of the transaction being queried.

Output:

  • receipt : receipt being queried.

GetNonce

GetNonce returns the number of transactions sent from an address.

nonce, err := client.Eth().GetNonce(address)

Params:

  • address : address of the account to query.

Output:

  • nonce (uint64): next valid nonce for the account.

GetBalance

GetBalance returns the balance of the account of given address.

balance, err := client.Eth().GetBalance(address)

Params:

  • address : address of the account to query.

Output:

  • balance (big.Int): balance of the account in big format.

GasPrice

GasPrice returns the current price per gas in wei.

price, err := client.Eth().GasPrice()

Output:

  • price (big.Int): gas price in wei.