@chainflip/sdk 1.6.0-alpha.7 → 1.6.0-beta.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/dist/swap.d.mts +61 -66
- package/dist/swap.d.ts +61 -66
- package/dist/swap.js +5 -8
- package/dist/swap.mjs +5 -8
- package/package.json +1 -1
package/dist/swap.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { Signer } from 'ethers';
|
|
|
2
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
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
|
-
import { SwapType } from '.prisma/client';
|
|
6
5
|
|
|
7
6
|
declare const ccmParamsSchema: z.ZodObject<{
|
|
8
7
|
gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
|
|
@@ -35,6 +34,17 @@ declare const affiliateBroker: z.ZodEffects<z.ZodObject<{
|
|
|
35
34
|
commissionBps: number;
|
|
36
35
|
}>;
|
|
37
36
|
type AffiliateBroker = z.input<typeof affiliateBroker>;
|
|
37
|
+
declare const dcaParams: z.ZodObject<{
|
|
38
|
+
numberOfChunks: z.ZodNumber;
|
|
39
|
+
chunkIntervalBlocks: z.ZodNumber;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
numberOfChunks: number;
|
|
42
|
+
chunkIntervalBlocks: number;
|
|
43
|
+
}, {
|
|
44
|
+
numberOfChunks: number;
|
|
45
|
+
chunkIntervalBlocks: number;
|
|
46
|
+
}>;
|
|
47
|
+
type DcaParams = z.input<typeof dcaParams>;
|
|
38
48
|
declare const fillOrKillParams: z.ZodObject<{
|
|
39
49
|
retryDurationBlocks: z.ZodNumber;
|
|
40
50
|
refundAddress: z.ZodString;
|
|
@@ -52,10 +62,6 @@ type FillOrKillParamsX128 = z.input<typeof fillOrKillParams>;
|
|
|
52
62
|
type FillOrKillParams = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
|
|
53
63
|
minPrice: string;
|
|
54
64
|
};
|
|
55
|
-
type DcaParams = {
|
|
56
|
-
numberOfChunks: number;
|
|
57
|
-
chunkInterval: number;
|
|
58
|
-
};
|
|
59
65
|
type Fee<T> = {
|
|
60
66
|
type: T;
|
|
61
67
|
chain: Chain;
|
|
@@ -65,6 +71,7 @@ type Fee<T> = {
|
|
|
65
71
|
type SwapFee = Fee<'NETWORK' | 'INGRESS' | 'EGRESS' | 'BROKER' | 'BOOST'>;
|
|
66
72
|
type PoolFee = Fee<'LIQUIDITY'>;
|
|
67
73
|
type PaidFee = SwapFee | PoolFee;
|
|
74
|
+
type QuoteType = 'REGULAR' | 'DCA';
|
|
68
75
|
type PoolInfo = {
|
|
69
76
|
baseAsset: AssetAndChain;
|
|
70
77
|
quoteAsset: AssetAndChain;
|
|
@@ -86,8 +93,9 @@ type QuoteQueryResponse = QuoteDetails & {
|
|
|
86
93
|
boostQuote?: BoostedQuoteDetails;
|
|
87
94
|
dcaParams?: {
|
|
88
95
|
numberOfChunks: number;
|
|
89
|
-
|
|
96
|
+
chunkIntervalBlocks: number;
|
|
90
97
|
};
|
|
98
|
+
type: QuoteType;
|
|
91
99
|
};
|
|
92
100
|
|
|
93
101
|
interface ExecuteSwapParams {
|
|
@@ -230,7 +238,7 @@ type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
|
230
238
|
state: 'FAILED';
|
|
231
239
|
depositAddress: undefined;
|
|
232
240
|
}>;
|
|
233
|
-
type SwapState
|
|
241
|
+
type SwapState = {
|
|
234
242
|
state: 'AWAITING_DEPOSIT';
|
|
235
243
|
depositAmount: string | undefined;
|
|
236
244
|
depositTransactionConfirmations: number | undefined;
|
|
@@ -317,8 +325,8 @@ type SwapState$1 = {
|
|
|
317
325
|
egressIgnoredAt: number;
|
|
318
326
|
egressIgnoredBlockIndex: string;
|
|
319
327
|
};
|
|
320
|
-
type DepositAddressStatusResponse = DepositAddressFields & SwapState
|
|
321
|
-
type VaultSwapStatusResponse = VaultSwapFields & SwapState
|
|
328
|
+
type DepositAddressStatusResponse = DepositAddressFields & SwapState;
|
|
329
|
+
type VaultSwapStatusResponse = VaultSwapFields & SwapState;
|
|
322
330
|
type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
|
|
323
331
|
type BoostPoolDepth = {
|
|
324
332
|
feeTierBps: number;
|
|
@@ -334,16 +342,6 @@ declare enum FailureMode {
|
|
|
334
342
|
BroadcastAborted = "SENDING_FAILED"
|
|
335
343
|
}
|
|
336
344
|
|
|
337
|
-
interface DcaParameters {
|
|
338
|
-
numberOfChunks: number;
|
|
339
|
-
chunkIntervalBlocks: string;
|
|
340
|
-
}
|
|
341
|
-
interface Ccm {
|
|
342
|
-
message: string;
|
|
343
|
-
gasBudget: string;
|
|
344
|
-
cfParameters: string | undefined;
|
|
345
|
-
ccmDepositReceivedBlockIndex: string | undefined;
|
|
346
|
-
}
|
|
347
345
|
interface Failure {
|
|
348
346
|
failedAt: number;
|
|
349
347
|
failedBlockIndex: string;
|
|
@@ -373,39 +371,51 @@ interface DepositChannelFields {
|
|
|
373
371
|
openedThroughBackend: boolean;
|
|
374
372
|
affiliateBrokers: AffiliateBroker[];
|
|
375
373
|
fillOrKillParams: FillOrKillParams | undefined;
|
|
376
|
-
dcaParams:
|
|
374
|
+
dcaParams: DcaParams | undefined;
|
|
377
375
|
}
|
|
378
376
|
interface DepositFields {
|
|
379
377
|
amount: string;
|
|
380
378
|
txRef: string | undefined;
|
|
381
379
|
txConfirmations: number | undefined;
|
|
382
|
-
|
|
383
|
-
|
|
380
|
+
witnessedAt: number | undefined;
|
|
381
|
+
witnessedBlockIndex: string | undefined;
|
|
384
382
|
failure: Failure | undefined;
|
|
385
383
|
failedAt: number | undefined;
|
|
386
384
|
failedBlockIndex: string | undefined;
|
|
387
385
|
}
|
|
388
|
-
interface SwapChunk {
|
|
389
|
-
swapInputAmount: string;
|
|
390
|
-
swapOutputAmount: string | undefined;
|
|
391
|
-
scheduledAt: number;
|
|
392
|
-
scheduledBlockIndex: string;
|
|
393
|
-
executedAt: number | undefined;
|
|
394
|
-
executedBlockIndex: string | undefined;
|
|
395
|
-
retryCount: number;
|
|
396
|
-
latestSwapRescheduledAt: number | undefined;
|
|
397
|
-
latestSwapRescheduledBlockIndex: number | undefined;
|
|
398
|
-
fees: PaidFee[];
|
|
399
|
-
isDca: false;
|
|
400
|
-
}
|
|
401
386
|
interface SwapFields {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
387
|
+
originalInputAmount: string;
|
|
388
|
+
remainingInputAmount: string;
|
|
389
|
+
swappedInputAmount: string;
|
|
390
|
+
swappedOutputAmount: string;
|
|
391
|
+
regular?: {
|
|
392
|
+
inputAmount: string;
|
|
393
|
+
outputAmount: string;
|
|
394
|
+
scheduledAt: number;
|
|
395
|
+
scheduledBlockIndex: string;
|
|
396
|
+
executedAt?: number;
|
|
397
|
+
executedBlockIndex?: string;
|
|
398
|
+
retryCount: 0;
|
|
399
|
+
};
|
|
400
|
+
dca?: {
|
|
401
|
+
lastExecutedChunk: {
|
|
402
|
+
inputAmount: string;
|
|
403
|
+
outputAmount: string;
|
|
404
|
+
scheduledAt: number;
|
|
405
|
+
scheduledBlockIndex: string;
|
|
406
|
+
executedAt: number;
|
|
407
|
+
executedBlockIndex: string;
|
|
408
|
+
retryCount: number;
|
|
409
|
+
} | null;
|
|
410
|
+
currentChunk: {
|
|
411
|
+
inputAmount: string;
|
|
412
|
+
scheduledAt: number;
|
|
413
|
+
scheduledBlockIndex: string;
|
|
414
|
+
retryCount: number;
|
|
415
|
+
} | null;
|
|
416
|
+
executedChunks: number;
|
|
417
|
+
remainingChunks: number;
|
|
418
|
+
};
|
|
409
419
|
fees: PaidFee[];
|
|
410
420
|
}
|
|
411
421
|
interface EgressFields {
|
|
@@ -413,9 +423,8 @@ interface EgressFields {
|
|
|
413
423
|
scheduledAt: number;
|
|
414
424
|
scheduledBlockIndex: string;
|
|
415
425
|
txRef: string | undefined;
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
ignoredAmount: string | undefined;
|
|
426
|
+
witnessedAt: number | undefined;
|
|
427
|
+
witnessedBlockIndex: string | undefined;
|
|
419
428
|
failure: Failure | undefined;
|
|
420
429
|
failedAt: number | undefined;
|
|
421
430
|
failedBlockIndex: string | undefined;
|
|
@@ -423,27 +432,16 @@ interface EgressFields {
|
|
|
423
432
|
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
424
433
|
swapId: string;
|
|
425
434
|
destAddress: string;
|
|
426
|
-
|
|
435
|
+
depositChannel: DepositChannelFields | undefined;
|
|
436
|
+
ccmParams: CcmParams | undefined;
|
|
427
437
|
boost: Boost | undefined;
|
|
428
438
|
estimatedDurationSeconds: number | null | undefined;
|
|
429
439
|
srcChainRequiredBlockConfirmations: number | null;
|
|
430
440
|
}
|
|
431
|
-
interface
|
|
432
|
-
}
|
|
433
|
-
interface ReceivingVaultSwap extends VaultSwapCommonFields {
|
|
434
|
-
deposit: DepositFields;
|
|
435
|
-
}
|
|
436
|
-
interface SwappingVaultSwap extends ReceivingVaultSwap {
|
|
437
|
-
swap: Exclude<SwapChunk, 'latestSwapRescheduledAt' | 'latestSwapRescheduledBlockIndex'> | undefined;
|
|
438
|
-
swapEgress: EgressFields | undefined;
|
|
439
|
-
}
|
|
440
|
-
interface SendingVaultSwap extends SwappingVaultSwap {
|
|
441
|
-
swapEgress: EgressFields | undefined;
|
|
442
|
-
}
|
|
443
|
-
interface DepositChannel extends SwapStatusResponseCommonFields {
|
|
441
|
+
interface Waiting extends SwapStatusResponseCommonFields {
|
|
444
442
|
depositChannel: DepositChannelFields;
|
|
445
443
|
}
|
|
446
|
-
interface Receiving extends
|
|
444
|
+
interface Receiving extends SwapStatusResponseCommonFields {
|
|
447
445
|
deposit: DepositFields;
|
|
448
446
|
}
|
|
449
447
|
interface Swapping extends Receiving {
|
|
@@ -454,9 +452,9 @@ interface Sending extends Receiving {
|
|
|
454
452
|
swapEgress: EgressFields | undefined;
|
|
455
453
|
refundEgress: EgressFields | undefined;
|
|
456
454
|
}
|
|
457
|
-
type
|
|
455
|
+
type SwapStatusResponseV2 = ({
|
|
458
456
|
state: 'WAITING';
|
|
459
|
-
} &
|
|
457
|
+
} & Waiting) | ({
|
|
460
458
|
state: 'RECEIVING';
|
|
461
459
|
} & Receiving) | ({
|
|
462
460
|
state: 'SWAPPING';
|
|
@@ -469,9 +467,6 @@ type SwapState = ({
|
|
|
469
467
|
} & Sending) | ({
|
|
470
468
|
state: 'FAILED';
|
|
471
469
|
} & Sending);
|
|
472
|
-
type DepositAddressStatusResponseV2 = SwapState;
|
|
473
|
-
type VaultSwapStatusResponseV2 = SwapState & SendingVaultSwap;
|
|
474
|
-
type SwapStatusResponseV2 = DepositAddressStatusResponseV2 | VaultSwapStatusResponseV2;
|
|
475
470
|
|
|
476
471
|
type RequestOptions = {
|
|
477
472
|
signal?: AbortSignal;
|
|
@@ -527,4 +522,4 @@ declare class SwapSDK {
|
|
|
527
522
|
}): Promise<BoostPoolDepth[]>;
|
|
528
523
|
}
|
|
529
524
|
|
|
530
|
-
export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type
|
|
525
|
+
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, type QuoteResponseV2, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse };
|
package/dist/swap.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Signer } from 'ethers';
|
|
|
2
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
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
|
-
import { SwapType } from '.prisma/client';
|
|
6
5
|
|
|
7
6
|
declare const ccmParamsSchema: z.ZodObject<{
|
|
8
7
|
gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
|
|
@@ -35,6 +34,17 @@ declare const affiliateBroker: z.ZodEffects<z.ZodObject<{
|
|
|
35
34
|
commissionBps: number;
|
|
36
35
|
}>;
|
|
37
36
|
type AffiliateBroker = z.input<typeof affiliateBroker>;
|
|
37
|
+
declare const dcaParams: z.ZodObject<{
|
|
38
|
+
numberOfChunks: z.ZodNumber;
|
|
39
|
+
chunkIntervalBlocks: z.ZodNumber;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
numberOfChunks: number;
|
|
42
|
+
chunkIntervalBlocks: number;
|
|
43
|
+
}, {
|
|
44
|
+
numberOfChunks: number;
|
|
45
|
+
chunkIntervalBlocks: number;
|
|
46
|
+
}>;
|
|
47
|
+
type DcaParams = z.input<typeof dcaParams>;
|
|
38
48
|
declare const fillOrKillParams: z.ZodObject<{
|
|
39
49
|
retryDurationBlocks: z.ZodNumber;
|
|
40
50
|
refundAddress: z.ZodString;
|
|
@@ -52,10 +62,6 @@ type FillOrKillParamsX128 = z.input<typeof fillOrKillParams>;
|
|
|
52
62
|
type FillOrKillParams = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
|
|
53
63
|
minPrice: string;
|
|
54
64
|
};
|
|
55
|
-
type DcaParams = {
|
|
56
|
-
numberOfChunks: number;
|
|
57
|
-
chunkInterval: number;
|
|
58
|
-
};
|
|
59
65
|
type Fee<T> = {
|
|
60
66
|
type: T;
|
|
61
67
|
chain: Chain;
|
|
@@ -65,6 +71,7 @@ type Fee<T> = {
|
|
|
65
71
|
type SwapFee = Fee<'NETWORK' | 'INGRESS' | 'EGRESS' | 'BROKER' | 'BOOST'>;
|
|
66
72
|
type PoolFee = Fee<'LIQUIDITY'>;
|
|
67
73
|
type PaidFee = SwapFee | PoolFee;
|
|
74
|
+
type QuoteType = 'REGULAR' | 'DCA';
|
|
68
75
|
type PoolInfo = {
|
|
69
76
|
baseAsset: AssetAndChain;
|
|
70
77
|
quoteAsset: AssetAndChain;
|
|
@@ -86,8 +93,9 @@ type QuoteQueryResponse = QuoteDetails & {
|
|
|
86
93
|
boostQuote?: BoostedQuoteDetails;
|
|
87
94
|
dcaParams?: {
|
|
88
95
|
numberOfChunks: number;
|
|
89
|
-
|
|
96
|
+
chunkIntervalBlocks: number;
|
|
90
97
|
};
|
|
98
|
+
type: QuoteType;
|
|
91
99
|
};
|
|
92
100
|
|
|
93
101
|
interface ExecuteSwapParams {
|
|
@@ -230,7 +238,7 @@ type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
|
230
238
|
state: 'FAILED';
|
|
231
239
|
depositAddress: undefined;
|
|
232
240
|
}>;
|
|
233
|
-
type SwapState
|
|
241
|
+
type SwapState = {
|
|
234
242
|
state: 'AWAITING_DEPOSIT';
|
|
235
243
|
depositAmount: string | undefined;
|
|
236
244
|
depositTransactionConfirmations: number | undefined;
|
|
@@ -317,8 +325,8 @@ type SwapState$1 = {
|
|
|
317
325
|
egressIgnoredAt: number;
|
|
318
326
|
egressIgnoredBlockIndex: string;
|
|
319
327
|
};
|
|
320
|
-
type DepositAddressStatusResponse = DepositAddressFields & SwapState
|
|
321
|
-
type VaultSwapStatusResponse = VaultSwapFields & SwapState
|
|
328
|
+
type DepositAddressStatusResponse = DepositAddressFields & SwapState;
|
|
329
|
+
type VaultSwapStatusResponse = VaultSwapFields & SwapState;
|
|
322
330
|
type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
|
|
323
331
|
type BoostPoolDepth = {
|
|
324
332
|
feeTierBps: number;
|
|
@@ -334,16 +342,6 @@ declare enum FailureMode {
|
|
|
334
342
|
BroadcastAborted = "SENDING_FAILED"
|
|
335
343
|
}
|
|
336
344
|
|
|
337
|
-
interface DcaParameters {
|
|
338
|
-
numberOfChunks: number;
|
|
339
|
-
chunkIntervalBlocks: string;
|
|
340
|
-
}
|
|
341
|
-
interface Ccm {
|
|
342
|
-
message: string;
|
|
343
|
-
gasBudget: string;
|
|
344
|
-
cfParameters: string | undefined;
|
|
345
|
-
ccmDepositReceivedBlockIndex: string | undefined;
|
|
346
|
-
}
|
|
347
345
|
interface Failure {
|
|
348
346
|
failedAt: number;
|
|
349
347
|
failedBlockIndex: string;
|
|
@@ -373,39 +371,51 @@ interface DepositChannelFields {
|
|
|
373
371
|
openedThroughBackend: boolean;
|
|
374
372
|
affiliateBrokers: AffiliateBroker[];
|
|
375
373
|
fillOrKillParams: FillOrKillParams | undefined;
|
|
376
|
-
dcaParams:
|
|
374
|
+
dcaParams: DcaParams | undefined;
|
|
377
375
|
}
|
|
378
376
|
interface DepositFields {
|
|
379
377
|
amount: string;
|
|
380
378
|
txRef: string | undefined;
|
|
381
379
|
txConfirmations: number | undefined;
|
|
382
|
-
|
|
383
|
-
|
|
380
|
+
witnessedAt: number | undefined;
|
|
381
|
+
witnessedBlockIndex: string | undefined;
|
|
384
382
|
failure: Failure | undefined;
|
|
385
383
|
failedAt: number | undefined;
|
|
386
384
|
failedBlockIndex: string | undefined;
|
|
387
385
|
}
|
|
388
|
-
interface SwapChunk {
|
|
389
|
-
swapInputAmount: string;
|
|
390
|
-
swapOutputAmount: string | undefined;
|
|
391
|
-
scheduledAt: number;
|
|
392
|
-
scheduledBlockIndex: string;
|
|
393
|
-
executedAt: number | undefined;
|
|
394
|
-
executedBlockIndex: string | undefined;
|
|
395
|
-
retryCount: number;
|
|
396
|
-
latestSwapRescheduledAt: number | undefined;
|
|
397
|
-
latestSwapRescheduledBlockIndex: number | undefined;
|
|
398
|
-
fees: PaidFee[];
|
|
399
|
-
isDca: false;
|
|
400
|
-
}
|
|
401
386
|
interface SwapFields {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
387
|
+
originalInputAmount: string;
|
|
388
|
+
remainingInputAmount: string;
|
|
389
|
+
swappedInputAmount: string;
|
|
390
|
+
swappedOutputAmount: string;
|
|
391
|
+
regular?: {
|
|
392
|
+
inputAmount: string;
|
|
393
|
+
outputAmount: string;
|
|
394
|
+
scheduledAt: number;
|
|
395
|
+
scheduledBlockIndex: string;
|
|
396
|
+
executedAt?: number;
|
|
397
|
+
executedBlockIndex?: string;
|
|
398
|
+
retryCount: 0;
|
|
399
|
+
};
|
|
400
|
+
dca?: {
|
|
401
|
+
lastExecutedChunk: {
|
|
402
|
+
inputAmount: string;
|
|
403
|
+
outputAmount: string;
|
|
404
|
+
scheduledAt: number;
|
|
405
|
+
scheduledBlockIndex: string;
|
|
406
|
+
executedAt: number;
|
|
407
|
+
executedBlockIndex: string;
|
|
408
|
+
retryCount: number;
|
|
409
|
+
} | null;
|
|
410
|
+
currentChunk: {
|
|
411
|
+
inputAmount: string;
|
|
412
|
+
scheduledAt: number;
|
|
413
|
+
scheduledBlockIndex: string;
|
|
414
|
+
retryCount: number;
|
|
415
|
+
} | null;
|
|
416
|
+
executedChunks: number;
|
|
417
|
+
remainingChunks: number;
|
|
418
|
+
};
|
|
409
419
|
fees: PaidFee[];
|
|
410
420
|
}
|
|
411
421
|
interface EgressFields {
|
|
@@ -413,9 +423,8 @@ interface EgressFields {
|
|
|
413
423
|
scheduledAt: number;
|
|
414
424
|
scheduledBlockIndex: string;
|
|
415
425
|
txRef: string | undefined;
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
ignoredAmount: string | undefined;
|
|
426
|
+
witnessedAt: number | undefined;
|
|
427
|
+
witnessedBlockIndex: string | undefined;
|
|
419
428
|
failure: Failure | undefined;
|
|
420
429
|
failedAt: number | undefined;
|
|
421
430
|
failedBlockIndex: string | undefined;
|
|
@@ -423,27 +432,16 @@ interface EgressFields {
|
|
|
423
432
|
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
424
433
|
swapId: string;
|
|
425
434
|
destAddress: string;
|
|
426
|
-
|
|
435
|
+
depositChannel: DepositChannelFields | undefined;
|
|
436
|
+
ccmParams: CcmParams | undefined;
|
|
427
437
|
boost: Boost | undefined;
|
|
428
438
|
estimatedDurationSeconds: number | null | undefined;
|
|
429
439
|
srcChainRequiredBlockConfirmations: number | null;
|
|
430
440
|
}
|
|
431
|
-
interface
|
|
432
|
-
}
|
|
433
|
-
interface ReceivingVaultSwap extends VaultSwapCommonFields {
|
|
434
|
-
deposit: DepositFields;
|
|
435
|
-
}
|
|
436
|
-
interface SwappingVaultSwap extends ReceivingVaultSwap {
|
|
437
|
-
swap: Exclude<SwapChunk, 'latestSwapRescheduledAt' | 'latestSwapRescheduledBlockIndex'> | undefined;
|
|
438
|
-
swapEgress: EgressFields | undefined;
|
|
439
|
-
}
|
|
440
|
-
interface SendingVaultSwap extends SwappingVaultSwap {
|
|
441
|
-
swapEgress: EgressFields | undefined;
|
|
442
|
-
}
|
|
443
|
-
interface DepositChannel extends SwapStatusResponseCommonFields {
|
|
441
|
+
interface Waiting extends SwapStatusResponseCommonFields {
|
|
444
442
|
depositChannel: DepositChannelFields;
|
|
445
443
|
}
|
|
446
|
-
interface Receiving extends
|
|
444
|
+
interface Receiving extends SwapStatusResponseCommonFields {
|
|
447
445
|
deposit: DepositFields;
|
|
448
446
|
}
|
|
449
447
|
interface Swapping extends Receiving {
|
|
@@ -454,9 +452,9 @@ interface Sending extends Receiving {
|
|
|
454
452
|
swapEgress: EgressFields | undefined;
|
|
455
453
|
refundEgress: EgressFields | undefined;
|
|
456
454
|
}
|
|
457
|
-
type
|
|
455
|
+
type SwapStatusResponseV2 = ({
|
|
458
456
|
state: 'WAITING';
|
|
459
|
-
} &
|
|
457
|
+
} & Waiting) | ({
|
|
460
458
|
state: 'RECEIVING';
|
|
461
459
|
} & Receiving) | ({
|
|
462
460
|
state: 'SWAPPING';
|
|
@@ -469,9 +467,6 @@ type SwapState = ({
|
|
|
469
467
|
} & Sending) | ({
|
|
470
468
|
state: 'FAILED';
|
|
471
469
|
} & Sending);
|
|
472
|
-
type DepositAddressStatusResponseV2 = SwapState;
|
|
473
|
-
type VaultSwapStatusResponseV2 = SwapState & SendingVaultSwap;
|
|
474
|
-
type SwapStatusResponseV2 = DepositAddressStatusResponseV2 | VaultSwapStatusResponseV2;
|
|
475
470
|
|
|
476
471
|
type RequestOptions = {
|
|
477
472
|
signal?: AbortSignal;
|
|
@@ -527,4 +522,4 @@ declare class SwapSDK {
|
|
|
527
522
|
}): Promise<BoostPoolDepth[]>;
|
|
528
523
|
}
|
|
529
524
|
|
|
530
|
-
export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type
|
|
525
|
+
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, type QuoteResponseV2, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse };
|
package/dist/swap.js
CHANGED
|
@@ -6925,7 +6925,7 @@ var affiliateBroker = z.object({
|
|
|
6925
6925
|
}));
|
|
6926
6926
|
var dcaParams = z.object({
|
|
6927
6927
|
numberOfChunks: number,
|
|
6928
|
-
|
|
6928
|
+
chunkIntervalBlocks: number
|
|
6929
6929
|
});
|
|
6930
6930
|
var fillOrKillParams = z.object({
|
|
6931
6931
|
retryDurationBlocks: number,
|
|
@@ -6944,10 +6944,7 @@ z.object({
|
|
|
6944
6944
|
maxBoostFeeBps: z.number().optional(),
|
|
6945
6945
|
srcAddress: z.string().optional(),
|
|
6946
6946
|
fillOrKillParams: fillOrKillParams.optional(),
|
|
6947
|
-
dcaParams:
|
|
6948
|
-
numberOfChunks: z.number(),
|
|
6949
|
-
chunkInterval: z.number()
|
|
6950
|
-
}).optional()
|
|
6947
|
+
dcaParams: dcaParams.optional()
|
|
6951
6948
|
}).transform(({ amount, ...rest }) => ({
|
|
6952
6949
|
...rest,
|
|
6953
6950
|
expectedDepositAmount: amount
|
|
@@ -6982,9 +6979,9 @@ var validateRequest = /* @__PURE__ */ __name((network, params) => z.tuple([
|
|
|
6982
6979
|
refund_address: refundAddress,
|
|
6983
6980
|
min_price: `0x${BigInt(minPriceX128).toString(16)}`
|
|
6984
6981
|
})).optional(),
|
|
6985
|
-
dcaParams.transform(({ numberOfChunks,
|
|
6982
|
+
dcaParams.transform(({ numberOfChunks, chunkIntervalBlocks }) => ({
|
|
6986
6983
|
number_of_chunks: numberOfChunks,
|
|
6987
|
-
chunk_interval:
|
|
6984
|
+
chunk_interval: chunkIntervalBlocks
|
|
6988
6985
|
})).optional()
|
|
6989
6986
|
]).parse(params), "validateRequest");
|
|
6990
6987
|
var validateResponse = /* @__PURE__ */ __name((network, response) => z.object({
|
|
@@ -10032,7 +10029,7 @@ var getChainData = /* @__PURE__ */ __name((chain2, network, env) => ({
|
|
|
10032
10029
|
}), "getChainData");
|
|
10033
10030
|
|
|
10034
10031
|
// package.json
|
|
10035
|
-
var version = "1.6.0-
|
|
10032
|
+
var version = "1.6.0-beta.1";
|
|
10036
10033
|
|
|
10037
10034
|
// src/swap/consts.ts
|
|
10038
10035
|
var CF_SDK_VERSION_HEADERS = {
|
package/dist/swap.mjs
CHANGED
|
@@ -6650,7 +6650,7 @@ var affiliateBroker = z.object({
|
|
|
6650
6650
|
}));
|
|
6651
6651
|
var dcaParams = z.object({
|
|
6652
6652
|
numberOfChunks: number,
|
|
6653
|
-
|
|
6653
|
+
chunkIntervalBlocks: number
|
|
6654
6654
|
});
|
|
6655
6655
|
var fillOrKillParams = z.object({
|
|
6656
6656
|
retryDurationBlocks: number,
|
|
@@ -6669,10 +6669,7 @@ z.object({
|
|
|
6669
6669
|
maxBoostFeeBps: z.number().optional(),
|
|
6670
6670
|
srcAddress: z.string().optional(),
|
|
6671
6671
|
fillOrKillParams: fillOrKillParams.optional(),
|
|
6672
|
-
dcaParams:
|
|
6673
|
-
numberOfChunks: z.number(),
|
|
6674
|
-
chunkInterval: z.number()
|
|
6675
|
-
}).optional()
|
|
6672
|
+
dcaParams: dcaParams.optional()
|
|
6676
6673
|
}).transform(({ amount, ...rest }) => ({
|
|
6677
6674
|
...rest,
|
|
6678
6675
|
expectedDepositAmount: amount
|
|
@@ -6707,9 +6704,9 @@ var validateRequest = /* @__PURE__ */ __name((network, params) => z.tuple([
|
|
|
6707
6704
|
refund_address: refundAddress,
|
|
6708
6705
|
min_price: `0x${BigInt(minPriceX128).toString(16)}`
|
|
6709
6706
|
})).optional(),
|
|
6710
|
-
dcaParams.transform(({ numberOfChunks,
|
|
6707
|
+
dcaParams.transform(({ numberOfChunks, chunkIntervalBlocks }) => ({
|
|
6711
6708
|
number_of_chunks: numberOfChunks,
|
|
6712
|
-
chunk_interval:
|
|
6709
|
+
chunk_interval: chunkIntervalBlocks
|
|
6713
6710
|
})).optional()
|
|
6714
6711
|
]).parse(params), "validateRequest");
|
|
6715
6712
|
var validateResponse = /* @__PURE__ */ __name((network, response) => z.object({
|
|
@@ -8307,7 +8304,7 @@ var getChainData = /* @__PURE__ */ __name((chain2, network, env) => ({
|
|
|
8307
8304
|
}), "getChainData");
|
|
8308
8305
|
|
|
8309
8306
|
// package.json
|
|
8310
|
-
var version = "1.6.0-
|
|
8307
|
+
var version = "1.6.0-beta.1";
|
|
8311
8308
|
|
|
8312
8309
|
// src/swap/consts.ts
|
|
8313
8310
|
var CF_SDK_VERSION_HEADERS = {
|