# SwapData

Defined in: [atomiq-base/src/swaps/SwapData.ts:9](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L9)

Represents full escrow swap data and parameters

## Extended by

* [`EVMSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-evm/src/classes/EVMSwapData.md)
* [`SolanaSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-solana/src/classes/SolanaSwapData.md)
* [`StarknetSwapData`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-chain-starknet/src/classes/StarknetSwapData.md)

## Implements

* [`StorageObject`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/StorageObject.md)

## Constructors

### Constructor

```
new SwapData(): SwapData;
```

#### Returns

`SwapData`

## Properties

### deserializers

```
static deserializers: object = {};
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:14](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L14)

A mapping of deserializers for different escrow swap data types coming from different smart chain implementations

#### Index Signature

```
[type: string]: (serialized) => any
```

## Methods

### deserialize()

```
static deserialize<T>(data): T;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:23](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L23)

Deserializer parsing the chain-specific escrow swap data from a JSON-compatible object representation

#### Type Parameters

| Type Parameter           |
| ------------------------ |
| `T` *extends* `SwapData` |

#### Parameters

| Parameter | Type  | Description |
| --------- | ----- | ----------- |
| `data`    | `any` |             |

#### Returns

`T`

***

### equals()

```
abstract equals(other): boolean;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:215](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L215)

Checks equality between 2 swap data objects

#### Parameters

| Parameter | Type       | Description |
| --------- | ---------- | ----------- |
| `other`   | `SwapData` |             |

#### Returns

`boolean`

***

### getAmount()

```
abstract getAmount(): bigint;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:82](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L82)

Gets the amount of token deposited into the vault by the offerer

#### Returns

`bigint`

***

### getClaimer()

```
abstract getClaimer(): string;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:53](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L53)

Gets the claim, which receives funds from the escrow

#### Returns

`string`

***

### getClaimerBounty()

```
abstract getClaimerBounty(): bigint;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:187](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L187)

Gets the claimer bounty, an amount of native tokens deposited by the caller (initiator) on escrow initialization, that is paid out to a caller which claims the escrow as a reward, otherwise returned to the claimer if escrow is refunded

#### Returns

`bigint`

***

### getClaimHash()

```
abstract getClaimHash(): string;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:125](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L125)

Returns the claim hash of the escrow, this specifies a condition that needs to be satisfied to claim the funds from the escrow

#### Returns

`string`

***

### getConfirmationsHint()

```
abstract getConfirmationsHint(): number;
```

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

Retrieves required number of confirmations as a hint from the extra data provided, or `null` if no extra data has been provided when creating the escrow

#### Returns

`number`

***

### getDepositToken()

```
abstract getDepositToken(): string;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:201](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L201)

Returns the token used for the deposit (security deposit & claimer bounty) (usually a native token of the underlying smart chain)

#### Returns

`string`

***

### getEscrowHash()

```
abstract getEscrowHash(): string;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:130](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L130)

Returns a unique hash of this escrow

#### Returns

`string`

***

### getEscrowStruct()

```
getEscrowStruct(): any;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:228](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L228)

Returns the JSON-serialization safe representation of the underlying swap escrow struct committed (or to-be-committed) on-chain

#### Returns

`any`

***

### getExpiry()

```
abstract getExpiry(): bigint;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:100](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L100)

Returns the expiration time of this escrow, after the timeout an offerer is able to refund unilaterally. taking back funds from the escrow

#### Returns

`bigint`

***

### getExtraData()

```
abstract getExtraData(): string;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:140](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L140)

Gets the extraneous data specified when creating this escrow, this provides helpers for 3rd party claimers

#### Returns

`string`

***

### getHTLCHashHint()

```
getHTLCHashHint(): string;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:164](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L164)

Retrieves a hint providing an HTLC hash from the extra data provided, or `null` if no extra data has been provided when creating the escrow

#### Returns

`string`

***

### getNonceHint()

```
abstract getNonceHint(): bigint;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:152](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L152)

Retrieves the PrTLC transaction nonce as a hint from the extra data provided, or `null` if no extra data has been provided when creating the escrow

#### Returns

`bigint`

***

### getOfferer()

```
abstract getOfferer(): string;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:34](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L34)

Gets the offerer, which funds the escrow

#### Returns

`string`

***

### getSecurityDeposit()

```
abstract getSecurityDeposit(): bigint;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:180](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L180)

Gets the security deposit, which is an amount of native tokens deposited by the caller (initiator) on escrow initialization to guarantee the execution, this acts as a compensation for offerer if he has to refund the escrow, otherwise it is returned back to claimer after a successful claim of the escrow

#### Returns

`bigint`

***

### getSequence()

```
abstract getSequence(): bigint;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:135](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L135)

Returns a random variable sequence of this vault, used to ensure the escrow hash is always different

#### Returns

`bigint`

***

### getToken()

```
abstract getToken(): string;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:87](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L87)

Gets the address of the deposited token in a vault

#### Returns

`string`

***

### getTotalDeposit()

```
abstract getTotalDeposit(): bigint;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:195](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L195)

Returns the total deposit in native token to be deposited by the caller (initiator) on escrow initialization, due to how claimer bounty and security deposits work, this is basically a max(claimer bounty, security deposit), because either a swap is claimed (and claimer bounty is paid) or a swap is refunded (and security deposit is paid), never both!

#### Returns

`bigint`

***

### getTxoHashHint()

```
abstract getTxoHashHint(): string;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:158](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L158)

Retrieves the PrTLC transaction txo (transaction output) hash as a hint from the extra data provided, or `null` if no extra data has been provided when creating the escrow

#### Returns

`string`

***

### getType()

```
abstract getType(): ChainSwapType;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:77](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L77)

Returns the type of this escrow

#### Returns

`ChainSwapType`

***

### hasSuccessAction()

```
hasSuccessAction(): boolean;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:220](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L220)

Checks whether the escrow contains an execution action (swap+)

#### Returns

`boolean`

***

### isClaimer()

```
abstract isClaimer(address): boolean;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:67](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L67)

Checks whether the provided address is a claimer for this escrow

#### Parameters

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

#### Returns

`boolean`

***

### isDepositToken()

```
abstract isDepositToken(token): boolean;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:208](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L208)

Checks whether a provided token is used as a deposit token (security deposit & claimer bounty) for the escrow

#### Parameters

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

#### Returns

`boolean`

***

### isOfferer()

```
abstract isOfferer(address): boolean;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:48](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L48)

Checks whether the provided address is an offerer for this escrow

#### Parameters

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

#### Returns

`boolean`

***

### isPayIn()

```
abstract isPayIn(): boolean;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:114](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L114)

Whether this escrow will be funded from the offerer's wallet or from the offerer's vault inside the contract, when `true` it takes funds normally from the offerer's address, when `false` it pulls the funds from the offerer's vault inside the contract

#### Returns

`boolean`

***

### isPayOut()

```
abstract isPayOut(): boolean;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:107](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L107)

Whether this escrow will pay out the claimer, when `true` it pays out normally to the claimer's address, when `false` it instead keeps the funds inside the contract and assigns them to the claimer's vault inside the contract

#### Returns

`boolean`

***

### isToken()

```
abstract isToken(token): boolean;
```

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

Checks whether the provided token address is the actual token used by this escrow

#### Parameters

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

#### Returns

`boolean`

***

### isTrackingReputation()

```
abstract isTrackingReputation(): boolean;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:119](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L119)

Whether the outcome of this escrow should be used to track reputation of the claimer

#### Returns

`boolean`

***

### serialize()

```
abstract serialize(): any;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:72](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L72)

Serializes the object to a JSON-compatible object (i.e. no bigints, functions, etc.)

#### Returns

`any`

#### Implementation of

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

***

### setClaimer()

```
abstract setClaimer(newClaimer): void;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:60](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L60)

Sets the claimer which receives funds from the escrow

#### Parameters

| Parameter    | Type     | Description |
| ------------ | -------- | ----------- |
| `newClaimer` | `string` |             |

#### Returns

`void`

***

### setExtraData()

```
abstract setExtraData(extraData): void;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:173](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L173)

Sets the extra data with hints for this escrow

#### Parameters

| Parameter   | Type     | Description |
| ----------- | -------- | ----------- |
| `extraData` | `string` |             |

#### Returns

`void`

***

### setOfferer()

```
abstract setOfferer(newOfferer): void;
```

Defined in: [atomiq-base/src/swaps/SwapData.ts:41](https://github.com/atomiqlabs/atomiq-base/blob/df344bedbab9ab3de863e3c2d9246e90bd861d04/src/swaps/SwapData.ts#L41)

Sets the offerer to fund the escrow

#### Parameters

| Parameter    | Type     | Description |
| ------------ | -------- | ----------- |
| `newOfferer` | `string` |             |

#### Returns

`void`
