erc20

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ERC20_DEFAULT_FEE, _ = new(big.Int).SetString("10000000000000000", 10)
View Source
var GetToken func(tokentype string) string

返回合约地址或空

var Tokens map[string]string

Functions

func DecodeTransferData

func DecodeTransferData(data []byte) (toAddress string, transferAmount *big.Int, err error)

func ERC20Init

func ERC20Init()

func GetLastBlock

func GetLastBlock() *big.Int

func HasToken

func HasToken(name string) bool

func LoadErc20Config

func LoadErc20Config()

func RegisterTokenGetter

func RegisterTokenGetter(callback func(tokentype string) string)

Types

type ERC20Handler

type ERC20Handler struct {
	TokenType string
}

func NewERC20Handler

func NewERC20Handler() *ERC20Handler

func NewERC20TokenHandler

func NewERC20TokenHandler(tokenType string) *ERC20Handler

func (*ERC20Handler) BuildUnsignedTransaction

func (h *ERC20Handler) BuildUnsignedTransaction(fromAddress, fromPublicKey, toAddress string, amount *big.Int, jsonstring string, memo string) (transaction interface{}, digests []string, err error)

jsonstring '{"gasPrice":8000000000,"gasLimit":50000,"tokenType":"BNB"}'

func (*ERC20Handler) FiltTransaction

func (h *ERC20Handler) FiltTransaction(blocknumber uint64, filter ctypes.Filter) (txhashes []string, err error)

func (*ERC20Handler) GetAddressBalance

func (h *ERC20Handler) GetAddressBalance(address string, jsonstring string) (balance ctypes.Balance, err error)

jsonstring:'{"tokenType":"BNB"}'

func (*ERC20Handler) GetDefaultFee

func (h *ERC20Handler) GetDefaultFee() ctypes.Value

func (*ERC20Handler) GetTransactionInfo

func (h *ERC20Handler) GetTransactionInfo(txhash string) (*ctypes.TransactionInfo, error)

func (h *ERC20Handler) GetTransactionInfo(txhash string) (fromAddress string, txOutputs []ctypes.TxOutput, jsonstring string, confirmed bool, fee ctypes.Value, err error) {

func (*ERC20Handler) IsToken

func (h *ERC20Handler) IsToken() bool

func (*ERC20Handler) MakeSignedTransaction

func (h *ERC20Handler) MakeSignedTransaction(rsv []string, transaction interface{}) (signedTransaction interface{}, err error)

func (*ERC20Handler) MakeSignedTransactionByJson

func (h *ERC20Handler) MakeSignedTransactionByJson(rsv []string, txjson string) (signedTransaction interface{}, err error)

func (*ERC20Handler) PublicKeyToAddress

func (h *ERC20Handler) PublicKeyToAddress(pubKeyHex string) (address string, err error)

func (*ERC20Handler) SignTransaction

func (h *ERC20Handler) SignTransaction(hash []string, privateKey interface{}) (rsv []string, err error)

func (*ERC20Handler) SubmitTransaction

func (h *ERC20Handler) SubmitTransaction(signedTransaction interface{}) (ret string, err error)

func (*ERC20Handler) SubmitTransactionByJson

func (h *ERC20Handler) SubmitTransactionByJson(txjson string) (txhash string, err error)

Directories

Path Synopsis
Package abi implements the Ethereum ABI (Application Binary Interface).
Package abi implements the Ethereum ABI (Application Binary Interface).

Jump to

Keyboard shortcuts

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