@chainflip/sdk 1.2.0 → 1.2.1-alpha.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/swap.d.ts CHANGED
@@ -1,22 +1,8 @@
1
1
  import { Signer } from 'ethers';
2
- import { C as ChainflipNetwork, a as Chain, A as Asset, c as chainAssets, T as TransactionOptions } from './contracts-auzntmd7.js';
3
- export { d as Assets, e as ChainflipNetworks, b as Chains } from './contracts-auzntmd7.js';
2
+ import { C as ChainflipNetwork, a as Chain, A as Asset, I as InternalAsset, b as AssetOfChain, T as TransactionOptions, c as ChainAssetMap } from './contracts-5Td0BhwY.js';
3
+ export { e as Assets, f as ChainflipNetworks, d as Chains } from './contracts-5Td0BhwY.js';
4
4
  import { z } from 'zod';
5
5
 
6
- type ChainAssetMap<T> = {
7
- Bitcoin: {
8
- BTC: T;
9
- };
10
- Ethereum: {
11
- ETH: T;
12
- USDC: T;
13
- FLIP: T;
14
- };
15
- Polkadot: {
16
- DOT: T;
17
- };
18
- };
19
-
20
6
  declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[z.ZodObject<{
21
7
  amount: z.ZodString;
22
8
  srcChain: z.ZodLiteral<"Ethereum">;
@@ -28,15 +14,15 @@ declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[
28
14
  amount: string;
29
15
  srcChain: "Ethereum";
30
16
  srcAsset: "FLIP";
31
- destAsset: "USDC" | "ETH";
32
17
  destChain: "Ethereum";
18
+ destAsset: "USDC" | "ETH";
33
19
  destAddress: `0x${string}`;
34
20
  }, {
35
21
  amount: string;
36
22
  srcChain: "Ethereum";
37
23
  srcAsset: "FLIP";
38
- destAsset: "USDC" | "ETH";
39
24
  destChain: "Ethereum";
25
+ destAsset: "USDC" | "ETH";
40
26
  destAddress: string;
41
27
  }>, z.ZodObject<{
42
28
  amount: z.ZodString;
@@ -49,65 +35,65 @@ declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[
49
35
  amount: string;
50
36
  srcChain: "Ethereum";
51
37
  srcAsset: "USDC";
52
- destAsset: "FLIP" | "ETH";
53
38
  destChain: "Ethereum";
39
+ destAsset: "FLIP" | "ETH";
54
40
  destAddress: `0x${string}`;
55
41
  }, {
56
42
  amount: string;
57
43
  srcChain: "Ethereum";
58
44
  srcAsset: "USDC";
59
- destAsset: "FLIP" | "ETH";
60
45
  destChain: "Ethereum";
46
+ destAsset: "FLIP" | "ETH";
61
47
  destAddress: string;
62
48
  }>, z.ZodObject<{
63
49
  amount: z.ZodString;
64
50
  srcChain: z.ZodLiteral<"Ethereum">;
65
- destAsset: z.ZodLiteral<"DOT">;
66
51
  destChain: z.ZodLiteral<"Polkadot">;
52
+ destAsset: z.ZodLiteral<"DOT">;
67
53
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, string | null, string>, string, string>, string, string>;
68
54
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
69
55
  }, "strip", z.ZodTypeAny, {
70
56
  amount: string;
71
57
  srcChain: "Ethereum";
72
58
  srcAsset: "FLIP" | "USDC";
73
- destAsset: "DOT";
74
59
  destChain: "Polkadot";
60
+ destAsset: "DOT";
75
61
  destAddress: string;
76
62
  }, {
77
63
  amount: string;
78
64
  srcChain: "Ethereum";
79
65
  srcAsset: "FLIP" | "USDC";
80
- destAsset: "DOT";
81
66
  destChain: "Polkadot";
67
+ destAsset: "DOT";
82
68
  destAddress: string;
83
69
  }>, z.ZodObject<{
84
70
  amount: z.ZodString;
85
71
  srcChain: z.ZodLiteral<"Ethereum">;
86
- destAsset: z.ZodLiteral<"BTC">;
87
72
  destChain: z.ZodLiteral<"Bitcoin">;
73
+ destAsset: z.ZodLiteral<"BTC">;
88
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>;
89
75
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
90
76
  }, "strip", z.ZodTypeAny, {
91
77
  amount: string;
92
78
  srcChain: "Ethereum";
93
79
  srcAsset: "FLIP" | "USDC";
94
- destAsset: "BTC";
95
80
  destChain: "Bitcoin";
81
+ destAsset: "BTC";
96
82
  destAddress: string;
97
83
  }, {
98
84
  amount: string;
99
85
  srcChain: "Ethereum";
100
86
  srcAsset: "FLIP" | "USDC";
101
- destAsset: "BTC";
102
87
  destChain: "Bitcoin";
88
+ destAsset: "BTC";
103
89
  destAddress: string;
104
90
  }>]>;
105
91
  declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[z.ZodObject<{
106
92
  amount: z.ZodString;
107
93
  srcChain: z.ZodLiteral<"Ethereum">;
108
94
  srcAsset: z.ZodLiteral<"ETH">;
109
- destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
110
95
  destChain: z.ZodLiteral<"Ethereum">;
96
+ destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
111
97
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
112
98
  ccmMetadata: z.ZodObject<{
113
99
  gasBudget: z.ZodString;
@@ -123,8 +109,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
123
109
  amount: string;
124
110
  srcChain: "Ethereum";
125
111
  srcAsset: "ETH";
126
- destAsset: "FLIP" | "USDC";
127
112
  destChain: "Ethereum";
113
+ destAsset: "FLIP" | "USDC";
128
114
  destAddress: `0x${string}`;
129
115
  ccmMetadata: {
130
116
  message: `0x${string}`;
@@ -134,8 +120,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
134
120
  amount: string;
135
121
  srcChain: "Ethereum";
136
122
  srcAsset: "ETH";
137
- destAsset: "FLIP" | "USDC";
138
123
  destChain: "Ethereum";
124
+ destAsset: "FLIP" | "USDC";
139
125
  destAddress: string;
140
126
  ccmMetadata: {
141
127
  message: string;
@@ -145,8 +131,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
145
131
  amount: z.ZodString;
146
132
  srcChain: z.ZodLiteral<"Ethereum">;
147
133
  srcAsset: z.ZodLiteral<"FLIP">;
148
- destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
149
134
  destChain: z.ZodLiteral<"Ethereum">;
135
+ destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
150
136
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
151
137
  ccmMetadata: z.ZodObject<{
152
138
  gasBudget: z.ZodString;
@@ -162,8 +148,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
162
148
  amount: string;
163
149
  srcChain: "Ethereum";
164
150
  srcAsset: "FLIP";
165
- destAsset: "USDC" | "ETH";
166
151
  destChain: "Ethereum";
152
+ destAsset: "USDC" | "ETH";
167
153
  destAddress: `0x${string}`;
168
154
  ccmMetadata: {
169
155
  message: `0x${string}`;
@@ -173,8 +159,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
173
159
  amount: string;
174
160
  srcChain: "Ethereum";
175
161
  srcAsset: "FLIP";
176
- destAsset: "USDC" | "ETH";
177
162
  destChain: "Ethereum";
163
+ destAsset: "USDC" | "ETH";
178
164
  destAddress: string;
179
165
  ccmMetadata: {
180
166
  message: string;
@@ -184,8 +170,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
184
170
  amount: z.ZodString;
185
171
  srcChain: z.ZodLiteral<"Ethereum">;
186
172
  srcAsset: z.ZodLiteral<"USDC">;
187
- destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
188
173
  destChain: z.ZodLiteral<"Ethereum">;
174
+ destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
189
175
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
190
176
  ccmMetadata: z.ZodObject<{
191
177
  gasBudget: z.ZodString;
@@ -201,8 +187,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
201
187
  amount: string;
202
188
  srcChain: "Ethereum";
203
189
  srcAsset: "USDC";
204
- destAsset: "FLIP" | "ETH";
205
190
  destChain: "Ethereum";
191
+ destAsset: "FLIP" | "ETH";
206
192
  destAddress: `0x${string}`;
207
193
  ccmMetadata: {
208
194
  message: `0x${string}`;
@@ -212,8 +198,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
212
198
  amount: string;
213
199
  srcChain: "Ethereum";
214
200
  srcAsset: "USDC";
215
- destAsset: "FLIP" | "ETH";
216
201
  destChain: "Ethereum";
202
+ destAsset: "FLIP" | "ETH";
217
203
  destAddress: string;
218
204
  ccmMetadata: {
219
205
  message: string;
@@ -230,15 +216,15 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
230
216
  amount: string;
231
217
  srcChain: "Ethereum";
232
218
  srcAsset: "ETH";
233
- destAsset: "FLIP" | "USDC";
234
219
  destChain: "Ethereum";
220
+ destAsset: "FLIP" | "USDC";
235
221
  destAddress: `0x${string}`;
236
222
  }, {
237
223
  amount: string;
238
224
  srcChain: "Ethereum";
239
225
  srcAsset: "ETH";
240
- destAsset: "FLIP" | "USDC";
241
226
  destChain: "Ethereum";
227
+ destAsset: "FLIP" | "USDC";
242
228
  destAddress: string;
243
229
  }>, z.ZodObject<{
244
230
  amount: z.ZodString;
@@ -251,15 +237,15 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
251
237
  amount: string;
252
238
  srcChain: "Ethereum";
253
239
  srcAsset: "ETH";
254
- destAsset: "DOT";
255
240
  destChain: "Polkadot";
241
+ destAsset: "DOT";
256
242
  destAddress: string;
257
243
  }, {
258
244
  amount: string;
259
245
  srcChain: "Ethereum";
260
246
  srcAsset: "ETH";
261
- destAsset: "DOT";
262
247
  destChain: "Polkadot";
248
+ destAsset: "DOT";
263
249
  destAddress: string;
264
250
  }>, z.ZodObject<{
265
251
  amount: z.ZodString;
@@ -272,15 +258,15 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
272
258
  amount: string;
273
259
  srcChain: "Ethereum";
274
260
  srcAsset: "ETH";
275
- destAsset: "BTC";
276
261
  destChain: "Bitcoin";
262
+ destAsset: "BTC";
277
263
  destAddress: string;
278
264
  }, {
279
265
  amount: string;
280
266
  srcChain: "Ethereum";
281
267
  srcAsset: "ETH";
282
- destAsset: "BTC";
283
268
  destChain: "Bitcoin";
269
+ destAsset: "BTC";
284
270
  destAddress: string;
285
271
  }>]>, z.ZodUnion<[z.ZodObject<{
286
272
  amount: z.ZodString;
@@ -293,15 +279,15 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
293
279
  amount: string;
294
280
  srcChain: "Ethereum";
295
281
  srcAsset: "FLIP";
296
- destAsset: "USDC" | "ETH";
297
282
  destChain: "Ethereum";
283
+ destAsset: "USDC" | "ETH";
298
284
  destAddress: `0x${string}`;
299
285
  }, {
300
286
  amount: string;
301
287
  srcChain: "Ethereum";
302
288
  srcAsset: "FLIP";
303
- destAsset: "USDC" | "ETH";
304
289
  destChain: "Ethereum";
290
+ destAsset: "USDC" | "ETH";
305
291
  destAddress: string;
306
292
  }>, z.ZodObject<{
307
293
  amount: z.ZodString;
@@ -314,57 +300,57 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
314
300
  amount: string;
315
301
  srcChain: "Ethereum";
316
302
  srcAsset: "USDC";
317
- destAsset: "FLIP" | "ETH";
318
303
  destChain: "Ethereum";
304
+ destAsset: "FLIP" | "ETH";
319
305
  destAddress: `0x${string}`;
320
306
  }, {
321
307
  amount: string;
322
308
  srcChain: "Ethereum";
323
309
  srcAsset: "USDC";
324
- destAsset: "FLIP" | "ETH";
325
310
  destChain: "Ethereum";
311
+ destAsset: "FLIP" | "ETH";
326
312
  destAddress: string;
327
313
  }>, z.ZodObject<{
328
314
  amount: z.ZodString;
329
315
  srcChain: z.ZodLiteral<"Ethereum">;
330
- destAsset: z.ZodLiteral<"DOT">;
331
316
  destChain: z.ZodLiteral<"Polkadot">;
317
+ destAsset: z.ZodLiteral<"DOT">;
332
318
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, string | null, string>, string, string>, string, string>;
333
319
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
334
320
  }, "strip", z.ZodTypeAny, {
335
321
  amount: string;
336
322
  srcChain: "Ethereum";
337
323
  srcAsset: "FLIP" | "USDC";
338
- destAsset: "DOT";
339
324
  destChain: "Polkadot";
325
+ destAsset: "DOT";
340
326
  destAddress: string;
341
327
  }, {
342
328
  amount: string;
343
329
  srcChain: "Ethereum";
344
330
  srcAsset: "FLIP" | "USDC";
345
- destAsset: "DOT";
346
331
  destChain: "Polkadot";
332
+ destAsset: "DOT";
347
333
  destAddress: string;
348
334
  }>, z.ZodObject<{
349
335
  amount: z.ZodString;
350
336
  srcChain: z.ZodLiteral<"Ethereum">;
351
- destAsset: z.ZodLiteral<"BTC">;
352
337
  destChain: z.ZodLiteral<"Bitcoin">;
338
+ destAsset: z.ZodLiteral<"BTC">;
353
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>;
354
340
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
355
341
  }, "strip", z.ZodTypeAny, {
356
342
  amount: string;
357
343
  srcChain: "Ethereum";
358
344
  srcAsset: "FLIP" | "USDC";
359
- destAsset: "BTC";
360
345
  destChain: "Bitcoin";
346
+ destAsset: "BTC";
361
347
  destAddress: string;
362
348
  }, {
363
349
  amount: string;
364
350
  srcChain: "Ethereum";
365
351
  srcAsset: "FLIP" | "USDC";
366
- destAsset: "BTC";
367
352
  destChain: "Bitcoin";
353
+ destAsset: "BTC";
368
354
  destAddress: string;
369
355
  }>]>]>;
370
356
  type ExecuteSwapParams = z.infer<ReturnType<typeof executeSwapParamsSchema>>;
@@ -399,10 +385,10 @@ interface ChainData {
399
385
  isMainnet: boolean;
400
386
  }
401
387
  type AssetData = {
402
- [K in keyof typeof chainAssets]: {
403
- chainflipId: string;
404
- asset: (typeof chainAssets)[K][number];
405
- chain: K;
388
+ [C in Chain]: {
389
+ chainflipId: InternalAsset;
390
+ asset: AssetOfChain<C>;
391
+ chain: C;
406
392
  contractAddress: string | undefined;
407
393
  decimals: number;
408
394
  name: string;
@@ -412,11 +398,11 @@ type AssetData = {
412
398
  maximumSwapAmount: string | null;
413
399
  minimumEgressAmount: string;
414
400
  };
415
- }[keyof typeof chainAssets];
401
+ }[Chain];
416
402
  interface ChainsAndAssets {
417
403
  srcChain: Chain;
418
- destChain: Chain;
419
404
  srcAsset: Asset;
405
+ destChain: Chain;
420
406
  destAsset: Asset;
421
407
  }
422
408
  interface QuoteRequest extends ChainsAndAssets {