Documentation
¶
Index ¶
- Constants
- func ABIEncode(parts ...[]byte) []byte
- func EIP712DomainSeparator(name, version string, chainID int64, contract common.Address) []byte
- func EIP712DomainSeparatorNameVersion(name, version string) []byte
- func EIP712Hash(domainSeparator, structHash []byte) []byte
- func GuaranteeNativeAmt(fee *Fee, gasLimitStr, nativeBalStr string, l1FeeStr string, isLegacy bool) (bool, error)
- func IsZeroAddress(address string) bool
- func NewAccountFromMnemonic(mnemonic, path string) (chain.AccountHandler, error)
- func NewAccountFromPrivateKey(privateKey []byte) (chain.AccountHandler, error)
- func NewAccountFromPrivateKeyHex(privateKey string) (chain.AccountHandler, error)
- func NormalizeAddress(address string) string
- func PackPayloadForErc20(function string, params []byte) (string, error)
- func Pad32(b []byte) []byte
- func PublicKey2Address(publicKey []byte) (string, error)
- func RecoverAddress(data, signature []byte) (string, error)
- func UnpackReturnsForErc20(function string, returns []byte) (string, error)
- func ValidAddress(address string) bool
- type Account
- func (a *Account) Address() string
- func (a *Account) PrivateKey() []byte
- func (a *Account) PrivateKeyHex() string
- func (a *Account) PublicKey() []byte
- func (a *Account) PublicKeyHex() string
- func (a *Account) SignData(data []byte) ([]byte, error)
- func (a *Account) VerifySignData(data, sig []byte) bool
- type CallErc20In
- type Fee
- type FeeTiers
- type Ingredient
- type TxBuilder
- func (tx *TxBuilder) Build() error
- func (tx *TxBuilder) ConcatSignature(signature string, isDerFormat bool) (string, error)
- func (tx *TxBuilder) GetSigHash() []string
- func (tx *TxBuilder) GetTxHash() string
- func (tx *TxBuilder) GetUnsignedHex() string
- func (tx *TxBuilder) PrintSignerParams(chain string, index string)
- func (tx *TxBuilder) SetSigHash(sigHash []string)
- func (tx *TxBuilder) SetUnsignedHex(unsignedHex string)
- func (tx *TxBuilder) Sign(privateKey []byte) (string, error)
- type UnpackErc20
Constants ¶
View Source
const ( NetworkEnumForETH string = "1" NetworkEnumForBNB string = "56" NetworkEnumForHT string = "128" NetworkEnumForOKC string = "66" NetworkEnumForAVAXC string = "43114" NetworkEnumForFTM string = "250" NetworkEnumForETC string = "61" NetworkEnumForETHW string = "10001" NetworkEnumForETHF string = "513100" NetworkEnumForFUSE string = "122" NetworkEnumForPOLYGON string = "137" NetworkEnumForAURORA string = "1313161554" NetworkEnumForCAD string = "256256" NetworkEnumForMETIS string = "1088" NetworkEnumForCIC string = "1353" NetworkEnumForRSK string = "30" NetworkEnumForTARA string = "841" NetworkEnumForKLAY string = "8217" NetworkEnumForCRO string = "25" NetworkEnumForCANTO string = "7700" NetworkEnumForCORE string = "1116" NetworkEnumForELA string = "20" NetworkEnumForCFXEVM string = "1030" NetworkEnumForSYSEVM string = "57" NetworkEnumForFEVM string = "314" NetworkEnumForTELOSEVM string = "40" NetworkEnumForARB string = "42161" NetworkEnumForOP string = "10" NetworkEnumForBASE string = "8453" NetworkEnumForLINEA string = "59144" NetworkEnumForZKEVM string = "1101" NetworkEnumForZKSYNC string = "324" NetworkEnumForOPBNB string = "204" NetworkEnumForROLLUX string = "570" NetworkEnumForSCROLL string = "534352" NetworkEnumForSHIBA string = "109" NetworkEnumForMERLIN string = "4200" NetworkEnumForBLAST string = "81457" NetworkEnumForXLAYER string = "196" NetworkEnumForB2 string = "223" NetworkEnumForBTR string = "200901" NetworkEnumForMANTA string = "169" NetworkEnumForSKL string = "2046399126" NetworkEnumForODYSSEY string = "153153" NetworkEnumForONEROOT string = "12193" )
View Source
const ABIERC20 = `` /* 5459-byte string literal not displayed */
View Source
const ABIERC20ForTransferWithData = `` /* 5195-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func EIP712DomainSeparator ¶
func EIP712Hash ¶
func GuaranteeNativeAmt ¶
func GuaranteeNativeAmt(fee *Fee, gasLimitStr, nativeBalStr string, l1FeeStr string, isLegacy bool) (bool, error)
for GuaranteeNativeAmt
func IsZeroAddress ¶
func NewAccountFromMnemonic ¶
func NewAccountFromMnemonic(mnemonic, path string) (chain.AccountHandler, error)
func NewAccountFromPrivateKey ¶
func NewAccountFromPrivateKey(privateKey []byte) (chain.AccountHandler, error)
func NewAccountFromPrivateKeyHex ¶
func NewAccountFromPrivateKeyHex(privateKey string) (chain.AccountHandler, error)
func NormalizeAddress ¶
func PublicKey2Address ¶
func RecoverAddress ¶
func UnpackReturnsForErc20 ¶
func ValidAddress ¶
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func (*Account) PrivateKey ¶
func (*Account) PrivateKeyHex ¶
func (*Account) PublicKeyHex ¶
func (*Account) VerifySignData ¶
type CallErc20In ¶
type CallErc20In struct {
Address string `json:"address,omitempty"`
Owner string `json:"owner,omitempty"`
Spender string `json:"spender,omitempty"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Recipient string `json:"recipient,omitempty"`
Amount string `json:"amount,omitempty"`
Memo string `json:"data,omitempty"`
}
for call contract
type Ingredient ¶
type Ingredient struct {
TxType string `json:"txType" validate:"required,oneof=0 1 2 3 4 5 6"`
ContractAddress string `json:"contractAddress" validate:"required,evm_addr"`
Sender string `json:"sender" validate:"required,evm_addr"`
Recipient string `json:"recipient,omitempty" validate:"omitempty,evm_addr"`
Amount string `json:"amount,omitempty" validate:"omitempty,bigint_gte0"`
Payload string `json:"payload,omitempty" validate:"omitempty,hex_str"`
Memo string `json:"memo,omitempty" validate:"omitempty,hex_str"`
Nonce string `json:"nonce" validate:"required,u64"`
GasPrice string `json:"gasPrice,omitempty" validate:"omitempty,bigint_gt0"`
GasFeeCap string `json:"gasFeeCap,omitempty" validate:"omitempty,bigint_gt0"`
GasTipCap string `json:"gasTipCap,omitempty" validate:"omitempty,bigint_gt0"`
GasLimit string `json:"gasLimit" validate:"required,u64_gt0"`
IsLegacyTx string `json:"isLegacyTx" validate:"required,bool_str"`
}
types
type TxBuilder ¶
type TxBuilder struct {
*Ingredient
// contains filtered or unexported fields
}
types
func NewTxBuilder ¶
func NewTxBuilder(ti *Ingredient, network string) *TxBuilder
func (*TxBuilder) ConcatSignature ¶
func (*TxBuilder) GetSigHash ¶
func (*TxBuilder) GetUnsignedHex ¶
func (*TxBuilder) PrintSignerParams ¶
func (*TxBuilder) SetSigHash ¶
func (*TxBuilder) SetUnsignedHex ¶
type UnpackErc20 ¶
type UnpackErc20 struct {
Function string
CallErc20In
}
for call contract
func UnpackPayloadForErc20 ¶
func UnpackPayloadForErc20(payload string) (*UnpackErc20, error)
Click to show internal directories.
Click to hide internal directories.