> 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/9-liquidation.md).

# Liquidation

### type LiquidationBuilder

```go
type LiquidationBuilder struct {
    AccountId            AccountId
    SubAccountId         SubAccountId
    SubAccountNonce      Nonce
    ContractPrices       []ContractPrice
    MarginPrices         []SpotPriceInfo
    LiquidationAccountId AccountId
    Fee                  BigUint
    FeeToken             TokenId
}
```

The builder used to create the [Liquidation](#type-liquidation) transaction.

### type Liquidation

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

#### func NewLiquidation(builder LiquidationBuilder)

```go
func NewLiquidation(builder LiquidationBuilder) *Liquidation
```

Create a new [Liquidation](#type-liquidation) transaction.

#### func (\*Liquidation) GetBytes

```go
func (*Liquidation) GetBytes() []uint8
```

Get the encoded bytes to create the L3 signature. See more in [Private Key and Signature](/developer/api-and-sdk/private_key/liquidation.md)

#### func (\*Liquidation) TxHash

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

Get the transaction hash of the transaction.

#### func (\*Liquidation) JsonStr

```go
func (*Liquidation) JsonStr() string
```

Get the json string of the transaction.

#### func (\*Liquidation) IsValid

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

Check if the transaction is valid.

#### func (\*Liquidation) CreateSignedTx

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

Create a new Liquidation transaction with L3 signature inside. **input:**

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

#### func (\*Liquidation) GetSignature

```go
func (*Liquidation) GetSignature() ZkLinkSignature
```

Get L3 signature of the transaction.

#### func (\*Liquidation) IsSignatureValid

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

Check if the inside L3 signature is valid or not.

#### func (\*Liquidation) ToZklinkTx

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

Change the 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zk.link/developer/sdk/changelog/transactions/9-liquidation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
