@chainflip/sdk 1.6.6 → 1.6.7-rc.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.
@@ -1,9 +1,37 @@
1
1
  import { constants, HttpClient } from '@chainflip/rpc';
2
2
  import { Interface, Contract } from 'ethers';
3
3
 
4
+ var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
10
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
11
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
12
+ var __commonJS = (cb, mod) => function __require() {
13
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
+ };
15
+ var __export = (target, all) => {
16
+ for (var name in all)
17
+ __defProp(target, name, { get: all[name], enumerable: true });
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key of __getOwnPropNames(from))
22
+ if (!__hasOwnProp.call(to, key) && key !== except)
23
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ // If the importer is in node compatibility mode or this is not an ESM
29
+ // file that has been converted to a CommonJS file using a Babel-
30
+ // compatible transform (i.e. "__esModule" has not been set), then set
31
+ // "default" to the CommonJS "module.exports" for node compatibility.
32
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
33
+ mod
34
+ ));
7
35
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
36
 
9
37
  // ../shared/src/enums.ts
@@ -126,7 +154,7 @@ var chainConstants = {
126
154
  Assets.USDC,
127
155
  Assets.USDT
128
156
  ],
129
- gasAsset: Assets.ETH,
157
+ gasAsset: InternalAssets.Eth,
130
158
  contractId: 1,
131
159
  blockTimeSeconds: 12
132
160
  },
@@ -134,7 +162,7 @@ var chainConstants = {
134
162
  assets: [
135
163
  Assets.DOT
136
164
  ],
137
- gasAsset: Assets.DOT,
165
+ gasAsset: InternalAssets.Dot,
138
166
  contractId: 2,
139
167
  blockTimeSeconds: 6
140
168
  },
@@ -142,7 +170,7 @@ var chainConstants = {
142
170
  assets: [
143
171
  Assets.BTC
144
172
  ],
145
- gasAsset: Assets.BTC,
173
+ gasAsset: InternalAssets.Btc,
146
174
  contractId: 3,
147
175
  blockTimeSeconds: 10 * 60
148
176
  },
@@ -151,7 +179,7 @@ var chainConstants = {
151
179
  Assets.ETH,
152
180
  Assets.USDC
153
181
  ],
154
- gasAsset: Assets.ETH,
182
+ gasAsset: InternalAssets.ArbEth,
155
183
  contractId: 4,
156
184
  blockTimeSeconds: 0.26
157
185
  },
@@ -160,7 +188,7 @@ var chainConstants = {
160
188
  Assets.SOL,
161
189
  Assets.USDC
162
190
  ],
163
- gasAsset: Assets.SOL,
191
+ gasAsset: InternalAssets.Sol,
164
192
  contractId: 5,
165
193
  blockTimeSeconds: (400 + 800) / 2 / 1e3
166
194
  }
@@ -241,9 +269,9 @@ __name(getAssetAndChain, "getAssetAndChain");
241
269
  // ../shared/src/guards.ts
242
270
  var isString = /* @__PURE__ */ __name((value) => typeof value === "string", "isString");
243
271
  var isNotNullish = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isNotNullish");
244
- function assert(condition, message) {
272
+ function assert(condition, message, Constructor = Error) {
245
273
  if (condition) return;
246
- const error = new Error(message);
274
+ const error = new Constructor(message);
247
275
  if (error.stack) {
248
276
  error.stack = error.stack.replace(/\n.+/, "\n");
249
277
  }
@@ -2378,4 +2406,4 @@ var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
2378
2406
  return flip.balanceOf(await signer.getAddress());
2379
2407
  }, "getFlipBalance");
2380
2408
 
2381
- export { Assets, ChainflipNetworks, Chains, InternalAssets, StateChainGateway__factory, Vault__factory, __name, __publicField, approve, assert, assetConstants, chainConstants, checkAllowance, extractOverrides, getAllBoostPoolsDepth, getAssetAndChain, getEnvironment, getEvmChainId, getFlipBalance, getFundingEnvironment, getInternalAsset, getInternalAssets, getStateChainGatewayContractAddress, getSupportedAssets, getTokenContractAddress, getVaultContractAddress, isNotNullish, isString, isTestnet, isValidAssetAndChain, readChainAssetValue };
2409
+ export { Assets, ChainflipNetworks, Chains, InternalAssets, StateChainGateway__factory, Vault__factory, __commonJS, __export, __name, __publicField, __toESM, approve, assert, assetConstants, chainConstants, checkAllowance, extractOverrides, getAllBoostPoolsDepth, getAssetAndChain, getEnvironment, getEvmChainId, getFlipBalance, getFundingEnvironment, getInternalAsset, getInternalAssets, getStateChainGatewayContractAddress, getSupportedAssets, getTokenContractAddress, getVaultContractAddress, isNotNullish, isString, isTestnet, isValidAssetAndChain, readChainAssetValue };
@@ -12,31 +12,31 @@ type ChainflipNetwork = (typeof ChainflipNetworks)[keyof typeof ChainflipNetwork
12
12
  declare const chainConstants: {
13
13
  readonly Ethereum: {
14
14
  readonly assets: ["ETH", "FLIP", "USDC", "USDT"];
15
- readonly gasAsset: "ETH";
15
+ readonly gasAsset: "Eth";
16
16
  readonly contractId: 1;
17
17
  readonly blockTimeSeconds: 12;
18
18
  };
19
19
  readonly Polkadot: {
20
20
  readonly assets: ["DOT"];
21
- readonly gasAsset: "DOT";
21
+ readonly gasAsset: "Dot";
22
22
  readonly contractId: 2;
23
23
  readonly blockTimeSeconds: 6;
24
24
  };
25
25
  readonly Bitcoin: {
26
26
  readonly assets: ["BTC"];
27
- readonly gasAsset: "BTC";
27
+ readonly gasAsset: "Btc";
28
28
  readonly contractId: 3;
29
29
  readonly blockTimeSeconds: number;
30
30
  };
31
31
  readonly Arbitrum: {
32
32
  readonly assets: ["ETH", "USDC"];
33
- readonly gasAsset: "ETH";
33
+ readonly gasAsset: "ArbEth";
34
34
  readonly contractId: 4;
35
35
  readonly blockTimeSeconds: 0.26;
36
36
  };
37
37
  readonly Solana: {
38
38
  readonly assets: ["SOL", "USDC"];
39
- readonly gasAsset: "SOL";
39
+ readonly gasAsset: "Sol";
40
40
  readonly contractId: 5;
41
41
  readonly blockTimeSeconds: number;
42
42
  };
@@ -12,31 +12,31 @@ type ChainflipNetwork = (typeof ChainflipNetworks)[keyof typeof ChainflipNetwork
12
12
  declare const chainConstants: {
13
13
  readonly Ethereum: {
14
14
  readonly assets: ["ETH", "FLIP", "USDC", "USDT"];
15
- readonly gasAsset: "ETH";
15
+ readonly gasAsset: "Eth";
16
16
  readonly contractId: 1;
17
17
  readonly blockTimeSeconds: 12;
18
18
  };
19
19
  readonly Polkadot: {
20
20
  readonly assets: ["DOT"];
21
- readonly gasAsset: "DOT";
21
+ readonly gasAsset: "Dot";
22
22
  readonly contractId: 2;
23
23
  readonly blockTimeSeconds: 6;
24
24
  };
25
25
  readonly Bitcoin: {
26
26
  readonly assets: ["BTC"];
27
- readonly gasAsset: "BTC";
27
+ readonly gasAsset: "Btc";
28
28
  readonly contractId: 3;
29
29
  readonly blockTimeSeconds: number;
30
30
  };
31
31
  readonly Arbitrum: {
32
32
  readonly assets: ["ETH", "USDC"];
33
- readonly gasAsset: "ETH";
33
+ readonly gasAsset: "ArbEth";
34
34
  readonly contractId: 4;
35
35
  readonly blockTimeSeconds: 0.26;
36
36
  };
37
37
  readonly Solana: {
38
38
  readonly assets: ["SOL", "USDC"];
39
- readonly gasAsset: "SOL";
39
+ readonly gasAsset: "Sol";
40
40
  readonly contractId: 5;
41
41
  readonly blockTimeSeconds: number;
42
42
  };
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { c as ChainflipNetwork, T as TransactionOptions } from './contracts-DmShvHR7.mjs';
2
+ import { c as ChainflipNetwork, T as TransactionOptions } from './contracts-Bgib7w_h.mjs';
3
3
 
4
4
  type PendingRedemption = {
5
5
  amount: bigint;
package/dist/funding.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { c as ChainflipNetwork, T as TransactionOptions } from './contracts-DmShvHR7.js';
2
+ import { c as ChainflipNetwork, T as TransactionOptions } from './contracts-Bgib7w_h.js';
3
3
 
4
4
  type PendingRedemption = {
5
5
  amount: bigint;
package/dist/funding.js CHANGED
@@ -878,7 +878,7 @@ var chainConstants = {
878
878
  Assets.USDC,
879
879
  Assets.USDT
880
880
  ],
881
- gasAsset: Assets.ETH,
881
+ gasAsset: InternalAssets.Eth,
882
882
  contractId: 1,
883
883
  blockTimeSeconds: 12
884
884
  },
@@ -886,7 +886,7 @@ var chainConstants = {
886
886
  assets: [
887
887
  Assets.DOT
888
888
  ],
889
- gasAsset: Assets.DOT,
889
+ gasAsset: InternalAssets.Dot,
890
890
  contractId: 2,
891
891
  blockTimeSeconds: 6
892
892
  },
@@ -894,7 +894,7 @@ var chainConstants = {
894
894
  assets: [
895
895
  Assets.BTC
896
896
  ],
897
- gasAsset: Assets.BTC,
897
+ gasAsset: InternalAssets.Btc,
898
898
  contractId: 3,
899
899
  blockTimeSeconds: 10 * 60
900
900
  },
@@ -903,7 +903,7 @@ var chainConstants = {
903
903
  Assets.ETH,
904
904
  Assets.USDC
905
905
  ],
906
- gasAsset: Assets.ETH,
906
+ gasAsset: InternalAssets.ArbEth,
907
907
  contractId: 4,
908
908
  blockTimeSeconds: 0.26
909
909
  },
@@ -912,7 +912,7 @@ var chainConstants = {
912
912
  Assets.SOL,
913
913
  Assets.USDC
914
914
  ],
915
- gasAsset: Assets.SOL,
915
+ gasAsset: InternalAssets.Sol,
916
916
  contractId: 5,
917
917
  blockTimeSeconds: (400 + 800) / 2 / 1e3
918
918
  }
@@ -1102,9 +1102,9 @@ var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
1102
1102
  }, "getStateChainGateway");
1103
1103
 
1104
1104
  // ../shared/src/guards.ts
1105
- function assert(condition, message) {
1105
+ function assert(condition, message, Constructor = Error) {
1106
1106
  if (condition) return;
1107
- const error = new Error(message);
1107
+ const error = new Constructor(message);
1108
1108
  if (error.stack) {
1109
1109
  error.stack = error.stack.replace(/\n.+/, "\n");
1110
1110
  }
package/dist/funding.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { __name, __publicField, ChainflipNetworks, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, InternalAssets, checkAllowance, assert, extractOverrides, StateChainGateway__factory } from './chunk-35BXEUA4.mjs';
1
+ import { __name, __publicField, ChainflipNetworks, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, InternalAssets, checkAllowance, assert, extractOverrides, StateChainGateway__factory } from './chunk-G76RI3QK.mjs';
2
2
 
3
3
  // ../shared/src/stateChainGateway/utils.ts
4
4
  var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
package/dist/swap.d.mts CHANGED
@@ -1,7 +1,8 @@
1
- import { Signer } from 'ethers';
2
- import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap } from './contracts-DmShvHR7.mjs';
3
- export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-DmShvHR7.mjs';
1
+ 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-Bgib7w_h.mjs';
2
+ export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-Bgib7w_h.mjs';
4
3
  import { z } from 'zod';
4
+ import { SwappingRequestSwapDepositAddressWithAffiliates } from '@chainflip/extrinsics/160/swapping/requestSwapDepositAddressWithAffiliates';
5
+ import { Signer } from 'ethers';
5
6
 
6
7
  declare const ccmParamsSchema: z.ZodObject<{
7
8
  gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
@@ -59,7 +60,7 @@ declare const fillOrKillParams: z.ZodObject<{
59
60
  minPriceX128: string;
60
61
  }>;
61
62
  type FillOrKillParamsX128 = z.input<typeof fillOrKillParams>;
62
- type FillOrKillParams = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
63
+ type FillOrKillParamsWithMinPrice = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
63
64
  minPrice: string;
64
65
  };
65
66
  type Fee<T> = {
@@ -71,31 +72,43 @@ type Fee<T> = {
71
72
  type SwapFee = Fee<'NETWORK' | 'INGRESS' | 'EGRESS' | 'BROKER' | 'BOOST'>;
72
73
  type PoolFee = Fee<'LIQUIDITY'>;
73
74
  type PaidFee = SwapFee | PoolFee;
74
- type QuoteType = 'REGULAR' | 'DCA';
75
75
  type PoolInfo = {
76
76
  baseAsset: AssetAndChain;
77
77
  quoteAsset: AssetAndChain;
78
78
  fee: Omit<PoolFee, 'type'>;
79
79
  };
80
- type QuoteDetails = {
80
+ type BoostedQuoteDetails = {
81
+ estimatedBoostFeeBps: number;
82
+ maxBoostFeeBps: number;
83
+ };
84
+ interface BaseQuoteDetails {
85
+ srcAsset: AssetAndChain;
86
+ destAsset: AssetAndChain;
81
87
  intermediateAmount?: string;
88
+ depositAmount: string;
82
89
  egressAmount: string;
83
90
  includedFees: SwapFee[];
84
91
  poolInfo: PoolInfo[];
85
92
  lowLiquidityWarning: boolean | undefined;
86
93
  estimatedDurationSeconds: number;
87
94
  estimatedPrice: string;
88
- dcaParams?: {
89
- numberOfChunks: number;
90
- chunkIntervalBlocks: number;
91
- };
92
- type: QuoteType;
93
- };
94
- type BoostedQuoteDetails = QuoteDetails & {
95
- estimatedBoostFeeBps: number;
96
- };
97
- type QuoteQueryResponse = QuoteDetails & {
98
- boostQuote?: BoostedQuoteDetails;
95
+ }
96
+ type WithBoostQuote<T> = Omit<T, 'boostQuote'> & BoostedQuoteDetails;
97
+ interface RegularQuote extends BaseQuoteDetails {
98
+ type: 'REGULAR';
99
+ boostQuote?: WithBoostQuote<RegularQuote>;
100
+ }
101
+ interface DCAQuote extends BaseQuoteDetails {
102
+ type: 'DCA';
103
+ dcaParams: DcaParams;
104
+ boostQuote?: WithBoostQuote<DCAQuote>;
105
+ }
106
+ type Quote = RegularQuote | DCAQuote;
107
+ type DCABoostQuote = NonNullable<DCAQuote['boostQuote']>;
108
+ type RegularBoostQuote = NonNullable<RegularQuote['boostQuote']>;
109
+ type BoostQuote = RegularBoostQuote | DCABoostQuote;
110
+ type FillOrKillParamsWithSlippage$1 = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
111
+ slippageTolerancePercent: string | number;
99
112
  };
100
113
 
101
114
  interface ExecuteSwapParams {
@@ -144,17 +157,20 @@ interface QuoteRequest extends ChainsAndAssets {
144
157
  affiliateBrokers?: AffiliateBroker[];
145
158
  }
146
159
  interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
147
- quote: QuoteQueryResponse;
160
+ quote: Quote;
148
161
  }
149
162
  interface QuoteResponseV2 extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
150
- quotes: QuoteQueryResponse[];
163
+ quotes: Quote[];
151
164
  }
165
+ type FillOrKillParamsWithSlippage = Omit<FillOrKillParamsWithMinPrice, 'minPrice'> & {
166
+ slippageTolerancePercent: string | number;
167
+ };
152
168
  interface DepositAddressRequest extends QuoteRequest {
153
169
  destAddress: string;
154
170
  ccmParams?: CcmParams;
155
171
  maxBoostFeeBps?: number;
156
172
  srcAddress?: string;
157
- fillOrKillParams?: FillOrKillParams;
173
+ fillOrKillParams?: FillOrKillParamsWithMinPrice;
158
174
  dcaParams?: DcaParams;
159
175
  ccmMetadata?: CcmParams;
160
176
  }
@@ -201,7 +217,7 @@ interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
201
217
  effectiveBoostFeeBps?: number;
202
218
  boostSkippedAt?: number;
203
219
  boostSkippedBlockIndex?: string;
204
- fillOrKillParams: FillOrKillParams;
220
+ fillOrKillParams: FillOrKillParamsWithMinPrice;
205
221
  }
206
222
  type EgressScheduled = {
207
223
  swapId: string;
@@ -371,7 +387,7 @@ interface DepositChannelFields {
371
387
  isExpired: boolean;
372
388
  openedThroughBackend: boolean;
373
389
  affiliateBrokers: AffiliateBroker[];
374
- fillOrKillParams: FillOrKillParams | undefined;
390
+ fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
375
391
  dcaParams: DcaParams | undefined;
376
392
  }
377
393
  interface DepositFields {
@@ -463,6 +479,18 @@ type SwapStatusResponseV2 = ({
463
479
  state: 'FAILED';
464
480
  } & Sending);
465
481
 
482
+ interface DepositAddressRequestV2 {
483
+ quote: Quote | BoostQuote;
484
+ destAddress: string;
485
+ fillOrKillParams?: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1;
486
+ affiliateBrokers?: {
487
+ account: `cF${string}` | `0x${string}`;
488
+ commissionBps: number;
489
+ }[];
490
+ ccmParams?: CcmParams;
491
+ brokerCommissionBps?: number;
492
+ }
493
+
466
494
  type RequestOptions = {
467
495
  signal?: AbortSignal;
468
496
  };
@@ -519,6 +547,36 @@ declare class SwapSDK {
519
547
  asset: Asset;
520
548
  chain: Chain;
521
549
  }): Promise<BoostPoolDepth[]>;
550
+ requestDepositAddressV2({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<{
551
+ depositChannelId: string;
552
+ depositAddress: string;
553
+ brokerCommissionBps: number;
554
+ affiliateBrokers: {
555
+ account: `cF${string}` | `0x${string}`;
556
+ commissionBps: number;
557
+ }[];
558
+ maxBoostFeeBps: number;
559
+ depositChannelExpiryBlock: bigint;
560
+ estimatedDepositChannelExpiryTime: number | undefined;
561
+ channelOpeningFee: bigint;
562
+ fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1 | undefined;
563
+ srcAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
564
+ srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
565
+ destAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
566
+ destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
567
+ destAddress: string;
568
+ dcaParams: {
569
+ numberOfChunks: number;
570
+ chunkIntervalBlocks: number;
571
+ } | undefined;
572
+ ccmParams: {
573
+ message: string;
574
+ gasBudget: string;
575
+ cfParameters?: string | undefined;
576
+ } | undefined;
577
+ amount: string;
578
+ }>;
579
+ buildRequestSwapDepositAddressWithAffiliatesParams({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): SwappingRequestSwapDepositAddressWithAffiliates;
522
580
  }
523
581
 
524
- 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 };
582
+ 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 };
package/dist/swap.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { Signer } from 'ethers';
2
- import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap } from './contracts-DmShvHR7.js';
3
- export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-DmShvHR7.js';
1
+ 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-Bgib7w_h.js';
2
+ export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-Bgib7w_h.js';
4
3
  import { z } from 'zod';
4
+ import { SwappingRequestSwapDepositAddressWithAffiliates } from '@chainflip/extrinsics/160/swapping/requestSwapDepositAddressWithAffiliates';
5
+ import { Signer } from 'ethers';
5
6
 
6
7
  declare const ccmParamsSchema: z.ZodObject<{
7
8
  gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
@@ -59,7 +60,7 @@ declare const fillOrKillParams: z.ZodObject<{
59
60
  minPriceX128: string;
60
61
  }>;
61
62
  type FillOrKillParamsX128 = z.input<typeof fillOrKillParams>;
62
- type FillOrKillParams = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
63
+ type FillOrKillParamsWithMinPrice = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
63
64
  minPrice: string;
64
65
  };
65
66
  type Fee<T> = {
@@ -71,31 +72,43 @@ type Fee<T> = {
71
72
  type SwapFee = Fee<'NETWORK' | 'INGRESS' | 'EGRESS' | 'BROKER' | 'BOOST'>;
72
73
  type PoolFee = Fee<'LIQUIDITY'>;
73
74
  type PaidFee = SwapFee | PoolFee;
74
- type QuoteType = 'REGULAR' | 'DCA';
75
75
  type PoolInfo = {
76
76
  baseAsset: AssetAndChain;
77
77
  quoteAsset: AssetAndChain;
78
78
  fee: Omit<PoolFee, 'type'>;
79
79
  };
80
- type QuoteDetails = {
80
+ type BoostedQuoteDetails = {
81
+ estimatedBoostFeeBps: number;
82
+ maxBoostFeeBps: number;
83
+ };
84
+ interface BaseQuoteDetails {
85
+ srcAsset: AssetAndChain;
86
+ destAsset: AssetAndChain;
81
87
  intermediateAmount?: string;
88
+ depositAmount: string;
82
89
  egressAmount: string;
83
90
  includedFees: SwapFee[];
84
91
  poolInfo: PoolInfo[];
85
92
  lowLiquidityWarning: boolean | undefined;
86
93
  estimatedDurationSeconds: number;
87
94
  estimatedPrice: string;
88
- dcaParams?: {
89
- numberOfChunks: number;
90
- chunkIntervalBlocks: number;
91
- };
92
- type: QuoteType;
93
- };
94
- type BoostedQuoteDetails = QuoteDetails & {
95
- estimatedBoostFeeBps: number;
96
- };
97
- type QuoteQueryResponse = QuoteDetails & {
98
- boostQuote?: BoostedQuoteDetails;
95
+ }
96
+ type WithBoostQuote<T> = Omit<T, 'boostQuote'> & BoostedQuoteDetails;
97
+ interface RegularQuote extends BaseQuoteDetails {
98
+ type: 'REGULAR';
99
+ boostQuote?: WithBoostQuote<RegularQuote>;
100
+ }
101
+ interface DCAQuote extends BaseQuoteDetails {
102
+ type: 'DCA';
103
+ dcaParams: DcaParams;
104
+ boostQuote?: WithBoostQuote<DCAQuote>;
105
+ }
106
+ type Quote = RegularQuote | DCAQuote;
107
+ type DCABoostQuote = NonNullable<DCAQuote['boostQuote']>;
108
+ type RegularBoostQuote = NonNullable<RegularQuote['boostQuote']>;
109
+ type BoostQuote = RegularBoostQuote | DCABoostQuote;
110
+ type FillOrKillParamsWithSlippage$1 = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
111
+ slippageTolerancePercent: string | number;
99
112
  };
100
113
 
101
114
  interface ExecuteSwapParams {
@@ -144,17 +157,20 @@ interface QuoteRequest extends ChainsAndAssets {
144
157
  affiliateBrokers?: AffiliateBroker[];
145
158
  }
146
159
  interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
147
- quote: QuoteQueryResponse;
160
+ quote: Quote;
148
161
  }
149
162
  interface QuoteResponseV2 extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
150
- quotes: QuoteQueryResponse[];
163
+ quotes: Quote[];
151
164
  }
165
+ type FillOrKillParamsWithSlippage = Omit<FillOrKillParamsWithMinPrice, 'minPrice'> & {
166
+ slippageTolerancePercent: string | number;
167
+ };
152
168
  interface DepositAddressRequest extends QuoteRequest {
153
169
  destAddress: string;
154
170
  ccmParams?: CcmParams;
155
171
  maxBoostFeeBps?: number;
156
172
  srcAddress?: string;
157
- fillOrKillParams?: FillOrKillParams;
173
+ fillOrKillParams?: FillOrKillParamsWithMinPrice;
158
174
  dcaParams?: DcaParams;
159
175
  ccmMetadata?: CcmParams;
160
176
  }
@@ -201,7 +217,7 @@ interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
201
217
  effectiveBoostFeeBps?: number;
202
218
  boostSkippedAt?: number;
203
219
  boostSkippedBlockIndex?: string;
204
- fillOrKillParams: FillOrKillParams;
220
+ fillOrKillParams: FillOrKillParamsWithMinPrice;
205
221
  }
206
222
  type EgressScheduled = {
207
223
  swapId: string;
@@ -371,7 +387,7 @@ interface DepositChannelFields {
371
387
  isExpired: boolean;
372
388
  openedThroughBackend: boolean;
373
389
  affiliateBrokers: AffiliateBroker[];
374
- fillOrKillParams: FillOrKillParams | undefined;
390
+ fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
375
391
  dcaParams: DcaParams | undefined;
376
392
  }
377
393
  interface DepositFields {
@@ -463,6 +479,18 @@ type SwapStatusResponseV2 = ({
463
479
  state: 'FAILED';
464
480
  } & Sending);
465
481
 
482
+ interface DepositAddressRequestV2 {
483
+ quote: Quote | BoostQuote;
484
+ destAddress: string;
485
+ fillOrKillParams?: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1;
486
+ affiliateBrokers?: {
487
+ account: `cF${string}` | `0x${string}`;
488
+ commissionBps: number;
489
+ }[];
490
+ ccmParams?: CcmParams;
491
+ brokerCommissionBps?: number;
492
+ }
493
+
466
494
  type RequestOptions = {
467
495
  signal?: AbortSignal;
468
496
  };
@@ -519,6 +547,36 @@ declare class SwapSDK {
519
547
  asset: Asset;
520
548
  chain: Chain;
521
549
  }): Promise<BoostPoolDepth[]>;
550
+ requestDepositAddressV2({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<{
551
+ depositChannelId: string;
552
+ depositAddress: string;
553
+ brokerCommissionBps: number;
554
+ affiliateBrokers: {
555
+ account: `cF${string}` | `0x${string}`;
556
+ commissionBps: number;
557
+ }[];
558
+ maxBoostFeeBps: number;
559
+ depositChannelExpiryBlock: bigint;
560
+ estimatedDepositChannelExpiryTime: number | undefined;
561
+ channelOpeningFee: bigint;
562
+ fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1 | undefined;
563
+ srcAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
564
+ srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
565
+ destAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
566
+ destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
567
+ destAddress: string;
568
+ dcaParams: {
569
+ numberOfChunks: number;
570
+ chunkIntervalBlocks: number;
571
+ } | undefined;
572
+ ccmParams: {
573
+ message: string;
574
+ gasBudget: string;
575
+ cfParameters?: string | undefined;
576
+ } | undefined;
577
+ amount: string;
578
+ }>;
579
+ buildRequestSwapDepositAddressWithAffiliatesParams({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): SwappingRequestSwapDepositAddressWithAffiliates;
522
580
  }
523
581
 
524
- 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 };
582
+ 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 };