> For the complete documentation index, see [llms.txt](https://docs.zk.link/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zk.link/developer/sdk/changelog/transactions/2-withdraw.md).

# Withdraw

### type WithdrawBuilder

```go
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 [Withdraw](/developer/sdk/changelog/transactions.md#type-withdraw) transaction.

### type Withdraw

[Withdraw](/developer/api-and-sdk/transaction/withdraw.md) transaction type, it's a opaque data type.

#### func NewWithdraw(builder WithdrawBuilder)

```go
func NewWithdraw(builder WithdrawBuilder) *Withdraw
```

Create a new [Withdraw](#type-withdraw) transaction.

**input:** builder: [WithdrawBuilder](#type-withdrawbuilder)

#### func (\*Withdraw) GetBytes

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

Get the encoded bytes used to create the L3 signature.

#### func (\*Withdraw) TxHash

```go
func (*Withdraw) TxHash() []uint8
```

Get the transaction hash of [Withdraw](#type-withdraw) transaction

#### func (\*Withdraw) IsValid

```go
func (*Withdraw) IsValid() bool
```

Check if all the fields in [Withdraw](#type-withdraw) are valid. For example, if the `ChainId` is exceeded the maximum ChainId, it will return false.

#### func (\*Withdraw) CreateSignedTx

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

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

**input:**

* signer: [ZkLinkSigner](/developer/sdk/changelog/signer.md#type-zklinksigner)

#### func (\*Withdraw) GetSignature

```go
func (_self *Withdraw) GetSignature() ZkLinkSignature
```

Get L3 signature inside the transaction.

#### func (\*Withdraw) IsSignatureValid

```go
func (*Withdraw) IsSignatureValid() bool
```

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

#### func (\*Withdraw) EthSignature

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

Create the Ethereum signature. **input:**:

* ethSigner: the [Ethereum signer](/developer/sdk/changelog/signer.md#type-ethsigner)
* l2SourceTokenSymbol: the symbol string of l2 token, for example: "USD"

#### func (\*Withdraw) SubmitterSignature

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

Create a submitter signature.

**input:**

* signer: [ZkLinkSigner](/developer/sdk/changelog/signer.md#type-zklinksigner)

#### func (\*Withdraw) ToZklinkTx

```go
func (*Withdraw) ToZklinkTx() ZkLinkTx
```

Change the Withdraw transaction to the [ZkLinkTx](/developer/sdk/changelog/basic_types.md#zklinktx)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zk.link/developer/sdk/changelog/transactions/2-withdraw.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
