# Intermediary

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:48](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L48)

Represents an intermediary (liquidity provider)

## Constructors

### Constructor

```
new Intermediary(

   url, 

   addresses, 

   services, 

   reputation, 

   contractVersions): Intermediary;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:102](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L102)

#### Parameters

| Parameter          | Type                                                             |
| ------------------ | ---------------------------------------------------------------- |
| `url`              | `string`                                                         |
| `addresses`        | { \[`chainIdentifier`: `string`]: `string`; }                    |
| `services`         | `ServicesType`                                                   |
| `reputation`       | { \[`chainIdentifier`: `string`]: `SingleChainReputationType`; } |
| `contractVersions` | { \[`chainIdentifier`: `string`]: `string`; }                    |

#### Returns

`Intermediary`

## Properties

### addresses

```
readonly addresses: object;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:57](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L57)

Addresses of the intermediary on smart chains, used for checking the provided signatures

#### Index Signature

```
[chainIdentifier: string]: string
```

***

### contractVersions

```
readonly contractVersions: object;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:61](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L61)

Contract versions of the intermediary on smart chains

#### Index Signature

```
[chainIdentifier: string]: string
```

***

### liquidity

```
liquidity: object = {};
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:94](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L94)

Liquidity of the intermediary across different smart chains, this is only fetched on-demand when creating a swap where intermediary's liquidity is checked

#### Index Signature

```
[chainIdentifier: string]: SCLiquidity
```

***

### lnData?

```
optional lnData: LNNodeLiquidity;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:100](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L100)

Data about a lightning network node used by this intermediary, if it offers lightning network swaps, this is only fetched on-demand when creating a Bitcoin Lightning -> Smart chain swap through the intermediary (which necessitates checking intermediary's channel capacities)

***

### reputation

```
reputation: object = {};
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:89](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L89)

Reputation of the intermediary on different smart chains, this is only fetched on-demand when creating a swap where reputation is checked

#### Index Signature

```
[chainIdentifier: string]: SingleChainReputationType
```

***

### services

```
readonly services: ServicesType;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:65](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L65)

Swap protocol services offered by the intermediary

***

### swapBounds

```
readonly swapBounds: object;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:69](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L69)

Input/output swap bounds for various swap protocols offered by the intermediary

#### 0?

```
optional 0: object;
```

##### Index Signature

```
[chainIdentifier: string]: object
```

#### 1?

```
optional 1: object;
```

##### Index Signature

```
[chainIdentifier: string]: object
```

#### 2?

```
optional 2: object;
```

##### Index Signature

```
[chainIdentifier: string]: object
```

#### 3?

```
optional 3: object;
```

##### Index Signature

```
[chainIdentifier: string]: object
```

#### 4?

```
optional 4: object;
```

##### Index Signature

```
[chainIdentifier: string]: object
```

#### 5?

```
optional 5: object;
```

##### Index Signature

```
[chainIdentifier: string]: object
```

#### 6?

```
optional 6: object;
```

##### Index Signature

```
[chainIdentifier: string]: object
```

#### 7?

```
optional 7: object;
```

##### Index Signature

```
[chainIdentifier: string]: object
```

***

### url

```
readonly url: string;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:53](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L53)

Base URL where the intermediary is listening for HTTP requests

## Methods

### getAddress()

```
getAddress(chainIdentifier): string;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:252](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L252)

Returns intermediary's address on a given smart chain

#### Parameters

| Parameter         | Type     | Description                         |
| ----------------- | -------- | ----------------------------------- |
| `chainIdentifier` | `string` | Chain identifier of the smart chain |

#### Returns

`string`

***

### getContractVersion()

```
getContractVersion(chainIdentifier): string;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:261](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L261)

Returns the contract version used by the intermediary for a given chain

#### Parameters

| Parameter         | Type     | Description |
| ----------------- | -------- | ----------- |
| `chainIdentifier` | `string` |             |

#### Returns

`string`

***

### getContractVersionsForLps()

```
static getContractVersionsForLps(chainIdentifier, lps): string[];
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:271](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L271)

Returns the range of contract versions used by the LPs

#### Parameters

| Parameter         | Type              | Description |
| ----------------- | ----------------- | ----------- |
| `chainIdentifier` | `string`          |             |
| `lps`             | `Intermediary`\[] |             |

#### Returns

`string`\[]

***

### getLiquidity()

```
getLiquidity(

   chainIdentifier, 

   swapContract, 

   token, 

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

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:219](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L219)

Fetches, returns and saves the liquidity of the intermediary for a specific token

#### Parameters

| Parameter         | Type                                                                                                              | Description                                                    |
| ----------------- | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `chainIdentifier` | `string`                                                                                                          | Chain identifier of the chain on which to fetch the reputation |
| `swapContract`    | [`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md)<`any`> | Swap contract for the requested smart chain                    |
| `token`           | `string`                                                                                                          | Token address of the token to fetch the liquidity for          |
| `abortSignal?`    | `AbortSignal`                                                                                                     |                                                                |

#### Returns

`Promise`<`bigint`>

***

### getReputation()

```
getReputation(

   chainIdentifier, 

   swapContract, 

   tokens?, 

abortSignal?): Promise<SingleChainReputationType>;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:178](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L178)

Fetches, returns and saves the reputation of the intermediary, either for all or just for a single token

#### Parameters

| Parameter         | Type                                                                                                              | Description                                                                                                     |
| ----------------- | ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `chainIdentifier` | `string`                                                                                                          | Chain identifier of the chain on which to fetch the reputation                                                  |
| `swapContract`    | [`SwapContract`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/interfaces/SwapContract.md)<`any`> | Swap contract for the requested smart chain                                                                     |
| `tokens?`         | `string`\[]                                                                                                       | An optional array of tokens to fetch the data for (by default it uses all tokens supported by the intermediary) |
| `abortSignal?`    | `AbortSignal`                                                                                                     |                                                                                                                 |

#### Returns

`Promise`<`SingleChainReputationType`>

***

### getSwapLimits()

```
getSwapLimits(

   swapType, 

   chainId, 

   tokenAddress): object;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:141](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L141)

Returns the input/output swap limit for given swap type, chain and token

#### Parameters

| Parameter      | Type                                                                                                 | Description                                  |
| -------------- | ---------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| `swapType`     | [`SwapType`](https://docs.atomiq.exchange/sdk-reference/api/atomiq-sdk/src/enumerations/SwapType.md) | Swap protocol service to check               |
| `chainId`      | `string`                                                                                             | Chain identifier of the smart chain to check |
| `tokenAddress` | `string`                                                                                             | Address of the token to check                |

#### Returns

`object`

| Name          | Type     | Defined in                                                                                                                                                                          |
| ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `input`       | `object` | [atomiq-sdk/src/intermediaries/Intermediary.ts:141](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L141) |
| `input.max?`  | `bigint` | [atomiq-sdk/src/intermediaries/Intermediary.ts:141](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L141) |
| `input.min?`  | `bigint` | [atomiq-sdk/src/intermediaries/Intermediary.ts:141](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L141) |
| `output`      | `object` | [atomiq-sdk/src/intermediaries/Intermediary.ts:141](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L141) |
| `output.max?` | `bigint` | [atomiq-sdk/src/intermediaries/Intermediary.ts:141](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L141) |
| `output.min?` | `bigint` | [atomiq-sdk/src/intermediaries/Intermediary.ts:141](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L141) |

***

### supportsChain()

```
supportsChain(chainIdentifier): boolean;
```

Defined in: [atomiq-sdk/src/intermediaries/Intermediary.ts:242](https://github.com/atomiqlabs/atomiq-sdk/blob/786509324f7f09c427e9ccfe527d82e496f06af5/src/intermediaries/Intermediary.ts#L242)

Checks whether the intermediary supports swaps of any tokens on the smart chain

#### Parameters

| Parameter         | Type     | Description                         |
| ----------------- | -------- | ----------------------------------- |
| `chainIdentifier` | `string` | Chain identifier of the smart chain |

#### Returns

`boolean`
