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
| Parameter | Type | Default value |
|---|---|---|
swapContracts | { [key: string]: SwapContract<SwapData, any, any, any, AbstractSigner, string>; } | undefined |
registryUrl | string | REGISTRY_URL |
nodeUrls? | string[] | undefined |
httpRequestTimeout? | number | undefined |
maxWaitForOthersTimeout? | number | undefined |
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
| Parameter | Type | Description |
|---|---|---|
url | string | Base 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
| Parameter | Type |
|---|---|
chainIdentifier | string |
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
| Parameter | Type | Description |
|---|---|---|
chainIdentifier | string | Chain identifier of the smart chain |
swapType | SwapType | Swap protocol type |
tokenAddress | string | Token address |
amount? | bigint | Amount to be swapped in sats - BTC |
count? | number | How many intermediaries to return at most |
Returns
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
| Parameter | Type | Description |
|---|---|---|
chainIdentifier | string | Chain identifier of the smart chain |
swapType | SwapType | Swap protocol type |
tokenAddress | string | Token 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
| Parameter | Type | Description |
|---|---|---|
chainIdentifier | string | Chain identifier of the smart chain |
swapType | SwapType | Swap protocol type |
tokenAddress | string | Token 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
| Parameter | Type | Description |
|---|---|---|
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
| Parameter | Type | Description |
|---|---|---|
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
| Parameter | Type | Description |
|---|---|---|
intermediary | Intermediary |
Returns
boolean