klayfw

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoKeyStore = errors.New("no keystore or file for account")
	ErrKeyDecrypt = errors.New("private key decryption failed")
)
View Source
var ErrNoCode = bind.ErrNoCode

Functions

This section is empty.

Types

type BoundContract

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

func BindContract

func BindContract(client *client.Client, contract *sol.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() *client.Client

func (*BoundContract) DeployContract

func (c *BoundContract) DeployContract(opts *bind.TransactOpts,
	params ...interface{}) (common.Address, *types.Transaction, error)

DeployContract deploys a contract onto the Ethereum blockchain and binds the deployment address with a Go wrapper.

func (*BoundContract) SetAddress

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

func (*BoundContract) SetClient

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

func (*BoundContract) SetTransact

func (contract *BoundContract) SetTransact(fn TransactFunc)

func (*BoundContract) Source

func (contract *BoundContract) Source() *sol.Contract

func (*BoundContract) Transact

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

Transact invokes the (paid) contract method with params as input values.

func (*BoundContract) Transfer

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

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type KeyCache

type KeyCache interface {
	SetPath(account common.Address, path string) bool
	UnsetPath(account common.Address, path string)
	PrivateKey(account common.Address, password string) (key *ecdsa.PrivateKey, ok bool)
	SetPrivateKey(account common.Address, pk *ecdsa.PrivateKey)
	UnsetKey(account common.Address, password string)
	SignerFn(account common.Address, password string) bind.SignerFn
}

func NewKeyCache

func NewKeyCache() KeyCache

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 uint64)
	Get(account common.Address) uint64
	Incr(account common.Address) uint64
	Decr(account common.Address) uint64
}

func NewNonceCache

func NewNonceCache() NonceCache

type Peb

type Peb decimal.Decimal

func BigPeb

func BigPeb(p *big.Int) *Peb

func DecimalPeb

func DecimalPeb(d decimal.Decimal) *Peb

func DecimalToPeb

func DecimalToPeb(d decimal.Decimal) *Peb

func Ston

func Ston(ston uint64) *Peb

func StringPeb

func StringPeb(str string) *Peb

func ToPeb

func ToPeb(amount float64) *Peb

ToPeb converts Klay or tokens amount into Peb amount.

func (*Peb) Add

func (p *Peb) Add(amount *Peb) *Peb

Add adds two amounts togKlay and returns a new amount.

func (Peb) Bytes

func (p Peb) Bytes() []byte

func (*Peb) Div

func (p *Peb) Div(m int64) *Peb

func (*Peb) Klay

func (p *Peb) Klay() float64

func (*Peb) Mul

func (p *Peb) Mul(m int64) *Peb

func (*Peb) Scan

func (p *Peb) Scan(v interface{}) error

func (*Peb) SplitEqual

func (p *Peb) SplitEqual(parts int) []*Peb

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 (*Peb) Ston

func (p *Peb) Ston() uint64

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

func (Peb) String

func (p Peb) String() string

func (Peb) StringSton

func (p Peb) StringSton() string

func (*Peb) Sub

func (p *Peb) Sub(amount *Peb) *Peb

Sub substracts two amounts and returns a new amount.

func (*Peb) ToInt

func (p *Peb) ToInt() *big.Int

func (*Peb) Tokens

func (p *Peb) Tokens() float64

type TransactFunc

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

func NewFeeDelegatedTransactFunc

func NewFeeDelegatedTransactFunc(
	chainID int,
	klayClient *client.Client,
	klayFeeClient klayfee.FeeDelegationClient,
) TransactFunc

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.

Directories

Path Synopsis
Package sol provides a convenient interface for calling the 'solc' Solidity Compiler from Go.
Package sol provides a convenient interface for calling the 'solc' Solidity Compiler from Go.

Jump to

Keyboard shortcuts

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