Transfer
type TransferBuilder
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
type Transfer
Transfer transaction type, it's a opaque data type.
func NewTransfer(builder TransferBuilder)
func NewTransfer(builder TransferBuilder) *TransferCreate a new Transfer transaction.
Get the signature in the Transfer transaction.
func (*Transfer) GetBytes
func (*Transfer) GetBytes() []uint8Get the encoded bytes used to create the L3 signature.
func (*Transfer) TxHash
func (*Transfer) TxHash() []uint8Get the transaction hash of Transfer transaction.
func (*Transfer) JsonStr
func (*Transfer) JsonStr() stringGet the json string of the Transfer transaction.
func (*Transfer) IsValid
func (*Transfer) IsValid() boolCheck 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
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
func (*Transfer) GetSignature() ZkLinkSignaturefunc (*Transfer) IsSignatureValid
func (*Transfer) IsSignatureValid() boolCheck if the L3 signature in the transaction is valid or not.
func (*Transfer) GetEthSignMsg
func (*Transfer) GetEthSignMsg(tokenSymbol string) stringGet the message that used to create the Ethereum signature.
func (*Transfer) EthSignature
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
func (*Transfer) SubmitterSignature(signer *ZkLinkSigner) (ZkLinkSignature, error)Create the submitter signature.
input:
signer: ZkLinkSigner
func (*Transfer) ToZklinkTx
func (*Withdraw) ToZklinkTx() ZkLinkTxChange the transaction to the ZkLinkTx
Last updated
Was this helpful?