contract

package
v0.0.0-...-007bb23 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallOpts

type CallOpts struct {
	Block ethgo.BlockNumber
	From  ethgo.Address
}

type Contract

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

Contract is a wrapper to make abi calls to contract with a state provider

func NewContract

func NewContract(addr ethgo.Address, abi *abi.ABI, opts ...ContractOption) *Contract

func (*Contract) Call

func (a *Contract) Call(method string, block ethgo.BlockNumber, args ...interface{}) (map[string]interface{}, error)

func (*Contract) GetABI

func (a *Contract) GetABI() *abi.ABI

func (*Contract) Txn

func (a *Contract) Txn(method string, args ...interface{}) (Txn, error)

type ContractOption

type ContractOption func(*Opts)

func WithEIP1559

func WithEIP1559() ContractOption

func WithJsonRPC

func WithJsonRPC(client *jsonrpc.Eth) ContractOption

func WithJsonRPCEndpoint

func WithJsonRPCEndpoint(endpoint string) ContractOption

func WithProvider

func WithProvider(provider Provider) ContractOption

func WithSender

func WithSender(sender ethgo.Key) ContractOption

type Opts

type Opts struct {
	JsonRPCEndpoint string
	JsonRPCClient   *jsonrpc.Eth
	Provider        Provider
	Sender          ethgo.Key
	EIP1559         bool
}

type Provider

type Provider interface {
	Call(ethgo.Address, []byte, *CallOpts) ([]byte, error)
	Txn(ethgo.Address, ethgo.Key, []byte) (Txn, error)
}

Provider handles the interactions with the Ethereum 1x node

type Txn

type Txn interface {
	Hash() ethgo.Hash
	WithOpts(opts *TxnOpts)
	Do() error
	Wait() (*ethgo.Receipt, error)
	BuildData() string
	GetInput() []byte
}

Txn is the transaction object returned

func DeployContract

func DeployContract(abi *abi.ABI, bin []byte, args []interface{}, opts ...ContractOption) (Txn, error)

type TxnOpts

type TxnOpts struct {
	Value    *big.Int
	GasPrice uint64
	GasLimit uint64
	Nonce    uint64
}

Jump to

Keyboard shortcuts

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