@chainflip/sdk 1.6.0-alpha.7 → 1.6.0-beta.0
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 +59 -66
- package/dist/swap.d.ts +59 -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;
|
|
@@ -86,7 +92,7 @@ type QuoteQueryResponse = QuoteDetails & {
|
|
|
86
92
|
boostQuote?: BoostedQuoteDetails;
|
|
87
93
|
dcaParams?: {
|
|
88
94
|
numberOfChunks: number;
|
|
89
|
-
|
|
95
|
+
chunkIntervalBlocks: number;
|
|
90
96
|
};
|
|
91
97
|
};
|
|
92
98
|
|
|
@@ -230,7 +236,7 @@ type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
|
230
236
|
state: 'FAILED';
|
|
231
237
|
depositAddress: undefined;
|
|
232
238
|
}>;
|
|
233
|
-
type SwapState
|
|
239
|
+
type SwapState = {
|
|
234
240
|
state: 'AWAITING_DEPOSIT';
|
|
235
241
|
depositAmount: string | undefined;
|
|
236
242
|
depositTransactionConfirmations: number | undefined;
|
|
@@ -317,8 +323,8 @@ type SwapState$1 = {
|
|
|
317
323
|
egressIgnoredAt: number;
|
|
318
324
|
egressIgnoredBlockIndex: string;
|
|
319
325
|
};
|
|
320
|
-
type DepositAddressStatusResponse = DepositAddressFields & SwapState
|
|
321
|
-
type VaultSwapStatusResponse = VaultSwapFields & SwapState
|
|
326
|
+
type DepositAddressStatusResponse = DepositAddressFields & SwapState;
|
|
327
|
+
type VaultSwapStatusResponse = VaultSwapFields & SwapState;
|
|
322
328
|
type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
|
|
323
329
|
type BoostPoolDepth = {
|
|
324
330
|
feeTierBps: number;
|
|
@@ -334,16 +340,6 @@ declare enum FailureMode {
|
|
|
334
340
|
BroadcastAborted = "SENDING_FAILED"
|
|
335
341
|
}
|
|
336
342
|
|
|
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
343
|
interface Failure {
|
|
348
344
|
failedAt: number;
|
|
349
345
|
failedBlockIndex: string;
|
|
@@ -373,39 +369,51 @@ interface DepositChannelFields {
|
|
|
373
369
|
openedThroughBackend: boolean;
|
|
374
370
|
affiliateBrokers: AffiliateBroker[];
|
|
375
371
|
fillOrKillParams: FillOrKillParams | undefined;
|
|
376
|
-
dcaParams:
|
|
372
|
+
dcaParams: DcaParams | undefined;
|
|
377
373
|
}
|
|
378
374
|
interface DepositFields {
|
|
379
375
|
amount: string;
|
|
380
376
|
txRef: string | undefined;
|
|
381
377
|
txConfirmations: number | undefined;
|
|
382
|
-
|
|
383
|
-
|
|
378
|
+
witnessedAt: number | undefined;
|
|
379
|
+
witnessedBlockIndex: string | undefined;
|
|
384
380
|
failure: Failure | undefined;
|
|
385
381
|
failedAt: number | undefined;
|
|
386
382
|
failedBlockIndex: string | undefined;
|
|
387
383
|
}
|
|
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
384
|
interface SwapFields {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
385
|
+
originalInputAmount: string;
|
|
386
|
+
remainingInputAmount: string;
|
|
387
|
+
swappedInputAmount: string;
|
|
388
|
+
swappedOutputAmount: string;
|
|
389
|
+
regular?: {
|
|
390
|
+
inputAmount: string;
|
|
391
|
+
outputAmount: string;
|
|
392
|
+
scheduledAt: number;
|
|
393
|
+
scheduledBlockIndex: string;
|
|
394
|
+
executedAt?: number;
|
|
395
|
+
executedBlockIndex?: string;
|
|
396
|
+
retryCount: 0;
|
|
397
|
+
};
|
|
398
|
+
dca?: {
|
|
399
|
+
lastExecutedChunk: {
|
|
400
|
+
inputAmount: string;
|
|
401
|
+
outputAmount: string;
|
|
402
|
+
scheduledAt: number;
|
|
403
|
+
scheduledBlockIndex: string;
|
|
404
|
+
executedAt: number;
|
|
405
|
+
executedBlockIndex: string;
|
|
406
|
+
retryCount: number;
|
|
407
|
+
} | null;
|
|
408
|
+
currentChunk: {
|
|
409
|
+
inputAmount: string;
|
|
410
|
+
scheduledAt: number;
|
|
411
|
+
scheduledBlockIndex: string;
|
|
412
|
+
retryCount: number;
|
|
413
|
+
} | null;
|
|
414
|
+
executedChunks: number;
|
|
415
|
+
remainingChunks: number;
|
|
416
|
+
};
|
|
409
417
|
fees: PaidFee[];
|
|
410
418
|
}
|
|
411
419
|
interface EgressFields {
|
|
@@ -413,9 +421,8 @@ interface EgressFields {
|
|
|
413
421
|
scheduledAt: number;
|
|
414
422
|
scheduledBlockIndex: string;
|
|
415
423
|
txRef: string | undefined;
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
ignoredAmount: string | undefined;
|
|
424
|
+
witnessedAt: number | undefined;
|
|
425
|
+
witnessedBlockIndex: string | undefined;
|
|
419
426
|
failure: Failure | undefined;
|
|
420
427
|
failedAt: number | undefined;
|
|
421
428
|
failedBlockIndex: string | undefined;
|
|
@@ -423,27 +430,16 @@ interface EgressFields {
|
|
|
423
430
|
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
424
431
|
swapId: string;
|
|
425
432
|
destAddress: string;
|
|
426
|
-
|
|
433
|
+
depositChannel: DepositChannelFields | undefined;
|
|
434
|
+
ccmParams: CcmParams | undefined;
|
|
427
435
|
boost: Boost | undefined;
|
|
428
436
|
estimatedDurationSeconds: number | null | undefined;
|
|
429
437
|
srcChainRequiredBlockConfirmations: number | null;
|
|
430
438
|
}
|
|
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 {
|
|
439
|
+
interface Waiting extends SwapStatusResponseCommonFields {
|
|
444
440
|
depositChannel: DepositChannelFields;
|
|
445
441
|
}
|
|
446
|
-
interface Receiving extends
|
|
442
|
+
interface Receiving extends SwapStatusResponseCommonFields {
|
|
447
443
|
deposit: DepositFields;
|
|
448
444
|
}
|
|
449
445
|
interface Swapping extends Receiving {
|
|
@@ -454,9 +450,9 @@ interface Sending extends Receiving {
|
|
|
454
450
|
swapEgress: EgressFields | undefined;
|
|
455
451
|
refundEgress: EgressFields | undefined;
|
|
456
452
|
}
|
|
457
|
-
type
|
|
453
|
+
type SwapStatusResponseV2 = ({
|
|
458
454
|
state: 'WAITING';
|
|
459
|
-
} &
|
|
455
|
+
} & Waiting) | ({
|
|
460
456
|
state: 'RECEIVING';
|
|
461
457
|
} & Receiving) | ({
|
|
462
458
|
state: 'SWAPPING';
|
|
@@ -469,9 +465,6 @@ type SwapState = ({
|
|
|
469
465
|
} & Sending) | ({
|
|
470
466
|
state: 'FAILED';
|
|
471
467
|
} & Sending);
|
|
472
|
-
type DepositAddressStatusResponseV2 = SwapState;
|
|
473
|
-
type VaultSwapStatusResponseV2 = SwapState & SendingVaultSwap;
|
|
474
|
-
type SwapStatusResponseV2 = DepositAddressStatusResponseV2 | VaultSwapStatusResponseV2;
|
|
475
468
|
|
|
476
469
|
type RequestOptions = {
|
|
477
470
|
signal?: AbortSignal;
|
|
@@ -527,4 +520,4 @@ declare class SwapSDK {
|
|
|
527
520
|
}): Promise<BoostPoolDepth[]>;
|
|
528
521
|
}
|
|
529
522
|
|
|
530
|
-
export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type
|
|
523
|
+
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;
|
|
@@ -86,7 +92,7 @@ type QuoteQueryResponse = QuoteDetails & {
|
|
|
86
92
|
boostQuote?: BoostedQuoteDetails;
|
|
87
93
|
dcaParams?: {
|
|
88
94
|
numberOfChunks: number;
|
|
89
|
-
|
|
95
|
+
chunkIntervalBlocks: number;
|
|
90
96
|
};
|
|
91
97
|
};
|
|
92
98
|
|
|
@@ -230,7 +236,7 @@ type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
|
230
236
|
state: 'FAILED';
|
|
231
237
|
depositAddress: undefined;
|
|
232
238
|
}>;
|
|
233
|
-
type SwapState
|
|
239
|
+
type SwapState = {
|
|
234
240
|
state: 'AWAITING_DEPOSIT';
|
|
235
241
|
depositAmount: string | undefined;
|
|
236
242
|
depositTransactionConfirmations: number | undefined;
|
|
@@ -317,8 +323,8 @@ type SwapState$1 = {
|
|
|
317
323
|
egressIgnoredAt: number;
|
|
318
324
|
egressIgnoredBlockIndex: string;
|
|
319
325
|
};
|
|
320
|
-
type DepositAddressStatusResponse = DepositAddressFields & SwapState
|
|
321
|
-
type VaultSwapStatusResponse = VaultSwapFields & SwapState
|
|
326
|
+
type DepositAddressStatusResponse = DepositAddressFields & SwapState;
|
|
327
|
+
type VaultSwapStatusResponse = VaultSwapFields & SwapState;
|
|
322
328
|
type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
|
|
323
329
|
type BoostPoolDepth = {
|
|
324
330
|
feeTierBps: number;
|
|
@@ -334,16 +340,6 @@ declare enum FailureMode {
|
|
|
334
340
|
BroadcastAborted = "SENDING_FAILED"
|
|
335
341
|
}
|
|
336
342
|
|
|
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
343
|
interface Failure {
|
|
348
344
|
failedAt: number;
|
|
349
345
|
failedBlockIndex: string;
|
|
@@ -373,39 +369,51 @@ interface DepositChannelFields {
|
|
|
373
369
|
openedThroughBackend: boolean;
|
|
374
370
|
affiliateBrokers: AffiliateBroker[];
|
|
375
371
|
fillOrKillParams: FillOrKillParams | undefined;
|
|
376
|
-
dcaParams:
|
|
372
|
+
dcaParams: DcaParams | undefined;
|
|
377
373
|
}
|
|
378
374
|
interface DepositFields {
|
|
379
375
|
amount: string;
|
|
380
376
|
txRef: string | undefined;
|
|
381
377
|
txConfirmations: number | undefined;
|
|
382
|
-
|
|
383
|
-
|
|
378
|
+
witnessedAt: number | undefined;
|
|
379
|
+
witnessedBlockIndex: string | undefined;
|
|
384
380
|
failure: Failure | undefined;
|
|
385
381
|
failedAt: number | undefined;
|
|
386
382
|
failedBlockIndex: string | undefined;
|
|
387
383
|
}
|
|
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
384
|
interface SwapFields {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
385
|
+
originalInputAmount: string;
|
|
386
|
+
remainingInputAmount: string;
|
|
387
|
+
swappedInputAmount: string;
|
|
388
|
+
swappedOutputAmount: string;
|
|
389
|
+
regular?: {
|
|
390
|
+
inputAmount: string;
|
|
391
|
+
outputAmount: string;
|
|
392
|
+
scheduledAt: number;
|
|
393
|
+
scheduledBlockIndex: string;
|
|
394
|
+
executedAt?: number;
|
|
395
|
+
executedBlockIndex?: string;
|
|
396
|
+
retryCount: 0;
|
|
397
|
+
};
|
|
398
|
+
dca?: {
|
|
399
|
+
lastExecutedChunk: {
|
|
400
|
+
inputAmount: string;
|
|
401
|
+
outputAmount: string;
|
|
402
|
+
scheduledAt: number;
|
|
403
|
+
scheduledBlockIndex: string;
|
|
404
|
+
executedAt: number;
|
|
405
|
+
executedBlockIndex: string;
|
|
406
|
+
retryCount: number;
|
|
407
|
+
} | null;
|
|
408
|
+
currentChunk: {
|
|
409
|
+
inputAmount: string;
|
|
410
|
+
scheduledAt: number;
|
|
411
|
+
scheduledBlockIndex: string;
|
|
412
|
+
retryCount: number;
|
|
413
|
+
} | null;
|
|
414
|
+
executedChunks: number;
|
|
415
|
+
remainingChunks: number;
|
|
416
|
+
};
|
|
409
417
|
fees: PaidFee[];
|
|
410
418
|
}
|
|
411
419
|
interface EgressFields {
|
|
@@ -413,9 +421,8 @@ interface EgressFields {
|
|
|
413
421
|
scheduledAt: number;
|
|
414
422
|
scheduledBlockIndex: string;
|
|
415
423
|
txRef: string | undefined;
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
ignoredAmount: string | undefined;
|
|
424
|
+
witnessedAt: number | undefined;
|
|
425
|
+
witnessedBlockIndex: string | undefined;
|
|
419
426
|
failure: Failure | undefined;
|
|
420
427
|
failedAt: number | undefined;
|
|
421
428
|
failedBlockIndex: string | undefined;
|
|
@@ -423,27 +430,16 @@ interface EgressFields {
|
|
|
423
430
|
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
424
431
|
swapId: string;
|
|
425
432
|
destAddress: string;
|
|
426
|
-
|
|
433
|
+
depositChannel: DepositChannelFields | undefined;
|
|
434
|
+
ccmParams: CcmParams | undefined;
|
|
427
435
|
boost: Boost | undefined;
|
|
428
436
|
estimatedDurationSeconds: number | null | undefined;
|
|
429
437
|
srcChainRequiredBlockConfirmations: number | null;
|
|
430
438
|
}
|
|
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 {
|
|
439
|
+
interface Waiting extends SwapStatusResponseCommonFields {
|
|
444
440
|
depositChannel: DepositChannelFields;
|
|
445
441
|
}
|
|
446
|
-
interface Receiving extends
|
|
442
|
+
interface Receiving extends SwapStatusResponseCommonFields {
|
|
447
443
|
deposit: DepositFields;
|
|
448
444
|
}
|
|
449
445
|
interface Swapping extends Receiving {
|
|
@@ -454,9 +450,9 @@ interface Sending extends Receiving {
|
|
|
454
450
|
swapEgress: EgressFields | undefined;
|
|
455
451
|
refundEgress: EgressFields | undefined;
|
|
456
452
|
}
|
|
457
|
-
type
|
|
453
|
+
type SwapStatusResponseV2 = ({
|
|
458
454
|
state: 'WAITING';
|
|
459
|
-
} &
|
|
455
|
+
} & Waiting) | ({
|
|
460
456
|
state: 'RECEIVING';
|
|
461
457
|
} & Receiving) | ({
|
|
462
458
|
state: 'SWAPPING';
|
|
@@ -469,9 +465,6 @@ type SwapState = ({
|
|
|
469
465
|
} & Sending) | ({
|
|
470
466
|
state: 'FAILED';
|
|
471
467
|
} & Sending);
|
|
472
|
-
type DepositAddressStatusResponseV2 = SwapState;
|
|
473
|
-
type VaultSwapStatusResponseV2 = SwapState & SendingVaultSwap;
|
|
474
|
-
type SwapStatusResponseV2 = DepositAddressStatusResponseV2 | VaultSwapStatusResponseV2;
|
|
475
468
|
|
|
476
469
|
type RequestOptions = {
|
|
477
470
|
signal?: AbortSignal;
|
|
@@ -527,4 +520,4 @@ declare class SwapSDK {
|
|
|
527
520
|
}): Promise<BoostPoolDepth[]>;
|
|
528
521
|
}
|
|
529
522
|
|
|
530
|
-
export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type
|
|
523
|
+
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.0";
|
|
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.0";
|
|
8311
8308
|
|
|
8312
8309
|
// src/swap/consts.ts
|
|
8313
8310
|
var CF_SDK_VERSION_HEADERS = {
|