jsonrpc

package
v0.0.0-...-99888be Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: MPL-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgBig

type ArgBig big.Int

func (*ArgBig) Big

func (a *ArgBig) Big() *big.Int

func (*ArgBig) UnmarshalText

func (a *ArgBig) UnmarshalText(input []byte) error

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the jsonrpc client

func NewClient

func NewClient(addr string, opts ...ConfigOption) (*Client, error)

func (*Client) Call

func (c *Client) Call(method string, out interface{}, params ...interface{}) error

Call makes a jsonrpc call

func (*Client) Close

func (c *Client) Close() error

Close closes the transport

func (*Client) Debug

func (c *Client) Debug() *Debug

Debug returns the reference to the debug namespace

func (*Client) Eth

func (c *Client) Eth() *Eth

Eth returns the reference to the eth namespace

func (*Client) Net

func (c *Client) Net() *Net

Net returns the reference to the net namespace

func (*Client) SetMaxConnsLimit

func (c *Client) SetMaxConnsLimit(count int)

SetMaxConnsLimit sets the maximum number of connections that can be established with a host

func (*Client) Subscribe

func (c *Client) Subscribe(method string, callback func(b []byte)) (func() error, error)

Subscribe starts a new subscription

func (*Client) SubscriptionEnabled

func (c *Client) SubscriptionEnabled() bool

SubscriptionEnabled returns true if the subscription endpoints are enabled

func (*Client) Web3

func (c *Client) Web3() *Web3

Web3 returns the reference to the web3 namespace

type Config

type Config struct {
	// contains filtered or unexported fields
}

type ConfigOption

type ConfigOption func(*Config)

func WithHeaders

func WithHeaders(headers map[string]string) ConfigOption

type Debug

type Debug struct {
	// contains filtered or unexported fields
}

func (*Debug) TraceTransaction

func (d *Debug) TraceTransaction(hash ethgo.Hash, opts TraceTransactionOptions) (*TransactionTrace, error)

type Eth

type Eth struct {
	// contains filtered or unexported fields
}

Eth is the eth namespace

func (*Eth) Accounts

func (e *Eth) Accounts() ([]ethgo.Address, error)

Accounts returns a list of addresses owned by client.

func (*Eth) BlockNumber

func (e *Eth) BlockNumber() (uint64, error)

BlockNumber returns the number of most recent block.

func (*Eth) Call

func (e *Eth) Call(msg *ethgo.CallMsg, block ethgo.BlockNumber, override ...*ethgo.StateOverride) (string, error)

Call executes a new message call immediately without creating a transaction on the blockchain.

func (*Eth) ChainID

func (e *Eth) ChainID() (*big.Int, error)

ChainID returns the id of the chain

func (*Eth) EstimateGas

func (e *Eth) EstimateGas(msg *ethgo.CallMsg) (uint64, error)

EstimateGas generates and returns an estimate of how much gas is necessary to allow the transaction to complete.

func (*Eth) EstimateGasContract

func (e *Eth) EstimateGasContract(bin []byte) (uint64, error)

EstimateGasContract estimates the gas to deploy a contract

func (*Eth) FeeHistory

func (e *Eth) FeeHistory(blockCount uint64, newestBlock ethgo.BlockNumber, rewardPercentiles []float64) (*FeeHistory, error)

FeeHistory returns base fee per gas and transaction effective priority fee

func (*Eth) GasPrice

func (e *Eth) GasPrice() (uint64, error)

GasPrice returns the current price per gas in wei.

func (*Eth) GetBalance

func (e *Eth) GetBalance(addr ethgo.Address, blockNumber ethgo.BlockNumberOrHash) (*big.Int, error)

GetBalance returns the balance of the account of given address.

func (*Eth) GetBlockByHash

func (e *Eth) GetBlockByHash(hash ethgo.Hash, full bool) (*ethgo.Block, error)

GetBlockByHash returns information about a block by hash.

func (*Eth) GetBlockByNumber

func (e *Eth) GetBlockByNumber(i ethgo.BlockNumber, full bool) (*ethgo.Block, error)

GetBlockByNumber returns information about a block by block number.

func (*Eth) GetCode

func (e *Eth) GetCode(addr ethgo.Address, block ethgo.BlockNumberOrHash) (string, error)

GetCode returns the code of a contract

func (*Eth) GetFilterChanges

func (e *Eth) GetFilterChanges(id string) ([]*ethgo.Log, error)

GetFilterChanges returns the filter changes for log filters

func (*Eth) GetFilterChangesBlock

func (e *Eth) GetFilterChangesBlock(id string) ([]ethgo.Hash, error)

GetFilterChangesBlock returns the filter changes for block filters

func (*Eth) GetLogs

func (e *Eth) GetLogs(filter *ethgo.LogFilter) ([]*ethgo.Log, error)

GetLogs returns an array of all logs matching a given filter object

func (*Eth) GetNonce

func (e *Eth) GetNonce(addr ethgo.Address, blockNumber ethgo.BlockNumberOrHash) (uint64, error)

GetNonce returns the nonce of the account

func (*Eth) GetStorageAt

func (e *Eth) GetStorageAt(addr ethgo.Address, slot ethgo.Hash, block ethgo.BlockNumberOrHash) (ethgo.Hash, error)

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

func (*Eth) GetTransactionByHash

func (e *Eth) GetTransactionByHash(hash ethgo.Hash) (*ethgo.Transaction, error)

GetTransactionByHash returns a transaction by his hash

func (*Eth) GetTransactionReceipt

func (e *Eth) GetTransactionReceipt(hash ethgo.Hash) (*ethgo.Receipt, error)

GetTransactionReceipt returns the receipt of a transaction by transaction hash.

func (*Eth) MaxPriorityFeePerGas

func (e *Eth) MaxPriorityFeePerGas() (*big.Int, error)

MaxPriorityFeePerGas returns a fee per gas that is an estimate of how much you can pay as a priority fee, or 'tip', to get a transaction included in the current block (EIP-1559).

func (*Eth) NewBlockFilter

func (e *Eth) NewBlockFilter() (string, error)

NewBlockFilter creates a new block filter

func (*Eth) NewFilter

func (e *Eth) NewFilter(filter *ethgo.LogFilter) (string, error)

NewFilter creates a new log filter

func (*Eth) SendRawTransaction

func (e *Eth) SendRawTransaction(data []byte) (ethgo.Hash, error)

SendRawTransaction sends a signed transaction in rlp format.

func (*Eth) SendTransaction

func (e *Eth) SendTransaction(txn *ethgo.Transaction) (ethgo.Hash, error)

SendTransaction creates new message call transaction or a contract creation.

func (*Eth) UninstallFilter

func (e *Eth) UninstallFilter(id string) (bool, error)

UninstallFilter uninstalls a filter

type FeeHistory

type FeeHistory struct {
	OldestBlock  *big.Int     `json:"oldestBlock"`
	Reward       [][]*big.Int `json:"reward,omitempty"`
	BaseFee      []*big.Int   `json:"baseFeePerGas,omitempty"`
	GasUsedRatio []float64    `json:"gasUsedRatio"`
}

FeeHistory is the result of the eth_feeHistory endpoint

func (*FeeHistory) UnmarshalJSON

func (f *FeeHistory) UnmarshalJSON(data []byte) error

type Net

type Net struct {
	// contains filtered or unexported fields
}

Net is the net namespace

func (*Net) Listening

func (n *Net) Listening() (bool, error)

Listening returns true if client is actively listening for network connections

func (*Net) PeerCount

func (n *Net) PeerCount() (uint64, error)

PeerCount returns number of peers currently connected to the client

func (*Net) Version

func (n *Net) Version() (uint64, error)

Version returns the current network id

type StructLogs

type StructLogs struct {
	Depth   int
	Gas     int
	GasCost int
	Op      string
	Pc      int
	Memory  []string
	Stack   []string
	Storage map[string]string
}

type TraceTransactionOptions

type TraceTransactionOptions struct {
	EnableMemory     bool                   `json:"enableMemory"`
	DisableStack     bool                   `json:"disableStack"`
	DisableStorage   bool                   `json:"disableStorage"`
	EnableReturnData bool                   `json:"enableReturnData"`
	Timeout          string                 `json:"timeout,omitempty"`
	Tracer           string                 `json:"tracer,omitempty"`
	TracerConfig     map[string]interface{} `json:"tracerConfig,omitempty"`
}

type TransactionTrace

type TransactionTrace struct {
	Gas         uint64
	ReturnValue string
	StructLogs  []*StructLogs
}

type Web3

type Web3 struct {
	// contains filtered or unexported fields
}

Web3 is the web3 namespace

func (*Web3) ClientVersion

func (w *Web3) ClientVersion() (string, error)

ClientVersion returns the current client version

func (*Web3) Sha3

func (w *Web3) Sha3(val []byte) ([]byte, error)

Sha3 returns Keccak-256 (not the standardized SHA3-256) of the given data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL