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