# SwapContract\<T, TX, PreFetchData, PreFetchVerification, Signer, ChainId>

Defined in: [atomiq-base/src/swaps/SwapContract.ts:63](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L63)

A contract for interacting with escrow manager swaps - escrow based swaps like HTLCs and PrTLCs

## Type Parameters

| Type Parameter                                                                                                                      | Default type                                                                                                     |
| ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `T` *extends* [`SwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/classes/SwapData.md)                       | [`SwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/classes/SwapData.md)                  |
| `TX`                                                                                                                                | `any`                                                                                                            |
| `PreFetchData`                                                                                                                      | `any`                                                                                                            |
| `PreFetchVerification`                                                                                                              | `any`                                                                                                            |
| `Signer` *extends* [`AbstractSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/AbstractSigner.md) | [`AbstractSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/type-aliases/AbstractSigner.md) |
| `ChainId` *extends* `string`                                                                                                        | `string`                                                                                                         |

## Properties

### chainId

```
readonly chainId: ChainId;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:75](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L75)

Chain identifier string

***

### claimWithSecretTimeout

```
readonly claimWithSecretTimeout: number;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:80](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L80)

A timeout to be used when claiming the escrow with a secret (HTLC), recommended to wait at least this long after sending a transaction before considering it a failure

***

### claimWithTxDataTimeout

```
readonly claimWithTxDataTimeout: number;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:85](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L85)

A timeout to be used when claiming the escrow with bitcoin transaction data (PrTLC), recommended to wait at least this long after sending a transaction before considering it a failure

***

### refundTimeout

```
readonly refundTimeout: number;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:90](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L90)

A timeout to be used when refunding the escrow, recommended to wait at least this long after sending a transaction before considering it a failure

***

### supportsInitWithoutClaimer?

```
readonly optional supportsInitWithoutClaimer: boolean;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:94](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L94)

Whether this chain supports sending initialization without a direct authorization by the claimer

## Methods

### claimDeposits()?

```
optional claimDeposits(signer, txOptions): Promise<{

  count: number;

  totalValue: bigint;

  txIds: string[];

}>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:643](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L643)

Claims the funds from claimable deposits

#### Parameters

| Parameter   | Type                             | Description                               |
| ----------- | -------------------------------- | ----------------------------------------- |
| `signer`    | `Signer`                         | Owner of the deposits, transaction signer |
| `txOptions` | `TransactionConfirmationOptions` | Transaction options                       |

#### Returns

`Promise`<{ `count`: `number`; `totalValue`: `bigint`; `txIds`: `string`\[]; }>

***

### claimWithSecret()

```
claimWithSecret(

   signer, 

   swapData, 

   secret, 

   checkExpiry?, 

   initAta?, 

txOptions?): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:133](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L133)

Signs & sends transactions required for claiming an HTLC swap

#### Parameters

| Parameter      | Type                             | Description                                                                                                  |
| -------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`       | `Signer`                         | Signer for which the transaction should be created (doesn't need to match the claimer)                       |
| `swapData`     | `T`                              | Swap to claim                                                                                                |
| `secret`       | `string`                         | Secret pre-image that hashes to the swap hash                                                                |
| `checkExpiry?` | `boolean`                        | Whether to check expiration of the swap before executing transactions                                        |
| `initAta?`     | `boolean`                        | Whether to initialize a token account if it doesn't exist (applies to e.g. Solana, with token specific ATAs) |
| `txOptions?`   | `TransactionConfirmationOptions` | Transaction options                                                                                          |

#### Returns

`Promise`<`string`>

***

### claimWithTxData()

```
claimWithTxData(

   signer, 

   swapData, 

   tx, 

   requiredConfirmations, 

   vout, 

   storedHeader?, 

   synchronizer?, 

   initAta?, 

txOptions?): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:161](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L161)

Signs & sends transactions required for claiming an on-chain PTLC (proof-time locked contract) swap

#### Parameters

| Parameter               | Type                                                                                                                    | Description                                                                                                  |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`                | `Signer`                                                                                                                | Signer for which the transaction should be created (doesn't need to match the claimer)                       |
| `swapData`              | `T`                                                                                                                     | Swap to claim                                                                                                |
| `tx`                    | `BitcoinTransactionData`                                                                                                | Bitcoin transaction containing the required output                                                           |
| `requiredConfirmations` | `number`                                                                                                                | Required confirmations for the escrow to be claimed                                                          |
| `vout`                  | `number`                                                                                                                | Bitcoin tx's output index of the required output                                                             |
| `storedHeader?`         | [`BtcStoredHeader`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/BtcStoredHeader.md)<`any`> | Optional already retrieved stored header to use for proving                                                  |
| `synchronizer?`         | `RelaySynchronizer`<`any`, `TX`, `any`>                                                                                 | Optiona synchronizer to be used if BTC relay contract is not synced up to the required blockheight           |
| `initAta?`              | `boolean`                                                                                                               | Whether to initialize a token account if it doesn't exist (applies to e.g. Solana, with token specific ATAs) |
| `txOptions?`            | `TransactionConfirmationOptions`                                                                                        | Transaction options                                                                                          |

#### Returns

`Promise`<`string`>

***

### createSwapData()

```
createSwapData(

   type, 

   offerer, 

   claimer, 

   token, 

   amount, 

   paymentHash, 

   sequence, 

   expiry, 

   payIn, 

   payOut, 

   securityDeposit, 

   claimerBounty, 

depositToken?): Promise<T>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:438](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L438)

Create a swap data for this given chain

#### Parameters

| Parameter         | Type            | Description                                                                                                                              |
| ----------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `type`            | `ChainSwapType` | Type of the swap                                                                                                                         |
| `offerer`         | `string`        | Offerer address                                                                                                                          |
| `claimer`         | `string`        | Claimer addres                                                                                                                           |
| `token`           | `string`        | Token to use for the swap                                                                                                                |
| `amount`          | `bigint`        | Amount of tokens for the swap                                                                                                            |
| `paymentHash`     | `string`        | Payment hash identifying the swap                                                                                                        |
| `sequence`        | `bigint`        | Swap sequence uniquelly defining this swap                                                                                               |
| `expiry`          | `bigint`        | Expiration of the swap                                                                                                                   |
| `payIn`           | `boolean`       | Whether the swap is payIn (offerer paying to the contract, or not payIn offerer using funds in his LP vault)                             |
| `payOut`          | `boolean`       | Whether the swap is payOut (claimer getting the funds to his on-chain address, or no payOut claimer getting his funds into his LP vault) |
| `securityDeposit` | `bigint`        | Security deposit for the swap paid by the claimer (options premium)                                                                      |
| `claimerBounty`   | `bigint`        | Bounty for the claimer of the swap (used for watchtowers)                                                                                |
| `depositToken?`   | `string`        | Token to be used for security deposit and claimer bounty                                                                                 |

#### Returns

`Promise`<`T`>

***

### deposit()

```
deposit(

   signer, 

   token, 

   amount, 

txOptions?): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:617](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L617)

Deposits funds to the trading LP vault

#### Parameters

| Parameter    | Type                             | Description                     |
| ------------ | -------------------------------- | ------------------------------- |
| `signer`     | `Signer`                         | Signer to sign the deposit with |
| `token`      | `string`                         | Token to deposit                |
| `amount`     | `bigint`                         | Amount of the token to deposit  |
| `txOptions?` | `TransactionConfirmationOptions` | Transaction options             |

#### Returns

`Promise`<`string`>

***

### getBalance()

```
getBalance(

   signer, 

   token, 

inContract): Promise<bigint>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:418](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L418)

Returns the token balance of a given signer's address

#### Parameters

| Parameter    | Type      | Description                                                                                |
| ------------ | --------- | ------------------------------------------------------------------------------------------ |
| `signer`     | `string`  | Address to check the balance of                                                            |
| `token`      | `string`  | Token                                                                                      |
| `inContract` | `boolean` | Whether we are checking the liquidity deposited into the LP vault or just on-chain balance |

#### Returns

`Promise`<`bigint`>

***

### getClaimableDeposits()?

```
optional getClaimableDeposits(signer): Promise<{

  count: number;

  totalValue: bigint;

}>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:635](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L635)

Returns the amount of deposits (in native token) that we can claim back (this is useful for SVM chains with the PDAs requiring you to put some deposit in order to store data)

#### Parameters

| Parameter | Type     | Description                                |
| --------- | -------- | ------------------------------------------ |
| `signer`  | `string` | Signer to check the claimable deposits for |

#### Returns

`Promise`<{ `count`: `number`; `totalValue`: `bigint`; }>

***

### getClaimFee()

```
getClaimFee(

   signer, 

   swapData, 

   feeRate?, 

witnessByteLength?): Promise<bigint>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:488](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L488)

Returns the fee in native token base units to claim the swap

#### Parameters

| Parameter            | Type     | Description                                               |
| -------------------- | -------- | --------------------------------------------------------- |
| `signer`             | `string` | Signer claiming the swap                                  |
| `swapData`           | `T`      | Swap to claim                                             |
| `feeRate?`           | `string` | Optional fee rate (fetched on-demand if not provided)     |
| `witnessByteLength?` | `number` | Optional length of the witness to better estimate the fee |

#### Returns

`Promise`<`bigint`>

***

### getClaimFeeRate()

```
getClaimFeeRate(signer, swapData): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:551](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L551)

Returns the fee rate for claiming a swap as a specific signer

#### Parameters

| Parameter  | Type     | Description              |
| ---------- | -------- | ------------------------ |
| `signer`   | `string` | Signer claiming the swap |
| `swapData` | `T`      | Swap to claim            |

#### Returns

`Promise`<`string`>

***

### getCommitFee()

```
getCommitFee(

   signer, 

   swapData, 

feeRate?): Promise<bigint>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:469](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L469)

Returns the fee in native token base units to commit (initiate) the swap

#### Parameters

| Parameter  | Type     | Description                                           |
| ---------- | -------- | ----------------------------------------------------- |
| `signer`   | `string` |                                                       |
| `swapData` | `T`      | Swap to initiate                                      |
| `feeRate?` | `string` | Optional fee rate (fetched on-demand if not provided) |

#### Returns

`Promise`<`bigint`>

***

### getCommitStatus()

```
getCommitStatus(signer, swapData): Promise<SwapCommitState>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:286](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L286)

Returns the full status of the swap, expiry is handled by the isExpired function so also requires a signer/sender

#### Parameters

| Parameter  | Type     | Description |
| ---------- | -------- | ----------- |
| `signer`   | `string` |             |
| `swapData` | `T`      |             |

#### Returns

`Promise`<`SwapCommitState`>

***

### getCommitStatuses()

```
getCommitStatuses(request): Promise<{

[escrowHash: string]: SwapCommitState;

}>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:293](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L293)

Returns the full status of the passed swaps, expiry is handled by the isExpired function so also requires a signer/sender

#### Parameters

| Parameter | Type        | Description |
| --------- | ----------- | ----------- |
| `request` | `object`\[] |             |

#### Returns

`Promise`<{ \[`escrowHash`: `string`]: `SwapCommitState`; }>

***

### getDataSignature()

```
getDataSignature(signer, data): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:400](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L400)

Signs the given data with the provided signer

#### Parameters

| Parameter | Type     | Description                |
| --------- | -------- | -------------------------- |
| `signer`  | `Signer` | Signer to sign the message |
| `data`    | `Buffer` | Data to sign               |

#### Returns

`Promise`<`string`>

***

### getExtraData()

```
getExtraData(

   outputScript, 

   amount, 

   confirmations, 

   nonce?): Buffer;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:562](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L562)

Returns additional data to be included in the data-carrier (extra data) part of the PrTLC escrow initialization this provides helpers for 3rd party claimers

#### Parameters

| Parameter       | Type     | Description                                                                                |
| --------------- | -------- | ------------------------------------------------------------------------------------------ |
| `outputScript`  | `Buffer` | A bitcoin output script required in the bitcoin transaction to claim the escrow            |
| `amount`        | `bigint` | An amount of bitcoin (in satoshis) required in the bitcoin transaction to claim the escrow |
| `confirmations` | `number` | Confirmations of the bitcoin transaction required for claiming the escrow                  |
| `nonce?`        | `bigint` | An optional nonce applied to the transaction                                               |

#### Returns

`Buffer`

***

### getHashForHtlc()

```
getHashForHtlc(swapHash): Buffer;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:587](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L587)

Compute the claim hash for an HTLC swap with a given swap hash

#### Parameters

| Parameter  | Type     | Description |
| ---------- | -------- | ----------- |
| `swapHash` | `Buffer` |             |

#### Returns

`Buffer`

***

### getHashForOnchain()

```
getHashForOnchain(

   outputScript, 

   amount, 

   confirmations, 

   nonce?): Buffer;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:572](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L572)

Compute the claim hash for a given transaction output, either nonced or just output locked

#### Parameters

| Parameter       | Type     | Description                                                   |
| --------------- | -------- | ------------------------------------------------------------- |
| `outputScript`  | `Buffer` | Bitcoin output locking script                                 |
| `amount`        | `bigint` | Amount of sats in the output                                  |
| `confirmations` | `number` | Required number of confirmations for the swap to be claimable |
| `nonce?`        | `bigint` | Nonce to be used as replay protection                         |

#### Returns

`Buffer`

***

### getHashForTxId()

```
getHashForTxId(txId, confirmations): Buffer;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:580](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L580)

Compute the claim hash for a given transaction id

#### Parameters

| Parameter       | Type     | Description                                                   |
| --------------- | -------- | ------------------------------------------------------------- |
| `txId`          | `string` | Bitcoin transaction ID                                        |
| `confirmations` | `number` | Required number of confirmations for the swap to be claimable |

#### Returns

`Buffer`

***

### getHistoricalSwaps()?

```
optional getHistoricalSwaps(signer, startBlockheight?): Promise<{

  latestBlockheight?: number;

  swaps: {

   [escrowHash: string]: object;

  };

}>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:301](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L301)

Returns the full history as fetched from the chain for a specific signer

#### Parameters

| Parameter           | Type     | Description |
| ------------------- | -------- | ----------- |
| `signer`            | `string` |             |
| `startBlockheight?` | `number` |             |

#### Returns

`Promise`<{ `latestBlockheight?`: `number`; `swaps`: { \[`escrowHash`: `string`]: `object`; }; }>

***

### getInitAuthorizationExpiry()

```
getInitAuthorizationExpiry(

   swapData, 

   signature, 

preFetchedVerificationData?): Promise<number>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:367](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L367)

Returns the expiry timestamp (UNIX milliseconds) of the authorization

#### Parameters

| Parameter                     | Type                   | Description                                                 |
| ----------------------------- | ---------------------- | ----------------------------------------------------------- |
| `swapData`                    | `T`                    | Swap                                                        |
| `signature`                   | `SignatureData`        | Signature data                                              |
| `preFetchedVerificationData?` | `PreFetchVerification` | Optional pre-fetched data required for signature validation |

#### Returns

`Promise`<`number`>

***

### getInitFeeRate()

```
getInitFeeRate(

   offerer, 

   claimer, 

   token, 

paymentHash?): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:536](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L536)

Returns the fee rate for committing (initializing) a non-payIn swap

#### Parameters

| Parameter      | Type     | Description           |
| -------------- | -------- | --------------------- |
| `offerer`      | `string` | Offerer of the swap   |
| `claimer`      | `string` | Claimer of the swap   |
| `token`        | `string` | Token to be swapped   |
| `paymentHash?` | `string` | Optional payment hash |

#### Returns

`Promise`<`string`>

***

### getInitPayInFeeRate()

```
getInitPayInFeeRate(

   offerer, 

   claimer, 

   token, 

paymentHash?): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:526](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L526)

Returns the fee rate for committing (initializing) a payIn swap

#### Parameters

| Parameter      | Type     | Description           |
| -------------- | -------- | --------------------- |
| `offerer`      | `string` | Offerer of the swap   |
| `claimer`      | `string` | Claimer of the swap   |
| `token`        | `string` | Token to be swapped   |
| `paymentHash?` | `string` | Optional payment hash |

#### Returns

`Promise`<`string`>

***

### getInitSignature()

```
getInitSignature(

   signer, 

   swapData, 

   authorizationTimeout, 

   preFetchedBlockData?, 

feeRate?): Promise<SignatureData>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:346](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L346)

Generates the initialization signature

#### Parameters

| Parameter              | Type           | Description                                                   |
| ---------------------- | -------------- | ------------------------------------------------------------- |
| `signer`               | `Signer`       | Signer to use for signing the message                         |
| `swapData`             | `T`            | Swap to sign                                                  |
| `authorizationTimeout` | `number`       | Timeout of the authorization                                  |
| `preFetchedBlockData?` | `PreFetchData` | Optional pre-fetched data required for creating the signature |
| `feeRate?`             | `string`       | Optional fee rate to use for the authorization                |

#### Returns

`Promise`<`SignatureData`>

***

### getIntermediaryReputation()

```
getIntermediaryReputation(address, token): Promise<IntermediaryReputationType>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:460](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L460)

Returns intermediary's reputation for a given token swaps

#### Parameters

| Parameter | Type     | Description |
| --------- | -------- | ----------- |
| `address` | `string` |             |
| `token`   | `string` |             |

#### Returns

`Promise`<`IntermediaryReputationType`>

***

### getRawClaimFee()?

```
optional getRawClaimFee(

   signer, 

   swapData, 

   feeRate?, 

witnessByteLength?): Promise<bigint>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:498](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L498)

Returns raw fee (not including any refunds we might get that would make the getClaimFee negative) for claiming the swap

#### Parameters

| Parameter            | Type     | Description                                               |
| -------------------- | -------- | --------------------------------------------------------- |
| `signer`             | `string` | Signer claiming the swap                                  |
| `swapData`           | `T`      | Swap to claim                                             |
| `feeRate?`           | `string` | Optional fee rate (fetched on-demand if not provided)     |
| `witnessByteLength?` | `number` | Optional length of the witness to better estimate the fee |

#### Returns

`Promise`<`bigint`>

***

### getRawCommitFee()?

```
optional getRawCommitFee(

   signer, 

   swapData, 

feeRate?): Promise<bigint>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:478](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L478)

Returns raw fee (not including any account deposits we might need) for initiating the swap

#### Parameters

| Parameter  | Type     | Description                                           |
| ---------- | -------- | ----------------------------------------------------- |
| `signer`   | `string` |                                                       |
| `swapData` | `T`      | Swap to initiate                                      |
| `feeRate?` | `string` | Optional fee rate (fetched on-demand if not provided) |

#### Returns

`Promise`<`bigint`>

***

### getRawRefundFee()?

```
optional getRawRefundFee(

   signer, 

   swapData, 

feeRate?): Promise<bigint>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:516](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L516)

Returns raw fee (not including any refunds we might get that would make the getRefundFee negative) for claiming the swap

#### Parameters

| Parameter  | Type     | Description                                           |
| ---------- | -------- | ----------------------------------------------------- |
| `signer`   | `string` |                                                       |
| `swapData` | `T`      | Swap to claim                                         |
| `feeRate?` | `string` | Optional fee rate (fetched on-demand if not provided) |

#### Returns

`Promise`<`bigint`>

***

### getRefundFee()

```
getRefundFee(

   signer, 

   swapData, 

feeRate?): Promise<bigint>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:507](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L507)

Returns the fee in native token base units to refund the swap

#### Parameters

| Parameter  | Type     | Description                                           |
| ---------- | -------- | ----------------------------------------------------- |
| `signer`   | `string` |                                                       |
| `swapData` | `T`      | Swap to refund                                        |
| `feeRate?` | `string` | Optional fee rate (fetched on-demand if not provided) |

#### Returns

`Promise`<`bigint`>

***

### getRefundFeeRate()

```
getRefundFeeRate(swapData): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:543](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L543)

Returns the fee rate for refunding a swap

#### Parameters

| Parameter  | Type | Description    |
| ---------- | ---- | -------------- |
| `swapData` | `T`  | Swap to refund |

#### Returns

`Promise`<`string`>

***

### getRefundSignature()

```
getRefundSignature(

   signer, 

   swapData, 

authorizationTimeout): Promise<SignatureData>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:384](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L384)

Generates the refund signature for a given swap allowing the offerer to refund before expiration

#### Parameters

| Parameter              | Type     | Description                                                                      |
| ---------------------- | -------- | -------------------------------------------------------------------------------- |
| `signer`               | `Signer` | Signer to use for signing the message (must be the same as offerer in swap data) |
| `swapData`             | `T`      | Swap to refund                                                                   |
| `authorizationTimeout` | `number` | Timeout of the provided refund authorization                                     |

#### Returns

`Promise`<`SignatureData`>

***

### init()

```
init(

   signer, 

   swapData, 

   signature, 

   skipChecks?, 

txOptions?): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:110](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L110)

Signs & sends transactions for initializing a non-payIn swap (BTC -> SC)

#### Parameters

| Parameter     | Type                             | Description                                                                               |
| ------------- | -------------------------------- | ----------------------------------------------------------------------------------------- |
| `signer`      | `Signer`                         | Signer to use for the transaction (must match claimer in swap data)                       |
| `swapData`    | `T`                              | Swap to init                                                                              |
| `signature`   | `SignatureData`                  | Signature data from the offerer                                                           |
| `skipChecks?` | `boolean`                        | Whether to skip verification of the signature & checking if the swap is already committed |
| `txOptions?`  | `TransactionConfirmationOptions` | Transaction options                                                                       |

#### Returns

`Promise`<`string`>

***

### initAndClaimWithSecret()?

```
optional initAndClaimWithSecret(

   signer, 

   swapData, 

   signature, 

   secret, 

   skipChecks?, 

txOptions?): Promise<string[]>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:254](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L254)

Signs & sends transactions for initializing and instantly (upon init confirmation) claiming the HTLC, used for BTC-LN -> SC swaps

#### Parameters

| Parameter     | Type                             | Description                                                                               |
| ------------- | -------------------------------- | ----------------------------------------------------------------------------------------- |
| `signer`      | `Signer`                         | Signer to use for the transaction (must match claimer in swap data)                       |
| `swapData`    | `T`                              | Swap to process                                                                           |
| `signature`   | `SignatureData`                  | Signature data from the offerer                                                           |
| `secret`      | `string`                         | Secret pre-image that hashes to the swap hash                                             |
| `skipChecks?` | `boolean`                        | Whether to skip verification of the signature & checking if the swap is already committed |
| `txOptions?`  | `TransactionConfirmationOptions` | Transaction options                                                                       |

#### Returns

`Promise`<`string`\[]>

***

### isClaimable()

```
isClaimable(signer, swapData): Promise<boolean>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:271](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L271)

Checks whether a swap is claimable for the signer, i.e. it is not expired yet and is committed on-chain

#### Parameters

| Parameter  | Type     | Description |
| ---------- | -------- | ----------- |
| `signer`   | `string` |             |
| `swapData` | `T`      |             |

#### Returns

`Promise`<`boolean`>

***

### isCommited()

```
isCommited(swapData): Promise<boolean>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:278](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L278)

Checks whether a given swap is committed on chain (initialized)

#### Parameters

| Parameter  | Type | Description |
| ---------- | ---- | ----------- |
| `swapData` | `T`  |             |

#### Returns

`Promise`<`boolean`>

***

### isExpired()

```
isExpired(signer, swapData): Promise<boolean>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:263](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L263)

Checks whether a swap is already expired, swap expires a bit sooner for the claimer & a bit later for offerer, this is used to account for possible on-chain time skew

#### Parameters

| Parameter  | Type     | Description                           |
| ---------- | -------- | ------------------------------------- |
| `signer`   | `string` | Signer to use for checking the expiry |
| `swapData` | `T`      | Swap to check                         |

#### Returns

`Promise`<`boolean`>

***

### isInitAuthorizationExpired()

```
isInitAuthorizationExpired(swapData, signature): Promise<boolean>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:375](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L375)

Checks whether a given init signature is already expired

#### Parameters

| Parameter   | Type            | Description    |
| ----------- | --------------- | -------------- |
| `swapData`  | `T`             | Swap           |
| `signature` | `SignatureData` | Signature data |

#### Returns

`Promise`<`boolean`>

***

### isRequestRefundable()

```
isRequestRefundable(signer, swapData): Promise<boolean>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:324](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L324)

Checks whether a given swap is refundable by us, i.e. it is already expired, we are offerer & swap is committed on-chain

#### Parameters

| Parameter  | Type     | Description |
| ---------- | -------- | ----------- |
| `signer`   | `string` |             |
| `swapData` | `T`      |             |

#### Returns

`Promise`<`boolean`>

***

### isValidDataSignature()

```
isValidDataSignature(

   data, 

   signature, 

publicKey): Promise<boolean>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:409](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L409)

Checks whether a provided data is signature is valid

#### Parameters

| Parameter   | Type     | Description              |
| ----------- | -------- | ------------------------ |
| `data`      | `Buffer` | Data to sign             |
| `signature` | `string` | Signature                |
| `publicKey` | `string` | Public key of the signer |

#### Returns

`Promise`<`boolean`>

***

### isValidInitAuthorization()

```
isValidInitAuthorization(

   sender, 

   swapData, 

   signature, 

   feeRate?, 

preFetchedVerificationData?): Promise<Buffer<ArrayBufferLike>>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:358](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L358)

Checks whether a signature is a valid initialization signature for a given swap

#### Parameters

| Parameter                     | Type                   | Description                                                                  |
| ----------------------------- | ---------------------- | ---------------------------------------------------------------------------- |
| `sender`                      | `string`               | Address of the sender of the transaction (must be either offerer or claimer) |
| `swapData`                    | `T`                    | Swap to initialize                                                           |
| `signature`                   | `SignatureData`        | Signature data                                                               |
| `feeRate?`                    | `string`               | Fee rate used for the authorization                                          |
| `preFetchedVerificationData?` | `PreFetchVerification` | Optional pre-fetched data required for signature validation                  |

#### Returns

`Promise`<`Buffer`<`ArrayBufferLike`>>

The message being signed if valid or null if invalid signature

***

### isValidRefundAuthorization()

```
isValidRefundAuthorization(swapData, signature): Promise<Buffer<ArrayBufferLike>>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:392](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L392)

Checks whether a given refund signature is valid

#### Parameters

| Parameter   | Type            | Description                         |
| ----------- | --------------- | ----------------------------------- |
| `swapData`  | `T`             | Swap to refund                      |
| `signature` | `SignatureData` | Signature received from the claimer |

#### Returns

`Promise`<`Buffer`<`ArrayBufferLike`>>

***

### preFetchBlockDataForSignatures()?

```
optional preFetchBlockDataForSignatures(): Promise<PreFetchData>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:329](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L329)

Pre-fetches data required for creating init signature

#### Returns

`Promise`<`PreFetchData`>

***

### preFetchForInitSignatureVerification()?

```
optional preFetchForInitSignatureVerification(data): Promise<PreFetchVerification>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:335](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L335)

Pre-fetches data required for init signature verification

#### Parameters

| Parameter | Type           | Description |
| --------- | -------------- | ----------- |
| `data`    | `PreFetchData` |             |

#### Returns

`Promise`<`PreFetchVerification`>

***

### refund()

```
refund(

   signer, 

   swapData, 

   check?, 

   initAta?, 

txOptions?): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:207](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L207)

Signs & sends transactions for refunding a timed out swap

#### Parameters

| Parameter    | Type                             | Description                                                                                                  |
| ------------ | -------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`     | `Signer`                         | Signer to use for the transaction (must match offerer in swap data)                                          |
| `swapData`   | `T`                              | Swap to refund                                                                                               |
| `check?`     | `boolean`                        | Whether to check if the swap contract still exists on-chain                                                  |
| `initAta?`   | `boolean`                        | Whether to initialize a token account if it doesn't exist (applies to e.g. Solana, with token specific ATAs) |
| `txOptions?` | `TransactionConfirmationOptions` | Transaction options                                                                                          |

#### Returns

`Promise`<`string`>

***

### refundWithAuthorization()

```
refundWithAuthorization(

   signer, 

   swapData, 

   signature, 

   check?, 

   initAta?, 

txOptions?): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:230](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L230)

Signs & sends transactions for refunding a swap with a valid refund signature from the claimer

#### Parameters

| Parameter    | Type                             | Description                                                                                                  |
| ------------ | -------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`     | `Signer`                         | Signer to use for the transaction (must match offerer in swap data)                                          |
| `swapData`   | `T`                              | Swap to refund                                                                                               |
| `signature`  | `SignatureData`                  | Refund signature received from the claimer                                                                   |
| `check?`     | `boolean`                        | Whether to check if the swap contract still exists on-chain                                                  |
| `initAta?`   | `boolean`                        | Whether to initialize a token account if it doesn't exist (applies to e.g. Solana, with token specific ATAs) |
| `txOptions?` | `TransactionConfirmationOptions` | Transaction options                                                                                          |

#### Returns

`Promise`<`string`>

***

### start()

```
start(): Promise<void>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:99](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L99)

Initializes the swap contract

#### Returns

`Promise`<`void`>

***

### txsClaimWithSecret()

```
txsClaimWithSecret(

   signer, 

   swapData, 

   secret, 

   checkExpiry?, 

   initAta?, 

   feeRate?, 

skipAtaCheck?): Promise<TX[]>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:146](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L146)

Returns the unsigned transactions required for claiming an HTLC swap

#### Parameters

| Parameter       | Type                 | Description                                                                                                  |
| --------------- | -------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`        | `string` \| `Signer` | Signer for which the transaction should be created (doesn't need to match the claimer)                       |
| `swapData`      | `T`                  | Swap to claim                                                                                                |
| `secret`        | `string`             | Secret pre-image that hashes to the swap hash                                                                |
| `checkExpiry?`  | `boolean`            | Whether to check expiration of the swap before returning the transactions                                    |
| `initAta?`      | `boolean`            | Whether to initialize a token account if it doesn't exist (applies to e.g. Solana, with token specific ATAs) |
| `feeRate?`      | `string`             | Fee rate to use for the transactions                                                                         |
| `skipAtaCheck?` | `boolean`            | Whether to skip checking if token account exists                                                             |

#### Returns

`Promise`<`TX`\[]>

***

### txsClaimWithTxData()

```
txsClaimWithTxData(

   signer, 

   swapData, 

   tx, 

   requiredConfirmations, 

   vout, 

   storedHeader?, 

   synchronizer?, 

   initAta?, 

feeRate?): Promise<TX[]>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:186](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L186)

Returns the unsigned transactions required for claiming an on-chain PTLC (proof-time locked contract) swap

#### Parameters

| Parameter               | Type                                                                                                                    | Description                                                                                                  |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`                | `string` \| `Signer`                                                                                                    | Signer for which the transaction should be created (doesn't need to match the claimer)                       |
| `swapData`              | `T`                                                                                                                     | Swap to claim                                                                                                |
| `tx`                    | `BitcoinTransactionData`                                                                                                | Bitcoin transaction containing the required output                                                           |
| `requiredConfirmations` | `number`                                                                                                                | Required confirmations for the escrow to be claimed                                                          |
| `vout`                  | `number`                                                                                                                | Bitcoin tx's output index of the required output                                                             |
| `storedHeader?`         | [`BtcStoredHeader`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/BtcStoredHeader.md)<`any`> | Optional already retrieved stored header to use for proving                                                  |
| `synchronizer?`         | `RelaySynchronizer`<`any`, `TX`, `any`>                                                                                 | Optiona synchronizer to be used if BTC relay contract is not synced up to the required blockheight           |
| `initAta?`              | `boolean`                                                                                                               | Whether to initialize a token account if it doesn't exist (applies to e.g. Solana, with token specific ATAs) |
| `feeRate?`              | `string`                                                                                                                | Fee rate to use for the transactions                                                                         |

#### Returns

`Promise`<`TX`\[]>

***

### txsDeposit()

```
txsDeposit(

   signer, 

   token, 

   amount, 

feeRate?): Promise<TX[]>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:627](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L627)

Returns transactions required for signer to deposit funds to the trading LP vault

#### Parameters

| Parameter  | Type     | Description                                                                      |
| ---------- | -------- | -------------------------------------------------------------------------------- |
| `signer`   | `string` | Owner of the funds                                                               |
| `token`    | `string` | Token to deposit                                                                 |
| `amount`   | `bigint` | Amount of the token to deposit                                                   |
| `feeRate?` | `string` | Optional fee rate to use for the transaction (fetched on-demand if not provided) |

#### Returns

`Promise`<`TX`\[]>

***

### txsInit()

```
txsInit(

   sender, 

   swapData, 

   signature, 

   skipChecks?, 

feeRate?): Promise<TX[]>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:121](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L121)

Returns the unsigned transactions required for initializing a non-payIn swap (BTC -> SC)

#### Parameters

| Parameter     | Type            | Description                                                                               |
| ------------- | --------------- | ----------------------------------------------------------------------------------------- |
| `sender`      | `string`        | Transaction sender address, must be either offerer or claimer                             |
| `swapData`    | `T`             | Swap to init                                                                              |
| `signature`   | `SignatureData` | Signature data from the offerer                                                           |
| `skipChecks?` | `boolean`       | Whether to skip verification of the signature & checking if the swap is already committed |
| `feeRate?`    | `string`        | Fee rate to use for the transaction                                                       |

#### Returns

`Promise`<`TX`\[]>

***

### txsRefund()

```
txsRefund(

   signer, 

   swapData, 

   check?, 

   initAta?, 

feeRate?): Promise<TX[]>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:218](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L218)

Returns the transactions for refunding a timed out swap

#### Parameters

| Parameter  | Type      | Description                                                                                                  |
| ---------- | --------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`   | `string`  | Signer of the refund transaction                                                                             |
| `swapData` | `T`       | Swap to refund                                                                                               |
| `check?`   | `boolean` | Whether to check if the swap contract still exists on-chain                                                  |
| `initAta?` | `boolean` | Whether to initialize a token account if it doesn't exist (applies to e.g. Solana, with token specific ATAs) |
| `feeRate?` | `string`  | Fee rate to use for the transactions                                                                         |

#### Returns

`Promise`<`TX`\[]>

***

### txsRefundWithAuthorization()

```
txsRefundWithAuthorization(

   signer, 

   swapData, 

   signature, 

   check?, 

   initAta?, 

feeRate?): Promise<TX[]>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:242](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L242)

Returns the transactions for refunding a swap with a valid refund signature from the claimer

#### Parameters

| Parameter   | Type            | Description                                                                                                  |
| ----------- | --------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`    | `string`        | Signer of the refund transaction                                                                             |
| `swapData`  | `T`             | Swap to refund                                                                                               |
| `signature` | `SignatureData` | Refund signature received from the claimer                                                                   |
| `check?`    | `boolean`       | Whether to check if the swap contract still exists on-chain                                                  |
| `initAta?`  | `boolean`       | Whether to initialize a token account if it doesn't exist (applies to e.g. Solana, with token specific ATAs) |
| `feeRate?`  | `string`        | Fee rate to use for the transactions                                                                         |

#### Returns

`Promise`<`TX`\[]>

***

### txsWithdraw()

```
txsWithdraw(

   signer, 

   token, 

   amount, 

feeRate?): Promise<TX[]>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:607](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L607)

Returns transactions required for signer to withdraw funds from the trading LP vault

#### Parameters

| Parameter  | Type     | Description                                                                      |
| ---------- | -------- | -------------------------------------------------------------------------------- |
| `signer`   | `string` | Owner of the funds                                                               |
| `token`    | `string` | Token to withdraw                                                                |
| `amount`   | `bigint` | Amount of the token to withdraw                                                  |
| `feeRate?` | `string` | Optional fee rate to use for the transaction (fetched on-demand if not provided) |

#### Returns

`Promise`<`TX`\[]>

***

### withdraw()

```
withdraw(

   signer, 

   token, 

   amount, 

txOptions?): Promise<string>;
```

Defined in: [atomiq-base/src/swaps/SwapContract.ts:597](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapContract.ts#L597)

Withdraws funds from the trading LP vault

#### Parameters

| Parameter    | Type                             | Description                        |
| ------------ | -------------------------------- | ---------------------------------- |
| `signer`     | `Signer`                         | Signer to sign the withdrawal with |
| `token`      | `string`                         | Token to withdraw                  |
| `amount`     | `bigint`                         | Amount of the token to withdraw    |
| `txOptions?` | `TransactionConfirmationOptions` | Transaction options                |

#### Returns

`Promise`<`string`>
