@chainflip/sdk 1.7.0 → 1.8.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/chunk-HBQFFIRA.mjs +292 -0
- package/dist/{contracts-Bgib7w_h.d.mts → enums-_AFEOA70.d.mts} +1 -10
- package/dist/{contracts-Bgib7w_h.d.ts → enums-_AFEOA70.d.ts} +1 -10
- package/dist/funding.d.mts +10 -1
- package/dist/funding.d.ts +10 -1
- package/dist/funding.js +89 -233
- package/dist/funding.mjs +832 -43
- package/dist/swap.d.mts +86 -65
- package/dist/swap.d.ts +86 -65
- package/dist/swap.js +628 -2127
- package/dist/swap.mjs +474 -568
- package/package.json +11 -11
- package/dist/chunk-KLBPIDTY.mjs +0 -2373
package/dist/swap.d.mts
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork,
|
|
2
|
-
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './
|
|
1
|
+
import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, d as ChainAssetMap, e as ChainMap } from './enums-_AFEOA70.mjs';
|
|
2
|
+
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './enums-_AFEOA70.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { Signer } from 'ethers';
|
|
5
4
|
|
|
6
|
-
declare const ccmParamsSchema: z.ZodObject<{
|
|
5
|
+
declare const ccmParamsSchema: z.ZodEffects<z.ZodObject<{
|
|
7
6
|
gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
|
|
8
7
|
message: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
8
|
+
additionalData: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>>;
|
|
9
9
|
cfParameters: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
message: `0x${string}`;
|
|
12
12
|
gasBudget: `0x${string}`;
|
|
13
|
+
additionalData?: `0x${string}` | undefined;
|
|
13
14
|
cfParameters?: `0x${string}` | undefined;
|
|
14
15
|
}, {
|
|
15
16
|
message: string;
|
|
16
17
|
gasBudget: string;
|
|
18
|
+
additionalData?: string | undefined;
|
|
19
|
+
cfParameters?: string | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
gasBudget: `0x${string}`;
|
|
22
|
+
message: `0x${string}`;
|
|
23
|
+
additionalData: `0x${string}` | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
message: string;
|
|
26
|
+
gasBudget: string;
|
|
27
|
+
additionalData?: string | undefined;
|
|
17
28
|
cfParameters?: string | undefined;
|
|
18
29
|
}>;
|
|
19
|
-
type CcmParams = z.input<typeof ccmParamsSchema
|
|
30
|
+
type CcmParams = Omit<z.input<typeof ccmParamsSchema>, 'cfParameters'> & {
|
|
31
|
+
cfParameters?: string;
|
|
32
|
+
};
|
|
20
33
|
declare const affiliateBroker: z.ZodEffects<z.ZodObject<{
|
|
21
34
|
account: z.ZodEffects<z.ZodString, string, string>;
|
|
22
35
|
commissionBps: z.ZodNumber;
|
|
@@ -83,6 +96,7 @@ type BoostedQuoteDetails = {
|
|
|
83
96
|
interface BaseQuoteDetails {
|
|
84
97
|
srcAsset: AssetAndChain;
|
|
85
98
|
destAsset: AssetAndChain;
|
|
99
|
+
isVaultSwap: boolean;
|
|
86
100
|
depositAmount: string;
|
|
87
101
|
intermediateAmount?: string;
|
|
88
102
|
egressAmount: string;
|
|
@@ -116,16 +130,6 @@ type FillOrKillParamsWithSlippage$1 = Omit<FillOrKillParamsX128, 'minPriceX128'>
|
|
|
116
130
|
slippageTolerancePercent: string | number;
|
|
117
131
|
};
|
|
118
132
|
|
|
119
|
-
interface ExecuteSwapParams {
|
|
120
|
-
srcChain: Chain;
|
|
121
|
-
srcAsset: Asset;
|
|
122
|
-
destChain: Chain;
|
|
123
|
-
destAsset: Asset;
|
|
124
|
-
amount: string;
|
|
125
|
-
destAddress: string;
|
|
126
|
-
ccmParams?: CcmParams;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
133
|
interface ChainData {
|
|
130
134
|
chain: Chain;
|
|
131
135
|
name: string;
|
|
@@ -159,6 +163,7 @@ interface QuoteRequest extends ChainsAndAssets {
|
|
|
159
163
|
amount: string;
|
|
160
164
|
brokerCommissionBps?: number;
|
|
161
165
|
affiliateBrokers?: AffiliateBroker[];
|
|
166
|
+
isVaultSwap?: boolean;
|
|
162
167
|
}
|
|
163
168
|
interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
164
169
|
quote: Quote;
|
|
@@ -191,7 +196,6 @@ interface SwapStatusRequest {
|
|
|
191
196
|
}
|
|
192
197
|
interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
193
198
|
destAddress: string;
|
|
194
|
-
ccmDepositReceivedBlockIndex: string | undefined;
|
|
195
199
|
ccmParams: CcmParams | undefined;
|
|
196
200
|
feesPaid: SwapFee[];
|
|
197
201
|
estimatedDefaultDurationSeconds: number | undefined;
|
|
@@ -354,11 +358,11 @@ type BoostPoolDepth = {
|
|
|
354
358
|
};
|
|
355
359
|
|
|
356
360
|
declare enum FailureMode {
|
|
357
|
-
IngressIgnored = "
|
|
361
|
+
IngressIgnored = "DEPOSIT_IGNORED",
|
|
358
362
|
SwapEgressIgnored = "SWAP_OUTPUT_TOO_SMALL",
|
|
359
363
|
RefundEgressIgnored = "REFUND_OUTPUT_TOO_SMALL",
|
|
360
364
|
BroadcastAborted = "SENDING_FAILED",
|
|
361
|
-
|
|
365
|
+
DepositRejected = "DEPOSIT_REJECTED"
|
|
362
366
|
}
|
|
363
367
|
|
|
364
368
|
interface Failure {
|
|
@@ -378,16 +382,20 @@ interface Boost {
|
|
|
378
382
|
skippedAt: number | undefined;
|
|
379
383
|
skippedBlockIndex: string | undefined;
|
|
380
384
|
}
|
|
385
|
+
interface Broker {
|
|
386
|
+
account: string;
|
|
387
|
+
commissionBps: string;
|
|
388
|
+
}
|
|
381
389
|
interface DepositChannelFields {
|
|
382
390
|
id: string;
|
|
383
391
|
createdAt: number;
|
|
384
|
-
brokerCommissionBps: number;
|
|
385
392
|
depositAddress: string;
|
|
386
393
|
srcChainExpiryBlock: string;
|
|
387
394
|
estimatedExpiryTime: number;
|
|
388
395
|
expectedDepositAmount: string | undefined;
|
|
389
396
|
isExpired: boolean;
|
|
390
397
|
openedThroughBackend: boolean;
|
|
398
|
+
brokerCommissionBps: number;
|
|
391
399
|
affiliateBrokers: AffiliateBroker[];
|
|
392
400
|
fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
|
|
393
401
|
dcaParams: DcaParams | undefined;
|
|
@@ -439,12 +447,20 @@ interface EgressFields {
|
|
|
439
447
|
failure: Failure | undefined;
|
|
440
448
|
failedAt: number | undefined;
|
|
441
449
|
failedBlockIndex: string | undefined;
|
|
450
|
+
transactionPayload: {
|
|
451
|
+
contract: `0x${string}`;
|
|
452
|
+
value: string;
|
|
453
|
+
chainId: string;
|
|
454
|
+
data: `0x${string}`;
|
|
455
|
+
} | undefined;
|
|
442
456
|
}
|
|
443
457
|
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
444
458
|
swapId: string;
|
|
445
459
|
destAddress: string;
|
|
446
460
|
depositChannel: DepositChannelFields | undefined;
|
|
447
461
|
ccmParams: CcmParams | undefined;
|
|
462
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
|
|
463
|
+
dcaParams: DcaParams | undefined;
|
|
448
464
|
boost: Boost | undefined;
|
|
449
465
|
estimatedDurationSeconds: number | null | undefined;
|
|
450
466
|
estimatedDurationsSeconds: {
|
|
@@ -453,6 +469,7 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
|
453
469
|
egress: number;
|
|
454
470
|
};
|
|
455
471
|
srcChainRequiredBlockConfirmations: number | null;
|
|
472
|
+
brokers: Broker[];
|
|
456
473
|
fees: PaidFee[];
|
|
457
474
|
lastStatechainUpdateAt: number | undefined;
|
|
458
475
|
}
|
|
@@ -498,19 +515,63 @@ interface DepositAddressRequestV2 {
|
|
|
498
515
|
ccmParams?: CcmParams;
|
|
499
516
|
brokerCommissionBps?: number;
|
|
500
517
|
}
|
|
518
|
+
interface DepositAddressResponseV2 extends Omit<DepositAddressRequest, 'fillOrKillParams'> {
|
|
519
|
+
fillOrKillParams?: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1;
|
|
520
|
+
depositChannelId: string;
|
|
521
|
+
depositAddress: string;
|
|
522
|
+
brokerCommissionBps: number;
|
|
523
|
+
affiliateBrokers: AffiliateBroker[];
|
|
524
|
+
depositChannelExpiryBlock: bigint;
|
|
525
|
+
estimatedDepositChannelExpiryTime: number | undefined;
|
|
526
|
+
channelOpeningFee: bigint;
|
|
527
|
+
}
|
|
528
|
+
interface VaultSwapRequest {
|
|
529
|
+
quote: Quote | BoostQuote;
|
|
530
|
+
srcAddress?: string;
|
|
531
|
+
destAddress: string;
|
|
532
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1;
|
|
533
|
+
affiliateBrokers?: {
|
|
534
|
+
account: `cF${string}` | `0x${string}`;
|
|
535
|
+
commissionBps: number;
|
|
536
|
+
}[];
|
|
537
|
+
ccmParams?: CcmParams;
|
|
538
|
+
brokerAccount?: `cF${string}`;
|
|
539
|
+
brokerCommissionBps?: number;
|
|
540
|
+
extraParams?: {
|
|
541
|
+
solanaDataAccount?: string;
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
type VaultSwapResponse = {
|
|
545
|
+
chain: 'Bitcoin';
|
|
546
|
+
nulldataPayload: string;
|
|
547
|
+
depositAddress: string;
|
|
548
|
+
} | {
|
|
549
|
+
chain: 'Ethereum' | 'Arbitrum';
|
|
550
|
+
calldata: string;
|
|
551
|
+
value: bigint;
|
|
552
|
+
to: string;
|
|
553
|
+
sourceTokenAddress?: string | undefined;
|
|
554
|
+
} | {
|
|
555
|
+
chain: 'Solana';
|
|
556
|
+
programId: string;
|
|
557
|
+
accounts: {
|
|
558
|
+
pubkey: string;
|
|
559
|
+
isSigner: boolean;
|
|
560
|
+
isWritable: boolean;
|
|
561
|
+
}[];
|
|
562
|
+
data: string;
|
|
563
|
+
};
|
|
501
564
|
|
|
502
565
|
type RequestOptions = {
|
|
503
566
|
signal?: AbortSignal;
|
|
504
567
|
};
|
|
505
568
|
|
|
506
|
-
type TransactionHash = `0x${string}`;
|
|
507
569
|
type SwapSDKOptions = {
|
|
508
570
|
network?: ChainflipNetwork;
|
|
509
571
|
backendUrl?: string;
|
|
510
|
-
signer?: Signer;
|
|
511
572
|
broker?: {
|
|
512
573
|
url: string;
|
|
513
|
-
commissionBps
|
|
574
|
+
commissionBps?: number;
|
|
514
575
|
};
|
|
515
576
|
rpcUrl?: string;
|
|
516
577
|
enabledFeatures?: {
|
|
@@ -535,19 +596,7 @@ declare class SwapSDK {
|
|
|
535
596
|
requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
536
597
|
getStatus(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponse>;
|
|
537
598
|
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponseV2>;
|
|
538
|
-
executeSwap(params: ExecuteSwapParams, txOpts?: TransactionOptions & {
|
|
539
|
-
signer?: Signer;
|
|
540
|
-
}): Promise<TransactionHash>;
|
|
541
|
-
approveVault(params: Pick<ExecuteSwapParams, 'srcChain' | 'srcAsset' | 'amount'>, txOpts?: TransactionOptions & {
|
|
542
|
-
signer?: Signer;
|
|
543
|
-
}): Promise<TransactionHash | null>;
|
|
544
599
|
private validateSwapAmount;
|
|
545
|
-
approveAndExecuteSwap(params: ExecuteSwapParams, txOpts?: Omit<TransactionOptions, 'nonce'> & {
|
|
546
|
-
signer?: Signer;
|
|
547
|
-
}): Promise<{
|
|
548
|
-
approveTxRef: TransactionHash | null;
|
|
549
|
-
swapTxRef: TransactionHash | null;
|
|
550
|
-
}>;
|
|
551
600
|
getSwapLimits(): Promise<{
|
|
552
601
|
minimumSwapAmounts: ChainAssetMap<bigint>;
|
|
553
602
|
maximumSwapAmounts: ChainAssetMap<bigint | null>;
|
|
@@ -561,36 +610,8 @@ declare class SwapSDK {
|
|
|
561
610
|
asset: Asset;
|
|
562
611
|
chain: Chain;
|
|
563
612
|
}): Promise<BoostPoolDepth[]>;
|
|
564
|
-
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<
|
|
565
|
-
|
|
566
|
-
depositAddress: string;
|
|
567
|
-
brokerCommissionBps: number;
|
|
568
|
-
affiliateBrokers: {
|
|
569
|
-
account: `cF${string}` | `0x${string}`;
|
|
570
|
-
commissionBps: number;
|
|
571
|
-
}[];
|
|
572
|
-
maxBoostFeeBps: number;
|
|
573
|
-
depositChannelExpiryBlock: bigint;
|
|
574
|
-
estimatedDepositChannelExpiryTime: number | undefined;
|
|
575
|
-
channelOpeningFee: bigint;
|
|
576
|
-
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1 | undefined;
|
|
577
|
-
srcAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
578
|
-
srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
579
|
-
destAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
580
|
-
destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
581
|
-
srcAddress: string | undefined;
|
|
582
|
-
destAddress: string;
|
|
583
|
-
dcaParams: {
|
|
584
|
-
numberOfChunks: number;
|
|
585
|
-
chunkIntervalBlocks: number;
|
|
586
|
-
} | undefined;
|
|
587
|
-
ccmParams: {
|
|
588
|
-
message: string;
|
|
589
|
-
gasBudget: string;
|
|
590
|
-
cfParameters?: string | undefined;
|
|
591
|
-
} | undefined;
|
|
592
|
-
amount: string;
|
|
593
|
-
}>;
|
|
613
|
+
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<DepositAddressResponseV2>;
|
|
614
|
+
encodeVaultSwapData({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerAccount, brokerCommissionBps, extraParams, }: VaultSwapRequest): Promise<VaultSwapResponse>;
|
|
594
615
|
}
|
|
595
616
|
|
|
596
|
-
export { Asset, type AssetData, type BoostPoolDepth, type BoostQuote, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequest, type DepositAddressRequestV2, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponse, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse };
|
|
617
|
+
export { Asset, type AssetData, type BoostPoolDepth, type BoostQuote, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequest, type DepositAddressRequestV2, type DepositAddressResponse, type DepositAddressResponseV2, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponse, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapRequest, type VaultSwapResponse, type VaultSwapStatusResponse };
|
package/dist/swap.d.ts
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork,
|
|
2
|
-
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './
|
|
1
|
+
import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, d as ChainAssetMap, e as ChainMap } from './enums-_AFEOA70.js';
|
|
2
|
+
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './enums-_AFEOA70.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { Signer } from 'ethers';
|
|
5
4
|
|
|
6
|
-
declare const ccmParamsSchema: z.ZodObject<{
|
|
5
|
+
declare const ccmParamsSchema: z.ZodEffects<z.ZodObject<{
|
|
7
6
|
gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
|
|
8
7
|
message: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
8
|
+
additionalData: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>>;
|
|
9
9
|
cfParameters: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
message: `0x${string}`;
|
|
12
12
|
gasBudget: `0x${string}`;
|
|
13
|
+
additionalData?: `0x${string}` | undefined;
|
|
13
14
|
cfParameters?: `0x${string}` | undefined;
|
|
14
15
|
}, {
|
|
15
16
|
message: string;
|
|
16
17
|
gasBudget: string;
|
|
18
|
+
additionalData?: string | undefined;
|
|
19
|
+
cfParameters?: string | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
gasBudget: `0x${string}`;
|
|
22
|
+
message: `0x${string}`;
|
|
23
|
+
additionalData: `0x${string}` | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
message: string;
|
|
26
|
+
gasBudget: string;
|
|
27
|
+
additionalData?: string | undefined;
|
|
17
28
|
cfParameters?: string | undefined;
|
|
18
29
|
}>;
|
|
19
|
-
type CcmParams = z.input<typeof ccmParamsSchema
|
|
30
|
+
type CcmParams = Omit<z.input<typeof ccmParamsSchema>, 'cfParameters'> & {
|
|
31
|
+
cfParameters?: string;
|
|
32
|
+
};
|
|
20
33
|
declare const affiliateBroker: z.ZodEffects<z.ZodObject<{
|
|
21
34
|
account: z.ZodEffects<z.ZodString, string, string>;
|
|
22
35
|
commissionBps: z.ZodNumber;
|
|
@@ -83,6 +96,7 @@ type BoostedQuoteDetails = {
|
|
|
83
96
|
interface BaseQuoteDetails {
|
|
84
97
|
srcAsset: AssetAndChain;
|
|
85
98
|
destAsset: AssetAndChain;
|
|
99
|
+
isVaultSwap: boolean;
|
|
86
100
|
depositAmount: string;
|
|
87
101
|
intermediateAmount?: string;
|
|
88
102
|
egressAmount: string;
|
|
@@ -116,16 +130,6 @@ type FillOrKillParamsWithSlippage$1 = Omit<FillOrKillParamsX128, 'minPriceX128'>
|
|
|
116
130
|
slippageTolerancePercent: string | number;
|
|
117
131
|
};
|
|
118
132
|
|
|
119
|
-
interface ExecuteSwapParams {
|
|
120
|
-
srcChain: Chain;
|
|
121
|
-
srcAsset: Asset;
|
|
122
|
-
destChain: Chain;
|
|
123
|
-
destAsset: Asset;
|
|
124
|
-
amount: string;
|
|
125
|
-
destAddress: string;
|
|
126
|
-
ccmParams?: CcmParams;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
133
|
interface ChainData {
|
|
130
134
|
chain: Chain;
|
|
131
135
|
name: string;
|
|
@@ -159,6 +163,7 @@ interface QuoteRequest extends ChainsAndAssets {
|
|
|
159
163
|
amount: string;
|
|
160
164
|
brokerCommissionBps?: number;
|
|
161
165
|
affiliateBrokers?: AffiliateBroker[];
|
|
166
|
+
isVaultSwap?: boolean;
|
|
162
167
|
}
|
|
163
168
|
interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
164
169
|
quote: Quote;
|
|
@@ -191,7 +196,6 @@ interface SwapStatusRequest {
|
|
|
191
196
|
}
|
|
192
197
|
interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
193
198
|
destAddress: string;
|
|
194
|
-
ccmDepositReceivedBlockIndex: string | undefined;
|
|
195
199
|
ccmParams: CcmParams | undefined;
|
|
196
200
|
feesPaid: SwapFee[];
|
|
197
201
|
estimatedDefaultDurationSeconds: number | undefined;
|
|
@@ -354,11 +358,11 @@ type BoostPoolDepth = {
|
|
|
354
358
|
};
|
|
355
359
|
|
|
356
360
|
declare enum FailureMode {
|
|
357
|
-
IngressIgnored = "
|
|
361
|
+
IngressIgnored = "DEPOSIT_IGNORED",
|
|
358
362
|
SwapEgressIgnored = "SWAP_OUTPUT_TOO_SMALL",
|
|
359
363
|
RefundEgressIgnored = "REFUND_OUTPUT_TOO_SMALL",
|
|
360
364
|
BroadcastAborted = "SENDING_FAILED",
|
|
361
|
-
|
|
365
|
+
DepositRejected = "DEPOSIT_REJECTED"
|
|
362
366
|
}
|
|
363
367
|
|
|
364
368
|
interface Failure {
|
|
@@ -378,16 +382,20 @@ interface Boost {
|
|
|
378
382
|
skippedAt: number | undefined;
|
|
379
383
|
skippedBlockIndex: string | undefined;
|
|
380
384
|
}
|
|
385
|
+
interface Broker {
|
|
386
|
+
account: string;
|
|
387
|
+
commissionBps: string;
|
|
388
|
+
}
|
|
381
389
|
interface DepositChannelFields {
|
|
382
390
|
id: string;
|
|
383
391
|
createdAt: number;
|
|
384
|
-
brokerCommissionBps: number;
|
|
385
392
|
depositAddress: string;
|
|
386
393
|
srcChainExpiryBlock: string;
|
|
387
394
|
estimatedExpiryTime: number;
|
|
388
395
|
expectedDepositAmount: string | undefined;
|
|
389
396
|
isExpired: boolean;
|
|
390
397
|
openedThroughBackend: boolean;
|
|
398
|
+
brokerCommissionBps: number;
|
|
391
399
|
affiliateBrokers: AffiliateBroker[];
|
|
392
400
|
fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
|
|
393
401
|
dcaParams: DcaParams | undefined;
|
|
@@ -439,12 +447,20 @@ interface EgressFields {
|
|
|
439
447
|
failure: Failure | undefined;
|
|
440
448
|
failedAt: number | undefined;
|
|
441
449
|
failedBlockIndex: string | undefined;
|
|
450
|
+
transactionPayload: {
|
|
451
|
+
contract: `0x${string}`;
|
|
452
|
+
value: string;
|
|
453
|
+
chainId: string;
|
|
454
|
+
data: `0x${string}`;
|
|
455
|
+
} | undefined;
|
|
442
456
|
}
|
|
443
457
|
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
444
458
|
swapId: string;
|
|
445
459
|
destAddress: string;
|
|
446
460
|
depositChannel: DepositChannelFields | undefined;
|
|
447
461
|
ccmParams: CcmParams | undefined;
|
|
462
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
|
|
463
|
+
dcaParams: DcaParams | undefined;
|
|
448
464
|
boost: Boost | undefined;
|
|
449
465
|
estimatedDurationSeconds: number | null | undefined;
|
|
450
466
|
estimatedDurationsSeconds: {
|
|
@@ -453,6 +469,7 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
|
453
469
|
egress: number;
|
|
454
470
|
};
|
|
455
471
|
srcChainRequiredBlockConfirmations: number | null;
|
|
472
|
+
brokers: Broker[];
|
|
456
473
|
fees: PaidFee[];
|
|
457
474
|
lastStatechainUpdateAt: number | undefined;
|
|
458
475
|
}
|
|
@@ -498,19 +515,63 @@ interface DepositAddressRequestV2 {
|
|
|
498
515
|
ccmParams?: CcmParams;
|
|
499
516
|
brokerCommissionBps?: number;
|
|
500
517
|
}
|
|
518
|
+
interface DepositAddressResponseV2 extends Omit<DepositAddressRequest, 'fillOrKillParams'> {
|
|
519
|
+
fillOrKillParams?: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1;
|
|
520
|
+
depositChannelId: string;
|
|
521
|
+
depositAddress: string;
|
|
522
|
+
brokerCommissionBps: number;
|
|
523
|
+
affiliateBrokers: AffiliateBroker[];
|
|
524
|
+
depositChannelExpiryBlock: bigint;
|
|
525
|
+
estimatedDepositChannelExpiryTime: number | undefined;
|
|
526
|
+
channelOpeningFee: bigint;
|
|
527
|
+
}
|
|
528
|
+
interface VaultSwapRequest {
|
|
529
|
+
quote: Quote | BoostQuote;
|
|
530
|
+
srcAddress?: string;
|
|
531
|
+
destAddress: string;
|
|
532
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1;
|
|
533
|
+
affiliateBrokers?: {
|
|
534
|
+
account: `cF${string}` | `0x${string}`;
|
|
535
|
+
commissionBps: number;
|
|
536
|
+
}[];
|
|
537
|
+
ccmParams?: CcmParams;
|
|
538
|
+
brokerAccount?: `cF${string}`;
|
|
539
|
+
brokerCommissionBps?: number;
|
|
540
|
+
extraParams?: {
|
|
541
|
+
solanaDataAccount?: string;
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
type VaultSwapResponse = {
|
|
545
|
+
chain: 'Bitcoin';
|
|
546
|
+
nulldataPayload: string;
|
|
547
|
+
depositAddress: string;
|
|
548
|
+
} | {
|
|
549
|
+
chain: 'Ethereum' | 'Arbitrum';
|
|
550
|
+
calldata: string;
|
|
551
|
+
value: bigint;
|
|
552
|
+
to: string;
|
|
553
|
+
sourceTokenAddress?: string | undefined;
|
|
554
|
+
} | {
|
|
555
|
+
chain: 'Solana';
|
|
556
|
+
programId: string;
|
|
557
|
+
accounts: {
|
|
558
|
+
pubkey: string;
|
|
559
|
+
isSigner: boolean;
|
|
560
|
+
isWritable: boolean;
|
|
561
|
+
}[];
|
|
562
|
+
data: string;
|
|
563
|
+
};
|
|
501
564
|
|
|
502
565
|
type RequestOptions = {
|
|
503
566
|
signal?: AbortSignal;
|
|
504
567
|
};
|
|
505
568
|
|
|
506
|
-
type TransactionHash = `0x${string}`;
|
|
507
569
|
type SwapSDKOptions = {
|
|
508
570
|
network?: ChainflipNetwork;
|
|
509
571
|
backendUrl?: string;
|
|
510
|
-
signer?: Signer;
|
|
511
572
|
broker?: {
|
|
512
573
|
url: string;
|
|
513
|
-
commissionBps
|
|
574
|
+
commissionBps?: number;
|
|
514
575
|
};
|
|
515
576
|
rpcUrl?: string;
|
|
516
577
|
enabledFeatures?: {
|
|
@@ -535,19 +596,7 @@ declare class SwapSDK {
|
|
|
535
596
|
requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
536
597
|
getStatus(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponse>;
|
|
537
598
|
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponseV2>;
|
|
538
|
-
executeSwap(params: ExecuteSwapParams, txOpts?: TransactionOptions & {
|
|
539
|
-
signer?: Signer;
|
|
540
|
-
}): Promise<TransactionHash>;
|
|
541
|
-
approveVault(params: Pick<ExecuteSwapParams, 'srcChain' | 'srcAsset' | 'amount'>, txOpts?: TransactionOptions & {
|
|
542
|
-
signer?: Signer;
|
|
543
|
-
}): Promise<TransactionHash | null>;
|
|
544
599
|
private validateSwapAmount;
|
|
545
|
-
approveAndExecuteSwap(params: ExecuteSwapParams, txOpts?: Omit<TransactionOptions, 'nonce'> & {
|
|
546
|
-
signer?: Signer;
|
|
547
|
-
}): Promise<{
|
|
548
|
-
approveTxRef: TransactionHash | null;
|
|
549
|
-
swapTxRef: TransactionHash | null;
|
|
550
|
-
}>;
|
|
551
600
|
getSwapLimits(): Promise<{
|
|
552
601
|
minimumSwapAmounts: ChainAssetMap<bigint>;
|
|
553
602
|
maximumSwapAmounts: ChainAssetMap<bigint | null>;
|
|
@@ -561,36 +610,8 @@ declare class SwapSDK {
|
|
|
561
610
|
asset: Asset;
|
|
562
611
|
chain: Chain;
|
|
563
612
|
}): Promise<BoostPoolDepth[]>;
|
|
564
|
-
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<
|
|
565
|
-
|
|
566
|
-
depositAddress: string;
|
|
567
|
-
brokerCommissionBps: number;
|
|
568
|
-
affiliateBrokers: {
|
|
569
|
-
account: `cF${string}` | `0x${string}`;
|
|
570
|
-
commissionBps: number;
|
|
571
|
-
}[];
|
|
572
|
-
maxBoostFeeBps: number;
|
|
573
|
-
depositChannelExpiryBlock: bigint;
|
|
574
|
-
estimatedDepositChannelExpiryTime: number | undefined;
|
|
575
|
-
channelOpeningFee: bigint;
|
|
576
|
-
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1 | undefined;
|
|
577
|
-
srcAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
578
|
-
srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
579
|
-
destAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
580
|
-
destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
581
|
-
srcAddress: string | undefined;
|
|
582
|
-
destAddress: string;
|
|
583
|
-
dcaParams: {
|
|
584
|
-
numberOfChunks: number;
|
|
585
|
-
chunkIntervalBlocks: number;
|
|
586
|
-
} | undefined;
|
|
587
|
-
ccmParams: {
|
|
588
|
-
message: string;
|
|
589
|
-
gasBudget: string;
|
|
590
|
-
cfParameters?: string | undefined;
|
|
591
|
-
} | undefined;
|
|
592
|
-
amount: string;
|
|
593
|
-
}>;
|
|
613
|
+
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<DepositAddressResponseV2>;
|
|
614
|
+
encodeVaultSwapData({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerAccount, brokerCommissionBps, extraParams, }: VaultSwapRequest): Promise<VaultSwapResponse>;
|
|
594
615
|
}
|
|
595
616
|
|
|
596
|
-
export { Asset, type AssetData, type BoostPoolDepth, type BoostQuote, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequest, type DepositAddressRequestV2, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponse, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse };
|
|
617
|
+
export { Asset, type AssetData, type BoostPoolDepth, type BoostQuote, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequest, type DepositAddressRequestV2, type DepositAddressResponse, type DepositAddressResponseV2, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponse, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapRequest, type VaultSwapResponse, type VaultSwapStatusResponse };
|