@chainflip/sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-BSY2FXE7.mjs → chunk-VIR4Q4NH.mjs} +2 -2
- package/dist/funding.mjs +1 -1
- package/dist/swap.d.ts +114 -30
- package/dist/swap.js +9 -7
- package/dist/swap.mjs +9 -7
- package/package.json +3 -3
|
@@ -2078,8 +2078,8 @@ function assert(condition, message) {
|
|
|
2078
2078
|
throw error;
|
|
2079
2079
|
}
|
|
2080
2080
|
__name(assert, "assert");
|
|
2081
|
-
var isTokenSwap = /* @__PURE__ */ __name((params) =>
|
|
2082
|
-
var isTokenCall = /* @__PURE__ */ __name((params) =>
|
|
2081
|
+
var isTokenSwap = /* @__PURE__ */ __name((params) => params.srcAsset !== Assets.ETH, "isTokenSwap");
|
|
2082
|
+
var isTokenCall = /* @__PURE__ */ __name((params) => params.srcAsset !== Assets.ETH, "isTokenCall");
|
|
2083
2083
|
|
|
2084
2084
|
// ../shared/src/contracts.ts
|
|
2085
2085
|
var getTokenContractAddress = /* @__PURE__ */ __name((asset, network) => {
|
package/dist/funding.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __name, ChainflipNetworks, getFlipBalance, getStateChainGatewayContractAddress, approve, getTokenContractAddress, Assets, checkAllowance, assert, StateChainGateway__factory } from './chunk-
|
|
1
|
+
import { __name, ChainflipNetworks, getFlipBalance, getStateChainGatewayContractAddress, approve, getTokenContractAddress, Assets, checkAllowance, assert, StateChainGateway__factory } from './chunk-VIR4Q4NH.mjs';
|
|
2
2
|
|
|
3
3
|
// ../shared/src/stateChainGateway/utils.ts
|
|
4
4
|
var getStateChainGateway = /* @__PURE__ */ __name((options) => {
|
package/dist/swap.d.ts
CHANGED
|
@@ -5,208 +5,254 @@ import { z } from 'zod';
|
|
|
5
5
|
|
|
6
6
|
declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
7
7
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
8
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
8
9
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
9
10
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
10
11
|
srcAsset: z.ZodLiteral<"FLIP">;
|
|
11
12
|
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
|
|
12
13
|
}, "strip", z.ZodTypeAny, {
|
|
13
14
|
amount: string | bigint;
|
|
15
|
+
srcChain: "Ethereum";
|
|
16
|
+
srcAsset: "FLIP";
|
|
14
17
|
destChain: "Ethereum";
|
|
15
18
|
destAddress: `0x${string}`;
|
|
16
19
|
destAsset: "USDC" | "ETH";
|
|
17
|
-
srcAsset: "FLIP";
|
|
18
20
|
}, {
|
|
19
21
|
amount: string | bigint;
|
|
22
|
+
srcChain: "Ethereum";
|
|
23
|
+
srcAsset: "FLIP";
|
|
20
24
|
destChain: "Ethereum";
|
|
21
25
|
destAddress: `0x${string}`;
|
|
22
26
|
destAsset: "USDC" | "ETH";
|
|
23
|
-
srcAsset: "FLIP";
|
|
24
27
|
}>, z.ZodObject<{
|
|
25
28
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
29
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
26
30
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
27
31
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
28
32
|
srcAsset: z.ZodLiteral<"USDC">;
|
|
29
33
|
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
|
|
30
34
|
}, "strip", z.ZodTypeAny, {
|
|
31
35
|
amount: string | bigint;
|
|
36
|
+
srcChain: "Ethereum";
|
|
37
|
+
srcAsset: "USDC";
|
|
32
38
|
destChain: "Ethereum";
|
|
33
39
|
destAddress: `0x${string}`;
|
|
34
40
|
destAsset: "FLIP" | "ETH";
|
|
35
|
-
srcAsset: "USDC";
|
|
36
41
|
}, {
|
|
37
42
|
amount: string | bigint;
|
|
43
|
+
srcChain: "Ethereum";
|
|
44
|
+
srcAsset: "USDC";
|
|
38
45
|
destChain: "Ethereum";
|
|
39
46
|
destAddress: `0x${string}`;
|
|
40
47
|
destAsset: "FLIP" | "ETH";
|
|
41
|
-
srcAsset: "USDC";
|
|
42
48
|
}>, z.ZodObject<{
|
|
43
49
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
50
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
44
51
|
destChain: z.ZodLiteral<"Polkadot">;
|
|
45
52
|
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>;
|
|
46
53
|
destAsset: z.ZodLiteral<"DOT">;
|
|
47
54
|
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
48
|
-
}, "
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
56
|
amount: string | bigint;
|
|
57
|
+
srcChain: "Ethereum";
|
|
58
|
+
srcAsset: "FLIP" | "USDC";
|
|
50
59
|
destChain: "Polkadot";
|
|
51
60
|
destAddress: string;
|
|
52
61
|
destAsset: "DOT";
|
|
53
|
-
srcAsset: "FLIP" | "USDC";
|
|
54
62
|
}, {
|
|
55
63
|
amount: string | bigint;
|
|
64
|
+
srcChain: "Ethereum";
|
|
65
|
+
srcAsset: "FLIP" | "USDC";
|
|
56
66
|
destChain: "Polkadot";
|
|
57
67
|
destAddress: string;
|
|
58
68
|
destAsset: "DOT";
|
|
59
|
-
srcAsset: "FLIP" | "USDC";
|
|
60
69
|
}>, z.ZodObject<{
|
|
61
70
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
71
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
62
72
|
destChain: z.ZodLiteral<"Bitcoin">;
|
|
63
73
|
destAddress: z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
|
|
64
74
|
destAsset: z.ZodLiteral<"BTC">;
|
|
65
75
|
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
66
|
-
}, "
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
77
|
amount: string | bigint;
|
|
78
|
+
srcChain: "Ethereum";
|
|
79
|
+
srcAsset: "FLIP" | "USDC";
|
|
68
80
|
destChain: "Bitcoin";
|
|
69
81
|
destAddress: string;
|
|
70
82
|
destAsset: "BTC";
|
|
71
|
-
srcAsset: "FLIP" | "USDC";
|
|
72
83
|
}, {
|
|
73
84
|
amount: string | bigint;
|
|
85
|
+
srcChain: "Ethereum";
|
|
86
|
+
srcAsset: "FLIP" | "USDC";
|
|
74
87
|
destChain: "Bitcoin";
|
|
75
88
|
destAddress: string;
|
|
76
89
|
destAsset: "BTC";
|
|
77
|
-
srcAsset: "FLIP" | "USDC";
|
|
78
90
|
}>]>;
|
|
79
91
|
type TokenSwapParams = z.infer<typeof tokenSwapParamsSchema>;
|
|
80
92
|
declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
81
93
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
94
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
95
|
+
srcAsset: z.ZodLiteral<"ETH">;
|
|
82
96
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
83
97
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
84
98
|
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
85
|
-
}, "
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
100
|
amount: string | bigint;
|
|
101
|
+
srcChain: "Ethereum";
|
|
102
|
+
srcAsset: "ETH";
|
|
87
103
|
destChain: "Ethereum";
|
|
88
104
|
destAddress: `0x${string}`;
|
|
89
105
|
destAsset: "FLIP" | "USDC";
|
|
90
106
|
}, {
|
|
91
107
|
amount: string | bigint;
|
|
108
|
+
srcChain: "Ethereum";
|
|
109
|
+
srcAsset: "ETH";
|
|
92
110
|
destChain: "Ethereum";
|
|
93
111
|
destAddress: `0x${string}`;
|
|
94
112
|
destAsset: "FLIP" | "USDC";
|
|
95
113
|
}>, z.ZodObject<{
|
|
96
114
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
115
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
116
|
+
srcAsset: z.ZodLiteral<"ETH">;
|
|
97
117
|
destChain: z.ZodLiteral<"Polkadot">;
|
|
98
118
|
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>;
|
|
99
119
|
destAsset: z.ZodLiteral<"DOT">;
|
|
100
|
-
}, "
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
121
|
amount: string | bigint;
|
|
122
|
+
srcChain: "Ethereum";
|
|
123
|
+
srcAsset: "ETH";
|
|
102
124
|
destChain: "Polkadot";
|
|
103
125
|
destAddress: string;
|
|
104
126
|
destAsset: "DOT";
|
|
105
127
|
}, {
|
|
106
128
|
amount: string | bigint;
|
|
129
|
+
srcChain: "Ethereum";
|
|
130
|
+
srcAsset: "ETH";
|
|
107
131
|
destChain: "Polkadot";
|
|
108
132
|
destAddress: string;
|
|
109
133
|
destAsset: "DOT";
|
|
110
134
|
}>, z.ZodObject<{
|
|
111
135
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
136
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
137
|
+
srcAsset: z.ZodLiteral<"ETH">;
|
|
112
138
|
destChain: z.ZodLiteral<"Bitcoin">;
|
|
113
139
|
destAddress: z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
|
|
114
140
|
destAsset: z.ZodLiteral<"BTC">;
|
|
115
|
-
}, "
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
142
|
amount: string | bigint;
|
|
143
|
+
srcChain: "Ethereum";
|
|
144
|
+
srcAsset: "ETH";
|
|
117
145
|
destChain: "Bitcoin";
|
|
118
146
|
destAddress: string;
|
|
119
147
|
destAsset: "BTC";
|
|
120
148
|
}, {
|
|
121
149
|
amount: string | bigint;
|
|
150
|
+
srcChain: "Ethereum";
|
|
151
|
+
srcAsset: "ETH";
|
|
122
152
|
destChain: "Bitcoin";
|
|
123
153
|
destAddress: string;
|
|
124
154
|
destAsset: "BTC";
|
|
125
155
|
}>]>, z.ZodUnion<[z.ZodObject<{
|
|
126
156
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
157
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
127
158
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
128
159
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
129
160
|
srcAsset: z.ZodLiteral<"FLIP">;
|
|
130
161
|
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
|
|
131
162
|
}, "strip", z.ZodTypeAny, {
|
|
132
163
|
amount: string | bigint;
|
|
164
|
+
srcChain: "Ethereum";
|
|
165
|
+
srcAsset: "FLIP";
|
|
133
166
|
destChain: "Ethereum";
|
|
134
167
|
destAddress: `0x${string}`;
|
|
135
168
|
destAsset: "USDC" | "ETH";
|
|
136
|
-
srcAsset: "FLIP";
|
|
137
169
|
}, {
|
|
138
170
|
amount: string | bigint;
|
|
171
|
+
srcChain: "Ethereum";
|
|
172
|
+
srcAsset: "FLIP";
|
|
139
173
|
destChain: "Ethereum";
|
|
140
174
|
destAddress: `0x${string}`;
|
|
141
175
|
destAsset: "USDC" | "ETH";
|
|
142
|
-
srcAsset: "FLIP";
|
|
143
176
|
}>, z.ZodObject<{
|
|
144
177
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
178
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
145
179
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
146
180
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
147
181
|
srcAsset: z.ZodLiteral<"USDC">;
|
|
148
182
|
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
|
|
149
183
|
}, "strip", z.ZodTypeAny, {
|
|
150
184
|
amount: string | bigint;
|
|
185
|
+
srcChain: "Ethereum";
|
|
186
|
+
srcAsset: "USDC";
|
|
151
187
|
destChain: "Ethereum";
|
|
152
188
|
destAddress: `0x${string}`;
|
|
153
189
|
destAsset: "FLIP" | "ETH";
|
|
154
|
-
srcAsset: "USDC";
|
|
155
190
|
}, {
|
|
156
191
|
amount: string | bigint;
|
|
192
|
+
srcChain: "Ethereum";
|
|
193
|
+
srcAsset: "USDC";
|
|
157
194
|
destChain: "Ethereum";
|
|
158
195
|
destAddress: `0x${string}`;
|
|
159
196
|
destAsset: "FLIP" | "ETH";
|
|
160
|
-
srcAsset: "USDC";
|
|
161
197
|
}>, z.ZodObject<{
|
|
162
198
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
199
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
163
200
|
destChain: z.ZodLiteral<"Polkadot">;
|
|
164
201
|
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>;
|
|
165
202
|
destAsset: z.ZodLiteral<"DOT">;
|
|
166
203
|
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
167
|
-
}, "
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
168
205
|
amount: string | bigint;
|
|
206
|
+
srcChain: "Ethereum";
|
|
207
|
+
srcAsset: "FLIP" | "USDC";
|
|
169
208
|
destChain: "Polkadot";
|
|
170
209
|
destAddress: string;
|
|
171
210
|
destAsset: "DOT";
|
|
172
|
-
srcAsset: "FLIP" | "USDC";
|
|
173
211
|
}, {
|
|
174
212
|
amount: string | bigint;
|
|
213
|
+
srcChain: "Ethereum";
|
|
214
|
+
srcAsset: "FLIP" | "USDC";
|
|
175
215
|
destChain: "Polkadot";
|
|
176
216
|
destAddress: string;
|
|
177
217
|
destAsset: "DOT";
|
|
178
|
-
srcAsset: "FLIP" | "USDC";
|
|
179
218
|
}>, z.ZodObject<{
|
|
180
219
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
220
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
181
221
|
destChain: z.ZodLiteral<"Bitcoin">;
|
|
182
222
|
destAddress: z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
|
|
183
223
|
destAsset: z.ZodLiteral<"BTC">;
|
|
184
224
|
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
185
|
-
}, "
|
|
225
|
+
}, "strip", z.ZodTypeAny, {
|
|
186
226
|
amount: string | bigint;
|
|
227
|
+
srcChain: "Ethereum";
|
|
228
|
+
srcAsset: "FLIP" | "USDC";
|
|
187
229
|
destChain: "Bitcoin";
|
|
188
230
|
destAddress: string;
|
|
189
231
|
destAsset: "BTC";
|
|
190
|
-
srcAsset: "FLIP" | "USDC";
|
|
191
232
|
}, {
|
|
192
233
|
amount: string | bigint;
|
|
234
|
+
srcChain: "Ethereum";
|
|
235
|
+
srcAsset: "FLIP" | "USDC";
|
|
193
236
|
destChain: "Bitcoin";
|
|
194
237
|
destAddress: string;
|
|
195
238
|
destAsset: "BTC";
|
|
196
|
-
srcAsset: "FLIP" | "USDC";
|
|
197
239
|
}>]>]>;
|
|
198
240
|
type ExecuteSwapParams = z.infer<typeof executeSwapParamsSchema>;
|
|
199
241
|
declare const executeCallParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
200
242
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
243
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
244
|
+
srcAsset: z.ZodLiteral<"ETH">;
|
|
201
245
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
202
246
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
203
247
|
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
204
248
|
message: z.ZodString;
|
|
205
249
|
gasAmount: z.ZodString;
|
|
206
|
-
}, "
|
|
250
|
+
}, "strip", z.ZodTypeAny, {
|
|
207
251
|
amount: string | bigint;
|
|
208
252
|
message: string;
|
|
209
253
|
gasAmount: string;
|
|
254
|
+
srcChain: "Ethereum";
|
|
255
|
+
srcAsset: "ETH";
|
|
210
256
|
destChain: "Ethereum";
|
|
211
257
|
destAddress: `0x${string}`;
|
|
212
258
|
destAsset: "FLIP" | "USDC";
|
|
@@ -214,11 +260,14 @@ declare const executeCallParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
214
260
|
amount: string | bigint;
|
|
215
261
|
message: string;
|
|
216
262
|
gasAmount: string;
|
|
263
|
+
srcChain: "Ethereum";
|
|
264
|
+
srcAsset: "ETH";
|
|
217
265
|
destChain: "Ethereum";
|
|
218
266
|
destAddress: `0x${string}`;
|
|
219
267
|
destAsset: "FLIP" | "USDC";
|
|
220
268
|
}>, z.ZodUnion<[z.ZodObject<{
|
|
221
269
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
270
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
222
271
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
223
272
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
224
273
|
srcAsset: z.ZodLiteral<"FLIP">;
|
|
@@ -229,20 +278,23 @@ declare const executeCallParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
229
278
|
amount: string | bigint;
|
|
230
279
|
message: `0x${string}`;
|
|
231
280
|
gasAmount: string;
|
|
281
|
+
srcChain: "Ethereum";
|
|
282
|
+
srcAsset: "FLIP";
|
|
232
283
|
destChain: "Ethereum";
|
|
233
284
|
destAddress: `0x${string}`;
|
|
234
285
|
destAsset: "USDC" | "ETH";
|
|
235
|
-
srcAsset: "FLIP";
|
|
236
286
|
}, {
|
|
237
287
|
amount: string | bigint;
|
|
238
288
|
message: `0x${string}`;
|
|
239
289
|
gasAmount: string;
|
|
290
|
+
srcChain: "Ethereum";
|
|
291
|
+
srcAsset: "FLIP";
|
|
240
292
|
destChain: "Ethereum";
|
|
241
293
|
destAddress: `0x${string}`;
|
|
242
294
|
destAsset: "USDC" | "ETH";
|
|
243
|
-
srcAsset: "FLIP";
|
|
244
295
|
}>, z.ZodObject<{
|
|
245
296
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
297
|
+
srcChain: z.ZodLiteral<"Ethereum">;
|
|
246
298
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
247
299
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
248
300
|
srcAsset: z.ZodLiteral<"USDC">;
|
|
@@ -253,18 +305,20 @@ declare const executeCallParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
253
305
|
amount: string | bigint;
|
|
254
306
|
message: `0x${string}`;
|
|
255
307
|
gasAmount: string;
|
|
308
|
+
srcChain: "Ethereum";
|
|
309
|
+
srcAsset: "USDC";
|
|
256
310
|
destChain: "Ethereum";
|
|
257
311
|
destAddress: `0x${string}`;
|
|
258
312
|
destAsset: "FLIP" | "ETH";
|
|
259
|
-
srcAsset: "USDC";
|
|
260
313
|
}, {
|
|
261
314
|
amount: string | bigint;
|
|
262
315
|
message: `0x${string}`;
|
|
263
316
|
gasAmount: string;
|
|
317
|
+
srcChain: "Ethereum";
|
|
318
|
+
srcAsset: "USDC";
|
|
264
319
|
destChain: "Ethereum";
|
|
265
320
|
destAddress: `0x${string}`;
|
|
266
321
|
destAsset: "FLIP" | "ETH";
|
|
267
|
-
srcAsset: "USDC";
|
|
268
322
|
}>]>]>;
|
|
269
323
|
type ExecuteCallParams = z.infer<typeof executeCallParamsSchema>;
|
|
270
324
|
|
|
@@ -387,6 +441,33 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
387
441
|
swapExecutedBlockIndex: string;
|
|
388
442
|
egressAmount: string;
|
|
389
443
|
egressScheduledAt: number;
|
|
444
|
+
egressScheduledBlockIndex: string;
|
|
445
|
+
} | {
|
|
446
|
+
state: 'BROADCAST_REQUESTED';
|
|
447
|
+
depositAmount: string;
|
|
448
|
+
depositReceivedAt: number;
|
|
449
|
+
depositReceivedBlockIndex: string;
|
|
450
|
+
swapExecutedAt: number;
|
|
451
|
+
swapExecutedBlockIndex: string;
|
|
452
|
+
egressAmount: string;
|
|
453
|
+
egressScheduledAt: number;
|
|
454
|
+
egressScheduledBlockIndex: string;
|
|
455
|
+
broadcastRequestedAt: number;
|
|
456
|
+
broadcastRequestedBlockIndex: string;
|
|
457
|
+
} | {
|
|
458
|
+
state: 'BROADCAST_ABORTED';
|
|
459
|
+
depositAmount: string;
|
|
460
|
+
depositReceivedAt: number;
|
|
461
|
+
depositReceivedBlockIndex: string;
|
|
462
|
+
swapExecutedAt: number;
|
|
463
|
+
swapExecutedBlockIndex: string;
|
|
464
|
+
egressAmount: string;
|
|
465
|
+
egressScheduledAt: number;
|
|
466
|
+
egressScheduledBlockIndex: string;
|
|
467
|
+
broadcastRequestedAt: number;
|
|
468
|
+
broadcastRequestedBlockIndex: string;
|
|
469
|
+
broadcastAbortedAt: number;
|
|
470
|
+
broadcastAbortedBlockIndex: string;
|
|
390
471
|
} | {
|
|
391
472
|
state: 'COMPLETE';
|
|
392
473
|
depositAmount: string;
|
|
@@ -396,8 +477,11 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
396
477
|
swapExecutedBlockIndex: string;
|
|
397
478
|
egressAmount: string;
|
|
398
479
|
egressScheduledAt: number;
|
|
399
|
-
|
|
400
|
-
|
|
480
|
+
egressScheduledBlockIndex: string;
|
|
481
|
+
broadcastRequestedAt: number;
|
|
482
|
+
broadcastRequestedBlockIndex: string;
|
|
483
|
+
broadcastSucceededAt: number;
|
|
484
|
+
broadcastSucceededBlockIndex: string;
|
|
401
485
|
});
|
|
402
486
|
|
|
403
487
|
type RequestOptions = {
|
package/dist/swap.js
CHANGED
|
@@ -115,8 +115,8 @@ function assert(condition, message) {
|
|
|
115
115
|
throw error;
|
|
116
116
|
}
|
|
117
117
|
__name(assert, "assert");
|
|
118
|
-
var isTokenSwap = /* @__PURE__ */ __name((params) =>
|
|
119
|
-
var isTokenCall = /* @__PURE__ */ __name((params) =>
|
|
118
|
+
var isTokenSwap = /* @__PURE__ */ __name((params) => params.srcAsset !== Assets.ETH, "isTokenSwap");
|
|
119
|
+
var isTokenCall = /* @__PURE__ */ __name((params) => params.srcAsset !== Assets.ETH, "isTokenCall");
|
|
120
120
|
var _abi = [
|
|
121
121
|
{
|
|
122
122
|
inputs: [
|
|
@@ -1777,7 +1777,9 @@ var base = zod.z.object({
|
|
|
1777
1777
|
numericString,
|
|
1778
1778
|
hexString,
|
|
1779
1779
|
zod.z.bigint()
|
|
1780
|
-
])
|
|
1780
|
+
]),
|
|
1781
|
+
srcChain: zod.z.literal(Chains.Ethereum),
|
|
1782
|
+
srcAsset: zod.z.literal(Assets.ETH)
|
|
1781
1783
|
});
|
|
1782
1784
|
var ethereumBase = base.extend({
|
|
1783
1785
|
destChain: zod.z.literal(Chains.Ethereum),
|
|
@@ -1797,13 +1799,13 @@ var erc20 = zod.z.union([
|
|
|
1797
1799
|
]);
|
|
1798
1800
|
var ethereumNative = ethereumBase.extend({
|
|
1799
1801
|
destAsset: erc20
|
|
1800
|
-
})
|
|
1802
|
+
});
|
|
1801
1803
|
var polkadotNative = polkadotBase.extend({
|
|
1802
1804
|
destAsset: zod.z.literal(Assets.DOT)
|
|
1803
|
-
})
|
|
1805
|
+
});
|
|
1804
1806
|
var bitcoinNative = bitcoinBase.extend({
|
|
1805
1807
|
destAsset: zod.z.literal(Assets.BTC)
|
|
1806
|
-
})
|
|
1808
|
+
});
|
|
1807
1809
|
var nativeSwapParamsSchema = zod.z.union([
|
|
1808
1810
|
ethereumNative,
|
|
1809
1811
|
polkadotNative,
|
|
@@ -1839,7 +1841,7 @@ var nativeCallParamsSchema = ethereumBase.extend({
|
|
|
1839
1841
|
destAsset: erc20,
|
|
1840
1842
|
message: zod.z.string(),
|
|
1841
1843
|
gasAmount: numericString
|
|
1842
|
-
})
|
|
1844
|
+
});
|
|
1843
1845
|
var tokenCallParamsSchema = zod.z.union([
|
|
1844
1846
|
ethereumBase.extend({
|
|
1845
1847
|
srcAsset: zod.z.literal(Assets.FLIP),
|
package/dist/swap.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isString, Chains, Assets, ChainflipNetworks, assetDecimals, __name, assert, getVaultManagerContractAddress, approve, isTokenSwap, isTokenCall, getTokenContractAddress, checkAllowance, isTestnet, Vault__factory, chainContractIds, assetContractIds } from './chunk-
|
|
2
|
-
export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-
|
|
1
|
+
import { isString, Chains, Assets, ChainflipNetworks, assetDecimals, __name, assert, getVaultManagerContractAddress, approve, isTokenSwap, isTokenCall, getTokenContractAddress, checkAllowance, isTestnet, Vault__factory, chainContractIds, assetContractIds } from './chunk-VIR4Q4NH.mjs';
|
|
2
|
+
export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-VIR4Q4NH.mjs';
|
|
3
3
|
import { encodeAddress, decodeAddress } from '@polkadot/util-crypto';
|
|
4
4
|
import * as ethers from 'ethers';
|
|
5
5
|
import { Signer } from 'ethers';
|
|
@@ -310,7 +310,9 @@ var base = z.object({
|
|
|
310
310
|
numericString,
|
|
311
311
|
hexString,
|
|
312
312
|
z.bigint()
|
|
313
|
-
])
|
|
313
|
+
]),
|
|
314
|
+
srcChain: z.literal(Chains.Ethereum),
|
|
315
|
+
srcAsset: z.literal(Assets.ETH)
|
|
314
316
|
});
|
|
315
317
|
var ethereumBase = base.extend({
|
|
316
318
|
destChain: z.literal(Chains.Ethereum),
|
|
@@ -330,13 +332,13 @@ var erc20 = z.union([
|
|
|
330
332
|
]);
|
|
331
333
|
var ethereumNative = ethereumBase.extend({
|
|
332
334
|
destAsset: erc20
|
|
333
|
-
})
|
|
335
|
+
});
|
|
334
336
|
var polkadotNative = polkadotBase.extend({
|
|
335
337
|
destAsset: z.literal(Assets.DOT)
|
|
336
|
-
})
|
|
338
|
+
});
|
|
337
339
|
var bitcoinNative = bitcoinBase.extend({
|
|
338
340
|
destAsset: z.literal(Assets.BTC)
|
|
339
|
-
})
|
|
341
|
+
});
|
|
340
342
|
var nativeSwapParamsSchema = z.union([
|
|
341
343
|
ethereumNative,
|
|
342
344
|
polkadotNative,
|
|
@@ -372,7 +374,7 @@ var nativeCallParamsSchema = ethereumBase.extend({
|
|
|
372
374
|
destAsset: erc20,
|
|
373
375
|
message: z.string(),
|
|
374
376
|
gasAmount: numericString
|
|
375
|
-
})
|
|
377
|
+
});
|
|
376
378
|
var tokenCallParamsSchema = z.union([
|
|
377
379
|
ethereumBase.extend({
|
|
378
380
|
srcAsset: z.literal(Assets.FLIP),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainflip/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./swap": {
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
},
|
|
45
45
|
"repository": "https://github.com/chainflip-io/chainflip-sdk-monorepo.git",
|
|
46
46
|
"publishConfig": {
|
|
47
|
-
"registry": "https://registry.npmjs.org/"
|
|
47
|
+
"registry": "https://registry.npmjs.org/",
|
|
48
|
+
"access": "public"
|
|
48
49
|
},
|
|
49
|
-
"private": false,
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@polkadot/util": "^12.0.1",
|
|
52
52
|
"@polkadot/util-crypto": "^12.0.1",
|