Skip to main content

IntermediaryDiscovery

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:162

Discovery service for available intermediaries (liquidity providers)

Extends

  • EventEmitter

Constructors

Constructor

new IntermediaryDiscovery(
swapContracts,
registryUrl,
nodeUrls?,
httpRequestTimeout?,
maxWaitForOthersTimeout?): IntermediaryDiscovery;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:195

Parameters

ParameterTypeDefault value
swapContracts{ [key: string]: SwapContract<SwapData, any, any, any, AbstractSigner, string>; }undefined
registryUrlstringREGISTRY_URL
nodeUrls?string[]undefined
httpRequestTimeout?numberundefined
maxWaitForOthersTimeout?numberundefined

Returns

IntermediaryDiscovery

Overrides

EventEmitter.constructor

Properties

httpRequestTimeout?

optional httpRequestTimeout: number;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:182

Timeout for the HTTP handshake (/info) requests sent to the intermediaries


intermediaries

intermediaries: Intermediary[] = [];

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:167

A current list of active intermediaries


maxWaitForOthersTimeout?

optional maxWaitForOthersTimeout: number;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:186

Maximum time (in millis) to wait for other intermediary's responses after the first one was founds


registryUrl

registryUrl: string;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:177

Registry URL used as a source for the list of intermediaries, this should be a link to a github-hosted JSON file


swapContracts

swapContracts: object;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:172

Swap contracts for checking intermediary signatures

Index Signature

[key: string]: SwapContract<SwapData, any, any, any, AbstractSigner, string>

Methods

getIntermediary()

getIntermediary(url, abortSignal?): Promise<Intermediary>;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:322

Returns the intermediary at the provided URL, either from the already fetched list of LPs or fetches the data on-demand, by sending the handshake HTTP request (/info) to the LP.

Doesn't save the fetched intermediary to the list of intermediaries if it isn't already part of the known intermediaries

Parameters

ParameterTypeDescription
urlstringBase URL of the intermediary, which accepts HTTP requests
abortSignal?AbortSignal

Returns

Promise<Intermediary>


getMultichainSwapBounds()

getMultichainSwapBounds(): MultichainSwapBounds;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:372

Returns known swap bounds (in satoshis - BTC) by aggregating values from all known intermediaries

Returns

MultichainSwapBounds


getSwapBounds()

getSwapBounds(chainIdentifier): SwapBounds;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:406

Returns aggregate swap bounds (in satoshis - BTC) as indicated by the intermediaries

Parameters

ParameterType
chainIdentifierstring

Returns

SwapBounds


getSwapCandidates()

getSwapCandidates(
chainIdentifier,
swapType,
tokenAddress,
amount?,
count?): Intermediary[];

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:483

Returns swap candidates for a specific swap type & token address

Parameters

ParameterTypeDescription
chainIdentifierstringChain identifier of the smart chain
swapTypeSwapTypeSwap protocol type
tokenAddressstringToken address
amount?bigintAmount to be swapped in sats - BTC
count?numberHow many intermediaries to return at most

Returns

Intermediary[]


getSwapMaximum()

getSwapMaximum(
chainIdentifier,
swapType,
tokenAddress): number;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:462

Returns the aggregate swap maximum (in satoshis - BTC) for a specific swap type & token as indicated by the intermediaries

Parameters

ParameterTypeDescription
chainIdentifierstringChain identifier of the smart chain
swapTypeSwapTypeSwap protocol type
tokenAddressstringToken address

Returns

number


getSwapMinimum()

getSwapMinimum(
chainIdentifier,
swapType,
tokenAddress): number;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:442

Returns the aggregate swap minimum (in satoshis - BTC) for a specific swap type & token as indicated by the intermediaries

Parameters

ParameterTypeDescription
chainIdentifierstringChain identifier of the smart chain
swapTypeSwapTypeSwap protocol type
tokenAddressstringToken address

Returns

number


init()

init(abortSignal?): Promise<void>;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:364

Initializes the discovery by fetching/reloading intermediaries

Parameters

ParameterTypeDescription
abortSignal?AbortSignal

Returns

Promise<void>


reloadIntermediaries()

reloadIntermediaries(abortSignal?): Promise<void>;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:333

Reloads the saves a list of intermediaries

Parameters

ParameterTypeDescription
abortSignal?AbortSignal

Returns

Promise<void>


removeIntermediary()

removeIntermediary(intermediary): boolean;

Defined in: atomiq-sdk/src/intermediaries/IntermediaryDiscovery.ts:509

Removes a specific intermediary from the list of active intermediaries (used for blacklisting)

Parameters

ParameterTypeDescription
intermediaryIntermediary

Returns

boolean