type TransferBuilder struct {
AccountId AccountId
ToAddress ZkLinkAddress
FromSubAccountId SubAccountId
ToSubAccountId SubAccountId
Token TokenId
Amount BigUint
Fee BigUint
Nonce Nonce
Timestamp TimeStamp
}
Builder is used to build Transfer transaction
Transfer transaction type, it's a opaque data type.
func NewTransfer(builder TransferBuilder) *Transfer
Create a new Transfer transaction.
Get the signature in the Transfer transaction.
func (*Transfer) GetBytes() []uint8
Get the encoded bytes used to create the L3 signature.
func (*Transfer) TxHash() []uint8
Get the transaction hash of Transfer transaction.
func (*Transfer) JsonStr() string
Get the json string of the Transfer transaction.
func (*Transfer) IsValid() bool
Check if all the fields in Withdraw are valid. For example, if the ChainId
is exceeded the maximum ChainId, it will return false.
func (*Transfer) CreateSignedTx(signer *ZkLinkSigner) (*Transfer, error)
Sign the Transfer transaction with the ZkLinkSigner, L1 signature and L3 signature will be created.
input:
- signer: ZkLinkSigner
func (*Transfer) GetSignature() ZkLinkSignature
func (*Transfer) IsSignatureValid() bool
Check if the L3 signature in the transaction is valid or not.
func (*Transfer) GetEthSignMsg(tokenSymbol string) string
Get the message that used to create the Ethereum signature.
func (*Transfer) EthSignature(ethSigner *EthSigner, tokenSymbol string) (TxLayer1Signature, error)
Create Ethereum signature, returns a TxLayer1Signature
input:
- ethSigner: EthSigner
- tokenSymbol: the symbol string of the token, for example,
USDT
func (*Transfer) SubmitterSignature(signer *ZkLinkSigner) (ZkLinkSignature, error)
Create the submitter signature.
input:
- signer: ZkLinkSigner
func (*Withdraw) ToZklinkTx() ZkLinkTx
Change the transaction to the ZkLinkTx