@chainflip/sdk 1.6.0-alpha.3 → 1.6.0-alpha.4
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/dist/{contracts-50KY1eSc.d.mts → contracts-DmShvHR7.d.mts} +1 -1
- package/dist/{contracts-50KY1eSc.d.ts → contracts-DmShvHR7.d.ts} +1 -1
- package/dist/funding.d.mts +1 -1
- package/dist/funding.d.ts +1 -1
- package/dist/swap.d.mts +138 -142
- package/dist/swap.d.ts +138 -142
- package/dist/swap.js +1 -1
- package/dist/swap.mjs +1 -1
- package/package.json +1 -1
|
@@ -75,4 +75,4 @@ type TransactionOptions = {
|
|
|
75
75
|
wait?: number;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
export { type
|
|
78
|
+
export { type AssetAndChain as A, type Chain as C, type InternalAsset as I, type TransactionOptions as T, type UncheckedAssetAndChain as U, type Asset as a, type AssetOfChain as b, type ChainflipNetwork as c, type ChainAssetMap as d, type ChainMap as e, Chains as f, Assets as g, InternalAssets as h, ChainflipNetworks as i, getInternalAsset as j };
|
|
@@ -75,4 +75,4 @@ type TransactionOptions = {
|
|
|
75
75
|
wait?: number;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
export { type
|
|
78
|
+
export { type AssetAndChain as A, type Chain as C, type InternalAsset as I, type TransactionOptions as T, type UncheckedAssetAndChain as U, type Asset as a, type AssetOfChain as b, type ChainflipNetwork as c, type ChainAssetMap as d, type ChainMap as e, Chains as f, Assets as g, InternalAssets as h, ChainflipNetworks as i, getInternalAsset as j };
|
package/dist/funding.d.mts
CHANGED
package/dist/funding.d.ts
CHANGED
package/dist/swap.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import {
|
|
3
|
-
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-
|
|
2
|
+
import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap } from './contracts-DmShvHR7.mjs';
|
|
3
|
+
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-DmShvHR7.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { SwapType } from '.prisma/client';
|
|
6
6
|
|
|
@@ -154,7 +154,7 @@ interface DepositAddressResponse extends DepositAddressRequest {
|
|
|
154
154
|
interface SwapStatusRequest {
|
|
155
155
|
id: string;
|
|
156
156
|
}
|
|
157
|
-
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
157
|
+
interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
158
158
|
destAddress: string;
|
|
159
159
|
ccmDepositReceivedBlockIndex: string | undefined;
|
|
160
160
|
ccmParams: CcmParams | undefined;
|
|
@@ -167,7 +167,7 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
|
167
167
|
depositTransactionHash: string | undefined;
|
|
168
168
|
ccmMetadata?: CcmParams;
|
|
169
169
|
}
|
|
170
|
-
interface DepositAddressFields extends SwapStatusResponseCommonFields {
|
|
170
|
+
interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
|
|
171
171
|
depositAddress: string;
|
|
172
172
|
depositChannelCreatedAt: number;
|
|
173
173
|
depositChannelBrokerCommissionBps: number;
|
|
@@ -205,7 +205,7 @@ type EgressScheduled = {
|
|
|
205
205
|
type CopyFields<T, U> = {
|
|
206
206
|
[K in Exclude<keyof T, keyof U>]: undefined;
|
|
207
207
|
} & U;
|
|
208
|
-
type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields>;
|
|
208
|
+
type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields$1>;
|
|
209
209
|
type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
210
210
|
depositAmount: string;
|
|
211
211
|
destAddress: string;
|
|
@@ -222,7 +222,7 @@ type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
|
222
222
|
state: 'FAILED';
|
|
223
223
|
depositAddress: undefined;
|
|
224
224
|
}>;
|
|
225
|
-
type SwapState = {
|
|
225
|
+
type SwapState$1 = {
|
|
226
226
|
state: 'AWAITING_DEPOSIT';
|
|
227
227
|
depositAmount: string | undefined;
|
|
228
228
|
depositTransactionConfirmations: number | undefined;
|
|
@@ -309,8 +309,8 @@ type SwapState = {
|
|
|
309
309
|
egressIgnoredAt: number;
|
|
310
310
|
egressIgnoredBlockIndex: string;
|
|
311
311
|
};
|
|
312
|
-
type DepositAddressStatusResponse = DepositAddressFields & SwapState;
|
|
313
|
-
type VaultSwapStatusResponse = VaultSwapFields & SwapState;
|
|
312
|
+
type DepositAddressStatusResponse = DepositAddressFields & SwapState$1;
|
|
313
|
+
type VaultSwapStatusResponse = VaultSwapFields & SwapState$1;
|
|
314
314
|
type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
|
|
315
315
|
type BoostPoolDepth = {
|
|
316
316
|
feeTierBps: number;
|
|
@@ -326,140 +326,136 @@ declare enum FailureMode {
|
|
|
326
326
|
BroadcastAborted = "SENDING_FAILED"
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
329
|
+
interface DcaParameters {
|
|
330
|
+
numberOfChunks: number;
|
|
331
|
+
chunkIntervalBlocks: string;
|
|
332
|
+
}
|
|
333
|
+
interface Ccm {
|
|
334
|
+
message: string;
|
|
335
|
+
gasBudget: string;
|
|
336
|
+
cfParameters: string | undefined;
|
|
337
|
+
ccmDepositReceivedBlockIndex: string | undefined;
|
|
338
|
+
}
|
|
339
|
+
interface Failure {
|
|
340
|
+
failedAt: number;
|
|
341
|
+
failedAtBlockIndex: string;
|
|
342
|
+
mode: FailureMode;
|
|
343
|
+
reason: {
|
|
344
|
+
code: string;
|
|
335
345
|
message: string;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
interface SwapChunk {
|
|
380
|
-
swapInputAmount: string;
|
|
381
|
-
swapOutputAmount: string | undefined;
|
|
382
|
-
scheduledAt: number;
|
|
383
|
-
scheduledBlockIndex: string;
|
|
384
|
-
executedAt: number | undefined;
|
|
385
|
-
executedBlockIndex: string | undefined;
|
|
386
|
-
retryCount: number;
|
|
387
|
-
latestSwapRescheduledAt: number | undefined;
|
|
388
|
-
latestSwapRescheduledBlockIndex: number | undefined;
|
|
389
|
-
fees: SwapFee[];
|
|
390
|
-
}
|
|
391
|
-
interface SwapFields {
|
|
392
|
-
totalInputAmountSwapped: string | undefined;
|
|
393
|
-
totalOutputAmountSwapped: string | undefined;
|
|
394
|
-
totalChunksExecuted: number;
|
|
395
|
-
isDcaSwap: boolean;
|
|
396
|
-
lastExecutedChunk: SwapChunk | undefined;
|
|
397
|
-
currentChunk: SwapChunk;
|
|
398
|
-
type: SwapType;
|
|
399
|
-
fees: SwapFee[];
|
|
400
|
-
}
|
|
401
|
-
interface EgressFields {
|
|
402
|
-
amount: string;
|
|
403
|
-
scheduledAt: number;
|
|
404
|
-
scheduledBlockIndex: string;
|
|
405
|
-
sentTxRef: string | undefined;
|
|
406
|
-
sentAt: number | undefined;
|
|
407
|
-
sentAtBlockIndex: string | undefined;
|
|
408
|
-
ignoredAmount: string | undefined;
|
|
409
|
-
failure: Failure | undefined;
|
|
410
|
-
}
|
|
411
|
-
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
412
|
-
swapId: string;
|
|
413
|
-
destAddress: string;
|
|
414
|
-
depositChannel: DepositChannelFields;
|
|
415
|
-
ccm: Ccm | undefined;
|
|
416
|
-
boost: Boost | undefined;
|
|
417
|
-
estimatedDurationSeconds: number | null | undefined;
|
|
418
|
-
}
|
|
419
|
-
interface VaultSwapCommonFields extends Exclude<SwapStatusResponseCommonFields, 'depositChannel' | 'boost'> {
|
|
420
|
-
}
|
|
421
|
-
interface ReceivingVaultSwap extends VaultSwapCommonFields {
|
|
422
|
-
deposit: Pick<DepositFields, 'amount' | 'txRef'>;
|
|
423
|
-
}
|
|
424
|
-
interface SwappingVaultSwap extends ReceivingVaultSwap {
|
|
425
|
-
swap: Exclude<SwapChunk, 'latestSwapRescheduledAt' | 'latestSwapRescheduledBlockIndex'> | undefined;
|
|
426
|
-
swapEgress: EgressFields | undefined;
|
|
427
|
-
}
|
|
428
|
-
interface SendingVaultSwap extends SwappingVaultSwap {
|
|
429
|
-
swapEgress: EgressFields | undefined;
|
|
430
|
-
}
|
|
431
|
-
interface DepositChannel extends SwapStatusResponseCommonFields {
|
|
432
|
-
depositChannel: DepositChannelFields;
|
|
433
|
-
}
|
|
434
|
-
interface Receiving extends DepositChannel {
|
|
435
|
-
deposit: DepositFields;
|
|
436
|
-
}
|
|
437
|
-
interface Swapping extends Receiving {
|
|
438
|
-
swap: SwapFields;
|
|
439
|
-
}
|
|
440
|
-
interface Sending extends Receiving {
|
|
441
|
-
swap: SwapFields;
|
|
442
|
-
swapEgress: EgressFields | undefined;
|
|
443
|
-
refundEgress: EgressFields | undefined;
|
|
444
|
-
}
|
|
445
|
-
type SwapState = ({
|
|
446
|
-
state: 'RECEIVING';
|
|
447
|
-
} & Receiving) | ({
|
|
448
|
-
state: 'SWAPPING';
|
|
449
|
-
} & Swapping) | ({
|
|
450
|
-
state: 'SENDING';
|
|
451
|
-
} & Sending) | ({
|
|
452
|
-
state: 'SENT';
|
|
453
|
-
} & Sending) | ({
|
|
454
|
-
state: 'COMPLETED';
|
|
455
|
-
} & Sending) | ({
|
|
456
|
-
state: 'FAILED';
|
|
457
|
-
} & Sending);
|
|
458
|
-
export type DepositAddressStatusResponse = SwapState;
|
|
459
|
-
export type VaultSwapStatusResponse = SwapState & SendingVaultSwap;
|
|
460
|
-
export type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse;
|
|
461
|
-
export { };
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
interface Boost {
|
|
349
|
+
maxBoostFeeBps: number;
|
|
350
|
+
effectiveBoostFeeBps: number | undefined;
|
|
351
|
+
boostedAt: number | undefined;
|
|
352
|
+
boostedBlockIndex: string | undefined;
|
|
353
|
+
skippedAt: number | undefined;
|
|
354
|
+
skippedBlockIndex: string | undefined;
|
|
355
|
+
}
|
|
356
|
+
interface DepositChannelFields {
|
|
357
|
+
createdAt: number;
|
|
358
|
+
brokerCommissionBps: number;
|
|
359
|
+
depositAddress: string;
|
|
360
|
+
srcChainExpiryBlock: string;
|
|
361
|
+
estimatedExpiryTime: number;
|
|
362
|
+
expectedDepositAmount: string;
|
|
363
|
+
isExpired: boolean;
|
|
364
|
+
openedThroughBackend: boolean;
|
|
365
|
+
affiliateBrokers: AffiliateBroker[];
|
|
366
|
+
fillOrKillParams: FillOrKillParams | undefined;
|
|
367
|
+
dcaParams: DcaParameters | undefined;
|
|
368
|
+
srcChainRequiredBlockConfirmations: number | null | undefined;
|
|
369
|
+
}
|
|
370
|
+
interface DepositFields {
|
|
371
|
+
amount: string | undefined;
|
|
372
|
+
txRef: string | undefined;
|
|
373
|
+
txConfirmations: number | undefined;
|
|
374
|
+
receivedAt: number | undefined;
|
|
375
|
+
receivedBlockIndex: string | undefined;
|
|
376
|
+
failure: Failure | undefined;
|
|
377
|
+
}
|
|
378
|
+
interface SwapChunk {
|
|
379
|
+
swapInputAmount: string;
|
|
380
|
+
swapOutputAmount: string | undefined;
|
|
381
|
+
scheduledAt: number;
|
|
382
|
+
scheduledBlockIndex: string;
|
|
383
|
+
executedAt: number | undefined;
|
|
384
|
+
executedBlockIndex: string | undefined;
|
|
385
|
+
retryCount: number;
|
|
386
|
+
latestSwapRescheduledAt: number | undefined;
|
|
387
|
+
latestSwapRescheduledBlockIndex: number | undefined;
|
|
388
|
+
fees: SwapFee[];
|
|
462
389
|
}
|
|
390
|
+
interface SwapFields {
|
|
391
|
+
totalInputAmountSwapped: string | undefined;
|
|
392
|
+
totalOutputAmountSwapped: string | undefined;
|
|
393
|
+
totalChunksExecuted: number;
|
|
394
|
+
isDcaSwap: boolean;
|
|
395
|
+
lastExecutedChunk: SwapChunk | undefined;
|
|
396
|
+
currentChunk: SwapChunk;
|
|
397
|
+
type: SwapType;
|
|
398
|
+
fees: SwapFee[];
|
|
399
|
+
}
|
|
400
|
+
interface EgressFields {
|
|
401
|
+
amount: string;
|
|
402
|
+
scheduledAt: number;
|
|
403
|
+
scheduledBlockIndex: string;
|
|
404
|
+
sentTxRef: string | undefined;
|
|
405
|
+
sentAt: number | undefined;
|
|
406
|
+
sentAtBlockIndex: string | undefined;
|
|
407
|
+
ignoredAmount: string | undefined;
|
|
408
|
+
failure: Failure | undefined;
|
|
409
|
+
}
|
|
410
|
+
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
411
|
+
swapId: string;
|
|
412
|
+
destAddress: string;
|
|
413
|
+
ccm: Ccm | undefined;
|
|
414
|
+
boost: Boost | undefined;
|
|
415
|
+
estimatedDurationSeconds: number | null | undefined;
|
|
416
|
+
}
|
|
417
|
+
interface VaultSwapCommonFields extends Exclude<SwapStatusResponseCommonFields, 'boost'> {
|
|
418
|
+
}
|
|
419
|
+
interface ReceivingVaultSwap extends VaultSwapCommonFields {
|
|
420
|
+
deposit: Pick<DepositFields, 'amount' | 'txRef'>;
|
|
421
|
+
}
|
|
422
|
+
interface SwappingVaultSwap extends ReceivingVaultSwap {
|
|
423
|
+
swap: Exclude<SwapChunk, 'latestSwapRescheduledAt' | 'latestSwapRescheduledBlockIndex'> | undefined;
|
|
424
|
+
swapEgress: EgressFields | undefined;
|
|
425
|
+
}
|
|
426
|
+
interface SendingVaultSwap extends SwappingVaultSwap {
|
|
427
|
+
swapEgress: EgressFields | undefined;
|
|
428
|
+
}
|
|
429
|
+
interface DepositChannel extends SwapStatusResponseCommonFields {
|
|
430
|
+
depositChannel: DepositChannelFields;
|
|
431
|
+
}
|
|
432
|
+
interface Receiving extends DepositChannel {
|
|
433
|
+
deposit: DepositFields;
|
|
434
|
+
}
|
|
435
|
+
interface Swapping extends Receiving {
|
|
436
|
+
swap: SwapFields;
|
|
437
|
+
}
|
|
438
|
+
interface Sending extends Receiving {
|
|
439
|
+
swap: SwapFields;
|
|
440
|
+
swapEgress: EgressFields | undefined;
|
|
441
|
+
refundEgress: EgressFields | undefined;
|
|
442
|
+
}
|
|
443
|
+
type SwapState = ({
|
|
444
|
+
state: 'RECEIVING';
|
|
445
|
+
} & Receiving) | ({
|
|
446
|
+
state: 'SWAPPING';
|
|
447
|
+
} & Swapping) | ({
|
|
448
|
+
state: 'SENDING';
|
|
449
|
+
} & Sending) | ({
|
|
450
|
+
state: 'SENT';
|
|
451
|
+
} & Sending) | ({
|
|
452
|
+
state: 'COMPLETED';
|
|
453
|
+
} & Sending) | ({
|
|
454
|
+
state: 'FAILED';
|
|
455
|
+
} & Sending);
|
|
456
|
+
type DepositAddressStatusResponseV2 = SwapState;
|
|
457
|
+
type VaultSwapStatusResponseV2 = SwapState & SendingVaultSwap;
|
|
458
|
+
type SwapStatusResponseV2 = DepositAddressStatusResponseV2 | VaultSwapStatusResponseV2;
|
|
463
459
|
|
|
464
460
|
type RequestOptions = {
|
|
465
461
|
signal?: AbortSignal;
|
|
@@ -491,7 +487,7 @@ declare class SwapSDK {
|
|
|
491
487
|
getQuote(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponse>;
|
|
492
488
|
requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
493
489
|
getStatus(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponse>;
|
|
494
|
-
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<
|
|
490
|
+
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponseV2>;
|
|
495
491
|
executeSwap(params: ExecuteSwapParams, txOpts?: TransactionOptions & {
|
|
496
492
|
signer?: Signer;
|
|
497
493
|
}): Promise<TransactionHash>;
|
|
@@ -514,4 +510,4 @@ declare class SwapSDK {
|
|
|
514
510
|
}): Promise<BoostPoolDepth[]>;
|
|
515
511
|
}
|
|
516
512
|
|
|
517
|
-
export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse,
|
|
513
|
+
export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type DepositAddressStatusResponseV2, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse, type VaultSwapStatusResponseV2 };
|
package/dist/swap.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import {
|
|
3
|
-
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-
|
|
2
|
+
import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap } from './contracts-DmShvHR7.js';
|
|
3
|
+
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-DmShvHR7.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { SwapType } from '.prisma/client';
|
|
6
6
|
|
|
@@ -154,7 +154,7 @@ interface DepositAddressResponse extends DepositAddressRequest {
|
|
|
154
154
|
interface SwapStatusRequest {
|
|
155
155
|
id: string;
|
|
156
156
|
}
|
|
157
|
-
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
157
|
+
interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
158
158
|
destAddress: string;
|
|
159
159
|
ccmDepositReceivedBlockIndex: string | undefined;
|
|
160
160
|
ccmParams: CcmParams | undefined;
|
|
@@ -167,7 +167,7 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
|
167
167
|
depositTransactionHash: string | undefined;
|
|
168
168
|
ccmMetadata?: CcmParams;
|
|
169
169
|
}
|
|
170
|
-
interface DepositAddressFields extends SwapStatusResponseCommonFields {
|
|
170
|
+
interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
|
|
171
171
|
depositAddress: string;
|
|
172
172
|
depositChannelCreatedAt: number;
|
|
173
173
|
depositChannelBrokerCommissionBps: number;
|
|
@@ -205,7 +205,7 @@ type EgressScheduled = {
|
|
|
205
205
|
type CopyFields<T, U> = {
|
|
206
206
|
[K in Exclude<keyof T, keyof U>]: undefined;
|
|
207
207
|
} & U;
|
|
208
|
-
type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields>;
|
|
208
|
+
type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields$1>;
|
|
209
209
|
type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
210
210
|
depositAmount: string;
|
|
211
211
|
destAddress: string;
|
|
@@ -222,7 +222,7 @@ type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
|
222
222
|
state: 'FAILED';
|
|
223
223
|
depositAddress: undefined;
|
|
224
224
|
}>;
|
|
225
|
-
type SwapState = {
|
|
225
|
+
type SwapState$1 = {
|
|
226
226
|
state: 'AWAITING_DEPOSIT';
|
|
227
227
|
depositAmount: string | undefined;
|
|
228
228
|
depositTransactionConfirmations: number | undefined;
|
|
@@ -309,8 +309,8 @@ type SwapState = {
|
|
|
309
309
|
egressIgnoredAt: number;
|
|
310
310
|
egressIgnoredBlockIndex: string;
|
|
311
311
|
};
|
|
312
|
-
type DepositAddressStatusResponse = DepositAddressFields & SwapState;
|
|
313
|
-
type VaultSwapStatusResponse = VaultSwapFields & SwapState;
|
|
312
|
+
type DepositAddressStatusResponse = DepositAddressFields & SwapState$1;
|
|
313
|
+
type VaultSwapStatusResponse = VaultSwapFields & SwapState$1;
|
|
314
314
|
type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
|
|
315
315
|
type BoostPoolDepth = {
|
|
316
316
|
feeTierBps: number;
|
|
@@ -326,140 +326,136 @@ declare enum FailureMode {
|
|
|
326
326
|
BroadcastAborted = "SENDING_FAILED"
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
329
|
+
interface DcaParameters {
|
|
330
|
+
numberOfChunks: number;
|
|
331
|
+
chunkIntervalBlocks: string;
|
|
332
|
+
}
|
|
333
|
+
interface Ccm {
|
|
334
|
+
message: string;
|
|
335
|
+
gasBudget: string;
|
|
336
|
+
cfParameters: string | undefined;
|
|
337
|
+
ccmDepositReceivedBlockIndex: string | undefined;
|
|
338
|
+
}
|
|
339
|
+
interface Failure {
|
|
340
|
+
failedAt: number;
|
|
341
|
+
failedAtBlockIndex: string;
|
|
342
|
+
mode: FailureMode;
|
|
343
|
+
reason: {
|
|
344
|
+
code: string;
|
|
335
345
|
message: string;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
interface SwapChunk {
|
|
380
|
-
swapInputAmount: string;
|
|
381
|
-
swapOutputAmount: string | undefined;
|
|
382
|
-
scheduledAt: number;
|
|
383
|
-
scheduledBlockIndex: string;
|
|
384
|
-
executedAt: number | undefined;
|
|
385
|
-
executedBlockIndex: string | undefined;
|
|
386
|
-
retryCount: number;
|
|
387
|
-
latestSwapRescheduledAt: number | undefined;
|
|
388
|
-
latestSwapRescheduledBlockIndex: number | undefined;
|
|
389
|
-
fees: SwapFee[];
|
|
390
|
-
}
|
|
391
|
-
interface SwapFields {
|
|
392
|
-
totalInputAmountSwapped: string | undefined;
|
|
393
|
-
totalOutputAmountSwapped: string | undefined;
|
|
394
|
-
totalChunksExecuted: number;
|
|
395
|
-
isDcaSwap: boolean;
|
|
396
|
-
lastExecutedChunk: SwapChunk | undefined;
|
|
397
|
-
currentChunk: SwapChunk;
|
|
398
|
-
type: SwapType;
|
|
399
|
-
fees: SwapFee[];
|
|
400
|
-
}
|
|
401
|
-
interface EgressFields {
|
|
402
|
-
amount: string;
|
|
403
|
-
scheduledAt: number;
|
|
404
|
-
scheduledBlockIndex: string;
|
|
405
|
-
sentTxRef: string | undefined;
|
|
406
|
-
sentAt: number | undefined;
|
|
407
|
-
sentAtBlockIndex: string | undefined;
|
|
408
|
-
ignoredAmount: string | undefined;
|
|
409
|
-
failure: Failure | undefined;
|
|
410
|
-
}
|
|
411
|
-
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
412
|
-
swapId: string;
|
|
413
|
-
destAddress: string;
|
|
414
|
-
depositChannel: DepositChannelFields;
|
|
415
|
-
ccm: Ccm | undefined;
|
|
416
|
-
boost: Boost | undefined;
|
|
417
|
-
estimatedDurationSeconds: number | null | undefined;
|
|
418
|
-
}
|
|
419
|
-
interface VaultSwapCommonFields extends Exclude<SwapStatusResponseCommonFields, 'depositChannel' | 'boost'> {
|
|
420
|
-
}
|
|
421
|
-
interface ReceivingVaultSwap extends VaultSwapCommonFields {
|
|
422
|
-
deposit: Pick<DepositFields, 'amount' | 'txRef'>;
|
|
423
|
-
}
|
|
424
|
-
interface SwappingVaultSwap extends ReceivingVaultSwap {
|
|
425
|
-
swap: Exclude<SwapChunk, 'latestSwapRescheduledAt' | 'latestSwapRescheduledBlockIndex'> | undefined;
|
|
426
|
-
swapEgress: EgressFields | undefined;
|
|
427
|
-
}
|
|
428
|
-
interface SendingVaultSwap extends SwappingVaultSwap {
|
|
429
|
-
swapEgress: EgressFields | undefined;
|
|
430
|
-
}
|
|
431
|
-
interface DepositChannel extends SwapStatusResponseCommonFields {
|
|
432
|
-
depositChannel: DepositChannelFields;
|
|
433
|
-
}
|
|
434
|
-
interface Receiving extends DepositChannel {
|
|
435
|
-
deposit: DepositFields;
|
|
436
|
-
}
|
|
437
|
-
interface Swapping extends Receiving {
|
|
438
|
-
swap: SwapFields;
|
|
439
|
-
}
|
|
440
|
-
interface Sending extends Receiving {
|
|
441
|
-
swap: SwapFields;
|
|
442
|
-
swapEgress: EgressFields | undefined;
|
|
443
|
-
refundEgress: EgressFields | undefined;
|
|
444
|
-
}
|
|
445
|
-
type SwapState = ({
|
|
446
|
-
state: 'RECEIVING';
|
|
447
|
-
} & Receiving) | ({
|
|
448
|
-
state: 'SWAPPING';
|
|
449
|
-
} & Swapping) | ({
|
|
450
|
-
state: 'SENDING';
|
|
451
|
-
} & Sending) | ({
|
|
452
|
-
state: 'SENT';
|
|
453
|
-
} & Sending) | ({
|
|
454
|
-
state: 'COMPLETED';
|
|
455
|
-
} & Sending) | ({
|
|
456
|
-
state: 'FAILED';
|
|
457
|
-
} & Sending);
|
|
458
|
-
export type DepositAddressStatusResponse = SwapState;
|
|
459
|
-
export type VaultSwapStatusResponse = SwapState & SendingVaultSwap;
|
|
460
|
-
export type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse;
|
|
461
|
-
export { };
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
interface Boost {
|
|
349
|
+
maxBoostFeeBps: number;
|
|
350
|
+
effectiveBoostFeeBps: number | undefined;
|
|
351
|
+
boostedAt: number | undefined;
|
|
352
|
+
boostedBlockIndex: string | undefined;
|
|
353
|
+
skippedAt: number | undefined;
|
|
354
|
+
skippedBlockIndex: string | undefined;
|
|
355
|
+
}
|
|
356
|
+
interface DepositChannelFields {
|
|
357
|
+
createdAt: number;
|
|
358
|
+
brokerCommissionBps: number;
|
|
359
|
+
depositAddress: string;
|
|
360
|
+
srcChainExpiryBlock: string;
|
|
361
|
+
estimatedExpiryTime: number;
|
|
362
|
+
expectedDepositAmount: string;
|
|
363
|
+
isExpired: boolean;
|
|
364
|
+
openedThroughBackend: boolean;
|
|
365
|
+
affiliateBrokers: AffiliateBroker[];
|
|
366
|
+
fillOrKillParams: FillOrKillParams | undefined;
|
|
367
|
+
dcaParams: DcaParameters | undefined;
|
|
368
|
+
srcChainRequiredBlockConfirmations: number | null | undefined;
|
|
369
|
+
}
|
|
370
|
+
interface DepositFields {
|
|
371
|
+
amount: string | undefined;
|
|
372
|
+
txRef: string | undefined;
|
|
373
|
+
txConfirmations: number | undefined;
|
|
374
|
+
receivedAt: number | undefined;
|
|
375
|
+
receivedBlockIndex: string | undefined;
|
|
376
|
+
failure: Failure | undefined;
|
|
377
|
+
}
|
|
378
|
+
interface SwapChunk {
|
|
379
|
+
swapInputAmount: string;
|
|
380
|
+
swapOutputAmount: string | undefined;
|
|
381
|
+
scheduledAt: number;
|
|
382
|
+
scheduledBlockIndex: string;
|
|
383
|
+
executedAt: number | undefined;
|
|
384
|
+
executedBlockIndex: string | undefined;
|
|
385
|
+
retryCount: number;
|
|
386
|
+
latestSwapRescheduledAt: number | undefined;
|
|
387
|
+
latestSwapRescheduledBlockIndex: number | undefined;
|
|
388
|
+
fees: SwapFee[];
|
|
462
389
|
}
|
|
390
|
+
interface SwapFields {
|
|
391
|
+
totalInputAmountSwapped: string | undefined;
|
|
392
|
+
totalOutputAmountSwapped: string | undefined;
|
|
393
|
+
totalChunksExecuted: number;
|
|
394
|
+
isDcaSwap: boolean;
|
|
395
|
+
lastExecutedChunk: SwapChunk | undefined;
|
|
396
|
+
currentChunk: SwapChunk;
|
|
397
|
+
type: SwapType;
|
|
398
|
+
fees: SwapFee[];
|
|
399
|
+
}
|
|
400
|
+
interface EgressFields {
|
|
401
|
+
amount: string;
|
|
402
|
+
scheduledAt: number;
|
|
403
|
+
scheduledBlockIndex: string;
|
|
404
|
+
sentTxRef: string | undefined;
|
|
405
|
+
sentAt: number | undefined;
|
|
406
|
+
sentAtBlockIndex: string | undefined;
|
|
407
|
+
ignoredAmount: string | undefined;
|
|
408
|
+
failure: Failure | undefined;
|
|
409
|
+
}
|
|
410
|
+
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
411
|
+
swapId: string;
|
|
412
|
+
destAddress: string;
|
|
413
|
+
ccm: Ccm | undefined;
|
|
414
|
+
boost: Boost | undefined;
|
|
415
|
+
estimatedDurationSeconds: number | null | undefined;
|
|
416
|
+
}
|
|
417
|
+
interface VaultSwapCommonFields extends Exclude<SwapStatusResponseCommonFields, 'boost'> {
|
|
418
|
+
}
|
|
419
|
+
interface ReceivingVaultSwap extends VaultSwapCommonFields {
|
|
420
|
+
deposit: Pick<DepositFields, 'amount' | 'txRef'>;
|
|
421
|
+
}
|
|
422
|
+
interface SwappingVaultSwap extends ReceivingVaultSwap {
|
|
423
|
+
swap: Exclude<SwapChunk, 'latestSwapRescheduledAt' | 'latestSwapRescheduledBlockIndex'> | undefined;
|
|
424
|
+
swapEgress: EgressFields | undefined;
|
|
425
|
+
}
|
|
426
|
+
interface SendingVaultSwap extends SwappingVaultSwap {
|
|
427
|
+
swapEgress: EgressFields | undefined;
|
|
428
|
+
}
|
|
429
|
+
interface DepositChannel extends SwapStatusResponseCommonFields {
|
|
430
|
+
depositChannel: DepositChannelFields;
|
|
431
|
+
}
|
|
432
|
+
interface Receiving extends DepositChannel {
|
|
433
|
+
deposit: DepositFields;
|
|
434
|
+
}
|
|
435
|
+
interface Swapping extends Receiving {
|
|
436
|
+
swap: SwapFields;
|
|
437
|
+
}
|
|
438
|
+
interface Sending extends Receiving {
|
|
439
|
+
swap: SwapFields;
|
|
440
|
+
swapEgress: EgressFields | undefined;
|
|
441
|
+
refundEgress: EgressFields | undefined;
|
|
442
|
+
}
|
|
443
|
+
type SwapState = ({
|
|
444
|
+
state: 'RECEIVING';
|
|
445
|
+
} & Receiving) | ({
|
|
446
|
+
state: 'SWAPPING';
|
|
447
|
+
} & Swapping) | ({
|
|
448
|
+
state: 'SENDING';
|
|
449
|
+
} & Sending) | ({
|
|
450
|
+
state: 'SENT';
|
|
451
|
+
} & Sending) | ({
|
|
452
|
+
state: 'COMPLETED';
|
|
453
|
+
} & Sending) | ({
|
|
454
|
+
state: 'FAILED';
|
|
455
|
+
} & Sending);
|
|
456
|
+
type DepositAddressStatusResponseV2 = SwapState;
|
|
457
|
+
type VaultSwapStatusResponseV2 = SwapState & SendingVaultSwap;
|
|
458
|
+
type SwapStatusResponseV2 = DepositAddressStatusResponseV2 | VaultSwapStatusResponseV2;
|
|
463
459
|
|
|
464
460
|
type RequestOptions = {
|
|
465
461
|
signal?: AbortSignal;
|
|
@@ -491,7 +487,7 @@ declare class SwapSDK {
|
|
|
491
487
|
getQuote(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponse>;
|
|
492
488
|
requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
493
489
|
getStatus(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponse>;
|
|
494
|
-
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<
|
|
490
|
+
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponseV2>;
|
|
495
491
|
executeSwap(params: ExecuteSwapParams, txOpts?: TransactionOptions & {
|
|
496
492
|
signer?: Signer;
|
|
497
493
|
}): Promise<TransactionHash>;
|
|
@@ -514,4 +510,4 @@ declare class SwapSDK {
|
|
|
514
510
|
}): Promise<BoostPoolDepth[]>;
|
|
515
511
|
}
|
|
516
512
|
|
|
517
|
-
export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse,
|
|
513
|
+
export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type DepositAddressStatusResponseV2, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse, type VaultSwapStatusResponseV2 };
|
package/dist/swap.js
CHANGED
|
@@ -10029,7 +10029,7 @@ var getChainData = /* @__PURE__ */ __name((chain2, network, env) => ({
|
|
|
10029
10029
|
}), "getChainData");
|
|
10030
10030
|
|
|
10031
10031
|
// package.json
|
|
10032
|
-
var version = "1.6.0-alpha.
|
|
10032
|
+
var version = "1.6.0-alpha.4";
|
|
10033
10033
|
|
|
10034
10034
|
// src/swap/consts.ts
|
|
10035
10035
|
var CF_SDK_VERSION_HEADERS = {
|
package/dist/swap.mjs
CHANGED
|
@@ -8307,7 +8307,7 @@ var getChainData = /* @__PURE__ */ __name((chain2, network, env) => ({
|
|
|
8307
8307
|
}), "getChainData");
|
|
8308
8308
|
|
|
8309
8309
|
// package.json
|
|
8310
|
-
var version = "1.6.0-alpha.
|
|
8310
|
+
var version = "1.6.0-alpha.4";
|
|
8311
8311
|
|
|
8312
8312
|
// src/swap/consts.ts
|
|
8313
8313
|
var CF_SDK_VERSION_HEADERS = {
|