@atomiqlabs/sdk 8.8.3 → 8.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.d.ts +1 -0
- package/api/index.js +3 -0
- package/dist/ApiList.d.ts +37 -0
- package/dist/ApiList.js +30 -0
- package/dist/api/ApiEndpoints.d.ts +393 -0
- package/dist/api/ApiEndpoints.js +2 -0
- package/dist/api/ApiParser.d.ts +10 -0
- package/dist/api/ApiParser.js +134 -0
- package/dist/api/ApiTypes.d.ts +157 -0
- package/dist/api/ApiTypes.js +75 -0
- package/dist/api/SerializedAction.d.ts +40 -0
- package/dist/api/SerializedAction.js +59 -0
- package/dist/api/SwapperApi.d.ts +50 -0
- package/dist/api/SwapperApi.js +431 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.js +24 -0
- package/dist/events/UnifiedSwapEventListener.d.ts +4 -3
- package/dist/events/UnifiedSwapEventListener.js +8 -2
- package/dist/http/HttpUtils.d.ts +4 -2
- package/dist/http/HttpUtils.js +10 -4
- package/dist/http/paramcoders/client/StreamingFetchPromise.d.ts +2 -1
- package/dist/http/paramcoders/client/StreamingFetchPromise.js +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/intermediaries/IntermediaryDiscovery.d.ts +7 -2
- package/dist/intermediaries/IntermediaryDiscovery.js +4 -4
- package/dist/intermediaries/apis/IntermediaryAPI.d.ts +171 -14
- package/dist/intermediaries/apis/IntermediaryAPI.js +174 -28
- package/dist/intermediaries/auth/SignedKeyBasedAuth.d.ts +14 -0
- package/dist/intermediaries/auth/SignedKeyBasedAuth.js +68 -0
- package/dist/storage/IUnifiedStorage.d.ts +45 -3
- package/dist/storage/UnifiedSwapStorage.d.ts +8 -2
- package/dist/storage/UnifiedSwapStorage.js +46 -8
- package/dist/swapper/Swapper.d.ts +41 -3
- package/dist/swapper/Swapper.js +93 -48
- package/dist/swapper/SwapperUtils.d.ts +18 -2
- package/dist/swapper/SwapperUtils.js +39 -1
- package/dist/swaps/ISwap.d.ts +70 -9
- package/dist/swaps/ISwap.js +28 -6
- package/dist/swaps/ISwapWrapper.d.ts +11 -1
- package/dist/swaps/ISwapWrapper.js +23 -3
- package/dist/swaps/escrow_swaps/IEscrowSwap.d.ts +1 -1
- package/dist/swaps/escrow_swaps/IEscrowSwap.js +4 -2
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.d.ts +2 -1
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.js +2 -2
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.js +3 -2
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.d.ts +47 -31
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.js +201 -67
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.js +6 -6
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.d.ts +82 -15
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.js +304 -98
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.js +6 -6
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.d.ts +75 -42
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.js +424 -87
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.js +7 -7
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.d.ts +54 -11
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.js +214 -41
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.d.ts +2 -1
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.js +7 -8
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.js +5 -5
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.d.ts +76 -19
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.js +290 -51
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.d.ts +3 -1
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.js +5 -5
- package/dist/swaps/trusted/ln/LnForGasSwap.d.ts +53 -12
- package/dist/swaps/trusted/ln/LnForGasSwap.js +163 -49
- package/dist/swaps/trusted/ln/LnForGasWrapper.js +1 -2
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.d.ts +14 -13
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.js +30 -47
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.d.ts +3 -1
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.js +4 -4
- package/dist/types/SwapExecutionAction.d.ts +141 -34
- package/dist/types/SwapExecutionAction.js +104 -0
- package/dist/types/SwapExecutionStep.d.ts +144 -0
- package/dist/types/SwapExecutionStep.js +87 -0
- package/dist/types/TokenAmount.d.ts +6 -0
- package/dist/types/TokenAmount.js +26 -1
- package/dist/utils/BitcoinUtils.d.ts +2 -0
- package/dist/utils/BitcoinUtils.js +34 -1
- package/dist/utils/Utils.d.ts +3 -1
- package/dist/utils/Utils.js +7 -1
- package/package.json +7 -4
- package/src/api/ApiEndpoints.ts +427 -0
- package/src/api/ApiParser.ts +138 -0
- package/src/api/ApiTypes.ts +229 -0
- package/src/api/SerializedAction.ts +97 -0
- package/src/api/SwapperApi.ts +545 -0
- package/src/api/index.ts +5 -0
- package/src/events/UnifiedSwapEventListener.ts +11 -3
- package/src/http/HttpUtils.ts +10 -4
- package/src/http/paramcoders/client/StreamingFetchPromise.ts +4 -2
- package/src/index.ts +1 -0
- package/src/intermediaries/IntermediaryDiscovery.ts +9 -2
- package/src/intermediaries/apis/IntermediaryAPI.ts +314 -30
- package/src/intermediaries/auth/SignedKeyBasedAuth.ts +69 -0
- package/src/storage/IUnifiedStorage.ts +45 -4
- package/src/storage/UnifiedSwapStorage.ts +42 -8
- package/src/swapper/Swapper.ts +134 -52
- package/src/swapper/SwapperUtils.ts +42 -2
- package/src/swaps/ISwap.ts +88 -16
- package/src/swaps/ISwapWrapper.ts +28 -3
- package/src/swaps/escrow_swaps/IEscrowSwap.ts +5 -3
- package/src/swaps/escrow_swaps/IEscrowSwapWrapper.ts +3 -1
- package/src/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.ts +4 -1
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts +264 -67
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts +6 -4
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts +390 -89
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.ts +6 -4
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts +548 -94
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.ts +7 -5
- package/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts +276 -45
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.ts +7 -6
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.ts +5 -3
- package/src/swaps/spv_swaps/SpvFromBTCSwap.ts +393 -57
- package/src/swaps/spv_swaps/SpvFromBTCWrapper.ts +5 -3
- package/src/swaps/trusted/ln/LnForGasSwap.ts +211 -47
- package/src/swaps/trusted/ln/LnForGasWrapper.ts +1 -2
- package/src/swaps/trusted/onchain/OnchainForGasSwap.ts +32 -51
- package/src/swaps/trusted/onchain/OnchainForGasWrapper.ts +5 -3
- package/src/types/SwapExecutionAction.ts +266 -43
- package/src/types/SwapExecutionStep.ts +224 -0
- package/src/types/TokenAmount.ts +36 -2
- package/src/utils/BitcoinUtils.ts +32 -0
- package/src/utils/Utils.ts +10 -1
- package/src/intermediaries/apis/TrustedIntermediaryAPI.ts +0 -258
|
@@ -3,6 +3,7 @@ import { Intermediary } from "./Intermediary";
|
|
|
3
3
|
import { SwapType } from "../enums/SwapType";
|
|
4
4
|
import { SpvVaultContract, SwapContract } from "@atomiqlabs/base";
|
|
5
5
|
import { EventEmitter } from "events";
|
|
6
|
+
import { IntermediaryAPI } from "./apis/IntermediaryAPI";
|
|
6
7
|
/**
|
|
7
8
|
* Swap handler type mapping for intermediary communication
|
|
8
9
|
*
|
|
@@ -109,6 +110,10 @@ export declare class IntermediaryDiscovery extends EventEmitter {
|
|
|
109
110
|
* @private
|
|
110
111
|
*/
|
|
111
112
|
private overrideNodeUrls?;
|
|
113
|
+
/**
|
|
114
|
+
* @private
|
|
115
|
+
*/
|
|
116
|
+
private lpApi;
|
|
112
117
|
constructor(swapContracts: {
|
|
113
118
|
[chainIdentifier: string]: {
|
|
114
119
|
[contractVersion: string]: {
|
|
@@ -116,7 +121,7 @@ export declare class IntermediaryDiscovery extends EventEmitter {
|
|
|
116
121
|
spvVaultContract: SpvVaultContract;
|
|
117
122
|
};
|
|
118
123
|
};
|
|
119
|
-
}, registryUrl?: string, nodeUrls?: string[], httpRequestTimeout?: number, maxWaitForOthersTimeout?: number);
|
|
124
|
+
}, lpApi: IntermediaryAPI, registryUrl?: string, nodeUrls?: string[], httpRequestTimeout?: number, maxWaitForOthersTimeout?: number);
|
|
120
125
|
/**
|
|
121
126
|
* Fetches the URLs of swap intermediaries from registry or from a pre-defined array of node urls
|
|
122
127
|
*
|
|
@@ -193,7 +198,7 @@ export declare class IntermediaryDiscovery extends EventEmitter {
|
|
|
193
198
|
/**
|
|
194
199
|
* Returns swap candidates for a specific swap type & token address
|
|
195
200
|
*
|
|
196
|
-
* @
|
|
201
|
+
* @remarks Also filters the LPs based on supported swap versions
|
|
197
202
|
*
|
|
198
203
|
* @param chainIdentifier Chain identifier of the smart chain
|
|
199
204
|
* @param swapType Swap protocol type
|
|
@@ -6,7 +6,6 @@ const SwapType_1 = require("../enums/SwapType");
|
|
|
6
6
|
const events_1 = require("events");
|
|
7
7
|
const buffer_1 = require("buffer");
|
|
8
8
|
const Utils_1 = require("../utils/Utils");
|
|
9
|
-
const IntermediaryAPI_1 = require("./apis/IntermediaryAPI");
|
|
10
9
|
const Logger_1 = require("../utils/Logger");
|
|
11
10
|
const HttpUtils_1 = require("../http/HttpUtils");
|
|
12
11
|
const RetryUtils_1 = require("../utils/RetryUtils");
|
|
@@ -94,7 +93,7 @@ const DEFAULT_CHAIN = "SOLANA";
|
|
|
94
93
|
* @category LPs
|
|
95
94
|
*/
|
|
96
95
|
class IntermediaryDiscovery extends events_1.EventEmitter {
|
|
97
|
-
constructor(swapContracts, registryUrl = REGISTRY_URL, nodeUrls, httpRequestTimeout, maxWaitForOthersTimeout) {
|
|
96
|
+
constructor(swapContracts, lpApi, registryUrl = REGISTRY_URL, nodeUrls, httpRequestTimeout, maxWaitForOthersTimeout) {
|
|
98
97
|
super();
|
|
99
98
|
/**
|
|
100
99
|
* A current list of active intermediaries
|
|
@@ -105,6 +104,7 @@ class IntermediaryDiscovery extends events_1.EventEmitter {
|
|
|
105
104
|
this.overrideNodeUrls = nodeUrls;
|
|
106
105
|
this.httpRequestTimeout = httpRequestTimeout;
|
|
107
106
|
this.maxWaitForOthersTimeout = maxWaitForOthersTimeout;
|
|
107
|
+
this.lpApi = lpApi;
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* Fetches the URLs of swap intermediaries from registry or from a pre-defined array of node urls
|
|
@@ -129,7 +129,7 @@ class IntermediaryDiscovery extends events_1.EventEmitter {
|
|
|
129
129
|
* @param abortSignal
|
|
130
130
|
*/
|
|
131
131
|
async getNodeInfo(url, abortSignal) {
|
|
132
|
-
const response = await (0, RetryUtils_1.tryWithRetries)(() =>
|
|
132
|
+
const response = await (0, RetryUtils_1.tryWithRetries)(() => this.lpApi.getIntermediaryInfo(url, this.httpRequestTimeout, abortSignal), { maxRetries: 3, delay: 100, exponential: true }, undefined, abortSignal, "debug");
|
|
133
133
|
abortSignal?.throwIfAborted();
|
|
134
134
|
const promises = [];
|
|
135
135
|
const addresses = {};
|
|
@@ -365,7 +365,7 @@ class IntermediaryDiscovery extends events_1.EventEmitter {
|
|
|
365
365
|
/**
|
|
366
366
|
* Returns swap candidates for a specific swap type & token address
|
|
367
367
|
*
|
|
368
|
-
* @
|
|
368
|
+
* @remarks Also filters the LPs based on supported swap versions
|
|
369
369
|
*
|
|
370
370
|
* @param chainIdentifier Chain identifier of the smart chain
|
|
371
371
|
* @param swapType Swap protocol type
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { FieldTypeEnum, RequestSchemaResult } from "../../http/paramcoders/SchemaVerifier";
|
|
3
|
+
import { FieldTypeEnum, RequestSchema, RequestSchemaResult, RequestSchemaResultPromise } from "../../http/paramcoders/SchemaVerifier";
|
|
4
|
+
import { RequestBody } from "../../http/paramcoders/client/StreamingFetchPromise";
|
|
4
5
|
export type InfoHandlerResponse = {
|
|
5
6
|
envelope: string;
|
|
6
7
|
chains: {
|
|
@@ -264,7 +265,108 @@ export type SpvFromBTCInit = {
|
|
|
264
265
|
quoteId: string;
|
|
265
266
|
psbtHex: string;
|
|
266
267
|
};
|
|
268
|
+
export declare enum TrustedInvoiceStatusResponseCodes {
|
|
269
|
+
EXPIRED = 10001,
|
|
270
|
+
PAID = 10000,
|
|
271
|
+
AWAIT_PAYMENT = 10010,
|
|
272
|
+
PENDING = 10011,
|
|
273
|
+
TX_SENT = 10012
|
|
274
|
+
}
|
|
275
|
+
export type TrustedInvoiceStatusResponse = {
|
|
276
|
+
code: TrustedInvoiceStatusResponseCodes.TX_SENT | TrustedInvoiceStatusResponseCodes.PAID;
|
|
277
|
+
msg: string;
|
|
278
|
+
data: {
|
|
279
|
+
txId: string;
|
|
280
|
+
};
|
|
281
|
+
} | {
|
|
282
|
+
code: Exclude<TrustedInvoiceStatusResponseCodes, TrustedInvoiceStatusResponseCodes.TX_SENT | TrustedInvoiceStatusResponseCodes.PAID>;
|
|
283
|
+
msg: string;
|
|
284
|
+
};
|
|
285
|
+
export type TrustedFromBTCLNInit = {
|
|
286
|
+
address: string;
|
|
287
|
+
amount: bigint;
|
|
288
|
+
token: string;
|
|
289
|
+
};
|
|
290
|
+
declare const TrustedFromBTCLNResponseSchema: {
|
|
291
|
+
readonly pr: FieldTypeEnum.String;
|
|
292
|
+
readonly swapFee: FieldTypeEnum.BigInt;
|
|
293
|
+
readonly swapFeeSats: FieldTypeEnum.BigInt;
|
|
294
|
+
readonly total: FieldTypeEnum.BigInt;
|
|
295
|
+
};
|
|
296
|
+
export type TrustedFromBTCLNResponseType = RequestSchemaResult<typeof TrustedFromBTCLNResponseSchema>;
|
|
297
|
+
export declare enum TrustedAddressStatusResponseCodes {
|
|
298
|
+
EXPIRED = 10001,
|
|
299
|
+
PAID = 10000,
|
|
300
|
+
AWAIT_PAYMENT = 10010,
|
|
301
|
+
AWAIT_CONFIRMATION = 10011,
|
|
302
|
+
PENDING = 10013,
|
|
303
|
+
TX_SENT = 10012,
|
|
304
|
+
REFUNDED = 10014,
|
|
305
|
+
DOUBLE_SPENT = 10015,
|
|
306
|
+
REFUNDABLE = 10016
|
|
307
|
+
}
|
|
308
|
+
export type TrustedAddressStatusResponse = {
|
|
309
|
+
code: TrustedAddressStatusResponseCodes.TX_SENT | TrustedAddressStatusResponseCodes.PAID;
|
|
310
|
+
msg: string;
|
|
311
|
+
data: {
|
|
312
|
+
adjustedAmount: string;
|
|
313
|
+
adjustedTotal: string;
|
|
314
|
+
adjustedFee?: string;
|
|
315
|
+
adjustedFeeSats?: string;
|
|
316
|
+
txId: string;
|
|
317
|
+
scTxId: string;
|
|
318
|
+
};
|
|
319
|
+
} | {
|
|
320
|
+
code: TrustedAddressStatusResponseCodes.AWAIT_CONFIRMATION | TrustedAddressStatusResponseCodes.PENDING;
|
|
321
|
+
msg: string;
|
|
322
|
+
data: {
|
|
323
|
+
adjustedAmount: string;
|
|
324
|
+
adjustedTotal: string;
|
|
325
|
+
adjustedFee?: string;
|
|
326
|
+
adjustedFeeSats?: string;
|
|
327
|
+
txId: string;
|
|
328
|
+
};
|
|
329
|
+
} | {
|
|
330
|
+
code: TrustedAddressStatusResponseCodes.REFUNDABLE;
|
|
331
|
+
msg: string;
|
|
332
|
+
data: {
|
|
333
|
+
adjustedAmount: string;
|
|
334
|
+
};
|
|
335
|
+
} | {
|
|
336
|
+
code: TrustedAddressStatusResponseCodes.REFUNDED | TrustedAddressStatusResponseCodes.DOUBLE_SPENT;
|
|
337
|
+
msg: string;
|
|
338
|
+
data: {
|
|
339
|
+
txId: string;
|
|
340
|
+
};
|
|
341
|
+
} | {
|
|
342
|
+
code: TrustedAddressStatusResponseCodes.AWAIT_PAYMENT | TrustedAddressStatusResponseCodes.EXPIRED;
|
|
343
|
+
msg: string;
|
|
344
|
+
};
|
|
345
|
+
export type TrustedFromBTCInit = {
|
|
346
|
+
address: string;
|
|
347
|
+
amount: bigint;
|
|
348
|
+
token: string;
|
|
349
|
+
refundAddress?: string;
|
|
350
|
+
};
|
|
351
|
+
declare const TrustedFromBTCResponseSchema: {
|
|
352
|
+
readonly paymentHash: FieldTypeEnum.String;
|
|
353
|
+
readonly sequence: FieldTypeEnum.BigInt;
|
|
354
|
+
readonly btcAddress: FieldTypeEnum.String;
|
|
355
|
+
readonly amountSats: FieldTypeEnum.BigInt;
|
|
356
|
+
readonly swapFeeSats: FieldTypeEnum.BigInt;
|
|
357
|
+
readonly swapFee: FieldTypeEnum.BigInt;
|
|
358
|
+
readonly total: FieldTypeEnum.BigInt;
|
|
359
|
+
readonly intermediaryKey: FieldTypeEnum.String;
|
|
360
|
+
readonly recommendedFee: FieldTypeEnum.Number;
|
|
361
|
+
readonly expiresAt: FieldTypeEnum.Number;
|
|
362
|
+
};
|
|
363
|
+
export type TrustedFromBTCResponseType = RequestSchemaResult<typeof TrustedFromBTCResponseSchema>;
|
|
267
364
|
export declare class IntermediaryAPI {
|
|
365
|
+
requestHeaders?: (type: "GET" | "POST", url: string, body?: any) => Record<string, string>;
|
|
366
|
+
constructor(requestHeaders?: (type: "GET" | "POST", url: string, body?: any) => Record<string, string>);
|
|
367
|
+
httpGet<T>(url: string, timeout?: number, abortSignal?: AbortSignal, allowNon200?: boolean): Promise<T>;
|
|
368
|
+
httpPost<T>(url: string, body: any, timeout?: number, abortSignal?: AbortSignal): Promise<T>;
|
|
369
|
+
streamingFetchPromise<T extends RequestSchema>(url: string, body: RequestBody, schema: T, timeout?: number, signal?: AbortSignal, streamRequest?: boolean): Promise<RequestSchemaResultPromise<T>>;
|
|
268
370
|
/**
|
|
269
371
|
* Returns the information about a specific intermediary
|
|
270
372
|
*
|
|
@@ -275,7 +377,7 @@ export declare class IntermediaryAPI {
|
|
|
275
377
|
* @throws {RequestError} If non-200 http response code is returned
|
|
276
378
|
* @throws {Error} If the supplied nonce doesn't match the response
|
|
277
379
|
*/
|
|
278
|
-
|
|
380
|
+
getIntermediaryInfo(baseUrl: string, timeout?: number, abortSignal?: AbortSignal): Promise<InfoHandlerResponse>;
|
|
279
381
|
/**
|
|
280
382
|
* Returns the information about an outcome of the To BTC swap
|
|
281
383
|
*
|
|
@@ -287,7 +389,7 @@ export declare class IntermediaryAPI {
|
|
|
287
389
|
*
|
|
288
390
|
* @throws {RequestError} If non-200 http response code is returned
|
|
289
391
|
*/
|
|
290
|
-
|
|
392
|
+
getRefundAuthorization(url: string, paymentHash: string, sequence: bigint, timeout?: number, abortSignal?: AbortSignal): Promise<RefundAuthorizationResponse>;
|
|
291
393
|
/**
|
|
292
394
|
* Returns the information about the payment of the From BTCLN swaps
|
|
293
395
|
*
|
|
@@ -298,7 +400,7 @@ export declare class IntermediaryAPI {
|
|
|
298
400
|
*
|
|
299
401
|
* @throws {RequestError} If non-200 http response code is returned
|
|
300
402
|
*/
|
|
301
|
-
|
|
403
|
+
getPaymentAuthorization(url: string, paymentHash: string, timeout?: number, abortSignal?: AbortSignal): Promise<PaymentAuthorizationResponse>;
|
|
302
404
|
/**
|
|
303
405
|
* Returns the status of the payment of the From BTCLN swaps
|
|
304
406
|
*
|
|
@@ -309,7 +411,7 @@ export declare class IntermediaryAPI {
|
|
|
309
411
|
*
|
|
310
412
|
* @throws {RequestError} If non-200 http response code is returned
|
|
311
413
|
*/
|
|
312
|
-
|
|
414
|
+
getInvoiceStatus(url: string, paymentHash: string, timeout?: number, abortSignal?: AbortSignal): Promise<InvoiceStatusResponse>;
|
|
313
415
|
/**
|
|
314
416
|
* Initiate To BTC swap with an intermediary
|
|
315
417
|
*
|
|
@@ -322,7 +424,7 @@ export declare class IntermediaryAPI {
|
|
|
322
424
|
*
|
|
323
425
|
* @throws {RequestError} If non-200 http response code is returned
|
|
324
426
|
*/
|
|
325
|
-
|
|
427
|
+
initToBTC(chainIdentifier: string, baseUrl: string, init: ToBTCInit, timeout?: number, abortSignal?: AbortSignal, streamRequest?: boolean): {
|
|
326
428
|
signDataPrefetch: Promise<any>;
|
|
327
429
|
response: Promise<ToBTCResponseType>;
|
|
328
430
|
};
|
|
@@ -339,7 +441,7 @@ export declare class IntermediaryAPI {
|
|
|
339
441
|
*
|
|
340
442
|
* @throws {RequestError} If non-200 http response code is returned
|
|
341
443
|
*/
|
|
342
|
-
|
|
444
|
+
initFromBTC(chainIdentifier: string, baseUrl: string, depositToken: string, init: FromBTCInit, timeout?: number, abortSignal?: AbortSignal, streamRequest?: boolean): {
|
|
343
445
|
signDataPrefetch: Promise<any>;
|
|
344
446
|
response: Promise<FromBTCResponseType>;
|
|
345
447
|
};
|
|
@@ -356,7 +458,7 @@ export declare class IntermediaryAPI {
|
|
|
356
458
|
*
|
|
357
459
|
* @throws {RequestError} If non-200 http response code is returned
|
|
358
460
|
*/
|
|
359
|
-
|
|
461
|
+
initFromBTCLN(chainIdentifier: string, baseUrl: string, depositToken: string, init: FromBTCLNInit, timeout?: number, abortSignal?: AbortSignal, streamRequest?: boolean): {
|
|
360
462
|
lnPublicKey: Promise<string | null>;
|
|
361
463
|
response: Promise<FromBTCLNResponseType>;
|
|
362
464
|
};
|
|
@@ -372,7 +474,7 @@ export declare class IntermediaryAPI {
|
|
|
372
474
|
*
|
|
373
475
|
* @throws {RequestError} If non-200 http response code is returned
|
|
374
476
|
*/
|
|
375
|
-
|
|
477
|
+
initFromBTCLNAuto(chainIdentifier: string, baseUrl: string, init: FromBTCLNAutoInit, timeout?: number, abortSignal?: AbortSignal, streamRequest?: boolean): {
|
|
376
478
|
lnPublicKey: Promise<string | null>;
|
|
377
479
|
response: Promise<FromBTCLNAutoResponseType>;
|
|
378
480
|
};
|
|
@@ -388,7 +490,7 @@ export declare class IntermediaryAPI {
|
|
|
388
490
|
*
|
|
389
491
|
* @throws {RequestError} If non-200 http response code is returned
|
|
390
492
|
*/
|
|
391
|
-
|
|
493
|
+
initToBTCLN(chainIdentifier: string, baseUrl: string, init: ToBTCLNInit, timeout?: number, abortSignal?: AbortSignal, streamRequest?: boolean): {
|
|
392
494
|
signDataPrefetch: Promise<any>;
|
|
393
495
|
response: Promise<ToBTCLNResponseType>;
|
|
394
496
|
};
|
|
@@ -403,7 +505,7 @@ export declare class IntermediaryAPI {
|
|
|
403
505
|
*
|
|
404
506
|
* @throws {RequestError} If non-200 http response code is returned
|
|
405
507
|
*/
|
|
406
|
-
|
|
508
|
+
initToBTCLNExactIn(baseUrl: string, init: ToBTCLNInitExactIn, timeout?: number, abortSignal?: AbortSignal, streamRequest?: boolean): Promise<ToBTCLNResponseType>;
|
|
407
509
|
/**
|
|
408
510
|
* Prepare To BTCLN exact in swap with an intermediary
|
|
409
511
|
*
|
|
@@ -416,7 +518,7 @@ export declare class IntermediaryAPI {
|
|
|
416
518
|
*
|
|
417
519
|
* @throws {RequestError} If non-200 http response code is returned
|
|
418
520
|
*/
|
|
419
|
-
|
|
521
|
+
prepareToBTCLNExactIn(chainIdentifier: string, baseUrl: string, init: ToBTCLNPrepareExactIn, timeout?: number, abortSignal?: AbortSignal, streamRequest?: boolean): {
|
|
420
522
|
signDataPrefetch: Promise<any>;
|
|
421
523
|
response: Promise<ToBTCLNPrepareExactInResponseType>;
|
|
422
524
|
};
|
|
@@ -432,7 +534,7 @@ export declare class IntermediaryAPI {
|
|
|
432
534
|
*
|
|
433
535
|
* @throws {RequestError} If non-200 http response code is returned
|
|
434
536
|
*/
|
|
435
|
-
|
|
537
|
+
prepareSpvFromBTC(chainIdentifier: string, baseUrl: string, init: SpvFromBTCPrepare, timeout?: number, abortSignal?: AbortSignal, streamRequest?: boolean): Promise<SpvFromBTCPrepareResponseType>;
|
|
436
538
|
/**
|
|
437
539
|
* Prepare From BTC swap via new spv vault swaps with an intermediary
|
|
438
540
|
*
|
|
@@ -445,6 +547,61 @@ export declare class IntermediaryAPI {
|
|
|
445
547
|
*
|
|
446
548
|
* @throws {RequestError} If non-200 http response code is returned
|
|
447
549
|
*/
|
|
448
|
-
|
|
550
|
+
initSpvFromBTC(chainIdentifier: string, url: string, init: SpvFromBTCInit, timeout?: number, abortSignal?: AbortSignal, streamRequest?: boolean): Promise<SpvFromBTCInitResponseType>;
|
|
551
|
+
/**
|
|
552
|
+
* Fetches the invoice status from the intermediary node
|
|
553
|
+
*
|
|
554
|
+
* @param url Url of the trusted intermediary
|
|
555
|
+
* @param paymentHash Payment hash of the lightning invoice
|
|
556
|
+
* @param timeout Timeout in milliseconds
|
|
557
|
+
* @param abortSignal
|
|
558
|
+
* @throws {RequestError} if non-200 http response is returned
|
|
559
|
+
*/
|
|
560
|
+
getTrustedInvoiceStatus(url: string, paymentHash: string, timeout?: number, abortSignal?: AbortSignal): Promise<TrustedInvoiceStatusResponse>;
|
|
561
|
+
/**
|
|
562
|
+
* Initiate a trusted swap from BTCLN to SC native currency, retries!
|
|
563
|
+
*
|
|
564
|
+
* @param chainIdentifier
|
|
565
|
+
* @param baseUrl Base url of the trusted swap intermediary
|
|
566
|
+
* @param init Initialization parameters
|
|
567
|
+
* @param timeout Timeout in milliseconds for the request
|
|
568
|
+
* @param abortSignal
|
|
569
|
+
* @throws {RequestError} If the response is non-200
|
|
570
|
+
*/
|
|
571
|
+
initTrustedFromBTCLN(chainIdentifier: string, baseUrl: string, init: TrustedFromBTCLNInit, timeout?: number, abortSignal?: AbortSignal): Promise<TrustedFromBTCLNResponseType>;
|
|
572
|
+
/**
|
|
573
|
+
* Fetches the address status from the intermediary node
|
|
574
|
+
*
|
|
575
|
+
* @param url Url of the trusted intermediary
|
|
576
|
+
* @param paymentHash Payment hash of the swap
|
|
577
|
+
* @param sequence Sequence number of the swap
|
|
578
|
+
* @param timeout Timeout in milliseconds
|
|
579
|
+
* @param abortSignal
|
|
580
|
+
* @throws {RequestError} if non-200 http response is returned
|
|
581
|
+
*/
|
|
582
|
+
getTrustedAddressStatus(url: string, paymentHash: string, sequence: bigint, timeout?: number, abortSignal?: AbortSignal): Promise<TrustedAddressStatusResponse>;
|
|
583
|
+
/**
|
|
584
|
+
* Sets the refund address for an on-chain gas swap
|
|
585
|
+
*
|
|
586
|
+
* @param url Url of the trusted intermediary
|
|
587
|
+
* @param paymentHash Payment hash of the swap
|
|
588
|
+
* @param sequence Sequence number of the swap
|
|
589
|
+
* @param refundAddress Refund address to set for the swap
|
|
590
|
+
* @param timeout Timeout in milliseconds
|
|
591
|
+
* @param abortSignal
|
|
592
|
+
* @throws {RequestError} if non-200 http response is returned
|
|
593
|
+
*/
|
|
594
|
+
setTrustedRefundAddress(url: string, paymentHash: string, sequence: bigint, refundAddress: string, timeout?: number, abortSignal?: AbortSignal): Promise<void>;
|
|
595
|
+
/**
|
|
596
|
+
* Initiate a trusted swap from BTC to SC native currency, retries!
|
|
597
|
+
*
|
|
598
|
+
* @param chainIdentifier
|
|
599
|
+
* @param baseUrl Base url of the trusted swap intermediary
|
|
600
|
+
* @param init Initialization parameters
|
|
601
|
+
* @param timeout Timeout in milliseconds for the request
|
|
602
|
+
* @param abortSignal
|
|
603
|
+
* @throws {RequestError} If the response is non-200
|
|
604
|
+
*/
|
|
605
|
+
initTrustedFromBTC(chainIdentifier: string, baseUrl: string, init: TrustedFromBTCInit, timeout?: number, abortSignal?: AbortSignal): Promise<TrustedFromBTCResponseType>;
|
|
449
606
|
}
|
|
450
607
|
export {};
|