@chainrails/sdk 0.3.3 → 0.3.4
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 +65 -58
- package/dist/chainrails-sdk.es.mjs +65 -58
- package/dist/chainrails-sdk.umd.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/src/Quotes/types.d.ts +7 -1
- package/dist/src/Quotes/types.d.ts.map +1 -1
- package/dist/src/history/index.d.ts +6 -0
- package/dist/src/history/index.d.ts.map +1 -0
- package/dist/src/history/types.d.ts +22 -0
- package/dist/src/history/types.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ const c = {
|
|
|
18
18
|
POLYGON: "POLYGON_MAINNET",
|
|
19
19
|
STARKNET: "STARKNET_MAINNET",
|
|
20
20
|
STARKNET_TESTNET: "STARKNET_TESTNET"
|
|
21
|
-
},
|
|
21
|
+
}, ts = {
|
|
22
22
|
ARBITRUM: "ARBITRUM",
|
|
23
23
|
ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
|
|
24
24
|
AVALANCHE: "AVALANCHE",
|
|
@@ -44,10 +44,10 @@ function w(s, { strict: e = !0 } = {}) {
|
|
|
44
44
|
function x(s) {
|
|
45
45
|
return w(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const L = "2.43.4";
|
|
48
48
|
let I = {
|
|
49
49
|
getDocsUrl: ({ docsBaseUrl: s, docsPath: e = "", docsSlug: n }) => e ? `${s ?? "https://viem.sh"}${e}${n ? `#${n}` : ""}` : void 0,
|
|
50
|
-
version: `viem@${
|
|
50
|
+
version: `viem@${L}`
|
|
51
51
|
};
|
|
52
52
|
class E extends Error {
|
|
53
53
|
constructor(e, n = {}) {
|
|
@@ -90,7 +90,7 @@ class E extends Error {
|
|
|
90
90
|
configurable: !0,
|
|
91
91
|
writable: !0,
|
|
92
92
|
value: "BaseError"
|
|
93
|
-
}), this.details = a, this.docsPath = o, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = e, this.version =
|
|
93
|
+
}), this.details = a, this.docsPath = o, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = e, this.version = L;
|
|
94
94
|
}
|
|
95
95
|
walk(e) {
|
|
96
96
|
return j(this, e);
|
|
@@ -145,7 +145,7 @@ class ce extends E {
|
|
|
145
145
|
super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function N(s, { size: e }) {
|
|
149
149
|
if (x(s) > e)
|
|
150
150
|
throw new ce({
|
|
151
151
|
givenSize: x(s),
|
|
@@ -172,11 +172,11 @@ function de(s, e = {}) {
|
|
|
172
172
|
}
|
|
173
173
|
const le = /* @__PURE__ */ new TextEncoder();
|
|
174
174
|
function ue(s, e = {}) {
|
|
175
|
-
return typeof s == "number" || typeof s == "bigint" ?
|
|
175
|
+
return typeof s == "number" || typeof s == "bigint" ? he(s, e) : typeof s == "boolean" ? ge(s, e) : w(s) ? W(s, e) : V(s, e);
|
|
176
176
|
}
|
|
177
177
|
function ge(s, e = {}) {
|
|
178
178
|
const n = new Uint8Array(1);
|
|
179
|
-
return n[0] = Number(s), typeof e.size == "number" ? (
|
|
179
|
+
return n[0] = Number(s), typeof e.size == "number" ? (N(n, { size: e.size }), U(n, { size: e.size })) : n;
|
|
180
180
|
}
|
|
181
181
|
const T = {
|
|
182
182
|
zero: 48,
|
|
@@ -196,7 +196,7 @@ function M(s) {
|
|
|
196
196
|
}
|
|
197
197
|
function W(s, e = {}) {
|
|
198
198
|
let n = s;
|
|
199
|
-
e.size && (
|
|
199
|
+
e.size && (N(n, { size: e.size }), n = U(n, { dir: "right", size: e.size }));
|
|
200
200
|
let a = n.slice(2);
|
|
201
201
|
a.length % 2 && (a = `0${a}`);
|
|
202
202
|
const o = a.length / 2, r = new Uint8Array(o);
|
|
@@ -208,23 +208,23 @@ function W(s, e = {}) {
|
|
|
208
208
|
}
|
|
209
209
|
return r;
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function he(s, e) {
|
|
212
212
|
const n = de(s, e);
|
|
213
213
|
return W(n);
|
|
214
214
|
}
|
|
215
215
|
function V(s, e = {}) {
|
|
216
216
|
const n = le.encode(s);
|
|
217
|
-
return typeof e.size == "number" ? (
|
|
217
|
+
return typeof e.size == "number" ? (N(n, { size: e.size }), U(n, { dir: "right", size: e.size })) : n;
|
|
218
218
|
}
|
|
219
219
|
const A = /* @__PURE__ */ BigInt(2 ** 32 - 1), O = /* @__PURE__ */ BigInt(32);
|
|
220
|
-
function
|
|
220
|
+
function fe(s, e = !1) {
|
|
221
221
|
return e ? { h: Number(s & A), l: Number(s >> O & A) } : { h: Number(s >> O & A) | 0, l: Number(s & A) | 0 };
|
|
222
222
|
}
|
|
223
223
|
function me(s, e = !1) {
|
|
224
224
|
const n = s.length;
|
|
225
225
|
let a = new Uint32Array(n), o = new Uint32Array(n);
|
|
226
226
|
for (let r = 0; r < n; r++) {
|
|
227
|
-
const { h: i, l: d } =
|
|
227
|
+
const { h: i, l: d } = fe(s[r], e);
|
|
228
228
|
[a[r], o[r]] = [i, d];
|
|
229
229
|
}
|
|
230
230
|
return [a, o];
|
|
@@ -287,12 +287,12 @@ function Re(s) {
|
|
|
287
287
|
const e = (a) => s().update(G(a)).digest(), n = s();
|
|
288
288
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => s(), e;
|
|
289
289
|
}
|
|
290
|
-
const ve = BigInt(0), C = BigInt(1), we = BigInt(2),
|
|
290
|
+
const ve = BigInt(0), C = BigInt(1), we = BigInt(2), Ne = BigInt(7), Be = BigInt(256), xe = BigInt(113), q = [], X = [], Q = [];
|
|
291
291
|
for (let s = 0, e = C, n = 1, a = 0; s < 24; s++) {
|
|
292
292
|
[n, a] = [a, (2 * n + 3 * a) % 5], q.push(2 * (5 * a + n)), X.push((s + 1) * (s + 2) / 2 % 64);
|
|
293
293
|
let o = ve;
|
|
294
294
|
for (let r = 0; r < 7; r++)
|
|
295
|
-
e = (e << C ^ (e >>
|
|
295
|
+
e = (e << C ^ (e >> Ne) * xe) % Be, e & we && (o ^= C << (C << /* @__PURE__ */ BigInt(r)) - C);
|
|
296
296
|
Q.push(o);
|
|
297
297
|
}
|
|
298
298
|
const J = me(Q, !0), Me = J[0], Oe = J[1], P = (s, e, n) => n > 32 ? Se(s, e, n) : Te(s, e, n), z = (s, e, n) => n > 32 ? pe(s, e, n) : Ee(s, e, n);
|
|
@@ -321,7 +321,7 @@ function Fe(s, e = 24) {
|
|
|
321
321
|
}
|
|
322
322
|
Y(n);
|
|
323
323
|
}
|
|
324
|
-
class
|
|
324
|
+
class B extends ke {
|
|
325
325
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
326
326
|
constructor(e, n, a, o = !1, r = 24) {
|
|
327
327
|
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = n, this.outputLen = a, this.enableXOF = o, this.rounds = r, F(a), !(0 < e && e < 200))
|
|
@@ -383,10 +383,10 @@ class N extends ke {
|
|
|
383
383
|
}
|
|
384
384
|
_cloneInto(e) {
|
|
385
385
|
const { blockLen: n, suffix: a, outputLen: o, rounds: r, enableXOF: i } = this;
|
|
386
|
-
return e || (e = new
|
|
386
|
+
return e || (e = new B(n, 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;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
const He = (s, e, n) => Re(() => new
|
|
389
|
+
const He = (s, e, n) => Re(() => new B(e, s, n)), $e = He(1, 136, 256 / 8);
|
|
390
390
|
function Pe(s, e) {
|
|
391
391
|
return $e(w(s, { strict: !1 }) ? ue(s) : s);
|
|
392
392
|
}
|
|
@@ -433,16 +433,16 @@ function ee(s, e) {
|
|
|
433
433
|
return y.set(`${s}.${e}`, r), r;
|
|
434
434
|
}
|
|
435
435
|
function g(s, e) {
|
|
436
|
-
if (!
|
|
436
|
+
if (!Le(s, { strict: !1 }))
|
|
437
437
|
throw new ze({ address: s });
|
|
438
438
|
return ee(s, e);
|
|
439
439
|
}
|
|
440
|
-
const
|
|
441
|
-
function
|
|
440
|
+
const _e = /^0x[a-fA-F0-9]{40}$/, k = /* @__PURE__ */ new Z(8192);
|
|
441
|
+
function Le(s, e) {
|
|
442
442
|
const { strict: n = !0 } = e ?? {}, a = `${s}.${n}`;
|
|
443
443
|
if (k.has(a))
|
|
444
444
|
return k.get(a);
|
|
445
|
-
const o =
|
|
445
|
+
const o = _e.test(s) ? s.toLowerCase() === s ? !0 : n ? ee(s) === s : !0 : !1;
|
|
446
446
|
return k.set(a, o), o;
|
|
447
447
|
}
|
|
448
448
|
const t = {
|
|
@@ -458,7 +458,7 @@ const t = {
|
|
|
458
458
|
LORDS: "LORDS"
|
|
459
459
|
};
|
|
460
460
|
t.USDC;
|
|
461
|
-
const
|
|
461
|
+
const f = {
|
|
462
462
|
[c.ARBITRUM]: {
|
|
463
463
|
[t.DAI]: {
|
|
464
464
|
address: g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
|
|
@@ -933,19 +933,19 @@ const h = {
|
|
|
933
933
|
nativeToken: !1
|
|
934
934
|
}
|
|
935
935
|
}
|
|
936
|
-
},
|
|
937
|
-
ARBITRUM:
|
|
938
|
-
ARBITRUM_TESTNET:
|
|
939
|
-
AVALANCHE:
|
|
940
|
-
AVALANCHE_TESTNET:
|
|
941
|
-
BASE:
|
|
942
|
-
BASE_TESTNET:
|
|
943
|
-
BSC:
|
|
944
|
-
ETHEREUM:
|
|
945
|
-
ETHEREUM_TESTNET:
|
|
946
|
-
STARKNET:
|
|
936
|
+
}, as = {
|
|
937
|
+
ARBITRUM: f[c.ARBITRUM],
|
|
938
|
+
ARBITRUM_TESTNET: f[c.ARBITRUM_TESTNET],
|
|
939
|
+
AVALANCHE: f[c.AVALANCHE],
|
|
940
|
+
AVALANCHE_TESTNET: f[c.AVALANCHE_TESTNET],
|
|
941
|
+
BASE: f[c.BASE],
|
|
942
|
+
BASE_TESTNET: f[c.BASE_TESTNET],
|
|
943
|
+
BSC: f[c.BSC],
|
|
944
|
+
ETHEREUM: f[c.ETHEREUM],
|
|
945
|
+
ETHEREUM_TESTNET: f[c.ETHEREUM_TESTNET],
|
|
946
|
+
STARKNET: f[c.STARKNET]
|
|
947
947
|
}, je = new Set(Object.values(c));
|
|
948
|
-
function
|
|
948
|
+
function h(s) {
|
|
949
949
|
if (Ke(s))
|
|
950
950
|
return s;
|
|
951
951
|
const e = c[s];
|
|
@@ -957,7 +957,7 @@ function Ke(s) {
|
|
|
957
957
|
return je.has(s);
|
|
958
958
|
}
|
|
959
959
|
function We(s, e) {
|
|
960
|
-
const n = e.toLowerCase().trim(), a =
|
|
960
|
+
const n = e.toLowerCase().trim(), a = f[s];
|
|
961
961
|
if (!a)
|
|
962
962
|
throw new Error(
|
|
963
963
|
`Chain not found: ${s}. The chain key must be a valid chain identifier.`
|
|
@@ -985,9 +985,9 @@ function R(s, e, n) {
|
|
|
985
985
|
return a;
|
|
986
986
|
}
|
|
987
987
|
function Ve(s, e) {
|
|
988
|
-
return
|
|
988
|
+
return f[s]?.[e];
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function _(s, e) {
|
|
991
991
|
return Ve(s, e)?.address;
|
|
992
992
|
}
|
|
993
993
|
var se = /* @__PURE__ */ ((s) => (s.PRODUCTION = "production", s.STAGING = "staging", s))(se || {});
|
|
@@ -1085,7 +1085,7 @@ class Ge {
|
|
|
1085
1085
|
return await u().get("intents", { searchParams: e }).json();
|
|
1086
1086
|
}
|
|
1087
1087
|
async create(e) {
|
|
1088
|
-
const n =
|
|
1088
|
+
const n = h(e.source_chain), a = h(e.destination_chain);
|
|
1089
1089
|
return await u().post("intents", {
|
|
1090
1090
|
json: {
|
|
1091
1091
|
...e,
|
|
@@ -1095,7 +1095,7 @@ class Ge {
|
|
|
1095
1095
|
}).json();
|
|
1096
1096
|
}
|
|
1097
1097
|
async createForSession(e) {
|
|
1098
|
-
const n =
|
|
1098
|
+
const n = h(e.sourceChain);
|
|
1099
1099
|
return await u().post("modal/sessions/intents", {
|
|
1100
1100
|
json: { ...e, sourceChain: n }
|
|
1101
1101
|
}).json();
|
|
@@ -1112,9 +1112,9 @@ class Ge {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
class qe {
|
|
1114
1114
|
async getFromSpecificBridge(e) {
|
|
1115
|
-
const n =
|
|
1115
|
+
const n = h(e.sourceChain);
|
|
1116
1116
|
R(n, e.tokenIn, e.amountSymbol);
|
|
1117
|
-
const a =
|
|
1117
|
+
const a = h(e.destinationChain);
|
|
1118
1118
|
return await u().get("quotes/single", {
|
|
1119
1119
|
searchParams: {
|
|
1120
1120
|
...e,
|
|
@@ -1124,9 +1124,9 @@ class qe {
|
|
|
1124
1124
|
}).json();
|
|
1125
1125
|
}
|
|
1126
1126
|
async getFromAllBridges(e) {
|
|
1127
|
-
const n =
|
|
1127
|
+
const n = h(e.sourceChain);
|
|
1128
1128
|
R(n, e.tokenIn, e.amountSymbol);
|
|
1129
|
-
const a =
|
|
1129
|
+
const a = h(e.destinationChain);
|
|
1130
1130
|
return await u().get("quotes/multiple", {
|
|
1131
1131
|
searchParams: {
|
|
1132
1132
|
...e,
|
|
@@ -1136,9 +1136,9 @@ class qe {
|
|
|
1136
1136
|
}).json();
|
|
1137
1137
|
}
|
|
1138
1138
|
async getBestAcrossBridges(e) {
|
|
1139
|
-
const n =
|
|
1139
|
+
const n = h(e.sourceChain);
|
|
1140
1140
|
R(n, e.tokenIn, e.amountSymbol);
|
|
1141
|
-
const a =
|
|
1141
|
+
const a = h(e.destinationChain);
|
|
1142
1142
|
return await u().get("quotes/best", { searchParams: {
|
|
1143
1143
|
...e,
|
|
1144
1144
|
sourceChain: n,
|
|
@@ -1146,7 +1146,7 @@ class qe {
|
|
|
1146
1146
|
} }).json();
|
|
1147
1147
|
}
|
|
1148
1148
|
async getAll(e) {
|
|
1149
|
-
const n =
|
|
1149
|
+
const n = h(e.destinationChain);
|
|
1150
1150
|
return await u().get("quotes/multi-source", { searchParams: {
|
|
1151
1151
|
...e,
|
|
1152
1152
|
destinationChain: n
|
|
@@ -1158,7 +1158,7 @@ class qe {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
class Xe {
|
|
1160
1160
|
async getOptimalRoutes(e) {
|
|
1161
|
-
const n =
|
|
1161
|
+
const n = h(e.sourceChain), a = h(e.destinationChain);
|
|
1162
1162
|
return await u().get("router/optimal-route", {
|
|
1163
1163
|
searchParams: {
|
|
1164
1164
|
...e,
|
|
@@ -1171,7 +1171,7 @@ class Xe {
|
|
|
1171
1171
|
return await u().get("router/supported-bridges/all").json();
|
|
1172
1172
|
}
|
|
1173
1173
|
async getSupportedBridges(e) {
|
|
1174
|
-
const n =
|
|
1174
|
+
const n = h(e.sourceChain), a = h(e.destinationChain);
|
|
1175
1175
|
return await u().get("router/supported-bridges/route", { searchParams: {
|
|
1176
1176
|
...e,
|
|
1177
1177
|
sourceChain: n,
|
|
@@ -1200,9 +1200,9 @@ class Je {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
class Ze {
|
|
1202
1202
|
async getSessionToken(e) {
|
|
1203
|
-
const n =
|
|
1204
|
-
let a =
|
|
1205
|
-
a || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), a =
|
|
1203
|
+
const n = h(e.destinationChain);
|
|
1204
|
+
let a = _(n, e.token);
|
|
1205
|
+
a || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), a = _(n, "USDC"));
|
|
1206
1206
|
const o = {
|
|
1207
1207
|
recipient: e.recipient,
|
|
1208
1208
|
tokenOut: a,
|
|
@@ -1212,25 +1212,32 @@ class Ze {
|
|
|
1212
1212
|
return u().post("modal/sessions", { json: o }).json().then((r) => ({ ...r, amount: o.amount }));
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
const
|
|
1215
|
+
const es = "modal/sessions/history";
|
|
1216
|
+
class ss {
|
|
1217
|
+
async getHistoryForSession(e) {
|
|
1218
|
+
return u().post(es, { json: e }).json();
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
const os = {
|
|
1216
1222
|
ACROSS: "ACROSS",
|
|
1217
1223
|
CCTP: "CCTP",
|
|
1218
1224
|
GATEWAY: "GATEWAY",
|
|
1219
1225
|
RHINOFI: "RHINOFI"
|
|
1220
|
-
},
|
|
1226
|
+
}, is = {
|
|
1221
1227
|
router: new Xe(),
|
|
1222
1228
|
quotes: new qe(),
|
|
1223
1229
|
intents: new Ge(),
|
|
1224
1230
|
chains: new Qe(),
|
|
1225
1231
|
client: new Je(),
|
|
1226
|
-
auth: new Ze()
|
|
1232
|
+
auth: new Ze(),
|
|
1233
|
+
history: new ss()
|
|
1227
1234
|
};
|
|
1228
1235
|
export {
|
|
1229
1236
|
t as AmountSymbols,
|
|
1230
|
-
|
|
1237
|
+
os as Bridges,
|
|
1231
1238
|
l as Chainrails,
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1239
|
+
ts as Chains,
|
|
1240
|
+
as as Tokens,
|
|
1241
|
+
is as crapi,
|
|
1235
1242
|
se as environment
|
|
1236
1243
|
};
|
|
@@ -18,7 +18,7 @@ const c = {
|
|
|
18
18
|
POLYGON: "POLYGON_MAINNET",
|
|
19
19
|
STARKNET: "STARKNET_MAINNET",
|
|
20
20
|
STARKNET_TESTNET: "STARKNET_TESTNET"
|
|
21
|
-
},
|
|
21
|
+
}, ts = {
|
|
22
22
|
ARBITRUM: "ARBITRUM",
|
|
23
23
|
ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
|
|
24
24
|
AVALANCHE: "AVALANCHE",
|
|
@@ -44,10 +44,10 @@ function w(s, { strict: e = !0 } = {}) {
|
|
|
44
44
|
function x(s) {
|
|
45
45
|
return w(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const L = "2.43.4";
|
|
48
48
|
let I = {
|
|
49
49
|
getDocsUrl: ({ docsBaseUrl: s, docsPath: e = "", docsSlug: n }) => e ? `${s ?? "https://viem.sh"}${e}${n ? `#${n}` : ""}` : void 0,
|
|
50
|
-
version: `viem@${
|
|
50
|
+
version: `viem@${L}`
|
|
51
51
|
};
|
|
52
52
|
class E extends Error {
|
|
53
53
|
constructor(e, n = {}) {
|
|
@@ -90,7 +90,7 @@ class E extends Error {
|
|
|
90
90
|
configurable: !0,
|
|
91
91
|
writable: !0,
|
|
92
92
|
value: "BaseError"
|
|
93
|
-
}), this.details = a, this.docsPath = o, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = e, this.version =
|
|
93
|
+
}), this.details = a, this.docsPath = o, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = e, this.version = L;
|
|
94
94
|
}
|
|
95
95
|
walk(e) {
|
|
96
96
|
return j(this, e);
|
|
@@ -145,7 +145,7 @@ class ce extends E {
|
|
|
145
145
|
super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function N(s, { size: e }) {
|
|
149
149
|
if (x(s) > e)
|
|
150
150
|
throw new ce({
|
|
151
151
|
givenSize: x(s),
|
|
@@ -172,11 +172,11 @@ function de(s, e = {}) {
|
|
|
172
172
|
}
|
|
173
173
|
const le = /* @__PURE__ */ new TextEncoder();
|
|
174
174
|
function ue(s, e = {}) {
|
|
175
|
-
return typeof s == "number" || typeof s == "bigint" ?
|
|
175
|
+
return typeof s == "number" || typeof s == "bigint" ? he(s, e) : typeof s == "boolean" ? ge(s, e) : w(s) ? W(s, e) : V(s, e);
|
|
176
176
|
}
|
|
177
177
|
function ge(s, e = {}) {
|
|
178
178
|
const n = new Uint8Array(1);
|
|
179
|
-
return n[0] = Number(s), typeof e.size == "number" ? (
|
|
179
|
+
return n[0] = Number(s), typeof e.size == "number" ? (N(n, { size: e.size }), U(n, { size: e.size })) : n;
|
|
180
180
|
}
|
|
181
181
|
const T = {
|
|
182
182
|
zero: 48,
|
|
@@ -196,7 +196,7 @@ function M(s) {
|
|
|
196
196
|
}
|
|
197
197
|
function W(s, e = {}) {
|
|
198
198
|
let n = s;
|
|
199
|
-
e.size && (
|
|
199
|
+
e.size && (N(n, { size: e.size }), n = U(n, { dir: "right", size: e.size }));
|
|
200
200
|
let a = n.slice(2);
|
|
201
201
|
a.length % 2 && (a = `0${a}`);
|
|
202
202
|
const o = a.length / 2, r = new Uint8Array(o);
|
|
@@ -208,23 +208,23 @@ function W(s, e = {}) {
|
|
|
208
208
|
}
|
|
209
209
|
return r;
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function he(s, e) {
|
|
212
212
|
const n = de(s, e);
|
|
213
213
|
return W(n);
|
|
214
214
|
}
|
|
215
215
|
function V(s, e = {}) {
|
|
216
216
|
const n = le.encode(s);
|
|
217
|
-
return typeof e.size == "number" ? (
|
|
217
|
+
return typeof e.size == "number" ? (N(n, { size: e.size }), U(n, { dir: "right", size: e.size })) : n;
|
|
218
218
|
}
|
|
219
219
|
const A = /* @__PURE__ */ BigInt(2 ** 32 - 1), O = /* @__PURE__ */ BigInt(32);
|
|
220
|
-
function
|
|
220
|
+
function fe(s, e = !1) {
|
|
221
221
|
return e ? { h: Number(s & A), l: Number(s >> O & A) } : { h: Number(s >> O & A) | 0, l: Number(s & A) | 0 };
|
|
222
222
|
}
|
|
223
223
|
function me(s, e = !1) {
|
|
224
224
|
const n = s.length;
|
|
225
225
|
let a = new Uint32Array(n), o = new Uint32Array(n);
|
|
226
226
|
for (let r = 0; r < n; r++) {
|
|
227
|
-
const { h: i, l: d } =
|
|
227
|
+
const { h: i, l: d } = fe(s[r], e);
|
|
228
228
|
[a[r], o[r]] = [i, d];
|
|
229
229
|
}
|
|
230
230
|
return [a, o];
|
|
@@ -287,12 +287,12 @@ function Re(s) {
|
|
|
287
287
|
const e = (a) => s().update(G(a)).digest(), n = s();
|
|
288
288
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => s(), e;
|
|
289
289
|
}
|
|
290
|
-
const ve = BigInt(0), C = BigInt(1), we = BigInt(2),
|
|
290
|
+
const ve = BigInt(0), C = BigInt(1), we = BigInt(2), Ne = BigInt(7), Be = BigInt(256), xe = BigInt(113), q = [], X = [], Q = [];
|
|
291
291
|
for (let s = 0, e = C, n = 1, a = 0; s < 24; s++) {
|
|
292
292
|
[n, a] = [a, (2 * n + 3 * a) % 5], q.push(2 * (5 * a + n)), X.push((s + 1) * (s + 2) / 2 % 64);
|
|
293
293
|
let o = ve;
|
|
294
294
|
for (let r = 0; r < 7; r++)
|
|
295
|
-
e = (e << C ^ (e >>
|
|
295
|
+
e = (e << C ^ (e >> Ne) * xe) % Be, e & we && (o ^= C << (C << /* @__PURE__ */ BigInt(r)) - C);
|
|
296
296
|
Q.push(o);
|
|
297
297
|
}
|
|
298
298
|
const J = me(Q, !0), Me = J[0], Oe = J[1], P = (s, e, n) => n > 32 ? Se(s, e, n) : Te(s, e, n), z = (s, e, n) => n > 32 ? pe(s, e, n) : Ee(s, e, n);
|
|
@@ -321,7 +321,7 @@ function Fe(s, e = 24) {
|
|
|
321
321
|
}
|
|
322
322
|
Y(n);
|
|
323
323
|
}
|
|
324
|
-
class
|
|
324
|
+
class B extends ke {
|
|
325
325
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
326
326
|
constructor(e, n, a, o = !1, r = 24) {
|
|
327
327
|
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = n, this.outputLen = a, this.enableXOF = o, this.rounds = r, F(a), !(0 < e && e < 200))
|
|
@@ -383,10 +383,10 @@ class N extends ke {
|
|
|
383
383
|
}
|
|
384
384
|
_cloneInto(e) {
|
|
385
385
|
const { blockLen: n, suffix: a, outputLen: o, rounds: r, enableXOF: i } = this;
|
|
386
|
-
return e || (e = new
|
|
386
|
+
return e || (e = new B(n, 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;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
const He = (s, e, n) => Re(() => new
|
|
389
|
+
const He = (s, e, n) => Re(() => new B(e, s, n)), $e = He(1, 136, 256 / 8);
|
|
390
390
|
function Pe(s, e) {
|
|
391
391
|
return $e(w(s, { strict: !1 }) ? ue(s) : s);
|
|
392
392
|
}
|
|
@@ -433,16 +433,16 @@ function ee(s, e) {
|
|
|
433
433
|
return y.set(`${s}.${e}`, r), r;
|
|
434
434
|
}
|
|
435
435
|
function g(s, e) {
|
|
436
|
-
if (!
|
|
436
|
+
if (!Le(s, { strict: !1 }))
|
|
437
437
|
throw new ze({ address: s });
|
|
438
438
|
return ee(s, e);
|
|
439
439
|
}
|
|
440
|
-
const
|
|
441
|
-
function
|
|
440
|
+
const _e = /^0x[a-fA-F0-9]{40}$/, k = /* @__PURE__ */ new Z(8192);
|
|
441
|
+
function Le(s, e) {
|
|
442
442
|
const { strict: n = !0 } = e ?? {}, a = `${s}.${n}`;
|
|
443
443
|
if (k.has(a))
|
|
444
444
|
return k.get(a);
|
|
445
|
-
const o =
|
|
445
|
+
const o = _e.test(s) ? s.toLowerCase() === s ? !0 : n ? ee(s) === s : !0 : !1;
|
|
446
446
|
return k.set(a, o), o;
|
|
447
447
|
}
|
|
448
448
|
const t = {
|
|
@@ -458,7 +458,7 @@ const t = {
|
|
|
458
458
|
LORDS: "LORDS"
|
|
459
459
|
};
|
|
460
460
|
t.USDC;
|
|
461
|
-
const
|
|
461
|
+
const f = {
|
|
462
462
|
[c.ARBITRUM]: {
|
|
463
463
|
[t.DAI]: {
|
|
464
464
|
address: g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
|
|
@@ -933,19 +933,19 @@ const h = {
|
|
|
933
933
|
nativeToken: !1
|
|
934
934
|
}
|
|
935
935
|
}
|
|
936
|
-
},
|
|
937
|
-
ARBITRUM:
|
|
938
|
-
ARBITRUM_TESTNET:
|
|
939
|
-
AVALANCHE:
|
|
940
|
-
AVALANCHE_TESTNET:
|
|
941
|
-
BASE:
|
|
942
|
-
BASE_TESTNET:
|
|
943
|
-
BSC:
|
|
944
|
-
ETHEREUM:
|
|
945
|
-
ETHEREUM_TESTNET:
|
|
946
|
-
STARKNET:
|
|
936
|
+
}, as = {
|
|
937
|
+
ARBITRUM: f[c.ARBITRUM],
|
|
938
|
+
ARBITRUM_TESTNET: f[c.ARBITRUM_TESTNET],
|
|
939
|
+
AVALANCHE: f[c.AVALANCHE],
|
|
940
|
+
AVALANCHE_TESTNET: f[c.AVALANCHE_TESTNET],
|
|
941
|
+
BASE: f[c.BASE],
|
|
942
|
+
BASE_TESTNET: f[c.BASE_TESTNET],
|
|
943
|
+
BSC: f[c.BSC],
|
|
944
|
+
ETHEREUM: f[c.ETHEREUM],
|
|
945
|
+
ETHEREUM_TESTNET: f[c.ETHEREUM_TESTNET],
|
|
946
|
+
STARKNET: f[c.STARKNET]
|
|
947
947
|
}, je = new Set(Object.values(c));
|
|
948
|
-
function
|
|
948
|
+
function h(s) {
|
|
949
949
|
if (Ke(s))
|
|
950
950
|
return s;
|
|
951
951
|
const e = c[s];
|
|
@@ -957,7 +957,7 @@ function Ke(s) {
|
|
|
957
957
|
return je.has(s);
|
|
958
958
|
}
|
|
959
959
|
function We(s, e) {
|
|
960
|
-
const n = e.toLowerCase().trim(), a =
|
|
960
|
+
const n = e.toLowerCase().trim(), a = f[s];
|
|
961
961
|
if (!a)
|
|
962
962
|
throw new Error(
|
|
963
963
|
`Chain not found: ${s}. The chain key must be a valid chain identifier.`
|
|
@@ -985,9 +985,9 @@ function R(s, e, n) {
|
|
|
985
985
|
return a;
|
|
986
986
|
}
|
|
987
987
|
function Ve(s, e) {
|
|
988
|
-
return
|
|
988
|
+
return f[s]?.[e];
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function _(s, e) {
|
|
991
991
|
return Ve(s, e)?.address;
|
|
992
992
|
}
|
|
993
993
|
var se = /* @__PURE__ */ ((s) => (s.PRODUCTION = "production", s.STAGING = "staging", s))(se || {});
|
|
@@ -1085,7 +1085,7 @@ class Ge {
|
|
|
1085
1085
|
return await u().get("intents", { searchParams: e }).json();
|
|
1086
1086
|
}
|
|
1087
1087
|
async create(e) {
|
|
1088
|
-
const n =
|
|
1088
|
+
const n = h(e.source_chain), a = h(e.destination_chain);
|
|
1089
1089
|
return await u().post("intents", {
|
|
1090
1090
|
json: {
|
|
1091
1091
|
...e,
|
|
@@ -1095,7 +1095,7 @@ class Ge {
|
|
|
1095
1095
|
}).json();
|
|
1096
1096
|
}
|
|
1097
1097
|
async createForSession(e) {
|
|
1098
|
-
const n =
|
|
1098
|
+
const n = h(e.sourceChain);
|
|
1099
1099
|
return await u().post("modal/sessions/intents", {
|
|
1100
1100
|
json: { ...e, sourceChain: n }
|
|
1101
1101
|
}).json();
|
|
@@ -1112,9 +1112,9 @@ class Ge {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
class qe {
|
|
1114
1114
|
async getFromSpecificBridge(e) {
|
|
1115
|
-
const n =
|
|
1115
|
+
const n = h(e.sourceChain);
|
|
1116
1116
|
R(n, e.tokenIn, e.amountSymbol);
|
|
1117
|
-
const a =
|
|
1117
|
+
const a = h(e.destinationChain);
|
|
1118
1118
|
return await u().get("quotes/single", {
|
|
1119
1119
|
searchParams: {
|
|
1120
1120
|
...e,
|
|
@@ -1124,9 +1124,9 @@ class qe {
|
|
|
1124
1124
|
}).json();
|
|
1125
1125
|
}
|
|
1126
1126
|
async getFromAllBridges(e) {
|
|
1127
|
-
const n =
|
|
1127
|
+
const n = h(e.sourceChain);
|
|
1128
1128
|
R(n, e.tokenIn, e.amountSymbol);
|
|
1129
|
-
const a =
|
|
1129
|
+
const a = h(e.destinationChain);
|
|
1130
1130
|
return await u().get("quotes/multiple", {
|
|
1131
1131
|
searchParams: {
|
|
1132
1132
|
...e,
|
|
@@ -1136,9 +1136,9 @@ class qe {
|
|
|
1136
1136
|
}).json();
|
|
1137
1137
|
}
|
|
1138
1138
|
async getBestAcrossBridges(e) {
|
|
1139
|
-
const n =
|
|
1139
|
+
const n = h(e.sourceChain);
|
|
1140
1140
|
R(n, e.tokenIn, e.amountSymbol);
|
|
1141
|
-
const a =
|
|
1141
|
+
const a = h(e.destinationChain);
|
|
1142
1142
|
return await u().get("quotes/best", { searchParams: {
|
|
1143
1143
|
...e,
|
|
1144
1144
|
sourceChain: n,
|
|
@@ -1146,7 +1146,7 @@ class qe {
|
|
|
1146
1146
|
} }).json();
|
|
1147
1147
|
}
|
|
1148
1148
|
async getAll(e) {
|
|
1149
|
-
const n =
|
|
1149
|
+
const n = h(e.destinationChain);
|
|
1150
1150
|
return await u().get("quotes/multi-source", { searchParams: {
|
|
1151
1151
|
...e,
|
|
1152
1152
|
destinationChain: n
|
|
@@ -1158,7 +1158,7 @@ class qe {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
class Xe {
|
|
1160
1160
|
async getOptimalRoutes(e) {
|
|
1161
|
-
const n =
|
|
1161
|
+
const n = h(e.sourceChain), a = h(e.destinationChain);
|
|
1162
1162
|
return await u().get("router/optimal-route", {
|
|
1163
1163
|
searchParams: {
|
|
1164
1164
|
...e,
|
|
@@ -1171,7 +1171,7 @@ class Xe {
|
|
|
1171
1171
|
return await u().get("router/supported-bridges/all").json();
|
|
1172
1172
|
}
|
|
1173
1173
|
async getSupportedBridges(e) {
|
|
1174
|
-
const n =
|
|
1174
|
+
const n = h(e.sourceChain), a = h(e.destinationChain);
|
|
1175
1175
|
return await u().get("router/supported-bridges/route", { searchParams: {
|
|
1176
1176
|
...e,
|
|
1177
1177
|
sourceChain: n,
|
|
@@ -1200,9 +1200,9 @@ class Je {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
class Ze {
|
|
1202
1202
|
async getSessionToken(e) {
|
|
1203
|
-
const n =
|
|
1204
|
-
let a =
|
|
1205
|
-
a || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), a =
|
|
1203
|
+
const n = h(e.destinationChain);
|
|
1204
|
+
let a = _(n, e.token);
|
|
1205
|
+
a || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), a = _(n, "USDC"));
|
|
1206
1206
|
const o = {
|
|
1207
1207
|
recipient: e.recipient,
|
|
1208
1208
|
tokenOut: a,
|
|
@@ -1212,25 +1212,32 @@ class Ze {
|
|
|
1212
1212
|
return u().post("modal/sessions", { json: o }).json().then((r) => ({ ...r, amount: o.amount }));
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
const
|
|
1215
|
+
const es = "modal/sessions/history";
|
|
1216
|
+
class ss {
|
|
1217
|
+
async getHistoryForSession(e) {
|
|
1218
|
+
return u().post(es, { json: e }).json();
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
const os = {
|
|
1216
1222
|
ACROSS: "ACROSS",
|
|
1217
1223
|
CCTP: "CCTP",
|
|
1218
1224
|
GATEWAY: "GATEWAY",
|
|
1219
1225
|
RHINOFI: "RHINOFI"
|
|
1220
|
-
},
|
|
1226
|
+
}, is = {
|
|
1221
1227
|
router: new Xe(),
|
|
1222
1228
|
quotes: new qe(),
|
|
1223
1229
|
intents: new Ge(),
|
|
1224
1230
|
chains: new Qe(),
|
|
1225
1231
|
client: new Je(),
|
|
1226
|
-
auth: new Ze()
|
|
1232
|
+
auth: new Ze(),
|
|
1233
|
+
history: new ss()
|
|
1227
1234
|
};
|
|
1228
1235
|
export {
|
|
1229
1236
|
t as AmountSymbols,
|
|
1230
|
-
|
|
1237
|
+
os as Bridges,
|
|
1231
1238
|
l as Chainrails,
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1239
|
+
ts as Chains,
|
|
1240
|
+
as as Tokens,
|
|
1241
|
+
is as crapi,
|
|
1235
1242
|
se as environment
|
|
1236
1243
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(h,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("ky")):typeof define=="function"&&define.amd?define(["exports","ky"],b):(h=typeof globalThis<"u"?globalThis:h||self,b(h.Chainrails={},h.Ky))})(this,(function(h,b){"use strict";const c={ARBITRUM:"ARBITRUM_MAINNET",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE_MAINNET",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE_MAINNET",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC_MAINNET",ETHEREUM:"ETHEREUM_MAINNET",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM_MAINNET",LISK:"LISK_MAINNET",MONAD:"MONAD_MAINNET",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM_MAINNET",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON_MAINNET",STARKNET:"STARKNET_MAINNET",STARKNET_TESTNET:"STARKNET_TESTNET"},ae={ARBITRUM:"ARBITRUM",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC",ETHEREUM:"ETHEREUM",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM",LISK:"LISK",MONAD:"MONAD",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON",STARKNET:"STARKNET",STARKNET_TESTNET:"STARKNET_TESTNET"};function k(s,{strict:e=!0}={}){return!s||typeof s!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(s):s.startsWith("0x")}function F(s){return k(s,{strict:!1})?Math.ceil((s.length-2)/2):s.length}const H="2.43.4";let
|
|
2
|
-
`);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=a,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=e,this.version=H}walk(e){return $(this,e)}}function $(s,e){return e?.(s)?s:s&&typeof s=="object"&&"cause"in s&&s.cause!==void 0?$(s.cause,e):e?null:s}class P extends S{constructor({size:e,targetSize:n,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function D(s,{dir:e,size:n=32}={}){return typeof s=="string"?oe(s,{dir:e,size:n}):ie(s,{dir:e,size:n})}function oe(s,{dir:e,size:n=32}={}){if(n===null)return s;const a=s.replace("0x","");if(a.length>n*2)throw new P({size:Math.ceil(a.length/2),targetSize:n,type:"hex"});return`0x${a[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function ie(s,{dir:e,size:n=32}={}){if(n===null)return s;if(s.length>n)throw new P({size:s.length,targetSize:n,type:"bytes"});const a=new Uint8Array(n);for(let o=0;o<n;o++){const r=e==="right";a[r?o:n-o-1]=s[r?o:s.length-o-1]}return a}class re extends S{constructor({max:e,min:n,signed:a,size:o,value:r}){super(`Number "${r}" is not in safe ${o?`${o*8}-bit ${a?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class ce extends S{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function R(s,{size:e}){if(F(s)>e)throw new ce({givenSize:F(s),maxSize:e})}function de(s,e={}){const{signed:n,size:a}=e,o=BigInt(s);let r;a?n?r=(1n<<BigInt(a)*8n-1n)-1n:r=2n**(BigInt(a)*8n)-1n:typeof s=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof r=="bigint"&&n?-r-1n:0;if(r&&o>r||o<i){const T=typeof s=="bigint"?"n":"";throw new re({max:r?`${r}${T}`:void 0,min:`${i}${T}`,signed:n,size:a,value:`${s}${T}`})}const d=`0x${(n&&o<0?(1n<<BigInt(a*8))+BigInt(o):o).toString(16)}`;return a?D(d,{size:a}):d}const le=new TextEncoder;function ue(s,e={}){return typeof s=="number"||typeof s=="bigint"?fe(s,e):typeof s=="boolean"?ge(s,e):k(s)?L(s,e):_(s,e)}function ge(s,e={}){const n=new Uint8Array(1);return n[0]=Number(s),typeof e.size=="number"?(R(n,{size:e.size}),D(n,{size:e.size})):n}const E={zero:48,nine:57,A:65,F:70,a:97,f:102};function z(s){if(s>=E.zero&&s<=E.nine)return s-E.zero;if(s>=E.A&&s<=E.F)return s-(E.A-10);if(s>=E.a&&s<=E.f)return s-(E.a-10)}function L(s,e={}){let n=s;e.size&&(R(n,{size:e.size}),n=D(n,{dir:"right",size:e.size}));let a=n.slice(2);a.length%2&&(a=`0${a}`);const o=a.length/2,r=new Uint8Array(o);for(let i=0,d=0;i<o;i++){const T=z(a.charCodeAt(d++)),p=z(a.charCodeAt(d++));if(T===void 0||p===void 0)throw new S(`Invalid byte sequence ("${a[d-2]}${a[d-1]}" in "${a}").`);r[i]=T*16+p}return r}function fe(s,e){const n=de(s,e);return L(n)}function _(s,e={}){const n=le.encode(s);return typeof e.size=="number"?(R(n,{size:e.size}),D(n,{dir:"right",size:e.size})):n}const U=BigInt(2**32-1),j=BigInt(32);function he(s,e=!1){return e?{h:Number(s&U),l:Number(s>>j&U)}:{h:Number(s>>j&U)|0,l:Number(s&U)|0}}function me(s,e=!1){const n=s.length;let a=new Uint32Array(n),o=new Uint32Array(n);for(let r=0;r<n;r++){const{h:i,l:d}=he(s[r],e);[a[r],o[r]]=[i,d]}return[a,o]}const Te=(s,e,n)=>s<<n|e>>>32-n,Ee=(s,e,n)=>e<<n|s>>>32-n,Se=(s,e,n)=>e<<n-32|s>>>64-n,pe=(s,e,n)=>s<<n-32|e>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ce(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function K(s){if(!Number.isSafeInteger(s)||s<0)throw new Error("positive integer expected, got "+s)}function I(s,...e){if(!Ce(s))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(s.length))throw new Error("Uint8Array expected of length "+e+", got length="+s.length)}function W(s,e=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(e&&s.finished)throw new Error("Hash#digest() has already been called")}function be(s,e){I(s);const n=e.outputLen;if(s.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ae(s){return new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4))}function V(...s){for(let e=0;e<s.length;e++)s[e].fill(0)}const De=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ue(s){return s<<24&4278190080|s<<8&16711680|s>>>8&65280|s>>>24&255}function Ie(s){for(let e=0;e<s.length;e++)s[e]=Ue(s[e]);return s}const Y=De?s=>s:Ie;function ye(s){if(typeof s!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(s))}function q(s){return typeof s=="string"&&(s=ye(s)),I(s),s}class ke{}function ve(s){const e=a=>s().update(q(a)).digest(),n=s();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>s(),e}const Re=BigInt(0),A=BigInt(1),we=BigInt(2),Be=BigInt(7),Ne=BigInt(256),xe=BigInt(113),G=[],X=[],Q=[];for(let s=0,e=A,n=1,a=0;s<24;s++){[n,a]=[a,(2*n+3*a)%5],G.push(2*(5*a+n)),X.push((s+1)*(s+2)/2%64);let o=Re;for(let r=0;r<7;r++)e=(e<<A^(e>>Be)*xe)%Ne,e&we&&(o^=A<<(A<<BigInt(r))-A);Q.push(o)}const J=me(Q,!0),Me=J[0],Oe=J[1],Z=(s,e,n)=>n>32?Se(s,e,n):Te(s,e,n),ee=(s,e,n)=>n>32?pe(s,e,n):Ee(s,e,n);function Fe(s,e=24){const n=new Uint32Array(10);for(let a=24-e;a<24;a++){for(let i=0;i<10;i++)n[i]=s[i]^s[i+10]^s[i+20]^s[i+30]^s[i+40];for(let i=0;i<10;i+=2){const d=(i+8)%10,T=(i+2)%10,p=n[T],C=n[T+1],ts=Z(p,C,1)^n[d],as=ee(p,C,1)^n[d+1];for(let y=0;y<50;y+=10)s[i+y]^=ts,s[i+y+1]^=as}let o=s[2],r=s[3];for(let i=0;i<24;i++){const d=X[i],T=Z(o,r,d),p=ee(o,r,d),C=G[i];o=s[C],r=s[C+1],s[C]=T,s[C+1]=p}for(let i=0;i<50;i+=10){for(let d=0;d<10;d++)n[d]=s[i+d];for(let d=0;d<10;d++)s[i+d]^=~n[(d+2)%10]&n[(d+4)%10]}s[0]^=Me[a],s[1]^=Oe[a]}V(n)}class w extends ke{constructor(e,n,a,o=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=a,this.enableXOF=o,this.rounds=r,K(a),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Ae(this.state)}clone(){return this._cloneInto()}keccak(){Y(this.state32),Fe(this.state32,this.rounds),Y(this.state32),this.posOut=0,this.pos=0}update(e){W(this),e=q(e),I(e);const{blockLen:n,state:a}=this,o=e.length;for(let r=0;r<o;){const i=Math.min(n-this.pos,o-r);for(let d=0;d<i;d++)a[this.pos++]^=e[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:a,blockLen:o}=this;e[a]^=n,(n&128)!==0&&a===o-1&&this.keccak(),e[o-1]^=128,this.keccak()}writeInto(e){W(this,!1),I(e),this.finish();const n=this.state,{blockLen:a}=this;for(let o=0,r=e.length;o<r;){this.posOut>=a&&this.keccak();const i=Math.min(a-this.posOut,r-o);e.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return K(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(be(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,V(this.state)}_cloneInto(e){const{blockLen:n,suffix:a,outputLen:o,rounds:r,enableXOF:i}=this;return e||(e=new w(n,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}}const He=(s,e,n)=>ve(()=>new w(e,s,n)),$e=He(1,136,256/8);function Pe(s,e){return $e(k(s,{strict:!1})?ue(s):s)}class ze extends S{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class se extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const a=this.keys().next().value;a&&this.delete(a)}return this}}const B=new se(8192);function ne(s,e){if(B.has(`${s}.${e}`))return B.get(`${s}.${e}`);const n=s.substring(2).toLowerCase(),a=Pe(_(n)),o=n.split("");for(let i=0;i<40;i+=2)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());const r=`0x${o.join("")}`;return B.set(`${s}.${e}`,r),r}function g(s,e){if(!_e(s,{strict:!1}))throw new ze({address:s});return ne(s,e)}const Le=/^0x[a-fA-F0-9]{40}$/,N=new se(8192);function _e(s,e){const{strict:n=!0}=e??{},a=`${s}.${n}`;if(N.has(a))return N.get(a);const o=Le.test(s)?s.toLowerCase()===s?!0:n?ne(s)===s:!0:!1;return N.set(a,o),o}const t={USDC:"USDC",USDT:"USDT",DAI:"DAI",BUSD:"BUSD",EURC:"EURC",ETH:"ETH",WETH:"WETH",STRK:"STRK",BNB:"BNB",LORDS:"LORDS"};t.USDC;const m={[c.ARBITRUM]:{[t.DAI]:{address:g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.USDC]:{address:g("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:g("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:g("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.ARBITRUM_TESTNET]:{[t.USDC]:{address:g("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.AVALANCHE]:{[t.DAI]:{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.USDC]:{address:g("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.AVALANCHE_TESTNET]:{[t.USDC]:{address:g("0x5425890298aed601595a70AB815c96711a31Bc65"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.BASE]:{[t.DAI]:{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.EURC]:{address:"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",symbol:t.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[t.USDC]:{address:g("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.WETH]:{address:g("0x4200000000000000000000000000000000000006"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.BASE_TESTNET]:{[t.USDC]:{address:g("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.BSC]:{[t.BNB]:{address:"0x0000000000000000000000000000000000000000",symbol:t.BNB,name:"BNB",decimals:18,logoURI:"/images/chains/bsc.webp",nativeToken:!0},[t.BUSD]:{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:t.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[t.DAI]:{address:"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[t.USDC]:{address:g("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:t.USDC,decimals:18,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x55d398326f99059fF775485246999027B3197955",symbol:t.USDT,name:"Tether USD",decimals:18,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[c.ETHEREUM]:{[t.BUSD]:{address:"0x4Fabb145d64652a948d72533023f6E7A623C7C53",symbol:t.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[t.DAI]:{address:g("0x6B175474E89094C44Da98b954EedeAC495271d0F"),symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.EURC]:{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:t.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[t.STRK]:{address:"0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",symbol:t.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[t.USDC]:{address:g("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:g("0xdAC17F958D2ee523a2206206994597C13D831ec7"),symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:g("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.ETHEREUM_TESTNET]:{[t.USDC]:{address:g("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:t.USDC,decimals:6,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.HYPEREVM]:{[t.USDC]:{address:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.LISK]:{[t.USDC]:{address:"0xF242275d3a6527d877f2c927a82D9b057609cc71",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.MONAD]:{[t.USDC]:{address:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.MONAD_TESTNET]:{[t.USDC]:{address:"0x534b2f3A21130d7a60830c2Df862319e593943A3",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.OPTIMISM]:{[t.DAI]:{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.USDC]:{address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x4200000000000000000000000000000000000006",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.OPTIMISM_TESTNET]:{[t.USDC]:{address:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.POLYGON]:{[t.DAI]:{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.USDC]:{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.STARKNET]:{[t.DAI]:{address:"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[t.LORDS]:{address:"0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",symbol:t.LORDS,name:"LORDS Token",decimals:18,logoURI:"/images/tokens/lords.png",nativeToken:!1},[t.STRK]:{address:"0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",symbol:t.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[t.USDC]:{address:"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[c.STARKNET_TESTNET]:{[t.USDC]:{address:"0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}}},je={ARBITRUM:m[c.ARBITRUM],ARBITRUM_TESTNET:m[c.ARBITRUM_TESTNET],AVALANCHE:m[c.AVALANCHE],AVALANCHE_TESTNET:m[c.AVALANCHE_TESTNET],BASE:m[c.BASE],BASE_TESTNET:m[c.BASE_TESTNET],BSC:m[c.BSC],ETHEREUM:m[c.ETHEREUM],ETHEREUM_TESTNET:m[c.ETHEREUM_TESTNET],STARKNET:m[c.STARKNET]},Ke=new Set(Object.values(c));function f(s){if(We(s))return s;const e=c[s];if(!e)throw new Error(`Invalid chain: ${s}. Chain must be a valid chain alias or internal chain value from Chains.`);return e}function We(s){return Ke.has(s)}function Ve(s,e){const n=e.toLowerCase().trim(),a=m[s];if(!a)throw new Error(`Chain not found: ${s}. The chain key must be a valid chain identifier.`);let o;for(const r in a){const i=a[r];if(i&&i.address.toLowerCase()===n.toLowerCase()){o=i;break}}if(!o)throw new Error(`Token address mismatch: address ${e} does not exist on chain ${s}. The token address must be a valid token address on the specified chain.`);return o}function x(s,e,n){const a=Ve(s,e);if(a.symbol!==n)throw new Error(`Token address and symbol mismatch: address ${e} on chain ${s} corresponds to token "${a.symbol}", but expected "${n}". The token address must correspond to a token with the expected symbol on the specified chain.`);return a}function Ye(s,e){return m[s]?.[e]}function te(s,e){return Ye(s,e)?.address}var M=(s=>(s.PRODUCTION="production",s.STAGING="staging",s))(M||{});class l{constructor({api_key:e,env:n,seesion_token:a,props:o}){this.api_key=e||"",this.sessionToken=a||"",this.env=n??M.PRODUCTION,this.props=o}static async config(e){if(!l.app){if(!e)throw new Error("Please provide an api_key");l.app=new l(e)}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}static getApiKey(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.api_key}static getSessionToken(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.sessionToken}static getProps(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.props}static getEnv(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.env==="internal"?"staging":l.app.env}static getBaseUrl(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(l.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(e){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const n=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:""}`;return n+o+r}}let O=null;function qe(){O=b.create({prefixUrl:l.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[s=>{const e=l.getSessionToken()||l.getApiKey();s.headers.set("Authorization",`Bearer ${e}`)}],afterResponse:[(s,e,n)=>n]},retry:{limit:2}})}function u(){return O||qe(),O}class Ge{async getById(e){return await u().get("intents/"+e).json()}async getForSender(e){return await u().get("intents/user/"+e).json()}async getForAddress(e){return await u().get("intents/address/"+e).json()}async getForSession(e){return await u().get("modal/sessions/intents/"+e).json()}async getAll(e){return await u().get("intents",{searchParams:e}).json()}async create(e){const n=f(e.source_chain),a=f(e.destination_chain);return await u().post("intents",{json:{...e,source_chain:n,destination_chain:a}}).json()}async createForSession(e){const n=f(e.sourceChain);return await u().post("modal/sessions/intents",{json:{...e,sourceChain:n}}).json()}async update(e,n){return await u().post("intents",{json:n}).json()}async triggerProcessing(e){return await u().post(`intents/${e}/trigger-processing`).json()}async triggerProcessingForSession(e){return await u().post(`modal/sessions/intents/${e}/process`).json()}}class Xe{async getFromSpecificBridge(e){const n=f(e.sourceChain);x(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await u().get("quotes/single",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getFromAllBridges(e){const n=f(e.sourceChain);x(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await u().get("quotes/multiple",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getBestAcrossBridges(e){const n=f(e.sourceChain);x(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await u().get("quotes/best",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAll(e){const n=f(e.destinationChain);return await u().get("quotes/multi-source",{searchParams:{...e,destinationChain:n}}).json()}async getAllForSession(e){return await u().get("modal/sessions/quotes",{searchParams:e}).json()}}class Qe{async getOptimalRoutes(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await u().get("router/optimal-route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAllSupportedBridges(){return await u().get("router/supported-bridges/all").json()}async getSupportedBridges(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await u().get("router/supported-bridges/route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getSupportedRoutes(e){return await u().get("router/supported-routes/bridge/"+e).json()}}class Je{async getSupported(e){return await u().get("chains",{searchParams:e}).json()}async getBalance(e){return await u().get(`chains/balances/${e.address}`,{searchParams:e}).json()}}class Ze{async getClientInfo(){return await u().get("client/auth/client-info").json()}async getClientInfoForSession(){return await u().get("modal/sessions/client").json()}}class es{async getSessionToken(e){const n=f(e.destinationChain);let a=te(n,e.token);a||(console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`),a=te(n,"USDC"));const o={recipient:e.recipient,tokenOut:a,destinationChain:n,amount:e.amount};return u().post("modal/sessions",{json:o}).json().then(r=>({...r,amount:o.amount}))}}const ss={ACROSS:"ACROSS",CCTP:"CCTP",GATEWAY:"GATEWAY",RHINOFI:"RHINOFI"},ns={router:new Qe,quotes:new Xe,intents:new Ge,chains:new Je,client:new Ze,auth:new es};h.AmountSymbols=t,h.Bridges=ss,h.Chainrails=l,h.Chains=ae,h.Tokens=je,h.crapi=ns,h.environment=M,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(h,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("ky")):typeof define=="function"&&define.amd?define(["exports","ky"],b):(h=typeof globalThis<"u"?globalThis:h||self,b(h.Chainrails={},h.Ky))})(this,(function(h,b){"use strict";const c={ARBITRUM:"ARBITRUM_MAINNET",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE_MAINNET",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE_MAINNET",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC_MAINNET",ETHEREUM:"ETHEREUM_MAINNET",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM_MAINNET",LISK:"LISK_MAINNET",MONAD:"MONAD_MAINNET",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM_MAINNET",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON_MAINNET",STARKNET:"STARKNET_MAINNET",STARKNET_TESTNET:"STARKNET_TESTNET"},ae={ARBITRUM:"ARBITRUM",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC",ETHEREUM:"ETHEREUM",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM",LISK:"LISK",MONAD:"MONAD",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON",STARKNET:"STARKNET",STARKNET_TESTNET:"STARKNET_TESTNET"};function k(s,{strict:e=!0}={}){return!s||typeof s!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(s):s.startsWith("0x")}function F(s){return k(s,{strict:!1})?Math.ceil((s.length-2)/2):s.length}const H="2.43.4";let R={getDocsUrl:({docsBaseUrl:s,docsPath:e="",docsSlug:n})=>e?`${s??"https://viem.sh"}${e}${n?`#${n}`:""}`:void 0,version:`viem@${H}`};class S extends Error{constructor(e,n={}){const a=n.cause instanceof S?n.cause.details:n.cause?.message?n.cause.message:n.details,o=n.cause instanceof S&&n.cause.docsPath||n.docsPath,r=R.getDocsUrl?.({...n,docsPath:o}),i=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...a?[`Details: ${a}`]:[],...R.version?[`Version: ${R.version}`]:[]].join(`
|
|
2
|
+
`);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=a,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=e,this.version=H}walk(e){return $(this,e)}}function $(s,e){return e?.(s)?s:s&&typeof s=="object"&&"cause"in s&&s.cause!==void 0?$(s.cause,e):e?null:s}class P extends S{constructor({size:e,targetSize:n,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function D(s,{dir:e,size:n=32}={}){return typeof s=="string"?oe(s,{dir:e,size:n}):ie(s,{dir:e,size:n})}function oe(s,{dir:e,size:n=32}={}){if(n===null)return s;const a=s.replace("0x","");if(a.length>n*2)throw new P({size:Math.ceil(a.length/2),targetSize:n,type:"hex"});return`0x${a[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function ie(s,{dir:e,size:n=32}={}){if(n===null)return s;if(s.length>n)throw new P({size:s.length,targetSize:n,type:"bytes"});const a=new Uint8Array(n);for(let o=0;o<n;o++){const r=e==="right";a[r?o:n-o-1]=s[r?o:s.length-o-1]}return a}class re extends S{constructor({max:e,min:n,signed:a,size:o,value:r}){super(`Number "${r}" is not in safe ${o?`${o*8}-bit ${a?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class ce extends S{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function v(s,{size:e}){if(F(s)>e)throw new ce({givenSize:F(s),maxSize:e})}function de(s,e={}){const{signed:n,size:a}=e,o=BigInt(s);let r;a?n?r=(1n<<BigInt(a)*8n-1n)-1n:r=2n**(BigInt(a)*8n)-1n:typeof s=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof r=="bigint"&&n?-r-1n:0;if(r&&o>r||o<i){const T=typeof s=="bigint"?"n":"";throw new re({max:r?`${r}${T}`:void 0,min:`${i}${T}`,signed:n,size:a,value:`${s}${T}`})}const d=`0x${(n&&o<0?(1n<<BigInt(a*8))+BigInt(o):o).toString(16)}`;return a?D(d,{size:a}):d}const le=new TextEncoder;function ue(s,e={}){return typeof s=="number"||typeof s=="bigint"?fe(s,e):typeof s=="boolean"?ge(s,e):k(s)?_(s,e):L(s,e)}function ge(s,e={}){const n=new Uint8Array(1);return n[0]=Number(s),typeof e.size=="number"?(v(n,{size:e.size}),D(n,{size:e.size})):n}const E={zero:48,nine:57,A:65,F:70,a:97,f:102};function z(s){if(s>=E.zero&&s<=E.nine)return s-E.zero;if(s>=E.A&&s<=E.F)return s-(E.A-10);if(s>=E.a&&s<=E.f)return s-(E.a-10)}function _(s,e={}){let n=s;e.size&&(v(n,{size:e.size}),n=D(n,{dir:"right",size:e.size}));let a=n.slice(2);a.length%2&&(a=`0${a}`);const o=a.length/2,r=new Uint8Array(o);for(let i=0,d=0;i<o;i++){const T=z(a.charCodeAt(d++)),p=z(a.charCodeAt(d++));if(T===void 0||p===void 0)throw new S(`Invalid byte sequence ("${a[d-2]}${a[d-1]}" in "${a}").`);r[i]=T*16+p}return r}function fe(s,e){const n=de(s,e);return _(n)}function L(s,e={}){const n=le.encode(s);return typeof e.size=="number"?(v(n,{size:e.size}),D(n,{dir:"right",size:e.size})):n}const U=BigInt(2**32-1),j=BigInt(32);function he(s,e=!1){return e?{h:Number(s&U),l:Number(s>>j&U)}:{h:Number(s>>j&U)|0,l:Number(s&U)|0}}function me(s,e=!1){const n=s.length;let a=new Uint32Array(n),o=new Uint32Array(n);for(let r=0;r<n;r++){const{h:i,l:d}=he(s[r],e);[a[r],o[r]]=[i,d]}return[a,o]}const Te=(s,e,n)=>s<<n|e>>>32-n,Ee=(s,e,n)=>e<<n|s>>>32-n,Se=(s,e,n)=>e<<n-32|s>>>64-n,pe=(s,e,n)=>s<<n-32|e>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ce(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function K(s){if(!Number.isSafeInteger(s)||s<0)throw new Error("positive integer expected, got "+s)}function y(s,...e){if(!Ce(s))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(s.length))throw new Error("Uint8Array expected of length "+e+", got length="+s.length)}function W(s,e=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(e&&s.finished)throw new Error("Hash#digest() has already been called")}function be(s,e){y(s);const n=e.outputLen;if(s.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ae(s){return new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4))}function V(...s){for(let e=0;e<s.length;e++)s[e].fill(0)}const De=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ue(s){return s<<24&4278190080|s<<8&16711680|s>>>8&65280|s>>>24&255}function ye(s){for(let e=0;e<s.length;e++)s[e]=Ue(s[e]);return s}const Y=De?s=>s:ye;function Ie(s){if(typeof s!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(s))}function q(s){return typeof s=="string"&&(s=Ie(s)),y(s),s}class ke{}function Re(s){const e=a=>s().update(q(a)).digest(),n=s();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>s(),e}const ve=BigInt(0),A=BigInt(1),we=BigInt(2),Ne=BigInt(7),Be=BigInt(256),xe=BigInt(113),G=[],X=[],Q=[];for(let s=0,e=A,n=1,a=0;s<24;s++){[n,a]=[a,(2*n+3*a)%5],G.push(2*(5*a+n)),X.push((s+1)*(s+2)/2%64);let o=ve;for(let r=0;r<7;r++)e=(e<<A^(e>>Ne)*xe)%Be,e&we&&(o^=A<<(A<<BigInt(r))-A);Q.push(o)}const J=me(Q,!0),Me=J[0],Oe=J[1],Z=(s,e,n)=>n>32?Se(s,e,n):Te(s,e,n),ee=(s,e,n)=>n>32?pe(s,e,n):Ee(s,e,n);function Fe(s,e=24){const n=new Uint32Array(10);for(let a=24-e;a<24;a++){for(let i=0;i<10;i++)n[i]=s[i]^s[i+10]^s[i+20]^s[i+30]^s[i+40];for(let i=0;i<10;i+=2){const d=(i+8)%10,T=(i+2)%10,p=n[T],C=n[T+1],os=Z(p,C,1)^n[d],is=ee(p,C,1)^n[d+1];for(let I=0;I<50;I+=10)s[i+I]^=os,s[i+I+1]^=is}let o=s[2],r=s[3];for(let i=0;i<24;i++){const d=X[i],T=Z(o,r,d),p=ee(o,r,d),C=G[i];o=s[C],r=s[C+1],s[C]=T,s[C+1]=p}for(let i=0;i<50;i+=10){for(let d=0;d<10;d++)n[d]=s[i+d];for(let d=0;d<10;d++)s[i+d]^=~n[(d+2)%10]&n[(d+4)%10]}s[0]^=Me[a],s[1]^=Oe[a]}V(n)}class w extends ke{constructor(e,n,a,o=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=a,this.enableXOF=o,this.rounds=r,K(a),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Ae(this.state)}clone(){return this._cloneInto()}keccak(){Y(this.state32),Fe(this.state32,this.rounds),Y(this.state32),this.posOut=0,this.pos=0}update(e){W(this),e=q(e),y(e);const{blockLen:n,state:a}=this,o=e.length;for(let r=0;r<o;){const i=Math.min(n-this.pos,o-r);for(let d=0;d<i;d++)a[this.pos++]^=e[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:a,blockLen:o}=this;e[a]^=n,(n&128)!==0&&a===o-1&&this.keccak(),e[o-1]^=128,this.keccak()}writeInto(e){W(this,!1),y(e),this.finish();const n=this.state,{blockLen:a}=this;for(let o=0,r=e.length;o<r;){this.posOut>=a&&this.keccak();const i=Math.min(a-this.posOut,r-o);e.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return K(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(be(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,V(this.state)}_cloneInto(e){const{blockLen:n,suffix:a,outputLen:o,rounds:r,enableXOF:i}=this;return e||(e=new w(n,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}}const He=(s,e,n)=>Re(()=>new w(e,s,n)),$e=He(1,136,256/8);function Pe(s,e){return $e(k(s,{strict:!1})?ue(s):s)}class ze extends S{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class se extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const a=this.keys().next().value;a&&this.delete(a)}return this}}const N=new se(8192);function ne(s,e){if(N.has(`${s}.${e}`))return N.get(`${s}.${e}`);const n=s.substring(2).toLowerCase(),a=Pe(L(n)),o=n.split("");for(let i=0;i<40;i+=2)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());const r=`0x${o.join("")}`;return N.set(`${s}.${e}`,r),r}function g(s,e){if(!Le(s,{strict:!1}))throw new ze({address:s});return ne(s,e)}const _e=/^0x[a-fA-F0-9]{40}$/,B=new se(8192);function Le(s,e){const{strict:n=!0}=e??{},a=`${s}.${n}`;if(B.has(a))return B.get(a);const o=_e.test(s)?s.toLowerCase()===s?!0:n?ne(s)===s:!0:!1;return B.set(a,o),o}const t={USDC:"USDC",USDT:"USDT",DAI:"DAI",BUSD:"BUSD",EURC:"EURC",ETH:"ETH",WETH:"WETH",STRK:"STRK",BNB:"BNB",LORDS:"LORDS"};t.USDC;const m={[c.ARBITRUM]:{[t.DAI]:{address:g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.USDC]:{address:g("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:g("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:g("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.ARBITRUM_TESTNET]:{[t.USDC]:{address:g("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.AVALANCHE]:{[t.DAI]:{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.USDC]:{address:g("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.AVALANCHE_TESTNET]:{[t.USDC]:{address:g("0x5425890298aed601595a70AB815c96711a31Bc65"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.BASE]:{[t.DAI]:{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.EURC]:{address:"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",symbol:t.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[t.USDC]:{address:g("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.WETH]:{address:g("0x4200000000000000000000000000000000000006"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.BASE_TESTNET]:{[t.USDC]:{address:g("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.BSC]:{[t.BNB]:{address:"0x0000000000000000000000000000000000000000",symbol:t.BNB,name:"BNB",decimals:18,logoURI:"/images/chains/bsc.webp",nativeToken:!0},[t.BUSD]:{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:t.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[t.DAI]:{address:"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[t.USDC]:{address:g("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:t.USDC,decimals:18,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x55d398326f99059fF775485246999027B3197955",symbol:t.USDT,name:"Tether USD",decimals:18,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[c.ETHEREUM]:{[t.BUSD]:{address:"0x4Fabb145d64652a948d72533023f6E7A623C7C53",symbol:t.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[t.DAI]:{address:g("0x6B175474E89094C44Da98b954EedeAC495271d0F"),symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.EURC]:{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:t.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[t.STRK]:{address:"0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",symbol:t.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[t.USDC]:{address:g("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:g("0xdAC17F958D2ee523a2206206994597C13D831ec7"),symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:g("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.ETHEREUM_TESTNET]:{[t.USDC]:{address:g("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:t.USDC,decimals:6,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.HYPEREVM]:{[t.USDC]:{address:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.LISK]:{[t.USDC]:{address:"0xF242275d3a6527d877f2c927a82D9b057609cc71",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.MONAD]:{[t.USDC]:{address:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.MONAD_TESTNET]:{[t.USDC]:{address:"0x534b2f3A21130d7a60830c2Df862319e593943A3",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.OPTIMISM]:{[t.DAI]:{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.USDC]:{address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x4200000000000000000000000000000000000006",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.OPTIMISM_TESTNET]:{[t.USDC]:{address:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.POLYGON]:{[t.DAI]:{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.USDC]:{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.STARKNET]:{[t.DAI]:{address:"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[t.LORDS]:{address:"0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",symbol:t.LORDS,name:"LORDS Token",decimals:18,logoURI:"/images/tokens/lords.png",nativeToken:!1},[t.STRK]:{address:"0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",symbol:t.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[t.USDC]:{address:"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[c.STARKNET_TESTNET]:{[t.USDC]:{address:"0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}}},je={ARBITRUM:m[c.ARBITRUM],ARBITRUM_TESTNET:m[c.ARBITRUM_TESTNET],AVALANCHE:m[c.AVALANCHE],AVALANCHE_TESTNET:m[c.AVALANCHE_TESTNET],BASE:m[c.BASE],BASE_TESTNET:m[c.BASE_TESTNET],BSC:m[c.BSC],ETHEREUM:m[c.ETHEREUM],ETHEREUM_TESTNET:m[c.ETHEREUM_TESTNET],STARKNET:m[c.STARKNET]},Ke=new Set(Object.values(c));function f(s){if(We(s))return s;const e=c[s];if(!e)throw new Error(`Invalid chain: ${s}. Chain must be a valid chain alias or internal chain value from Chains.`);return e}function We(s){return Ke.has(s)}function Ve(s,e){const n=e.toLowerCase().trim(),a=m[s];if(!a)throw new Error(`Chain not found: ${s}. The chain key must be a valid chain identifier.`);let o;for(const r in a){const i=a[r];if(i&&i.address.toLowerCase()===n.toLowerCase()){o=i;break}}if(!o)throw new Error(`Token address mismatch: address ${e} does not exist on chain ${s}. The token address must be a valid token address on the specified chain.`);return o}function x(s,e,n){const a=Ve(s,e);if(a.symbol!==n)throw new Error(`Token address and symbol mismatch: address ${e} on chain ${s} corresponds to token "${a.symbol}", but expected "${n}". The token address must correspond to a token with the expected symbol on the specified chain.`);return a}function Ye(s,e){return m[s]?.[e]}function te(s,e){return Ye(s,e)?.address}var M=(s=>(s.PRODUCTION="production",s.STAGING="staging",s))(M||{});class l{constructor({api_key:e,env:n,seesion_token:a,props:o}){this.api_key=e||"",this.sessionToken=a||"",this.env=n??M.PRODUCTION,this.props=o}static async config(e){if(!l.app){if(!e)throw new Error("Please provide an api_key");l.app=new l(e)}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}static getApiKey(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.api_key}static getSessionToken(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.sessionToken}static getProps(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.props}static getEnv(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.env==="internal"?"staging":l.app.env}static getBaseUrl(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(l.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(e){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const n=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:""}`;return n+o+r}}let O=null;function qe(){O=b.create({prefixUrl:l.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[s=>{const e=l.getSessionToken()||l.getApiKey();s.headers.set("Authorization",`Bearer ${e}`)}],afterResponse:[(s,e,n)=>n]},retry:{limit:2}})}function u(){return O||qe(),O}class Ge{async getById(e){return await u().get("intents/"+e).json()}async getForSender(e){return await u().get("intents/user/"+e).json()}async getForAddress(e){return await u().get("intents/address/"+e).json()}async getForSession(e){return await u().get("modal/sessions/intents/"+e).json()}async getAll(e){return await u().get("intents",{searchParams:e}).json()}async create(e){const n=f(e.source_chain),a=f(e.destination_chain);return await u().post("intents",{json:{...e,source_chain:n,destination_chain:a}}).json()}async createForSession(e){const n=f(e.sourceChain);return await u().post("modal/sessions/intents",{json:{...e,sourceChain:n}}).json()}async update(e,n){return await u().post("intents",{json:n}).json()}async triggerProcessing(e){return await u().post(`intents/${e}/trigger-processing`).json()}async triggerProcessingForSession(e){return await u().post(`modal/sessions/intents/${e}/process`).json()}}class Xe{async getFromSpecificBridge(e){const n=f(e.sourceChain);x(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await u().get("quotes/single",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getFromAllBridges(e){const n=f(e.sourceChain);x(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await u().get("quotes/multiple",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getBestAcrossBridges(e){const n=f(e.sourceChain);x(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await u().get("quotes/best",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAll(e){const n=f(e.destinationChain);return await u().get("quotes/multi-source",{searchParams:{...e,destinationChain:n}}).json()}async getAllForSession(e){return await u().get("modal/sessions/quotes",{searchParams:e}).json()}}class Qe{async getOptimalRoutes(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await u().get("router/optimal-route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAllSupportedBridges(){return await u().get("router/supported-bridges/all").json()}async getSupportedBridges(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await u().get("router/supported-bridges/route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getSupportedRoutes(e){return await u().get("router/supported-routes/bridge/"+e).json()}}class Je{async getSupported(e){return await u().get("chains",{searchParams:e}).json()}async getBalance(e){return await u().get(`chains/balances/${e.address}`,{searchParams:e}).json()}}class Ze{async getClientInfo(){return await u().get("client/auth/client-info").json()}async getClientInfoForSession(){return await u().get("modal/sessions/client").json()}}class es{async getSessionToken(e){const n=f(e.destinationChain);let a=te(n,e.token);a||(console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`),a=te(n,"USDC"));const o={recipient:e.recipient,tokenOut:a,destinationChain:n,amount:e.amount};return u().post("modal/sessions",{json:o}).json().then(r=>({...r,amount:o.amount}))}}const ss="modal/sessions/history";class ns{async getHistoryForSession(e){return u().post(ss,{json:e}).json()}}const ts={ACROSS:"ACROSS",CCTP:"CCTP",GATEWAY:"GATEWAY",RHINOFI:"RHINOFI"},as={router:new Qe,quotes:new Xe,intents:new Ge,chains:new Je,client:new Ze,auth:new es,history:new ns};h.AmountSymbols=t,h.Bridges=ts,h.Chainrails=l,h.Chains=ae,h.Tokens=je,h.crapi=as,h.environment=M,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import Router from "./src/Router";
|
|
|
4
4
|
import ChainsService from "./src/Chains";
|
|
5
5
|
import Client from "./src/Client";
|
|
6
6
|
import Auth from "./src/Auth";
|
|
7
|
+
import History from "./src/history";
|
|
7
8
|
import { Chainrails } from "./src/req";
|
|
8
9
|
import { Chains, Tokens, environment, AmountSymbols, AmountSymbol, Chain } from "@chainrails/common";
|
|
9
10
|
declare const crapi: {
|
|
@@ -13,6 +14,7 @@ declare const crapi: {
|
|
|
13
14
|
chains: ChainsService;
|
|
14
15
|
client: Client;
|
|
15
16
|
auth: Auth;
|
|
17
|
+
history: History;
|
|
16
18
|
};
|
|
17
19
|
export * from "./src/types";
|
|
18
20
|
export { crapi, Chains, Tokens, Chainrails, environment, AmountSymbols };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,aAAa,MAAM,cAAc,CAAC;AACzC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,aAAa,MAAM,cAAc,CAAC;AACzC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,MAAM,EACN,MAAM,EACN,WAAW,EACX,aAAa,EACb,YAAY,EACZ,KAAK,EACN,MAAM,oBAAoB,CAAC;AAE5B,QAAA,MAAM,KAAK;;;;;;;;CAQV,CAAC;AAEF,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;AACzE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -87,10 +87,16 @@ export interface getAllForSessionInput {
|
|
|
87
87
|
excludeChains?: string;
|
|
88
88
|
[key: string]: string | number | boolean | undefined;
|
|
89
89
|
}
|
|
90
|
+
type Network = "mainnet" | "testnet";
|
|
90
91
|
export interface getAllForSessionOutput {
|
|
91
92
|
destinationChain: Chain;
|
|
92
93
|
quotes: Quote[];
|
|
93
94
|
cheapestOption: Quote;
|
|
94
|
-
network:
|
|
95
|
+
network: Network;
|
|
96
|
+
amount: string;
|
|
97
|
+
amountSymbol: AmountSymbol;
|
|
98
|
+
recipient: `0x${string}` | string;
|
|
99
|
+
token: `0x${string}` | string;
|
|
95
100
|
}
|
|
101
|
+
export {};
|
|
96
102
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Quotes/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,EAAE,KAAK,CAAC;IACxB,WAAW,EAAE,KAAK,CAAC;IACnB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,2BAA2B;IAC1C,gBAAgB,EAAE,KAAK,CAAC;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,cAAc,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,KAAK,CAAC;IACxB,WAAW,EAAE,KAAK,CAAC;IACnB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,+FAA+F;IAC/F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,EAAE,KAAK,CAAC;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,cAAc,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,gBAAgB,EAAE,KAAK,CAAC;IACxB,WAAW,EAAE,KAAK,CAAC;IACnB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,EAAE;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,YAAY,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,wBAAwB,EAAE,MAAM,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,KAAK,EAAE;QACL,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;QACvB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Quotes/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,EAAE,KAAK,CAAC;IACxB,WAAW,EAAE,KAAK,CAAC;IACnB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,2BAA2B;IAC1C,gBAAgB,EAAE,KAAK,CAAC;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,cAAc,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,KAAK,CAAC;IACxB,WAAW,EAAE,KAAK,CAAC;IACnB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,+FAA+F;IAC/F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,EAAE,KAAK,CAAC;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,cAAc,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,gBAAgB,EAAE,KAAK,CAAC;IACxB,WAAW,EAAE,KAAK,CAAC;IACnB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,EAAE;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,YAAY,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,wBAAwB,EAAE,MAAM,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,KAAK,EAAE;QACL,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;QACvB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;QACxB,WAAW,EAAE,KAAK,CAAC;QACnB,gBAAgB,EAAE,KAAK,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;QACzB,YAAY,EAAE,YAAY,CAAC;QAC3B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,KAAK,CAAC;IACxB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,+FAA+F;IAC/F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,YAAY;IAC3B,gBAAgB,EAAE,KAAK,CAAC;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,cAAc,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,+FAA+F;IAC/F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,KAAK,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AACrC,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,KAAK,CAAC;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,cAAc,EAAE,KAAK,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,KAAK,MAAM,EAAE,GAAG,MAAM,CAAC;IAClC,KAAK,EAAE,KAAK,MAAM,EAAE,GAAG,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/history/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAItD,MAAM,CAAC,OAAO,OAAO,OAAO;IACpB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;CAKxE;AAED,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Status } from "src/types";
|
|
2
|
+
import { InternalChain } from "@chainrails/common";
|
|
3
|
+
export interface HistoryInput {
|
|
4
|
+
ids: string[];
|
|
5
|
+
cursor?: string;
|
|
6
|
+
limit?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface IHistoryItem {
|
|
9
|
+
id: number | string;
|
|
10
|
+
clientName: string;
|
|
11
|
+
amount: string;
|
|
12
|
+
source_chain: InternalChain;
|
|
13
|
+
destination_chain: InternalChain;
|
|
14
|
+
intent_status: Status;
|
|
15
|
+
txnHash: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface HistoryOutput {
|
|
18
|
+
intents: IHistoryItem[];
|
|
19
|
+
nextCursor: string;
|
|
20
|
+
hasMore: boolean;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/history/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,aAAa,CAAC;IAC5B,iBAAiB,EAAE,aAAa,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB"}
|