@chainrails/sdk 0.3.3 → 0.3.5

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.
@@ -18,7 +18,7 @@ const c = {
18
18
  POLYGON: "POLYGON_MAINNET",
19
19
  STARKNET: "STARKNET_MAINNET",
20
20
  STARKNET_TESTNET: "STARKNET_TESTNET"
21
- }, ss = {
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 _ = "2.43.4";
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 B(s, { size: e }) {
148
+ function N(s, { size: e }) {
149
149
  if (x(s) > e)
150
150
  throw new ce({
151
151
  givenSize: x(s),
@@ -176,7 +176,7 @@ function ue(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" ? (B(n, { size: e.size }), U(n, { size: e.size })) : n;
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 && (B(n, { size: e.size }), n = U(n, { dir: "right", size: 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);
@@ -214,7 +214,7 @@ function fe(s, e) {
214
214
  }
215
215
  function V(s, e = {}) {
216
216
  const n = le.encode(s);
217
- return typeof e.size == "number" ? (B(n, { size: e.size }), U(n, { dir: "right", size: e.size })) : n;
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
220
  function he(s, e = !1) {
@@ -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), Be = BigInt(7), Ne = BigInt(256), xe = BigInt(113), q = [], X = [], Q = [];
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 >> Be) * xe) % Ne, e & we && (o ^= C << (C << /* @__PURE__ */ BigInt(r)) - C);
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 N extends ke {
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 N(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;
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 N(e, s, n)), $e = He(1, 136, 256 / 8);
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 (!_e(s, { strict: !1 }))
436
+ if (!Le(s, { strict: !1 }))
437
437
  throw new ze({ address: s });
438
438
  return ee(s, e);
439
439
  }
440
- const Le = /^0x[a-fA-F0-9]{40}$/, k = /* @__PURE__ */ new Z(8192);
441
- function _e(s, e) {
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 = Le.test(s) ? s.toLowerCase() === s ? !0 : n ? ee(s) === s : !0 : !1;
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 = {
@@ -933,7 +933,7 @@ const h = {
933
933
  nativeToken: !1
934
934
  }
935
935
  }
936
- }, ns = {
936
+ }, as = {
937
937
  ARBITRUM: h[c.ARBITRUM],
938
938
  ARBITRUM_TESTNET: h[c.ARBITRUM_TESTNET],
939
939
  AVALANCHE: h[c.AVALANCHE],
@@ -987,46 +987,46 @@ function R(s, e, n) {
987
987
  function Ve(s, e) {
988
988
  return h[s]?.[e];
989
989
  }
990
- function L(s, e) {
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 || {});
994
- class l {
994
+ class u {
995
995
  constructor({ api_key: e, env: n, seesion_token: a, props: o }) {
996
996
  this.api_key = e || "", this.sessionToken = a || "", this.env = n ?? se.PRODUCTION, this.props = o;
997
997
  }
998
998
  static async config(e) {
999
- if (!l.app) {
999
+ if (!u.app) {
1000
1000
  if (!e)
1001
1001
  throw new Error("Please provide an api_key");
1002
- l.app = new l(e);
1002
+ u.app = new u(e);
1003
1003
  }
1004
- 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;
1004
+ return e && (e.api_key !== void 0 && (u.app.api_key = e.api_key), e.seesion_token !== void 0 && (u.app.sessionToken = e.seesion_token), e.env !== void 0 && (u.app.env = e.env), e.props !== void 0 && (u.app.props = e.props)), u.app;
1005
1005
  }
1006
1006
  static getApiKey() {
1007
- if (!l.app)
1007
+ if (!u.app)
1008
1008
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1009
- return l.app.api_key;
1009
+ return u.app.api_key;
1010
1010
  }
1011
1011
  static getSessionToken() {
1012
- if (!l.app)
1012
+ if (!u.app)
1013
1013
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1014
- return l.app.sessionToken;
1014
+ return u.app.sessionToken;
1015
1015
  }
1016
1016
  static getProps() {
1017
- if (!l.app)
1017
+ if (!u.app)
1018
1018
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1019
- return l.app.props;
1019
+ return u.app.props;
1020
1020
  }
1021
1021
  static getEnv() {
1022
- if (!l.app)
1022
+ if (!u.app)
1023
1023
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1024
- return l.app.env === "internal" ? "staging" : l.app.env;
1024
+ return u.app.env === "internal" ? "staging" : u.app.env;
1025
1025
  }
1026
1026
  static getBaseUrl() {
1027
- if (!l.app)
1027
+ if (!u.app)
1028
1028
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1029
- switch (l.app.env) {
1029
+ switch (u.app.env) {
1030
1030
  case "production":
1031
1031
  return "https://api.chainrails.io/api/v1";
1032
1032
  case "staging":
@@ -1038,23 +1038,23 @@ class l {
1038
1038
  }
1039
1039
  }
1040
1040
  static getPayModalUrl(e) {
1041
- if (!l.app)
1041
+ if (!u.app)
1042
1042
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1043
- 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 : ""}`;
1043
+ const n = u.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 : ""}`;
1044
1044
  return n + o + r;
1045
1045
  }
1046
1046
  }
1047
1047
  let v = null;
1048
1048
  function Ye() {
1049
1049
  v = ae.create({
1050
- prefixUrl: l.getBaseUrl(),
1050
+ prefixUrl: u.getBaseUrl(),
1051
1051
  headers: {
1052
1052
  "Content-Type": "application/json"
1053
1053
  },
1054
1054
  hooks: {
1055
1055
  beforeRequest: [
1056
1056
  (s) => {
1057
- const e = l.getSessionToken() || l.getApiKey();
1057
+ const e = u.getSessionToken() || u.getApiKey();
1058
1058
  s.headers.set("Authorization", `Bearer ${e}`);
1059
1059
  }
1060
1060
  ],
@@ -1065,28 +1065,28 @@ function Ye() {
1065
1065
  }
1066
1066
  });
1067
1067
  }
1068
- function u() {
1068
+ function l() {
1069
1069
  return v || Ye(), v;
1070
1070
  }
1071
1071
  class Ge {
1072
1072
  async getById(e) {
1073
- return await u().get("intents/" + e).json();
1073
+ return await l().get("intents/" + e).json();
1074
1074
  }
1075
1075
  async getForSender(e) {
1076
- return await u().get("intents/user/" + e).json();
1076
+ return await l().get("intents/user/" + e).json();
1077
1077
  }
1078
1078
  async getForAddress(e) {
1079
- return await u().get("intents/address/" + e).json();
1079
+ return await l().get("intents/address/" + e).json();
1080
1080
  }
1081
1081
  async getForSession(e) {
1082
- return await u().get("modal/sessions/intents/" + e).json();
1082
+ return await l().get("modal/sessions/intents/" + e).json();
1083
1083
  }
1084
1084
  async getAll(e) {
1085
- return await u().get("intents", { searchParams: e }).json();
1085
+ return await l().get("intents", { searchParams: e }).json();
1086
1086
  }
1087
1087
  async create(e) {
1088
1088
  const n = f(e.source_chain), a = f(e.destination_chain);
1089
- return await u().post("intents", {
1089
+ return await l().post("intents", {
1090
1090
  json: {
1091
1091
  ...e,
1092
1092
  source_chain: n,
@@ -1096,18 +1096,18 @@ class Ge {
1096
1096
  }
1097
1097
  async createForSession(e) {
1098
1098
  const n = f(e.sourceChain);
1099
- return await u().post("modal/sessions/intents", {
1099
+ return await l().post("modal/sessions/intents", {
1100
1100
  json: { ...e, sourceChain: n }
1101
1101
  }).json();
1102
1102
  }
1103
1103
  async update(e, n) {
1104
- return await u().post("intents", { json: n }).json();
1104
+ return await l().post("intents", { json: n }).json();
1105
1105
  }
1106
1106
  async triggerProcessing(e) {
1107
- return await u().post(`intents/${e}/trigger-processing`).json();
1107
+ return await l().post(`intents/${e}/trigger-processing`).json();
1108
1108
  }
1109
1109
  async triggerProcessingForSession(e) {
1110
- return await u().post(`modal/sessions/intents/${e}/process`).json();
1110
+ return await l().post(`modal/sessions/intents/${e}/process`).json();
1111
1111
  }
1112
1112
  }
1113
1113
  class qe {
@@ -1115,7 +1115,7 @@ class qe {
1115
1115
  const n = f(e.sourceChain);
1116
1116
  R(n, e.tokenIn, e.amountSymbol);
1117
1117
  const a = f(e.destinationChain);
1118
- return await u().get("quotes/single", {
1118
+ return await l().get("quotes/single", {
1119
1119
  searchParams: {
1120
1120
  ...e,
1121
1121
  sourceChain: n,
@@ -1127,7 +1127,7 @@ class qe {
1127
1127
  const n = f(e.sourceChain);
1128
1128
  R(n, e.tokenIn, e.amountSymbol);
1129
1129
  const a = f(e.destinationChain);
1130
- return await u().get("quotes/multiple", {
1130
+ return await l().get("quotes/multiple", {
1131
1131
  searchParams: {
1132
1132
  ...e,
1133
1133
  sourceChain: n,
@@ -1139,7 +1139,7 @@ class qe {
1139
1139
  const n = f(e.sourceChain);
1140
1140
  R(n, e.tokenIn, e.amountSymbol);
1141
1141
  const a = f(e.destinationChain);
1142
- return await u().get("quotes/best", { searchParams: {
1142
+ return await l().get("quotes/best", { searchParams: {
1143
1143
  ...e,
1144
1144
  sourceChain: n,
1145
1145
  destinationChain: a
@@ -1147,19 +1147,19 @@ class qe {
1147
1147
  }
1148
1148
  async getAll(e) {
1149
1149
  const n = f(e.destinationChain);
1150
- return await u().get("quotes/multi-source", { searchParams: {
1150
+ return await l().get("quotes/multi-source", { searchParams: {
1151
1151
  ...e,
1152
1152
  destinationChain: n
1153
1153
  } }).json();
1154
1154
  }
1155
1155
  async getAllForSession(e) {
1156
- return await u().get("modal/sessions/quotes", { searchParams: e }).json();
1156
+ return await l().get("modal/sessions/quotes", { searchParams: e }).json();
1157
1157
  }
1158
1158
  }
1159
1159
  class Xe {
1160
1160
  async getOptimalRoutes(e) {
1161
1161
  const n = f(e.sourceChain), a = f(e.destinationChain);
1162
- return await u().get("router/optimal-route", {
1162
+ return await l().get("router/optimal-route", {
1163
1163
  searchParams: {
1164
1164
  ...e,
1165
1165
  sourceChain: n,
@@ -1168,69 +1168,84 @@ class Xe {
1168
1168
  }).json();
1169
1169
  }
1170
1170
  async getAllSupportedBridges() {
1171
- return await u().get("router/supported-bridges/all").json();
1171
+ return await l().get("router/supported-bridges/all").json();
1172
1172
  }
1173
1173
  async getSupportedBridges(e) {
1174
1174
  const n = f(e.sourceChain), a = f(e.destinationChain);
1175
- return await u().get("router/supported-bridges/route", { searchParams: {
1175
+ return await l().get("router/supported-bridges/route", { searchParams: {
1176
1176
  ...e,
1177
1177
  sourceChain: n,
1178
1178
  destinationChain: a
1179
1179
  } }).json();
1180
1180
  }
1181
1181
  async getSupportedRoutes(e) {
1182
- return await u().get("router/supported-routes/bridge/" + e).json();
1182
+ return await l().get("router/supported-routes/bridge/" + e).json();
1183
1183
  }
1184
1184
  }
1185
1185
  class Qe {
1186
1186
  async getSupported(e) {
1187
- return await u().get("chains", { searchParams: e }).json();
1187
+ return await l().get("chains", { searchParams: e }).json();
1188
1188
  }
1189
1189
  async getBalance(e) {
1190
- return await u().get(`chains/balances/${e.address}`, { searchParams: e }).json();
1190
+ return await l().get(`chains/balances/${e.address}`, { searchParams: e }).json();
1191
1191
  }
1192
1192
  }
1193
1193
  class Je {
1194
1194
  async getClientInfo() {
1195
- return await u().get("client/auth/client-info").json();
1195
+ return await l().get("client/auth/client-info").json();
1196
1196
  }
1197
1197
  async getClientInfoForSession() {
1198
- return await u().get("modal/sessions/client").json();
1198
+ return await l().get("modal/sessions/client").json();
1199
1199
  }
1200
1200
  }
1201
1201
  class Ze {
1202
1202
  async getSessionToken(e) {
1203
1203
  const n = f(e.destinationChain);
1204
- let a = L(n, e.token);
1205
- a || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), a = L(n, "USDC"));
1204
+ let a = _(n, e.token);
1205
+ a || (console.error(
1206
+ `${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`
1207
+ ), a = _(n, "USDC"));
1206
1208
  const o = {
1207
1209
  recipient: e.recipient,
1208
1210
  tokenOut: a,
1209
1211
  destinationChain: n,
1210
1212
  amount: e.amount
1211
1213
  };
1212
- return u().post("modal/sessions", { json: o }).json().then((r) => ({ ...r, amount: o.amount }));
1214
+ return l().post("modal/sessions", { json: o }).json().then((r) => ({ ...r, amount: o.amount }));
1215
+ }
1216
+ async getHandOffToken() {
1217
+ return l().post("modal/sessions/handoff-token").json();
1218
+ }
1219
+ async resumeSession(e) {
1220
+ return l().post(`modal/sessions/${e.sessionId}/resume`, { json: e }).json();
1213
1221
  }
1214
1222
  }
1215
- const ts = {
1223
+ const es = "modal/sessions/history";
1224
+ class ss {
1225
+ async getHistoryForSession(e) {
1226
+ return l().post(es, { json: e }).json();
1227
+ }
1228
+ }
1229
+ const os = {
1216
1230
  ACROSS: "ACROSS",
1217
1231
  CCTP: "CCTP",
1218
1232
  GATEWAY: "GATEWAY",
1219
1233
  RHINOFI: "RHINOFI"
1220
- }, as = {
1234
+ }, is = {
1221
1235
  router: new Xe(),
1222
1236
  quotes: new qe(),
1223
1237
  intents: new Ge(),
1224
1238
  chains: new Qe(),
1225
1239
  client: new Je(),
1226
- auth: new Ze()
1240
+ auth: new Ze(),
1241
+ history: new ss()
1227
1242
  };
1228
1243
  export {
1229
1244
  t as AmountSymbols,
1230
- ts as Bridges,
1231
- l as Chainrails,
1232
- ss as Chains,
1233
- ns as Tokens,
1234
- as as crapi,
1245
+ os as Bridges,
1246
+ u as Chainrails,
1247
+ ts as Chains,
1248
+ as as Tokens,
1249
+ is as crapi,
1235
1250
  se as environment
1236
1251
  };
@@ -18,7 +18,7 @@ const c = {
18
18
  POLYGON: "POLYGON_MAINNET",
19
19
  STARKNET: "STARKNET_MAINNET",
20
20
  STARKNET_TESTNET: "STARKNET_TESTNET"
21
- }, ss = {
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 _ = "2.43.4";
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 B(s, { size: e }) {
148
+ function N(s, { size: e }) {
149
149
  if (x(s) > e)
150
150
  throw new ce({
151
151
  givenSize: x(s),
@@ -176,7 +176,7 @@ function ue(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" ? (B(n, { size: e.size }), U(n, { size: e.size })) : n;
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 && (B(n, { size: e.size }), n = U(n, { dir: "right", size: 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);
@@ -214,7 +214,7 @@ function fe(s, e) {
214
214
  }
215
215
  function V(s, e = {}) {
216
216
  const n = le.encode(s);
217
- return typeof e.size == "number" ? (B(n, { size: e.size }), U(n, { dir: "right", size: e.size })) : n;
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
220
  function he(s, e = !1) {
@@ -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), Be = BigInt(7), Ne = BigInt(256), xe = BigInt(113), q = [], X = [], Q = [];
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 >> Be) * xe) % Ne, e & we && (o ^= C << (C << /* @__PURE__ */ BigInt(r)) - C);
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 N extends ke {
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 N(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;
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 N(e, s, n)), $e = He(1, 136, 256 / 8);
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 (!_e(s, { strict: !1 }))
436
+ if (!Le(s, { strict: !1 }))
437
437
  throw new ze({ address: s });
438
438
  return ee(s, e);
439
439
  }
440
- const Le = /^0x[a-fA-F0-9]{40}$/, k = /* @__PURE__ */ new Z(8192);
441
- function _e(s, e) {
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 = Le.test(s) ? s.toLowerCase() === s ? !0 : n ? ee(s) === s : !0 : !1;
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 = {
@@ -933,7 +933,7 @@ const h = {
933
933
  nativeToken: !1
934
934
  }
935
935
  }
936
- }, ns = {
936
+ }, as = {
937
937
  ARBITRUM: h[c.ARBITRUM],
938
938
  ARBITRUM_TESTNET: h[c.ARBITRUM_TESTNET],
939
939
  AVALANCHE: h[c.AVALANCHE],
@@ -987,46 +987,46 @@ function R(s, e, n) {
987
987
  function Ve(s, e) {
988
988
  return h[s]?.[e];
989
989
  }
990
- function L(s, e) {
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 || {});
994
- class l {
994
+ class u {
995
995
  constructor({ api_key: e, env: n, seesion_token: a, props: o }) {
996
996
  this.api_key = e || "", this.sessionToken = a || "", this.env = n ?? se.PRODUCTION, this.props = o;
997
997
  }
998
998
  static async config(e) {
999
- if (!l.app) {
999
+ if (!u.app) {
1000
1000
  if (!e)
1001
1001
  throw new Error("Please provide an api_key");
1002
- l.app = new l(e);
1002
+ u.app = new u(e);
1003
1003
  }
1004
- 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;
1004
+ return e && (e.api_key !== void 0 && (u.app.api_key = e.api_key), e.seesion_token !== void 0 && (u.app.sessionToken = e.seesion_token), e.env !== void 0 && (u.app.env = e.env), e.props !== void 0 && (u.app.props = e.props)), u.app;
1005
1005
  }
1006
1006
  static getApiKey() {
1007
- if (!l.app)
1007
+ if (!u.app)
1008
1008
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1009
- return l.app.api_key;
1009
+ return u.app.api_key;
1010
1010
  }
1011
1011
  static getSessionToken() {
1012
- if (!l.app)
1012
+ if (!u.app)
1013
1013
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1014
- return l.app.sessionToken;
1014
+ return u.app.sessionToken;
1015
1015
  }
1016
1016
  static getProps() {
1017
- if (!l.app)
1017
+ if (!u.app)
1018
1018
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1019
- return l.app.props;
1019
+ return u.app.props;
1020
1020
  }
1021
1021
  static getEnv() {
1022
- if (!l.app)
1022
+ if (!u.app)
1023
1023
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1024
- return l.app.env === "internal" ? "staging" : l.app.env;
1024
+ return u.app.env === "internal" ? "staging" : u.app.env;
1025
1025
  }
1026
1026
  static getBaseUrl() {
1027
- if (!l.app)
1027
+ if (!u.app)
1028
1028
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1029
- switch (l.app.env) {
1029
+ switch (u.app.env) {
1030
1030
  case "production":
1031
1031
  return "https://api.chainrails.io/api/v1";
1032
1032
  case "staging":
@@ -1038,23 +1038,23 @@ class l {
1038
1038
  }
1039
1039
  }
1040
1040
  static getPayModalUrl(e) {
1041
- if (!l.app)
1041
+ if (!u.app)
1042
1042
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1043
- 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 : ""}`;
1043
+ const n = u.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 : ""}`;
1044
1044
  return n + o + r;
1045
1045
  }
1046
1046
  }
1047
1047
  let v = null;
1048
1048
  function Ye() {
1049
1049
  v = ae.create({
1050
- prefixUrl: l.getBaseUrl(),
1050
+ prefixUrl: u.getBaseUrl(),
1051
1051
  headers: {
1052
1052
  "Content-Type": "application/json"
1053
1053
  },
1054
1054
  hooks: {
1055
1055
  beforeRequest: [
1056
1056
  (s) => {
1057
- const e = l.getSessionToken() || l.getApiKey();
1057
+ const e = u.getSessionToken() || u.getApiKey();
1058
1058
  s.headers.set("Authorization", `Bearer ${e}`);
1059
1059
  }
1060
1060
  ],
@@ -1065,28 +1065,28 @@ function Ye() {
1065
1065
  }
1066
1066
  });
1067
1067
  }
1068
- function u() {
1068
+ function l() {
1069
1069
  return v || Ye(), v;
1070
1070
  }
1071
1071
  class Ge {
1072
1072
  async getById(e) {
1073
- return await u().get("intents/" + e).json();
1073
+ return await l().get("intents/" + e).json();
1074
1074
  }
1075
1075
  async getForSender(e) {
1076
- return await u().get("intents/user/" + e).json();
1076
+ return await l().get("intents/user/" + e).json();
1077
1077
  }
1078
1078
  async getForAddress(e) {
1079
- return await u().get("intents/address/" + e).json();
1079
+ return await l().get("intents/address/" + e).json();
1080
1080
  }
1081
1081
  async getForSession(e) {
1082
- return await u().get("modal/sessions/intents/" + e).json();
1082
+ return await l().get("modal/sessions/intents/" + e).json();
1083
1083
  }
1084
1084
  async getAll(e) {
1085
- return await u().get("intents", { searchParams: e }).json();
1085
+ return await l().get("intents", { searchParams: e }).json();
1086
1086
  }
1087
1087
  async create(e) {
1088
1088
  const n = f(e.source_chain), a = f(e.destination_chain);
1089
- return await u().post("intents", {
1089
+ return await l().post("intents", {
1090
1090
  json: {
1091
1091
  ...e,
1092
1092
  source_chain: n,
@@ -1096,18 +1096,18 @@ class Ge {
1096
1096
  }
1097
1097
  async createForSession(e) {
1098
1098
  const n = f(e.sourceChain);
1099
- return await u().post("modal/sessions/intents", {
1099
+ return await l().post("modal/sessions/intents", {
1100
1100
  json: { ...e, sourceChain: n }
1101
1101
  }).json();
1102
1102
  }
1103
1103
  async update(e, n) {
1104
- return await u().post("intents", { json: n }).json();
1104
+ return await l().post("intents", { json: n }).json();
1105
1105
  }
1106
1106
  async triggerProcessing(e) {
1107
- return await u().post(`intents/${e}/trigger-processing`).json();
1107
+ return await l().post(`intents/${e}/trigger-processing`).json();
1108
1108
  }
1109
1109
  async triggerProcessingForSession(e) {
1110
- return await u().post(`modal/sessions/intents/${e}/process`).json();
1110
+ return await l().post(`modal/sessions/intents/${e}/process`).json();
1111
1111
  }
1112
1112
  }
1113
1113
  class qe {
@@ -1115,7 +1115,7 @@ class qe {
1115
1115
  const n = f(e.sourceChain);
1116
1116
  R(n, e.tokenIn, e.amountSymbol);
1117
1117
  const a = f(e.destinationChain);
1118
- return await u().get("quotes/single", {
1118
+ return await l().get("quotes/single", {
1119
1119
  searchParams: {
1120
1120
  ...e,
1121
1121
  sourceChain: n,
@@ -1127,7 +1127,7 @@ class qe {
1127
1127
  const n = f(e.sourceChain);
1128
1128
  R(n, e.tokenIn, e.amountSymbol);
1129
1129
  const a = f(e.destinationChain);
1130
- return await u().get("quotes/multiple", {
1130
+ return await l().get("quotes/multiple", {
1131
1131
  searchParams: {
1132
1132
  ...e,
1133
1133
  sourceChain: n,
@@ -1139,7 +1139,7 @@ class qe {
1139
1139
  const n = f(e.sourceChain);
1140
1140
  R(n, e.tokenIn, e.amountSymbol);
1141
1141
  const a = f(e.destinationChain);
1142
- return await u().get("quotes/best", { searchParams: {
1142
+ return await l().get("quotes/best", { searchParams: {
1143
1143
  ...e,
1144
1144
  sourceChain: n,
1145
1145
  destinationChain: a
@@ -1147,19 +1147,19 @@ class qe {
1147
1147
  }
1148
1148
  async getAll(e) {
1149
1149
  const n = f(e.destinationChain);
1150
- return await u().get("quotes/multi-source", { searchParams: {
1150
+ return await l().get("quotes/multi-source", { searchParams: {
1151
1151
  ...e,
1152
1152
  destinationChain: n
1153
1153
  } }).json();
1154
1154
  }
1155
1155
  async getAllForSession(e) {
1156
- return await u().get("modal/sessions/quotes", { searchParams: e }).json();
1156
+ return await l().get("modal/sessions/quotes", { searchParams: e }).json();
1157
1157
  }
1158
1158
  }
1159
1159
  class Xe {
1160
1160
  async getOptimalRoutes(e) {
1161
1161
  const n = f(e.sourceChain), a = f(e.destinationChain);
1162
- return await u().get("router/optimal-route", {
1162
+ return await l().get("router/optimal-route", {
1163
1163
  searchParams: {
1164
1164
  ...e,
1165
1165
  sourceChain: n,
@@ -1168,69 +1168,84 @@ class Xe {
1168
1168
  }).json();
1169
1169
  }
1170
1170
  async getAllSupportedBridges() {
1171
- return await u().get("router/supported-bridges/all").json();
1171
+ return await l().get("router/supported-bridges/all").json();
1172
1172
  }
1173
1173
  async getSupportedBridges(e) {
1174
1174
  const n = f(e.sourceChain), a = f(e.destinationChain);
1175
- return await u().get("router/supported-bridges/route", { searchParams: {
1175
+ return await l().get("router/supported-bridges/route", { searchParams: {
1176
1176
  ...e,
1177
1177
  sourceChain: n,
1178
1178
  destinationChain: a
1179
1179
  } }).json();
1180
1180
  }
1181
1181
  async getSupportedRoutes(e) {
1182
- return await u().get("router/supported-routes/bridge/" + e).json();
1182
+ return await l().get("router/supported-routes/bridge/" + e).json();
1183
1183
  }
1184
1184
  }
1185
1185
  class Qe {
1186
1186
  async getSupported(e) {
1187
- return await u().get("chains", { searchParams: e }).json();
1187
+ return await l().get("chains", { searchParams: e }).json();
1188
1188
  }
1189
1189
  async getBalance(e) {
1190
- return await u().get(`chains/balances/${e.address}`, { searchParams: e }).json();
1190
+ return await l().get(`chains/balances/${e.address}`, { searchParams: e }).json();
1191
1191
  }
1192
1192
  }
1193
1193
  class Je {
1194
1194
  async getClientInfo() {
1195
- return await u().get("client/auth/client-info").json();
1195
+ return await l().get("client/auth/client-info").json();
1196
1196
  }
1197
1197
  async getClientInfoForSession() {
1198
- return await u().get("modal/sessions/client").json();
1198
+ return await l().get("modal/sessions/client").json();
1199
1199
  }
1200
1200
  }
1201
1201
  class Ze {
1202
1202
  async getSessionToken(e) {
1203
1203
  const n = f(e.destinationChain);
1204
- let a = L(n, e.token);
1205
- a || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), a = L(n, "USDC"));
1204
+ let a = _(n, e.token);
1205
+ a || (console.error(
1206
+ `${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`
1207
+ ), a = _(n, "USDC"));
1206
1208
  const o = {
1207
1209
  recipient: e.recipient,
1208
1210
  tokenOut: a,
1209
1211
  destinationChain: n,
1210
1212
  amount: e.amount
1211
1213
  };
1212
- return u().post("modal/sessions", { json: o }).json().then((r) => ({ ...r, amount: o.amount }));
1214
+ return l().post("modal/sessions", { json: o }).json().then((r) => ({ ...r, amount: o.amount }));
1215
+ }
1216
+ async getHandOffToken() {
1217
+ return l().post("modal/sessions/handoff-token").json();
1218
+ }
1219
+ async resumeSession(e) {
1220
+ return l().post(`modal/sessions/${e.sessionId}/resume`, { json: e }).json();
1213
1221
  }
1214
1222
  }
1215
- const ts = {
1223
+ const es = "modal/sessions/history";
1224
+ class ss {
1225
+ async getHistoryForSession(e) {
1226
+ return l().post(es, { json: e }).json();
1227
+ }
1228
+ }
1229
+ const os = {
1216
1230
  ACROSS: "ACROSS",
1217
1231
  CCTP: "CCTP",
1218
1232
  GATEWAY: "GATEWAY",
1219
1233
  RHINOFI: "RHINOFI"
1220
- }, as = {
1234
+ }, is = {
1221
1235
  router: new Xe(),
1222
1236
  quotes: new qe(),
1223
1237
  intents: new Ge(),
1224
1238
  chains: new Qe(),
1225
1239
  client: new Je(),
1226
- auth: new Ze()
1240
+ auth: new Ze(),
1241
+ history: new ss()
1227
1242
  };
1228
1243
  export {
1229
1244
  t as AmountSymbols,
1230
- ts as Bridges,
1231
- l as Chainrails,
1232
- ss as Chains,
1233
- ns as Tokens,
1234
- as as crapi,
1245
+ os as Bridges,
1246
+ u as Chainrails,
1247
+ ts as Chains,
1248
+ as as Tokens,
1249
+ is as crapi,
1235
1250
  se as environment
1236
1251
  };
@@ -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 v={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=v.getDocsUrl?.({...n,docsPath:o}),i=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...a?[`Details: ${a}`]:[],...v.version?[`Version: ${v.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 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 u{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(!u.app){if(!e)throw new Error("Please provide an api_key");u.app=new u(e)}return e&&(e.api_key!==void 0&&(u.app.api_key=e.api_key),e.seesion_token!==void 0&&(u.app.sessionToken=e.seesion_token),e.env!==void 0&&(u.app.env=e.env),e.props!==void 0&&(u.app.props=e.props)),u.app}static getApiKey(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.api_key}static getSessionToken(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.sessionToken}static getProps(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.props}static getEnv(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.env==="internal"?"staging":u.app.env}static getBaseUrl(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(u.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(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const n=u.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:u.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[s=>{const e=u.getSessionToken()||u.getApiKey();s.headers.set("Authorization",`Bearer ${e}`)}],afterResponse:[(s,e,n)=>n]},retry:{limit:2}})}function l(){return O||qe(),O}class Ge{async getById(e){return await l().get("intents/"+e).json()}async getForSender(e){return await l().get("intents/user/"+e).json()}async getForAddress(e){return await l().get("intents/address/"+e).json()}async getForSession(e){return await l().get("modal/sessions/intents/"+e).json()}async getAll(e){return await l().get("intents",{searchParams:e}).json()}async create(e){const n=f(e.source_chain),a=f(e.destination_chain);return await l().post("intents",{json:{...e,source_chain:n,destination_chain:a}}).json()}async createForSession(e){const n=f(e.sourceChain);return await l().post("modal/sessions/intents",{json:{...e,sourceChain:n}}).json()}async update(e,n){return await l().post("intents",{json:n}).json()}async triggerProcessing(e){return await l().post(`intents/${e}/trigger-processing`).json()}async triggerProcessingForSession(e){return await l().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 l().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 l().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 l().get("quotes/best",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAll(e){const n=f(e.destinationChain);return await l().get("quotes/multi-source",{searchParams:{...e,destinationChain:n}}).json()}async getAllForSession(e){return await l().get("modal/sessions/quotes",{searchParams:e}).json()}}class Qe{async getOptimalRoutes(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await l().get("router/optimal-route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAllSupportedBridges(){return await l().get("router/supported-bridges/all").json()}async getSupportedBridges(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await l().get("router/supported-bridges/route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getSupportedRoutes(e){return await l().get("router/supported-routes/bridge/"+e).json()}}class Je{async getSupported(e){return await l().get("chains",{searchParams:e}).json()}async getBalance(e){return await l().get(`chains/balances/${e.address}`,{searchParams:e}).json()}}class Ze{async getClientInfo(){return await l().get("client/auth/client-info").json()}async getClientInfoForSession(){return await l().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 l().post("modal/sessions",{json:o}).json().then(r=>({...r,amount:o.amount}))}async getHandOffToken(){return l().post("modal/sessions/handoff-token").json()}async resumeSession(e){return l().post(`modal/sessions/${e.sessionId}/resume`,{json:e}).json()}}const ss="modal/sessions/history";class ns{async getHistoryForSession(e){return l().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=u,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 };
@@ -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,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAErG,QAAA,MAAM,KAAK;;;;;;;CAOV,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"}
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"}
@@ -1,9 +1,11 @@
1
- import { getSessionTokenInput } from "./types";
1
+ import { getHandOffTokenOutput, getSessionTokenInput, resumeSessionInput, resumeSessionOutput } from "./types";
2
2
  export default class Auth {
3
3
  getSessionToken(input: getSessionTokenInput): Promise<{
4
4
  amount: string;
5
5
  sessionToken: string;
6
6
  }>;
7
+ getHandOffToken(): Promise<getHandOffTokenOutput>;
8
+ resumeSession(input: resumeSessionInput): Promise<resumeSessionOutput>;
7
9
  }
8
10
  export * from "./types";
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Auth/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAyB,MAAM,SAAS,CAAC;AAEtE,MAAM,CAAC,OAAO,OAAO,IAAI;IACjB,eAAe,CAAC,KAAK,EAAE,oBAAoB;;;;CAmBlD;AAED,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Auth/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EAEpB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,IAAI;IACjB,eAAe,CAAC,KAAK,EAAE,oBAAoB;;;;IAsB3C,eAAe;IAMf,aAAa,CAAC,KAAK,EAAE,kBAAkB;CAK9C;AAED,cAAc,SAAS,CAAC"}
@@ -8,4 +8,18 @@ export interface getSessionTokenInput {
8
8
  export interface getSessionTokenOutput {
9
9
  sessionToken: string;
10
10
  }
11
+ export interface getHandOffTokenOutput {
12
+ sessionId: string;
13
+ handoffToken: string;
14
+ expiresAt: string;
15
+ }
16
+ export interface resumeSessionInput {
17
+ sessionId: string;
18
+ handoffToken: string;
19
+ }
20
+ export interface resumeSessionOutput {
21
+ sessionId: string;
22
+ sessionToken: string;
23
+ expiresAt: string;
24
+ }
11
25
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,KAAK,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;CACtB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,KAAK,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -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: 'mainnet' | 'testnet';
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":"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"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Quotes/types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ import { HistoryInput, HistoryOutput } from "./types";
2
+ export default class History {
3
+ getHistoryForSession(input: HistoryInput): Promise<HistoryOutput>;
4
+ }
5
+ export * from "./types";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chainrails/sdk",
3
3
  "sideEffects": false,
4
- "version": "0.3.3",
4
+ "version": "0.3.5",
5
5
  "main": "./dist/chainrails-sdk.umd.js",
6
6
  "module": "./dist/chainrails-sdk.es.mjs",
7
7
  "license": "MIT",