@chainflip/sdk 0.2.4 → 0.2.5

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.
@@ -2064,6 +2064,9 @@ __publicField(_Vault__factory, "abi", _abi3);
2064
2064
  var Vault__factory = _Vault__factory;
2065
2065
 
2066
2066
  // ../shared/src/consts.ts
2067
+ ({
2068
+ [ChainflipNetworks.perseverance]: 100
2069
+ });
2067
2070
  var MINIMUM_DEPOSIT_AMOUNTS = {
2068
2071
  [ChainflipNetworks.perseverance]: {
2069
2072
  [Assets.ETH]: "0",
@@ -2079,7 +2082,7 @@ var MINIMUM_SWAP_AMOUNTS = {
2079
2082
  [Assets.ETH]: "580000000000000",
2080
2083
  [Assets.FLIP]: "1000000000000000000",
2081
2084
  [Assets.USDC]: "1000000",
2082
- [Assets.BTC]: "5000",
2085
+ [Assets.BTC]: "1000",
2083
2086
  [Assets.DOT]: "2000000000"
2084
2087
  }
2085
2088
  };
package/dist/funding.js CHANGED
@@ -826,6 +826,9 @@ var ChainflipNetworks = arrayToMap([
826
826
  });
827
827
 
828
828
  // ../shared/src/consts.ts
829
+ ({
830
+ [ChainflipNetworks.perseverance]: 100
831
+ });
829
832
  ({
830
833
  [ChainflipNetworks.perseverance]: {
831
834
  [Assets.ETH]: "0",
@@ -840,7 +843,7 @@ var ChainflipNetworks = arrayToMap([
840
843
  [Assets.ETH]: "580000000000000",
841
844
  [Assets.FLIP]: "1000000000000000000",
842
845
  [Assets.USDC]: "1000000",
843
- [Assets.BTC]: "5000",
846
+ [Assets.BTC]: "1000",
844
847
  [Assets.DOT]: "2000000000"
845
848
  }
846
849
  });
package/dist/funding.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { __name, __publicField, ChainflipNetworks, getFlipBalance, getStateChainGatewayContractAddress, approve, getTokenContractAddress, Assets, checkAllowance, assert, extractOverrides, StateChainGateway__factory } from './chunk-HVSV6XD5.mjs';
1
+ import { __name, __publicField, ChainflipNetworks, getFlipBalance, getStateChainGatewayContractAddress, approve, getTokenContractAddress, Assets, checkAllowance, assert, extractOverrides, StateChainGateway__factory } from './chunk-HR2UQBMZ.mjs';
2
2
 
3
3
  // ../shared/src/stateChainGateway/utils.ts
4
4
  var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
package/dist/swap.d.mts CHANGED
@@ -1,87 +1,87 @@
1
1
  import { Signer } from 'ethers';
2
- import { C as Chain, c as chainAssets, A as Asset, a as ChainflipNetwork, T as TransactionOptions } from './contracts-920ad844.js';
2
+ import { A as Asset, C as Chain, c as chainAssets, a as ChainflipNetwork, T as TransactionOptions } from './contracts-920ad844.js';
3
3
  export { d as Assets, e as ChainflipNetworks, b as Chains, f as assetChains, h as assetContractIds, g as assetDecimals, i as chainContractIds } from './contracts-920ad844.js';
4
4
  import { z } from 'zod';
5
5
 
6
6
  declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
7
- amount: z.ZodBigInt;
7
+ amount: z.ZodString;
8
8
  srcChain: z.ZodLiteral<"Ethereum">;
9
9
  destChain: z.ZodLiteral<"Ethereum">;
10
10
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
11
11
  srcAsset: z.ZodLiteral<"FLIP">;
12
12
  destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
13
13
  }, "strip", z.ZodTypeAny, {
14
- amount: bigint;
14
+ amount: string;
15
15
  srcChain: "Ethereum";
16
16
  srcAsset: "FLIP";
17
17
  destAsset: "USDC" | "ETH";
18
18
  destChain: "Ethereum";
19
19
  destAddress: `0x${string}`;
20
20
  }, {
21
- amount: bigint;
21
+ amount: string;
22
22
  srcChain: "Ethereum";
23
23
  srcAsset: "FLIP";
24
24
  destAsset: "USDC" | "ETH";
25
25
  destChain: "Ethereum";
26
26
  destAddress: `0x${string}`;
27
27
  }>, z.ZodObject<{
28
- amount: z.ZodBigInt;
28
+ amount: z.ZodString;
29
29
  srcChain: z.ZodLiteral<"Ethereum">;
30
30
  destChain: z.ZodLiteral<"Ethereum">;
31
31
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
32
32
  srcAsset: z.ZodLiteral<"USDC">;
33
33
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
34
34
  }, "strip", z.ZodTypeAny, {
35
- amount: bigint;
35
+ amount: string;
36
36
  srcChain: "Ethereum";
37
37
  srcAsset: "USDC";
38
38
  destAsset: "FLIP" | "ETH";
39
39
  destChain: "Ethereum";
40
40
  destAddress: `0x${string}`;
41
41
  }, {
42
- amount: bigint;
42
+ amount: string;
43
43
  srcChain: "Ethereum";
44
44
  srcAsset: "USDC";
45
45
  destAsset: "FLIP" | "ETH";
46
46
  destChain: "Ethereum";
47
47
  destAddress: `0x${string}`;
48
48
  }>, z.ZodObject<{
49
- amount: z.ZodBigInt;
49
+ amount: z.ZodString;
50
50
  srcChain: z.ZodLiteral<"Ethereum">;
51
51
  destAsset: z.ZodLiteral<"DOT">;
52
52
  destChain: z.ZodLiteral<"Polkadot">;
53
53
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
54
54
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
55
55
  }, "strip", z.ZodTypeAny, {
56
- amount: bigint;
56
+ amount: string;
57
57
  srcChain: "Ethereum";
58
58
  srcAsset: "FLIP" | "USDC";
59
59
  destAsset: "DOT";
60
60
  destChain: "Polkadot";
61
61
  destAddress: string;
62
62
  }, {
63
- amount: bigint;
63
+ amount: string;
64
64
  srcChain: "Ethereum";
65
65
  srcAsset: "FLIP" | "USDC";
66
66
  destAsset: "DOT";
67
67
  destChain: "Polkadot";
68
68
  destAddress: string;
69
69
  }>, z.ZodObject<{
70
- amount: z.ZodBigInt;
70
+ amount: z.ZodString;
71
71
  srcChain: z.ZodLiteral<"Ethereum">;
72
72
  destAsset: z.ZodLiteral<"BTC">;
73
73
  destChain: z.ZodLiteral<"Bitcoin">;
74
74
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
75
75
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
76
76
  }, "strip", z.ZodTypeAny, {
77
- amount: bigint;
77
+ amount: string;
78
78
  srcChain: "Ethereum";
79
79
  srcAsset: "FLIP" | "USDC";
80
80
  destAsset: "BTC";
81
81
  destChain: "Bitcoin";
82
82
  destAddress: string;
83
83
  }, {
84
- amount: bigint;
84
+ amount: string;
85
85
  srcChain: "Ethereum";
86
86
  srcAsset: "FLIP" | "USDC";
87
87
  destAsset: "BTC";
@@ -89,7 +89,7 @@ declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
89
89
  destAddress: string;
90
90
  }>]>;
91
91
  declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
92
- amount: z.ZodBigInt;
92
+ amount: z.ZodString;
93
93
  srcChain: z.ZodLiteral<"Ethereum">;
94
94
  srcAsset: z.ZodLiteral<"ETH">;
95
95
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
@@ -106,7 +106,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
106
106
  gasBudget: string;
107
107
  }>;
108
108
  }, "strip", z.ZodTypeAny, {
109
- amount: bigint;
109
+ amount: string;
110
110
  srcChain: "Ethereum";
111
111
  srcAsset: "ETH";
112
112
  destAsset: "FLIP" | "USDC";
@@ -117,7 +117,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
117
117
  gasBudget: string;
118
118
  };
119
119
  }, {
120
- amount: bigint;
120
+ amount: string;
121
121
  srcChain: "Ethereum";
122
122
  srcAsset: "ETH";
123
123
  destAsset: "FLIP" | "USDC";
@@ -128,7 +128,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
128
128
  gasBudget: string;
129
129
  };
130
130
  }>, z.ZodUnion<[z.ZodObject<{
131
- amount: z.ZodBigInt;
131
+ amount: z.ZodString;
132
132
  srcChain: z.ZodLiteral<"Ethereum">;
133
133
  srcAsset: z.ZodLiteral<"FLIP">;
134
134
  destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
@@ -145,7 +145,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
145
145
  gasBudget: string;
146
146
  }>;
147
147
  }, "strip", z.ZodTypeAny, {
148
- amount: bigint;
148
+ amount: string;
149
149
  srcChain: "Ethereum";
150
150
  srcAsset: "FLIP";
151
151
  destAsset: "USDC" | "ETH";
@@ -156,7 +156,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
156
156
  gasBudget: string;
157
157
  };
158
158
  }, {
159
- amount: bigint;
159
+ amount: string;
160
160
  srcChain: "Ethereum";
161
161
  srcAsset: "FLIP";
162
162
  destAsset: "USDC" | "ETH";
@@ -167,7 +167,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
167
167
  gasBudget: string;
168
168
  };
169
169
  }>, z.ZodObject<{
170
- amount: z.ZodBigInt;
170
+ amount: z.ZodString;
171
171
  srcChain: z.ZodLiteral<"Ethereum">;
172
172
  srcAsset: z.ZodLiteral<"USDC">;
173
173
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
@@ -184,7 +184,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
184
184
  gasBudget: string;
185
185
  }>;
186
186
  }, "strip", z.ZodTypeAny, {
187
- amount: bigint;
187
+ amount: string;
188
188
  srcChain: "Ethereum";
189
189
  srcAsset: "USDC";
190
190
  destAsset: "FLIP" | "ETH";
@@ -195,7 +195,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
195
195
  gasBudget: string;
196
196
  };
197
197
  }, {
198
- amount: bigint;
198
+ amount: string;
199
199
  srcChain: "Ethereum";
200
200
  srcAsset: "USDC";
201
201
  destAsset: "FLIP" | "ETH";
@@ -206,147 +206,147 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
206
206
  gasBudget: string;
207
207
  };
208
208
  }>]>, z.ZodUnion<[z.ZodObject<{
209
- amount: z.ZodBigInt;
209
+ amount: z.ZodString;
210
210
  srcChain: z.ZodLiteral<"Ethereum">;
211
211
  srcAsset: z.ZodLiteral<"ETH">;
212
212
  destChain: z.ZodLiteral<"Ethereum">;
213
213
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
214
214
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
215
215
  }, "strip", z.ZodTypeAny, {
216
- amount: bigint;
216
+ amount: string;
217
217
  srcChain: "Ethereum";
218
218
  srcAsset: "ETH";
219
219
  destAsset: "FLIP" | "USDC";
220
220
  destChain: "Ethereum";
221
221
  destAddress: `0x${string}`;
222
222
  }, {
223
- amount: bigint;
223
+ amount: string;
224
224
  srcChain: "Ethereum";
225
225
  srcAsset: "ETH";
226
226
  destAsset: "FLIP" | "USDC";
227
227
  destChain: "Ethereum";
228
228
  destAddress: `0x${string}`;
229
229
  }>, z.ZodObject<{
230
- amount: z.ZodBigInt;
230
+ amount: z.ZodString;
231
231
  srcChain: z.ZodLiteral<"Ethereum">;
232
232
  srcAsset: z.ZodLiteral<"ETH">;
233
233
  destChain: z.ZodLiteral<"Polkadot">;
234
234
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
235
235
  destAsset: z.ZodLiteral<"DOT">;
236
236
  }, "strip", z.ZodTypeAny, {
237
- amount: bigint;
237
+ amount: string;
238
238
  srcChain: "Ethereum";
239
239
  srcAsset: "ETH";
240
240
  destAsset: "DOT";
241
241
  destChain: "Polkadot";
242
242
  destAddress: string;
243
243
  }, {
244
- amount: bigint;
244
+ amount: string;
245
245
  srcChain: "Ethereum";
246
246
  srcAsset: "ETH";
247
247
  destAsset: "DOT";
248
248
  destChain: "Polkadot";
249
249
  destAddress: string;
250
250
  }>, z.ZodObject<{
251
- amount: z.ZodBigInt;
251
+ amount: z.ZodString;
252
252
  srcChain: z.ZodLiteral<"Ethereum">;
253
253
  srcAsset: z.ZodLiteral<"ETH">;
254
254
  destChain: z.ZodLiteral<"Bitcoin">;
255
255
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
256
256
  destAsset: z.ZodLiteral<"BTC">;
257
257
  }, "strip", z.ZodTypeAny, {
258
- amount: bigint;
258
+ amount: string;
259
259
  srcChain: "Ethereum";
260
260
  srcAsset: "ETH";
261
261
  destAsset: "BTC";
262
262
  destChain: "Bitcoin";
263
263
  destAddress: string;
264
264
  }, {
265
- amount: bigint;
265
+ amount: string;
266
266
  srcChain: "Ethereum";
267
267
  srcAsset: "ETH";
268
268
  destAsset: "BTC";
269
269
  destChain: "Bitcoin";
270
270
  destAddress: string;
271
271
  }>]>, z.ZodUnion<[z.ZodObject<{
272
- amount: z.ZodBigInt;
272
+ amount: z.ZodString;
273
273
  srcChain: z.ZodLiteral<"Ethereum">;
274
274
  destChain: z.ZodLiteral<"Ethereum">;
275
275
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
276
276
  srcAsset: z.ZodLiteral<"FLIP">;
277
277
  destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
278
278
  }, "strip", z.ZodTypeAny, {
279
- amount: bigint;
279
+ amount: string;
280
280
  srcChain: "Ethereum";
281
281
  srcAsset: "FLIP";
282
282
  destAsset: "USDC" | "ETH";
283
283
  destChain: "Ethereum";
284
284
  destAddress: `0x${string}`;
285
285
  }, {
286
- amount: bigint;
286
+ amount: string;
287
287
  srcChain: "Ethereum";
288
288
  srcAsset: "FLIP";
289
289
  destAsset: "USDC" | "ETH";
290
290
  destChain: "Ethereum";
291
291
  destAddress: `0x${string}`;
292
292
  }>, z.ZodObject<{
293
- amount: z.ZodBigInt;
293
+ amount: z.ZodString;
294
294
  srcChain: z.ZodLiteral<"Ethereum">;
295
295
  destChain: z.ZodLiteral<"Ethereum">;
296
296
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
297
297
  srcAsset: z.ZodLiteral<"USDC">;
298
298
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
299
299
  }, "strip", z.ZodTypeAny, {
300
- amount: bigint;
300
+ amount: string;
301
301
  srcChain: "Ethereum";
302
302
  srcAsset: "USDC";
303
303
  destAsset: "FLIP" | "ETH";
304
304
  destChain: "Ethereum";
305
305
  destAddress: `0x${string}`;
306
306
  }, {
307
- amount: bigint;
307
+ amount: string;
308
308
  srcChain: "Ethereum";
309
309
  srcAsset: "USDC";
310
310
  destAsset: "FLIP" | "ETH";
311
311
  destChain: "Ethereum";
312
312
  destAddress: `0x${string}`;
313
313
  }>, z.ZodObject<{
314
- amount: z.ZodBigInt;
314
+ amount: z.ZodString;
315
315
  srcChain: z.ZodLiteral<"Ethereum">;
316
316
  destAsset: z.ZodLiteral<"DOT">;
317
317
  destChain: z.ZodLiteral<"Polkadot">;
318
318
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
319
319
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
320
320
  }, "strip", z.ZodTypeAny, {
321
- amount: bigint;
321
+ amount: string;
322
322
  srcChain: "Ethereum";
323
323
  srcAsset: "FLIP" | "USDC";
324
324
  destAsset: "DOT";
325
325
  destChain: "Polkadot";
326
326
  destAddress: string;
327
327
  }, {
328
- amount: bigint;
328
+ amount: string;
329
329
  srcChain: "Ethereum";
330
330
  srcAsset: "FLIP" | "USDC";
331
331
  destAsset: "DOT";
332
332
  destChain: "Polkadot";
333
333
  destAddress: string;
334
334
  }>, z.ZodObject<{
335
- amount: z.ZodBigInt;
335
+ amount: z.ZodString;
336
336
  srcChain: z.ZodLiteral<"Ethereum">;
337
337
  destAsset: z.ZodLiteral<"BTC">;
338
338
  destChain: z.ZodLiteral<"Bitcoin">;
339
339
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
340
340
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
341
341
  }, "strip", z.ZodTypeAny, {
342
- amount: bigint;
342
+ amount: string;
343
343
  srcChain: "Ethereum";
344
344
  srcAsset: "FLIP" | "USDC";
345
345
  destAsset: "BTC";
346
346
  destChain: "Bitcoin";
347
347
  destAddress: string;
348
348
  }, {
349
- amount: bigint;
349
+ amount: string;
350
350
  srcChain: "Ethereum";
351
351
  srcAsset: "FLIP" | "USDC";
352
352
  destAsset: "BTC";
@@ -367,43 +367,16 @@ declare const ccmMetadataSchema: z.ZodObject<{
367
367
  gasBudget: string;
368
368
  }>;
369
369
  type CcmMetadata = z.infer<typeof ccmMetadataSchema>;
370
- declare const quoteResponseSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
371
- id: z.ZodString;
372
- intermediate_amount: z.ZodString;
373
- egress_amount: z.ZodString;
374
- }, "strip", z.ZodTypeAny, {
375
- id: string;
376
- intermediate_amount: string;
377
- egress_amount: string;
378
- }, {
379
- id: string;
380
- intermediate_amount: string;
381
- egress_amount: string;
382
- }>, {
383
- id: string;
384
- intermediateAmount: string;
385
- egressAmount: string;
386
- }, {
387
- id: string;
388
- intermediate_amount: string;
389
- egress_amount: string;
390
- }>, z.ZodEffects<z.ZodObject<{
391
- id: z.ZodString;
392
- egress_amount: z.ZodString;
393
- }, "strip", z.ZodTypeAny, {
394
- id: string;
395
- egress_amount: string;
396
- }, {
397
- id: string;
398
- egress_amount: string;
399
- }>, {
400
- id: string;
370
+ type QuoteFee = {
371
+ type: 'liquidity' | 'network';
372
+ asset: Asset;
373
+ amount: string;
374
+ };
375
+ type QuoteQueryResponse = {
376
+ intermediateAmount?: string;
401
377
  egressAmount: string;
402
- }, {
403
- id: string;
404
- egress_amount: string;
405
- }>]>;
406
- type QuoteQueryResponse = z.infer<typeof quoteResponseSchema>;
378
+ includedFees: QuoteFee[];
379
+ };
407
380
 
408
381
  interface ChainData {
409
382
  id: Chain;
package/dist/swap.d.ts CHANGED
@@ -1,87 +1,87 @@
1
1
  import { Signer } from 'ethers';
2
- import { C as Chain, c as chainAssets, A as Asset, a as ChainflipNetwork, T as TransactionOptions } from './contracts-920ad844.js';
2
+ import { A as Asset, C as Chain, c as chainAssets, a as ChainflipNetwork, T as TransactionOptions } from './contracts-920ad844.js';
3
3
  export { d as Assets, e as ChainflipNetworks, b as Chains, f as assetChains, h as assetContractIds, g as assetDecimals, i as chainContractIds } from './contracts-920ad844.js';
4
4
  import { z } from 'zod';
5
5
 
6
6
  declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
7
- amount: z.ZodBigInt;
7
+ amount: z.ZodString;
8
8
  srcChain: z.ZodLiteral<"Ethereum">;
9
9
  destChain: z.ZodLiteral<"Ethereum">;
10
10
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
11
11
  srcAsset: z.ZodLiteral<"FLIP">;
12
12
  destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
13
13
  }, "strip", z.ZodTypeAny, {
14
- amount: bigint;
14
+ amount: string;
15
15
  srcChain: "Ethereum";
16
16
  srcAsset: "FLIP";
17
17
  destAsset: "USDC" | "ETH";
18
18
  destChain: "Ethereum";
19
19
  destAddress: `0x${string}`;
20
20
  }, {
21
- amount: bigint;
21
+ amount: string;
22
22
  srcChain: "Ethereum";
23
23
  srcAsset: "FLIP";
24
24
  destAsset: "USDC" | "ETH";
25
25
  destChain: "Ethereum";
26
26
  destAddress: `0x${string}`;
27
27
  }>, z.ZodObject<{
28
- amount: z.ZodBigInt;
28
+ amount: z.ZodString;
29
29
  srcChain: z.ZodLiteral<"Ethereum">;
30
30
  destChain: z.ZodLiteral<"Ethereum">;
31
31
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
32
32
  srcAsset: z.ZodLiteral<"USDC">;
33
33
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
34
34
  }, "strip", z.ZodTypeAny, {
35
- amount: bigint;
35
+ amount: string;
36
36
  srcChain: "Ethereum";
37
37
  srcAsset: "USDC";
38
38
  destAsset: "FLIP" | "ETH";
39
39
  destChain: "Ethereum";
40
40
  destAddress: `0x${string}`;
41
41
  }, {
42
- amount: bigint;
42
+ amount: string;
43
43
  srcChain: "Ethereum";
44
44
  srcAsset: "USDC";
45
45
  destAsset: "FLIP" | "ETH";
46
46
  destChain: "Ethereum";
47
47
  destAddress: `0x${string}`;
48
48
  }>, z.ZodObject<{
49
- amount: z.ZodBigInt;
49
+ amount: z.ZodString;
50
50
  srcChain: z.ZodLiteral<"Ethereum">;
51
51
  destAsset: z.ZodLiteral<"DOT">;
52
52
  destChain: z.ZodLiteral<"Polkadot">;
53
53
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
54
54
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
55
55
  }, "strip", z.ZodTypeAny, {
56
- amount: bigint;
56
+ amount: string;
57
57
  srcChain: "Ethereum";
58
58
  srcAsset: "FLIP" | "USDC";
59
59
  destAsset: "DOT";
60
60
  destChain: "Polkadot";
61
61
  destAddress: string;
62
62
  }, {
63
- amount: bigint;
63
+ amount: string;
64
64
  srcChain: "Ethereum";
65
65
  srcAsset: "FLIP" | "USDC";
66
66
  destAsset: "DOT";
67
67
  destChain: "Polkadot";
68
68
  destAddress: string;
69
69
  }>, z.ZodObject<{
70
- amount: z.ZodBigInt;
70
+ amount: z.ZodString;
71
71
  srcChain: z.ZodLiteral<"Ethereum">;
72
72
  destAsset: z.ZodLiteral<"BTC">;
73
73
  destChain: z.ZodLiteral<"Bitcoin">;
74
74
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
75
75
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
76
76
  }, "strip", z.ZodTypeAny, {
77
- amount: bigint;
77
+ amount: string;
78
78
  srcChain: "Ethereum";
79
79
  srcAsset: "FLIP" | "USDC";
80
80
  destAsset: "BTC";
81
81
  destChain: "Bitcoin";
82
82
  destAddress: string;
83
83
  }, {
84
- amount: bigint;
84
+ amount: string;
85
85
  srcChain: "Ethereum";
86
86
  srcAsset: "FLIP" | "USDC";
87
87
  destAsset: "BTC";
@@ -89,7 +89,7 @@ declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
89
89
  destAddress: string;
90
90
  }>]>;
91
91
  declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
92
- amount: z.ZodBigInt;
92
+ amount: z.ZodString;
93
93
  srcChain: z.ZodLiteral<"Ethereum">;
94
94
  srcAsset: z.ZodLiteral<"ETH">;
95
95
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
@@ -106,7 +106,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
106
106
  gasBudget: string;
107
107
  }>;
108
108
  }, "strip", z.ZodTypeAny, {
109
- amount: bigint;
109
+ amount: string;
110
110
  srcChain: "Ethereum";
111
111
  srcAsset: "ETH";
112
112
  destAsset: "FLIP" | "USDC";
@@ -117,7 +117,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
117
117
  gasBudget: string;
118
118
  };
119
119
  }, {
120
- amount: bigint;
120
+ amount: string;
121
121
  srcChain: "Ethereum";
122
122
  srcAsset: "ETH";
123
123
  destAsset: "FLIP" | "USDC";
@@ -128,7 +128,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
128
128
  gasBudget: string;
129
129
  };
130
130
  }>, z.ZodUnion<[z.ZodObject<{
131
- amount: z.ZodBigInt;
131
+ amount: z.ZodString;
132
132
  srcChain: z.ZodLiteral<"Ethereum">;
133
133
  srcAsset: z.ZodLiteral<"FLIP">;
134
134
  destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
@@ -145,7 +145,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
145
145
  gasBudget: string;
146
146
  }>;
147
147
  }, "strip", z.ZodTypeAny, {
148
- amount: bigint;
148
+ amount: string;
149
149
  srcChain: "Ethereum";
150
150
  srcAsset: "FLIP";
151
151
  destAsset: "USDC" | "ETH";
@@ -156,7 +156,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
156
156
  gasBudget: string;
157
157
  };
158
158
  }, {
159
- amount: bigint;
159
+ amount: string;
160
160
  srcChain: "Ethereum";
161
161
  srcAsset: "FLIP";
162
162
  destAsset: "USDC" | "ETH";
@@ -167,7 +167,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
167
167
  gasBudget: string;
168
168
  };
169
169
  }>, z.ZodObject<{
170
- amount: z.ZodBigInt;
170
+ amount: z.ZodString;
171
171
  srcChain: z.ZodLiteral<"Ethereum">;
172
172
  srcAsset: z.ZodLiteral<"USDC">;
173
173
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
@@ -184,7 +184,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
184
184
  gasBudget: string;
185
185
  }>;
186
186
  }, "strip", z.ZodTypeAny, {
187
- amount: bigint;
187
+ amount: string;
188
188
  srcChain: "Ethereum";
189
189
  srcAsset: "USDC";
190
190
  destAsset: "FLIP" | "ETH";
@@ -195,7 +195,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
195
195
  gasBudget: string;
196
196
  };
197
197
  }, {
198
- amount: bigint;
198
+ amount: string;
199
199
  srcChain: "Ethereum";
200
200
  srcAsset: "USDC";
201
201
  destAsset: "FLIP" | "ETH";
@@ -206,147 +206,147 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
206
206
  gasBudget: string;
207
207
  };
208
208
  }>]>, z.ZodUnion<[z.ZodObject<{
209
- amount: z.ZodBigInt;
209
+ amount: z.ZodString;
210
210
  srcChain: z.ZodLiteral<"Ethereum">;
211
211
  srcAsset: z.ZodLiteral<"ETH">;
212
212
  destChain: z.ZodLiteral<"Ethereum">;
213
213
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
214
214
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
215
215
  }, "strip", z.ZodTypeAny, {
216
- amount: bigint;
216
+ amount: string;
217
217
  srcChain: "Ethereum";
218
218
  srcAsset: "ETH";
219
219
  destAsset: "FLIP" | "USDC";
220
220
  destChain: "Ethereum";
221
221
  destAddress: `0x${string}`;
222
222
  }, {
223
- amount: bigint;
223
+ amount: string;
224
224
  srcChain: "Ethereum";
225
225
  srcAsset: "ETH";
226
226
  destAsset: "FLIP" | "USDC";
227
227
  destChain: "Ethereum";
228
228
  destAddress: `0x${string}`;
229
229
  }>, z.ZodObject<{
230
- amount: z.ZodBigInt;
230
+ amount: z.ZodString;
231
231
  srcChain: z.ZodLiteral<"Ethereum">;
232
232
  srcAsset: z.ZodLiteral<"ETH">;
233
233
  destChain: z.ZodLiteral<"Polkadot">;
234
234
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
235
235
  destAsset: z.ZodLiteral<"DOT">;
236
236
  }, "strip", z.ZodTypeAny, {
237
- amount: bigint;
237
+ amount: string;
238
238
  srcChain: "Ethereum";
239
239
  srcAsset: "ETH";
240
240
  destAsset: "DOT";
241
241
  destChain: "Polkadot";
242
242
  destAddress: string;
243
243
  }, {
244
- amount: bigint;
244
+ amount: string;
245
245
  srcChain: "Ethereum";
246
246
  srcAsset: "ETH";
247
247
  destAsset: "DOT";
248
248
  destChain: "Polkadot";
249
249
  destAddress: string;
250
250
  }>, z.ZodObject<{
251
- amount: z.ZodBigInt;
251
+ amount: z.ZodString;
252
252
  srcChain: z.ZodLiteral<"Ethereum">;
253
253
  srcAsset: z.ZodLiteral<"ETH">;
254
254
  destChain: z.ZodLiteral<"Bitcoin">;
255
255
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
256
256
  destAsset: z.ZodLiteral<"BTC">;
257
257
  }, "strip", z.ZodTypeAny, {
258
- amount: bigint;
258
+ amount: string;
259
259
  srcChain: "Ethereum";
260
260
  srcAsset: "ETH";
261
261
  destAsset: "BTC";
262
262
  destChain: "Bitcoin";
263
263
  destAddress: string;
264
264
  }, {
265
- amount: bigint;
265
+ amount: string;
266
266
  srcChain: "Ethereum";
267
267
  srcAsset: "ETH";
268
268
  destAsset: "BTC";
269
269
  destChain: "Bitcoin";
270
270
  destAddress: string;
271
271
  }>]>, z.ZodUnion<[z.ZodObject<{
272
- amount: z.ZodBigInt;
272
+ amount: z.ZodString;
273
273
  srcChain: z.ZodLiteral<"Ethereum">;
274
274
  destChain: z.ZodLiteral<"Ethereum">;
275
275
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
276
276
  srcAsset: z.ZodLiteral<"FLIP">;
277
277
  destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
278
278
  }, "strip", z.ZodTypeAny, {
279
- amount: bigint;
279
+ amount: string;
280
280
  srcChain: "Ethereum";
281
281
  srcAsset: "FLIP";
282
282
  destAsset: "USDC" | "ETH";
283
283
  destChain: "Ethereum";
284
284
  destAddress: `0x${string}`;
285
285
  }, {
286
- amount: bigint;
286
+ amount: string;
287
287
  srcChain: "Ethereum";
288
288
  srcAsset: "FLIP";
289
289
  destAsset: "USDC" | "ETH";
290
290
  destChain: "Ethereum";
291
291
  destAddress: `0x${string}`;
292
292
  }>, z.ZodObject<{
293
- amount: z.ZodBigInt;
293
+ amount: z.ZodString;
294
294
  srcChain: z.ZodLiteral<"Ethereum">;
295
295
  destChain: z.ZodLiteral<"Ethereum">;
296
296
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
297
297
  srcAsset: z.ZodLiteral<"USDC">;
298
298
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
299
299
  }, "strip", z.ZodTypeAny, {
300
- amount: bigint;
300
+ amount: string;
301
301
  srcChain: "Ethereum";
302
302
  srcAsset: "USDC";
303
303
  destAsset: "FLIP" | "ETH";
304
304
  destChain: "Ethereum";
305
305
  destAddress: `0x${string}`;
306
306
  }, {
307
- amount: bigint;
307
+ amount: string;
308
308
  srcChain: "Ethereum";
309
309
  srcAsset: "USDC";
310
310
  destAsset: "FLIP" | "ETH";
311
311
  destChain: "Ethereum";
312
312
  destAddress: `0x${string}`;
313
313
  }>, z.ZodObject<{
314
- amount: z.ZodBigInt;
314
+ amount: z.ZodString;
315
315
  srcChain: z.ZodLiteral<"Ethereum">;
316
316
  destAsset: z.ZodLiteral<"DOT">;
317
317
  destChain: z.ZodLiteral<"Polkadot">;
318
318
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
319
319
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
320
320
  }, "strip", z.ZodTypeAny, {
321
- amount: bigint;
321
+ amount: string;
322
322
  srcChain: "Ethereum";
323
323
  srcAsset: "FLIP" | "USDC";
324
324
  destAsset: "DOT";
325
325
  destChain: "Polkadot";
326
326
  destAddress: string;
327
327
  }, {
328
- amount: bigint;
328
+ amount: string;
329
329
  srcChain: "Ethereum";
330
330
  srcAsset: "FLIP" | "USDC";
331
331
  destAsset: "DOT";
332
332
  destChain: "Polkadot";
333
333
  destAddress: string;
334
334
  }>, z.ZodObject<{
335
- amount: z.ZodBigInt;
335
+ amount: z.ZodString;
336
336
  srcChain: z.ZodLiteral<"Ethereum">;
337
337
  destAsset: z.ZodLiteral<"BTC">;
338
338
  destChain: z.ZodLiteral<"Bitcoin">;
339
339
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
340
340
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
341
341
  }, "strip", z.ZodTypeAny, {
342
- amount: bigint;
342
+ amount: string;
343
343
  srcChain: "Ethereum";
344
344
  srcAsset: "FLIP" | "USDC";
345
345
  destAsset: "BTC";
346
346
  destChain: "Bitcoin";
347
347
  destAddress: string;
348
348
  }, {
349
- amount: bigint;
349
+ amount: string;
350
350
  srcChain: "Ethereum";
351
351
  srcAsset: "FLIP" | "USDC";
352
352
  destAsset: "BTC";
@@ -367,43 +367,16 @@ declare const ccmMetadataSchema: z.ZodObject<{
367
367
  gasBudget: string;
368
368
  }>;
369
369
  type CcmMetadata = z.infer<typeof ccmMetadataSchema>;
370
- declare const quoteResponseSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
371
- id: z.ZodString;
372
- intermediate_amount: z.ZodString;
373
- egress_amount: z.ZodString;
374
- }, "strip", z.ZodTypeAny, {
375
- id: string;
376
- intermediate_amount: string;
377
- egress_amount: string;
378
- }, {
379
- id: string;
380
- intermediate_amount: string;
381
- egress_amount: string;
382
- }>, {
383
- id: string;
384
- intermediateAmount: string;
385
- egressAmount: string;
386
- }, {
387
- id: string;
388
- intermediate_amount: string;
389
- egress_amount: string;
390
- }>, z.ZodEffects<z.ZodObject<{
391
- id: z.ZodString;
392
- egress_amount: z.ZodString;
393
- }, "strip", z.ZodTypeAny, {
394
- id: string;
395
- egress_amount: string;
396
- }, {
397
- id: string;
398
- egress_amount: string;
399
- }>, {
400
- id: string;
370
+ type QuoteFee = {
371
+ type: 'liquidity' | 'network';
372
+ asset: Asset;
373
+ amount: string;
374
+ };
375
+ type QuoteQueryResponse = {
376
+ intermediateAmount?: string;
401
377
  egressAmount: string;
402
- }, {
403
- id: string;
404
- egress_amount: string;
405
- }>]>;
406
- type QuoteQueryResponse = z.infer<typeof quoteResponseSchema>;
378
+ includedFees: QuoteFee[];
379
+ };
407
380
 
408
381
  interface ChainData {
409
382
  id: Chain;
package/dist/swap.js CHANGED
@@ -133,9 +133,9 @@ var Encoding;
133
133
  })(Encoding || (Encoding = {}));
134
134
  var bech32 = {
135
135
  getEncodingConst(enc) {
136
- if (enc === Encoding.Bech32)
136
+ if (enc === "bech32")
137
137
  return 1;
138
- if (enc === Encoding.Bech32m)
138
+ if (enc === "bech32m")
139
139
  return 734539939;
140
140
  return null;
141
141
  },
@@ -259,9 +259,9 @@ var segwitAddress = {
259
259
  },
260
260
  decode(hrp, addr) {
261
261
  let bech32m = false;
262
- let dec = bech32.decode(addr, Encoding.Bech32);
262
+ let dec = bech32.decode(addr, "bech32");
263
263
  if (dec === null) {
264
- dec = bech32.decode(addr, Encoding.Bech32m);
264
+ dec = bech32.decode(addr, "bech32m");
265
265
  bech32m = true;
266
266
  }
267
267
  if (dec === null || dec.hrp !== hrp || dec.data.length < 1 || dec.data[0] > 16) {
@@ -286,9 +286,9 @@ var segwitAddress = {
286
286
  };
287
287
  },
288
288
  encode(hrp, version, program) {
289
- let enc = Encoding.Bech32;
289
+ let enc = "bech32";
290
290
  if (version > 0) {
291
- enc = Encoding.Bech32m;
291
+ enc = "bech32m";
292
292
  }
293
293
  const ret = bech32.encode(
294
294
  hrp,
@@ -455,24 +455,6 @@ zod.z.object({
455
455
  ...rest,
456
456
  expectedDepositAmount: amount
457
457
  }));
458
- zod.z.union([
459
- zod.z.object({
460
- id: zod.z.string(),
461
- intermediate_amount: numericString,
462
- egress_amount: numericString
463
- }).transform(({ id, ...rest }) => ({
464
- id,
465
- intermediateAmount: rest.intermediate_amount,
466
- egressAmount: rest.egress_amount
467
- })),
468
- zod.z.object({
469
- id: zod.z.string(),
470
- egress_amount: numericString
471
- }).transform(({ id, ...rest }) => ({
472
- id,
473
- egressAmount: rest.egress_amount
474
- }))
475
- ]);
476
458
 
477
459
  // ../shared/src/vault/schemas.ts
478
460
  var bytesToHex = /* @__PURE__ */ __name((arr) => `0x${[
@@ -480,7 +462,7 @@ var bytesToHex = /* @__PURE__ */ __name((arr) => `0x${[
480
462
  ].map((v) => v.toString(16).padStart(2, "0")).join("")}`, "bytesToHex");
481
463
  var utf8ToHex = /* @__PURE__ */ __name((str) => `0x${Buffer.from(str).toString("hex")}`, "utf8ToHex");
482
464
  var eth = zod.z.object({
483
- amount: zod.z.bigint(),
465
+ amount: numericString,
484
466
  srcChain: zod.z.literal(Chains.Ethereum),
485
467
  srcAsset: zod.z.literal(Assets.ETH)
486
468
  });
@@ -1862,6 +1844,9 @@ __publicField(_Vault__factory, "abi", _abi2);
1862
1844
  var Vault__factory = _Vault__factory;
1863
1845
 
1864
1846
  // ../shared/src/consts.ts
1847
+ ({
1848
+ [ChainflipNetworks.perseverance]: 100
1849
+ });
1865
1850
  var MINIMUM_DEPOSIT_AMOUNTS = {
1866
1851
  [ChainflipNetworks.perseverance]: {
1867
1852
  [Assets.ETH]: "0",
@@ -1877,7 +1862,7 @@ var MINIMUM_SWAP_AMOUNTS = {
1877
1862
  [Assets.ETH]: "580000000000000",
1878
1863
  [Assets.FLIP]: "1000000000000000000",
1879
1864
  [Assets.USDC]: "1000000",
1880
- [Assets.BTC]: "5000",
1865
+ [Assets.BTC]: "1000",
1881
1866
  [Assets.DOT]: "2000000000"
1882
1867
  }
1883
1868
  };
@@ -1943,7 +1928,7 @@ var swapToken = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
1943
1928
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
1944
1929
  const erc20Address = networkOpts.network === "localnet" ? networkOpts.srcTokenContractAddress : getTokenContractAddress(params.srcAsset, networkOpts.network);
1945
1930
  assert(erc20Address !== void 0, "Missing ERC20 contract address");
1946
- const { isAllowable } = await checkAllowance(params.amount, vaultContractAddress, erc20Address, networkOpts.signer);
1931
+ const { isAllowable } = await checkAllowance(BigInt(params.amount), vaultContractAddress, erc20Address, networkOpts.signer);
1947
1932
  assert(isAllowable, "Swap amount exceeds allowance");
1948
1933
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
1949
1934
  const transaction = await vault.xSwapToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], erc20Address, params.amount, "0x", extractOverrides(txOpts));
@@ -1962,7 +1947,7 @@ var callToken = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
1962
1947
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
1963
1948
  const erc20Address = networkOpts.network === "localnet" ? networkOpts.srcTokenContractAddress : getTokenContractAddress(params.srcAsset, networkOpts.network);
1964
1949
  assert(erc20Address !== void 0, "Missing ERC20 contract address");
1965
- const { isAllowable } = await checkAllowance(params.amount, vaultContractAddress, erc20Address, networkOpts.signer);
1950
+ const { isAllowable } = await checkAllowance(BigInt(params.amount), vaultContractAddress, erc20Address, networkOpts.signer);
1966
1951
  assert(isAllowable, "Swap amount exceeds allowance");
1967
1952
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
1968
1953
  const transaction = await vault.xCallToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata.message, params.ccmMetadata.gasBudget, erc20Address, params.amount, "0x", extractOverrides(txOpts));
@@ -1982,14 +1967,14 @@ var checkVaultAllowance = /* @__PURE__ */ __name((params, networkOpts) => {
1982
1967
  const erc20Address = networkOpts.network === "localnet" ? networkOpts.srcTokenContractAddress : getTokenContractAddress(params.srcAsset, networkOpts.network);
1983
1968
  assert(erc20Address !== void 0, "Missing ERC20 contract address");
1984
1969
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
1985
- return checkAllowance(params.amount, vaultContractAddress, erc20Address, networkOpts.signer);
1970
+ return checkAllowance(BigInt(params.amount), vaultContractAddress, erc20Address, networkOpts.signer);
1986
1971
  }, "checkVaultAllowance");
1987
1972
  var approveVault = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
1988
1973
  const { isAllowable, erc20, allowance } = await checkVaultAllowance(params, networkOpts);
1989
1974
  if (isAllowable)
1990
1975
  return null;
1991
1976
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
1992
- return approve(params.amount, vaultContractAddress, erc20, allowance, txOpts);
1977
+ return approve(BigInt(params.amount), vaultContractAddress, erc20, allowance, txOpts);
1993
1978
  }, "approveVault");
1994
1979
 
1995
1980
  // src/swap/consts.ts
package/dist/swap.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { isString, Chains, Assets, ChainflipNetworks, __name, __publicField, assert, getVaultManagerContractAddress, approve, isTokenCall, isTokenSwap, getTokenContractAddress, checkAllowance, Vault__factory, chainContractIds, assetContractIds, extractOverrides, assetDecimals, isTestnet, getMinimumDepositAmount, getMinimumSwapAmount } from './chunk-HVSV6XD5.mjs';
2
- export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-HVSV6XD5.mjs';
1
+ import { isString, Chains, Assets, ChainflipNetworks, __name, __publicField, assert, getVaultManagerContractAddress, approve, isTokenCall, isTokenSwap, getTokenContractAddress, checkAllowance, Vault__factory, chainContractIds, assetContractIds, extractOverrides, assetDecimals, isTestnet, getMinimumDepositAmount, getMinimumSwapAmount } from './chunk-HR2UQBMZ.mjs';
2
+ export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-HR2UQBMZ.mjs';
3
3
  import { encodeAddress, decodeAddress, base58Decode } from '@polkadot/util-crypto';
4
4
  import { z } from 'zod';
5
5
  import { hexToU8a } from '@polkadot/util';
@@ -22,9 +22,9 @@ var Encoding;
22
22
  })(Encoding || (Encoding = {}));
23
23
  var bech32 = {
24
24
  getEncodingConst(enc) {
25
- if (enc === Encoding.Bech32)
25
+ if (enc === "bech32")
26
26
  return 1;
27
- if (enc === Encoding.Bech32m)
27
+ if (enc === "bech32m")
28
28
  return 734539939;
29
29
  return null;
30
30
  },
@@ -148,9 +148,9 @@ var segwitAddress = {
148
148
  },
149
149
  decode(hrp, addr) {
150
150
  let bech32m = false;
151
- let dec = bech32.decode(addr, Encoding.Bech32);
151
+ let dec = bech32.decode(addr, "bech32");
152
152
  if (dec === null) {
153
- dec = bech32.decode(addr, Encoding.Bech32m);
153
+ dec = bech32.decode(addr, "bech32m");
154
154
  bech32m = true;
155
155
  }
156
156
  if (dec === null || dec.hrp !== hrp || dec.data.length < 1 || dec.data[0] > 16) {
@@ -175,9 +175,9 @@ var segwitAddress = {
175
175
  };
176
176
  },
177
177
  encode(hrp, version, program) {
178
- let enc = Encoding.Bech32;
178
+ let enc = "bech32";
179
179
  if (version > 0) {
180
- enc = Encoding.Bech32m;
180
+ enc = "bech32m";
181
181
  }
182
182
  const ret = bech32.encode(
183
183
  hrp,
@@ -344,24 +344,6 @@ z.object({
344
344
  ...rest,
345
345
  expectedDepositAmount: amount
346
346
  }));
347
- z.union([
348
- z.object({
349
- id: z.string(),
350
- intermediate_amount: numericString,
351
- egress_amount: numericString
352
- }).transform(({ id, ...rest }) => ({
353
- id,
354
- intermediateAmount: rest.intermediate_amount,
355
- egressAmount: rest.egress_amount
356
- })),
357
- z.object({
358
- id: z.string(),
359
- egress_amount: numericString
360
- }).transform(({ id, ...rest }) => ({
361
- id,
362
- egressAmount: rest.egress_amount
363
- }))
364
- ]);
365
347
 
366
348
  // ../shared/src/vault/schemas.ts
367
349
  var bytesToHex = /* @__PURE__ */ __name((arr) => `0x${[
@@ -369,7 +351,7 @@ var bytesToHex = /* @__PURE__ */ __name((arr) => `0x${[
369
351
  ].map((v) => v.toString(16).padStart(2, "0")).join("")}`, "bytesToHex");
370
352
  var utf8ToHex = /* @__PURE__ */ __name((str) => `0x${Buffer.from(str).toString("hex")}`, "utf8ToHex");
371
353
  var eth = z.object({
372
- amount: z.bigint(),
354
+ amount: numericString,
373
355
  srcChain: z.literal(Chains.Ethereum),
374
356
  srcAsset: z.literal(Assets.ETH)
375
357
  });
@@ -460,7 +442,7 @@ var swapToken = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
460
442
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
461
443
  const erc20Address = networkOpts.network === "localnet" ? networkOpts.srcTokenContractAddress : getTokenContractAddress(params.srcAsset, networkOpts.network);
462
444
  assert(erc20Address !== void 0, "Missing ERC20 contract address");
463
- const { isAllowable } = await checkAllowance(params.amount, vaultContractAddress, erc20Address, networkOpts.signer);
445
+ const { isAllowable } = await checkAllowance(BigInt(params.amount), vaultContractAddress, erc20Address, networkOpts.signer);
464
446
  assert(isAllowable, "Swap amount exceeds allowance");
465
447
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
466
448
  const transaction = await vault.xSwapToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], erc20Address, params.amount, "0x", extractOverrides(txOpts));
@@ -479,7 +461,7 @@ var callToken = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
479
461
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
480
462
  const erc20Address = networkOpts.network === "localnet" ? networkOpts.srcTokenContractAddress : getTokenContractAddress(params.srcAsset, networkOpts.network);
481
463
  assert(erc20Address !== void 0, "Missing ERC20 contract address");
482
- const { isAllowable } = await checkAllowance(params.amount, vaultContractAddress, erc20Address, networkOpts.signer);
464
+ const { isAllowable } = await checkAllowance(BigInt(params.amount), vaultContractAddress, erc20Address, networkOpts.signer);
483
465
  assert(isAllowable, "Swap amount exceeds allowance");
484
466
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
485
467
  const transaction = await vault.xCallToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata.message, params.ccmMetadata.gasBudget, erc20Address, params.amount, "0x", extractOverrides(txOpts));
@@ -499,14 +481,14 @@ var checkVaultAllowance = /* @__PURE__ */ __name((params, networkOpts) => {
499
481
  const erc20Address = networkOpts.network === "localnet" ? networkOpts.srcTokenContractAddress : getTokenContractAddress(params.srcAsset, networkOpts.network);
500
482
  assert(erc20Address !== void 0, "Missing ERC20 contract address");
501
483
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
502
- return checkAllowance(params.amount, vaultContractAddress, erc20Address, networkOpts.signer);
484
+ return checkAllowance(BigInt(params.amount), vaultContractAddress, erc20Address, networkOpts.signer);
503
485
  }, "checkVaultAllowance");
504
486
  var approveVault = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
505
487
  const { isAllowable, erc20, allowance } = await checkVaultAllowance(params, networkOpts);
506
488
  if (isAllowable)
507
489
  return null;
508
490
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
509
- return approve(params.amount, vaultContractAddress, erc20, allowance, txOpts);
491
+ return approve(BigInt(params.amount), vaultContractAddress, erc20, allowance, txOpts);
510
492
  }, "approveVault");
511
493
 
512
494
  // src/swap/consts.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/sdk",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./swap": {
@@ -43,7 +43,7 @@
43
43
  "dependencies": {
44
44
  "@polkadot/util": "^12.5.1",
45
45
  "@polkadot/util-crypto": "^12.5.1",
46
- "axios": "^1.5.0",
46
+ "axios": "^1.5.1",
47
47
  "ethers": "6.7.1",
48
48
  "zod": "^3.22.2"
49
49
  },