@stableflow/core 3.0.0-beta-02a59f37a0-20260515
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/README.md +60 -0
- package/dist/index.d.mts +749 -0
- package/dist/index.d.ts +749 -0
- package/dist/index.js +2232 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2191 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +42 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2191 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import FormData from 'form-data';
|
|
3
|
+
import { Buffer } from 'buffer';
|
|
4
|
+
import Big from 'big.js';
|
|
5
|
+
import bs58 from 'bs58';
|
|
6
|
+
|
|
7
|
+
var __typeError = (msg) => {
|
|
8
|
+
throw TypeError(msg);
|
|
9
|
+
};
|
|
10
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
11
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
12
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
13
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
14
|
+
|
|
15
|
+
// src/core/ApiError.ts
|
|
16
|
+
var ApiError = class extends Error {
|
|
17
|
+
constructor(request2, response, message) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = "ApiError";
|
|
20
|
+
this.url = response.url;
|
|
21
|
+
this.status = response.status;
|
|
22
|
+
this.statusText = response.statusText;
|
|
23
|
+
this.body = response.body;
|
|
24
|
+
this.request = request2;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// src/core/CancelablePromise.ts
|
|
29
|
+
var CancelError = class extends Error {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = "CancelError";
|
|
33
|
+
}
|
|
34
|
+
get isCancelled() {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var _isResolved, _isRejected, _isCancelled, _cancelHandlers, _promise, _resolve, _reject;
|
|
39
|
+
var CancelablePromise = class {
|
|
40
|
+
constructor(executor) {
|
|
41
|
+
__privateAdd(this, _isResolved);
|
|
42
|
+
__privateAdd(this, _isRejected);
|
|
43
|
+
__privateAdd(this, _isCancelled);
|
|
44
|
+
__privateAdd(this, _cancelHandlers);
|
|
45
|
+
__privateAdd(this, _promise);
|
|
46
|
+
__privateAdd(this, _resolve);
|
|
47
|
+
__privateAdd(this, _reject);
|
|
48
|
+
__privateSet(this, _isResolved, false);
|
|
49
|
+
__privateSet(this, _isRejected, false);
|
|
50
|
+
__privateSet(this, _isCancelled, false);
|
|
51
|
+
__privateSet(this, _cancelHandlers, []);
|
|
52
|
+
__privateSet(this, _promise, new Promise((resolve2, reject) => {
|
|
53
|
+
__privateSet(this, _resolve, resolve2);
|
|
54
|
+
__privateSet(this, _reject, reject);
|
|
55
|
+
const onResolve = (value) => {
|
|
56
|
+
if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
__privateSet(this, _isResolved, true);
|
|
60
|
+
if (__privateGet(this, _resolve)) __privateGet(this, _resolve).call(this, value);
|
|
61
|
+
};
|
|
62
|
+
const onReject = (reason) => {
|
|
63
|
+
if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
__privateSet(this, _isRejected, true);
|
|
67
|
+
if (__privateGet(this, _reject)) __privateGet(this, _reject).call(this, reason);
|
|
68
|
+
};
|
|
69
|
+
const onCancel = (cancelHandler) => {
|
|
70
|
+
if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
__privateGet(this, _cancelHandlers).push(cancelHandler);
|
|
74
|
+
};
|
|
75
|
+
Object.defineProperty(onCancel, "isResolved", {
|
|
76
|
+
get: () => __privateGet(this, _isResolved)
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(onCancel, "isRejected", {
|
|
79
|
+
get: () => __privateGet(this, _isRejected)
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(onCancel, "isCancelled", {
|
|
82
|
+
get: () => __privateGet(this, _isCancelled)
|
|
83
|
+
});
|
|
84
|
+
return executor(onResolve, onReject, onCancel);
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
get [Symbol.toStringTag]() {
|
|
88
|
+
return "Cancellable Promise";
|
|
89
|
+
}
|
|
90
|
+
then(onFulfilled, onRejected) {
|
|
91
|
+
return __privateGet(this, _promise).then(onFulfilled, onRejected);
|
|
92
|
+
}
|
|
93
|
+
catch(onRejected) {
|
|
94
|
+
return __privateGet(this, _promise).catch(onRejected);
|
|
95
|
+
}
|
|
96
|
+
finally(onFinally) {
|
|
97
|
+
return __privateGet(this, _promise).finally(onFinally);
|
|
98
|
+
}
|
|
99
|
+
cancel() {
|
|
100
|
+
if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
__privateSet(this, _isCancelled, true);
|
|
104
|
+
if (__privateGet(this, _cancelHandlers).length) {
|
|
105
|
+
try {
|
|
106
|
+
for (const cancelHandler of __privateGet(this, _cancelHandlers)) {
|
|
107
|
+
cancelHandler();
|
|
108
|
+
}
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.warn("Cancellation threw an error", error);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
__privateGet(this, _cancelHandlers).length = 0;
|
|
115
|
+
if (__privateGet(this, _reject)) __privateGet(this, _reject).call(this, new CancelError("Request aborted"));
|
|
116
|
+
}
|
|
117
|
+
get isCancelled() {
|
|
118
|
+
return __privateGet(this, _isCancelled);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
_isResolved = new WeakMap();
|
|
122
|
+
_isRejected = new WeakMap();
|
|
123
|
+
_isCancelled = new WeakMap();
|
|
124
|
+
_cancelHandlers = new WeakMap();
|
|
125
|
+
_promise = new WeakMap();
|
|
126
|
+
_resolve = new WeakMap();
|
|
127
|
+
_reject = new WeakMap();
|
|
128
|
+
|
|
129
|
+
// src/core/OpenAPI.ts
|
|
130
|
+
var OpenAPI = {
|
|
131
|
+
BASE: "https://api.stableflow.ai",
|
|
132
|
+
VERSION: "1.0.0",
|
|
133
|
+
WITH_CREDENTIALS: false,
|
|
134
|
+
CREDENTIALS: "include",
|
|
135
|
+
TOKEN: void 0,
|
|
136
|
+
USERNAME: void 0,
|
|
137
|
+
PASSWORD: void 0,
|
|
138
|
+
HEADERS: void 0,
|
|
139
|
+
ENCODE_PATH: void 0,
|
|
140
|
+
DEBUG: false
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// src/utils/log.ts
|
|
144
|
+
var logStyles = {
|
|
145
|
+
"red-50": "background:oklch(97.1% 0.013 17.38);color:#000;",
|
|
146
|
+
"red-100": "background:oklch(93.6% 0.032 17.717);color:#000;",
|
|
147
|
+
"red-200": "background:oklch(88.5% 0.062 18.334);color:#000;",
|
|
148
|
+
"red-300": "background:oklch(80.8% 0.114 19.571);color:#000;",
|
|
149
|
+
"red-400": "background:oklch(70.4% 0.191 22.216);color:#fff;",
|
|
150
|
+
"red-500": "background:oklch(63.7% 0.237 25.331);color:#fff;",
|
|
151
|
+
"red-600": "background:oklch(57.7% 0.245 27.325);color:#fff;",
|
|
152
|
+
"red-700": "background:oklch(50.5% 0.213 27.518);color:#fff;",
|
|
153
|
+
"red-800": "background:oklch(44.4% 0.177 26.899);color:#fff;",
|
|
154
|
+
"red-900": "background:oklch(39.6% 0.141 25.723);color:#fff;",
|
|
155
|
+
"red-950": "background:oklch(25.8% 0.092 26.042);color:#fff;",
|
|
156
|
+
"yellow-50": "background:oklch(98.73% 0.0262 102.21);color:#000;",
|
|
157
|
+
"yellow-100": "background:oklch(97.29% 0.0693 103.19);color:#000;",
|
|
158
|
+
"yellow-200": "background:oklch(94.51% 0.1243 101.54);color:#000;",
|
|
159
|
+
"yellow-300": "background:oklch(90.52% 0.1657 98.11);color:#000;",
|
|
160
|
+
"yellow-400": "background:oklch(86.06% 0.1731 91.94);color:#fff;",
|
|
161
|
+
"yellow-500": "background:oklch(79.52% 0.1617 86.05);color:#fff;",
|
|
162
|
+
"yellow-600": "background:oklch(68.06% 0.1423 75.83);color:#fff;",
|
|
163
|
+
"yellow-700": "background:oklch(55.38% 0.1207 66.44);color:#fff;",
|
|
164
|
+
"yellow-800": "background:oklch(47.62% 0.1034 61.91);color:#fff;",
|
|
165
|
+
"yellow-900": "background:oklch(42.1% 0.0897 57.71);color:#fff;",
|
|
166
|
+
"yellow-950": "background:oklch(28.57% 0.0639 53.81);color:#fff;",
|
|
167
|
+
"green-50": "background:oklch(98.19% 0.0181 155.83);color:#000;",
|
|
168
|
+
"green-100": "background:oklch(96.24% 0.0434 156.74);color:#000;",
|
|
169
|
+
"green-200": "background:oklch(92.5% 0.0806 155.99);color:#000;",
|
|
170
|
+
"green-300": "background:oklch(87.12% 0.1363 154.45);color:#000;",
|
|
171
|
+
"green-400": "background:oklch(80.03% 0.1821 151.71);color:#fff;",
|
|
172
|
+
"green-500": "background:oklch(72.27% 0.192 149.58);color:#fff;",
|
|
173
|
+
"green-600": "background:oklch(62.71% 0.1699 149.21);color:#fff;",
|
|
174
|
+
"green-700": "background:oklch(52.73% 0.1371 150.07);color:#fff;",
|
|
175
|
+
"green-800": "background:oklch(44.79% 0.1083 151.33);color:#fff;",
|
|
176
|
+
"green-900": "background:oklch(39.25% 0.0896 152.54);color:#fff;",
|
|
177
|
+
"green-950": "background:oklch(26.64% 0.0628 152.93);color:#fff;",
|
|
178
|
+
"blue-50": "background:oklch(97.05% 0.0142 254.6);color:#000;",
|
|
179
|
+
"blue-100": "background:oklch(93.19% 0.0316 255.59);color:#000;",
|
|
180
|
+
"blue-200": "background:oklch(88.23% 0.0571 254.13);color:#000;",
|
|
181
|
+
"blue-300": "background:oklch(80.91% 0.0956 251.81);color:#000;",
|
|
182
|
+
"blue-400": "background:oklch(71.37% 0.1434 254.62);color:#fff;",
|
|
183
|
+
"blue-500": "background:oklch(62.31% 0.188 259.81);color:#fff;",
|
|
184
|
+
"blue-600": "background:oklch(54.61% 0.2152 262.88);color:#fff;",
|
|
185
|
+
"blue-700": "background:oklch(48.82% 0.2172 264.38);color:#fff;",
|
|
186
|
+
"blue-800": "background:oklch(42.44% 0.1809 265.64);color:#fff;",
|
|
187
|
+
"blue-900": "background:oklch(37.91% 0.1378 265.52);color:#fff;",
|
|
188
|
+
"blue-950": "background:oklch(28.23% 0.0874 267.94);color:#fff;",
|
|
189
|
+
"sky-50": "background:oklch(97.71% 0.0125 236.62);color:#000;",
|
|
190
|
+
"sky-100": "background:oklch(95.14% 0.025 236.82);color:#000;",
|
|
191
|
+
"sky-200": "background:oklch(90.14% 0.0555 230.9);color:#000;",
|
|
192
|
+
"sky-300": "background:oklch(82.76% 0.1013 230.32);color:#000;",
|
|
193
|
+
"sky-400": "background:oklch(75.35% 0.139 232.66);color:#fff;",
|
|
194
|
+
"sky-500": "background:oklch(68.47% 0.1479 237.32);color:#fff;",
|
|
195
|
+
"sky-600": "background:oklch(58.76% 0.1389 241.97);color:#fff;",
|
|
196
|
+
"sky-700": "background:oklch(50% 0.1193 242.75);color:#fff;",
|
|
197
|
+
"sky-800": "background:oklch(44.34% 0.1 240.79);color:#fff;",
|
|
198
|
+
"sky-900": "background:oklch(39.12% 0.0845 240.88);color:#fff;",
|
|
199
|
+
"sky-950": "background:oklch(29.35% 0.0632 243.16);color:#fff;",
|
|
200
|
+
"teal-50": "background:oklch(98.36% 0.0142 180.72);color:#000;",
|
|
201
|
+
"teal-100": "background:oklch(95.27% 0.0498 180.8);color:#000;",
|
|
202
|
+
"teal-200": "background:oklch(91% 0.0927 180.43);color:#000;",
|
|
203
|
+
"teal-300": "background:oklch(85.49% 0.1251 181.07);color:#000;",
|
|
204
|
+
"teal-400": "background:oklch(78.45% 0.1325 181.91);color:#fff;",
|
|
205
|
+
"teal-500": "background:oklch(70.38% 0.123 182.5);color:#fff;",
|
|
206
|
+
"teal-600": "background:oklch(60.02% 0.1038 184.7);color:#fff;",
|
|
207
|
+
"teal-700": "background:oklch(51.09% 0.0861 186.39);color:#fff;",
|
|
208
|
+
"teal-800": "background:oklch(43.7% 0.0705 188.22);color:#fff;",
|
|
209
|
+
"teal-900": "background:oklch(38.61% 0.059 188.42);color:#fff;",
|
|
210
|
+
"teal-950": "background:oklch(27.73% 0.0447 192.52);color:#fff;",
|
|
211
|
+
"purple-50": "background:oklch(97.68% 0.0142 308.3);color:#000;",
|
|
212
|
+
"purple-100": "background:oklch(94.64% 0.0327 307.17);color:#000;",
|
|
213
|
+
"purple-200": "background:oklch(90.24% 0.0604 306.7);color:#000;",
|
|
214
|
+
"purple-300": "background:oklch(82.68% 0.1082 306.38);color:#000;",
|
|
215
|
+
"purple-400": "background:oklch(72.17% 0.1767 305.5);color:#fff;",
|
|
216
|
+
"purple-500": "background:oklch(62.68% 0.2325 303.9);color:#fff;",
|
|
217
|
+
"purple-600": "background:oklch(55.75% 0.2525 302.32);color:#fff;",
|
|
218
|
+
"purple-700": "background:oklch(49.55% 0.2369 301.92);color:#fff;",
|
|
219
|
+
"purple-800": "background:oklch(43.83% 0.1983 303.72);color:#fff;",
|
|
220
|
+
"purple-900": "background:oklch(38.07% 0.1661 304.99);color:#fff;",
|
|
221
|
+
"purple-950": "background:oklch(29.05% 0.1432 302.72);color:#fff;",
|
|
222
|
+
"pink-50": "background:oklch(97.14% 0.0141 343.2);color:#000;",
|
|
223
|
+
"pink-100": "background:oklch(94.82% 0.0276 342.26);color:#000;",
|
|
224
|
+
"pink-200": "background:oklch(89.94% 0.0589 343.23);color:#000;",
|
|
225
|
+
"pink-300": "background:oklch(82.28% 0.1095 346.02);color:#000;",
|
|
226
|
+
"pink-400": "background:oklch(72.53% 0.1752 349.76);color:#fff;",
|
|
227
|
+
"pink-500": "background:oklch(65.59% 0.2118 354.31);color:#fff;",
|
|
228
|
+
"pink-600": "background:oklch(59.16% 0.218 354.58);color:#fff;",
|
|
229
|
+
"pink-700": "background:oklch(52.46% 0.199 353.96);color:#fff;",
|
|
230
|
+
"pink-800": "background:oklch(45.87% 0.1697 353.82);color:#fff;",
|
|
231
|
+
"pink-900": "background:oklch(40.78% 0.1442 352.43);color:#fff;",
|
|
232
|
+
"pink-950": "background:oklch(28.45% 0.1048 353.91);color:#fff;",
|
|
233
|
+
"rose-50": "background:oklch(96.94% 0.0151 12.42);color:#000;",
|
|
234
|
+
"rose-100": "background:oklch(94.14% 0.0297 12.58);color:#000;",
|
|
235
|
+
"rose-200": "background:oklch(89.24% 0.0559 10);color:#000;",
|
|
236
|
+
"rose-300": "background:oklch(80.97% 0.1061 11.64);color:#000;",
|
|
237
|
+
"rose-400": "background:oklch(71.92% 0.169 13.43);color:#fff;",
|
|
238
|
+
"rose-500": "background:oklch(64.5% 0.2154 16.44);color:#fff;",
|
|
239
|
+
"rose-600": "background:oklch(58.58% 0.222 17.58);color:#fff;",
|
|
240
|
+
"rose-700": "background:oklch(51.43% 0.1978 16.93);color:#fff;",
|
|
241
|
+
"rose-800": "background:oklch(45.46% 0.1713 13.7);color:#fff;",
|
|
242
|
+
"rose-900": "background:oklch(41.03% 0.1502 10.27);color:#fff;",
|
|
243
|
+
"rose-950": "background:oklch(27.08% 0.1009 12.09);color:#fff;",
|
|
244
|
+
"gray-50": "background:oklch(98.46% 0.0017 247.84);color:#000;",
|
|
245
|
+
"gray-100": "background:oklch(96.7% 0.0029 264.54);color:#000;",
|
|
246
|
+
"gray-200": "background:oklch(92.76% 0.0058 264.53);color:#000;",
|
|
247
|
+
"gray-300": "background:oklch(87.17% 0.0093 258.34);color:#000;",
|
|
248
|
+
"gray-400": "background:oklch(71.37% 0.0192 261.32);color:#fff;",
|
|
249
|
+
"gray-500": "background:oklch(55.1% 0.0234 264.36);color:#fff;",
|
|
250
|
+
"gray-600": "background:oklch(44.55% 0.0234 264.36);color:#fff;",
|
|
251
|
+
"gray-700": "background:oklch(37.29% 0.0306 259.73);color:#fff;",
|
|
252
|
+
"gray-800": "background:oklch(27.81% 0.0296 256.85);color:#fff;",
|
|
253
|
+
"gray-900": "background:oklch(21.01% 0.0318 264.66);color:#fff;",
|
|
254
|
+
"gray-950": "background:oklch(12.96% 0.0274 261.69);color:#fff;",
|
|
255
|
+
"indigo-50": "background:oklch(96.2% 0.018 272.314);color:#000;",
|
|
256
|
+
"indigo-100": "background:oklch(93% 0.034 272.788);color:#000;",
|
|
257
|
+
"indigo-200": "background:oklch(87% 0.065 274.039);color:#000;",
|
|
258
|
+
"indigo-300": "background:oklch(78.5% 0.115 274.713);color:#000;",
|
|
259
|
+
"indigo-400": "background:oklch(67.3% 0.182 276.935);color:#fff;",
|
|
260
|
+
"indigo-500": "background:oklch(58.5% 0.233 277.117);color:#fff;",
|
|
261
|
+
"indigo-600": "background:oklch(51.1% 0.262 276.966);color:#fff;",
|
|
262
|
+
"indigo-700": "background:oklch(45.7% 0.24 277.023);color:#fff;",
|
|
263
|
+
"indigo-800": "background:oklch(39.8% 0.195 277.366);color:#fff;",
|
|
264
|
+
"indigo-900": "background:oklch(35.9% 0.144 278.697);color:#fff;",
|
|
265
|
+
"indigo-950": "background:oklch(25.7% 0.09 281.288);color:#fff;",
|
|
266
|
+
"fuchsia-50": "background:oklch(97.7% 0.017 320.058);color:#000;",
|
|
267
|
+
"fuchsia-100": "background:oklch(95.2% 0.037 318.852);color:#000;",
|
|
268
|
+
"fuchsia-200": "background:oklch(90.3% 0.076 319.62);color:#000;",
|
|
269
|
+
"fuchsia-300": "background:oklch(83.3% 0.145 321.434);color:#000;",
|
|
270
|
+
"fuchsia-400": "background:oklch(74% 0.238 322.16);color:#fff;",
|
|
271
|
+
"fuchsia-500": "background:oklch(66.7% 0.295 322.15);color:#fff;",
|
|
272
|
+
"fuchsia-600": "background:oklch(59.1% 0.293 322.896);color:#fff;",
|
|
273
|
+
"fuchsia-700": "background:oklch(51.8% 0.253 323.949);color:#fff;",
|
|
274
|
+
"fuchsia-800": "background:oklch(45.2% 0.211 324.591);color:#fff;",
|
|
275
|
+
"fuchsia-900": "background:oklch(40.1% 0.17 325.612);color:#fff;",
|
|
276
|
+
"fuchsia-950": "background:oklch(29.3% 0.136 325.661);color:#fff;",
|
|
277
|
+
"stone-50": "background:oklch(98.5% 0.001 106.423);color:#000;",
|
|
278
|
+
"stone-100": "background:oklch(97% 0.001 106.424);color:#000;",
|
|
279
|
+
"stone-200": "background:oklch(92.3% 0.003 48.717);color:#000;",
|
|
280
|
+
"stone-300": "background:oklch(86.9% 0.005 56.366);color:#000;",
|
|
281
|
+
"stone-400": "background:oklch(70.9% 0.01 56.259);color:#fff;",
|
|
282
|
+
"stone-500": "background:oklch(55.3% 0.013 58.071);color:#fff;",
|
|
283
|
+
"stone-600": "background:oklch(44.4% 0.011 73.639);color:#fff;",
|
|
284
|
+
"stone-700": "background:oklch(37.4% 0.01 67.558);color:#fff;",
|
|
285
|
+
"stone-800": "background:oklch(26.8% 0.007 34.298);color:#fff;",
|
|
286
|
+
"stone-900": "background:oklch(21.6% 0.006 56.043);color:#fff;",
|
|
287
|
+
"stone-950": "background:oklch(14.7% 0.004 49.25);color:#fff;",
|
|
288
|
+
"lime-50": "background:oklch(98.6% 0.031 120.757);color:#000;",
|
|
289
|
+
"lime-100": "background:oklch(96.7% 0.067 122.328);color:#000;",
|
|
290
|
+
"lime-200": "background:oklch(93.8% 0.127 124.321);color:#000;",
|
|
291
|
+
"lime-300": "background:oklch(89.7% 0.196 126.665);color:#000;",
|
|
292
|
+
"lime-400": "background:oklch(84.1% 0.238 128.85);color:#fff;",
|
|
293
|
+
"lime-500": "background:oklch(76.8% 0.233 130.85);color:#fff;",
|
|
294
|
+
"lime-600": "background:oklch(64.8% 0.2 131.684);color:#fff;",
|
|
295
|
+
"lime-700": "background:oklch(53.2% 0.157 131.589);color:#fff;",
|
|
296
|
+
"lime-800": "background:oklch(45.3% 0.124 130.933);color:#fff;",
|
|
297
|
+
"lime-900": "background:oklch(40.5% 0.101 131.063);color:#fff;",
|
|
298
|
+
"lime-950": "background:oklch(27.4% 0.072 132.109);color:#fff;"
|
|
299
|
+
};
|
|
300
|
+
var csl = (isDebug, type, style, str, ...args) => {
|
|
301
|
+
if (!isDebug) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const _style = logStyles[style] || logStyles["blue-400"];
|
|
305
|
+
console.log(`%c[StableFlowAiSDK]${type ? ".[" + type + "]" : ""} ${str}`, _style, ...args);
|
|
306
|
+
};
|
|
307
|
+
var Csl = class {
|
|
308
|
+
constructor(isDebug) {
|
|
309
|
+
this.log = (type, style, str, ...args) => {
|
|
310
|
+
csl(this.isDebug, type, style, str, ...args);
|
|
311
|
+
};
|
|
312
|
+
this.info = (type, str, ...args) => {
|
|
313
|
+
csl(this.isDebug, type, "blue-400", str, ...args);
|
|
314
|
+
};
|
|
315
|
+
this.error = (type, str, ...args) => {
|
|
316
|
+
csl(this.isDebug, type, "red-400", str, ...args);
|
|
317
|
+
};
|
|
318
|
+
this.success = (type, str, ...args) => {
|
|
319
|
+
csl(this.isDebug, type, "green-400", str, ...args);
|
|
320
|
+
};
|
|
321
|
+
this.simple = (str, ...args) => {
|
|
322
|
+
csl(this.isDebug, "", "blue-400", str, ...args);
|
|
323
|
+
};
|
|
324
|
+
this.isDebug = isDebug;
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
var isDefined = (value) => {
|
|
328
|
+
return value !== void 0 && value !== null;
|
|
329
|
+
};
|
|
330
|
+
var isString = (value) => {
|
|
331
|
+
return typeof value === "string";
|
|
332
|
+
};
|
|
333
|
+
var isStringWithValue = (value) => {
|
|
334
|
+
return isString(value) && value !== "";
|
|
335
|
+
};
|
|
336
|
+
var isBlob = (value) => {
|
|
337
|
+
return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
|
|
338
|
+
};
|
|
339
|
+
var isFormData = (value) => {
|
|
340
|
+
return value instanceof FormData;
|
|
341
|
+
};
|
|
342
|
+
var isSuccess = (status) => {
|
|
343
|
+
return status >= 200 && status < 300;
|
|
344
|
+
};
|
|
345
|
+
var base64 = (str) => {
|
|
346
|
+
try {
|
|
347
|
+
return btoa(str);
|
|
348
|
+
} catch (err) {
|
|
349
|
+
return Buffer.from(str).toString("base64");
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
var getQueryString = (params) => {
|
|
353
|
+
const qs = [];
|
|
354
|
+
const append = (key, value) => {
|
|
355
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
356
|
+
};
|
|
357
|
+
const process = (key, value) => {
|
|
358
|
+
if (isDefined(value)) {
|
|
359
|
+
if (Array.isArray(value)) {
|
|
360
|
+
value.forEach((v) => {
|
|
361
|
+
process(key, v);
|
|
362
|
+
});
|
|
363
|
+
} else if (typeof value === "object") {
|
|
364
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
365
|
+
process(`${key}[${k}]`, v);
|
|
366
|
+
});
|
|
367
|
+
} else {
|
|
368
|
+
append(key, value);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
373
|
+
process(key, value);
|
|
374
|
+
});
|
|
375
|
+
if (qs.length > 0) {
|
|
376
|
+
return `?${qs.join("&")}`;
|
|
377
|
+
}
|
|
378
|
+
return "";
|
|
379
|
+
};
|
|
380
|
+
var getUrl = (config, options) => {
|
|
381
|
+
const encoder = config.ENCODE_PATH || encodeURI;
|
|
382
|
+
const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
383
|
+
if (options.path?.hasOwnProperty(group)) {
|
|
384
|
+
return encoder(String(options.path[group]));
|
|
385
|
+
}
|
|
386
|
+
return substring;
|
|
387
|
+
});
|
|
388
|
+
const url = `${config.BASE}${path}`;
|
|
389
|
+
if (options.query) {
|
|
390
|
+
return `${url}${getQueryString(options.query)}`;
|
|
391
|
+
}
|
|
392
|
+
return url;
|
|
393
|
+
};
|
|
394
|
+
var getFormData = (options) => {
|
|
395
|
+
if (options.formData) {
|
|
396
|
+
const formData = new FormData();
|
|
397
|
+
const process = (key, value) => {
|
|
398
|
+
if (isString(value) || isBlob(value)) {
|
|
399
|
+
formData.append(key, value);
|
|
400
|
+
} else {
|
|
401
|
+
formData.append(key, JSON.stringify(value));
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
Object.entries(options.formData).filter(([_, value]) => isDefined(value)).forEach(([key, value]) => {
|
|
405
|
+
if (Array.isArray(value)) {
|
|
406
|
+
value.forEach((v) => process(key, v));
|
|
407
|
+
} else {
|
|
408
|
+
process(key, value);
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
return formData;
|
|
412
|
+
}
|
|
413
|
+
return void 0;
|
|
414
|
+
};
|
|
415
|
+
var resolve = async (options, resolver) => {
|
|
416
|
+
if (typeof resolver === "function") {
|
|
417
|
+
return resolver(options);
|
|
418
|
+
}
|
|
419
|
+
return resolver;
|
|
420
|
+
};
|
|
421
|
+
var getHeaders = async (config, options, formData) => {
|
|
422
|
+
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
423
|
+
resolve(options, config.TOKEN),
|
|
424
|
+
resolve(options, config.USERNAME),
|
|
425
|
+
resolve(options, config.PASSWORD),
|
|
426
|
+
resolve(options, config.HEADERS)
|
|
427
|
+
]);
|
|
428
|
+
const formHeaders = typeof formData?.getHeaders === "function" && formData?.getHeaders() || {};
|
|
429
|
+
const headers = Object.entries({
|
|
430
|
+
Accept: "application/json",
|
|
431
|
+
...additionalHeaders,
|
|
432
|
+
...options.headers,
|
|
433
|
+
...formHeaders
|
|
434
|
+
}).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => ({
|
|
435
|
+
...headers2,
|
|
436
|
+
[key]: String(value)
|
|
437
|
+
}), {});
|
|
438
|
+
if (isStringWithValue(token)) {
|
|
439
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
440
|
+
}
|
|
441
|
+
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
442
|
+
const credentials = base64(`${username}:${password}`);
|
|
443
|
+
headers["Authorization"] = `Basic ${credentials}`;
|
|
444
|
+
}
|
|
445
|
+
if (options.body !== void 0) {
|
|
446
|
+
if (options.mediaType) {
|
|
447
|
+
headers["Content-Type"] = options.mediaType;
|
|
448
|
+
} else if (isBlob(options.body)) {
|
|
449
|
+
headers["Content-Type"] = options.body.type || "application/octet-stream";
|
|
450
|
+
} else if (isString(options.body)) {
|
|
451
|
+
headers["Content-Type"] = "text/plain";
|
|
452
|
+
} else if (!isFormData(options.body)) {
|
|
453
|
+
headers["Content-Type"] = "application/json";
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return headers;
|
|
457
|
+
};
|
|
458
|
+
var getRequestBody = (options) => {
|
|
459
|
+
if (options.body) {
|
|
460
|
+
return options.body;
|
|
461
|
+
}
|
|
462
|
+
return void 0;
|
|
463
|
+
};
|
|
464
|
+
var sendRequest = async (config, options, url, body, formData, headers, onCancel, axiosClient) => {
|
|
465
|
+
const source = axios.CancelToken.source();
|
|
466
|
+
const requestConfig = {
|
|
467
|
+
url,
|
|
468
|
+
headers,
|
|
469
|
+
data: body ?? formData,
|
|
470
|
+
method: options.method,
|
|
471
|
+
withCredentials: config.WITH_CREDENTIALS,
|
|
472
|
+
withXSRFToken: config.CREDENTIALS === "include" ? config.WITH_CREDENTIALS : false,
|
|
473
|
+
cancelToken: source.token
|
|
474
|
+
};
|
|
475
|
+
onCancel(() => source.cancel("The user aborted a request."));
|
|
476
|
+
try {
|
|
477
|
+
return await axiosClient.request(requestConfig);
|
|
478
|
+
} catch (error) {
|
|
479
|
+
const axiosError = error;
|
|
480
|
+
if (axiosError.response) {
|
|
481
|
+
return axiosError.response;
|
|
482
|
+
}
|
|
483
|
+
throw error;
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
var getResponseHeader = (response, responseHeader) => {
|
|
487
|
+
if (responseHeader) {
|
|
488
|
+
const content = response.headers[responseHeader];
|
|
489
|
+
if (isString(content)) {
|
|
490
|
+
return content;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return void 0;
|
|
494
|
+
};
|
|
495
|
+
var getResponseBody = (response) => {
|
|
496
|
+
if (response.status !== 204) {
|
|
497
|
+
return response.data;
|
|
498
|
+
}
|
|
499
|
+
return void 0;
|
|
500
|
+
};
|
|
501
|
+
var catchErrorCodes = (options, result) => {
|
|
502
|
+
const errors = {
|
|
503
|
+
400: "Bad Request",
|
|
504
|
+
401: "Unauthorized",
|
|
505
|
+
403: "Forbidden",
|
|
506
|
+
404: "Not Found",
|
|
507
|
+
500: "Internal Server Error",
|
|
508
|
+
502: "Bad Gateway",
|
|
509
|
+
503: "Service Unavailable",
|
|
510
|
+
...options.errors
|
|
511
|
+
};
|
|
512
|
+
const error = errors[result.status];
|
|
513
|
+
if (error) {
|
|
514
|
+
throw new ApiError(options, result, error);
|
|
515
|
+
}
|
|
516
|
+
if (!result.ok) {
|
|
517
|
+
const errorStatus = result.status ?? "unknown";
|
|
518
|
+
const errorStatusText = result.statusText ?? "unknown";
|
|
519
|
+
const errorBody = (() => {
|
|
520
|
+
try {
|
|
521
|
+
return JSON.stringify(result.body, null, 2);
|
|
522
|
+
} catch (e) {
|
|
523
|
+
return void 0;
|
|
524
|
+
}
|
|
525
|
+
})();
|
|
526
|
+
throw new ApiError(
|
|
527
|
+
options,
|
|
528
|
+
result,
|
|
529
|
+
`Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
var request = (config, options, axiosClient = axios) => {
|
|
534
|
+
const csl2 = new Csl(config.DEBUG);
|
|
535
|
+
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
536
|
+
try {
|
|
537
|
+
const url = getUrl(config, options);
|
|
538
|
+
const formData = getFormData(options);
|
|
539
|
+
const body = getRequestBody(options);
|
|
540
|
+
const headers = await getHeaders(config, options, formData);
|
|
541
|
+
csl2.simple("\n\u{1F535} ========== API Request ==========");
|
|
542
|
+
csl2.simple("Method:", options.method);
|
|
543
|
+
csl2.simple("URL:", url);
|
|
544
|
+
csl2.simple("Headers:", JSON.stringify(headers, null, 2));
|
|
545
|
+
if (body) {
|
|
546
|
+
csl2.simple("Body:", JSON.stringify(body, null, 2));
|
|
547
|
+
}
|
|
548
|
+
if (formData) {
|
|
549
|
+
csl2.simple("FormData:", formData);
|
|
550
|
+
}
|
|
551
|
+
csl2.simple("====================================\n");
|
|
552
|
+
if (!onCancel.isCancelled) {
|
|
553
|
+
const response = await sendRequest(config, options, url, body, formData, headers, onCancel, axiosClient);
|
|
554
|
+
const responseBody = getResponseBody(response);
|
|
555
|
+
const responseHeader = getResponseHeader(response, options.responseHeader);
|
|
556
|
+
const result = {
|
|
557
|
+
url,
|
|
558
|
+
ok: isSuccess(response.status),
|
|
559
|
+
status: response.status,
|
|
560
|
+
statusText: response.statusText,
|
|
561
|
+
body: responseHeader ?? responseBody
|
|
562
|
+
};
|
|
563
|
+
catchErrorCodes(options, result);
|
|
564
|
+
csl2.simple("\n\u{1F7E2} ========== API Response ==========");
|
|
565
|
+
csl2.simple("Status:", response.status, response.statusText);
|
|
566
|
+
csl2.simple("Response Headers:", JSON.stringify(response.headers, null, 2));
|
|
567
|
+
csl2.simple("Response Body:", JSON.stringify(responseBody, null, 2));
|
|
568
|
+
csl2.simple("=====================================\n");
|
|
569
|
+
resolve2(result.body);
|
|
570
|
+
}
|
|
571
|
+
} catch (error) {
|
|
572
|
+
csl2.simple("\n\u{1F534} ========== API Error ==========");
|
|
573
|
+
csl2.simple("Error:", error);
|
|
574
|
+
if (error instanceof ApiError) {
|
|
575
|
+
csl2.simple("Status:", error.status);
|
|
576
|
+
csl2.simple("Status Text:", error.statusText);
|
|
577
|
+
csl2.simple("URL:", error.url);
|
|
578
|
+
csl2.simple("Body:", JSON.stringify(error.body, null, 2));
|
|
579
|
+
}
|
|
580
|
+
csl2.simple("==================================\n");
|
|
581
|
+
reject(error);
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
// src/core/Send.ts
|
|
587
|
+
var SendType = /* @__PURE__ */ ((SendType2) => {
|
|
588
|
+
SendType2["SEND"] = "SEND";
|
|
589
|
+
SendType2["TRANSFER"] = "TRANSFER";
|
|
590
|
+
return SendType2;
|
|
591
|
+
})(SendType || {});
|
|
592
|
+
|
|
593
|
+
// src/core/Service.ts
|
|
594
|
+
var Service = {
|
|
595
|
+
OneClick: "oneclick",
|
|
596
|
+
Usdt0: "usdt0",
|
|
597
|
+
CCTP: "cctp",
|
|
598
|
+
FraxZero: "fraxzero",
|
|
599
|
+
FraxZeroOneClick: "fraxzero-oneclick",
|
|
600
|
+
OneClickFraxZero: "oneclick-fraxzero",
|
|
601
|
+
Usdt0OneClick: "usdt0-oneclick",
|
|
602
|
+
OneClickUsdt0: "oneclick-usdt0",
|
|
603
|
+
Native: "native"
|
|
604
|
+
};
|
|
605
|
+
var ServiceBackend = {
|
|
606
|
+
[Service.OneClick]: "nearintents",
|
|
607
|
+
[Service.Usdt0]: "layerzero",
|
|
608
|
+
[Service.CCTP]: "cctp",
|
|
609
|
+
[Service.FraxZero]: "fraxzero",
|
|
610
|
+
[Service.FraxZeroOneClick]: "fraxzerointent",
|
|
611
|
+
[Service.OneClickFraxZero]: "intentfraxzero",
|
|
612
|
+
[Service.Usdt0OneClick]: "zerointent",
|
|
613
|
+
[Service.OneClickUsdt0]: "intentzero",
|
|
614
|
+
[Service.Native]: "native"
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
// src/models/GetExecutionStatusResponse.ts
|
|
618
|
+
var GetExecutionStatusResponse;
|
|
619
|
+
((GetExecutionStatusResponse2) => {
|
|
620
|
+
((status2) => {
|
|
621
|
+
status2["KNOWN_DEPOSIT_TX"] = "KNOWN_DEPOSIT_TX";
|
|
622
|
+
status2["PENDING_DEPOSIT"] = "PENDING_DEPOSIT";
|
|
623
|
+
status2["INCOMPLETE_DEPOSIT"] = "INCOMPLETE_DEPOSIT";
|
|
624
|
+
status2["PROCESSING"] = "PROCESSING";
|
|
625
|
+
status2["SUCCESS"] = "SUCCESS";
|
|
626
|
+
status2["REFUNDED"] = "REFUNDED";
|
|
627
|
+
status2["FAILED"] = "FAILED";
|
|
628
|
+
})(GetExecutionStatusResponse2.status || (GetExecutionStatusResponse2.status = {}));
|
|
629
|
+
})(GetExecutionStatusResponse || (GetExecutionStatusResponse = {}));
|
|
630
|
+
|
|
631
|
+
// src/models/QuoteRequest.ts
|
|
632
|
+
var QuoteRequest;
|
|
633
|
+
((QuoteRequest2) => {
|
|
634
|
+
((depositMode2) => {
|
|
635
|
+
depositMode2["SIMPLE"] = "SIMPLE";
|
|
636
|
+
depositMode2["MEMO"] = "MEMO";
|
|
637
|
+
})(QuoteRequest2.depositMode || (QuoteRequest2.depositMode = {}));
|
|
638
|
+
((swapType2) => {
|
|
639
|
+
swapType2["EXACT_INPUT"] = "EXACT_INPUT";
|
|
640
|
+
swapType2["EXACT_OUTPUT"] = "EXACT_OUTPUT";
|
|
641
|
+
swapType2["FLEX_INPUT"] = "FLEX_INPUT";
|
|
642
|
+
})(QuoteRequest2.swapType || (QuoteRequest2.swapType = {}));
|
|
643
|
+
((depositType2) => {
|
|
644
|
+
depositType2["ORIGIN_CHAIN"] = "ORIGIN_CHAIN";
|
|
645
|
+
depositType2["INTENTS"] = "INTENTS";
|
|
646
|
+
})(QuoteRequest2.depositType || (QuoteRequest2.depositType = {}));
|
|
647
|
+
((refundType2) => {
|
|
648
|
+
refundType2["ORIGIN_CHAIN"] = "ORIGIN_CHAIN";
|
|
649
|
+
refundType2["INTENTS"] = "INTENTS";
|
|
650
|
+
})(QuoteRequest2.refundType || (QuoteRequest2.refundType = {}));
|
|
651
|
+
((recipientType2) => {
|
|
652
|
+
recipientType2["DESTINATION_CHAIN"] = "DESTINATION_CHAIN";
|
|
653
|
+
recipientType2["INTENTS"] = "INTENTS";
|
|
654
|
+
})(QuoteRequest2.recipientType || (QuoteRequest2.recipientType = {}));
|
|
655
|
+
})(QuoteRequest || (QuoteRequest = {}));
|
|
656
|
+
|
|
657
|
+
// src/models/SubmitDepositTxResponse.ts
|
|
658
|
+
var SubmitDepositTxResponse;
|
|
659
|
+
((SubmitDepositTxResponse2) => {
|
|
660
|
+
((status2) => {
|
|
661
|
+
status2["KNOWN_DEPOSIT_TX"] = "KNOWN_DEPOSIT_TX";
|
|
662
|
+
status2["PENDING_DEPOSIT"] = "PENDING_DEPOSIT";
|
|
663
|
+
status2["INCOMPLETE_DEPOSIT"] = "INCOMPLETE_DEPOSIT";
|
|
664
|
+
status2["PROCESSING"] = "PROCESSING";
|
|
665
|
+
status2["SUCCESS"] = "SUCCESS";
|
|
666
|
+
status2["REFUNDED"] = "REFUNDED";
|
|
667
|
+
status2["FAILED"] = "FAILED";
|
|
668
|
+
})(SubmitDepositTxResponse2.status || (SubmitDepositTxResponse2.status = {}));
|
|
669
|
+
})(SubmitDepositTxResponse || (SubmitDepositTxResponse = {}));
|
|
670
|
+
|
|
671
|
+
// src/models/TokenResponse.ts
|
|
672
|
+
var TokenResponse;
|
|
673
|
+
((TokenResponse2) => {
|
|
674
|
+
((blockchain2) => {
|
|
675
|
+
blockchain2["NEAR"] = "near";
|
|
676
|
+
blockchain2["ETH"] = "eth";
|
|
677
|
+
blockchain2["BASE"] = "base";
|
|
678
|
+
blockchain2["ARB"] = "arb";
|
|
679
|
+
blockchain2["BTC"] = "btc";
|
|
680
|
+
blockchain2["SOL"] = "sol";
|
|
681
|
+
blockchain2["TON"] = "ton";
|
|
682
|
+
blockchain2["DOGE"] = "doge";
|
|
683
|
+
blockchain2["XRP"] = "xrp";
|
|
684
|
+
blockchain2["ZEC"] = "zec";
|
|
685
|
+
blockchain2["GNOSIS"] = "gnosis";
|
|
686
|
+
blockchain2["BERA"] = "bera";
|
|
687
|
+
blockchain2["BSC"] = "bsc";
|
|
688
|
+
blockchain2["POL"] = "pol";
|
|
689
|
+
blockchain2["TRON"] = "tron";
|
|
690
|
+
blockchain2["SUI"] = "sui";
|
|
691
|
+
blockchain2["OP"] = "op";
|
|
692
|
+
blockchain2["AVAX"] = "avax";
|
|
693
|
+
blockchain2["CARDANO"] = "cardano";
|
|
694
|
+
})(TokenResponse2.blockchain || (TokenResponse2.blockchain = {}));
|
|
695
|
+
})(TokenResponse || (TokenResponse = {}));
|
|
696
|
+
|
|
697
|
+
// src/models/Status.ts
|
|
698
|
+
var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
|
|
699
|
+
TransactionStatus2["Pending"] = "pending";
|
|
700
|
+
TransactionStatus2["Success"] = "success";
|
|
701
|
+
TransactionStatus2["Failed"] = "failed";
|
|
702
|
+
return TransactionStatus2;
|
|
703
|
+
})(TransactionStatus || {});
|
|
704
|
+
|
|
705
|
+
// src/services/SFA.ts
|
|
706
|
+
var submitOneclickDepositTx = (requestBody) => {
|
|
707
|
+
return request(OpenAPI, {
|
|
708
|
+
method: "POST",
|
|
709
|
+
url: "/v0/deposit/submit",
|
|
710
|
+
body: requestBody,
|
|
711
|
+
mediaType: "application/json",
|
|
712
|
+
errors: {
|
|
713
|
+
400: `Bad Request - Invalid input data`,
|
|
714
|
+
401: `Unauthorized - JWT token is invalid`
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
};
|
|
718
|
+
var SFA = class {
|
|
719
|
+
/**
|
|
720
|
+
* Get supported tokens
|
|
721
|
+
* Retrieves a list of tokens currently supported by the StableFlow AI API for asset swaps.
|
|
722
|
+
*/
|
|
723
|
+
static getTokens() {
|
|
724
|
+
return request(OpenAPI, {
|
|
725
|
+
method: "GET",
|
|
726
|
+
url: "/v0/tokens"
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Request a swap quote
|
|
731
|
+
* Generates a swap quote based on input parameters such as the assets, amount, slippage tolerance, and recipient/refund information.
|
|
732
|
+
*/
|
|
733
|
+
static getQuote(requestBody) {
|
|
734
|
+
return request(OpenAPI, {
|
|
735
|
+
method: "POST",
|
|
736
|
+
url: "/v0/quote",
|
|
737
|
+
body: requestBody,
|
|
738
|
+
mediaType: "application/json",
|
|
739
|
+
errors: {
|
|
740
|
+
400: `Bad Request - Invalid input data`,
|
|
741
|
+
401: `Unauthorized - JWT token is invalid`
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Check swap execution status
|
|
747
|
+
* Retrieves the current status of a swap using the unique deposit address from the quote.
|
|
748
|
+
*/
|
|
749
|
+
static getExecutionStatus(depositAddress, depositMemo) {
|
|
750
|
+
return request(OpenAPI, {
|
|
751
|
+
method: "GET",
|
|
752
|
+
url: "/v0/status",
|
|
753
|
+
query: {
|
|
754
|
+
"depositAddress": depositAddress,
|
|
755
|
+
"depositMemo": depositMemo
|
|
756
|
+
},
|
|
757
|
+
errors: {
|
|
758
|
+
401: `Unauthorized - JWT token is invalid`,
|
|
759
|
+
404: `Deposit address not found`
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
/**
|
|
765
|
+
* Submit deposit transaction hash (OneClick)
|
|
766
|
+
* Optionally notifies the service that a deposit has been sent to the specified address.
|
|
767
|
+
*/
|
|
768
|
+
SFA.submitDepositTx = submitOneclickDepositTx;
|
|
769
|
+
|
|
770
|
+
// src/wallets/config/rpcs.ts
|
|
771
|
+
var NetworkRpcUrlsMap = {
|
|
772
|
+
"eth": ["https://0xrpc.io/eth"],
|
|
773
|
+
"arb": ["https://arb1.arbitrum.io/rpc"],
|
|
774
|
+
"bsc": ["https://56.rpc.thirdweb.com"],
|
|
775
|
+
"avax": ["https://api.avax.network/ext/bc/C/rpc"],
|
|
776
|
+
"base": ["https://mainnet.base.org"],
|
|
777
|
+
"pol": ["https://polygon-rpc.com"],
|
|
778
|
+
"gnosis": ["https://rpc.gnosischain.com"],
|
|
779
|
+
"op": ["https://mainnet.optimism.io"],
|
|
780
|
+
"bera": ["https://rpc.berachain.com"],
|
|
781
|
+
"tron": ["https://api.trongrid.io"],
|
|
782
|
+
"aptos": ["https://api.mainnet.aptoslabs.com/v1"],
|
|
783
|
+
"sol": ["https://solana-rpc.publicnode.com"],
|
|
784
|
+
"near": ["https://nearinner.deltarpc.com"],
|
|
785
|
+
"xlayer": ["https://rpc.xlayer.tech"],
|
|
786
|
+
"plasma": ["https://rpc.plasma.to"],
|
|
787
|
+
"mantle": ["https://rpc.mantle.xyz", "https://mantle-rpc.publicnode.com"],
|
|
788
|
+
"megaeth": ["https://mainnet.megaeth.com/rpc"],
|
|
789
|
+
"ink": ["https://rpc-gel.inkonchain.com", "https://rpc-qnd.inkonchain.com"],
|
|
790
|
+
"stable": ["https://rpc.stable.xyz"],
|
|
791
|
+
"celo": ["https://forno.celo.org"],
|
|
792
|
+
"sei": ["https://sei-evm-rpc.publicnode.com"],
|
|
793
|
+
"flare": ["https://flare-api.flare.network/ext/C/rpc"],
|
|
794
|
+
"frax": ["https://rpc.frax.com"],
|
|
795
|
+
"ton": ["https://toncenter.com/api/v2/jsonRPC"],
|
|
796
|
+
"sui": ["https://fullnode.mainnet.sui.io:443"],
|
|
797
|
+
"katana": ["https://rpc.katana.network", "https://katana.drpc.org"]
|
|
798
|
+
};
|
|
799
|
+
var getRpcUrls = (blockchain) => {
|
|
800
|
+
return NetworkRpcUrlsMap[blockchain] || [];
|
|
801
|
+
};
|
|
802
|
+
var getChainRpcUrl = (blockchain) => {
|
|
803
|
+
return {
|
|
804
|
+
rpcUrls: NetworkRpcUrlsMap[blockchain],
|
|
805
|
+
rpcUrl: NetworkRpcUrlsMap[blockchain][0]
|
|
806
|
+
};
|
|
807
|
+
};
|
|
808
|
+
var setRpcUrls = (urls) => {
|
|
809
|
+
for (const blockchain in urls) {
|
|
810
|
+
const prev = NetworkRpcUrlsMap[blockchain] ?? [];
|
|
811
|
+
const next = urls[blockchain];
|
|
812
|
+
for (let i = next.length - 1; i >= 0; i--) {
|
|
813
|
+
const rpc = next[i];
|
|
814
|
+
if (prev.some((_rpc) => _rpc.toLowerCase() === rpc.toLowerCase())) {
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
prev.unshift(rpc);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
return NetworkRpcUrlsMap;
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
// src/wallets/config/chains.ts
|
|
824
|
+
var chainTypes = {
|
|
825
|
+
near: {
|
|
826
|
+
value: "near"},
|
|
827
|
+
sol: {
|
|
828
|
+
value: "sol"},
|
|
829
|
+
evm: {
|
|
830
|
+
value: "evm"},
|
|
831
|
+
tron: {
|
|
832
|
+
value: "tron"},
|
|
833
|
+
aptos: {
|
|
834
|
+
value: "aptos"},
|
|
835
|
+
ton: {
|
|
836
|
+
value: "ton"}};
|
|
837
|
+
var getStableflowChainLogo = (name) => {
|
|
838
|
+
return `/chains/${name}.png`;
|
|
839
|
+
};
|
|
840
|
+
var chains = {
|
|
841
|
+
near: {
|
|
842
|
+
chainName: "Near",
|
|
843
|
+
blockchain: "near",
|
|
844
|
+
chainIcon: getStableflowChainLogo("near"),
|
|
845
|
+
chainIconGray: getStableflowChainLogo("near-gray"),
|
|
846
|
+
chainType: chainTypes.near.value,
|
|
847
|
+
blockExplorerUrl: "https://nearblocks.io/txns",
|
|
848
|
+
blockExplorerUrls: ["https://nearblocks.io"],
|
|
849
|
+
primaryColor: "#76EA9E",
|
|
850
|
+
nativeToken: {
|
|
851
|
+
symbol: "NEAR",
|
|
852
|
+
decimals: 24
|
|
853
|
+
},
|
|
854
|
+
...getChainRpcUrl("near")
|
|
855
|
+
},
|
|
856
|
+
sol: {
|
|
857
|
+
chainName: "Solana",
|
|
858
|
+
blockchain: "sol",
|
|
859
|
+
chainIcon: getStableflowChainLogo("solana"),
|
|
860
|
+
chainIconGray: getStableflowChainLogo("solana-gray"),
|
|
861
|
+
chainType: chainTypes.sol.value,
|
|
862
|
+
blockExplorerUrl: "https://solscan.io/tx",
|
|
863
|
+
blockExplorerUrls: ["https://solscan.io"],
|
|
864
|
+
primaryColor: "#B93EF0",
|
|
865
|
+
nativeToken: {
|
|
866
|
+
symbol: "SOL",
|
|
867
|
+
decimals: 9
|
|
868
|
+
},
|
|
869
|
+
...getChainRpcUrl("sol")
|
|
870
|
+
},
|
|
871
|
+
eth: {
|
|
872
|
+
chainName: "Ethereum",
|
|
873
|
+
blockchain: "eth",
|
|
874
|
+
chainIcon: getStableflowChainLogo("Ethereum"),
|
|
875
|
+
chainIconGray: getStableflowChainLogo("Ethereum-gray"),
|
|
876
|
+
chainType: chainTypes.evm.value,
|
|
877
|
+
chainId: 1,
|
|
878
|
+
blockExplorerUrl: "https://etherscan.io/tx",
|
|
879
|
+
blockExplorerUrls: ["https://etherscan.io"],
|
|
880
|
+
primaryColor: "#7083ee",
|
|
881
|
+
nativeToken: {
|
|
882
|
+
symbol: "ETH",
|
|
883
|
+
decimals: 18
|
|
884
|
+
},
|
|
885
|
+
...getChainRpcUrl("eth")
|
|
886
|
+
},
|
|
887
|
+
arb: {
|
|
888
|
+
chainName: "Arbitrum",
|
|
889
|
+
blockchain: "arb",
|
|
890
|
+
chainIcon: getStableflowChainLogo("Arbitrum"),
|
|
891
|
+
chainIconGray: getStableflowChainLogo("Arbitrum-gray"),
|
|
892
|
+
chainType: chainTypes.evm.value,
|
|
893
|
+
chainId: 42161,
|
|
894
|
+
blockExplorerUrl: "https://arbiscan.io/tx",
|
|
895
|
+
blockExplorerUrls: ["https://arbiscan.io"],
|
|
896
|
+
primaryColor: "#4763A7",
|
|
897
|
+
nativeToken: {
|
|
898
|
+
symbol: "ETH",
|
|
899
|
+
decimals: 18
|
|
900
|
+
},
|
|
901
|
+
...getChainRpcUrl("arb")
|
|
902
|
+
},
|
|
903
|
+
bsc: {
|
|
904
|
+
chainName: "BNB Chain",
|
|
905
|
+
blockchain: "bsc",
|
|
906
|
+
chainIcon: getStableflowChainLogo("bsc"),
|
|
907
|
+
chainIconGray: getStableflowChainLogo("bsc-gray"),
|
|
908
|
+
chainType: chainTypes.evm.value,
|
|
909
|
+
chainId: 56,
|
|
910
|
+
blockExplorerUrl: "https://bscscan.com/tx",
|
|
911
|
+
blockExplorerUrls: ["https://bscscan.com"],
|
|
912
|
+
primaryColor: "#F1C144",
|
|
913
|
+
nativeToken: {
|
|
914
|
+
symbol: "BNB",
|
|
915
|
+
decimals: 18
|
|
916
|
+
},
|
|
917
|
+
...getChainRpcUrl("bsc")
|
|
918
|
+
},
|
|
919
|
+
avax: {
|
|
920
|
+
chainName: "Avalanche",
|
|
921
|
+
blockchain: "avax",
|
|
922
|
+
chainIcon: getStableflowChainLogo("Avalanche"),
|
|
923
|
+
chainIconGray: getStableflowChainLogo("Avalanche-gray"),
|
|
924
|
+
chainType: chainTypes.evm.value,
|
|
925
|
+
chainId: 43114,
|
|
926
|
+
blockExplorerUrl: "https://snowtrace.io/tx",
|
|
927
|
+
blockExplorerUrls: ["https://snowtrace.io"],
|
|
928
|
+
primaryColor: "#9D2620",
|
|
929
|
+
nativeToken: {
|
|
930
|
+
symbol: "AVAX",
|
|
931
|
+
decimals: 18
|
|
932
|
+
},
|
|
933
|
+
...getChainRpcUrl("avax")
|
|
934
|
+
},
|
|
935
|
+
base: {
|
|
936
|
+
chainName: "Base",
|
|
937
|
+
blockchain: "base",
|
|
938
|
+
chainIcon: getStableflowChainLogo("Base"),
|
|
939
|
+
chainIconGray: getStableflowChainLogo("Base-gray"),
|
|
940
|
+
chainType: chainTypes.evm.value,
|
|
941
|
+
chainId: 8453,
|
|
942
|
+
blockExplorerUrl: "https://basescan.org/tx",
|
|
943
|
+
blockExplorerUrls: ["https://basescan.org"],
|
|
944
|
+
primaryColor: "#3137F6",
|
|
945
|
+
nativeToken: {
|
|
946
|
+
symbol: "ETH",
|
|
947
|
+
decimals: 18
|
|
948
|
+
},
|
|
949
|
+
...getChainRpcUrl("base")
|
|
950
|
+
},
|
|
951
|
+
pol: {
|
|
952
|
+
chainName: "Polygon",
|
|
953
|
+
blockchain: "pol",
|
|
954
|
+
chainIcon: getStableflowChainLogo("Polygon"),
|
|
955
|
+
chainIconGray: getStableflowChainLogo("Polygon-gray"),
|
|
956
|
+
chainType: chainTypes.evm.value,
|
|
957
|
+
chainId: 137,
|
|
958
|
+
blockExplorerUrl: "https://polygonscan.com/tx",
|
|
959
|
+
blockExplorerUrls: ["https://polygonscan.com"],
|
|
960
|
+
primaryColor: "#5A2AD1",
|
|
961
|
+
nativeToken: {
|
|
962
|
+
symbol: "POL",
|
|
963
|
+
decimals: 18
|
|
964
|
+
},
|
|
965
|
+
...getChainRpcUrl("pol")
|
|
966
|
+
},
|
|
967
|
+
gnosis: {
|
|
968
|
+
...getChainRpcUrl("gnosis")
|
|
969
|
+
},
|
|
970
|
+
op: {
|
|
971
|
+
chainName: "Optimism",
|
|
972
|
+
blockchain: "op",
|
|
973
|
+
chainIcon: getStableflowChainLogo("Optimism"),
|
|
974
|
+
chainIconGray: getStableflowChainLogo("Optimism-gray"),
|
|
975
|
+
chainType: chainTypes.evm.value,
|
|
976
|
+
chainId: 10,
|
|
977
|
+
blockExplorerUrl: "https://optimistic.etherscan.io/tx",
|
|
978
|
+
blockExplorerUrls: ["https://optimistic.etherscan.io"],
|
|
979
|
+
primaryColor: "#B5271D",
|
|
980
|
+
nativeToken: {
|
|
981
|
+
symbol: "ETH",
|
|
982
|
+
decimals: 18
|
|
983
|
+
},
|
|
984
|
+
...getChainRpcUrl("op")
|
|
985
|
+
},
|
|
986
|
+
tron: {
|
|
987
|
+
chainName: "Tron",
|
|
988
|
+
blockchain: "tron",
|
|
989
|
+
chainIcon: getStableflowChainLogo("Tron"),
|
|
990
|
+
chainIconGray: getStableflowChainLogo("Tron-gray"),
|
|
991
|
+
chainType: chainTypes.tron.value,
|
|
992
|
+
blockExplorerUrl: "https://tronscan.org/#/transaction",
|
|
993
|
+
blockExplorerUrls: ["https://tronscan.org"],
|
|
994
|
+
primaryColor: "#BC3221",
|
|
995
|
+
nativeToken: {
|
|
996
|
+
symbol: "TRX",
|
|
997
|
+
decimals: 6
|
|
998
|
+
},
|
|
999
|
+
...getChainRpcUrl("tron")
|
|
1000
|
+
},
|
|
1001
|
+
aptos: {
|
|
1002
|
+
chainName: "Aptos",
|
|
1003
|
+
blockchain: "aptos",
|
|
1004
|
+
chainIcon: getStableflowChainLogo("Aptos"),
|
|
1005
|
+
chainIconGray: getStableflowChainLogo("Aptos-gray"),
|
|
1006
|
+
chainType: chainTypes.aptos.value,
|
|
1007
|
+
blockExplorerUrl: "https://aptoscan.com/transaction",
|
|
1008
|
+
blockExplorerUrls: ["https://aptoscan.com"],
|
|
1009
|
+
primaryColor: "#000000",
|
|
1010
|
+
nativeToken: {
|
|
1011
|
+
symbol: "APT",
|
|
1012
|
+
decimals: 8
|
|
1013
|
+
},
|
|
1014
|
+
...getChainRpcUrl("aptos")
|
|
1015
|
+
},
|
|
1016
|
+
bera: {
|
|
1017
|
+
chainName: "Berachain",
|
|
1018
|
+
blockchain: "bera",
|
|
1019
|
+
chainIcon: getStableflowChainLogo("Berachain"),
|
|
1020
|
+
chainIconGray: getStableflowChainLogo("Berachain-gray"),
|
|
1021
|
+
chainType: chainTypes.evm.value,
|
|
1022
|
+
chainId: 80094,
|
|
1023
|
+
blockExplorerUrl: "https://berascan.com/tx/",
|
|
1024
|
+
blockExplorerUrls: ["https://berascan.com"],
|
|
1025
|
+
primaryColor: "#F37325",
|
|
1026
|
+
nativeToken: {
|
|
1027
|
+
symbol: "BERA",
|
|
1028
|
+
decimals: 18
|
|
1029
|
+
},
|
|
1030
|
+
...getChainRpcUrl("bera")
|
|
1031
|
+
},
|
|
1032
|
+
xlayer: {
|
|
1033
|
+
chainName: "X Layer",
|
|
1034
|
+
blockchain: "xlayer",
|
|
1035
|
+
chainIcon: getStableflowChainLogo("xlayer"),
|
|
1036
|
+
chainIconGray: getStableflowChainLogo("xlayer-gray"),
|
|
1037
|
+
chainType: chainTypes.evm.value,
|
|
1038
|
+
chainId: 196,
|
|
1039
|
+
blockExplorerUrl: "https://www.oklink.com/xlayer/tx/",
|
|
1040
|
+
blockExplorerUrls: ["https://www.oklink.com"],
|
|
1041
|
+
primaryColor: "#000000",
|
|
1042
|
+
nativeToken: {
|
|
1043
|
+
symbol: "OKB",
|
|
1044
|
+
decimals: 18
|
|
1045
|
+
},
|
|
1046
|
+
...getChainRpcUrl("xlayer")
|
|
1047
|
+
},
|
|
1048
|
+
plasma: {
|
|
1049
|
+
chainName: "Plasma",
|
|
1050
|
+
blockchain: "plasma",
|
|
1051
|
+
chainIcon: getStableflowChainLogo("Plasma"),
|
|
1052
|
+
chainIconGray: getStableflowChainLogo("Plasma-gray"),
|
|
1053
|
+
chainType: chainTypes.evm.value,
|
|
1054
|
+
chainId: 9745,
|
|
1055
|
+
blockExplorerUrl: "https://plasmascan.to/tx/",
|
|
1056
|
+
blockExplorerUrls: ["https://plasmascan.to"],
|
|
1057
|
+
primaryColor: "#162F29",
|
|
1058
|
+
nativeToken: {
|
|
1059
|
+
symbol: "XPL",
|
|
1060
|
+
decimals: 18
|
|
1061
|
+
},
|
|
1062
|
+
...getChainRpcUrl("plasma")
|
|
1063
|
+
},
|
|
1064
|
+
ton: {
|
|
1065
|
+
chainName: "Ton",
|
|
1066
|
+
blockchain: "ton",
|
|
1067
|
+
chainIcon: getStableflowChainLogo("Ton"),
|
|
1068
|
+
chainIconGray: getStableflowChainLogo("Ton-gray"),
|
|
1069
|
+
chainType: chainTypes.ton.value,
|
|
1070
|
+
blockExplorerUrl: "https://tonviewer.com/transaction/",
|
|
1071
|
+
blockExplorerUrls: ["https://tonviewer.com"],
|
|
1072
|
+
primaryColor: "#0098EA",
|
|
1073
|
+
nativeToken: {
|
|
1074
|
+
symbol: "TON",
|
|
1075
|
+
decimals: 9
|
|
1076
|
+
},
|
|
1077
|
+
...getChainRpcUrl("ton")
|
|
1078
|
+
},
|
|
1079
|
+
mantle: {
|
|
1080
|
+
chainName: "Mantle",
|
|
1081
|
+
blockchain: "mantle",
|
|
1082
|
+
chainIcon: getStableflowChainLogo("Mantle"),
|
|
1083
|
+
chainIconGray: getStableflowChainLogo("Mantle-gray"),
|
|
1084
|
+
chainType: chainTypes.evm.value,
|
|
1085
|
+
chainId: 5e3,
|
|
1086
|
+
blockExplorerUrl: "https://mantlescan.xyz/tx/",
|
|
1087
|
+
blockExplorerUrls: ["https://mantlescan.xyz"],
|
|
1088
|
+
primaryColor: "#162F29",
|
|
1089
|
+
nativeToken: {
|
|
1090
|
+
symbol: "MNT",
|
|
1091
|
+
decimals: 18
|
|
1092
|
+
},
|
|
1093
|
+
...getChainRpcUrl("mantle")
|
|
1094
|
+
},
|
|
1095
|
+
megaeth: {
|
|
1096
|
+
chainName: "MegaETH",
|
|
1097
|
+
blockchain: "megaeth",
|
|
1098
|
+
chainIcon: getStableflowChainLogo("MegaETH"),
|
|
1099
|
+
chainIconGray: getStableflowChainLogo("MegaETH-gray"),
|
|
1100
|
+
chainType: chainTypes.evm.value,
|
|
1101
|
+
chainId: 4326,
|
|
1102
|
+
blockExplorerUrl: "https://mega.etherscan.io/tx/",
|
|
1103
|
+
blockExplorerUrls: ["https://mega.etherscan.io"],
|
|
1104
|
+
primaryColor: "#19191A",
|
|
1105
|
+
nativeToken: {
|
|
1106
|
+
symbol: "ETH",
|
|
1107
|
+
decimals: 18
|
|
1108
|
+
},
|
|
1109
|
+
...getChainRpcUrl("megaeth")
|
|
1110
|
+
},
|
|
1111
|
+
ink: {
|
|
1112
|
+
chainName: "Ink",
|
|
1113
|
+
blockchain: "ink",
|
|
1114
|
+
chainIcon: getStableflowChainLogo("Ink"),
|
|
1115
|
+
chainIconGray: getStableflowChainLogo("Ink-gray"),
|
|
1116
|
+
chainType: chainTypes.evm.value,
|
|
1117
|
+
chainId: 57073,
|
|
1118
|
+
blockExplorerUrl: "https://explorer.inkonchain.com/tx/",
|
|
1119
|
+
blockExplorerUrls: ["https://explorer.inkonchain.com"],
|
|
1120
|
+
primaryColor: "#7132F5",
|
|
1121
|
+
nativeToken: {
|
|
1122
|
+
symbol: "ETH",
|
|
1123
|
+
decimals: 18
|
|
1124
|
+
},
|
|
1125
|
+
...getChainRpcUrl("ink")
|
|
1126
|
+
},
|
|
1127
|
+
stable: {
|
|
1128
|
+
chainName: "Stable",
|
|
1129
|
+
blockchain: "stable",
|
|
1130
|
+
chainIcon: getStableflowChainLogo("Stable"),
|
|
1131
|
+
chainIconGray: getStableflowChainLogo("Stable-gray"),
|
|
1132
|
+
chainType: chainTypes.evm.value,
|
|
1133
|
+
chainId: 988,
|
|
1134
|
+
blockExplorerUrl: "https://uniscan.xyz/tx/",
|
|
1135
|
+
blockExplorerUrls: ["https://uniscan.xyz"],
|
|
1136
|
+
primaryColor: "#01241D",
|
|
1137
|
+
nativeToken: {
|
|
1138
|
+
symbol: "USDT0",
|
|
1139
|
+
decimals: 18
|
|
1140
|
+
},
|
|
1141
|
+
...getChainRpcUrl("stable")
|
|
1142
|
+
},
|
|
1143
|
+
celo: {
|
|
1144
|
+
chainName: "Celo",
|
|
1145
|
+
blockchain: "celo",
|
|
1146
|
+
chainIcon: getStableflowChainLogo("Celo"),
|
|
1147
|
+
chainIconGray: getStableflowChainLogo("Celo-gray"),
|
|
1148
|
+
chainType: chainTypes.evm.value,
|
|
1149
|
+
chainId: 42220,
|
|
1150
|
+
blockExplorerUrl: "https://celoscan.io/tx/",
|
|
1151
|
+
blockExplorerUrls: ["https://celoscan.io"],
|
|
1152
|
+
primaryColor: "#FCFF52",
|
|
1153
|
+
nativeToken: {
|
|
1154
|
+
symbol: "CELO",
|
|
1155
|
+
decimals: 18
|
|
1156
|
+
},
|
|
1157
|
+
...getChainRpcUrl("celo")
|
|
1158
|
+
},
|
|
1159
|
+
sei: {
|
|
1160
|
+
chainName: "Sei",
|
|
1161
|
+
blockchain: "sei",
|
|
1162
|
+
chainIcon: getStableflowChainLogo("Sei"),
|
|
1163
|
+
chainIconGray: getStableflowChainLogo("Sei-gray"),
|
|
1164
|
+
chainType: chainTypes.evm.value,
|
|
1165
|
+
chainId: 1329,
|
|
1166
|
+
blockExplorerUrl: "https://seitrace.com/tx/",
|
|
1167
|
+
blockExplorerUrls: ["https://seitrace.com"],
|
|
1168
|
+
primaryColor: "#991717",
|
|
1169
|
+
nativeToken: {
|
|
1170
|
+
symbol: "SEI",
|
|
1171
|
+
decimals: 18
|
|
1172
|
+
},
|
|
1173
|
+
...getChainRpcUrl("sei")
|
|
1174
|
+
},
|
|
1175
|
+
flare: {
|
|
1176
|
+
chainName: "Flare",
|
|
1177
|
+
blockchain: "flare",
|
|
1178
|
+
chainIcon: getStableflowChainLogo("Flare"),
|
|
1179
|
+
chainIconGray: getStableflowChainLogo("Flare-gray"),
|
|
1180
|
+
chainType: chainTypes.evm.value,
|
|
1181
|
+
chainId: 14,
|
|
1182
|
+
blockExplorerUrl: "https://flare-explorer.flare.network/tx/",
|
|
1183
|
+
blockExplorerUrls: ["https://flare-explorer.flare.network"],
|
|
1184
|
+
primaryColor: "#E62058",
|
|
1185
|
+
nativeToken: {
|
|
1186
|
+
symbol: "FLR",
|
|
1187
|
+
decimals: 18
|
|
1188
|
+
},
|
|
1189
|
+
...getChainRpcUrl("flare")
|
|
1190
|
+
},
|
|
1191
|
+
frax: {
|
|
1192
|
+
chainName: "Fraxtal",
|
|
1193
|
+
blockchain: "frax",
|
|
1194
|
+
chainIcon: getStableflowChainLogo("Frax"),
|
|
1195
|
+
chainIconGray: getStableflowChainLogo("Frax-gray"),
|
|
1196
|
+
chainType: chainTypes.evm.value,
|
|
1197
|
+
chainId: 252,
|
|
1198
|
+
blockExplorerUrl: "https://fraxscan.com/tx/",
|
|
1199
|
+
blockExplorerUrls: ["https://fraxscan.com"],
|
|
1200
|
+
primaryColor: "#000",
|
|
1201
|
+
nativeToken: {
|
|
1202
|
+
symbol: "FRAX",
|
|
1203
|
+
decimals: 18
|
|
1204
|
+
},
|
|
1205
|
+
...getChainRpcUrl("frax")
|
|
1206
|
+
},
|
|
1207
|
+
sui: {
|
|
1208
|
+
...getChainRpcUrl("sui")
|
|
1209
|
+
},
|
|
1210
|
+
katana: {
|
|
1211
|
+
...getChainRpcUrl("katana")
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
var chains_default = chains;
|
|
1215
|
+
|
|
1216
|
+
// src/wallets/config/usdt.ts
|
|
1217
|
+
var usdt = {
|
|
1218
|
+
symbol: "USDT",
|
|
1219
|
+
decimals: 6,
|
|
1220
|
+
icon: "/usdt.png",
|
|
1221
|
+
name: "Tether USD"
|
|
1222
|
+
};
|
|
1223
|
+
var usdtChains = {
|
|
1224
|
+
eth: {
|
|
1225
|
+
...usdt,
|
|
1226
|
+
assetId: "nep141:eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near",
|
|
1227
|
+
contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
1228
|
+
...chains_default.eth,
|
|
1229
|
+
services: [Service.OneClick, Service.Usdt0, Service.Native]
|
|
1230
|
+
},
|
|
1231
|
+
bsc: {
|
|
1232
|
+
...usdt,
|
|
1233
|
+
assetId: "nep245:v2_1.omni.hot.tg:56_2CMMyVTGZkeyNZTSvS5sarzfir6g",
|
|
1234
|
+
contractAddress: "0x55d398326f99059ff775485246999027b3197955",
|
|
1235
|
+
...chains_default.bsc,
|
|
1236
|
+
decimals: 18,
|
|
1237
|
+
services: [Service.OneClick, Service.Native]
|
|
1238
|
+
},
|
|
1239
|
+
op: {
|
|
1240
|
+
...usdt,
|
|
1241
|
+
assetId: "nep245:v2_1.omni.hot.tg:10_359RPSJVdTxwTJT9TyGssr2rFoWo",
|
|
1242
|
+
contractAddress: "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58",
|
|
1243
|
+
...chains_default.op,
|
|
1244
|
+
services: [Service.OneClick]
|
|
1245
|
+
},
|
|
1246
|
+
avax: {
|
|
1247
|
+
...usdt,
|
|
1248
|
+
assetId: "nep245:v2_1.omni.hot.tg:43114_372BeH7ENZieCaabwkbWkBiTTgXp",
|
|
1249
|
+
contractAddress: "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
|
|
1250
|
+
...chains_default.avax,
|
|
1251
|
+
services: [Service.OneClick]
|
|
1252
|
+
},
|
|
1253
|
+
// disabled gnosis temporarily, 22/Oct/2025
|
|
1254
|
+
// gnosis: {
|
|
1255
|
+
// ...usdt,
|
|
1256
|
+
// assetId: "nep141:gnosis-0x4ecaba5870353805a9f068101a40e0f32ed605c6.omft.near",
|
|
1257
|
+
// contractAddress: "0x4ecaba5870353805a9f068101a40e0f32ed605c6",
|
|
1258
|
+
// ...chains.gnosis,
|
|
1259
|
+
// services: [Service.OneClick],
|
|
1260
|
+
// },
|
|
1261
|
+
near: {
|
|
1262
|
+
...usdt,
|
|
1263
|
+
assetId: "nep141:usdt.tether-token.near",
|
|
1264
|
+
contractAddress: "usdt.tether-token.near",
|
|
1265
|
+
...chains_default.near,
|
|
1266
|
+
services: [Service.OneClick]
|
|
1267
|
+
},
|
|
1268
|
+
sol: {
|
|
1269
|
+
...usdt,
|
|
1270
|
+
assetId: "nep141:sol-c800a4bd850783ccb82c2b2c7e84175443606352.omft.near",
|
|
1271
|
+
contractAddress: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
|
|
1272
|
+
...chains_default.sol,
|
|
1273
|
+
services: [Service.OneClick, Service.Usdt0]
|
|
1274
|
+
},
|
|
1275
|
+
tron: {
|
|
1276
|
+
...usdt,
|
|
1277
|
+
assetId: "nep141:tron-d28a265909efecdcee7c5028585214ea0b96f015.omft.near",
|
|
1278
|
+
contractAddress: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
|
|
1279
|
+
...chains_default.tron,
|
|
1280
|
+
services: [Service.OneClick, Service.Usdt0]
|
|
1281
|
+
},
|
|
1282
|
+
aptos: {
|
|
1283
|
+
...usdt,
|
|
1284
|
+
assetId: "nep141:aptos-88cb7619440a914fe6400149a12b443c3ac21d59.omft.near",
|
|
1285
|
+
contractAddress: "0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b",
|
|
1286
|
+
...chains_default.aptos,
|
|
1287
|
+
services: [Service.OneClick]
|
|
1288
|
+
},
|
|
1289
|
+
ton: {
|
|
1290
|
+
...usdt,
|
|
1291
|
+
assetId: "nep245:v2_1.omni.hot.tg:1117_3tsdfyziyc7EJbP2aULWSKU4toBaAcN4FdTgfm5W1mC4ouR",
|
|
1292
|
+
contractAddress: "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
|
|
1293
|
+
...chains_default.ton,
|
|
1294
|
+
services: [Service.OneClick, Service.Usdt0]
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
({
|
|
1298
|
+
...usdtChains.sol,
|
|
1299
|
+
chains: [usdtChains.sol]
|
|
1300
|
+
});
|
|
1301
|
+
({
|
|
1302
|
+
...usdtChains.near,
|
|
1303
|
+
chains: [usdtChains.near]
|
|
1304
|
+
});
|
|
1305
|
+
({
|
|
1306
|
+
chains: Object.values(usdtChains).filter((chain) => chain.chainType === "evm")
|
|
1307
|
+
});
|
|
1308
|
+
({
|
|
1309
|
+
...usdtChains.tron,
|
|
1310
|
+
chains: [usdtChains.tron]
|
|
1311
|
+
});
|
|
1312
|
+
({
|
|
1313
|
+
...usdtChains.aptos,
|
|
1314
|
+
chains: [usdtChains.aptos]
|
|
1315
|
+
});
|
|
1316
|
+
({
|
|
1317
|
+
...usdtChains.ton,
|
|
1318
|
+
chains: [usdtChains.ton]
|
|
1319
|
+
});
|
|
1320
|
+
|
|
1321
|
+
// src/wallets/config/usdt0.ts
|
|
1322
|
+
var usdt0 = {
|
|
1323
|
+
symbol: "USD\u20AE0",
|
|
1324
|
+
decimals: 6,
|
|
1325
|
+
icon: "/usdt0.png",
|
|
1326
|
+
name: "USD\u20AE0"
|
|
1327
|
+
};
|
|
1328
|
+
var usdt0Chains = {
|
|
1329
|
+
// eth: {
|
|
1330
|
+
// ...usdt0,
|
|
1331
|
+
// symbol: "USDT",
|
|
1332
|
+
// icon: "/usdt.png",
|
|
1333
|
+
// assetId: "nep141:eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near",
|
|
1334
|
+
// contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
1335
|
+
// ...chains.eth,
|
|
1336
|
+
// services: [Service.OneClick, Service.Usdt0, Service.Native],
|
|
1337
|
+
// },
|
|
1338
|
+
arb: {
|
|
1339
|
+
...usdt0,
|
|
1340
|
+
assetId: "nep141:arb-0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9.omft.near",
|
|
1341
|
+
contractAddress: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
|
|
1342
|
+
...chains_default.arb,
|
|
1343
|
+
services: [Service.OneClick, Service.Usdt0, Service.Native]
|
|
1344
|
+
},
|
|
1345
|
+
pol: {
|
|
1346
|
+
...usdt0,
|
|
1347
|
+
assetId: "nep245:v2_1.omni.hot.tg:137_3hpYoaLtt8MP1Z2GH1U473DMRKgr",
|
|
1348
|
+
contractAddress: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
|
|
1349
|
+
...chains_default.pol,
|
|
1350
|
+
services: [Service.OneClick, Service.Usdt0]
|
|
1351
|
+
},
|
|
1352
|
+
op: {
|
|
1353
|
+
...usdt0,
|
|
1354
|
+
assetId: "",
|
|
1355
|
+
contractAddress: "0x01bFF41798a0BcF287b996046Ca68b395DbC1071",
|
|
1356
|
+
...chains_default.op,
|
|
1357
|
+
services: [Service.Usdt0]
|
|
1358
|
+
},
|
|
1359
|
+
bera: {
|
|
1360
|
+
...usdt0,
|
|
1361
|
+
assetId: "nep141:bera-0x779ded0c9e1022225f8e0630b35a9b54be713736.omft.near",
|
|
1362
|
+
contractAddress: "0x779Ded0c9e1022225f8E0630b35a9b54bE713736",
|
|
1363
|
+
...chains_default.bera,
|
|
1364
|
+
services: [Service.OneClick, Service.Usdt0]
|
|
1365
|
+
},
|
|
1366
|
+
xlayer: {
|
|
1367
|
+
...usdt0,
|
|
1368
|
+
assetId: "nep245:v2_1.omni.hot.tg:196_2fezDCvVYRsG8wrK6deJ2VRPiAS1",
|
|
1369
|
+
contractAddress: "0x779ded0c9e1022225f8e0630b35a9b54be713736",
|
|
1370
|
+
...chains_default.xlayer,
|
|
1371
|
+
services: [Service.OneClick, Service.Usdt0]
|
|
1372
|
+
},
|
|
1373
|
+
plasma: {
|
|
1374
|
+
...usdt0,
|
|
1375
|
+
assetId: "nep245:v2_1.omni.hot.tg:9745_3aL9skCy1yhPoDB8oKMmRHRN7SJW",
|
|
1376
|
+
contractAddress: "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb",
|
|
1377
|
+
...chains_default.plasma,
|
|
1378
|
+
services: [Service.OneClick, Service.Usdt0]
|
|
1379
|
+
},
|
|
1380
|
+
mantle: {
|
|
1381
|
+
...usdt0,
|
|
1382
|
+
assetId: "",
|
|
1383
|
+
contractAddress: "0x779Ded0c9e1022225f8E0630b35a9b54bE713736",
|
|
1384
|
+
...chains_default.mantle,
|
|
1385
|
+
services: [Service.Usdt0]
|
|
1386
|
+
},
|
|
1387
|
+
megaeth: {
|
|
1388
|
+
...usdt0,
|
|
1389
|
+
assetId: "",
|
|
1390
|
+
contractAddress: "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb",
|
|
1391
|
+
...chains_default.megaeth,
|
|
1392
|
+
services: [Service.Usdt0]
|
|
1393
|
+
},
|
|
1394
|
+
ink: {
|
|
1395
|
+
...usdt0,
|
|
1396
|
+
assetId: "",
|
|
1397
|
+
contractAddress: "0x0200C29006150606B650577BBE7B6248F58470c1",
|
|
1398
|
+
...chains_default.ink,
|
|
1399
|
+
services: [Service.Usdt0]
|
|
1400
|
+
},
|
|
1401
|
+
stable: {
|
|
1402
|
+
...usdt0,
|
|
1403
|
+
assetId: "",
|
|
1404
|
+
contractAddress: "0x779Ded0c9e1022225f8E0630b35a9b54bE713736",
|
|
1405
|
+
...chains_default.stable,
|
|
1406
|
+
services: [Service.Usdt0]
|
|
1407
|
+
},
|
|
1408
|
+
celo: {
|
|
1409
|
+
...usdt0,
|
|
1410
|
+
assetId: "",
|
|
1411
|
+
contractAddress: "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e",
|
|
1412
|
+
...chains_default.celo,
|
|
1413
|
+
services: [Service.Usdt0]
|
|
1414
|
+
},
|
|
1415
|
+
sei: {
|
|
1416
|
+
...usdt0,
|
|
1417
|
+
assetId: "",
|
|
1418
|
+
contractAddress: "0x9151434b16b9763660705744891fA906F660EcC5",
|
|
1419
|
+
...chains_default.sei,
|
|
1420
|
+
services: [Service.Usdt0]
|
|
1421
|
+
},
|
|
1422
|
+
flare: {
|
|
1423
|
+
...usdt0,
|
|
1424
|
+
assetId: "",
|
|
1425
|
+
contractAddress: "0xe7cd86e13AC4309349F30B3435a9d337750fC82D",
|
|
1426
|
+
...chains_default.flare,
|
|
1427
|
+
services: [Service.Usdt0]
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1430
|
+
({
|
|
1431
|
+
chains: Object.values(usdt0Chains).filter((chain) => chain.chainType === "evm")
|
|
1432
|
+
});
|
|
1433
|
+
|
|
1434
|
+
// src/wallets/config/usdc.ts
|
|
1435
|
+
var usdc = {
|
|
1436
|
+
symbol: "USDC",
|
|
1437
|
+
decimals: 6,
|
|
1438
|
+
icon: "/usdc.png",
|
|
1439
|
+
name: "USD Coin"
|
|
1440
|
+
};
|
|
1441
|
+
var usdcChains = {
|
|
1442
|
+
eth: {
|
|
1443
|
+
...usdc,
|
|
1444
|
+
assetId: "nep141:eth-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.omft.near",
|
|
1445
|
+
contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
1446
|
+
...chains_default.eth,
|
|
1447
|
+
services: [Service.OneClick, Service.CCTP, Service.Native]
|
|
1448
|
+
},
|
|
1449
|
+
arb: {
|
|
1450
|
+
...usdc,
|
|
1451
|
+
assetId: "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near",
|
|
1452
|
+
contractAddress: "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
|
|
1453
|
+
...chains_default.arb,
|
|
1454
|
+
services: [Service.OneClick, Service.CCTP, Service.Native]
|
|
1455
|
+
},
|
|
1456
|
+
base: {
|
|
1457
|
+
...usdc,
|
|
1458
|
+
assetId: "nep141:base-0x833589fcd6edb6e08f4c7c32d4f71b54bda02913.omft.near",
|
|
1459
|
+
contractAddress: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
1460
|
+
...chains_default.base,
|
|
1461
|
+
services: [Service.OneClick, Service.CCTP, Service.Native]
|
|
1462
|
+
},
|
|
1463
|
+
// gnosis: {
|
|
1464
|
+
// ...usdc,
|
|
1465
|
+
// assetId:
|
|
1466
|
+
// "nep141:gnosis-0x2a22f9c3b484c3629090feed35f17ff8f88f76f0.omft.near",
|
|
1467
|
+
// contractAddress: "0x2a22f9c3b484c3629090feed35f17ff8f88f76f0",
|
|
1468
|
+
// ...chains.gnosis,
|
|
1469
|
+
// services: [Service.OneClick],
|
|
1470
|
+
// },
|
|
1471
|
+
pol: {
|
|
1472
|
+
...usdc,
|
|
1473
|
+
assetId: "nep245:v2_1.omni.hot.tg:137_qiStmoQJDQPTebaPjgx5VBxZv6L",
|
|
1474
|
+
contractAddress: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
|
|
1475
|
+
...chains_default.pol,
|
|
1476
|
+
services: [Service.OneClick, Service.CCTP]
|
|
1477
|
+
},
|
|
1478
|
+
bsc: {
|
|
1479
|
+
...usdc,
|
|
1480
|
+
assetId: "nep245:v2_1.omni.hot.tg:56_2w93GqMcEmQFDru84j3HZZWt557r",
|
|
1481
|
+
contractAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
|
|
1482
|
+
...chains_default.bsc,
|
|
1483
|
+
decimals: 18,
|
|
1484
|
+
services: [Service.OneClick, Service.Native]
|
|
1485
|
+
},
|
|
1486
|
+
op: {
|
|
1487
|
+
...usdc,
|
|
1488
|
+
assetId: "nep245:v2_1.omni.hot.tg:10_A2ewyUyDp6qsue1jqZsGypkCxRJ",
|
|
1489
|
+
contractAddress: "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
|
|
1490
|
+
...chains_default.op,
|
|
1491
|
+
services: [Service.OneClick, Service.CCTP]
|
|
1492
|
+
},
|
|
1493
|
+
avax: {
|
|
1494
|
+
...usdc,
|
|
1495
|
+
assetId: "nep245:v2_1.omni.hot.tg:43114_3atVJH3r5c4GqiSYmg9fECvjc47o",
|
|
1496
|
+
contractAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
|
|
1497
|
+
...chains_default.avax,
|
|
1498
|
+
services: [Service.OneClick, Service.CCTP]
|
|
1499
|
+
},
|
|
1500
|
+
near: {
|
|
1501
|
+
...usdc,
|
|
1502
|
+
assetId: "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1",
|
|
1503
|
+
contractAddress: "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1",
|
|
1504
|
+
...chains_default.near,
|
|
1505
|
+
services: [Service.OneClick]
|
|
1506
|
+
},
|
|
1507
|
+
sol: {
|
|
1508
|
+
...usdc,
|
|
1509
|
+
assetId: "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near",
|
|
1510
|
+
contractAddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
1511
|
+
...chains_default.sol,
|
|
1512
|
+
services: [Service.OneClick, Service.CCTP]
|
|
1513
|
+
},
|
|
1514
|
+
xlayer: {
|
|
1515
|
+
...usdc,
|
|
1516
|
+
assetId: "nep245:v2_1.omni.hot.tg:196_2dK9kLNR7Ekq7su8FxNGiUW3djTw",
|
|
1517
|
+
contractAddress: "0x74b7f16337b8972027f6196a17a631ac6de26d22",
|
|
1518
|
+
...chains_default.xlayer,
|
|
1519
|
+
services: [Service.OneClick]
|
|
1520
|
+
},
|
|
1521
|
+
aptos: {
|
|
1522
|
+
...usdc,
|
|
1523
|
+
assetId: "nep141:aptos-34ee497f210c5a511e8d5b53bc56d75b63612bb5.omft.near",
|
|
1524
|
+
contractAddress: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
|
|
1525
|
+
...chains_default.aptos,
|
|
1526
|
+
services: [Service.OneClick]
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
({
|
|
1530
|
+
...usdcChains.sol,
|
|
1531
|
+
chains: [usdcChains.sol]
|
|
1532
|
+
});
|
|
1533
|
+
({
|
|
1534
|
+
...usdcChains.near,
|
|
1535
|
+
chains: [usdcChains.near]
|
|
1536
|
+
});
|
|
1537
|
+
({
|
|
1538
|
+
...usdcChains.aptos,
|
|
1539
|
+
chains: [usdcChains.aptos]
|
|
1540
|
+
});
|
|
1541
|
+
({
|
|
1542
|
+
chains: Object.values(usdcChains).filter((chain) => chain.chainType === "evm")
|
|
1543
|
+
});
|
|
1544
|
+
|
|
1545
|
+
// src/wallets/config/frxusd.ts
|
|
1546
|
+
var frxusd = {
|
|
1547
|
+
symbol: "frxUSD",
|
|
1548
|
+
decimals: 18,
|
|
1549
|
+
icon: "/frxusd.png",
|
|
1550
|
+
name: "Frax USD"
|
|
1551
|
+
};
|
|
1552
|
+
var frxusdChains = {
|
|
1553
|
+
frax: {
|
|
1554
|
+
...frxusd,
|
|
1555
|
+
assetId: "",
|
|
1556
|
+
contractAddress: "0xFc00000000000000000000000000000000000001",
|
|
1557
|
+
...chains_default.frax,
|
|
1558
|
+
services: [Service.FraxZero]
|
|
1559
|
+
},
|
|
1560
|
+
eth: {
|
|
1561
|
+
...frxusd,
|
|
1562
|
+
assetId: "",
|
|
1563
|
+
contractAddress: "0xCAcd6fd266aF91b8AeD52aCCc382b4e165586E29",
|
|
1564
|
+
...chains_default.eth,
|
|
1565
|
+
services: [Service.FraxZero]
|
|
1566
|
+
},
|
|
1567
|
+
arb: {
|
|
1568
|
+
...frxusd,
|
|
1569
|
+
assetId: "",
|
|
1570
|
+
contractAddress: "0x80Eede496655FB9047dd39d9f418d5483ED600df",
|
|
1571
|
+
...chains_default.arb,
|
|
1572
|
+
services: [Service.FraxZero]
|
|
1573
|
+
},
|
|
1574
|
+
avax: {
|
|
1575
|
+
...frxusd,
|
|
1576
|
+
assetId: "",
|
|
1577
|
+
contractAddress: "0x80Eede496655FB9047dd39d9f418d5483ED600df",
|
|
1578
|
+
...chains_default.avax,
|
|
1579
|
+
services: [Service.FraxZero]
|
|
1580
|
+
},
|
|
1581
|
+
// base: {
|
|
1582
|
+
// ...frxusd,
|
|
1583
|
+
// assetId: "",
|
|
1584
|
+
// contractAddress: "0xe5020A6d073a794B6E7f05678707dE47986Fb0b6",
|
|
1585
|
+
// ...chains.base,
|
|
1586
|
+
// services: [Service.FraxZero],
|
|
1587
|
+
// },
|
|
1588
|
+
bera: {
|
|
1589
|
+
...frxusd,
|
|
1590
|
+
assetId: "",
|
|
1591
|
+
contractAddress: "0x80Eede496655FB9047dd39d9f418d5483ED600df",
|
|
1592
|
+
...chains_default.bera,
|
|
1593
|
+
services: [Service.FraxZero]
|
|
1594
|
+
},
|
|
1595
|
+
bsc: {
|
|
1596
|
+
...frxusd,
|
|
1597
|
+
assetId: "",
|
|
1598
|
+
contractAddress: "0x80Eede496655FB9047dd39d9f418d5483ED600df",
|
|
1599
|
+
...chains_default.bsc,
|
|
1600
|
+
services: [Service.FraxZero]
|
|
1601
|
+
},
|
|
1602
|
+
op: {
|
|
1603
|
+
...frxusd,
|
|
1604
|
+
assetId: "",
|
|
1605
|
+
contractAddress: "0x80Eede496655FB9047dd39d9f418d5483ED600df",
|
|
1606
|
+
...chains_default.op,
|
|
1607
|
+
services: [Service.FraxZero]
|
|
1608
|
+
},
|
|
1609
|
+
pol: {
|
|
1610
|
+
...frxusd,
|
|
1611
|
+
assetId: "",
|
|
1612
|
+
contractAddress: "0x80Eede496655FB9047dd39d9f418d5483ED600df",
|
|
1613
|
+
...chains_default.pol,
|
|
1614
|
+
services: [Service.FraxZero]
|
|
1615
|
+
},
|
|
1616
|
+
xlayer: {
|
|
1617
|
+
...frxusd,
|
|
1618
|
+
assetId: "",
|
|
1619
|
+
contractAddress: "0x80eede496655fb9047dd39d9f418d5483ed600df",
|
|
1620
|
+
...chains_default.xlayer,
|
|
1621
|
+
services: [Service.FraxZero]
|
|
1622
|
+
},
|
|
1623
|
+
sol: {
|
|
1624
|
+
...frxusd,
|
|
1625
|
+
assetId: "",
|
|
1626
|
+
contractAddress: "GzX1ireZDU865FiMaKrdVB1H6AE8LAqWYCg6chrMrfBw",
|
|
1627
|
+
decimals: 9,
|
|
1628
|
+
...chains_default.sol,
|
|
1629
|
+
services: [Service.FraxZero]
|
|
1630
|
+
}
|
|
1631
|
+
};
|
|
1632
|
+
({
|
|
1633
|
+
...frxusdChains.sol,
|
|
1634
|
+
chains: [frxusdChains.sol]
|
|
1635
|
+
});
|
|
1636
|
+
({
|
|
1637
|
+
chains: Object.values(frxusdChains).filter((chain) => chain.chainType === "evm")
|
|
1638
|
+
});
|
|
1639
|
+
|
|
1640
|
+
// src/wallets/config/tokens.ts
|
|
1641
|
+
var tokens = [
|
|
1642
|
+
...Object.values(usdtChains),
|
|
1643
|
+
...Object.values(usdcChains),
|
|
1644
|
+
...Object.values(usdt0Chains),
|
|
1645
|
+
...Object.values(frxusdChains)
|
|
1646
|
+
];
|
|
1647
|
+
var usdtTokens = [...Object.values(usdtChains), ...Object.values(usdt0Chains)];
|
|
1648
|
+
var usdcTokens = Object.values(usdcChains);
|
|
1649
|
+
var frxusdTokens = Object.values(frxusdChains);
|
|
1650
|
+
|
|
1651
|
+
// src/wallets/config/addresses.ts
|
|
1652
|
+
var DefaultAddresses = {
|
|
1653
|
+
near: "stableflow.near",
|
|
1654
|
+
sol: "2bRTgL16xgu6VkSRY7TJcLRuT93T1pLtaYeChhyhfFcX",
|
|
1655
|
+
evm: "0x10b06e6A12E86f8C2b55B5073fA3dB39b120C7F5",
|
|
1656
|
+
tron: "TSKMAaJLnWAUa6cKtTTm5oathCQPPaJZtF",
|
|
1657
|
+
aptos: "0x93493b07d031c4f18ad1e874575761be7e47d4cea5c81d538600e8ec72d6ab1c",
|
|
1658
|
+
ton: "UQBv1hzUIB5liMe1cqxUAvfO2tWMnN6wDyXP4DFSptAbePVK",
|
|
1659
|
+
sui: "0xeae6dbc896a8a6994c093bf8ea47116063f0b016f1fdc61bff95ba9dfb36c4d2"
|
|
1660
|
+
};
|
|
1661
|
+
|
|
1662
|
+
// src/wallets/config/erc20.ts
|
|
1663
|
+
var erc20_default = [
|
|
1664
|
+
{
|
|
1665
|
+
inputs: [
|
|
1666
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
1667
|
+
{ internalType: "address", name: "spender", type: "address" }
|
|
1668
|
+
],
|
|
1669
|
+
name: "allowance",
|
|
1670
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1671
|
+
stateMutability: "view",
|
|
1672
|
+
type: "function"
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
inputs: [
|
|
1676
|
+
{ internalType: "address", name: "spender", type: "address" },
|
|
1677
|
+
{ internalType: "uint256", name: "value", type: "uint256" }
|
|
1678
|
+
],
|
|
1679
|
+
name: "approve",
|
|
1680
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
1681
|
+
stateMutability: "nonpayable",
|
|
1682
|
+
type: "function"
|
|
1683
|
+
},
|
|
1684
|
+
{
|
|
1685
|
+
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
1686
|
+
name: "balanceOf",
|
|
1687
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1688
|
+
stateMutability: "view",
|
|
1689
|
+
type: "function"
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
inputs: [
|
|
1693
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
1694
|
+
{ internalType: "uint256", name: "value", type: "uint256" }
|
|
1695
|
+
],
|
|
1696
|
+
name: "transfer",
|
|
1697
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
1698
|
+
stateMutability: "nonpayable",
|
|
1699
|
+
type: "function"
|
|
1700
|
+
}
|
|
1701
|
+
];
|
|
1702
|
+
|
|
1703
|
+
// src/utils/price.ts
|
|
1704
|
+
function getPrice(prices, symbol) {
|
|
1705
|
+
let price = "1";
|
|
1706
|
+
if (prices[symbol]) {
|
|
1707
|
+
price = prices[symbol];
|
|
1708
|
+
if (price !== "0") {
|
|
1709
|
+
return price;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
if (prices[symbol.toLowerCase()]) {
|
|
1713
|
+
price = prices[symbol.toLowerCase()];
|
|
1714
|
+
if (price !== "0") {
|
|
1715
|
+
return price;
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
if (prices[symbol.toUpperCase()]) {
|
|
1719
|
+
price = prices[symbol.toUpperCase()];
|
|
1720
|
+
if (price !== "0") {
|
|
1721
|
+
return price;
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
return "1";
|
|
1725
|
+
}
|
|
1726
|
+
var addThousandSeparator = (numberString) => {
|
|
1727
|
+
if (!numberString) return "0";
|
|
1728
|
+
const parts = String(numberString).split(".");
|
|
1729
|
+
const integerPart = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
1730
|
+
const decimalPart = parts[1] ? `.${parts[1]}` : "";
|
|
1731
|
+
return integerPart + decimalPart;
|
|
1732
|
+
};
|
|
1733
|
+
var formatNumber = (value, precision, isSimple, options) => {
|
|
1734
|
+
const {
|
|
1735
|
+
prefix = "",
|
|
1736
|
+
isLTIntegerZero,
|
|
1737
|
+
isZeroPrecision,
|
|
1738
|
+
isShort,
|
|
1739
|
+
isShortUppercase,
|
|
1740
|
+
round = Big.roundHalfUp,
|
|
1741
|
+
isLessPrecision = true
|
|
1742
|
+
} = options || {};
|
|
1743
|
+
const isValid = () => {
|
|
1744
|
+
try {
|
|
1745
|
+
if (!value) return false;
|
|
1746
|
+
Big(value);
|
|
1747
|
+
return true;
|
|
1748
|
+
} catch (err) {
|
|
1749
|
+
return false;
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
if (!value || !isValid() || Big(value).eq(0)) {
|
|
1753
|
+
if (isSimple) {
|
|
1754
|
+
if (isZeroPrecision) {
|
|
1755
|
+
return `${prefix}${Big(0).toFixed(precision, round)}`;
|
|
1756
|
+
}
|
|
1757
|
+
return `${prefix}0`;
|
|
1758
|
+
}
|
|
1759
|
+
if (isZeroPrecision) {
|
|
1760
|
+
return {
|
|
1761
|
+
integer: `${prefix}0`,
|
|
1762
|
+
decimal: Big(0).toFixed(precision, round).replace(/^\d/, "")
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
return {
|
|
1766
|
+
integer: `${prefix}0`,
|
|
1767
|
+
decimal: ""
|
|
1768
|
+
};
|
|
1769
|
+
}
|
|
1770
|
+
if (isLessPrecision && Big(value).lt(Big(10).pow(-precision))) {
|
|
1771
|
+
if (isSimple) {
|
|
1772
|
+
return `< ${prefix}${Big(10).pow(-precision).toFixed(precision, round)}`;
|
|
1773
|
+
}
|
|
1774
|
+
if (isLTIntegerZero) {
|
|
1775
|
+
return {
|
|
1776
|
+
integer: `< ${prefix}0`,
|
|
1777
|
+
decimal: Big(10).pow(-precision).toFixed(precision, round).replace(/^\d/, "")
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
return {
|
|
1781
|
+
integer: "",
|
|
1782
|
+
decimal: `< ${prefix}${Big(10).pow(-precision).toFixed(precision, round)}`
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
const finalValue = addThousandSeparator(Big(value).toFixed(precision, round));
|
|
1786
|
+
const firstPart = finalValue.split(".")[0];
|
|
1787
|
+
let secondPart = finalValue.split(".")[1] || "";
|
|
1788
|
+
if (secondPart) {
|
|
1789
|
+
secondPart = "." + secondPart;
|
|
1790
|
+
}
|
|
1791
|
+
if (isSimple) {
|
|
1792
|
+
if (isShort) {
|
|
1793
|
+
const formatter = (split, unit) => {
|
|
1794
|
+
const _num = Big(value).div(split).toFixed(precision, 0).replace(/(?:\.0*|(\.\d+?)0+)$/, "$1");
|
|
1795
|
+
const inter = _num.split(".")?.[0]?.replace(/\d(?=(\d{3})+\b)/g, "$&,");
|
|
1796
|
+
const decimal = _num.split(".")?.[1] ?? "";
|
|
1797
|
+
return `${prefix}${inter}${decimal ? "." + decimal : ""}${unit}`;
|
|
1798
|
+
};
|
|
1799
|
+
if (Big(value).gte(1e12)) {
|
|
1800
|
+
return formatter(1e12, isShortUppercase ? "T" : "t");
|
|
1801
|
+
}
|
|
1802
|
+
if (Big(value).gte(1e9)) {
|
|
1803
|
+
return formatter(1e9, isShortUppercase ? "B" : "b");
|
|
1804
|
+
}
|
|
1805
|
+
if (Big(value).gte(1e6)) {
|
|
1806
|
+
return formatter(1e6, isShortUppercase ? "M" : "m");
|
|
1807
|
+
}
|
|
1808
|
+
if (Big(value).gte(1e3)) {
|
|
1809
|
+
return formatter(1e3, isShortUppercase ? "K" : "k");
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
if (isZeroPrecision) {
|
|
1813
|
+
return `${prefix}${firstPart}${secondPart}`;
|
|
1814
|
+
}
|
|
1815
|
+
return `${prefix}${firstPart}${secondPart.replace(/[.]?0*$/, "")}`;
|
|
1816
|
+
}
|
|
1817
|
+
if (isZeroPrecision) {
|
|
1818
|
+
return {
|
|
1819
|
+
integer: `${prefix}${firstPart}`,
|
|
1820
|
+
decimal: secondPart
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
return {
|
|
1824
|
+
integer: `${prefix}${firstPart}`,
|
|
1825
|
+
decimal: secondPart.replace(/[.]?0*$/, "")
|
|
1826
|
+
};
|
|
1827
|
+
};
|
|
1828
|
+
var numberRemoveEndZero = (value) => {
|
|
1829
|
+
return value.replace("-", "").replace(/\.?0+$/, "");
|
|
1830
|
+
};
|
|
1831
|
+
function zeroPadValue(hex, lengthBytes) {
|
|
1832
|
+
const normalized = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
1833
|
+
const targetLen = lengthBytes * 2;
|
|
1834
|
+
if (normalized.length > targetLen) {
|
|
1835
|
+
throw new Error(`hex value exceeds ${lengthBytes} bytes`);
|
|
1836
|
+
}
|
|
1837
|
+
return "0x" + normalized.padStart(targetLen, "0");
|
|
1838
|
+
}
|
|
1839
|
+
function tronAddressToBytes32(tronAddress) {
|
|
1840
|
+
try {
|
|
1841
|
+
const decoded = bs58.decode(tronAddress);
|
|
1842
|
+
const addressBytes = decoded.slice(1, 21);
|
|
1843
|
+
if (addressBytes.length !== 20) {
|
|
1844
|
+
throw new Error("Invalid Tron address length");
|
|
1845
|
+
}
|
|
1846
|
+
const paddedBytes = Buffer.concat([
|
|
1847
|
+
Buffer.alloc(12, 0),
|
|
1848
|
+
// 12 zero bytes
|
|
1849
|
+
addressBytes
|
|
1850
|
+
// 20-byte address
|
|
1851
|
+
]);
|
|
1852
|
+
return "0x" + paddedBytes.toString("hex");
|
|
1853
|
+
} catch (error) {
|
|
1854
|
+
throw new Error(`Failed to convert Tron address: ${error.message}`);
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
function solanaAddressToBytes32(solanaAddress) {
|
|
1858
|
+
const decoded = bs58.decode(solanaAddress);
|
|
1859
|
+
if (decoded.length !== 32) {
|
|
1860
|
+
throw new Error("Invalid Solana address length");
|
|
1861
|
+
}
|
|
1862
|
+
return "0x" + Buffer.from(decoded).toString("hex");
|
|
1863
|
+
}
|
|
1864
|
+
function tonAddressToBytes32(tonAddress) {
|
|
1865
|
+
try {
|
|
1866
|
+
const parsed = parseTonAddress(tonAddress);
|
|
1867
|
+
if (parsed.hash.length !== 32) {
|
|
1868
|
+
throw new Error("Invalid TON address hash length");
|
|
1869
|
+
}
|
|
1870
|
+
return "0x" + bytesToHex(parsed.hash);
|
|
1871
|
+
} catch (error) {
|
|
1872
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
1873
|
+
throw new Error(`Failed to convert TON address: ${message}`);
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
function addressToBytes32(chainType, address) {
|
|
1877
|
+
if (chainType === "evm") {
|
|
1878
|
+
return zeroPadValue(address, 32);
|
|
1879
|
+
}
|
|
1880
|
+
if (chainType === "sol") {
|
|
1881
|
+
return solanaAddressToBytes32(address);
|
|
1882
|
+
}
|
|
1883
|
+
if (chainType === "tron") {
|
|
1884
|
+
return tronAddressToBytes32(address);
|
|
1885
|
+
}
|
|
1886
|
+
if (chainType === "ton") {
|
|
1887
|
+
return tonAddressToBytes32(address);
|
|
1888
|
+
}
|
|
1889
|
+
return address;
|
|
1890
|
+
}
|
|
1891
|
+
function parseTonAddress(address) {
|
|
1892
|
+
const input = address.trim();
|
|
1893
|
+
if (!input) {
|
|
1894
|
+
throw new Error("Address is empty");
|
|
1895
|
+
}
|
|
1896
|
+
if (isRawTonAddress(input)) {
|
|
1897
|
+
return parseRawTonAddress(input);
|
|
1898
|
+
}
|
|
1899
|
+
return parseUserFriendlyTonAddress(input);
|
|
1900
|
+
}
|
|
1901
|
+
function crc16Ccitt(data) {
|
|
1902
|
+
let crc = 0;
|
|
1903
|
+
for (const byte of data) {
|
|
1904
|
+
crc ^= byte << 8;
|
|
1905
|
+
for (let i = 0; i < 8; i++) {
|
|
1906
|
+
if ((crc & 32768) !== 0) {
|
|
1907
|
+
crc = (crc << 1 ^ 4129) & 65535;
|
|
1908
|
+
} else {
|
|
1909
|
+
crc = crc << 1 & 65535;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
return new Uint8Array([crc >> 8 & 255, crc & 255]);
|
|
1914
|
+
}
|
|
1915
|
+
function base64ToBytes(input) {
|
|
1916
|
+
let normalized = input.replace(/-/g, "+").replace(/_/g, "/");
|
|
1917
|
+
const padding = normalized.length % 4;
|
|
1918
|
+
if (padding === 2) {
|
|
1919
|
+
normalized += "==";
|
|
1920
|
+
} else if (padding === 3) {
|
|
1921
|
+
normalized += "=";
|
|
1922
|
+
} else if (padding !== 0) {
|
|
1923
|
+
throw new Error("Invalid base64 TON address");
|
|
1924
|
+
}
|
|
1925
|
+
if (typeof Buffer !== "undefined") {
|
|
1926
|
+
return new Uint8Array(Buffer.from(normalized, "base64"));
|
|
1927
|
+
}
|
|
1928
|
+
if (typeof atob !== "undefined") {
|
|
1929
|
+
const binary = atob(normalized);
|
|
1930
|
+
const bytes = new Uint8Array(binary.length);
|
|
1931
|
+
for (let i = 0; i < binary.length; i++) {
|
|
1932
|
+
bytes[i] = binary.charCodeAt(i);
|
|
1933
|
+
}
|
|
1934
|
+
return bytes;
|
|
1935
|
+
}
|
|
1936
|
+
throw new Error("No base64 decoder available");
|
|
1937
|
+
}
|
|
1938
|
+
function hexToBytes(hex) {
|
|
1939
|
+
if (hex.length % 2 !== 0) {
|
|
1940
|
+
throw new Error("Invalid hex string");
|
|
1941
|
+
}
|
|
1942
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
1943
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
1944
|
+
const byte = Number.parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
1945
|
+
if (Number.isNaN(byte)) {
|
|
1946
|
+
throw new Error("Invalid hex string");
|
|
1947
|
+
}
|
|
1948
|
+
bytes[i] = byte;
|
|
1949
|
+
}
|
|
1950
|
+
return bytes;
|
|
1951
|
+
}
|
|
1952
|
+
function bytesToHex(bytes) {
|
|
1953
|
+
return Array.from(bytes).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
1954
|
+
}
|
|
1955
|
+
function isRawTonAddress(address) {
|
|
1956
|
+
return /^-?\d+:[0-9a-fA-F]{64}$/.test(address);
|
|
1957
|
+
}
|
|
1958
|
+
function parseRawTonAddress(address) {
|
|
1959
|
+
const [workchainPart, hashPart] = address.split(":");
|
|
1960
|
+
if (!workchainPart || !hashPart) {
|
|
1961
|
+
throw new Error("Invalid raw TON address");
|
|
1962
|
+
}
|
|
1963
|
+
const workchain = Number(workchainPart);
|
|
1964
|
+
if (!Number.isInteger(workchain)) {
|
|
1965
|
+
throw new Error("Invalid TON workchain");
|
|
1966
|
+
}
|
|
1967
|
+
if (!/^[0-9a-fA-F]{64}$/.test(hashPart)) {
|
|
1968
|
+
throw new Error("Invalid TON address hash");
|
|
1969
|
+
}
|
|
1970
|
+
return {
|
|
1971
|
+
workchain,
|
|
1972
|
+
hash: hexToBytes(hashPart),
|
|
1973
|
+
isUserFriendly: false
|
|
1974
|
+
};
|
|
1975
|
+
}
|
|
1976
|
+
function parseUserFriendlyTonAddress(address) {
|
|
1977
|
+
if (!/^[A-Za-z0-9+/_-]{48}$/.test(address)) {
|
|
1978
|
+
throw new Error("Invalid user-friendly TON address format");
|
|
1979
|
+
}
|
|
1980
|
+
const data = base64ToBytes(address);
|
|
1981
|
+
if (data.length !== 36) {
|
|
1982
|
+
throw new Error("Invalid user-friendly TON address length");
|
|
1983
|
+
}
|
|
1984
|
+
const body = data.slice(0, 34);
|
|
1985
|
+
const checksum = data.slice(34, 36);
|
|
1986
|
+
const expectedChecksum = crc16Ccitt(body);
|
|
1987
|
+
if (checksum[0] !== expectedChecksum[0] || checksum[1] !== expectedChecksum[1]) {
|
|
1988
|
+
throw new Error("Invalid TON address checksum");
|
|
1989
|
+
}
|
|
1990
|
+
const flags = data[0];
|
|
1991
|
+
const isTestOnly = (flags & 128) !== 0;
|
|
1992
|
+
const tag = flags & 127;
|
|
1993
|
+
if (tag !== 17 && tag !== 81) {
|
|
1994
|
+
throw new Error("Invalid TON address flags");
|
|
1995
|
+
}
|
|
1996
|
+
const isBounceable = tag === 17;
|
|
1997
|
+
const workchainByte = data[1];
|
|
1998
|
+
const workchain = workchainByte === 255 ? -1 : workchainByte;
|
|
1999
|
+
const hash = data.slice(2, 34);
|
|
2000
|
+
if (hash.length !== 32) {
|
|
2001
|
+
throw new Error("Invalid TON address hash length");
|
|
2002
|
+
}
|
|
2003
|
+
return {
|
|
2004
|
+
workchain,
|
|
2005
|
+
hash,
|
|
2006
|
+
isUserFriendly: true,
|
|
2007
|
+
isBounceable,
|
|
2008
|
+
isTestOnly
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
// src/utils/exec-time.ts
|
|
2013
|
+
var ExecTime = class {
|
|
2014
|
+
constructor(options) {
|
|
2015
|
+
this.startTimestamp = 0;
|
|
2016
|
+
this.currentTimestamp = 0;
|
|
2017
|
+
this.performanceThreshold = 1e3;
|
|
2018
|
+
const { type, logStyle, isPerformance, isDebug } = options;
|
|
2019
|
+
this.type = type;
|
|
2020
|
+
this.logStyle = logStyle ?? "stone-500";
|
|
2021
|
+
this.isPerformance = isPerformance ?? false;
|
|
2022
|
+
this.isDebug = isDebug;
|
|
2023
|
+
this.csl = new Csl(isDebug);
|
|
2024
|
+
if (!isDebug) return;
|
|
2025
|
+
this.startTimestamp = performance.now();
|
|
2026
|
+
this.currentTimestamp = this.startTimestamp;
|
|
2027
|
+
}
|
|
2028
|
+
breakpoint() {
|
|
2029
|
+
if (!this.isDebug) return;
|
|
2030
|
+
this.currentTimestamp = performance.now();
|
|
2031
|
+
}
|
|
2032
|
+
log(subType, str, ...params) {
|
|
2033
|
+
const duration = performance.now() - this.currentTimestamp;
|
|
2034
|
+
if (this.isPerformance) {
|
|
2035
|
+
if (duration <= this.performanceThreshold) {
|
|
2036
|
+
return;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
this.csl.log(this.type, this.logStyle, `<${subType}>cost: %c%sms%c${str ? ", " + str : ""}`, "color:red;font-weight:bold;", duration.toFixed(0), "color:black;font-weight:normal;", ...params);
|
|
2040
|
+
}
|
|
2041
|
+
logTotal(subType, str, ...params) {
|
|
2042
|
+
const duration = performance.now() - this.startTimestamp;
|
|
2043
|
+
this.csl.log(this.type, this.logStyle, `<${subType}>total cost: %c%sms%c${str ? ", " + str : ""}`, "color:red;font-weight:bold;", duration.toFixed(0), "color:black;font-weight:normal;", ...params);
|
|
2044
|
+
}
|
|
2045
|
+
};
|
|
2046
|
+
var formatQuoteError = (error, options) => {
|
|
2047
|
+
const { service, fromToken } = options;
|
|
2048
|
+
const defaultErrorMessage = "Failed to get quote, please try again later";
|
|
2049
|
+
if (service === Service.OneClick) {
|
|
2050
|
+
const getQuoteErrorMessage = () => {
|
|
2051
|
+
const _messageResult = {
|
|
2052
|
+
message: defaultErrorMessage,
|
|
2053
|
+
sourceMessage: error?.response?.data?.message || defaultErrorMessage
|
|
2054
|
+
};
|
|
2055
|
+
if (error?.response?.data?.message && error?.response?.data?.message !== "Internal server error") {
|
|
2056
|
+
if (error?.response?.data?.message === "Failed to get quote") {
|
|
2057
|
+
_messageResult.message = "Amount exceeds max";
|
|
2058
|
+
return _messageResult;
|
|
2059
|
+
}
|
|
2060
|
+
if (error?.response?.data?.message?.includes("Amount is too low for bridge, try at least")) {
|
|
2061
|
+
const match = error.response.data.message.match(/try at least\s+(\d+(?:\.\d+)?)/i);
|
|
2062
|
+
let minimumAmount = match ? match[1] : Big(1).times(10 ** fromToken.decimals).toFixed(0);
|
|
2063
|
+
minimumAmount = Big(minimumAmount).div(10 ** fromToken.decimals).toFixed(fromToken.decimals);
|
|
2064
|
+
_messageResult.message = `Amount is too low, at least ${minimumAmount}`;
|
|
2065
|
+
return _messageResult;
|
|
2066
|
+
}
|
|
2067
|
+
return _messageResult;
|
|
2068
|
+
}
|
|
2069
|
+
return _messageResult;
|
|
2070
|
+
};
|
|
2071
|
+
const onclickErrMsg = getQuoteErrorMessage();
|
|
2072
|
+
return {
|
|
2073
|
+
serviceType: service,
|
|
2074
|
+
error: onclickErrMsg.message
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
return {
|
|
2078
|
+
serviceType: service,
|
|
2079
|
+
error: error?.message || defaultErrorMessage
|
|
2080
|
+
};
|
|
2081
|
+
};
|
|
2082
|
+
|
|
2083
|
+
// src/utils/service.ts
|
|
2084
|
+
var getRouteStatus = (service, disabledServices) => {
|
|
2085
|
+
const result = { disabled: false };
|
|
2086
|
+
if (!disabledServices || disabledServices.length === 0) {
|
|
2087
|
+
return result;
|
|
2088
|
+
}
|
|
2089
|
+
const IS_PAUSE_ONECLICK = disabledServices.includes(Service.OneClick);
|
|
2090
|
+
const IS_PAUSE_USDT0 = disabledServices.includes(Service.Usdt0);
|
|
2091
|
+
const IS_PAUSE_CCTP = disabledServices.includes(Service.CCTP);
|
|
2092
|
+
const IS_PAUSE_FRAXZERO = disabledServices.includes(Service.FraxZero);
|
|
2093
|
+
const IS_PAUSE_NATIVE = disabledServices.includes(Service.Native);
|
|
2094
|
+
const IS_PAUSE_USDT0_ONECLICK = disabledServices.includes(Service.OneClickUsdt0);
|
|
2095
|
+
const IS_PAUSE_ONECLICK_USDT0 = disabledServices.includes(Service.OneClickUsdt0);
|
|
2096
|
+
const IS_PAUSE_FRAXZERO_ONECLICK = disabledServices.includes(Service.FraxZeroOneClick);
|
|
2097
|
+
const IS_PAUSE_ONECLICK_FRAXZERO = disabledServices.includes(Service.OneClickFraxZero);
|
|
2098
|
+
const IS_PAUSE_ALL = IS_PAUSE_ONECLICK && IS_PAUSE_USDT0 && IS_PAUSE_CCTP && IS_PAUSE_FRAXZERO && IS_PAUSE_NATIVE;
|
|
2099
|
+
if (IS_PAUSE_ALL) {
|
|
2100
|
+
result.disabled = true;
|
|
2101
|
+
return result;
|
|
2102
|
+
}
|
|
2103
|
+
if (service === Service.CCTP) {
|
|
2104
|
+
if (IS_PAUSE_CCTP) {
|
|
2105
|
+
result.disabled = true;
|
|
2106
|
+
return result;
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
if (service === Service.FraxZero) {
|
|
2110
|
+
if (IS_PAUSE_FRAXZERO) {
|
|
2111
|
+
result.disabled = true;
|
|
2112
|
+
return result;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
if ([Service.FraxZeroOneClick, Service.OneClickFraxZero].includes(service)) {
|
|
2116
|
+
if (IS_PAUSE_ONECLICK || IS_PAUSE_FRAXZERO) {
|
|
2117
|
+
result.disabled = true;
|
|
2118
|
+
return result;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
if (service === Service.Native) {
|
|
2122
|
+
if (IS_PAUSE_NATIVE) {
|
|
2123
|
+
result.disabled = true;
|
|
2124
|
+
return result;
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
if (service === Service.OneClick) {
|
|
2128
|
+
if (IS_PAUSE_ONECLICK) {
|
|
2129
|
+
result.disabled = true;
|
|
2130
|
+
return result;
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
if (service === Service.Usdt0) {
|
|
2134
|
+
if (IS_PAUSE_USDT0) {
|
|
2135
|
+
result.disabled = true;
|
|
2136
|
+
return result;
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
if ([Service.Usdt0OneClick, Service.OneClickUsdt0].includes(service)) {
|
|
2140
|
+
if (IS_PAUSE_ONECLICK || IS_PAUSE_USDT0) {
|
|
2141
|
+
result.disabled = true;
|
|
2142
|
+
return result;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
if (service === Service.Usdt0OneClick) {
|
|
2146
|
+
if (IS_PAUSE_USDT0_ONECLICK) {
|
|
2147
|
+
result.disabled = true;
|
|
2148
|
+
return result;
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
if (service === Service.OneClickUsdt0) {
|
|
2152
|
+
if (IS_PAUSE_ONECLICK_USDT0) {
|
|
2153
|
+
result.disabled = true;
|
|
2154
|
+
return result;
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
if (service === Service.FraxZeroOneClick) {
|
|
2158
|
+
if (IS_PAUSE_FRAXZERO_ONECLICK) {
|
|
2159
|
+
result.disabled = true;
|
|
2160
|
+
return result;
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
if (service === Service.OneClickFraxZero) {
|
|
2164
|
+
if (IS_PAUSE_ONECLICK_FRAXZERO) {
|
|
2165
|
+
result.disabled = true;
|
|
2166
|
+
return result;
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
return result;
|
|
2170
|
+
};
|
|
2171
|
+
|
|
2172
|
+
// src/utils/cctp.ts
|
|
2173
|
+
async function quoteSignature(params) {
|
|
2174
|
+
const response = await request(OpenAPI, {
|
|
2175
|
+
method: "POST",
|
|
2176
|
+
url: "/v0/cctp/sign",
|
|
2177
|
+
body: params,
|
|
2178
|
+
headers: {
|
|
2179
|
+
"Content-Type": "application/json"
|
|
2180
|
+
},
|
|
2181
|
+
errors: {
|
|
2182
|
+
400: `Bad Request - Invalid input data`,
|
|
2183
|
+
401: `Unauthorized - JWT token is invalid`
|
|
2184
|
+
}
|
|
2185
|
+
});
|
|
2186
|
+
return response.data ?? {};
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
export { ApiError, CancelError, CancelablePromise, Csl, DefaultAddresses, ExecTime, GetExecutionStatusResponse, NetworkRpcUrlsMap, OpenAPI, QuoteRequest, SFA, SendType, Service, ServiceBackend, SubmitDepositTxResponse, TokenResponse, TransactionStatus, addressToBytes32, erc20_default as erc20Abi, formatNumber, formatQuoteError, frxusdChains, frxusdTokens, getChainRpcUrl, getPrice, getRouteStatus, getRpcUrls, numberRemoveEndZero, quoteSignature, request, setRpcUrls, tokens, usdcChains, usdcTokens, usdt0Chains, usdtChains, usdtTokens };
|
|
2190
|
+
//# sourceMappingURL=index.mjs.map
|
|
2191
|
+
//# sourceMappingURL=index.mjs.map
|