@chainrails/sdk 0.3.4 → 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.
@@ -172,7 +172,7 @@ function de(s, e = {}) {
172
172
  }
173
173
  const le = /* @__PURE__ */ new TextEncoder();
174
174
  function ue(s, e = {}) {
175
- return typeof s == "number" || typeof s == "bigint" ? he(s, e) : typeof s == "boolean" ? ge(s, e) : w(s) ? W(s, e) : V(s, e);
175
+ return typeof s == "number" || typeof s == "bigint" ? fe(s, e) : typeof s == "boolean" ? ge(s, e) : w(s) ? W(s, e) : V(s, e);
176
176
  }
177
177
  function ge(s, e = {}) {
178
178
  const n = new Uint8Array(1);
@@ -208,7 +208,7 @@ function W(s, e = {}) {
208
208
  }
209
209
  return r;
210
210
  }
211
- function he(s, e) {
211
+ function fe(s, e) {
212
212
  const n = de(s, e);
213
213
  return W(n);
214
214
  }
@@ -217,14 +217,14 @@ function V(s, e = {}) {
217
217
  return typeof e.size == "number" ? (N(n, { size: e.size }), U(n, { dir: "right", size: e.size })) : n;
218
218
  }
219
219
  const A = /* @__PURE__ */ BigInt(2 ** 32 - 1), O = /* @__PURE__ */ BigInt(32);
220
- function fe(s, e = !1) {
220
+ function he(s, e = !1) {
221
221
  return e ? { h: Number(s & A), l: Number(s >> O & A) } : { h: Number(s >> O & A) | 0, l: Number(s & A) | 0 };
222
222
  }
223
223
  function me(s, e = !1) {
224
224
  const n = s.length;
225
225
  let a = new Uint32Array(n), o = new Uint32Array(n);
226
226
  for (let r = 0; r < n; r++) {
227
- const { h: i, l: d } = fe(s[r], e);
227
+ const { h: i, l: d } = he(s[r], e);
228
228
  [a[r], o[r]] = [i, d];
229
229
  }
230
230
  return [a, o];
@@ -458,7 +458,7 @@ const t = {
458
458
  LORDS: "LORDS"
459
459
  };
460
460
  t.USDC;
461
- const f = {
461
+ const h = {
462
462
  [c.ARBITRUM]: {
463
463
  [t.DAI]: {
464
464
  address: g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
@@ -934,18 +934,18 @@ const f = {
934
934
  }
935
935
  }
936
936
  }, as = {
937
- ARBITRUM: f[c.ARBITRUM],
938
- ARBITRUM_TESTNET: f[c.ARBITRUM_TESTNET],
939
- AVALANCHE: f[c.AVALANCHE],
940
- AVALANCHE_TESTNET: f[c.AVALANCHE_TESTNET],
941
- BASE: f[c.BASE],
942
- BASE_TESTNET: f[c.BASE_TESTNET],
943
- BSC: f[c.BSC],
944
- ETHEREUM: f[c.ETHEREUM],
945
- ETHEREUM_TESTNET: f[c.ETHEREUM_TESTNET],
946
- STARKNET: f[c.STARKNET]
937
+ ARBITRUM: h[c.ARBITRUM],
938
+ ARBITRUM_TESTNET: h[c.ARBITRUM_TESTNET],
939
+ AVALANCHE: h[c.AVALANCHE],
940
+ AVALANCHE_TESTNET: h[c.AVALANCHE_TESTNET],
941
+ BASE: h[c.BASE],
942
+ BASE_TESTNET: h[c.BASE_TESTNET],
943
+ BSC: h[c.BSC],
944
+ ETHEREUM: h[c.ETHEREUM],
945
+ ETHEREUM_TESTNET: h[c.ETHEREUM_TESTNET],
946
+ STARKNET: h[c.STARKNET]
947
947
  }, je = new Set(Object.values(c));
948
- function h(s) {
948
+ function f(s) {
949
949
  if (Ke(s))
950
950
  return s;
951
951
  const e = c[s];
@@ -957,7 +957,7 @@ function Ke(s) {
957
957
  return je.has(s);
958
958
  }
959
959
  function We(s, e) {
960
- const n = e.toLowerCase().trim(), a = f[s];
960
+ const n = e.toLowerCase().trim(), a = h[s];
961
961
  if (!a)
962
962
  throw new Error(
963
963
  `Chain not found: ${s}. The chain key must be a valid chain identifier.`
@@ -985,48 +985,48 @@ function R(s, e, n) {
985
985
  return a;
986
986
  }
987
987
  function Ve(s, e) {
988
- return f[s]?.[e];
988
+ return h[s]?.[e];
989
989
  }
990
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
- const n = h(e.source_chain), a = h(e.destination_chain);
1089
- return await u().post("intents", {
1088
+ const n = f(e.source_chain), a = f(e.destination_chain);
1089
+ return await l().post("intents", {
1090
1090
  json: {
1091
1091
  ...e,
1092
1092
  source_chain: n,
@@ -1095,27 +1095,27 @@ class Ge {
1095
1095
  }).json();
1096
1096
  }
1097
1097
  async createForSession(e) {
1098
- const n = h(e.sourceChain);
1099
- return await u().post("modal/sessions/intents", {
1098
+ const n = f(e.sourceChain);
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 {
1114
1114
  async getFromSpecificBridge(e) {
1115
- const n = h(e.sourceChain);
1115
+ const n = f(e.sourceChain);
1116
1116
  R(n, e.tokenIn, e.amountSymbol);
1117
- const a = h(e.destinationChain);
1118
- return await u().get("quotes/single", {
1117
+ const a = f(e.destinationChain);
1118
+ return await l().get("quotes/single", {
1119
1119
  searchParams: {
1120
1120
  ...e,
1121
1121
  sourceChain: n,
@@ -1124,10 +1124,10 @@ class qe {
1124
1124
  }).json();
1125
1125
  }
1126
1126
  async getFromAllBridges(e) {
1127
- const n = h(e.sourceChain);
1127
+ const n = f(e.sourceChain);
1128
1128
  R(n, e.tokenIn, e.amountSymbol);
1129
- const a = h(e.destinationChain);
1130
- return await u().get("quotes/multiple", {
1129
+ const a = f(e.destinationChain);
1130
+ return await l().get("quotes/multiple", {
1131
1131
  searchParams: {
1132
1132
  ...e,
1133
1133
  sourceChain: n,
@@ -1136,30 +1136,30 @@ class qe {
1136
1136
  }).json();
1137
1137
  }
1138
1138
  async getBestAcrossBridges(e) {
1139
- const n = h(e.sourceChain);
1139
+ const n = f(e.sourceChain);
1140
1140
  R(n, e.tokenIn, e.amountSymbol);
1141
- const a = h(e.destinationChain);
1142
- return await u().get("quotes/best", { searchParams: {
1141
+ const a = f(e.destinationChain);
1142
+ return await l().get("quotes/best", { searchParams: {
1143
1143
  ...e,
1144
1144
  sourceChain: n,
1145
1145
  destinationChain: a
1146
1146
  } }).json();
1147
1147
  }
1148
1148
  async getAll(e) {
1149
- const n = h(e.destinationChain);
1150
- return await u().get("quotes/multi-source", { searchParams: {
1149
+ const n = f(e.destinationChain);
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
- const n = h(e.sourceChain), a = h(e.destinationChain);
1162
- return await u().get("router/optimal-route", {
1161
+ const n = f(e.sourceChain), a = f(e.destinationChain);
1162
+ return await l().get("router/optimal-route", {
1163
1163
  searchParams: {
1164
1164
  ...e,
1165
1165
  sourceChain: n,
@@ -1168,54 +1168,62 @@ 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
- const n = h(e.sourceChain), a = h(e.destinationChain);
1175
- return await u().get("router/supported-bridges/route", { searchParams: {
1174
+ const n = f(e.sourceChain), a = f(e.destinationChain);
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
- const n = h(e.destinationChain);
1203
+ const n = f(e.destinationChain);
1204
1204
  let a = _(n, e.token);
1205
- a || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), a = _(n, "USDC"));
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
1223
  const es = "modal/sessions/history";
1216
1224
  class ss {
1217
1225
  async getHistoryForSession(e) {
1218
- return u().post(es, { json: e }).json();
1226
+ return l().post(es, { json: e }).json();
1219
1227
  }
1220
1228
  }
1221
1229
  const os = {
@@ -1235,7 +1243,7 @@ const os = {
1235
1243
  export {
1236
1244
  t as AmountSymbols,
1237
1245
  os as Bridges,
1238
- l as Chainrails,
1246
+ u as Chainrails,
1239
1247
  ts as Chains,
1240
1248
  as as Tokens,
1241
1249
  is as crapi,
@@ -172,7 +172,7 @@ function de(s, e = {}) {
172
172
  }
173
173
  const le = /* @__PURE__ */ new TextEncoder();
174
174
  function ue(s, e = {}) {
175
- return typeof s == "number" || typeof s == "bigint" ? he(s, e) : typeof s == "boolean" ? ge(s, e) : w(s) ? W(s, e) : V(s, e);
175
+ return typeof s == "number" || typeof s == "bigint" ? fe(s, e) : typeof s == "boolean" ? ge(s, e) : w(s) ? W(s, e) : V(s, e);
176
176
  }
177
177
  function ge(s, e = {}) {
178
178
  const n = new Uint8Array(1);
@@ -208,7 +208,7 @@ function W(s, e = {}) {
208
208
  }
209
209
  return r;
210
210
  }
211
- function he(s, e) {
211
+ function fe(s, e) {
212
212
  const n = de(s, e);
213
213
  return W(n);
214
214
  }
@@ -217,14 +217,14 @@ function V(s, e = {}) {
217
217
  return typeof e.size == "number" ? (N(n, { size: e.size }), U(n, { dir: "right", size: e.size })) : n;
218
218
  }
219
219
  const A = /* @__PURE__ */ BigInt(2 ** 32 - 1), O = /* @__PURE__ */ BigInt(32);
220
- function fe(s, e = !1) {
220
+ function he(s, e = !1) {
221
221
  return e ? { h: Number(s & A), l: Number(s >> O & A) } : { h: Number(s >> O & A) | 0, l: Number(s & A) | 0 };
222
222
  }
223
223
  function me(s, e = !1) {
224
224
  const n = s.length;
225
225
  let a = new Uint32Array(n), o = new Uint32Array(n);
226
226
  for (let r = 0; r < n; r++) {
227
- const { h: i, l: d } = fe(s[r], e);
227
+ const { h: i, l: d } = he(s[r], e);
228
228
  [a[r], o[r]] = [i, d];
229
229
  }
230
230
  return [a, o];
@@ -458,7 +458,7 @@ const t = {
458
458
  LORDS: "LORDS"
459
459
  };
460
460
  t.USDC;
461
- const f = {
461
+ const h = {
462
462
  [c.ARBITRUM]: {
463
463
  [t.DAI]: {
464
464
  address: g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
@@ -934,18 +934,18 @@ const f = {
934
934
  }
935
935
  }
936
936
  }, as = {
937
- ARBITRUM: f[c.ARBITRUM],
938
- ARBITRUM_TESTNET: f[c.ARBITRUM_TESTNET],
939
- AVALANCHE: f[c.AVALANCHE],
940
- AVALANCHE_TESTNET: f[c.AVALANCHE_TESTNET],
941
- BASE: f[c.BASE],
942
- BASE_TESTNET: f[c.BASE_TESTNET],
943
- BSC: f[c.BSC],
944
- ETHEREUM: f[c.ETHEREUM],
945
- ETHEREUM_TESTNET: f[c.ETHEREUM_TESTNET],
946
- STARKNET: f[c.STARKNET]
937
+ ARBITRUM: h[c.ARBITRUM],
938
+ ARBITRUM_TESTNET: h[c.ARBITRUM_TESTNET],
939
+ AVALANCHE: h[c.AVALANCHE],
940
+ AVALANCHE_TESTNET: h[c.AVALANCHE_TESTNET],
941
+ BASE: h[c.BASE],
942
+ BASE_TESTNET: h[c.BASE_TESTNET],
943
+ BSC: h[c.BSC],
944
+ ETHEREUM: h[c.ETHEREUM],
945
+ ETHEREUM_TESTNET: h[c.ETHEREUM_TESTNET],
946
+ STARKNET: h[c.STARKNET]
947
947
  }, je = new Set(Object.values(c));
948
- function h(s) {
948
+ function f(s) {
949
949
  if (Ke(s))
950
950
  return s;
951
951
  const e = c[s];
@@ -957,7 +957,7 @@ function Ke(s) {
957
957
  return je.has(s);
958
958
  }
959
959
  function We(s, e) {
960
- const n = e.toLowerCase().trim(), a = f[s];
960
+ const n = e.toLowerCase().trim(), a = h[s];
961
961
  if (!a)
962
962
  throw new Error(
963
963
  `Chain not found: ${s}. The chain key must be a valid chain identifier.`
@@ -985,48 +985,48 @@ function R(s, e, n) {
985
985
  return a;
986
986
  }
987
987
  function Ve(s, e) {
988
- return f[s]?.[e];
988
+ return h[s]?.[e];
989
989
  }
990
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
- const n = h(e.source_chain), a = h(e.destination_chain);
1089
- return await u().post("intents", {
1088
+ const n = f(e.source_chain), a = f(e.destination_chain);
1089
+ return await l().post("intents", {
1090
1090
  json: {
1091
1091
  ...e,
1092
1092
  source_chain: n,
@@ -1095,27 +1095,27 @@ class Ge {
1095
1095
  }).json();
1096
1096
  }
1097
1097
  async createForSession(e) {
1098
- const n = h(e.sourceChain);
1099
- return await u().post("modal/sessions/intents", {
1098
+ const n = f(e.sourceChain);
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 {
1114
1114
  async getFromSpecificBridge(e) {
1115
- const n = h(e.sourceChain);
1115
+ const n = f(e.sourceChain);
1116
1116
  R(n, e.tokenIn, e.amountSymbol);
1117
- const a = h(e.destinationChain);
1118
- return await u().get("quotes/single", {
1117
+ const a = f(e.destinationChain);
1118
+ return await l().get("quotes/single", {
1119
1119
  searchParams: {
1120
1120
  ...e,
1121
1121
  sourceChain: n,
@@ -1124,10 +1124,10 @@ class qe {
1124
1124
  }).json();
1125
1125
  }
1126
1126
  async getFromAllBridges(e) {
1127
- const n = h(e.sourceChain);
1127
+ const n = f(e.sourceChain);
1128
1128
  R(n, e.tokenIn, e.amountSymbol);
1129
- const a = h(e.destinationChain);
1130
- return await u().get("quotes/multiple", {
1129
+ const a = f(e.destinationChain);
1130
+ return await l().get("quotes/multiple", {
1131
1131
  searchParams: {
1132
1132
  ...e,
1133
1133
  sourceChain: n,
@@ -1136,30 +1136,30 @@ class qe {
1136
1136
  }).json();
1137
1137
  }
1138
1138
  async getBestAcrossBridges(e) {
1139
- const n = h(e.sourceChain);
1139
+ const n = f(e.sourceChain);
1140
1140
  R(n, e.tokenIn, e.amountSymbol);
1141
- const a = h(e.destinationChain);
1142
- return await u().get("quotes/best", { searchParams: {
1141
+ const a = f(e.destinationChain);
1142
+ return await l().get("quotes/best", { searchParams: {
1143
1143
  ...e,
1144
1144
  sourceChain: n,
1145
1145
  destinationChain: a
1146
1146
  } }).json();
1147
1147
  }
1148
1148
  async getAll(e) {
1149
- const n = h(e.destinationChain);
1150
- return await u().get("quotes/multi-source", { searchParams: {
1149
+ const n = f(e.destinationChain);
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
- const n = h(e.sourceChain), a = h(e.destinationChain);
1162
- return await u().get("router/optimal-route", {
1161
+ const n = f(e.sourceChain), a = f(e.destinationChain);
1162
+ return await l().get("router/optimal-route", {
1163
1163
  searchParams: {
1164
1164
  ...e,
1165
1165
  sourceChain: n,
@@ -1168,54 +1168,62 @@ 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
- const n = h(e.sourceChain), a = h(e.destinationChain);
1175
- return await u().get("router/supported-bridges/route", { searchParams: {
1174
+ const n = f(e.sourceChain), a = f(e.destinationChain);
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
- const n = h(e.destinationChain);
1203
+ const n = f(e.destinationChain);
1204
1204
  let a = _(n, e.token);
1205
- a || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), a = _(n, "USDC"));
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
1223
  const es = "modal/sessions/history";
1216
1224
  class ss {
1217
1225
  async getHistoryForSession(e) {
1218
- return u().post(es, { json: e }).json();
1226
+ return l().post(es, { json: e }).json();
1219
1227
  }
1220
1228
  }
1221
1229
  const os = {
@@ -1235,7 +1243,7 @@ const os = {
1235
1243
  export {
1236
1244
  t as AmountSymbols,
1237
1245
  os as Bridges,
1238
- l as Chainrails,
1246
+ u as Chainrails,
1239
1247
  ts as Chains,
1240
1248
  as as Tokens,
1241
1249
  is as crapi,
@@ -1,2 +1,2 @@
1
1
  (function(h,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("ky")):typeof define=="function"&&define.amd?define(["exports","ky"],b):(h=typeof globalThis<"u"?globalThis:h||self,b(h.Chainrails={},h.Ky))})(this,(function(h,b){"use strict";const c={ARBITRUM:"ARBITRUM_MAINNET",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE_MAINNET",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE_MAINNET",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC_MAINNET",ETHEREUM:"ETHEREUM_MAINNET",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM_MAINNET",LISK:"LISK_MAINNET",MONAD:"MONAD_MAINNET",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM_MAINNET",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON_MAINNET",STARKNET:"STARKNET_MAINNET",STARKNET_TESTNET:"STARKNET_TESTNET"},ae={ARBITRUM:"ARBITRUM",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC",ETHEREUM:"ETHEREUM",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM",LISK:"LISK",MONAD:"MONAD",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON",STARKNET:"STARKNET",STARKNET_TESTNET:"STARKNET_TESTNET"};function k(s,{strict:e=!0}={}){return!s||typeof s!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(s):s.startsWith("0x")}function F(s){return k(s,{strict:!1})?Math.ceil((s.length-2)/2):s.length}const H="2.43.4";let R={getDocsUrl:({docsBaseUrl:s,docsPath:e="",docsSlug:n})=>e?`${s??"https://viem.sh"}${e}${n?`#${n}`:""}`:void 0,version:`viem@${H}`};class S extends Error{constructor(e,n={}){const a=n.cause instanceof S?n.cause.details:n.cause?.message?n.cause.message:n.details,o=n.cause instanceof S&&n.cause.docsPath||n.docsPath,r=R.getDocsUrl?.({...n,docsPath:o}),i=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...a?[`Details: ${a}`]:[],...R.version?[`Version: ${R.version}`]:[]].join(`
2
- `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=a,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=e,this.version=H}walk(e){return $(this,e)}}function $(s,e){return e?.(s)?s:s&&typeof s=="object"&&"cause"in s&&s.cause!==void 0?$(s.cause,e):e?null:s}class P extends S{constructor({size:e,targetSize:n,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function D(s,{dir:e,size:n=32}={}){return typeof s=="string"?oe(s,{dir:e,size:n}):ie(s,{dir:e,size:n})}function oe(s,{dir:e,size:n=32}={}){if(n===null)return s;const a=s.replace("0x","");if(a.length>n*2)throw new P({size:Math.ceil(a.length/2),targetSize:n,type:"hex"});return`0x${a[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function ie(s,{dir:e,size:n=32}={}){if(n===null)return s;if(s.length>n)throw new P({size:s.length,targetSize:n,type:"bytes"});const a=new Uint8Array(n);for(let o=0;o<n;o++){const r=e==="right";a[r?o:n-o-1]=s[r?o:s.length-o-1]}return a}class re extends S{constructor({max:e,min:n,signed:a,size:o,value:r}){super(`Number "${r}" is not in safe ${o?`${o*8}-bit ${a?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class ce extends S{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function v(s,{size:e}){if(F(s)>e)throw new ce({givenSize:F(s),maxSize:e})}function de(s,e={}){const{signed:n,size:a}=e,o=BigInt(s);let r;a?n?r=(1n<<BigInt(a)*8n-1n)-1n:r=2n**(BigInt(a)*8n)-1n:typeof s=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof r=="bigint"&&n?-r-1n:0;if(r&&o>r||o<i){const T=typeof s=="bigint"?"n":"";throw new re({max:r?`${r}${T}`:void 0,min:`${i}${T}`,signed:n,size:a,value:`${s}${T}`})}const d=`0x${(n&&o<0?(1n<<BigInt(a*8))+BigInt(o):o).toString(16)}`;return a?D(d,{size:a}):d}const le=new TextEncoder;function ue(s,e={}){return typeof s=="number"||typeof s=="bigint"?fe(s,e):typeof s=="boolean"?ge(s,e):k(s)?_(s,e):L(s,e)}function ge(s,e={}){const n=new Uint8Array(1);return n[0]=Number(s),typeof e.size=="number"?(v(n,{size:e.size}),D(n,{size:e.size})):n}const E={zero:48,nine:57,A:65,F:70,a:97,f:102};function z(s){if(s>=E.zero&&s<=E.nine)return s-E.zero;if(s>=E.A&&s<=E.F)return s-(E.A-10);if(s>=E.a&&s<=E.f)return s-(E.a-10)}function _(s,e={}){let n=s;e.size&&(v(n,{size:e.size}),n=D(n,{dir:"right",size:e.size}));let a=n.slice(2);a.length%2&&(a=`0${a}`);const o=a.length/2,r=new Uint8Array(o);for(let i=0,d=0;i<o;i++){const T=z(a.charCodeAt(d++)),p=z(a.charCodeAt(d++));if(T===void 0||p===void 0)throw new S(`Invalid byte sequence ("${a[d-2]}${a[d-1]}" in "${a}").`);r[i]=T*16+p}return r}function fe(s,e){const n=de(s,e);return _(n)}function L(s,e={}){const n=le.encode(s);return typeof e.size=="number"?(v(n,{size:e.size}),D(n,{dir:"right",size:e.size})):n}const U=BigInt(2**32-1),j=BigInt(32);function he(s,e=!1){return e?{h:Number(s&U),l:Number(s>>j&U)}:{h:Number(s>>j&U)|0,l:Number(s&U)|0}}function me(s,e=!1){const n=s.length;let a=new Uint32Array(n),o=new Uint32Array(n);for(let r=0;r<n;r++){const{h:i,l:d}=he(s[r],e);[a[r],o[r]]=[i,d]}return[a,o]}const Te=(s,e,n)=>s<<n|e>>>32-n,Ee=(s,e,n)=>e<<n|s>>>32-n,Se=(s,e,n)=>e<<n-32|s>>>64-n,pe=(s,e,n)=>s<<n-32|e>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ce(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function K(s){if(!Number.isSafeInteger(s)||s<0)throw new Error("positive integer expected, got "+s)}function y(s,...e){if(!Ce(s))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(s.length))throw new Error("Uint8Array expected of length "+e+", got length="+s.length)}function W(s,e=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(e&&s.finished)throw new Error("Hash#digest() has already been called")}function be(s,e){y(s);const n=e.outputLen;if(s.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ae(s){return new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4))}function V(...s){for(let e=0;e<s.length;e++)s[e].fill(0)}const De=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ue(s){return s<<24&4278190080|s<<8&16711680|s>>>8&65280|s>>>24&255}function ye(s){for(let e=0;e<s.length;e++)s[e]=Ue(s[e]);return s}const Y=De?s=>s:ye;function Ie(s){if(typeof s!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(s))}function q(s){return typeof s=="string"&&(s=Ie(s)),y(s),s}class ke{}function Re(s){const e=a=>s().update(q(a)).digest(),n=s();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>s(),e}const ve=BigInt(0),A=BigInt(1),we=BigInt(2),Ne=BigInt(7),Be=BigInt(256),xe=BigInt(113),G=[],X=[],Q=[];for(let s=0,e=A,n=1,a=0;s<24;s++){[n,a]=[a,(2*n+3*a)%5],G.push(2*(5*a+n)),X.push((s+1)*(s+2)/2%64);let o=ve;for(let r=0;r<7;r++)e=(e<<A^(e>>Ne)*xe)%Be,e&we&&(o^=A<<(A<<BigInt(r))-A);Q.push(o)}const J=me(Q,!0),Me=J[0],Oe=J[1],Z=(s,e,n)=>n>32?Se(s,e,n):Te(s,e,n),ee=(s,e,n)=>n>32?pe(s,e,n):Ee(s,e,n);function Fe(s,e=24){const n=new Uint32Array(10);for(let a=24-e;a<24;a++){for(let i=0;i<10;i++)n[i]=s[i]^s[i+10]^s[i+20]^s[i+30]^s[i+40];for(let i=0;i<10;i+=2){const d=(i+8)%10,T=(i+2)%10,p=n[T],C=n[T+1],os=Z(p,C,1)^n[d],is=ee(p,C,1)^n[d+1];for(let I=0;I<50;I+=10)s[i+I]^=os,s[i+I+1]^=is}let o=s[2],r=s[3];for(let i=0;i<24;i++){const d=X[i],T=Z(o,r,d),p=ee(o,r,d),C=G[i];o=s[C],r=s[C+1],s[C]=T,s[C+1]=p}for(let i=0;i<50;i+=10){for(let d=0;d<10;d++)n[d]=s[i+d];for(let d=0;d<10;d++)s[i+d]^=~n[(d+2)%10]&n[(d+4)%10]}s[0]^=Me[a],s[1]^=Oe[a]}V(n)}class w extends ke{constructor(e,n,a,o=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=a,this.enableXOF=o,this.rounds=r,K(a),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Ae(this.state)}clone(){return this._cloneInto()}keccak(){Y(this.state32),Fe(this.state32,this.rounds),Y(this.state32),this.posOut=0,this.pos=0}update(e){W(this),e=q(e),y(e);const{blockLen:n,state:a}=this,o=e.length;for(let r=0;r<o;){const i=Math.min(n-this.pos,o-r);for(let d=0;d<i;d++)a[this.pos++]^=e[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:a,blockLen:o}=this;e[a]^=n,(n&128)!==0&&a===o-1&&this.keccak(),e[o-1]^=128,this.keccak()}writeInto(e){W(this,!1),y(e),this.finish();const n=this.state,{blockLen:a}=this;for(let o=0,r=e.length;o<r;){this.posOut>=a&&this.keccak();const i=Math.min(a-this.posOut,r-o);e.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return K(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(be(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,V(this.state)}_cloneInto(e){const{blockLen:n,suffix:a,outputLen:o,rounds:r,enableXOF:i}=this;return e||(e=new w(n,a,o,i,r)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=r,e.suffix=a,e.outputLen=o,e.enableXOF=i,e.destroyed=this.destroyed,e}}const He=(s,e,n)=>Re(()=>new w(e,s,n)),$e=He(1,136,256/8);function Pe(s,e){return $e(k(s,{strict:!1})?ue(s):s)}class ze extends S{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class se extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const a=this.keys().next().value;a&&this.delete(a)}return this}}const N=new se(8192);function ne(s,e){if(N.has(`${s}.${e}`))return N.get(`${s}.${e}`);const n=s.substring(2).toLowerCase(),a=Pe(L(n)),o=n.split("");for(let i=0;i<40;i+=2)a[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(a[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const r=`0x${o.join("")}`;return N.set(`${s}.${e}`,r),r}function g(s,e){if(!Le(s,{strict:!1}))throw new ze({address:s});return ne(s,e)}const _e=/^0x[a-fA-F0-9]{40}$/,B=new se(8192);function Le(s,e){const{strict:n=!0}=e??{},a=`${s}.${n}`;if(B.has(a))return B.get(a);const o=_e.test(s)?s.toLowerCase()===s?!0:n?ne(s)===s:!0:!1;return B.set(a,o),o}const t={USDC:"USDC",USDT:"USDT",DAI:"DAI",BUSD:"BUSD",EURC:"EURC",ETH:"ETH",WETH:"WETH",STRK:"STRK",BNB:"BNB",LORDS:"LORDS"};t.USDC;const m={[c.ARBITRUM]:{[t.DAI]:{address:g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.USDC]:{address:g("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:g("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:g("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.ARBITRUM_TESTNET]:{[t.USDC]:{address:g("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.AVALANCHE]:{[t.DAI]:{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.USDC]:{address:g("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.AVALANCHE_TESTNET]:{[t.USDC]:{address:g("0x5425890298aed601595a70AB815c96711a31Bc65"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.BASE]:{[t.DAI]:{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.EURC]:{address:"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",symbol:t.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[t.USDC]:{address:g("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.WETH]:{address:g("0x4200000000000000000000000000000000000006"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.BASE_TESTNET]:{[t.USDC]:{address:g("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.BSC]:{[t.BNB]:{address:"0x0000000000000000000000000000000000000000",symbol:t.BNB,name:"BNB",decimals:18,logoURI:"/images/chains/bsc.webp",nativeToken:!0},[t.BUSD]:{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:t.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[t.DAI]:{address:"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[t.USDC]:{address:g("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:t.USDC,decimals:18,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x55d398326f99059fF775485246999027B3197955",symbol:t.USDT,name:"Tether USD",decimals:18,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[c.ETHEREUM]:{[t.BUSD]:{address:"0x4Fabb145d64652a948d72533023f6E7A623C7C53",symbol:t.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[t.DAI]:{address:g("0x6B175474E89094C44Da98b954EedeAC495271d0F"),symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.EURC]:{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:t.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[t.STRK]:{address:"0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",symbol:t.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[t.USDC]:{address:g("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:g("0xdAC17F958D2ee523a2206206994597C13D831ec7"),symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:g("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.ETHEREUM_TESTNET]:{[t.USDC]:{address:g("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:t.USDC,decimals:6,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[c.HYPEREVM]:{[t.USDC]:{address:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.LISK]:{[t.USDC]:{address:"0xF242275d3a6527d877f2c927a82D9b057609cc71",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.MONAD]:{[t.USDC]:{address:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.MONAD_TESTNET]:{[t.USDC]:{address:"0x534b2f3A21130d7a60830c2Df862319e593943A3",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.OPTIMISM]:{[t.DAI]:{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.USDC]:{address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x4200000000000000000000000000000000000006",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.OPTIMISM_TESTNET]:{[t.USDC]:{address:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[c.POLYGON]:{[t.DAI]:{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.USDC]:{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[c.STARKNET]:{[t.DAI]:{address:"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[t.LORDS]:{address:"0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",symbol:t.LORDS,name:"LORDS Token",decimals:18,logoURI:"/images/tokens/lords.png",nativeToken:!1},[t.STRK]:{address:"0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",symbol:t.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[t.USDC]:{address:"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[c.STARKNET_TESTNET]:{[t.USDC]:{address:"0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}}},je={ARBITRUM:m[c.ARBITRUM],ARBITRUM_TESTNET:m[c.ARBITRUM_TESTNET],AVALANCHE:m[c.AVALANCHE],AVALANCHE_TESTNET:m[c.AVALANCHE_TESTNET],BASE:m[c.BASE],BASE_TESTNET:m[c.BASE_TESTNET],BSC:m[c.BSC],ETHEREUM:m[c.ETHEREUM],ETHEREUM_TESTNET:m[c.ETHEREUM_TESTNET],STARKNET:m[c.STARKNET]},Ke=new Set(Object.values(c));function f(s){if(We(s))return s;const e=c[s];if(!e)throw new Error(`Invalid chain: ${s}. Chain must be a valid chain alias or internal chain value from Chains.`);return e}function We(s){return Ke.has(s)}function Ve(s,e){const n=e.toLowerCase().trim(),a=m[s];if(!a)throw new Error(`Chain not found: ${s}. The chain key must be a valid chain identifier.`);let o;for(const r in a){const i=a[r];if(i&&i.address.toLowerCase()===n.toLowerCase()){o=i;break}}if(!o)throw new Error(`Token address mismatch: address ${e} does not exist on chain ${s}. The token address must be a valid token address on the specified chain.`);return o}function x(s,e,n){const a=Ve(s,e);if(a.symbol!==n)throw new Error(`Token address and symbol mismatch: address ${e} on chain ${s} corresponds to token "${a.symbol}", but expected "${n}". The token address must correspond to a token with the expected symbol on the specified chain.`);return a}function Ye(s,e){return m[s]?.[e]}function te(s,e){return Ye(s,e)?.address}var M=(s=>(s.PRODUCTION="production",s.STAGING="staging",s))(M||{});class l{constructor({api_key:e,env:n,seesion_token:a,props:o}){this.api_key=e||"",this.sessionToken=a||"",this.env=n??M.PRODUCTION,this.props=o}static async config(e){if(!l.app){if(!e)throw new Error("Please provide an api_key");l.app=new l(e)}return e&&(e.api_key!==void 0&&(l.app.api_key=e.api_key),e.seesion_token!==void 0&&(l.app.sessionToken=e.seesion_token),e.env!==void 0&&(l.app.env=e.env),e.props!==void 0&&(l.app.props=e.props)),l.app}static getApiKey(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.api_key}static getSessionToken(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.sessionToken}static getProps(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.props}static getEnv(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return l.app.env==="internal"?"staging":l.app.env}static getBaseUrl(){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(l.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(e){if(!l.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const n=l.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",a=Number(e),o=e&&!isNaN(Number(e))&&a>0?"/pay/":"/deposit/",r=`${e&&!isNaN(Number(e))&&a>0?a*100:""}`;return n+o+r}}let O=null;function qe(){O=b.create({prefixUrl:l.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[s=>{const e=l.getSessionToken()||l.getApiKey();s.headers.set("Authorization",`Bearer ${e}`)}],afterResponse:[(s,e,n)=>n]},retry:{limit:2}})}function u(){return O||qe(),O}class Ge{async getById(e){return await u().get("intents/"+e).json()}async getForSender(e){return await u().get("intents/user/"+e).json()}async getForAddress(e){return await u().get("intents/address/"+e).json()}async getForSession(e){return await u().get("modal/sessions/intents/"+e).json()}async getAll(e){return await u().get("intents",{searchParams:e}).json()}async create(e){const n=f(e.source_chain),a=f(e.destination_chain);return await u().post("intents",{json:{...e,source_chain:n,destination_chain:a}}).json()}async createForSession(e){const n=f(e.sourceChain);return await u().post("modal/sessions/intents",{json:{...e,sourceChain:n}}).json()}async update(e,n){return await u().post("intents",{json:n}).json()}async triggerProcessing(e){return await u().post(`intents/${e}/trigger-processing`).json()}async triggerProcessingForSession(e){return await u().post(`modal/sessions/intents/${e}/process`).json()}}class Xe{async getFromSpecificBridge(e){const n=f(e.sourceChain);x(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await u().get("quotes/single",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getFromAllBridges(e){const n=f(e.sourceChain);x(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await u().get("quotes/multiple",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getBestAcrossBridges(e){const n=f(e.sourceChain);x(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await u().get("quotes/best",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAll(e){const n=f(e.destinationChain);return await u().get("quotes/multi-source",{searchParams:{...e,destinationChain:n}}).json()}async getAllForSession(e){return await u().get("modal/sessions/quotes",{searchParams:e}).json()}}class Qe{async getOptimalRoutes(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await u().get("router/optimal-route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAllSupportedBridges(){return await u().get("router/supported-bridges/all").json()}async getSupportedBridges(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await u().get("router/supported-bridges/route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getSupportedRoutes(e){return await u().get("router/supported-routes/bridge/"+e).json()}}class Je{async getSupported(e){return await u().get("chains",{searchParams:e}).json()}async getBalance(e){return await u().get(`chains/balances/${e.address}`,{searchParams:e}).json()}}class Ze{async getClientInfo(){return await u().get("client/auth/client-info").json()}async getClientInfoForSession(){return await u().get("modal/sessions/client").json()}}class es{async getSessionToken(e){const n=f(e.destinationChain);let a=te(n,e.token);a||(console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`),a=te(n,"USDC"));const o={recipient:e.recipient,tokenOut:a,destinationChain:n,amount:e.amount};return u().post("modal/sessions",{json:o}).json().then(r=>({...r,amount:o.amount}))}}const ss="modal/sessions/history";class ns{async getHistoryForSession(e){return u().post(ss,{json:e}).json()}}const ts={ACROSS:"ACROSS",CCTP:"CCTP",GATEWAY:"GATEWAY",RHINOFI:"RHINOFI"},as={router:new Qe,quotes:new Xe,intents:new Ge,chains:new Je,client:new Ze,auth:new es,history:new ns};h.AmountSymbols=t,h.Bridges=ts,h.Chainrails=l,h.Chains=ae,h.Tokens=je,h.crapi=as,h.environment=M,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
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"})}));
@@ -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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chainrails/sdk",
3
3
  "sideEffects": false,
4
- "version": "0.3.4",
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",