@chainrails/sdk 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chainrails-sdk.es.js +853 -531
- package/dist/chainrails-sdk.es.mjs +853 -531
- package/dist/chainrails-sdk.umd.js +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/src/Auth/index.d.ts.map +1 -1
- package/dist/src/Auth/types.d.ts +3 -3
- package/dist/src/Auth/types.d.ts.map +1 -1
- package/dist/src/Chains/index.d.ts +3 -2
- package/dist/src/Chains/index.d.ts.map +1 -1
- package/dist/src/Chains/types.d.ts +8 -0
- package/dist/src/Chains/types.d.ts.map +1 -1
- package/dist/src/Intents/types.d.ts +2 -0
- package/dist/src/Intents/types.d.ts.map +1 -1
- package/dist/src/Quotes/index.d.ts +2 -2
- package/dist/src/Quotes/index.d.ts.map +1 -1
- package/dist/src/Quotes/types.d.ts +37 -16
- package/dist/src/Quotes/types.d.ts.map +1 -1
- package/dist/src/Router/types.d.ts +7 -4
- package/dist/src/Router/types.d.ts.map +1 -1
- package/dist/src/types.d.ts +32 -20
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,90 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, J = {
|
|
22
|
-
type: "evm",
|
|
23
|
-
chainId: 84532,
|
|
24
|
-
name: "Base Sepolia",
|
|
25
|
-
cctpDomain: 6,
|
|
26
|
-
logoURI: "/images/chains/base.webp"
|
|
27
|
-
}, Y = {
|
|
28
|
-
type: "evm",
|
|
29
|
-
chainId: 56,
|
|
30
|
-
name: "BNB Chain",
|
|
31
|
-
cctpDomain: null,
|
|
32
|
-
logoURI: "/images/chains/bsc.webp"
|
|
33
|
-
}, Z = {
|
|
34
|
-
type: "evm",
|
|
35
|
-
chainId: 1,
|
|
36
|
-
name: "Ethereum",
|
|
37
|
-
cctpDomain: 0,
|
|
38
|
-
logoURI: "/images/chains/ethereum.svg"
|
|
39
|
-
}, ee = {
|
|
40
|
-
type: "evm",
|
|
41
|
-
chainId: 11155111,
|
|
42
|
-
name: "Ethereum Sepolia",
|
|
43
|
-
cctpDomain: 0,
|
|
44
|
-
logoURI: "/images/chains/ethereum.svg"
|
|
45
|
-
}, te = {
|
|
46
|
-
type: "evm",
|
|
47
|
-
chainId: 43114,
|
|
48
|
-
name: "Avalanche",
|
|
49
|
-
cctpDomain: 1,
|
|
50
|
-
logoURI: "/images/chains/avalanche.svg"
|
|
51
|
-
}, se = {
|
|
52
|
-
type: "evm",
|
|
53
|
-
chainId: 43113,
|
|
54
|
-
name: "Avalanche Fuji",
|
|
55
|
-
cctpDomain: 1,
|
|
56
|
-
logoURI: "/images/chains/avalanche.svg"
|
|
57
|
-
}, ne = {
|
|
58
|
-
type: "starknet",
|
|
59
|
-
chainId: "0x534e5f4d41494e",
|
|
60
|
-
// SN_MAIN
|
|
61
|
-
name: "Starknet",
|
|
62
|
-
cctpDomain: null,
|
|
63
|
-
logoURI: "/images/chains/starknet.svg"
|
|
1
|
+
import te from "ky";
|
|
2
|
+
const c = {
|
|
3
|
+
ARBITRUM: "ARBITRUM_MAINNET",
|
|
4
|
+
ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
|
|
5
|
+
AVALANCHE: "AVALANCHE_MAINNET",
|
|
6
|
+
AVALANCHE_TESTNET: "AVALANCHE_TESTNET",
|
|
7
|
+
BASE: "BASE_MAINNET",
|
|
8
|
+
BASE_TESTNET: "BASE_TESTNET",
|
|
9
|
+
BSC: "BSC_MAINNET",
|
|
10
|
+
ETHEREUM: "ETHEREUM_MAINNET",
|
|
11
|
+
ETHEREUM_TESTNET: "ETHEREUM_TESTNET",
|
|
12
|
+
HYPEREVM: "HYPEREVM_MAINNET",
|
|
13
|
+
LISK: "LISK_MAINNET",
|
|
14
|
+
MONAD: "MONAD_MAINNET",
|
|
15
|
+
MONAD_TESTNET: "MONAD_TESTNET",
|
|
16
|
+
OPTIMISM: "OPTIMISM_MAINNET",
|
|
17
|
+
OPTIMISM_TESTNET: "OPTIMISM_TESTNET",
|
|
18
|
+
POLYGON: "POLYGON_MAINNET",
|
|
19
|
+
STARKNET: "STARKNET_MAINNET",
|
|
20
|
+
STARKNET_TESTNET: "STARKNET_TESTNET"
|
|
64
21
|
};
|
|
65
|
-
function
|
|
66
|
-
return !
|
|
22
|
+
function B(s, { strict: e = !0 } = {}) {
|
|
23
|
+
return !s || typeof s != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(s) : s.startsWith("0x");
|
|
67
24
|
}
|
|
68
|
-
function
|
|
69
|
-
return
|
|
25
|
+
function M(s) {
|
|
26
|
+
return B(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
|
|
70
27
|
}
|
|
71
|
-
const
|
|
72
|
-
let
|
|
73
|
-
getDocsUrl: ({ docsBaseUrl:
|
|
74
|
-
version: `viem@${
|
|
28
|
+
const $ = "2.43.4";
|
|
29
|
+
let C = {
|
|
30
|
+
getDocsUrl: ({ docsBaseUrl: s, docsPath: e = "", docsSlug: t }) => e ? `${s ?? "https://viem.sh"}${e}${t ? `#${t}` : ""}` : void 0,
|
|
31
|
+
version: `viem@${$}`
|
|
75
32
|
};
|
|
76
|
-
class
|
|
77
|
-
constructor(e,
|
|
78
|
-
const
|
|
33
|
+
class T extends Error {
|
|
34
|
+
constructor(e, t = {}) {
|
|
35
|
+
const o = t.cause instanceof T ? t.cause.details : t.cause?.message ? t.cause.message : t.details, a = t.cause instanceof T && t.cause.docsPath || t.docsPath, r = C.getDocsUrl?.({ ...t, docsPath: a }), i = [
|
|
79
36
|
e || "An error occurred.",
|
|
80
37
|
"",
|
|
81
|
-
...
|
|
38
|
+
...t.metaMessages ? [...t.metaMessages, ""] : [],
|
|
82
39
|
...r ? [`Docs: ${r}`] : [],
|
|
83
|
-
...
|
|
84
|
-
...
|
|
40
|
+
...o ? [`Details: ${o}`] : [],
|
|
41
|
+
...C.version ? [`Version: ${C.version}`] : []
|
|
85
42
|
].join(`
|
|
86
43
|
`);
|
|
87
|
-
super(
|
|
44
|
+
super(i, t.cause ? { cause: t.cause } : void 0), Object.defineProperty(this, "details", {
|
|
88
45
|
enumerable: !0,
|
|
89
46
|
configurable: !0,
|
|
90
47
|
writable: !0,
|
|
@@ -114,95 +71,95 @@ class g extends Error {
|
|
|
114
71
|
configurable: !0,
|
|
115
72
|
writable: !0,
|
|
116
73
|
value: "BaseError"
|
|
117
|
-
}), this.details =
|
|
74
|
+
}), this.details = o, this.docsPath = a, this.metaMessages = t.metaMessages, this.name = t.name ?? this.name, this.shortMessage = e, this.version = $;
|
|
118
75
|
}
|
|
119
76
|
walk(e) {
|
|
120
|
-
return
|
|
77
|
+
return z(this, e);
|
|
121
78
|
}
|
|
122
79
|
}
|
|
123
|
-
function
|
|
124
|
-
return e?.(
|
|
80
|
+
function z(s, e) {
|
|
81
|
+
return e?.(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? z(s.cause, e) : e ? null : s;
|
|
125
82
|
}
|
|
126
|
-
class
|
|
127
|
-
constructor({ size: e, targetSize:
|
|
128
|
-
super(`${
|
|
83
|
+
class L extends T {
|
|
84
|
+
constructor({ size: e, targetSize: t, type: o }) {
|
|
85
|
+
super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
129
86
|
}
|
|
130
87
|
}
|
|
131
|
-
function
|
|
132
|
-
return typeof
|
|
88
|
+
function D(s, { dir: e, size: t = 32 } = {}) {
|
|
89
|
+
return typeof s == "string" ? ne(s, { dir: e, size: t }) : oe(s, { dir: e, size: t });
|
|
133
90
|
}
|
|
134
|
-
function
|
|
135
|
-
if (
|
|
136
|
-
return
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
139
|
-
throw new
|
|
140
|
-
size: Math.ceil(
|
|
141
|
-
targetSize:
|
|
91
|
+
function ne(s, { dir: e, size: t = 32 } = {}) {
|
|
92
|
+
if (t === null)
|
|
93
|
+
return s;
|
|
94
|
+
const o = s.replace("0x", "");
|
|
95
|
+
if (o.length > t * 2)
|
|
96
|
+
throw new L({
|
|
97
|
+
size: Math.ceil(o.length / 2),
|
|
98
|
+
targetSize: t,
|
|
142
99
|
type: "hex"
|
|
143
100
|
});
|
|
144
|
-
return `0x${
|
|
145
|
-
}
|
|
146
|
-
function
|
|
147
|
-
if (
|
|
148
|
-
return
|
|
149
|
-
if (
|
|
150
|
-
throw new
|
|
151
|
-
size:
|
|
152
|
-
targetSize:
|
|
101
|
+
return `0x${o[e === "right" ? "padEnd" : "padStart"](t * 2, "0")}`;
|
|
102
|
+
}
|
|
103
|
+
function oe(s, { dir: e, size: t = 32 } = {}) {
|
|
104
|
+
if (t === null)
|
|
105
|
+
return s;
|
|
106
|
+
if (s.length > t)
|
|
107
|
+
throw new L({
|
|
108
|
+
size: s.length,
|
|
109
|
+
targetSize: t,
|
|
153
110
|
type: "bytes"
|
|
154
111
|
});
|
|
155
|
-
const
|
|
156
|
-
for (let
|
|
112
|
+
const o = new Uint8Array(t);
|
|
113
|
+
for (let a = 0; a < t; a++) {
|
|
157
114
|
const r = e === "right";
|
|
158
|
-
|
|
115
|
+
o[r ? a : t - a - 1] = s[r ? a : s.length - a - 1];
|
|
159
116
|
}
|
|
160
|
-
return
|
|
117
|
+
return o;
|
|
161
118
|
}
|
|
162
|
-
class
|
|
163
|
-
constructor({ max: e, min:
|
|
164
|
-
super(`Number "${r}" is not in safe ${
|
|
119
|
+
class ae extends T {
|
|
120
|
+
constructor({ max: e, min: t, signed: o, size: a, value: r }) {
|
|
121
|
+
super(`Number "${r}" is not in safe ${a ? `${a * 8}-bit ${o ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${t} to ${e})` : `(above ${t})`}`, { name: "IntegerOutOfRangeError" });
|
|
165
122
|
}
|
|
166
123
|
}
|
|
167
|
-
class
|
|
168
|
-
constructor({ givenSize: e, maxSize:
|
|
169
|
-
super(`Size cannot exceed ${
|
|
124
|
+
class ie extends T {
|
|
125
|
+
constructor({ givenSize: e, maxSize: t }) {
|
|
126
|
+
super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
|
|
170
127
|
}
|
|
171
128
|
}
|
|
172
|
-
function
|
|
173
|
-
if (
|
|
174
|
-
throw new
|
|
175
|
-
givenSize:
|
|
129
|
+
function w(s, { size: e }) {
|
|
130
|
+
if (M(s) > e)
|
|
131
|
+
throw new ie({
|
|
132
|
+
givenSize: M(s),
|
|
176
133
|
maxSize: e
|
|
177
134
|
});
|
|
178
135
|
}
|
|
179
|
-
function
|
|
180
|
-
const { signed:
|
|
136
|
+
function re(s, e = {}) {
|
|
137
|
+
const { signed: t, size: o } = e, a = BigInt(s);
|
|
181
138
|
let r;
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
if (r &&
|
|
185
|
-
const
|
|
186
|
-
throw new
|
|
187
|
-
max: r ? `${r}${
|
|
188
|
-
min: `${
|
|
189
|
-
signed:
|
|
190
|
-
size:
|
|
191
|
-
value: `${
|
|
139
|
+
o ? t ? r = (1n << BigInt(o) * 8n - 1n) - 1n : r = 2n ** (BigInt(o) * 8n) - 1n : typeof s == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
|
|
140
|
+
const i = typeof r == "bigint" && t ? -r - 1n : 0;
|
|
141
|
+
if (r && a > r || a < i) {
|
|
142
|
+
const m = typeof s == "bigint" ? "n" : "";
|
|
143
|
+
throw new ae({
|
|
144
|
+
max: r ? `${r}${m}` : void 0,
|
|
145
|
+
min: `${i}${m}`,
|
|
146
|
+
signed: t,
|
|
147
|
+
size: o,
|
|
148
|
+
value: `${s}${m}`
|
|
192
149
|
});
|
|
193
150
|
}
|
|
194
|
-
const
|
|
195
|
-
return
|
|
151
|
+
const l = `0x${(t && a < 0 ? (1n << BigInt(o * 8)) + BigInt(a) : a).toString(16)}`;
|
|
152
|
+
return o ? D(l, { size: o }) : l;
|
|
196
153
|
}
|
|
197
|
-
const
|
|
198
|
-
function
|
|
199
|
-
return typeof
|
|
154
|
+
const ce = /* @__PURE__ */ new TextEncoder();
|
|
155
|
+
function de(s, e = {}) {
|
|
156
|
+
return typeof s == "number" || typeof s == "bigint" ? ue(s, e) : typeof s == "boolean" ? le(s, e) : B(s) ? j(s, e) : K(s, e);
|
|
200
157
|
}
|
|
201
|
-
function
|
|
202
|
-
const
|
|
203
|
-
return
|
|
158
|
+
function le(s, e = {}) {
|
|
159
|
+
const t = new Uint8Array(1);
|
|
160
|
+
return t[0] = Number(s), typeof e.size == "number" ? (w(t, { size: e.size }), D(t, { size: e.size })) : t;
|
|
204
161
|
}
|
|
205
|
-
const
|
|
162
|
+
const h = {
|
|
206
163
|
zero: 48,
|
|
207
164
|
nine: 57,
|
|
208
165
|
A: 65,
|
|
@@ -210,162 +167,162 @@ const p = {
|
|
|
210
167
|
a: 97,
|
|
211
168
|
f: 102
|
|
212
169
|
};
|
|
213
|
-
function
|
|
214
|
-
if (
|
|
215
|
-
return
|
|
216
|
-
if (
|
|
217
|
-
return
|
|
218
|
-
if (
|
|
219
|
-
return
|
|
220
|
-
}
|
|
221
|
-
function
|
|
222
|
-
let
|
|
223
|
-
e.size && (
|
|
224
|
-
let
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
for (let
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
230
|
-
throw new
|
|
231
|
-
r[
|
|
170
|
+
function x(s) {
|
|
171
|
+
if (s >= h.zero && s <= h.nine)
|
|
172
|
+
return s - h.zero;
|
|
173
|
+
if (s >= h.A && s <= h.F)
|
|
174
|
+
return s - (h.A - 10);
|
|
175
|
+
if (s >= h.a && s <= h.f)
|
|
176
|
+
return s - (h.a - 10);
|
|
177
|
+
}
|
|
178
|
+
function j(s, e = {}) {
|
|
179
|
+
let t = s;
|
|
180
|
+
e.size && (w(t, { size: e.size }), t = D(t, { dir: "right", size: e.size }));
|
|
181
|
+
let o = t.slice(2);
|
|
182
|
+
o.length % 2 && (o = `0${o}`);
|
|
183
|
+
const a = o.length / 2, r = new Uint8Array(a);
|
|
184
|
+
for (let i = 0, l = 0; i < a; i++) {
|
|
185
|
+
const m = x(o.charCodeAt(l++)), f = x(o.charCodeAt(l++));
|
|
186
|
+
if (m === void 0 || f === void 0)
|
|
187
|
+
throw new T(`Invalid byte sequence ("${o[l - 2]}${o[l - 1]}" in "${o}").`);
|
|
188
|
+
r[i] = m * 16 + f;
|
|
232
189
|
}
|
|
233
190
|
return r;
|
|
234
191
|
}
|
|
235
|
-
function
|
|
236
|
-
const
|
|
237
|
-
return
|
|
192
|
+
function ue(s, e) {
|
|
193
|
+
const t = re(s, e);
|
|
194
|
+
return j(t);
|
|
238
195
|
}
|
|
239
|
-
function
|
|
240
|
-
const
|
|
241
|
-
return typeof e.size == "number" ? (
|
|
196
|
+
function K(s, e = {}) {
|
|
197
|
+
const t = ce.encode(s);
|
|
198
|
+
return typeof e.size == "number" ? (w(t, { size: e.size }), D(t, { dir: "right", size: e.size })) : t;
|
|
242
199
|
}
|
|
243
|
-
const
|
|
244
|
-
function
|
|
245
|
-
return e ? { h: Number(
|
|
200
|
+
const A = /* @__PURE__ */ BigInt(2 ** 32 - 1), v = /* @__PURE__ */ BigInt(32);
|
|
201
|
+
function ge(s, e = !1) {
|
|
202
|
+
return e ? { h: Number(s & A), l: Number(s >> v & A) } : { h: Number(s >> v & A) | 0, l: Number(s & A) | 0 };
|
|
246
203
|
}
|
|
247
|
-
function
|
|
248
|
-
const
|
|
249
|
-
let
|
|
250
|
-
for (let r = 0; r <
|
|
251
|
-
const { h:
|
|
252
|
-
[
|
|
204
|
+
function Ee(s, e = !1) {
|
|
205
|
+
const t = s.length;
|
|
206
|
+
let o = new Uint32Array(t), a = new Uint32Array(t);
|
|
207
|
+
for (let r = 0; r < t; r++) {
|
|
208
|
+
const { h: i, l } = ge(s[r], e);
|
|
209
|
+
[o[r], a[r]] = [i, l];
|
|
253
210
|
}
|
|
254
|
-
return [
|
|
211
|
+
return [o, a];
|
|
255
212
|
}
|
|
256
|
-
const
|
|
213
|
+
const me = (s, e, t) => s << t | e >>> 32 - t, he = (s, e, t) => e << t | s >>> 32 - t, Te = (s, e, t) => e << t - 32 | s >>> 64 - t, fe = (s, e, t) => s << t - 32 | e >>> 64 - t;
|
|
257
214
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
258
|
-
function
|
|
259
|
-
return
|
|
215
|
+
function Se(s) {
|
|
216
|
+
return s instanceof Uint8Array || ArrayBuffer.isView(s) && s.constructor.name === "Uint8Array";
|
|
260
217
|
}
|
|
261
|
-
function
|
|
262
|
-
if (!Number.isSafeInteger(
|
|
263
|
-
throw new Error("positive integer expected, got " +
|
|
218
|
+
function O(s) {
|
|
219
|
+
if (!Number.isSafeInteger(s) || s < 0)
|
|
220
|
+
throw new Error("positive integer expected, got " + s);
|
|
264
221
|
}
|
|
265
|
-
function
|
|
266
|
-
if (!
|
|
222
|
+
function U(s, ...e) {
|
|
223
|
+
if (!Se(s))
|
|
267
224
|
throw new Error("Uint8Array expected");
|
|
268
|
-
if (e.length > 0 && !e.includes(
|
|
269
|
-
throw new Error("Uint8Array expected of length " + e + ", got length=" +
|
|
225
|
+
if (e.length > 0 && !e.includes(s.length))
|
|
226
|
+
throw new Error("Uint8Array expected of length " + e + ", got length=" + s.length);
|
|
270
227
|
}
|
|
271
|
-
function
|
|
272
|
-
if (
|
|
228
|
+
function F(s, e = !0) {
|
|
229
|
+
if (s.destroyed)
|
|
273
230
|
throw new Error("Hash instance has been destroyed");
|
|
274
|
-
if (e &&
|
|
231
|
+
if (e && s.finished)
|
|
275
232
|
throw new Error("Hash#digest() has already been called");
|
|
276
233
|
}
|
|
277
|
-
function
|
|
278
|
-
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
281
|
-
throw new Error("digestInto() expects output buffer of length at least " +
|
|
234
|
+
function pe(s, e) {
|
|
235
|
+
U(s);
|
|
236
|
+
const t = e.outputLen;
|
|
237
|
+
if (s.length < t)
|
|
238
|
+
throw new Error("digestInto() expects output buffer of length at least " + t);
|
|
282
239
|
}
|
|
283
|
-
function
|
|
284
|
-
return new Uint32Array(
|
|
240
|
+
function be(s) {
|
|
241
|
+
return new Uint32Array(s.buffer, s.byteOffset, Math.floor(s.byteLength / 4));
|
|
285
242
|
}
|
|
286
|
-
function
|
|
287
|
-
for (let e = 0; e <
|
|
288
|
-
|
|
243
|
+
function W(...s) {
|
|
244
|
+
for (let e = 0; e < s.length; e++)
|
|
245
|
+
s[e].fill(0);
|
|
289
246
|
}
|
|
290
|
-
const
|
|
291
|
-
function
|
|
292
|
-
return
|
|
247
|
+
const Ae = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
248
|
+
function Ue(s) {
|
|
249
|
+
return s << 24 & 4278190080 | s << 8 & 16711680 | s >>> 8 & 65280 | s >>> 24 & 255;
|
|
293
250
|
}
|
|
294
|
-
function
|
|
295
|
-
for (let e = 0; e <
|
|
296
|
-
|
|
297
|
-
return
|
|
251
|
+
function De(s) {
|
|
252
|
+
for (let e = 0; e < s.length; e++)
|
|
253
|
+
s[e] = Ue(s[e]);
|
|
254
|
+
return s;
|
|
298
255
|
}
|
|
299
|
-
const
|
|
300
|
-
function
|
|
301
|
-
if (typeof
|
|
256
|
+
const H = Ae ? (s) => s : De;
|
|
257
|
+
function Ce(s) {
|
|
258
|
+
if (typeof s != "string")
|
|
302
259
|
throw new Error("string expected");
|
|
303
|
-
return new Uint8Array(new TextEncoder().encode(
|
|
260
|
+
return new Uint8Array(new TextEncoder().encode(s));
|
|
304
261
|
}
|
|
305
|
-
function
|
|
306
|
-
return typeof
|
|
262
|
+
function V(s) {
|
|
263
|
+
return typeof s == "string" && (s = Ce(s)), U(s), s;
|
|
307
264
|
}
|
|
308
|
-
class
|
|
265
|
+
class Ie {
|
|
309
266
|
}
|
|
310
|
-
function
|
|
311
|
-
const e = (
|
|
312
|
-
return e.outputLen =
|
|
267
|
+
function ye(s) {
|
|
268
|
+
const e = (o) => s().update(V(o)).digest(), t = s();
|
|
269
|
+
return e.outputLen = t.outputLen, e.blockLen = t.blockLen, e.create = () => s(), e;
|
|
313
270
|
}
|
|
314
|
-
const
|
|
315
|
-
for (let
|
|
316
|
-
[
|
|
317
|
-
let
|
|
271
|
+
const Ne = BigInt(0), p = BigInt(1), Re = BigInt(2), Be = BigInt(7), we = BigInt(256), ke = BigInt(113), Y = [], G = [], q = [];
|
|
272
|
+
for (let s = 0, e = p, t = 1, o = 0; s < 24; s++) {
|
|
273
|
+
[t, o] = [o, (2 * t + 3 * o) % 5], Y.push(2 * (5 * o + t)), G.push((s + 1) * (s + 2) / 2 % 64);
|
|
274
|
+
let a = Ne;
|
|
318
275
|
for (let r = 0; r < 7; r++)
|
|
319
|
-
e = (e <<
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
const
|
|
323
|
-
function
|
|
324
|
-
const
|
|
325
|
-
for (let
|
|
326
|
-
for (let
|
|
327
|
-
|
|
328
|
-
for (let
|
|
329
|
-
const
|
|
330
|
-
for (let
|
|
331
|
-
|
|
276
|
+
e = (e << p ^ (e >> Be) * ke) % we, e & Re && (a ^= p << (p << /* @__PURE__ */ BigInt(r)) - p);
|
|
277
|
+
q.push(a);
|
|
278
|
+
}
|
|
279
|
+
const X = Ee(q, !0), Me = X[0], xe = X[1], P = (s, e, t) => t > 32 ? Te(s, e, t) : me(s, e, t), _ = (s, e, t) => t > 32 ? fe(s, e, t) : he(s, e, t);
|
|
280
|
+
function ve(s, e = 24) {
|
|
281
|
+
const t = new Uint32Array(10);
|
|
282
|
+
for (let o = 24 - e; o < 24; o++) {
|
|
283
|
+
for (let i = 0; i < 10; i++)
|
|
284
|
+
t[i] = s[i] ^ s[i + 10] ^ s[i + 20] ^ s[i + 30] ^ s[i + 40];
|
|
285
|
+
for (let i = 0; i < 10; i += 2) {
|
|
286
|
+
const l = (i + 8) % 10, m = (i + 2) % 10, f = t[m], S = t[m + 1], ee = P(f, S, 1) ^ t[l], se = _(f, S, 1) ^ t[l + 1];
|
|
287
|
+
for (let b = 0; b < 50; b += 10)
|
|
288
|
+
s[i + b] ^= ee, s[i + b + 1] ^= se;
|
|
332
289
|
}
|
|
333
|
-
let
|
|
334
|
-
for (let
|
|
335
|
-
const
|
|
336
|
-
|
|
290
|
+
let a = s[2], r = s[3];
|
|
291
|
+
for (let i = 0; i < 24; i++) {
|
|
292
|
+
const l = G[i], m = P(a, r, l), f = _(a, r, l), S = Y[i];
|
|
293
|
+
a = s[S], r = s[S + 1], s[S] = m, s[S + 1] = f;
|
|
337
294
|
}
|
|
338
|
-
for (let
|
|
339
|
-
for (let
|
|
340
|
-
|
|
341
|
-
for (let
|
|
342
|
-
|
|
295
|
+
for (let i = 0; i < 50; i += 10) {
|
|
296
|
+
for (let l = 0; l < 10; l++)
|
|
297
|
+
t[l] = s[i + l];
|
|
298
|
+
for (let l = 0; l < 10; l++)
|
|
299
|
+
s[i + l] ^= ~t[(l + 2) % 10] & t[(l + 4) % 10];
|
|
343
300
|
}
|
|
344
|
-
|
|
301
|
+
s[0] ^= Me[o], s[1] ^= xe[o];
|
|
345
302
|
}
|
|
346
|
-
|
|
303
|
+
W(t);
|
|
347
304
|
}
|
|
348
|
-
class
|
|
305
|
+
class k extends Ie {
|
|
349
306
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
350
|
-
constructor(e,
|
|
351
|
-
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix =
|
|
307
|
+
constructor(e, t, o, a = !1, r = 24) {
|
|
308
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = t, this.outputLen = o, this.enableXOF = a, this.rounds = r, O(o), !(0 < e && e < 200))
|
|
352
309
|
throw new Error("only keccak-f1600 function is supported");
|
|
353
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
310
|
+
this.state = new Uint8Array(200), this.state32 = be(this.state);
|
|
354
311
|
}
|
|
355
312
|
clone() {
|
|
356
313
|
return this._cloneInto();
|
|
357
314
|
}
|
|
358
315
|
keccak() {
|
|
359
|
-
|
|
316
|
+
H(this.state32), ve(this.state32, this.rounds), H(this.state32), this.posOut = 0, this.pos = 0;
|
|
360
317
|
}
|
|
361
318
|
update(e) {
|
|
362
|
-
|
|
363
|
-
const { blockLen:
|
|
364
|
-
for (let r = 0; r <
|
|
365
|
-
const
|
|
366
|
-
for (let
|
|
367
|
-
|
|
368
|
-
this.pos ===
|
|
319
|
+
F(this), e = V(e), U(e);
|
|
320
|
+
const { blockLen: t, state: o } = this, a = e.length;
|
|
321
|
+
for (let r = 0; r < a; ) {
|
|
322
|
+
const i = Math.min(t - this.pos, a - r);
|
|
323
|
+
for (let l = 0; l < i; l++)
|
|
324
|
+
o[this.pos++] ^= e[r++];
|
|
325
|
+
this.pos === t && this.keccak();
|
|
369
326
|
}
|
|
370
327
|
return this;
|
|
371
328
|
}
|
|
@@ -373,16 +330,16 @@ class P extends Ke {
|
|
|
373
330
|
if (this.finished)
|
|
374
331
|
return;
|
|
375
332
|
this.finished = !0;
|
|
376
|
-
const { state: e, suffix:
|
|
377
|
-
e[
|
|
333
|
+
const { state: e, suffix: t, pos: o, blockLen: a } = this;
|
|
334
|
+
e[o] ^= t, (t & 128) !== 0 && o === a - 1 && this.keccak(), e[a - 1] ^= 128, this.keccak();
|
|
378
335
|
}
|
|
379
336
|
writeInto(e) {
|
|
380
|
-
|
|
381
|
-
const
|
|
382
|
-
for (let
|
|
383
|
-
this.posOut >=
|
|
384
|
-
const
|
|
385
|
-
e.set(
|
|
337
|
+
F(this, !1), U(e), this.finish();
|
|
338
|
+
const t = this.state, { blockLen: o } = this;
|
|
339
|
+
for (let a = 0, r = e.length; a < r; ) {
|
|
340
|
+
this.posOut >= o && this.keccak();
|
|
341
|
+
const i = Math.min(o - this.posOut, r - a);
|
|
342
|
+
e.set(t.subarray(this.posOut, this.posOut + i), a), this.posOut += i, a += i;
|
|
386
343
|
}
|
|
387
344
|
return e;
|
|
388
345
|
}
|
|
@@ -392,10 +349,10 @@ class P extends Ke {
|
|
|
392
349
|
return this.writeInto(e);
|
|
393
350
|
}
|
|
394
351
|
xof(e) {
|
|
395
|
-
return
|
|
352
|
+
return O(e), this.xofInto(new Uint8Array(e));
|
|
396
353
|
}
|
|
397
354
|
digestInto(e) {
|
|
398
|
-
if (
|
|
355
|
+
if (pe(e, this), this.finished)
|
|
399
356
|
throw new Error("digest() was already called");
|
|
400
357
|
return this.writeInto(e), this.destroy(), e;
|
|
401
358
|
}
|
|
@@ -403,18 +360,18 @@ class P extends Ke {
|
|
|
403
360
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
404
361
|
}
|
|
405
362
|
destroy() {
|
|
406
|
-
this.destroyed = !0,
|
|
363
|
+
this.destroyed = !0, W(this.state);
|
|
407
364
|
}
|
|
408
365
|
_cloneInto(e) {
|
|
409
|
-
const { blockLen:
|
|
410
|
-
return e || (e = new
|
|
366
|
+
const { blockLen: t, suffix: o, outputLen: a, rounds: r, enableXOF: i } = this;
|
|
367
|
+
return e || (e = new k(t, o, a, i, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = o, e.outputLen = a, e.enableXOF = i, e.destroyed = this.destroyed, e;
|
|
411
368
|
}
|
|
412
369
|
}
|
|
413
|
-
const
|
|
414
|
-
function
|
|
415
|
-
return
|
|
370
|
+
const Oe = (s, e, t) => ye(() => new k(e, s, t)), Fe = Oe(1, 136, 256 / 8);
|
|
371
|
+
function He(s, e) {
|
|
372
|
+
return Fe(B(s, { strict: !1 }) ? de(s) : s);
|
|
416
373
|
}
|
|
417
|
-
class
|
|
374
|
+
class Pe extends T {
|
|
418
375
|
constructor({ address: e }) {
|
|
419
376
|
super(`Address "${e}" is invalid.`, {
|
|
420
377
|
metaMessages: [
|
|
@@ -425,7 +382,7 @@ class nt extends g {
|
|
|
425
382
|
});
|
|
426
383
|
}
|
|
427
384
|
}
|
|
428
|
-
class
|
|
385
|
+
class Q extends Map {
|
|
429
386
|
constructor(e) {
|
|
430
387
|
super(), Object.defineProperty(this, "maxSize", {
|
|
431
388
|
enumerable: !0,
|
|
@@ -435,247 +392,603 @@ class fe extends Map {
|
|
|
435
392
|
}), this.maxSize = e;
|
|
436
393
|
}
|
|
437
394
|
get(e) {
|
|
438
|
-
const
|
|
439
|
-
return super.has(e) &&
|
|
395
|
+
const t = super.get(e);
|
|
396
|
+
return super.has(e) && t !== void 0 && (this.delete(e), super.set(e, t)), t;
|
|
440
397
|
}
|
|
441
|
-
set(e,
|
|
442
|
-
if (super.set(e,
|
|
443
|
-
const
|
|
444
|
-
|
|
398
|
+
set(e, t) {
|
|
399
|
+
if (super.set(e, t), this.maxSize && this.size > this.maxSize) {
|
|
400
|
+
const o = this.keys().next().value;
|
|
401
|
+
o && this.delete(o);
|
|
445
402
|
}
|
|
446
403
|
return this;
|
|
447
404
|
}
|
|
448
405
|
}
|
|
449
|
-
const
|
|
450
|
-
function
|
|
451
|
-
if (
|
|
452
|
-
return
|
|
453
|
-
const
|
|
454
|
-
for (let
|
|
455
|
-
|
|
456
|
-
const r = `0x${
|
|
457
|
-
return
|
|
458
|
-
}
|
|
459
|
-
function
|
|
460
|
-
if (
|
|
461
|
-
throw new
|
|
462
|
-
return
|
|
463
|
-
}
|
|
464
|
-
const
|
|
465
|
-
function
|
|
466
|
-
const { strict:
|
|
467
|
-
if (
|
|
468
|
-
return
|
|
469
|
-
const
|
|
470
|
-
return
|
|
471
|
-
}
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
}, k = {
|
|
528
|
-
chainId: ee.chainId,
|
|
529
|
-
address: d("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
530
|
-
symbol: "USDC",
|
|
531
|
-
decimals: 6,
|
|
532
|
-
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
533
|
-
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
534
|
-
}, B = {
|
|
535
|
-
chainId: Z.chainId,
|
|
536
|
-
address: d("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
537
|
-
symbol: "USDC",
|
|
538
|
-
decimals: 6,
|
|
539
|
-
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
540
|
-
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
541
|
-
}, rt = {
|
|
542
|
-
chainId: ne.chainId,
|
|
543
|
-
address: "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",
|
|
544
|
-
symbol: "USDC",
|
|
545
|
-
decimals: 6,
|
|
546
|
-
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
547
|
-
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
548
|
-
}, at = {
|
|
549
|
-
[v.chainId]: v,
|
|
550
|
-
[C.chainId]: C,
|
|
551
|
-
[T.chainId]: T,
|
|
552
|
-
[N.chainId]: N,
|
|
553
|
-
[x.chainId]: x,
|
|
554
|
-
[D.chainId]: D,
|
|
555
|
-
[k.chainId]: k,
|
|
556
|
-
[B.chainId]: B,
|
|
557
|
-
[R.chainId]: R
|
|
558
|
-
}, z = {
|
|
559
|
-
ARBITRUM_MAINNET: {
|
|
560
|
-
...G,
|
|
561
|
-
tokens: {
|
|
562
|
-
[h.USDC]: C
|
|
563
|
-
},
|
|
564
|
-
explorer: "https://arbiscan.io"
|
|
406
|
+
const I = /* @__PURE__ */ new Q(8192);
|
|
407
|
+
function J(s, e) {
|
|
408
|
+
if (I.has(`${s}.${e}`))
|
|
409
|
+
return I.get(`${s}.${e}`);
|
|
410
|
+
const t = s.substring(2).toLowerCase(), o = He(K(t)), a = t.split("");
|
|
411
|
+
for (let i = 0; i < 40; i += 2)
|
|
412
|
+
o[i >> 1] >> 4 >= 8 && a[i] && (a[i] = a[i].toUpperCase()), (o[i >> 1] & 15) >= 8 && a[i + 1] && (a[i + 1] = a[i + 1].toUpperCase());
|
|
413
|
+
const r = `0x${a.join("")}`;
|
|
414
|
+
return I.set(`${s}.${e}`, r), r;
|
|
415
|
+
}
|
|
416
|
+
function E(s, e) {
|
|
417
|
+
if (!$e(s, { strict: !1 }))
|
|
418
|
+
throw new Pe({ address: s });
|
|
419
|
+
return J(s, e);
|
|
420
|
+
}
|
|
421
|
+
const _e = /^0x[a-fA-F0-9]{40}$/, y = /* @__PURE__ */ new Q(8192);
|
|
422
|
+
function $e(s, e) {
|
|
423
|
+
const { strict: t = !0 } = e ?? {}, o = `${s}.${t}`;
|
|
424
|
+
if (y.has(o))
|
|
425
|
+
return y.get(o);
|
|
426
|
+
const a = _e.test(s) ? s.toLowerCase() === s ? !0 : t ? J(s) === s : !0 : !1;
|
|
427
|
+
return y.set(o, a), a;
|
|
428
|
+
}
|
|
429
|
+
const n = {
|
|
430
|
+
USDC: "USDC",
|
|
431
|
+
USDT: "USDT",
|
|
432
|
+
DAI: "DAI",
|
|
433
|
+
BUSD: "BUSD",
|
|
434
|
+
EURC: "EURC",
|
|
435
|
+
ETH: "ETH",
|
|
436
|
+
WETH: "WETH",
|
|
437
|
+
STRK: "STRK",
|
|
438
|
+
BNB: "BNB",
|
|
439
|
+
LORDS: "LORDS"
|
|
440
|
+
};
|
|
441
|
+
n.USDC;
|
|
442
|
+
const d = {
|
|
443
|
+
[c.ARBITRUM]: {
|
|
444
|
+
[n.DAI]: {
|
|
445
|
+
address: E("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
|
|
446
|
+
symbol: n.DAI,
|
|
447
|
+
name: "Dai Stablecoin",
|
|
448
|
+
decimals: 18,
|
|
449
|
+
logoURI: "/images/tokens/dai.png"
|
|
450
|
+
/* DAI */
|
|
451
|
+
},
|
|
452
|
+
[n.ETH]: {
|
|
453
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
454
|
+
symbol: n.ETH,
|
|
455
|
+
name: "Ethereum",
|
|
456
|
+
decimals: 18,
|
|
457
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
458
|
+
/* ETH */
|
|
459
|
+
},
|
|
460
|
+
[n.USDC]: {
|
|
461
|
+
address: E("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
462
|
+
symbol: n.USDC,
|
|
463
|
+
name: "USD Coin",
|
|
464
|
+
decimals: 6,
|
|
465
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
466
|
+
/* USDC */
|
|
467
|
+
},
|
|
468
|
+
[n.USDT]: {
|
|
469
|
+
address: E("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
|
|
470
|
+
symbol: n.USDT,
|
|
471
|
+
name: "Tether USD",
|
|
472
|
+
decimals: 6,
|
|
473
|
+
logoURI: "/images/tokens/usdt.png"
|
|
474
|
+
/* USDT */
|
|
475
|
+
},
|
|
476
|
+
[n.WETH]: {
|
|
477
|
+
address: E("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
|
|
478
|
+
symbol: n.WETH,
|
|
479
|
+
name: "Wrapped Ether",
|
|
480
|
+
decimals: 18,
|
|
481
|
+
logoURI: "/images/tokens/weth.png"
|
|
482
|
+
/* WETH */
|
|
483
|
+
}
|
|
565
484
|
},
|
|
566
|
-
ARBITRUM_TESTNET: {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
485
|
+
[c.ARBITRUM_TESTNET]: {
|
|
486
|
+
[n.USDC]: {
|
|
487
|
+
address: E("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
488
|
+
symbol: n.USDC,
|
|
489
|
+
name: "USD Coin",
|
|
490
|
+
fiatISO: "USD",
|
|
491
|
+
decimals: 6,
|
|
492
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
493
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
571
494
|
}
|
|
572
495
|
},
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
496
|
+
[c.AVALANCHE]: {
|
|
497
|
+
[n.DAI]: {
|
|
498
|
+
address: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",
|
|
499
|
+
symbol: n.DAI,
|
|
500
|
+
name: "Dai Stablecoin",
|
|
501
|
+
decimals: 18,
|
|
502
|
+
logoURI: "/images/tokens/dai.png"
|
|
503
|
+
/* DAI */
|
|
577
504
|
},
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
505
|
+
[n.USDC]: {
|
|
506
|
+
address: E("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
507
|
+
symbol: n.USDC,
|
|
508
|
+
name: "USD Coin",
|
|
509
|
+
fiatISO: "USD",
|
|
510
|
+
decimals: 6,
|
|
511
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
512
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
584
513
|
},
|
|
585
|
-
|
|
514
|
+
[n.USDT]: {
|
|
515
|
+
address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
|
|
516
|
+
symbol: n.USDT,
|
|
517
|
+
name: "Tether USD",
|
|
518
|
+
decimals: 6,
|
|
519
|
+
logoURI: "/images/tokens/usdt.png"
|
|
520
|
+
/* USDT */
|
|
521
|
+
},
|
|
522
|
+
[n.WETH]: {
|
|
523
|
+
address: "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
|
|
524
|
+
symbol: n.WETH,
|
|
525
|
+
name: "Wrapped Ether",
|
|
526
|
+
decimals: 18,
|
|
527
|
+
logoURI: "/images/tokens/weth.png"
|
|
528
|
+
/* WETH */
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
[c.AVALANCHE_TESTNET]: {
|
|
532
|
+
[n.USDC]: {
|
|
533
|
+
address: E("0x5425890298aed601595a70AB815c96711a31Bc65"),
|
|
534
|
+
symbol: n.USDC,
|
|
535
|
+
name: "USD Coin",
|
|
536
|
+
fiatISO: "USD",
|
|
537
|
+
decimals: 6,
|
|
538
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
539
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
540
|
+
}
|
|
586
541
|
},
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
542
|
+
[c.BASE]: {
|
|
543
|
+
[n.DAI]: {
|
|
544
|
+
address: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
|
|
545
|
+
symbol: n.DAI,
|
|
546
|
+
name: "Dai Stablecoin",
|
|
547
|
+
decimals: 18,
|
|
548
|
+
logoURI: "/images/tokens/dai.png"
|
|
549
|
+
/* DAI */
|
|
591
550
|
},
|
|
592
|
-
|
|
551
|
+
[n.ETH]: {
|
|
552
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
553
|
+
symbol: n.ETH,
|
|
554
|
+
name: "Ethereum",
|
|
555
|
+
decimals: 18,
|
|
556
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
557
|
+
/* ETH */
|
|
558
|
+
},
|
|
559
|
+
[n.EURC]: {
|
|
560
|
+
address: "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",
|
|
561
|
+
symbol: n.EURC,
|
|
562
|
+
name: "Euro Coin",
|
|
563
|
+
decimals: 6,
|
|
564
|
+
logoURI: "/images/tokens/eurc.png"
|
|
565
|
+
/* EURC */
|
|
566
|
+
},
|
|
567
|
+
[n.USDC]: {
|
|
568
|
+
address: E("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
569
|
+
symbol: n.USDC,
|
|
570
|
+
name: "USD Coin",
|
|
571
|
+
fiatISO: "USD",
|
|
572
|
+
decimals: 6,
|
|
573
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
574
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
575
|
+
},
|
|
576
|
+
[n.WETH]: {
|
|
577
|
+
address: E("0x4200000000000000000000000000000000000006"),
|
|
578
|
+
symbol: n.WETH,
|
|
579
|
+
name: "Wrapped Ether",
|
|
580
|
+
decimals: 18,
|
|
581
|
+
logoURI: "/images/tokens/weth.png"
|
|
582
|
+
/* WETH */
|
|
583
|
+
}
|
|
593
584
|
},
|
|
594
|
-
BASE_TESTNET: {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
585
|
+
[c.BASE_TESTNET]: {
|
|
586
|
+
[n.USDC]: {
|
|
587
|
+
address: E("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
588
|
+
symbol: n.USDC,
|
|
589
|
+
name: "USD Coin",
|
|
590
|
+
fiatISO: "USD",
|
|
591
|
+
decimals: 6,
|
|
592
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
593
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
[c.BSC]: {
|
|
597
|
+
[n.BNB]: {
|
|
598
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
599
|
+
symbol: n.BNB,
|
|
600
|
+
name: "BNB",
|
|
601
|
+
decimals: 18,
|
|
602
|
+
logoURI: "/images/chains/bsc.webp"
|
|
603
|
+
/* BNB */
|
|
604
|
+
},
|
|
605
|
+
[n.BUSD]: {
|
|
606
|
+
address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
|
|
607
|
+
symbol: n.BUSD,
|
|
608
|
+
name: "Binance USD",
|
|
609
|
+
decimals: 18,
|
|
610
|
+
logoURI: "/images/tokens/busd.png"
|
|
611
|
+
/* BUSD */
|
|
612
|
+
},
|
|
613
|
+
[n.DAI]: {
|
|
614
|
+
address: "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",
|
|
615
|
+
symbol: n.DAI,
|
|
616
|
+
name: "Dai Stablecoin",
|
|
617
|
+
decimals: 18,
|
|
618
|
+
logoURI: "/images/tokens/dai.png"
|
|
619
|
+
/* DAI */
|
|
620
|
+
},
|
|
621
|
+
[n.ETH]: {
|
|
622
|
+
address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8",
|
|
623
|
+
symbol: n.ETH,
|
|
624
|
+
name: "Ethereum",
|
|
625
|
+
decimals: 18,
|
|
626
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
627
|
+
/* ETH */
|
|
598
628
|
},
|
|
599
|
-
|
|
629
|
+
[n.USDC]: {
|
|
630
|
+
address: E("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
631
|
+
symbol: n.USDC,
|
|
632
|
+
decimals: 18,
|
|
633
|
+
name: "USD Coin",
|
|
634
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
635
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
636
|
+
},
|
|
637
|
+
[n.USDT]: {
|
|
638
|
+
address: "0x55d398326f99059fF775485246999027B3197955",
|
|
639
|
+
symbol: n.USDT,
|
|
640
|
+
name: "Tether USD",
|
|
641
|
+
decimals: 18,
|
|
642
|
+
logoURI: "/images/tokens/usdt.png"
|
|
643
|
+
/* USDT */
|
|
644
|
+
}
|
|
600
645
|
},
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
646
|
+
[c.ETHEREUM]: {
|
|
647
|
+
[n.BUSD]: {
|
|
648
|
+
address: "0x4Fabb145d64652a948d72533023f6E7A623C7C53",
|
|
649
|
+
symbol: n.BUSD,
|
|
650
|
+
name: "Binance USD",
|
|
651
|
+
decimals: 18,
|
|
652
|
+
logoURI: "/images/tokens/busd.png"
|
|
653
|
+
/* BUSD */
|
|
654
|
+
},
|
|
655
|
+
[n.DAI]: {
|
|
656
|
+
address: E("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
|
|
657
|
+
symbol: n.DAI,
|
|
658
|
+
name: "Dai Stablecoin",
|
|
659
|
+
decimals: 18,
|
|
660
|
+
logoURI: "/images/tokens/dai.png"
|
|
661
|
+
/* DAI */
|
|
662
|
+
},
|
|
663
|
+
[n.ETH]: {
|
|
664
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
665
|
+
symbol: n.ETH,
|
|
666
|
+
name: "Ethereum",
|
|
667
|
+
decimals: 18,
|
|
668
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
669
|
+
/* ETH */
|
|
670
|
+
},
|
|
671
|
+
[n.EURC]: {
|
|
672
|
+
address: "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",
|
|
673
|
+
symbol: n.EURC,
|
|
674
|
+
name: "Euro Coin",
|
|
675
|
+
decimals: 6,
|
|
676
|
+
logoURI: "/images/tokens/eurc.png"
|
|
677
|
+
/* EURC */
|
|
678
|
+
},
|
|
679
|
+
[n.STRK]: {
|
|
680
|
+
address: "0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",
|
|
681
|
+
symbol: n.STRK,
|
|
682
|
+
name: "Starknet Token",
|
|
683
|
+
decimals: 18,
|
|
684
|
+
logoURI: "/images/chains/starknet.svg"
|
|
685
|
+
/* STRK */
|
|
686
|
+
},
|
|
687
|
+
[n.USDC]: {
|
|
688
|
+
address: E("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
689
|
+
symbol: n.USDC,
|
|
690
|
+
name: "USD Coin",
|
|
691
|
+
decimals: 6,
|
|
692
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
693
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
694
|
+
},
|
|
695
|
+
[n.USDT]: {
|
|
696
|
+
address: E("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
|
|
697
|
+
symbol: n.USDT,
|
|
698
|
+
name: "Tether USD",
|
|
699
|
+
decimals: 6,
|
|
700
|
+
logoURI: "/images/tokens/usdt.png"
|
|
701
|
+
/* USDT */
|
|
605
702
|
},
|
|
606
|
-
|
|
703
|
+
[n.WETH]: {
|
|
704
|
+
address: E("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
705
|
+
symbol: n.WETH,
|
|
706
|
+
name: "Wrapped Ether",
|
|
707
|
+
decimals: 18,
|
|
708
|
+
logoURI: "/images/tokens/weth.png"
|
|
709
|
+
/* WETH */
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
[c.ETHEREUM_TESTNET]: {
|
|
713
|
+
[n.USDC]: {
|
|
714
|
+
address: E("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
715
|
+
symbol: n.USDC,
|
|
716
|
+
decimals: 6,
|
|
717
|
+
name: "USD Coin",
|
|
718
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
719
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
[c.HYPEREVM]: {
|
|
723
|
+
[n.USDC]: {
|
|
724
|
+
address: "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
|
|
725
|
+
symbol: n.USDC,
|
|
726
|
+
name: "USD Coin",
|
|
727
|
+
decimals: 6,
|
|
728
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
729
|
+
/* USDC */
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
[c.LISK]: {
|
|
733
|
+
[n.USDC]: {
|
|
734
|
+
address: "0xF242275d3a6527d877f2c927a82D9b057609cc71",
|
|
735
|
+
symbol: n.USDC,
|
|
736
|
+
name: "USD Coin",
|
|
737
|
+
decimals: 6,
|
|
738
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
739
|
+
/* USDC */
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
[c.MONAD]: {
|
|
743
|
+
[n.USDC]: {
|
|
744
|
+
address: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603",
|
|
745
|
+
symbol: n.USDC,
|
|
746
|
+
name: "USD Coin",
|
|
747
|
+
decimals: 6,
|
|
748
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
749
|
+
/* USDC */
|
|
750
|
+
}
|
|
607
751
|
},
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
752
|
+
[c.MONAD_TESTNET]: {
|
|
753
|
+
[n.USDC]: {
|
|
754
|
+
address: "0x534b2f3A21130d7a60830c2Df862319e593943A3",
|
|
755
|
+
symbol: n.USDC,
|
|
756
|
+
name: "USD Coin",
|
|
757
|
+
decimals: 6,
|
|
758
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
759
|
+
/* USDC */
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
[c.OPTIMISM]: {
|
|
763
|
+
[n.DAI]: {
|
|
764
|
+
address: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
|
|
765
|
+
symbol: n.DAI,
|
|
766
|
+
name: "Dai Stablecoin",
|
|
767
|
+
decimals: 18,
|
|
768
|
+
logoURI: "/images/tokens/dai.png"
|
|
769
|
+
/* DAI */
|
|
770
|
+
},
|
|
771
|
+
[n.ETH]: {
|
|
772
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
773
|
+
symbol: n.ETH,
|
|
774
|
+
name: "Ethereum",
|
|
775
|
+
decimals: 18,
|
|
776
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
777
|
+
/* ETH */
|
|
778
|
+
},
|
|
779
|
+
[n.USDC]: {
|
|
780
|
+
address: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
|
|
781
|
+
symbol: n.USDC,
|
|
782
|
+
name: "USD Coin",
|
|
783
|
+
decimals: 6,
|
|
784
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
785
|
+
/* USDC */
|
|
612
786
|
},
|
|
613
|
-
|
|
787
|
+
[n.USDT]: {
|
|
788
|
+
address: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
|
|
789
|
+
symbol: n.USDT,
|
|
790
|
+
name: "Tether USD",
|
|
791
|
+
decimals: 6,
|
|
792
|
+
logoURI: "/images/tokens/usdt.png"
|
|
793
|
+
/* USDT */
|
|
794
|
+
},
|
|
795
|
+
[n.WETH]: {
|
|
796
|
+
address: "0x4200000000000000000000000000000000000006",
|
|
797
|
+
symbol: n.WETH,
|
|
798
|
+
name: "Wrapped Ether",
|
|
799
|
+
decimals: 18,
|
|
800
|
+
logoURI: "/images/tokens/weth.png"
|
|
801
|
+
/* WETH */
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
[c.OPTIMISM_TESTNET]: {
|
|
805
|
+
[n.USDC]: {
|
|
806
|
+
address: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7",
|
|
807
|
+
symbol: n.USDC,
|
|
808
|
+
name: "USD Coin",
|
|
809
|
+
decimals: 6,
|
|
810
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
811
|
+
/* USDC */
|
|
812
|
+
}
|
|
614
813
|
},
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
814
|
+
[c.POLYGON]: {
|
|
815
|
+
[n.DAI]: {
|
|
816
|
+
address: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",
|
|
817
|
+
symbol: n.DAI,
|
|
818
|
+
name: "Dai Stablecoin",
|
|
819
|
+
decimals: 18,
|
|
820
|
+
logoURI: "/images/tokens/dai.png"
|
|
821
|
+
/* DAI */
|
|
619
822
|
},
|
|
620
|
-
|
|
823
|
+
[n.USDC]: {
|
|
824
|
+
address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
|
825
|
+
symbol: n.USDC,
|
|
826
|
+
name: "USD Coin",
|
|
827
|
+
decimals: 6,
|
|
828
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
829
|
+
/* USDC */
|
|
830
|
+
},
|
|
831
|
+
[n.USDT]: {
|
|
832
|
+
address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
|
|
833
|
+
symbol: n.USDT,
|
|
834
|
+
name: "Tether USD",
|
|
835
|
+
decimals: 6,
|
|
836
|
+
logoURI: "/images/tokens/usdt.png"
|
|
837
|
+
/* USDT */
|
|
838
|
+
},
|
|
839
|
+
[n.WETH]: {
|
|
840
|
+
address: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
|
|
841
|
+
symbol: n.WETH,
|
|
842
|
+
name: "Wrapped Ether",
|
|
843
|
+
decimals: 18,
|
|
844
|
+
logoURI: "/images/tokens/weth.png"
|
|
845
|
+
/* WETH */
|
|
846
|
+
}
|
|
621
847
|
},
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
848
|
+
[c.STARKNET]: {
|
|
849
|
+
[n.DAI]: {
|
|
850
|
+
address: "0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",
|
|
851
|
+
symbol: n.DAI,
|
|
852
|
+
name: "Dai Stablecoin",
|
|
853
|
+
decimals: 18,
|
|
854
|
+
logoURI: "/images/tokens/dai.png"
|
|
855
|
+
/* DAI */
|
|
856
|
+
},
|
|
857
|
+
[n.ETH]: {
|
|
858
|
+
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
859
|
+
symbol: n.ETH,
|
|
860
|
+
name: "Ethereum",
|
|
861
|
+
decimals: 18,
|
|
862
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
863
|
+
/* ETH */
|
|
864
|
+
},
|
|
865
|
+
[n.LORDS]: {
|
|
866
|
+
address: "0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",
|
|
867
|
+
symbol: n.LORDS,
|
|
868
|
+
name: "LORDS Token",
|
|
869
|
+
decimals: 18,
|
|
870
|
+
logoURI: "/images/tokens/lords.png"
|
|
871
|
+
/* LORDS */
|
|
626
872
|
},
|
|
627
|
-
|
|
873
|
+
[n.STRK]: {
|
|
874
|
+
address: "0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",
|
|
875
|
+
symbol: n.STRK,
|
|
876
|
+
name: "Starknet Token",
|
|
877
|
+
decimals: 18,
|
|
878
|
+
logoURI: "/images/chains/starknet.svg"
|
|
879
|
+
/* STRK */
|
|
880
|
+
},
|
|
881
|
+
[n.USDC]: {
|
|
882
|
+
address: "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",
|
|
883
|
+
symbol: n.USDC,
|
|
884
|
+
name: "USD Coin",
|
|
885
|
+
decimals: 6,
|
|
886
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
887
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
888
|
+
},
|
|
889
|
+
[n.USDT]: {
|
|
890
|
+
address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
|
|
891
|
+
symbol: n.USDT,
|
|
892
|
+
name: "Tether USD",
|
|
893
|
+
decimals: 6,
|
|
894
|
+
logoURI: "/images/tokens/usdt.png"
|
|
895
|
+
/* USDT */
|
|
896
|
+
}
|
|
897
|
+
},
|
|
898
|
+
[c.STARKNET_TESTNET]: {
|
|
899
|
+
[n.USDC]: {
|
|
900
|
+
address: "0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",
|
|
901
|
+
symbol: n.USDC,
|
|
902
|
+
name: "USD Coin",
|
|
903
|
+
decimals: 6,
|
|
904
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
905
|
+
/* USDC */
|
|
906
|
+
}
|
|
628
907
|
}
|
|
908
|
+
}, Je = {
|
|
909
|
+
ARBITRUM: d[c.ARBITRUM],
|
|
910
|
+
ARBITRUM_TESTNET: d[c.ARBITRUM_TESTNET],
|
|
911
|
+
AVALANCHE: d[c.AVALANCHE],
|
|
912
|
+
AVALANCHE_TESTNET: d[c.AVALANCHE_TESTNET],
|
|
913
|
+
BASE: d[c.BASE],
|
|
914
|
+
BASE_TESTNET: d[c.BASE_TESTNET],
|
|
915
|
+
BSC: d[c.BSC],
|
|
916
|
+
ETHEREUM: d[c.ETHEREUM],
|
|
917
|
+
ETHEREUM_TESTNET: d[c.ETHEREUM_TESTNET],
|
|
918
|
+
STARKNET: d[c.STARKNET]
|
|
629
919
|
};
|
|
630
|
-
|
|
631
|
-
function
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
920
|
+
d[c.ARBITRUM], d[c.ARBITRUM_TESTNET], d[c.AVALANCHE], d[c.AVALANCHE_TESTNET], d[c.BASE], d[c.BASE_TESTNET], d[c.BSC], d[c.ETHEREUM], d[c.ETHEREUM_TESTNET], d[c.HYPEREVM], d[c.LISK], d[c.MONAD], d[c.MONAD_TESTNET], d[c.OPTIMISM], d[c.OPTIMISM_TESTNET], d[c.POLYGON], d[c.STARKNET], d[c.STARKNET_TESTNET];
|
|
921
|
+
function ze(s, e) {
|
|
922
|
+
const t = e.toLowerCase().trim(), o = d[s];
|
|
923
|
+
if (!o)
|
|
924
|
+
throw new Error(
|
|
925
|
+
`Chain not found: ${s}. The chain key must be a valid chain identifier.`
|
|
926
|
+
);
|
|
927
|
+
let a;
|
|
928
|
+
for (const r in o) {
|
|
929
|
+
const i = o[r];
|
|
930
|
+
if (i && i.address.toLowerCase() === t.toLowerCase()) {
|
|
931
|
+
a = i;
|
|
932
|
+
break;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
if (!a)
|
|
936
|
+
throw new Error(
|
|
937
|
+
`Token address mismatch: address ${e} does not exist on chain ${s}. The token address must be a valid token address on the specified chain.`
|
|
938
|
+
);
|
|
939
|
+
return a;
|
|
641
940
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
941
|
+
function N(s, e, t) {
|
|
942
|
+
const o = ze(s, e);
|
|
943
|
+
if (o.symbol !== t)
|
|
944
|
+
throw new Error(
|
|
945
|
+
`Token address and symbol mismatch: address ${e} on chain ${s} corresponds to token "${o.symbol}", but expected "${t}". The token address must correspond to a token with the expected symbol on the specified chain.`
|
|
946
|
+
);
|
|
947
|
+
return o;
|
|
948
|
+
}
|
|
949
|
+
function Le(s, e) {
|
|
950
|
+
return d[s]?.[e];
|
|
951
|
+
}
|
|
952
|
+
function je(s, e) {
|
|
953
|
+
return Le(s, e)?.address;
|
|
954
|
+
}
|
|
955
|
+
var Z = /* @__PURE__ */ ((s) => (s.PRODUCTION = "production", s.STAGING = "staging", s))(Z || {});
|
|
956
|
+
class u {
|
|
957
|
+
constructor({ api_key: e, env: t, seesion_token: o, props: a }) {
|
|
958
|
+
this.api_key = e || "", this.sessionToken = o || "", this.env = t ?? Z.PRODUCTION, this.props = a;
|
|
646
959
|
}
|
|
647
960
|
static async config(e) {
|
|
648
|
-
if (!
|
|
961
|
+
if (!u.app) {
|
|
649
962
|
if (!e)
|
|
650
963
|
throw new Error("Please provide an api_key");
|
|
651
|
-
|
|
964
|
+
u.app = new u(e);
|
|
652
965
|
}
|
|
653
|
-
return e && (e.api_key !== void 0 && (
|
|
966
|
+
return e && (e.api_key !== void 0 && (u.app.api_key = e.api_key), e.seesion_token !== void 0 && (u.app.sessionToken = e.seesion_token), e.env !== void 0 && (u.app.env = e.env), e.props !== void 0 && (u.app.props = e.props)), u.app;
|
|
654
967
|
}
|
|
655
968
|
static getApiKey() {
|
|
656
|
-
if (!
|
|
969
|
+
if (!u.app)
|
|
657
970
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
658
|
-
return
|
|
971
|
+
return u.app.api_key;
|
|
659
972
|
}
|
|
660
973
|
static getSessionToken() {
|
|
661
|
-
if (!
|
|
974
|
+
if (!u.app)
|
|
662
975
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
663
|
-
return
|
|
976
|
+
return u.app.sessionToken;
|
|
664
977
|
}
|
|
665
978
|
static getProps() {
|
|
666
|
-
if (!
|
|
979
|
+
if (!u.app)
|
|
667
980
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
668
|
-
return
|
|
981
|
+
return u.app.props;
|
|
669
982
|
}
|
|
670
983
|
static getEnv() {
|
|
671
|
-
if (!
|
|
984
|
+
if (!u.app)
|
|
672
985
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
673
|
-
return
|
|
986
|
+
return u.app.env === "internal" ? "staging" : u.app.env;
|
|
674
987
|
}
|
|
675
988
|
static getBaseUrl() {
|
|
676
|
-
if (!
|
|
989
|
+
if (!u.app)
|
|
677
990
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
678
|
-
switch (
|
|
991
|
+
switch (u.app.env) {
|
|
679
992
|
case "production":
|
|
680
993
|
return "https://api.chainrails.io/api/v1";
|
|
681
994
|
case "staging":
|
|
@@ -687,139 +1000,148 @@ class c {
|
|
|
687
1000
|
}
|
|
688
1001
|
}
|
|
689
1002
|
static getPayModalUrl(e) {
|
|
690
|
-
if (!
|
|
1003
|
+
if (!u.app)
|
|
691
1004
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
692
|
-
const
|
|
693
|
-
return
|
|
1005
|
+
const t = u.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", o = Number(e), a = e && !isNaN(Number(e)) && o > 0 ? "/pay/" : "/deposit/", r = `${e && !isNaN(Number(e)) && o > 0 ? o * 100 : ""}`;
|
|
1006
|
+
return t + a + r;
|
|
694
1007
|
}
|
|
695
1008
|
}
|
|
696
|
-
let
|
|
697
|
-
function
|
|
698
|
-
|
|
699
|
-
prefixUrl:
|
|
1009
|
+
let R = null;
|
|
1010
|
+
function Ke() {
|
|
1011
|
+
R = te.create({
|
|
1012
|
+
prefixUrl: u.getBaseUrl(),
|
|
700
1013
|
headers: {
|
|
701
1014
|
"Content-Type": "application/json"
|
|
702
1015
|
},
|
|
703
1016
|
hooks: {
|
|
704
1017
|
beforeRequest: [
|
|
705
|
-
(
|
|
706
|
-
const e =
|
|
707
|
-
|
|
1018
|
+
(s) => {
|
|
1019
|
+
const e = u.getSessionToken() || u.getApiKey();
|
|
1020
|
+
s.headers.set("Authorization", `Bearer ${e}`);
|
|
708
1021
|
}
|
|
709
1022
|
],
|
|
710
|
-
afterResponse: [(
|
|
1023
|
+
afterResponse: [(s, e, t) => t]
|
|
711
1024
|
},
|
|
712
1025
|
retry: {
|
|
713
1026
|
limit: 2
|
|
714
1027
|
}
|
|
715
1028
|
});
|
|
716
1029
|
}
|
|
717
|
-
function
|
|
718
|
-
return
|
|
1030
|
+
function g() {
|
|
1031
|
+
return R || Ke(), R;
|
|
719
1032
|
}
|
|
720
|
-
class
|
|
1033
|
+
class We {
|
|
721
1034
|
async getById(e) {
|
|
722
|
-
return await
|
|
1035
|
+
return await g().get("intents/" + e).json();
|
|
723
1036
|
}
|
|
724
1037
|
async getForSender(e) {
|
|
725
|
-
return await
|
|
1038
|
+
return await g().get("intents/user/" + e).json();
|
|
726
1039
|
}
|
|
727
1040
|
async getForAddress(e) {
|
|
728
|
-
return await
|
|
1041
|
+
return await g().get("intents/address/" + e).json();
|
|
729
1042
|
}
|
|
730
1043
|
async getForSession(e) {
|
|
731
|
-
return await
|
|
1044
|
+
return await g().get("modal/sessions/intents/" + e).json();
|
|
732
1045
|
}
|
|
733
1046
|
async getAll(e) {
|
|
734
|
-
return await
|
|
1047
|
+
return await g().get("intents", { searchParams: e }).json();
|
|
735
1048
|
}
|
|
736
1049
|
async create(e) {
|
|
737
|
-
return await
|
|
1050
|
+
return await g().post("intents", { json: e }).json();
|
|
738
1051
|
}
|
|
739
1052
|
async createForSession(e) {
|
|
740
|
-
return await
|
|
1053
|
+
return await g().post("modal/sessions/intents", { json: e }).json();
|
|
741
1054
|
}
|
|
742
|
-
async update(e,
|
|
743
|
-
return await
|
|
1055
|
+
async update(e, t) {
|
|
1056
|
+
return await g().post("intents", { json: t }).json();
|
|
744
1057
|
}
|
|
745
1058
|
async triggerProcessing(e) {
|
|
746
|
-
return await
|
|
1059
|
+
return await g().post(`intents/${e}/trigger-processing`).json();
|
|
747
1060
|
}
|
|
748
1061
|
async triggerProcessingForSession(e) {
|
|
749
|
-
return await
|
|
1062
|
+
return await g().post(`modal/sessions/intents/${e}/process`).json();
|
|
750
1063
|
}
|
|
751
1064
|
}
|
|
752
|
-
class
|
|
1065
|
+
class Ve {
|
|
753
1066
|
async getFromSpecificBridge(e) {
|
|
754
|
-
return await
|
|
1067
|
+
return N(e.sourceChain, e.tokenIn, e.amountSymbol), await g().get("quotes/single", { searchParams: e }).json();
|
|
755
1068
|
}
|
|
756
1069
|
async getFromAllBridges(e) {
|
|
757
|
-
return await
|
|
1070
|
+
return N(e.sourceChain, e.tokenIn, e.amountSymbol), await g().get("quotes/multiple", { searchParams: e }).json();
|
|
758
1071
|
}
|
|
759
1072
|
async getBestAcrossBridges(e) {
|
|
760
|
-
return await
|
|
1073
|
+
return N(e.sourceChain, e.tokenIn, e.amountSymbol), await g().get("quotes/best", { searchParams: e }).json();
|
|
761
1074
|
}
|
|
762
1075
|
async getAll(e) {
|
|
763
|
-
return await
|
|
1076
|
+
return await g().get("quotes/multi-source", { searchParams: e }).json();
|
|
764
1077
|
}
|
|
765
1078
|
async getAllForSession(e) {
|
|
766
|
-
return await
|
|
1079
|
+
return await g().get("modal/sessions/quotes", { searchParams: e }).json();
|
|
767
1080
|
}
|
|
768
1081
|
}
|
|
769
|
-
class
|
|
1082
|
+
class Ye {
|
|
770
1083
|
async getOptimalRoutes(e) {
|
|
771
|
-
return await
|
|
1084
|
+
return await g().get("router/optimal-route", { searchParams: e }).json();
|
|
772
1085
|
}
|
|
773
1086
|
async getAllSupportedBridges() {
|
|
774
|
-
return await
|
|
1087
|
+
return await g().get("router/supported-bridges/all").json();
|
|
775
1088
|
}
|
|
776
1089
|
async getSupportedBridges(e) {
|
|
777
|
-
return await
|
|
1090
|
+
return await g().get("router/supported-bridges/route", { searchParams: e }).json();
|
|
778
1091
|
}
|
|
779
|
-
async getSupportedRoutes(e,
|
|
780
|
-
return await
|
|
1092
|
+
async getSupportedRoutes(e, t) {
|
|
1093
|
+
return await g().get("router/supported-bridges/bridge/" + e, { searchParams: t }).json();
|
|
781
1094
|
}
|
|
782
1095
|
}
|
|
783
|
-
class
|
|
1096
|
+
class Ge {
|
|
784
1097
|
async getSupported(e) {
|
|
785
|
-
return await
|
|
1098
|
+
return await g().get("chains", { searchParams: e }).json();
|
|
1099
|
+
}
|
|
1100
|
+
async getBalance(e) {
|
|
1101
|
+
return await g().get(`chains/balances/${e.address}`, { searchParams: e }).json();
|
|
786
1102
|
}
|
|
787
1103
|
}
|
|
788
|
-
class
|
|
1104
|
+
class qe {
|
|
789
1105
|
async getClientInfo() {
|
|
790
|
-
return await
|
|
1106
|
+
return await g().get("client/auth/client-info").json();
|
|
791
1107
|
}
|
|
792
1108
|
async getClientInfoForSession() {
|
|
793
|
-
return await
|
|
1109
|
+
return await g().get("modal/sessions/client").json();
|
|
794
1110
|
}
|
|
795
1111
|
}
|
|
796
|
-
class
|
|
797
|
-
getSessionToken(e) {
|
|
798
|
-
const
|
|
1112
|
+
class Xe {
|
|
1113
|
+
async getSessionToken(e) {
|
|
1114
|
+
const t = typeof e.destinationChain == "string" ? e.destinationChain.replace("_MAINNET", "") : void 0, o = t ? c[t] : void 0, a = {
|
|
799
1115
|
recipient: e.recipient,
|
|
800
|
-
tokenOut:
|
|
801
|
-
|
|
802
|
-
|
|
1116
|
+
tokenOut: je(
|
|
1117
|
+
o,
|
|
1118
|
+
e.token
|
|
803
1119
|
),
|
|
804
|
-
destinationChain:
|
|
1120
|
+
destinationChain: o,
|
|
805
1121
|
amount: e.amount
|
|
806
1122
|
};
|
|
807
|
-
return
|
|
1123
|
+
return g().post("modal/sessions", { json: a }).json().then((r) => ({ ...r, amount: a.amount }));
|
|
808
1124
|
}
|
|
809
1125
|
}
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
1126
|
+
const Ze = {
|
|
1127
|
+
ACROSS: "ACROSS",
|
|
1128
|
+
CCTP: "CCTP",
|
|
1129
|
+
GATEWAY: "GATEWAY",
|
|
1130
|
+
RHINOFI: "RHINOFI"
|
|
1131
|
+
}, es = {
|
|
1132
|
+
router: new Ye(),
|
|
1133
|
+
quotes: new Ve(),
|
|
1134
|
+
intents: new We(),
|
|
1135
|
+
chains: new Ge(),
|
|
1136
|
+
client: new qe(),
|
|
1137
|
+
auth: new Xe()
|
|
817
1138
|
};
|
|
818
1139
|
export {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
1140
|
+
n as AmountSymbols,
|
|
1141
|
+
Ze as Bridges,
|
|
1142
|
+
u as Chainrails,
|
|
1143
|
+
c as Chains,
|
|
1144
|
+
Je as Tokens,
|
|
1145
|
+
es as crapi,
|
|
1146
|
+
Z as environment
|
|
825
1147
|
};
|