@chainflip/sdk 1.8.0-assethub.2 → 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-BmyTFuGH.d.mts → enums-_AFEOA70.d.mts} +3 -18
- package/dist/{contracts-BmyTFuGH.d.ts → enums-_AFEOA70.d.ts} +3 -18
- package/dist/funding.d.mts +10 -1
- package/dist/funding.d.ts +10 -1
- package/dist/funding.js +94 -374
- package/dist/funding.mjs +832 -43
- package/dist/swap.d.mts +86 -73
- package/dist/swap.d.ts +86 -73
- package/dist/swap.js +914 -14135
- package/dist/swap.mjs +500 -12237
- package/package.json +17 -12
- package/dist/chunk-5BNVUJZY.mjs +0 -2453
package/dist/swap.d.mts
CHANGED
|
@@ -1,23 +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 { SwappingRequestSwapDepositAddressWithAffiliates } from '@chainflip/extrinsics/160/swapping/requestSwapDepositAddressWithAffiliates';
|
|
5
|
-
import { Signer } from 'ethers';
|
|
6
4
|
|
|
7
|
-
declare const ccmParamsSchema: z.ZodObject<{
|
|
5
|
+
declare const ccmParamsSchema: z.ZodEffects<z.ZodObject<{
|
|
8
6
|
gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
|
|
9
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>>;
|
|
10
9
|
cfParameters: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>>;
|
|
11
10
|
}, "strip", z.ZodTypeAny, {
|
|
12
11
|
message: `0x${string}`;
|
|
13
12
|
gasBudget: `0x${string}`;
|
|
13
|
+
additionalData?: `0x${string}` | undefined;
|
|
14
14
|
cfParameters?: `0x${string}` | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
message: string;
|
|
17
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;
|
|
18
28
|
cfParameters?: string | undefined;
|
|
19
29
|
}>;
|
|
20
|
-
type CcmParams = z.input<typeof ccmParamsSchema
|
|
30
|
+
type CcmParams = Omit<z.input<typeof ccmParamsSchema>, 'cfParameters'> & {
|
|
31
|
+
cfParameters?: string;
|
|
32
|
+
};
|
|
21
33
|
declare const affiliateBroker: z.ZodEffects<z.ZodObject<{
|
|
22
34
|
account: z.ZodEffects<z.ZodString, string, string>;
|
|
23
35
|
commissionBps: z.ZodNumber;
|
|
@@ -84,6 +96,7 @@ type BoostedQuoteDetails = {
|
|
|
84
96
|
interface BaseQuoteDetails {
|
|
85
97
|
srcAsset: AssetAndChain;
|
|
86
98
|
destAsset: AssetAndChain;
|
|
99
|
+
isVaultSwap: boolean;
|
|
87
100
|
depositAmount: string;
|
|
88
101
|
intermediateAmount?: string;
|
|
89
102
|
egressAmount: string;
|
|
@@ -117,17 +130,6 @@ type FillOrKillParamsWithSlippage$1 = Omit<FillOrKillParamsX128, 'minPriceX128'>
|
|
|
117
130
|
slippageTolerancePercent: string | number;
|
|
118
131
|
};
|
|
119
132
|
|
|
120
|
-
interface ExecuteSwapParams {
|
|
121
|
-
srcChain: Chain;
|
|
122
|
-
srcAsset: Asset;
|
|
123
|
-
destChain: Chain;
|
|
124
|
-
destAsset: Asset;
|
|
125
|
-
amount: string;
|
|
126
|
-
destAddress: string;
|
|
127
|
-
ccmParams?: CcmParams;
|
|
128
|
-
ccmMetadata?: CcmParams;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
133
|
interface ChainData {
|
|
132
134
|
chain: Chain;
|
|
133
135
|
name: string;
|
|
@@ -161,6 +163,7 @@ interface QuoteRequest extends ChainsAndAssets {
|
|
|
161
163
|
amount: string;
|
|
162
164
|
brokerCommissionBps?: number;
|
|
163
165
|
affiliateBrokers?: AffiliateBroker[];
|
|
166
|
+
isVaultSwap?: boolean;
|
|
164
167
|
}
|
|
165
168
|
interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
166
169
|
quote: Quote;
|
|
@@ -178,7 +181,6 @@ interface DepositAddressRequest extends QuoteRequest {
|
|
|
178
181
|
srcAddress?: string;
|
|
179
182
|
fillOrKillParams?: FillOrKillParamsWithMinPrice;
|
|
180
183
|
dcaParams?: DcaParams;
|
|
181
|
-
ccmMetadata?: CcmParams;
|
|
182
184
|
}
|
|
183
185
|
interface DepositAddressResponse extends DepositAddressRequest {
|
|
184
186
|
depositChannelId: string;
|
|
@@ -194,7 +196,6 @@ interface SwapStatusRequest {
|
|
|
194
196
|
}
|
|
195
197
|
interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
196
198
|
destAddress: string;
|
|
197
|
-
ccmDepositReceivedBlockIndex: string | undefined;
|
|
198
199
|
ccmParams: CcmParams | undefined;
|
|
199
200
|
feesPaid: SwapFee[];
|
|
200
201
|
estimatedDefaultDurationSeconds: number | undefined;
|
|
@@ -203,8 +204,6 @@ interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
|
203
204
|
swapScheduledAt: number | undefined;
|
|
204
205
|
swapScheduledBlockIndex: string | undefined;
|
|
205
206
|
lastStatechainUpdateAt: number | undefined;
|
|
206
|
-
depositTransactionHash: string | undefined;
|
|
207
|
-
ccmMetadata?: CcmParams;
|
|
208
207
|
}
|
|
209
208
|
interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
|
|
210
209
|
depositAddress: string;
|
|
@@ -359,11 +358,11 @@ type BoostPoolDepth = {
|
|
|
359
358
|
};
|
|
360
359
|
|
|
361
360
|
declare enum FailureMode {
|
|
362
|
-
IngressIgnored = "
|
|
361
|
+
IngressIgnored = "DEPOSIT_IGNORED",
|
|
363
362
|
SwapEgressIgnored = "SWAP_OUTPUT_TOO_SMALL",
|
|
364
363
|
RefundEgressIgnored = "REFUND_OUTPUT_TOO_SMALL",
|
|
365
364
|
BroadcastAborted = "SENDING_FAILED",
|
|
366
|
-
|
|
365
|
+
DepositRejected = "DEPOSIT_REJECTED"
|
|
367
366
|
}
|
|
368
367
|
|
|
369
368
|
interface Failure {
|
|
@@ -383,16 +382,20 @@ interface Boost {
|
|
|
383
382
|
skippedAt: number | undefined;
|
|
384
383
|
skippedBlockIndex: string | undefined;
|
|
385
384
|
}
|
|
385
|
+
interface Broker {
|
|
386
|
+
account: string;
|
|
387
|
+
commissionBps: string;
|
|
388
|
+
}
|
|
386
389
|
interface DepositChannelFields {
|
|
387
390
|
id: string;
|
|
388
391
|
createdAt: number;
|
|
389
|
-
brokerCommissionBps: number;
|
|
390
392
|
depositAddress: string;
|
|
391
393
|
srcChainExpiryBlock: string;
|
|
392
394
|
estimatedExpiryTime: number;
|
|
393
395
|
expectedDepositAmount: string | undefined;
|
|
394
396
|
isExpired: boolean;
|
|
395
397
|
openedThroughBackend: boolean;
|
|
398
|
+
brokerCommissionBps: number;
|
|
396
399
|
affiliateBrokers: AffiliateBroker[];
|
|
397
400
|
fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
|
|
398
401
|
dcaParams: DcaParams | undefined;
|
|
@@ -444,12 +447,20 @@ interface EgressFields {
|
|
|
444
447
|
failure: Failure | undefined;
|
|
445
448
|
failedAt: number | undefined;
|
|
446
449
|
failedBlockIndex: string | undefined;
|
|
450
|
+
transactionPayload: {
|
|
451
|
+
contract: `0x${string}`;
|
|
452
|
+
value: string;
|
|
453
|
+
chainId: string;
|
|
454
|
+
data: `0x${string}`;
|
|
455
|
+
} | undefined;
|
|
447
456
|
}
|
|
448
457
|
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
449
458
|
swapId: string;
|
|
450
459
|
destAddress: string;
|
|
451
460
|
depositChannel: DepositChannelFields | undefined;
|
|
452
461
|
ccmParams: CcmParams | undefined;
|
|
462
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
|
|
463
|
+
dcaParams: DcaParams | undefined;
|
|
453
464
|
boost: Boost | undefined;
|
|
454
465
|
estimatedDurationSeconds: number | null | undefined;
|
|
455
466
|
estimatedDurationsSeconds: {
|
|
@@ -458,6 +469,7 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
|
458
469
|
egress: number;
|
|
459
470
|
};
|
|
460
471
|
srcChainRequiredBlockConfirmations: number | null;
|
|
472
|
+
brokers: Broker[];
|
|
461
473
|
fees: PaidFee[];
|
|
462
474
|
lastStatechainUpdateAt: number | undefined;
|
|
463
475
|
}
|
|
@@ -503,24 +515,67 @@ interface DepositAddressRequestV2 {
|
|
|
503
515
|
ccmParams?: CcmParams;
|
|
504
516
|
brokerCommissionBps?: number;
|
|
505
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
|
+
};
|
|
506
564
|
|
|
507
565
|
type RequestOptions = {
|
|
508
566
|
signal?: AbortSignal;
|
|
509
567
|
};
|
|
510
568
|
|
|
511
|
-
type TransactionHash = `0x${string}`;
|
|
512
569
|
type SwapSDKOptions = {
|
|
513
570
|
network?: ChainflipNetwork;
|
|
514
571
|
backendUrl?: string;
|
|
515
|
-
signer?: Signer;
|
|
516
572
|
broker?: {
|
|
517
573
|
url: string;
|
|
518
|
-
commissionBps
|
|
574
|
+
commissionBps?: number;
|
|
519
575
|
};
|
|
520
576
|
rpcUrl?: string;
|
|
521
577
|
enabledFeatures?: {
|
|
522
578
|
dca?: boolean;
|
|
523
|
-
experimentalRecommendedSlippage?: boolean;
|
|
524
579
|
};
|
|
525
580
|
};
|
|
526
581
|
declare class SwapSDK {
|
|
@@ -530,7 +585,6 @@ declare class SwapSDK {
|
|
|
530
585
|
private stateChainEnvironmentCache;
|
|
531
586
|
private supportedAssets?;
|
|
532
587
|
private dcaEnabled;
|
|
533
|
-
private autoSlippageEnabled;
|
|
534
588
|
constructor(options?: SwapSDKOptions);
|
|
535
589
|
getChains(sourceChain?: Chain): Promise<ChainData[]>;
|
|
536
590
|
private getStateChainEnvironment;
|
|
@@ -542,19 +596,7 @@ declare class SwapSDK {
|
|
|
542
596
|
requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
543
597
|
getStatus(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponse>;
|
|
544
598
|
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponseV2>;
|
|
545
|
-
executeSwap(params: ExecuteSwapParams, txOpts?: TransactionOptions & {
|
|
546
|
-
signer?: Signer;
|
|
547
|
-
}): Promise<TransactionHash>;
|
|
548
|
-
approveVault(params: Pick<ExecuteSwapParams, 'srcChain' | 'srcAsset' | 'amount'>, txOpts?: TransactionOptions & {
|
|
549
|
-
signer?: Signer;
|
|
550
|
-
}): Promise<TransactionHash | null>;
|
|
551
599
|
private validateSwapAmount;
|
|
552
|
-
approveAndExecuteSwap(params: ExecuteSwapParams, txOpts?: Omit<TransactionOptions, 'nonce'> & {
|
|
553
|
-
signer?: Signer;
|
|
554
|
-
}): Promise<{
|
|
555
|
-
approveTxRef: TransactionHash | null;
|
|
556
|
-
swapTxRef: TransactionHash | null;
|
|
557
|
-
}>;
|
|
558
600
|
getSwapLimits(): Promise<{
|
|
559
601
|
minimumSwapAmounts: ChainAssetMap<bigint>;
|
|
560
602
|
maximumSwapAmounts: ChainAssetMap<bigint | null>;
|
|
@@ -568,37 +610,8 @@ declare class SwapSDK {
|
|
|
568
610
|
asset: Asset;
|
|
569
611
|
chain: Chain;
|
|
570
612
|
}): Promise<BoostPoolDepth[]>;
|
|
571
|
-
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<
|
|
572
|
-
|
|
573
|
-
depositAddress: string;
|
|
574
|
-
brokerCommissionBps: number;
|
|
575
|
-
affiliateBrokers: {
|
|
576
|
-
account: `cF${string}` | `0x${string}`;
|
|
577
|
-
commissionBps: number;
|
|
578
|
-
}[];
|
|
579
|
-
maxBoostFeeBps: number;
|
|
580
|
-
depositChannelExpiryBlock: bigint;
|
|
581
|
-
estimatedDepositChannelExpiryTime: number | undefined;
|
|
582
|
-
channelOpeningFee: bigint;
|
|
583
|
-
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1 | undefined;
|
|
584
|
-
srcAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
585
|
-
srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana" | "Assethub";
|
|
586
|
-
destAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
587
|
-
destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana" | "Assethub";
|
|
588
|
-
srcAddress: string | undefined;
|
|
589
|
-
destAddress: string;
|
|
590
|
-
dcaParams: {
|
|
591
|
-
numberOfChunks: number;
|
|
592
|
-
chunkIntervalBlocks: number;
|
|
593
|
-
} | undefined;
|
|
594
|
-
ccmParams: {
|
|
595
|
-
message: string;
|
|
596
|
-
gasBudget: string;
|
|
597
|
-
cfParameters?: string | undefined;
|
|
598
|
-
} | undefined;
|
|
599
|
-
amount: string;
|
|
600
|
-
}>;
|
|
601
|
-
buildRequestSwapDepositAddressWithAffiliatesParams({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): SwappingRequestSwapDepositAddressWithAffiliates;
|
|
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>;
|
|
602
615
|
}
|
|
603
616
|
|
|
604
|
-
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,23 +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 { SwappingRequestSwapDepositAddressWithAffiliates } from '@chainflip/extrinsics/160/swapping/requestSwapDepositAddressWithAffiliates';
|
|
5
|
-
import { Signer } from 'ethers';
|
|
6
4
|
|
|
7
|
-
declare const ccmParamsSchema: z.ZodObject<{
|
|
5
|
+
declare const ccmParamsSchema: z.ZodEffects<z.ZodObject<{
|
|
8
6
|
gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
|
|
9
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>>;
|
|
10
9
|
cfParameters: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>>;
|
|
11
10
|
}, "strip", z.ZodTypeAny, {
|
|
12
11
|
message: `0x${string}`;
|
|
13
12
|
gasBudget: `0x${string}`;
|
|
13
|
+
additionalData?: `0x${string}` | undefined;
|
|
14
14
|
cfParameters?: `0x${string}` | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
message: string;
|
|
17
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;
|
|
18
28
|
cfParameters?: string | undefined;
|
|
19
29
|
}>;
|
|
20
|
-
type CcmParams = z.input<typeof ccmParamsSchema
|
|
30
|
+
type CcmParams = Omit<z.input<typeof ccmParamsSchema>, 'cfParameters'> & {
|
|
31
|
+
cfParameters?: string;
|
|
32
|
+
};
|
|
21
33
|
declare const affiliateBroker: z.ZodEffects<z.ZodObject<{
|
|
22
34
|
account: z.ZodEffects<z.ZodString, string, string>;
|
|
23
35
|
commissionBps: z.ZodNumber;
|
|
@@ -84,6 +96,7 @@ type BoostedQuoteDetails = {
|
|
|
84
96
|
interface BaseQuoteDetails {
|
|
85
97
|
srcAsset: AssetAndChain;
|
|
86
98
|
destAsset: AssetAndChain;
|
|
99
|
+
isVaultSwap: boolean;
|
|
87
100
|
depositAmount: string;
|
|
88
101
|
intermediateAmount?: string;
|
|
89
102
|
egressAmount: string;
|
|
@@ -117,17 +130,6 @@ type FillOrKillParamsWithSlippage$1 = Omit<FillOrKillParamsX128, 'minPriceX128'>
|
|
|
117
130
|
slippageTolerancePercent: string | number;
|
|
118
131
|
};
|
|
119
132
|
|
|
120
|
-
interface ExecuteSwapParams {
|
|
121
|
-
srcChain: Chain;
|
|
122
|
-
srcAsset: Asset;
|
|
123
|
-
destChain: Chain;
|
|
124
|
-
destAsset: Asset;
|
|
125
|
-
amount: string;
|
|
126
|
-
destAddress: string;
|
|
127
|
-
ccmParams?: CcmParams;
|
|
128
|
-
ccmMetadata?: CcmParams;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
133
|
interface ChainData {
|
|
132
134
|
chain: Chain;
|
|
133
135
|
name: string;
|
|
@@ -161,6 +163,7 @@ interface QuoteRequest extends ChainsAndAssets {
|
|
|
161
163
|
amount: string;
|
|
162
164
|
brokerCommissionBps?: number;
|
|
163
165
|
affiliateBrokers?: AffiliateBroker[];
|
|
166
|
+
isVaultSwap?: boolean;
|
|
164
167
|
}
|
|
165
168
|
interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
166
169
|
quote: Quote;
|
|
@@ -178,7 +181,6 @@ interface DepositAddressRequest extends QuoteRequest {
|
|
|
178
181
|
srcAddress?: string;
|
|
179
182
|
fillOrKillParams?: FillOrKillParamsWithMinPrice;
|
|
180
183
|
dcaParams?: DcaParams;
|
|
181
|
-
ccmMetadata?: CcmParams;
|
|
182
184
|
}
|
|
183
185
|
interface DepositAddressResponse extends DepositAddressRequest {
|
|
184
186
|
depositChannelId: string;
|
|
@@ -194,7 +196,6 @@ interface SwapStatusRequest {
|
|
|
194
196
|
}
|
|
195
197
|
interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
196
198
|
destAddress: string;
|
|
197
|
-
ccmDepositReceivedBlockIndex: string | undefined;
|
|
198
199
|
ccmParams: CcmParams | undefined;
|
|
199
200
|
feesPaid: SwapFee[];
|
|
200
201
|
estimatedDefaultDurationSeconds: number | undefined;
|
|
@@ -203,8 +204,6 @@ interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
|
203
204
|
swapScheduledAt: number | undefined;
|
|
204
205
|
swapScheduledBlockIndex: string | undefined;
|
|
205
206
|
lastStatechainUpdateAt: number | undefined;
|
|
206
|
-
depositTransactionHash: string | undefined;
|
|
207
|
-
ccmMetadata?: CcmParams;
|
|
208
207
|
}
|
|
209
208
|
interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
|
|
210
209
|
depositAddress: string;
|
|
@@ -359,11 +358,11 @@ type BoostPoolDepth = {
|
|
|
359
358
|
};
|
|
360
359
|
|
|
361
360
|
declare enum FailureMode {
|
|
362
|
-
IngressIgnored = "
|
|
361
|
+
IngressIgnored = "DEPOSIT_IGNORED",
|
|
363
362
|
SwapEgressIgnored = "SWAP_OUTPUT_TOO_SMALL",
|
|
364
363
|
RefundEgressIgnored = "REFUND_OUTPUT_TOO_SMALL",
|
|
365
364
|
BroadcastAborted = "SENDING_FAILED",
|
|
366
|
-
|
|
365
|
+
DepositRejected = "DEPOSIT_REJECTED"
|
|
367
366
|
}
|
|
368
367
|
|
|
369
368
|
interface Failure {
|
|
@@ -383,16 +382,20 @@ interface Boost {
|
|
|
383
382
|
skippedAt: number | undefined;
|
|
384
383
|
skippedBlockIndex: string | undefined;
|
|
385
384
|
}
|
|
385
|
+
interface Broker {
|
|
386
|
+
account: string;
|
|
387
|
+
commissionBps: string;
|
|
388
|
+
}
|
|
386
389
|
interface DepositChannelFields {
|
|
387
390
|
id: string;
|
|
388
391
|
createdAt: number;
|
|
389
|
-
brokerCommissionBps: number;
|
|
390
392
|
depositAddress: string;
|
|
391
393
|
srcChainExpiryBlock: string;
|
|
392
394
|
estimatedExpiryTime: number;
|
|
393
395
|
expectedDepositAmount: string | undefined;
|
|
394
396
|
isExpired: boolean;
|
|
395
397
|
openedThroughBackend: boolean;
|
|
398
|
+
brokerCommissionBps: number;
|
|
396
399
|
affiliateBrokers: AffiliateBroker[];
|
|
397
400
|
fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
|
|
398
401
|
dcaParams: DcaParams | undefined;
|
|
@@ -444,12 +447,20 @@ interface EgressFields {
|
|
|
444
447
|
failure: Failure | undefined;
|
|
445
448
|
failedAt: number | undefined;
|
|
446
449
|
failedBlockIndex: string | undefined;
|
|
450
|
+
transactionPayload: {
|
|
451
|
+
contract: `0x${string}`;
|
|
452
|
+
value: string;
|
|
453
|
+
chainId: string;
|
|
454
|
+
data: `0x${string}`;
|
|
455
|
+
} | undefined;
|
|
447
456
|
}
|
|
448
457
|
interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
449
458
|
swapId: string;
|
|
450
459
|
destAddress: string;
|
|
451
460
|
depositChannel: DepositChannelFields | undefined;
|
|
452
461
|
ccmParams: CcmParams | undefined;
|
|
462
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
|
|
463
|
+
dcaParams: DcaParams | undefined;
|
|
453
464
|
boost: Boost | undefined;
|
|
454
465
|
estimatedDurationSeconds: number | null | undefined;
|
|
455
466
|
estimatedDurationsSeconds: {
|
|
@@ -458,6 +469,7 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
|
458
469
|
egress: number;
|
|
459
470
|
};
|
|
460
471
|
srcChainRequiredBlockConfirmations: number | null;
|
|
472
|
+
brokers: Broker[];
|
|
461
473
|
fees: PaidFee[];
|
|
462
474
|
lastStatechainUpdateAt: number | undefined;
|
|
463
475
|
}
|
|
@@ -503,24 +515,67 @@ interface DepositAddressRequestV2 {
|
|
|
503
515
|
ccmParams?: CcmParams;
|
|
504
516
|
brokerCommissionBps?: number;
|
|
505
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
|
+
};
|
|
506
564
|
|
|
507
565
|
type RequestOptions = {
|
|
508
566
|
signal?: AbortSignal;
|
|
509
567
|
};
|
|
510
568
|
|
|
511
|
-
type TransactionHash = `0x${string}`;
|
|
512
569
|
type SwapSDKOptions = {
|
|
513
570
|
network?: ChainflipNetwork;
|
|
514
571
|
backendUrl?: string;
|
|
515
|
-
signer?: Signer;
|
|
516
572
|
broker?: {
|
|
517
573
|
url: string;
|
|
518
|
-
commissionBps
|
|
574
|
+
commissionBps?: number;
|
|
519
575
|
};
|
|
520
576
|
rpcUrl?: string;
|
|
521
577
|
enabledFeatures?: {
|
|
522
578
|
dca?: boolean;
|
|
523
|
-
experimentalRecommendedSlippage?: boolean;
|
|
524
579
|
};
|
|
525
580
|
};
|
|
526
581
|
declare class SwapSDK {
|
|
@@ -530,7 +585,6 @@ declare class SwapSDK {
|
|
|
530
585
|
private stateChainEnvironmentCache;
|
|
531
586
|
private supportedAssets?;
|
|
532
587
|
private dcaEnabled;
|
|
533
|
-
private autoSlippageEnabled;
|
|
534
588
|
constructor(options?: SwapSDKOptions);
|
|
535
589
|
getChains(sourceChain?: Chain): Promise<ChainData[]>;
|
|
536
590
|
private getStateChainEnvironment;
|
|
@@ -542,19 +596,7 @@ declare class SwapSDK {
|
|
|
542
596
|
requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
543
597
|
getStatus(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponse>;
|
|
544
598
|
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponseV2>;
|
|
545
|
-
executeSwap(params: ExecuteSwapParams, txOpts?: TransactionOptions & {
|
|
546
|
-
signer?: Signer;
|
|
547
|
-
}): Promise<TransactionHash>;
|
|
548
|
-
approveVault(params: Pick<ExecuteSwapParams, 'srcChain' | 'srcAsset' | 'amount'>, txOpts?: TransactionOptions & {
|
|
549
|
-
signer?: Signer;
|
|
550
|
-
}): Promise<TransactionHash | null>;
|
|
551
599
|
private validateSwapAmount;
|
|
552
|
-
approveAndExecuteSwap(params: ExecuteSwapParams, txOpts?: Omit<TransactionOptions, 'nonce'> & {
|
|
553
|
-
signer?: Signer;
|
|
554
|
-
}): Promise<{
|
|
555
|
-
approveTxRef: TransactionHash | null;
|
|
556
|
-
swapTxRef: TransactionHash | null;
|
|
557
|
-
}>;
|
|
558
600
|
getSwapLimits(): Promise<{
|
|
559
601
|
minimumSwapAmounts: ChainAssetMap<bigint>;
|
|
560
602
|
maximumSwapAmounts: ChainAssetMap<bigint | null>;
|
|
@@ -568,37 +610,8 @@ declare class SwapSDK {
|
|
|
568
610
|
asset: Asset;
|
|
569
611
|
chain: Chain;
|
|
570
612
|
}): Promise<BoostPoolDepth[]>;
|
|
571
|
-
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<
|
|
572
|
-
|
|
573
|
-
depositAddress: string;
|
|
574
|
-
brokerCommissionBps: number;
|
|
575
|
-
affiliateBrokers: {
|
|
576
|
-
account: `cF${string}` | `0x${string}`;
|
|
577
|
-
commissionBps: number;
|
|
578
|
-
}[];
|
|
579
|
-
maxBoostFeeBps: number;
|
|
580
|
-
depositChannelExpiryBlock: bigint;
|
|
581
|
-
estimatedDepositChannelExpiryTime: number | undefined;
|
|
582
|
-
channelOpeningFee: bigint;
|
|
583
|
-
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1 | undefined;
|
|
584
|
-
srcAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
585
|
-
srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana" | "Assethub";
|
|
586
|
-
destAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
587
|
-
destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana" | "Assethub";
|
|
588
|
-
srcAddress: string | undefined;
|
|
589
|
-
destAddress: string;
|
|
590
|
-
dcaParams: {
|
|
591
|
-
numberOfChunks: number;
|
|
592
|
-
chunkIntervalBlocks: number;
|
|
593
|
-
} | undefined;
|
|
594
|
-
ccmParams: {
|
|
595
|
-
message: string;
|
|
596
|
-
gasBudget: string;
|
|
597
|
-
cfParameters?: string | undefined;
|
|
598
|
-
} | undefined;
|
|
599
|
-
amount: string;
|
|
600
|
-
}>;
|
|
601
|
-
buildRequestSwapDepositAddressWithAffiliatesParams({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): SwappingRequestSwapDepositAddressWithAffiliates;
|
|
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>;
|
|
602
615
|
}
|
|
603
616
|
|
|
604
|
-
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 };
|