util

package
v1.64.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoundContract

type BoundContract struct {
	*bind.BoundContract
	// contains filtered or unexported fields
}

func BindContract

func BindContract(client *ethclient.Client, contract *Contract) (*BoundContract, error)

func (*BoundContract) ABI

func (contract *BoundContract) ABI() abi.ABI

func (*BoundContract) Address

func (contract *BoundContract) Address() common.Address

func (*BoundContract) Client

func (contract *BoundContract) Client() *ethclient.Client

func (*BoundContract) SetAddress

func (contract *BoundContract) SetAddress(address common.Address)

func (*BoundContract) SetClient

func (contract *BoundContract) SetClient(client *ethclient.Client)

func (*BoundContract) SetTransact

func (contract *BoundContract) SetTransact(fn TransactFunc)

func (*BoundContract) Source

func (contract *BoundContract) Source() *Contract

func (*BoundContract) Transact

func (c *BoundContract) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

func (*BoundContract) Transfer

func (c *BoundContract) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

type Contract

type Contract struct {
	Name            string
	SourcePath      string
	CompilerVersion string
	Address         common.Address

	ABI []byte
	Bin string
}

type NonceCache

type NonceCache interface {
	Serialize(account common.Address, fn func() error) error
	Sync(account common.Address, syncFn func() (uint64, error))

	Set(account common.Address, nonce int64)
	Get(account common.Address) int64
	Incr(account common.Address) int64
	Decr(account common.Address) int64
}

func NewNonceCache

func NewNonceCache() NonceCache

type TransactFunc

type TransactFunc func(opts *bind.TransactOpts, contract *common.Address, input []byte) (*types.Transaction, error)

type Uniquify

type Uniquify interface {
	// Call executes only one callable with same id at a time.
	// Multilpe asynchronous calls with same id will be executed sequentally.
	Call(id string, callable func() error) error
}

Uniquify is a type of advanced mutex. It allows to create named resource locks.

func NewUniquify

func NewUniquify() Uniquify

NewUniquify returns a new thread-safe uniquify object.

type Wei

type Wei decimal.Decimal

func BigWei

func BigWei(w *big.Int) *Wei

func DecimalToWei

func DecimalToWei(d decimal.Decimal) *Wei

func DecimalWei

func DecimalWei(d decimal.Decimal) *Wei

func Gwei

func Gwei(gwei uint64) *Wei

func StringWei

func StringWei(str string) *Wei

func ToWei

func ToWei(amount float64) *Wei

ToWei converts ether or tokens amount into Wei amount.

func (*Wei) Add

func (w *Wei) Add(amount *Wei) *Wei

Add adds two amounts together and returns a new amount.

func (Wei) Bytes

func (w Wei) Bytes() []byte

func (*Wei) Div

func (w *Wei) Div(m int64) *Wei

func (*Wei) Ether

func (w *Wei) Ether() float64

func (*Wei) Gwei

func (w *Wei) Gwei() uint64

Gwei is an unsafe way to represent Wei as uint64, used for gas price reporting and should not be used for math.

func (*Wei) Mul

func (w *Wei) Mul(m int64) *Wei

func (*Wei) Scan

func (w *Wei) Scan(v interface{}) error

func (*Wei) SplitEqual

func (w *Wei) SplitEqual(parts int) []*Wei

SplitEqual splits the amount into n-1 equal amounts and one remainder. Example: (1000).SplitEqual(7) yields [142 142 142 142 142 142 148]

func (Wei) String

func (w Wei) String() string

func (Wei) StringGwei

func (w Wei) StringGwei() string

func (*Wei) Sub

func (w *Wei) Sub(amount *Wei) *Wei

Sub subtracts two amounts and returns a new amount.

func (*Wei) ToInt

func (w *Wei) ToInt() *big.Int

func (*Wei) Tokens

func (w *Wei) Tokens() float64

Jump to

Keyboard shortcuts

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