Documentation ¶
Index ¶
- func CalcGasCost(gasLimit uint64, gasPrice *big.Int) *big.Int
- func IsValidAddress(iaddress interface{}) bool
- func IsZeroAddress(iaddress interface{}) bool
- func LogTopicHash(fnsig string) common.Hash
- func PublicKeyBytesToAddress(publicKey []byte) common.Address
- func SigRSV(isig interface{}) ([32]byte, [32]byte, uint8)
- func ToDecimal(ivalue interface{}, decimals int) decimal.Decimal
- func ToWei(iamount interface{}, decimals int) *big.Int
- type Address
- type Handle
- func (h *Handle) CreateSign(priKey []byte, data []byte) (signature string, err error)
- func (h *Handle) CreateTxData(priKey []byte, toAddr string, wei *big.Int) (rawTX string, err error)
- func (h *Handle) CreateTxDataAdvanced(priKey []byte, toAddr string, wei *big.Int, gasLimit uint64, gasPrice *big.Int, ...) (rawTX string, err error)
- func (h *Handle) GetBalance(address string) (*big.Int, error)
- func (h *Handle) GetBlock(number *big.Int) (*types.Block, error)
- func (h *Handle) GetBlockHeader(number *big.Int) (*types.Header, error)
- func (h *Handle) GetChainID() *big.Int
- func (h *Handle) GetClient() *ethclient.Client
- func (h *Handle) IsContract(address string) (bool, error)
- func (h *Handle) IsValidAddress(address string) bool
- func (h *Handle) SendRawTX(rawTx string) (txHash string, err error)
- func (h *Handle) SetChainID(id int64)
- func (h *Handle) TransferUsePriKey(priKey []byte, toAddr string, wei *big.Int) (txHash string, err error)
- type PriKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcGasCost ¶
CalcGasCost calculate gas cost given gas limit (units) and gas price (wei)
func IsValidAddress ¶
func IsValidAddress(iaddress interface{}) bool
IsValidAddress validate hex address
func IsZeroAddress ¶
func IsZeroAddress(iaddress interface{}) bool
IsZeroAddress validate if it's a 0 address
func LogTopicHash ¶
LogTopicHash generates the log topic hash given the event function declaration signature
func PublicKeyBytesToAddress ¶
PublicKeyBytesToAddress returns the public address derived from a public key
Types ¶
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
func NewServiceHandle ¶
NewServiceHandle dsn demo http://127.0.0.1:8545 wss://mainnet.infura.io/ws/v3/xxxxxxxx https://mainnet.infura.io/v3/xxxxxxxx
func (*Handle) CreateSign ¶
CreateSign 签名
func (*Handle) CreateTxData ¶
CreateTxData 生成原始交易 - 简单
func (*Handle) CreateTxDataAdvanced ¶
func (h *Handle) CreateTxDataAdvanced(priKey []byte, toAddr string, wei *big.Int, gasLimit uint64, gasPrice *big.Int, chainID *big.Int, data []byte) (rawTX string, err error)
CreateTxDataAdvanced 生成原始交易 - 高级
func (*Handle) GetBalance ¶
GetBalance 获取额度
func (*Handle) GetBlockHeader ¶
GetBlockHeader 查询区块头 - number = nil 查询最新区块的头信息
func (*Handle) IsContract ¶
IsContract 检测是否为合约地址
func (*Handle) IsValidAddress ¶
IsValidAddress 校验地址
type PriKey ¶
type PriKey struct {
// contains filtered or unexported fields
}
func NewPriKeyRandom ¶
func NewPriKeyRandom() *PriKey
Click to show internal directories.
Click to hide internal directories.