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) *Transfer

Create a new Transfer transaction.

Get the signature in the Transfer transaction.

func (*Transfer) GetBytes

func (*Transfer) GetBytes() []uint8

Get the encoded bytes used to create the L3 signature.

func (*Transfer) TxHash

func (*Transfer) TxHash() []uint8

Get the transaction hash of Transfer transaction.

func (*Transfer) JsonStr

func (*Transfer) JsonStr() string

Get the json string of the Transfer transaction.

func (*Transfer) IsValid

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

func (*Transfer) CreateSignedTx(signer *ZkLinkSigner) (*Transfer, error)

Sign the Transfer transaction with the ZkLinkSigner, L1 signature and L3 signature will be created.

input:

func (*Transfer) GetSignature

func (*Transfer) GetSignature() ZkLinkSignature

func (*Transfer) IsSignatureValid

func (*Transfer) IsSignatureValid() bool

Check if the L3 signature in the transaction is valid or not.

func (*Transfer) GetEthSignMsg

func (*Transfer) GetEthSignMsg(tokenSymbol string) string

Get 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:

func (*Transfer) ToZklinkTx

func (*Withdraw) ToZklinkTx() ZkLinkTx

Change the transaction to the ZkLinkTx

Last updated