@chainflip/sdk 1.2.2 → 1.3.0-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/{broker-VIDTY3VV.mjs → broker-SV76BAIC.mjs} +2 -2
- package/dist/{chunk-MEARHD4S.mjs → chunk-CLGHWM7E.mjs} +1 -1
- package/dist/{chunk-D22I3FZH.mjs → chunk-ME7POX3G.mjs} +15 -4
- package/dist/{chunk-X5KSXKLT.mjs → chunk-R2AO5MXU.mjs} +12 -12
- package/dist/{contracts-NCUAyhz5.d.mts → contracts-lJ2ktbkk.d.mts} +3 -3
- package/dist/{contracts-NCUAyhz5.d.ts → contracts-lJ2ktbkk.d.ts} +3 -3
- package/dist/funding.d.mts +1 -1
- package/dist/funding.d.ts +1 -1
- package/dist/funding.js +24 -14
- package/dist/funding.mjs +2 -2
- package/dist/swap.d.mts +119 -38
- package/dist/swap.d.ts +119 -38
- package/dist/swap.js +65 -26
- package/dist/swap.mjs +44 -16
- package/package.json +1 -1
package/dist/swap.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { C as ChainflipNetwork, a as Chain, A as Asset, I as InternalAsset, b as AssetOfChain, T as TransactionOptions, c as ChainAssetMap, d as ChainMap } from './contracts-
|
|
3
|
-
export { f as Assets, g as ChainflipIds, h as ChainflipNetworks, e as Chains, i as getChainflipId } from './contracts-
|
|
2
|
+
import { C as ChainflipNetwork, a as Chain, A as Asset, I as InternalAsset, b as AssetOfChain, T as TransactionOptions, c as ChainAssetMap, d as ChainMap } from './contracts-lJ2ktbkk.js';
|
|
3
|
+
export { f as Assets, g as ChainflipIds, h as ChainflipNetworks, e as Chains, i as getChainflipId } from './contracts-lJ2ktbkk.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[z.ZodObject<{
|
|
@@ -9,20 +9,20 @@ declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[
|
|
|
9
9
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
10
10
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
11
11
|
srcAsset: z.ZodLiteral<"FLIP">;
|
|
12
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
|
|
12
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">, z.ZodLiteral<"USDT">]>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
amount: string;
|
|
15
15
|
srcChain: "Ethereum";
|
|
16
16
|
srcAsset: "FLIP";
|
|
17
17
|
destChain: "Ethereum";
|
|
18
|
-
destAsset: "USDC" | "ETH";
|
|
18
|
+
destAsset: "USDC" | "ETH" | "USDT";
|
|
19
19
|
destAddress: `0x${string}`;
|
|
20
20
|
}, {
|
|
21
21
|
amount: string;
|
|
22
22
|
srcChain: "Ethereum";
|
|
23
23
|
srcAsset: "FLIP";
|
|
24
24
|
destChain: "Ethereum";
|
|
25
|
-
destAsset: "USDC" | "ETH";
|
|
25
|
+
destAsset: "USDC" | "ETH" | "USDT";
|
|
26
26
|
destAddress: string;
|
|
27
27
|
}>, z.ZodObject<{
|
|
28
28
|
amount: z.ZodString;
|
|
@@ -30,20 +30,41 @@ declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[
|
|
|
30
30
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
31
31
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
32
32
|
srcAsset: z.ZodLiteral<"USDC">;
|
|
33
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
|
|
33
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">, z.ZodLiteral<"USDT">]>;
|
|
34
34
|
}, "strip", z.ZodTypeAny, {
|
|
35
35
|
amount: string;
|
|
36
36
|
srcChain: "Ethereum";
|
|
37
37
|
srcAsset: "USDC";
|
|
38
38
|
destChain: "Ethereum";
|
|
39
|
-
destAsset: "FLIP" | "ETH";
|
|
39
|
+
destAsset: "FLIP" | "ETH" | "USDT";
|
|
40
40
|
destAddress: `0x${string}`;
|
|
41
41
|
}, {
|
|
42
42
|
amount: string;
|
|
43
43
|
srcChain: "Ethereum";
|
|
44
44
|
srcAsset: "USDC";
|
|
45
45
|
destChain: "Ethereum";
|
|
46
|
-
destAsset: "FLIP" | "ETH";
|
|
46
|
+
destAsset: "FLIP" | "ETH" | "USDT";
|
|
47
|
+
destAddress: string;
|
|
48
|
+
}>, z.ZodObject<{
|
|
49
|
+
amount: z.ZodString;
|
|
50
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
51
|
+
destChain: z.ZodLiteral<"Ethereum">;
|
|
52
|
+
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
53
|
+
srcAsset: z.ZodLiteral<"USDT">;
|
|
54
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">, z.ZodLiteral<"USDC">]>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
amount: string;
|
|
57
|
+
srcChain: "Ethereum";
|
|
58
|
+
srcAsset: "USDT";
|
|
59
|
+
destChain: "Ethereum";
|
|
60
|
+
destAsset: "FLIP" | "USDC" | "ETH";
|
|
61
|
+
destAddress: `0x${string}`;
|
|
62
|
+
}, {
|
|
63
|
+
amount: string;
|
|
64
|
+
srcChain: "Ethereum";
|
|
65
|
+
srcAsset: "USDT";
|
|
66
|
+
destChain: "Ethereum";
|
|
67
|
+
destAsset: "FLIP" | "USDC" | "ETH";
|
|
47
68
|
destAddress: string;
|
|
48
69
|
}>, z.ZodObject<{
|
|
49
70
|
amount: z.ZodString;
|
|
@@ -51,18 +72,18 @@ declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[
|
|
|
51
72
|
destChain: z.ZodLiteral<"Polkadot">;
|
|
52
73
|
destAsset: z.ZodLiteral<"DOT">;
|
|
53
74
|
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>;
|
|
54
|
-
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
75
|
+
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">, z.ZodLiteral<"USDT">]>;
|
|
55
76
|
}, "strip", z.ZodTypeAny, {
|
|
56
77
|
amount: string;
|
|
57
78
|
srcChain: "Ethereum";
|
|
58
|
-
srcAsset: "FLIP" | "USDC";
|
|
79
|
+
srcAsset: "FLIP" | "USDC" | "USDT";
|
|
59
80
|
destChain: "Polkadot";
|
|
60
81
|
destAsset: "DOT";
|
|
61
82
|
destAddress: string;
|
|
62
83
|
}, {
|
|
63
84
|
amount: string;
|
|
64
85
|
srcChain: "Ethereum";
|
|
65
|
-
srcAsset: "FLIP" | "USDC";
|
|
86
|
+
srcAsset: "FLIP" | "USDC" | "USDT";
|
|
66
87
|
destChain: "Polkadot";
|
|
67
88
|
destAsset: "DOT";
|
|
68
89
|
destAddress: string;
|
|
@@ -72,18 +93,18 @@ declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[
|
|
|
72
93
|
destChain: z.ZodLiteral<"Bitcoin">;
|
|
73
94
|
destAsset: z.ZodLiteral<"BTC">;
|
|
74
95
|
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
|
-
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
96
|
+
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">, z.ZodLiteral<"USDT">]>;
|
|
76
97
|
}, "strip", z.ZodTypeAny, {
|
|
77
98
|
amount: string;
|
|
78
99
|
srcChain: "Ethereum";
|
|
79
|
-
srcAsset: "FLIP" | "USDC";
|
|
100
|
+
srcAsset: "FLIP" | "USDC" | "USDT";
|
|
80
101
|
destChain: "Bitcoin";
|
|
81
102
|
destAsset: "BTC";
|
|
82
103
|
destAddress: string;
|
|
83
104
|
}, {
|
|
84
105
|
amount: string;
|
|
85
106
|
srcChain: "Ethereum";
|
|
86
|
-
srcAsset: "FLIP" | "USDC";
|
|
107
|
+
srcAsset: "FLIP" | "USDC" | "USDT";
|
|
87
108
|
destChain: "Bitcoin";
|
|
88
109
|
destAsset: "BTC";
|
|
89
110
|
destAddress: string;
|
|
@@ -93,7 +114,7 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
93
114
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
94
115
|
srcAsset: z.ZodLiteral<"ETH">;
|
|
95
116
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
96
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
117
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">, z.ZodLiteral<"USDT">]>;
|
|
97
118
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
98
119
|
ccmMetadata: z.ZodObject<{
|
|
99
120
|
gasBudget: z.ZodString;
|
|
@@ -110,7 +131,7 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
110
131
|
srcChain: "Ethereum";
|
|
111
132
|
srcAsset: "ETH";
|
|
112
133
|
destChain: "Ethereum";
|
|
113
|
-
destAsset: "FLIP" | "USDC";
|
|
134
|
+
destAsset: "FLIP" | "USDC" | "USDT";
|
|
114
135
|
destAddress: `0x${string}`;
|
|
115
136
|
ccmMetadata: {
|
|
116
137
|
message: `0x${string}`;
|
|
@@ -121,7 +142,7 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
121
142
|
srcChain: "Ethereum";
|
|
122
143
|
srcAsset: "ETH";
|
|
123
144
|
destChain: "Ethereum";
|
|
124
|
-
destAsset: "FLIP" | "USDC";
|
|
145
|
+
destAsset: "FLIP" | "USDC" | "USDT";
|
|
125
146
|
destAddress: string;
|
|
126
147
|
ccmMetadata: {
|
|
127
148
|
message: string;
|
|
@@ -132,7 +153,7 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
132
153
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
133
154
|
srcAsset: z.ZodLiteral<"FLIP">;
|
|
134
155
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
135
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
|
|
156
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">, z.ZodLiteral<"USDT">]>;
|
|
136
157
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
137
158
|
ccmMetadata: z.ZodObject<{
|
|
138
159
|
gasBudget: z.ZodString;
|
|
@@ -149,7 +170,7 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
149
170
|
srcChain: "Ethereum";
|
|
150
171
|
srcAsset: "FLIP";
|
|
151
172
|
destChain: "Ethereum";
|
|
152
|
-
destAsset: "USDC" | "ETH";
|
|
173
|
+
destAsset: "USDC" | "ETH" | "USDT";
|
|
153
174
|
destAddress: `0x${string}`;
|
|
154
175
|
ccmMetadata: {
|
|
155
176
|
message: `0x${string}`;
|
|
@@ -160,7 +181,7 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
160
181
|
srcChain: "Ethereum";
|
|
161
182
|
srcAsset: "FLIP";
|
|
162
183
|
destChain: "Ethereum";
|
|
163
|
-
destAsset: "USDC" | "ETH";
|
|
184
|
+
destAsset: "USDC" | "ETH" | "USDT";
|
|
164
185
|
destAddress: string;
|
|
165
186
|
ccmMetadata: {
|
|
166
187
|
message: string;
|
|
@@ -171,7 +192,7 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
171
192
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
172
193
|
srcAsset: z.ZodLiteral<"USDC">;
|
|
173
194
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
174
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
|
|
195
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">, z.ZodLiteral<"USDT">]>;
|
|
175
196
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
176
197
|
ccmMetadata: z.ZodObject<{
|
|
177
198
|
gasBudget: z.ZodString;
|
|
@@ -188,7 +209,7 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
188
209
|
srcChain: "Ethereum";
|
|
189
210
|
srcAsset: "USDC";
|
|
190
211
|
destChain: "Ethereum";
|
|
191
|
-
destAsset: "FLIP" | "ETH";
|
|
212
|
+
destAsset: "FLIP" | "ETH" | "USDT";
|
|
192
213
|
destAddress: `0x${string}`;
|
|
193
214
|
ccmMetadata: {
|
|
194
215
|
message: `0x${string}`;
|
|
@@ -199,7 +220,46 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
199
220
|
srcChain: "Ethereum";
|
|
200
221
|
srcAsset: "USDC";
|
|
201
222
|
destChain: "Ethereum";
|
|
202
|
-
destAsset: "FLIP" | "ETH";
|
|
223
|
+
destAsset: "FLIP" | "ETH" | "USDT";
|
|
224
|
+
destAddress: string;
|
|
225
|
+
ccmMetadata: {
|
|
226
|
+
message: string;
|
|
227
|
+
gasBudget: string;
|
|
228
|
+
};
|
|
229
|
+
}>, z.ZodObject<{
|
|
230
|
+
amount: z.ZodString;
|
|
231
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
232
|
+
srcAsset: z.ZodLiteral<"USDT">;
|
|
233
|
+
destChain: z.ZodLiteral<"Ethereum">;
|
|
234
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">, z.ZodLiteral<"USDC">]>;
|
|
235
|
+
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
236
|
+
ccmMetadata: z.ZodObject<{
|
|
237
|
+
gasBudget: z.ZodString;
|
|
238
|
+
message: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
239
|
+
}, "strip", z.ZodTypeAny, {
|
|
240
|
+
message: `0x${string}`;
|
|
241
|
+
gasBudget: string;
|
|
242
|
+
}, {
|
|
243
|
+
message: string;
|
|
244
|
+
gasBudget: string;
|
|
245
|
+
}>;
|
|
246
|
+
}, "strip", z.ZodTypeAny, {
|
|
247
|
+
amount: string;
|
|
248
|
+
srcChain: "Ethereum";
|
|
249
|
+
srcAsset: "USDT";
|
|
250
|
+
destChain: "Ethereum";
|
|
251
|
+
destAsset: "FLIP" | "USDC" | "ETH";
|
|
252
|
+
destAddress: `0x${string}`;
|
|
253
|
+
ccmMetadata: {
|
|
254
|
+
message: `0x${string}`;
|
|
255
|
+
gasBudget: string;
|
|
256
|
+
};
|
|
257
|
+
}, {
|
|
258
|
+
amount: string;
|
|
259
|
+
srcChain: "Ethereum";
|
|
260
|
+
srcAsset: "USDT";
|
|
261
|
+
destChain: "Ethereum";
|
|
262
|
+
destAsset: "FLIP" | "USDC" | "ETH";
|
|
203
263
|
destAddress: string;
|
|
204
264
|
ccmMetadata: {
|
|
205
265
|
message: string;
|
|
@@ -211,20 +271,20 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
211
271
|
srcAsset: z.ZodLiteral<"ETH">;
|
|
212
272
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
213
273
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
214
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
274
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">, z.ZodLiteral<"USDT">]>;
|
|
215
275
|
}, "strip", z.ZodTypeAny, {
|
|
216
276
|
amount: string;
|
|
217
277
|
srcChain: "Ethereum";
|
|
218
278
|
srcAsset: "ETH";
|
|
219
279
|
destChain: "Ethereum";
|
|
220
|
-
destAsset: "FLIP" | "USDC";
|
|
280
|
+
destAsset: "FLIP" | "USDC" | "USDT";
|
|
221
281
|
destAddress: `0x${string}`;
|
|
222
282
|
}, {
|
|
223
283
|
amount: string;
|
|
224
284
|
srcChain: "Ethereum";
|
|
225
285
|
srcAsset: "ETH";
|
|
226
286
|
destChain: "Ethereum";
|
|
227
|
-
destAsset: "FLIP" | "USDC";
|
|
287
|
+
destAsset: "FLIP" | "USDC" | "USDT";
|
|
228
288
|
destAddress: string;
|
|
229
289
|
}>, z.ZodObject<{
|
|
230
290
|
amount: z.ZodString;
|
|
@@ -274,20 +334,20 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
274
334
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
275
335
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
276
336
|
srcAsset: z.ZodLiteral<"FLIP">;
|
|
277
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
|
|
337
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">, z.ZodLiteral<"USDT">]>;
|
|
278
338
|
}, "strip", z.ZodTypeAny, {
|
|
279
339
|
amount: string;
|
|
280
340
|
srcChain: "Ethereum";
|
|
281
341
|
srcAsset: "FLIP";
|
|
282
342
|
destChain: "Ethereum";
|
|
283
|
-
destAsset: "USDC" | "ETH";
|
|
343
|
+
destAsset: "USDC" | "ETH" | "USDT";
|
|
284
344
|
destAddress: `0x${string}`;
|
|
285
345
|
}, {
|
|
286
346
|
amount: string;
|
|
287
347
|
srcChain: "Ethereum";
|
|
288
348
|
srcAsset: "FLIP";
|
|
289
349
|
destChain: "Ethereum";
|
|
290
|
-
destAsset: "USDC" | "ETH";
|
|
350
|
+
destAsset: "USDC" | "ETH" | "USDT";
|
|
291
351
|
destAddress: string;
|
|
292
352
|
}>, z.ZodObject<{
|
|
293
353
|
amount: z.ZodString;
|
|
@@ -295,20 +355,41 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
295
355
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
296
356
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
297
357
|
srcAsset: z.ZodLiteral<"USDC">;
|
|
298
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
|
|
358
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">, z.ZodLiteral<"USDT">]>;
|
|
299
359
|
}, "strip", z.ZodTypeAny, {
|
|
300
360
|
amount: string;
|
|
301
361
|
srcChain: "Ethereum";
|
|
302
362
|
srcAsset: "USDC";
|
|
303
363
|
destChain: "Ethereum";
|
|
304
|
-
destAsset: "FLIP" | "ETH";
|
|
364
|
+
destAsset: "FLIP" | "ETH" | "USDT";
|
|
305
365
|
destAddress: `0x${string}`;
|
|
306
366
|
}, {
|
|
307
367
|
amount: string;
|
|
308
368
|
srcChain: "Ethereum";
|
|
309
369
|
srcAsset: "USDC";
|
|
310
370
|
destChain: "Ethereum";
|
|
311
|
-
destAsset: "FLIP" | "ETH";
|
|
371
|
+
destAsset: "FLIP" | "ETH" | "USDT";
|
|
372
|
+
destAddress: string;
|
|
373
|
+
}>, z.ZodObject<{
|
|
374
|
+
amount: z.ZodString;
|
|
375
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
376
|
+
destChain: z.ZodLiteral<"Ethereum">;
|
|
377
|
+
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
378
|
+
srcAsset: z.ZodLiteral<"USDT">;
|
|
379
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">, z.ZodLiteral<"USDC">]>;
|
|
380
|
+
}, "strip", z.ZodTypeAny, {
|
|
381
|
+
amount: string;
|
|
382
|
+
srcChain: "Ethereum";
|
|
383
|
+
srcAsset: "USDT";
|
|
384
|
+
destChain: "Ethereum";
|
|
385
|
+
destAsset: "FLIP" | "USDC" | "ETH";
|
|
386
|
+
destAddress: `0x${string}`;
|
|
387
|
+
}, {
|
|
388
|
+
amount: string;
|
|
389
|
+
srcChain: "Ethereum";
|
|
390
|
+
srcAsset: "USDT";
|
|
391
|
+
destChain: "Ethereum";
|
|
392
|
+
destAsset: "FLIP" | "USDC" | "ETH";
|
|
312
393
|
destAddress: string;
|
|
313
394
|
}>, z.ZodObject<{
|
|
314
395
|
amount: z.ZodString;
|
|
@@ -316,18 +397,18 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
316
397
|
destChain: z.ZodLiteral<"Polkadot">;
|
|
317
398
|
destAsset: z.ZodLiteral<"DOT">;
|
|
318
399
|
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>;
|
|
319
|
-
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
400
|
+
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">, z.ZodLiteral<"USDT">]>;
|
|
320
401
|
}, "strip", z.ZodTypeAny, {
|
|
321
402
|
amount: string;
|
|
322
403
|
srcChain: "Ethereum";
|
|
323
|
-
srcAsset: "FLIP" | "USDC";
|
|
404
|
+
srcAsset: "FLIP" | "USDC" | "USDT";
|
|
324
405
|
destChain: "Polkadot";
|
|
325
406
|
destAsset: "DOT";
|
|
326
407
|
destAddress: string;
|
|
327
408
|
}, {
|
|
328
409
|
amount: string;
|
|
329
410
|
srcChain: "Ethereum";
|
|
330
|
-
srcAsset: "FLIP" | "USDC";
|
|
411
|
+
srcAsset: "FLIP" | "USDC" | "USDT";
|
|
331
412
|
destChain: "Polkadot";
|
|
332
413
|
destAsset: "DOT";
|
|
333
414
|
destAddress: string;
|
|
@@ -337,18 +418,18 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
337
418
|
destChain: z.ZodLiteral<"Bitcoin">;
|
|
338
419
|
destAsset: z.ZodLiteral<"BTC">;
|
|
339
420
|
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
|
-
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
421
|
+
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">, z.ZodLiteral<"USDT">]>;
|
|
341
422
|
}, "strip", z.ZodTypeAny, {
|
|
342
423
|
amount: string;
|
|
343
424
|
srcChain: "Ethereum";
|
|
344
|
-
srcAsset: "FLIP" | "USDC";
|
|
425
|
+
srcAsset: "FLIP" | "USDC" | "USDT";
|
|
345
426
|
destChain: "Bitcoin";
|
|
346
427
|
destAsset: "BTC";
|
|
347
428
|
destAddress: string;
|
|
348
429
|
}, {
|
|
349
430
|
amount: string;
|
|
350
431
|
srcChain: "Ethereum";
|
|
351
|
-
srcAsset: "FLIP" | "USDC";
|
|
432
|
+
srcAsset: "FLIP" | "USDC" | "USDT";
|
|
352
433
|
destChain: "Bitcoin";
|
|
353
434
|
destAsset: "BTC";
|
|
354
435
|
destAddress: string;
|
package/dist/swap.js
CHANGED
|
@@ -85,7 +85,8 @@ function getInternalAsset(asset2) {
|
|
|
85
85
|
[exports.Chains.Ethereum]: {
|
|
86
86
|
[exports.Assets.USDC]: exports.ChainflipIds.Usdc,
|
|
87
87
|
[exports.Assets.FLIP]: exports.ChainflipIds.Flip,
|
|
88
|
-
[exports.Assets.ETH]: exports.ChainflipIds.Eth
|
|
88
|
+
[exports.Assets.ETH]: exports.ChainflipIds.Eth,
|
|
89
|
+
[exports.Assets.USDT]: exports.ChainflipIds.Usdt
|
|
89
90
|
},
|
|
90
91
|
[exports.Chains.Bitcoin]: {
|
|
91
92
|
[exports.Assets.BTC]: exports.ChainflipIds.Btc
|
|
@@ -108,7 +109,8 @@ var init_enums = __esm({
|
|
|
108
109
|
"Usdc",
|
|
109
110
|
"Dot",
|
|
110
111
|
"Eth",
|
|
111
|
-
"Btc"
|
|
112
|
+
"Btc",
|
|
113
|
+
"Usdt"
|
|
112
114
|
]);
|
|
113
115
|
exports.Chains = arrayToMap([
|
|
114
116
|
"Bitcoin",
|
|
@@ -120,7 +122,8 @@ var init_enums = __esm({
|
|
|
120
122
|
"USDC",
|
|
121
123
|
"DOT",
|
|
122
124
|
"ETH",
|
|
123
|
-
"BTC"
|
|
125
|
+
"BTC",
|
|
126
|
+
"USDT"
|
|
124
127
|
]);
|
|
125
128
|
exports.ChainflipNetworks = arrayToMap([
|
|
126
129
|
"backspin",
|
|
@@ -151,6 +154,13 @@ var init_enums = __esm({
|
|
|
151
154
|
decimals: 6,
|
|
152
155
|
contractId: 3
|
|
153
156
|
},
|
|
157
|
+
[exports.ChainflipIds.Usdt]: {
|
|
158
|
+
chain: exports.Chains.Ethereum,
|
|
159
|
+
asset: exports.Assets.USDT,
|
|
160
|
+
name: "USDT",
|
|
161
|
+
decimals: 6,
|
|
162
|
+
contractId: 8
|
|
163
|
+
},
|
|
154
164
|
[exports.ChainflipIds.Dot]: {
|
|
155
165
|
chain: exports.Chains.Polkadot,
|
|
156
166
|
asset: exports.Assets.DOT,
|
|
@@ -171,7 +181,8 @@ var init_enums = __esm({
|
|
|
171
181
|
assets: [
|
|
172
182
|
exports.Assets.ETH,
|
|
173
183
|
exports.Assets.FLIP,
|
|
174
|
-
exports.Assets.USDC
|
|
184
|
+
exports.Assets.USDC,
|
|
185
|
+
exports.Assets.USDT
|
|
175
186
|
],
|
|
176
187
|
gasAsset: exports.Assets.ETH,
|
|
177
188
|
contractId: 1,
|
|
@@ -7036,21 +7047,20 @@ var fundingEnvironment = z.object({
|
|
|
7036
7047
|
minimum_funding_amount: numberOrHex
|
|
7037
7048
|
});
|
|
7038
7049
|
createRequest("cf_funding_environment", fundingEnvironment);
|
|
7039
|
-
var
|
|
7050
|
+
var chainAssetMapFactory = /* @__PURE__ */ __name((parser, defaultValue) => z.object({
|
|
7040
7051
|
Bitcoin: z.object({
|
|
7041
7052
|
BTC: parser
|
|
7042
7053
|
}),
|
|
7043
7054
|
Ethereum: z.object({
|
|
7044
7055
|
ETH: parser,
|
|
7045
7056
|
USDC: parser,
|
|
7046
|
-
FLIP: parser
|
|
7057
|
+
FLIP: parser,
|
|
7058
|
+
USDT: parser.default(defaultValue)
|
|
7047
7059
|
}),
|
|
7048
7060
|
Polkadot: z.object({
|
|
7049
7061
|
DOT: parser
|
|
7050
7062
|
})
|
|
7051
|
-
}), "
|
|
7052
|
-
var chainAssetNumberMap = chainAssetMap(numberOrHex);
|
|
7053
|
-
var chainAssetNumberNullableMap = chainAssetMap(numberOrHex.nullable());
|
|
7063
|
+
}), "chainAssetMapFactory");
|
|
7054
7064
|
var chainMap = /* @__PURE__ */ __name((parser) => z.object({
|
|
7055
7065
|
Bitcoin: parser,
|
|
7056
7066
|
Ethereum: parser,
|
|
@@ -7058,7 +7068,7 @@ var chainMap = /* @__PURE__ */ __name((parser) => z.object({
|
|
|
7058
7068
|
}), "chainMap");
|
|
7059
7069
|
var chainNumberNullableMap = chainMap(numberOrHex.nullable());
|
|
7060
7070
|
var swappingEnvironment = z.object({
|
|
7061
|
-
maximum_swap_amounts:
|
|
7071
|
+
maximum_swap_amounts: chainAssetMapFactory(numberOrHex.nullable(), null)
|
|
7062
7072
|
});
|
|
7063
7073
|
createRequest("cf_swapping_environment", swappingEnvironment);
|
|
7064
7074
|
var rename = /* @__PURE__ */ __name((mapping) => (obj) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [
|
|
@@ -7066,19 +7076,20 @@ var rename = /* @__PURE__ */ __name((mapping) => (obj) => Object.fromEntries(Obj
|
|
|
7066
7076
|
value
|
|
7067
7077
|
])), "rename");
|
|
7068
7078
|
var ingressEgressEnvironment = z.object({
|
|
7069
|
-
minimum_deposit_amounts:
|
|
7070
|
-
ingress_fees:
|
|
7071
|
-
egress_fees:
|
|
7079
|
+
minimum_deposit_amounts: chainAssetMapFactory(numberOrHex, 0),
|
|
7080
|
+
ingress_fees: chainAssetMapFactory(numberOrHex, 0),
|
|
7081
|
+
egress_fees: chainAssetMapFactory(numberOrHex, 0),
|
|
7072
7082
|
witness_safety_margins: chainNumberNullableMap,
|
|
7073
7083
|
// TODO(1.2): remove optional and default value
|
|
7074
|
-
egress_dust_limits:
|
|
7084
|
+
egress_dust_limits: chainAssetMapFactory(numberOrHex, 1).optional().default({
|
|
7075
7085
|
Bitcoin: {
|
|
7076
7086
|
BTC: 600
|
|
7077
7087
|
},
|
|
7078
7088
|
Ethereum: {
|
|
7079
7089
|
ETH: 1,
|
|
7080
7090
|
USDC: 1,
|
|
7081
|
-
FLIP: 1
|
|
7091
|
+
FLIP: 1,
|
|
7092
|
+
USDT: 1
|
|
7082
7093
|
},
|
|
7083
7094
|
Polkadot: {
|
|
7084
7095
|
DOT: 1
|
|
@@ -7208,7 +7219,8 @@ var ethToBtc = /* @__PURE__ */ __name((network) => eth.extend({
|
|
|
7208
7219
|
}), "ethToBtc");
|
|
7209
7220
|
var erc20Asset = z.union([
|
|
7210
7221
|
z.literal(exports.Assets.FLIP),
|
|
7211
|
-
z.literal(exports.Assets.USDC)
|
|
7222
|
+
z.literal(exports.Assets.USDC),
|
|
7223
|
+
z.literal(exports.Assets.USDT)
|
|
7212
7224
|
]);
|
|
7213
7225
|
var ethToERC20 = ethToEthereum.extend({
|
|
7214
7226
|
destAsset: erc20Asset
|
|
@@ -7222,14 +7234,24 @@ var flipToEthereumAsset = ethToEthereum.extend({
|
|
|
7222
7234
|
srcAsset: z.literal(exports.Assets.FLIP),
|
|
7223
7235
|
destAsset: z.union([
|
|
7224
7236
|
z.literal(exports.Assets.USDC),
|
|
7225
|
-
z.literal(exports.Assets.ETH)
|
|
7237
|
+
z.literal(exports.Assets.ETH),
|
|
7238
|
+
z.literal(exports.Assets.USDT)
|
|
7226
7239
|
])
|
|
7227
7240
|
});
|
|
7228
7241
|
var usdcToEthereumAsset = ethToEthereum.extend({
|
|
7229
7242
|
srcAsset: z.literal(exports.Assets.USDC),
|
|
7230
7243
|
destAsset: z.union([
|
|
7231
7244
|
z.literal(exports.Assets.FLIP),
|
|
7232
|
-
z.literal(exports.Assets.ETH)
|
|
7245
|
+
z.literal(exports.Assets.ETH),
|
|
7246
|
+
z.literal(exports.Assets.USDT)
|
|
7247
|
+
])
|
|
7248
|
+
});
|
|
7249
|
+
var usdtToEthereumAsset = ethToEthereum.extend({
|
|
7250
|
+
srcAsset: z.literal(exports.Assets.USDT),
|
|
7251
|
+
destAsset: z.union([
|
|
7252
|
+
z.literal(exports.Assets.FLIP),
|
|
7253
|
+
z.literal(exports.Assets.ETH),
|
|
7254
|
+
z.literal(exports.Assets.USDC)
|
|
7233
7255
|
])
|
|
7234
7256
|
});
|
|
7235
7257
|
var erc20ToDot = ethToDot.extend({
|
|
@@ -7241,6 +7263,7 @@ var erc20ToBtc = /* @__PURE__ */ __name((network) => ethToBtc(network).extend({
|
|
|
7241
7263
|
var tokenSwapParamsSchema = /* @__PURE__ */ __name((network) => z.union([
|
|
7242
7264
|
flipToEthereumAsset,
|
|
7243
7265
|
usdcToEthereumAsset,
|
|
7266
|
+
usdtToEthereumAsset,
|
|
7244
7267
|
erc20ToDot,
|
|
7245
7268
|
erc20ToBtc(network)
|
|
7246
7269
|
]), "tokenSwapParamsSchema");
|
|
@@ -7250,9 +7273,13 @@ var ccmFlipToEthereumAssset = flipToEthereumAsset.extend({
|
|
|
7250
7273
|
var ccmUsdcToEthereumAsset = usdcToEthereumAsset.extend({
|
|
7251
7274
|
ccmMetadata: ccmMetadataSchema
|
|
7252
7275
|
});
|
|
7276
|
+
var ccmUsdtToEthereumAsset = usdtToEthereumAsset.extend({
|
|
7277
|
+
ccmMetadata: ccmMetadataSchema
|
|
7278
|
+
});
|
|
7253
7279
|
var tokenCallParamsSchema = z.union([
|
|
7254
7280
|
ccmFlipToEthereumAssset,
|
|
7255
|
-
ccmUsdcToEthereumAsset
|
|
7281
|
+
ccmUsdcToEthereumAsset,
|
|
7282
|
+
ccmUsdtToEthereumAsset
|
|
7256
7283
|
]);
|
|
7257
7284
|
var nativeCallParamsSchema = ethToERC20.extend({
|
|
7258
7285
|
ccmMetadata: ccmMetadataSchema
|
|
@@ -8765,6 +8792,7 @@ var assetFactory = /* @__PURE__ */ __name((asset2) => (network, env) => ({
|
|
|
8765
8792
|
var eth$ = assetFactory("Eth");
|
|
8766
8793
|
var usdc$ = assetFactory("Usdc");
|
|
8767
8794
|
var flip$ = assetFactory("Flip");
|
|
8795
|
+
var usdt$ = assetFactory("Usdt");
|
|
8768
8796
|
var dot$ = assetFactory("Dot");
|
|
8769
8797
|
var btc$ = assetFactory("Btc");
|
|
8770
8798
|
|
|
@@ -8788,39 +8816,50 @@ var getChains = /* @__PURE__ */ __name(async (network, env) => [
|
|
|
8788
8816
|
bitcoin(network, env)
|
|
8789
8817
|
], "getChains");
|
|
8790
8818
|
var getPossibleDestinationChains = /* @__PURE__ */ __name(async (sourceChain, network, env) => {
|
|
8791
|
-
if (sourceChain === exports.Chains.Ethereum)
|
|
8819
|
+
if (sourceChain === exports.Chains.Ethereum) {
|
|
8792
8820
|
return [
|
|
8793
8821
|
ethereum(network, env),
|
|
8794
8822
|
bitcoin(network, env),
|
|
8795
8823
|
polkadot(network, env)
|
|
8796
8824
|
];
|
|
8797
|
-
|
|
8825
|
+
}
|
|
8826
|
+
if (sourceChain === exports.Chains.Polkadot) {
|
|
8798
8827
|
return [
|
|
8799
8828
|
ethereum(network, env),
|
|
8800
8829
|
bitcoin(network, env)
|
|
8801
8830
|
];
|
|
8802
|
-
|
|
8831
|
+
}
|
|
8832
|
+
if (sourceChain === exports.Chains.Bitcoin) {
|
|
8803
8833
|
return [
|
|
8804
8834
|
ethereum(network, env),
|
|
8805
8835
|
polkadot(network, env)
|
|
8806
8836
|
];
|
|
8837
|
+
}
|
|
8807
8838
|
throw new Error("received unknown chain");
|
|
8808
8839
|
}, "getPossibleDestinationChains");
|
|
8809
8840
|
var getAssets = /* @__PURE__ */ __name(async (chain2, network, env) => {
|
|
8810
|
-
if (chain2 === exports.Chains.Ethereum)
|
|
8811
|
-
return [
|
|
8841
|
+
if (chain2 === exports.Chains.Ethereum) {
|
|
8842
|
+
return network === exports.ChainflipNetworks.backspin || network === exports.ChainflipNetworks.sisyphos ? [
|
|
8843
|
+
eth$(network, env),
|
|
8844
|
+
usdc$(network, env),
|
|
8845
|
+
flip$(network, env),
|
|
8846
|
+
usdt$(network, env)
|
|
8847
|
+
] : [
|
|
8812
8848
|
eth$(network, env),
|
|
8813
8849
|
usdc$(network, env),
|
|
8814
8850
|
flip$(network, env)
|
|
8815
8851
|
];
|
|
8816
|
-
|
|
8852
|
+
}
|
|
8853
|
+
if (chain2 === exports.Chains.Polkadot) {
|
|
8817
8854
|
return [
|
|
8818
8855
|
dot$(network, env)
|
|
8819
8856
|
];
|
|
8820
|
-
|
|
8857
|
+
}
|
|
8858
|
+
if (chain2 === exports.Chains.Bitcoin) {
|
|
8821
8859
|
return [
|
|
8822
8860
|
btc$(network, env)
|
|
8823
8861
|
];
|
|
8862
|
+
}
|
|
8824
8863
|
throw new Error("received unexpected chain");
|
|
8825
8864
|
}, "getAssets");
|
|
8826
8865
|
var getQuote = /* @__PURE__ */ __name(async (baseUrl, quoteRequest, { signal }) => {
|