zkLink X Documentaion
HomeGitHubBlogExplorer
  • 🙂Welcome
    • Introduction
  • ⚖️Architecture
    • Overview
    • Settlement Layer
      • Working Principal of A Multi-Chain ZK-Rollup
      • Nexus: Settlement on ETH L2s
      • Origin: Settlement on ETH and Alt-L1s
      • Multi-Chain State Synchronization
        • In-Detail: Nexus Multi-Chain State Synchronization
      • Supported Networks of zkLink Nexus and Origin
      • Security Assumptions of zkLink Nexus and Origin
    • Execution Layer
      • TS-zkVM for App Rollup
    • Sequencing Layer
    • DA Layer
  • 🛠️Developer
    • Developer Overview
    • Get Started
    • Examples
      • Base Demo
    • JSON RPC & Websocket & Kafka
      • JSON-RPC API
      • JSON-RPC Errors
      • Websocket
      • Kafka
    • Transactions
      • Basic Types
      • State Update
      • Transaction
        • Deposit
        • FullExit
        • ChangePubKey
        • Withdraw
        • Transfer
        • ForcedExit
        • OrderMatching
        • AutoDeleveraging
        • ContractMatching
        • Funding
        • Liquidation
        • UpdateGlobalVar
      • Private Key & Signature
        • Algorithm
        • ChangePubKey
        • Withdraw
        • Transfer
        • ForcedExit
        • OrderMatching
        • ContractMatching
        • Funding
        • Liquidation
        • AutoDeleveraging
        • UpdateGlobalVar
    • SDK
      • Go
        • Types
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
      • Js
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
      • Dart
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
  • ⚙️Network Information
    • Connected Networks
      • Mainnet
      • Testnet
    • DApps & Deployment Addresses
      • Mainnet
      • Testnet
  • Wallet & User Fund Streamline
    • Withdraw
    • Wallet Integration & AA Wallet
    • Deposit
  • Integration Cases
    • Heavyweight Integration (Multi-Chain Derivatives & Spot Exchange)
    • Simple Integration (Multi-Chain Spot Exchange)
  • Appendix
    • Audits
    • FAQ
    • glossary
Powered by GitBook
On this page
  • type WithdrawBuilder
  • type Withdraw

Was this helpful?

  1. Developer
  2. SDK
  3. Go
  4. Transactions

Withdraw

PreviousChangePubKeyNextTransfer

Last updated 1 year ago

Was this helpful?

type WithdrawBuilder

type WithdrawBuilder struct {
	AccountId        AccountId
	SubAccountId     SubAccountId
	ToChainId        ChainId
	ToAddress        ZkLinkAddress
	L2SourceToken    TokenId
	L1TargetToken    TokenId
	Amount           BigUint
	Fee              BigUint
	Nonce            Nonce
	WithdrawFeeRatio uint16
	WithdrawToL1     bool
	Timestamp        TimeStamp
}

The builder is used to build the transaction.

type Withdraw

transaction type, it's a opaque data type.

func NewWithdraw(builder WithdrawBuilder)

func NewWithdraw(builder WithdrawBuilder) *Withdraw

func (*Withdraw) GetBytes

func (_self *Withdraw) GetBytes() []uint8

Get the encoded bytes used to create the L3 signature.

func (*Withdraw) TxHash

func (*Withdraw) TxHash() []uint8

func (*Withdraw) IsValid

func (*Withdraw) IsValid() bool

func (*Withdraw) CreateSignedTx

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

The ZkLinkSigner will sign the [Withdraw] transaction, replace the default signature in the transaction.

input:

func (*Withdraw) GetSignature

func (_self *Withdraw) GetSignature() ZkLinkSignature

Get L3 signature inside the transaction.

func (*Withdraw) IsSignatureValid

func (*Withdraw) IsSignatureValid() bool

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

func (*Withdraw) EthSignature

func (*Withdraw) EthSignature(ethSigner *EthSigner, l2SourceTokenSymbol string) (PackedEthSignature, error)

Create the Ethereum signature. input::

  • l2SourceTokenSymbol: the symbol string of l2 token, for example: "USD"

func (*Withdraw) SubmitterSignature

func (_self *Withdraw) SubmitterSignature(signer *ZkLinkSigner) (ZkLinkSignature, error)

Create a submitter signature.

input:

func (*Withdraw) ToZklinkTx

func (*Withdraw) ToZklinkTx() ZkLinkTx

Create a new transaction.

input: builder:

Get the transaction hash of transaction

Check if all the fields in are valid. For example, if the ChainId is exceeded the maximum ChainId, it will return false.

signer:

ethSigner: the

signer:

Change the Withdraw transaction to the

🛠️
Withdraw
Withdraw
Withdraw
WithdrawBuilder
Withdraw
Withdraw
ZkLinkSigner
Ethereum signer
ZkLinkSigner
ZkLinkTx