# StarknetSwapContract

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:78](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L78)

Starknet swap contract (escrow manager) contract representation handling PrTLC (on-chain) and HTLC (lightning) based swaps

## Extends

* `StarknetContractBase`<*typeof* `EscrowManagerAbi`>

## Implements

* [`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md)<[`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md), [`StarknetTx`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/type-aliases/StarknetTx.md), `never`, `StarknetPreFetchVerification`, [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md), `"STARKNET"`>

## Constructors

### Constructor

```
new StarknetSwapContract(

   chainInterface, 

   btcRelay, 

   contractAddress, 

   _handlerAddresses?, 

   contractDeploymentHeight?): StarknetSwapContract;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:149](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L149)

Constructs the swap contract (escrow manager)

#### Parameters

| Parameter                            | Type                                                                                                                                   | Description                                                                |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `chainInterface`                     | [`StarknetChainInterface`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetChainInterface.md) | Underlying chain interface to use                                          |
| `btcRelay`                           | [`StarknetBtcRelay`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetBtcRelay.md)<`any`>      | Btc relay light client contract                                            |
| `contractAddress`                    | `string`                                                                                                                               | Optional underlying contract address (default is used otherwise)           |
| `_handlerAddresses?`                 | { `claim?`: { `0?`: `string`; `1?`: `string`; `2?`: `string`; `3?`: `string`; }; `refund?`: { `timelock?`: `string`; }; }              | Optional handler addresses (defaults are used otherwise)                   |
| `_handlerAddresses.claim?`           | { `0?`: `string`; `1?`: `string`; `2?`: `string`; `3?`: `string`; }                                                                    | -                                                                          |
| `_handlerAddresses.claim.0?`         | `string`                                                                                                                               | -                                                                          |
| `_handlerAddresses.claim.1?`         | `string`                                                                                                                               | -                                                                          |
| `_handlerAddresses.claim.2?`         | `string`                                                                                                                               | -                                                                          |
| `_handlerAddresses.claim.3?`         | `string`                                                                                                                               | -                                                                          |
| `_handlerAddresses.refund?`          | { `timelock?`: `string`; }                                                                                                             | -                                                                          |
| `_handlerAddresses.refund.timelock?` | `string`                                                                                                                               | -                                                                          |
| `contractDeploymentHeight?`          | `number`                                                                                                                               | The height at which this contract was deployed (default is used otherwise) |

#### Returns

`StarknetSwapContract`

#### Overrides

```
StarknetContractBase<typeof EscrowManagerAbi>.constructor
```

## Properties

### btcRelay

```
readonly btcRelay: StarknetBtcRelay<any>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:135](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L135)

***

### chainId

```
readonly chainId: "STARKNET" = "STARKNET";
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:96](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L96)

Chain identifier string

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`chainId`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#chainid-1)

***

### Claim

```
readonly Claim: StarknetSwapClaim;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:124](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L124)

***

### claimHandlersByAddress

```
readonly claimHandlersByAddress: object = {};
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:129](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L129)

#### Index Signature

```
[address: string]: IClaimHandler<any, any>
```

***

### claimHandlersBySwapType

```
readonly claimHandlersBySwapType: object = {};
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:130](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L130)

#### 0?

```
optional 0: IClaimHandler<any, any>;
```

#### 1?

```
optional 1: IClaimHandler<any, any>;
```

#### 2?

```
optional 2: IClaimHandler<any, any>;
```

#### 3?

```
optional 3: IClaimHandler<any, any>;
```

***

### claimWithSecretTimeout

```
readonly claimWithSecretTimeout: number = 180;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:103](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L103)

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

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`claimWithSecretTimeout`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#claimwithsecrettimeout)

***

### claimWithTxDataTimeout

```
readonly claimWithTxDataTimeout: number = 180;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:107](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L107)

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

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`claimWithTxDataTimeout`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#claimwithtxdatatimeout)

***

### contract

```
readonly contract: TypedContractV2<T>;
```

Defined in: [atomiq-chain-starknet/src/starknet/contract/StarknetContractBase.ts:11](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/contract/StarknetContractBase.ts#L11)

#### Inherited from

```
StarknetContractBase.contract
```

***

### Init

```
readonly Init: StarknetSwapInit;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:122](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L122)

***

### LpVault

```
readonly LpVault: StarknetLpVault;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:125](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L125)

***

### Refund

```
readonly Refund: StarknetSwapRefund;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:123](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L123)

***

### refundHandlersByAddress

```
readonly refundHandlersByAddress: object = {};
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:132](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L132)

#### Index Signature

```
[address: string]: IHandler<any, any>
```

***

### refundTimeout

```
readonly refundTimeout: number = 180;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:111](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L111)

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

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`refundTimeout`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#refundtimeout)

***

### supportsInitWithoutClaimer

```
readonly supportsInitWithoutClaimer: true = true;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:92](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L92)

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

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`supportsInitWithoutClaimer`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#supportsinitwithoutclaimer)

***

### timelockRefundHandler

```
readonly timelockRefundHandler: IHandler<any, any>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:133](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L133)

## Methods

### claimWithSecret()

```
claimWithSecret(

   signer, 

   swapData, 

   secret, 

   checkExpiry?, 

   initAta?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:864](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L864)

Signs & sends transactions required for claiming an HTLC swap

#### Parameters

| Parameter      | Type                                                                                                                       | Description                                                                                                  |
| -------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`       | [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md)     | Signer for which the transaction should be created (doesn't need to match the claimer)                       |
| `swapData`     | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | 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`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`claimWithSecret`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#claimwithsecret)

***

### claimWithTxData()

```
claimWithTxData(

   signer, 

   swapData, 

   tx, 

   requiredConfirmations, 

   vout, 

   commitedHeader?, 

   synchronizer?, 

   initAta?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:880](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L880)

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

#### Parameters

| Parameter                | Type                                                                                                                                                                                                                                                                                      | Description                                                                                                  |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`                 | [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md)                                                                                                                                                                    | Signer for which the transaction should be created (doesn't need to match the claimer)                       |
| `swapData`               | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md)                                                                                                                                                                | Swap to claim                                                                                                |
| `tx`                     | { `blockhash`: `string`; `confirmations`: `number`; `height`: `number`; `hex`: `string`; `txid`: `string`; }                                                                                                                                                                              | Bitcoin transaction containing the required output                                                           |
| `tx.blockhash`           | `string`                                                                                                                                                                                                                                                                                  | -                                                                                                            |
| `tx.confirmations`       | `number`                                                                                                                                                                                                                                                                                  | -                                                                                                            |
| `tx.height`              | `number`                                                                                                                                                                                                                                                                                  | -                                                                                                            |
| `tx.hex?`                | `string`                                                                                                                                                                                                                                                                                  | -                                                                                                            |
| `tx.txid?`               | `string`                                                                                                                                                                                                                                                                                  | -                                                                                                            |
| `requiredConfirmations?` | `number`                                                                                                                                                                                                                                                                                  | Required confirmations for the escrow to be claimed                                                          |
| `vout?`                  | `number`                                                                                                                                                                                                                                                                                  | Bitcoin tx's output index of the required output                                                             |
| `commitedHeader?`        | [`StarknetBtcStoredHeader`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetBtcStoredHeader.md)                                                                                                                                                  | Optional already retrieved stored header to use for proving                                                  |
| `synchronizer?`          | `RelaySynchronizer`<[`StarknetBtcStoredHeader`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetBtcStoredHeader.md), [`StarknetTx`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/type-aliases/StarknetTx.md), `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`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`claimWithTxData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#claimwithtxdata)

***

### createSwapData()

```
createSwapData(

   type, 

   offerer, 

   claimer, 

   token, 

   amount, 

   claimData, 

   sequence, 

   expiry, 

   payIn, 

   payOut, 

   securityDeposit, 

   claimerBounty, 

depositToken): Promise<StarknetSwapData>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:676](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L676)

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                                                                                                            |
| `claimData`       | `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`<[`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md)>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`createSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#createswapdata)

***

### deposit()

```
deposit(

   signer, 

   token, 

   amount, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:978](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L978)

Deposits funds to the trading LP vault

#### Parameters

| Parameter    | Type                                                                                                                   | Description                     |
| ------------ | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
| `signer`     | [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md) | 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`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`deposit`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#deposit)

***

### getBalance()

```
getBalance(

   signer, 

   tokenAddress, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:767](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L767)

Returns the token balance of a given signer's address

#### Parameters

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

#### Returns

`Promise`<`bigint`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getBalance`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getbalance)

***

### getClaimFee()

```
getClaimFee(

   signer, 

   swapData, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:1022](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L1022)

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

#### Parameters

| Parameter  | Type                                                                                                                       | Description                                           |
| ---------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| `signer`   | `string`                                                                                                                   | Signer claiming the swap                              |
| `swapData` | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to claim                                         |
| `feeRate?` | `string`                                                                                                                   | Optional fee rate (fetched on-demand if not provided) |

#### Returns

`Promise`<`bigint`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getClaimFee`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getclaimfee)

***

### getClaimFeeRate()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:1015](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L1015)

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

#### Parameters

| Parameter  | Type                                                                                                                       | Description              |
| ---------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| `signer`   | `string`                                                                                                                   | Signer claiming the swap |
| `swapData` | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to claim            |

#### Returns

`Promise`<`string`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getClaimFeeRate`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getclaimfeerate)

***

### getCommitFee()

```
getCommitFee(

   signer, 

   swapData, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:1029](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L1029)

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

#### Parameters

| Parameter  | Type                                                                                                                       | Description                                           |
| ---------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| `signer`   | `string`                                                                                                                   |                                                       |
| `swapData` | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to initiate                                      |
| `feeRate?` | `string`                                                                                                                   | Optional fee rate (fetched on-demand if not provided) |

#### Returns

`Promise`<`bigint`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getCommitFee`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getcommitfee)

***

### getCommitStatus()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:374](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L374)

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`                                                                                                                   |             |
| `data`    | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) |             |

#### Returns

`Promise`<`SwapCommitState`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getCommitStatus`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getcommitstatus)

***

### getCommitStatuses()

```
getCommitStatuses(request): Promise<{

[p: string]: SwapCommitState;

}>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:468](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L468)

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`<{ \[`p`: `string`]: `SwapCommitState`; }>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getCommitStatuses`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getcommitstatuses)

***

### getDataSignature()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:252](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L252)

Signs the given data with the provided signer

#### Parameters

| Parameter | Type                                                                                                                   | Description                |
| --------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| `signer`  | [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md) | Signer to sign the message |
| `data`    | `Buffer`                                                                                                               | Data to sign               |

#### Returns

`Promise`<`string`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getDataSignature`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getdatasignature)

***

### getExtraData()

```
getExtraData(

   outputScript, 

   amount, 

   confirmations, 

   nonce?): Buffer;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:355](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L355)

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`

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getExtraData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getextradata)

***

### getHashForHtlc()

```
getHashForHtlc(paymentHash): Buffer;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:346](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L346)

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

#### Parameters

| Parameter     | Type     | Description |
| ------------- | -------- | ----------- |
| `paymentHash` | `Buffer` |             |

#### Returns

`Buffer`

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getHashForHtlc`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#gethashforhtlc)

***

### getHashForOnchain()

```
getHashForOnchain(

   outputScript, 

   amount, 

   confirmations, 

   nonce?): Buffer;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:318](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L318)

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`

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getHashForOnchain`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#gethashforonchain)

***

### getHashForTxId()

```
getHashForTxId(txId, confirmations): Buffer<ArrayBufferLike>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:305](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L305)

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`<`ArrayBufferLike`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getHashForTxId`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#gethashfortxid)

***

### getHistoricalSwaps()

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

  latestBlockheight?: number;

  swaps: {

   [escrowHash: string]: object;

  };

}>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:492](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L492)

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`; }; }>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getHistoricalSwaps`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#gethistoricalswaps)

***

### getInitAuthorizationExpiry()

```
getInitAuthorizationExpiry(

   swapData, 

   sig, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:224](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L224)

Returns the expiry timestamp (UNIX milliseconds) of the authorization

#### Parameters

| Parameter         | Type                                                                                                                       | Description                                                 |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| `swapData`        | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap                                                        |
| `sig`             | `SignatureData`                                                                                                            | Signature data                                              |
| `preFetchedData?` | `StarknetPreFetchVerification`                                                                                             | Optional pre-fetched data required for signature validation |

#### Returns

`Promise`<`number`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getInitAuthorizationExpiry`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getinitauthorizationexpiry)

***

### getInitFeeRate()

```
getInitFeeRate(

   offerer?, 

   claimer?, 

   token?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:1001](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L1001)

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`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getInitFeeRate`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getinitfeerate)

***

### getInitPayInFeeRate()

```
getInitPayInFeeRate(

   offerer?, 

   claimer?, 

   token?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:994](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L994)

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`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getInitPayInFeeRate`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getinitpayinfeerate)

***

### getInitSignature()

```
getInitSignature(

   signer, 

   swapData, 

   authorizationTimeout, 

   preFetchedBlockData?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:210](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L210)

Generates the initialization signature

#### Parameters

| Parameter              | Type                                                                                                                       | Description                                                   |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| `signer`               | [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md)     | Signer to use for signing the message                         |
| `swapData`             | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to sign                                                  |
| `authorizationTimeout` | `number`                                                                                                                   | Timeout of the authorization                                  |
| `preFetchedBlockData?` | `never`                                                                                                                    | Optional pre-fetched data required for creating the signature |
| `feeRate?`             | `string`                                                                                                                   | Optional fee rate to use for the authorization                |

#### Returns

`Promise`<`SignatureData`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getInitSignature`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getinitsignature)

***

### getIntermediaryReputation()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:777](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L777)

Returns intermediary's reputation for a given token swaps

#### Parameters

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

#### Returns

`Promise`<`IntermediaryReputationType`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getIntermediaryReputation`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getintermediaryreputation)

***

### getRefundFee()

```
getRefundFee(

   signer, 

   swapData, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:1036](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L1036)

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

#### Parameters

| Parameter  | Type                                                                                                                       | Description                                           |
| ---------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| `signer`   | `string`                                                                                                                   |                                                       |
| `swapData` | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to refund                                        |
| `feeRate?` | `string`                                                                                                                   | Optional fee rate (fetched on-demand if not provided) |

#### Returns

`Promise`<`bigint`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getRefundFee`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getrefundfee)

***

### getRefundFeeRate()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:1008](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L1008)

Returns the fee rate for refunding a swap

#### Parameters

| Parameter  | Type                                                                                                                       | Description    |
| ---------- | -------------------------------------------------------------------------------------------------------------------------- | -------------- |
| `swapData` | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to refund |

#### Returns

`Promise`<`string`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getRefundFeeRate`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getrefundfeerate)

***

### getRefundSignature()

```
getRefundSignature(

   signer, 

   swapData, 

authorizationTimeout): Promise<SignatureData>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:238](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L238)

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

#### Parameters

| Parameter              | Type                                                                                                                       | Description                                                                      |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `signer`               | [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md)     | Signer to use for signing the message (must be the same as offerer in swap data) |
| `swapData`             | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to refund                                                                   |
| `authorizationTimeout` | `number`                                                                                                                   | Timeout of the provided refund authorization                                     |

#### Returns

`Promise`<`SignatureData`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`getRefundSignature`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#getrefundsignature)

***

### init()

```
init(

   signer, 

   swapData, 

   signature, 

   skipChecks?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:941](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L941)

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

#### Parameters

| Parameter     | Type                                                                                                                       | Description                                                                               |
| ------------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `signer`      | [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md)     | Signer to use for the transaction (must match claimer in swap data)                       |
| `swapData`    | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | 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`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`init`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#init)

***

### isClaimable()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:268](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L268)

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`                                                                                                                   |             |
| `data`    | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) |             |

#### Returns

`Promise`<`boolean`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`isClaimable`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#isclaimable)

***

### isCommited()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:277](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L277)

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

#### Parameters

| Parameter  | Type                                                                                                                       | Description |
| ---------- | -------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `swapData` | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) |             |

#### Returns

`Promise`<`boolean`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`isCommited`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#iscommited)

***

### isExpired()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:285](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L285)

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 |
| `data`    | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to check                         |

#### Returns

`Promise`<`boolean`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`isExpired`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#isexpired)

***

### isInitAuthorizationExpired()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:231](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L231)

Checks whether a given init signature is already expired

#### Parameters

| Parameter  | Type                                                                                                                       | Description    |
| ---------- | -------------------------------------------------------------------------------------------------------------------------- | -------------- |
| `swapData` | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap           |
| `sig`      | `SignatureData`                                                                                                            | Signature data |

#### Returns

`Promise`<`boolean`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`isInitAuthorizationExpired`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#isinitauthorizationexpired)

***

### isRequestRefundable()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:295](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L295)

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`                                                                                                                   |             |
| `data`    | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) |             |

#### Returns

`Promise`<`boolean`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`isRequestRefundable`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#isrequestrefundable)

***

### isValidDataSignature()

```
isValidDataSignature(

   data, 

   signature, 

publicKey): Promise<boolean>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:259](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L259)

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`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`isValidDataSignature`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#isvaliddatasignature)

***

### isValidInitAuthorization()

```
isValidInitAuthorization(

   sender, 

   swapData, 

   sig, 

   feeRate?, 

preFetchedData?): Promise<null>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:217](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L217)

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`        | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to initialize                                                           |
| `sig`             | `SignatureData`                                                                                                            | Signature data                                                               |
| `feeRate?`        | `string`                                                                                                                   | Fee rate used for the authorization                                          |
| `preFetchedData?` | `StarknetPreFetchVerification`                                                                                             | Optional pre-fetched data required for signature validation                  |

#### Returns

`Promise`<`null`>

The message being signed if valid or null if invalid signature

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`isValidInitAuthorization`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#isvalidinitauthorization)

***

### isValidRefundAuthorization()

```
isValidRefundAuthorization(swapData, sig): Promise<null>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:245](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L245)

Checks whether a given refund signature is valid

#### Parameters

| Parameter  | Type                                                                                                                       | Description                         |
| ---------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| `swapData` | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to refund                      |
| `sig`      | `SignatureData`                                                                                                            | Signature received from the claimer |

#### Returns

`Promise`<`null`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`isValidRefundAuthorization`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#isvalidrefundauthorization)

***

### preFetchForInitSignatureVerification()

```
preFetchForInitSignatureVerification(): Promise<StarknetPreFetchVerification>;
```

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:203](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L203)

Pre-fetches data required for init signature verification

#### Returns

`Promise`<`StarknetPreFetchVerification`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`preFetchForInitSignatureVerification`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#prefetchforinitsignatureverification)

***

### refund()

```
refund(

   signer, 

   swapData, 

   check?, 

   initAta?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:906](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L906)

Signs & sends transactions for refunding a timed out swap

#### Parameters

| Parameter    | Type                                                                                                                       | Description                                                                                                  |
| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`     | [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md)     | Signer to use for the transaction (must match offerer in swap data)                                          |
| `swapData`   | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | 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`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`refund`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#refund)

***

### refundWithAuthorization()

```
refundWithAuthorization(

   signer, 

   swapData, 

   signature, 

   check?, 

   initAta?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:923](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L923)

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

#### Parameters

| Parameter    | Type                                                                                                                       | Description                                                                                                  |
| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`     | [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md)     | Signer to use for the transaction (must match offerer in swap data)                                          |
| `swapData`   | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | 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`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`refundWithAuthorization`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#refundwithauthorization)

***

### start()

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:195](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L195)

Initializes the swap contract

#### Returns

`Promise`<`void`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`start`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#start)

***

### txsClaimWithSecret()

```
txsClaimWithSecret(

   signer, 

   swapData, 

   secret, 

   checkExpiry?, 

   initAta?, 

   feeRate?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:786](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L786)

Returns the unsigned transactions required for claiming an HTLC swap

#### Parameters

| Parameter       | Type                                                                                                                               | Description                                                                                                  |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`        | `string` \| [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md) | Signer for which the transaction should be created (doesn't need to match the claimer)                       |
| `swapData`      | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md)         | 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`<[`StarknetTx`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/type-aliases/StarknetTx.md)\[]>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`txsClaimWithSecret`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#txsclaimwithsecret)

***

### txsClaimWithTxData()

```
txsClaimWithTxData(

   signer, 

   swapData, 

   tx, 

   requiredConfirmations, 

   vout, 

   commitedHeader?, 

   synchronizer?, 

   initAta?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:801](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L801)

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

#### Parameters

| Parameter                | Type                                                                                                                                                                                                                                                                                      | Description                                                                                                  |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`                 | `string` \| [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md)                                                                                                                                                        | Signer for which the transaction should be created (doesn't need to match the claimer)                       |
| `swapData`               | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md)                                                                                                                                                                | Swap to claim                                                                                                |
| `tx`                     | { `blockhash`: `string`; `confirmations`: `number`; `height`: `number`; `hex`: `string`; `txid`: `string`; }                                                                                                                                                                              | Bitcoin transaction containing the required output                                                           |
| `tx.blockhash`           | `string`                                                                                                                                                                                                                                                                                  | -                                                                                                            |
| `tx.confirmations`       | `number`                                                                                                                                                                                                                                                                                  | -                                                                                                            |
| `tx.height`              | `number`                                                                                                                                                                                                                                                                                  | -                                                                                                            |
| `tx.hex?`                | `string`                                                                                                                                                                                                                                                                                  | -                                                                                                            |
| `tx.txid?`               | `string`                                                                                                                                                                                                                                                                                  | -                                                                                                            |
| `requiredConfirmations?` | `number`                                                                                                                                                                                                                                                                                  | Required confirmations for the escrow to be claimed                                                          |
| `vout?`                  | `number`                                                                                                                                                                                                                                                                                  | Bitcoin tx's output index of the required output                                                             |
| `commitedHeader?`        | [`StarknetBtcStoredHeader`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetBtcStoredHeader.md)                                                                                                                                                  | Optional already retrieved stored header to use for proving                                                  |
| `synchronizer?`          | `RelaySynchronizer`<[`StarknetBtcStoredHeader`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetBtcStoredHeader.md), [`StarknetTx`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/type-aliases/StarknetTx.md), `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`<[`StarknetTx`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/type-aliases/StarknetTx.md)\[]>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`txsClaimWithTxData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#txsclaimwithtxdata)

***

### txsDeposit()

```
txsDeposit(

   signer, 

   token, 

   amount, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:855](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L855)

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`<[`StarknetTx`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/type-aliases/StarknetTx.md)\[]>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`txsDeposit`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#txsdeposit)

***

### txsInit()

```
txsInit(

   sender, 

   swapData, 

   sig, 

   skipChecks?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:841](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L841)

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`    | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to init                                                                              |
| `sig`         | `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`<[`StarknetTx`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/type-aliases/StarknetTx.md)\[]>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`txsInit`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#txsinit)

***

### txsRefund()

```
txsRefund(

   signer, 

   swapData, 

   check?, 

   initAta?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:827](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L827)

Returns the transactions for refunding a timed out swap

#### Parameters

| Parameter  | Type                                                                                                                       | Description                                                                                                  |
| ---------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `signer`   | `string`                                                                                                                   | Signer of the refund transaction                                                                             |
| `swapData` | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | 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`<[`StarknetTx`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/type-aliases/StarknetTx.md)\[]>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`txsRefund`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#txsrefund)

***

### txsRefundWithAuthorization()

```
txsRefundWithAuthorization(

   signer, 

   swapData, 

   sig, 

   check?, 

   initAta?, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:834](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L834)

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` | [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md) | Swap to refund                                                                                               |
| `sig`      | `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`<[`StarknetTx`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/type-aliases/StarknetTx.md)\[]>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`txsRefundWithAuthorization`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#txsrefundwithauthorization)

***

### txsWithdraw()

```
txsWithdraw(

   signer, 

   token, 

   amount, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:848](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L848)

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`<[`StarknetTx`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/type-aliases/StarknetTx.md)\[]>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`txsWithdraw`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#txswithdraw)

***

### withdraw()

```
withdraw(

   signer, 

   token, 

   amount, 

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

Defined in: [atomiq-chain-starknet/src/starknet/swaps/StarknetSwapContract.ts:964](https://github.com/atomiqlabs/atomiq-chain-starknet/blob/697277c430597a8514a43540ef8b9a10e2b6a595/src/starknet/swaps/StarknetSwapContract.ts#L964)

Withdraws funds from the trading LP vault

#### Parameters

| Parameter    | Type                                                                                                                   | Description                        |
| ------------ | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| `signer`     | [`StarknetSigner`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSigner.md) | 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`>

#### Implementation of

[`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md).[`withdraw`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md#withdraw)
