Skip to main content

Intermediary

Defined in: atomiq-sdk/src/intermediaries/Intermediary.ts:48

Represents an intermediary (liquidity provider)

Constructors

Constructor

new Intermediary(
url,
addresses,
services,
reputation,
contractVersions): Intermediary;

Defined in: atomiq-sdk/src/intermediaries/Intermediary.ts:102

Parameters

ParameterType
urlstring
addresses{ [chainIdentifier: string]: string; }
servicesServicesType
reputation{ [chainIdentifier: string]: SingleChainReputationType; }
contractVersions{ [chainIdentifier: string]: string; }

Returns

Intermediary

Properties

addresses

readonly addresses: object;

Defined in: atomiq-sdk/src/intermediaries/Intermediary.ts:57

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

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

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

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

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

Swap protocol services offered by the intermediary


swapBounds

readonly swapBounds: object;

Defined in: atomiq-sdk/src/intermediaries/Intermediary.ts:69

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

Base URL where the intermediary is listening for HTTP requests

Methods

getAddress()

getAddress(chainIdentifier): string;

Defined in: atomiq-sdk/src/intermediaries/Intermediary.ts:252

Returns intermediary's address on a given smart chain

Parameters

ParameterTypeDescription
chainIdentifierstringChain identifier of the smart chain

Returns

string


getContractVersion()

getContractVersion(chainIdentifier): string;

Defined in: atomiq-sdk/src/intermediaries/Intermediary.ts:261

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

Parameters

ParameterTypeDescription
chainIdentifierstring

Returns

string


getContractVersionsForLps()

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

Defined in: atomiq-sdk/src/intermediaries/Intermediary.ts:271

Returns the range of contract versions used by the LPs

Parameters

ParameterTypeDescription
chainIdentifierstring
lpsIntermediary[]

Returns

string[]


getLiquidity()

getLiquidity(
chainIdentifier,
swapContract,
token,
abortSignal?): Promise<bigint>;

Defined in: atomiq-sdk/src/intermediaries/Intermediary.ts:219

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

Parameters

ParameterTypeDescription
chainIdentifierstringChain identifier of the chain on which to fetch the reputation
swapContractSwapContract<any>Swap contract for the requested smart chain
tokenstringToken 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

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

Parameters

ParameterTypeDescription
chainIdentifierstringChain identifier of the chain on which to fetch the reputation
swapContractSwapContract<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

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

Parameters

ParameterTypeDescription
swapTypeSwapTypeSwap protocol service to check
chainIdstringChain identifier of the smart chain to check
tokenAddressstringAddress of the token to check

Returns

object

NameTypeDefined in
inputobjectatomiq-sdk/src/intermediaries/Intermediary.ts:141
input.max?bigintatomiq-sdk/src/intermediaries/Intermediary.ts:141
input.min?bigintatomiq-sdk/src/intermediaries/Intermediary.ts:141
outputobjectatomiq-sdk/src/intermediaries/Intermediary.ts:141
output.max?bigintatomiq-sdk/src/intermediaries/Intermediary.ts:141
output.min?bigintatomiq-sdk/src/intermediaries/Intermediary.ts:141

supportsChain()

supportsChain(chainIdentifier): boolean;

Defined in: atomiq-sdk/src/intermediaries/Intermediary.ts:242

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

Parameters

ParameterTypeDescription
chainIdentifierstringChain identifier of the smart chain

Returns

boolean