contract

package
v0.0.0-...-e4f0010 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 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 Contract

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

Contract is an Ethereum contract

func NewContract

func NewContract(addr web3.Address, abi *abi.ABI, provider *jsonrpc.Client) *Contract

NewContract creates a new contract instance

func (*Contract) ABI

func (c *Contract) ABI() *abi.ABI

ABI returns the abi of the contract

func (*Contract) Addr

func (c *Contract) Addr() web3.Address

Addr returns the address of the contract

func (*Contract) Call

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

Call calls a method in the contract

func (*Contract) EstimateGas

func (c *Contract) EstimateGas(method string, args ...interface{}) (uint64, error)

EstimateGas estimates the gas for a contract call

func (*Contract) Event

func (c *Contract) Event(name string) (*Event, bool)

Event returns a specific event

func (*Contract) SetFrom

func (c *Contract) SetFrom(addr web3.Address)

SetFrom sets the origin of the calls

func (*Contract) Txn

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

Txn creates a new transaction object

type Event

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

Event is a solidity event

func (*Event) Encode

func (e *Event) Encode() web3.Hash

Encode encodes an event

func (*Event) ParseLog

func (e *Event) ParseLog(log *web3.Log) (map[string]interface{}, error)

ParseLog parses a log

type NodeProvider

type NodeProvider interface {
}

NodeProvider handles the interactions with the Ethereum 1x node

type Txn

type Txn struct {
	From     web3.Address
	Addr     *web3.Address
	Provider *jsonrpc.Client
	Method   *abi.Method
	Args     []interface{}
	Data     []byte
	Bin      []byte
	GasLimit uint64
	GasPrice uint64
	Value    *big.Int
	Hash     web3.Hash
	Receipt  *web3.Receipt
}

Txn is a transaction object

func DeployContract

func DeployContract(provider *jsonrpc.Client, from web3.Address, abi *abi.ABI, bin []byte, args ...interface{}) *Txn

DeployContract deploys a contract

func (*Txn) AddArgs

func (t *Txn) AddArgs(args ...interface{}) *Txn

AddArgs is used to set the arguments of the transaction

func (*Txn) ConvertToWeb3Transaction

func (t *Txn) ConvertToWeb3Transaction() (*web3.Transaction, error)

func (*Txn) EstimateGas

func (t *Txn) EstimateGas() (uint64, error)

EstimateGas estimates the gas for the call

func (*Txn) GetReceipt

func (t *Txn) GetReceipt() *web3.Receipt

Receipt returns the receipt of the transaction after wait

func (*Txn) SetGasLimit

func (t *Txn) SetGasLimit(gasLimit uint64) *Txn

SetGasLimit sets the gas limit of the transaction

func (*Txn) SetGasPrice

func (t *Txn) SetGasPrice(gasPrice uint64) *Txn

SetGasPrice sets the gas price of the transaction

func (*Txn) SetValue

func (t *Txn) SetValue(v *big.Int) *Txn

SetValue sets the value for the txn

func (*Txn) SignAndSend

func (t *Txn) SignAndSend(key *wallet.Key, chainID uint64) error

Signs and sends the transaction to the network

func (*Txn) SignSendAndWait

func (t *Txn) SignSendAndWait(key *wallet.Key, chainID uint64) error

SignSendAndWait is a blocking query that combines both SignAndSend and Wait functions

func (*Txn) Validate

func (t *Txn) Validate() error

Validate validates the arguments of the transaction

func (*Txn) Wait

func (t *Txn) Wait() error

Wait waits till the transaction is mined

Directories

Path Synopsis
builtin
ens
Code generated by go-web3/abigen.
Code generated by go-web3/abigen.
erc20
Code generated by go-web3/abigen.
Code generated by go-web3/abigen.

Jump to

Keyboard shortcuts

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