contract

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MPL-2.0 Imports: 7 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallOpts added in v0.1.1

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 added in v0.1.1

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

func (*Contract) Txn

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

type ContractOption added in v0.1.1

type ContractOption func(*Opts)

func WithEIP1559 added in v0.1.2

func WithEIP1559() ContractOption

func WithJsonRPC added in v0.1.1

func WithJsonRPC(client *jsonrpc.Eth) ContractOption

func WithJsonRPCEndpoint added in v0.1.1

func WithJsonRPCEndpoint(endpoint string) ContractOption

func WithProvider added in v0.1.1

func WithProvider(provider Provider) ContractOption

func WithSender added in v0.1.1

func WithSender(sender ethgo.Key) ContractOption

type Opts added in v0.1.1

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

type Provider added in v0.1.1

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)
}

Txn is the transaction object returned

func DeployContract

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

type TxnOpts added in v0.1.1

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