Documentation
¶
Index ¶
- type Client
- func (c *Client) Request(ctx context.Context, method types.RPCMethod, params ...any) (json.RawMessage, error)
- func (c *Client) SendETH(ctx context.Context, to common.Address, amount, chainID *big.Int, ...) (common.Hash, error)
- func (c *Client) SendETH1559(ctx context.Context, to common.Address, ...) (common.Hash, error)
- func (c *Client) SendRawTransaction(ctx context.Context, tx *ethTypes.Transaction, out *common.Hash) error
- func (c *Client) SignMessage(msg []byte) ([]byte, error)
- func (c *Client) SignTypedData(typedDataJSON string) ([]byte, error)
- type HTTPTransport
- type IPCTransport
- type Option
- type Transport
- type WebSocketTransport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a JSON-RPC Client that supports fallback
func (*Client) Request ¶
func (c *Client) Request(ctx context.Context, method types.RPCMethod, params ...any) (json.RawMessage, error)
Request calls all Transports in sequence and returns the first successful result
func (*Client) SendETH ¶
func (c *Client) SendETH(ctx context.Context, to common.Address, amount, chainID *big.Int, gasLimit, nonce uint64, maxFeePerGas, maxPriorityFeePerGas *big.Int) (common.Hash, error)
SendETH sends ETH
func (*Client) SendETH1559 ¶
func (c *Client) SendETH1559(ctx context.Context, to common.Address, amount, maxFeePerGas, maxPriorityFeePerGas, chainID *big.Int, gasLimit, nonce uint64, accessList ethTypes.AccessList) (common.Hash, error)
SendETH1559 sends an EIP-1559 transaction
func (*Client) SendRawTransaction ¶
func (c *Client) SendRawTransaction(ctx context.Context, tx *ethTypes.Transaction, out *common.Hash) error
SendRawTransaction sends a raw transaction method: eth_sendRawTransaction
func (*Client) SignMessage ¶
SignMessage signs a message
type HTTPTransport ¶
type HTTPTransport struct {
// contains filtered or unexported fields
}
HTTPTransport struct
func NewHTTPTransport ¶
func NewHTTPTransport(endpoint string) (*HTTPTransport, error)
NewHTTPTransport create a new HTTPTransport instance
type IPCTransport ¶
type IPCTransport struct {
// contains filtered or unexported fields
}
IPCTransport struct
func NewIPCTransport ¶
func NewIPCTransport(path string) (*IPCTransport, error)
NewIPCTransport create a new IPCTransport instance
type Option ¶
type Option func(*config) error
Option config function type
func WithPollingInterval ¶
WithPollingInterval sets the polling interval
func WithPrivateKey ¶
WithPrivateKey sets the private key
type Transport ¶
type Transport interface {
Request(ctx context.Context, method types.RPCMethod, params ...any) (json.RawMessage, error)
}
Transport is a JSON-RPC Client interface
type WebSocketTransport ¶
type WebSocketTransport struct {
// contains filtered or unexported fields
}
WebSocketTransport struct
func NewWebSocketTransport ¶
func NewWebSocketTransport(endpoint string) (*WebSocketTransport, error)
NewWebSocketTransport create a new WebSocketTransport instance