@imtbl/checkout-sdk 2.1.7 → 2.1.8-alpha.1

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.
@@ -1,16 +1,17 @@
1
1
  // src/widgets/definitions/events/widgets.ts
2
- var rn = /* @__PURE__ */ ((p) => {
3
- p["IMTBL_WIDGETS_PROVIDER"] = "imtbl-widgets-provider";
4
- p["IMTBL_CONNECT_WIDGET_EVENT"] = "imtbl-connect-widget";
5
- p["IMTBL_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
6
- p["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
7
- p["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
8
- p["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
9
- p["IMTBL_SALE_WIDGET_EVENT"] = "imtbl-sale-widget";
10
- p["IMTBL_COMMERCE_WIDGET_EVENT"] = "imtbl-commerce-widget";
11
- p["IMTBL_ADD_TOKENS_WIDGET_EVENT"] = "imtbl-add-tokens-widget";
12
- p["IMTBL_PURCHASE_WIDGET_EVENT"] = "imtbl-purchase-widget";
13
- return p;
2
+ var rn = /* @__PURE__ */ ((u) => {
3
+ u["IMTBL_WIDGETS_PROVIDER"] = "imtbl-widgets-provider";
4
+ u["IMTBL_CONNECT_WIDGET_EVENT"] = "imtbl-connect-widget";
5
+ u["IMTBL_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
6
+ u["IMTBL_SWAP_WIDGET_EVENT"] = "imtbl-swap-widget";
7
+ u["IMTBL_BRIDGE_WIDGET_EVENT"] = "imtbl-bridge-widget";
8
+ u["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
9
+ u["IMTBL_SALE_WIDGET_EVENT"] = "imtbl-sale-widget";
10
+ u["IMTBL_COMMERCE_WIDGET_EVENT"] = "imtbl-commerce-widget";
11
+ u["IMTBL_ADD_TOKENS_WIDGET_EVENT"] = "imtbl-add-tokens-widget";
12
+ u["IMTBL_PURCHASE_WIDGET_EVENT"] = "imtbl-purchase-widget";
13
+ u["IMTBL_TRANSFER_WIDGET_EVENT"] = "imtbl-transfer-widget";
14
+ return u;
14
15
  })(rn || {});
15
16
  var nn = /* @__PURE__ */ ((e) => {
16
17
  e["PROVIDER_UPDATED"] = "PROVIDER_UPDATED";
@@ -69,14 +70,14 @@ var dn = /* @__PURE__ */ ((n) => {
69
70
  })(dn || {});
70
71
 
71
72
  // src/widgets/definitions/events/bridge.ts
72
- var ln = /* @__PURE__ */ ((i) => {
73
- i["CLOSE_WIDGET"] = "close-widget";
74
- i["FAILURE"] = "failure";
75
- i["TRANSACTION_SENT"] = "transaction-sent";
76
- i["LANGUAGE_CHANGED"] = "language-changed";
77
- i["CLAIM_WITHDRAWAL_SUCCESS"] = "claim-withdrawal-success";
78
- i["CLAIM_WITHDRAWAL_FAILURE"] = "claim-withdrawal-failure";
79
- return i;
73
+ var ln = /* @__PURE__ */ ((s) => {
74
+ s["CLOSE_WIDGET"] = "close-widget";
75
+ s["FAILURE"] = "failure";
76
+ s["TRANSACTION_SENT"] = "transaction-sent";
77
+ s["LANGUAGE_CHANGED"] = "language-changed";
78
+ s["CLAIM_WITHDRAWAL_SUCCESS"] = "claim-withdrawal-success";
79
+ s["CLAIM_WITHDRAWAL_FAILURE"] = "claim-withdrawal-failure";
80
+ return s;
80
81
  })(ln || {});
81
82
 
82
83
  // src/widgets/definitions/events/orchestration.ts
@@ -102,15 +103,15 @@ var un = /* @__PURE__ */ ((o) => {
102
103
  })(un || {});
103
104
 
104
105
  // src/widgets/definitions/events/commerce.ts
105
- var mn = /* @__PURE__ */ ((s) => {
106
- s["INITIALISED"] = "INITIALISED";
107
- s["PROVIDER_UPDATED"] = "PROVIDER_UPDATED";
108
- s["CLOSE"] = "CLOSE";
109
- s["SUCCESS"] = "SUCCESS";
110
- s["FAILURE"] = "FAILURE";
111
- s["DISCONNECTED"] = "DISCONNECTED";
112
- s["USER_ACTION"] = "USER_ACTION";
113
- return s;
106
+ var mn = /* @__PURE__ */ ((i) => {
107
+ i["INITIALISED"] = "INITIALISED";
108
+ i["PROVIDER_UPDATED"] = "PROVIDER_UPDATED";
109
+ i["CLOSE"] = "CLOSE";
110
+ i["SUCCESS"] = "SUCCESS";
111
+ i["FAILURE"] = "FAILURE";
112
+ i["DISCONNECTED"] = "DISCONNECTED";
113
+ i["USER_ACTION"] = "USER_ACTION";
114
+ return i;
114
115
  })(mn || {});
115
116
  var fn = /* @__PURE__ */ ((d) => {
116
117
  d["SWAP_SUCCESS"] = "SWAP_SUCCESS";
@@ -161,61 +162,72 @@ var Cn = /* @__PURE__ */ ((o) => {
161
162
  return o;
162
163
  })(Cn || {});
163
164
 
165
+ // src/widgets/definitions/events/transfer.ts
166
+ var Tn = /* @__PURE__ */ ((o) => {
167
+ o["CLOSE_WIDGET"] = "close-widget";
168
+ o["REJECTED"] = "rejected";
169
+ o["SUCCESS"] = "success";
170
+ o["FAILURE"] = "failure";
171
+ return o;
172
+ })(Tn || {});
173
+
164
174
  // src/widgets/definitions/types.ts
165
- var In = /* @__PURE__ */ ((d) => {
166
- d["CONNECT"] = "connect";
167
- d["WALLET"] = "wallet";
168
- d["SWAP"] = "swap";
169
- d["BRIDGE"] = "bridge";
170
- d["ONRAMP"] = "onramp";
171
- d["SALE"] = "sale";
172
- d["IMMUTABLE_COMMERCE"] = "immutableCommerce";
173
- d["ADD_TOKENS"] = "addTokens";
174
- d["PURCHASE"] = "purchase";
175
- return d;
175
+ var In = /* @__PURE__ */ ((p) => {
176
+ p["CONNECT"] = "connect";
177
+ p["WALLET"] = "wallet";
178
+ p["SWAP"] = "swap";
179
+ p["BRIDGE"] = "bridge";
180
+ p["ONRAMP"] = "onramp";
181
+ p["SALE"] = "sale";
182
+ p["IMMUTABLE_COMMERCE"] = "immutableCommerce";
183
+ p["ADD_TOKENS"] = "addTokens";
184
+ p["PURCHASE"] = "purchase";
185
+ p["TRANSFER"] = "transfer";
186
+ return p;
176
187
  })(In || {});
177
188
 
178
189
  // src/widgets/definitions/parameters/connect.ts
179
- var Tn = /* @__PURE__ */ ((t) => {
190
+ var hn = /* @__PURE__ */ ((t) => {
180
191
  t["LAYER1"] = "LAYER1";
181
192
  t["LAYER2"] = "LAYER2";
182
193
  return t;
183
- })(Tn || {});
194
+ })(hn || {});
184
195
 
185
196
  // src/widgets/definitions/parameters/swap.ts
186
- var hn = /* @__PURE__ */ ((t) => {
197
+ var An = /* @__PURE__ */ ((t) => {
187
198
  t["FROM"] = "FROM";
188
199
  t["TO"] = "TO";
189
200
  return t;
190
- })(hn || {});
201
+ })(An || {});
191
202
 
192
203
  // src/widgets/definitions/parameters/commerce.ts
193
- var An = /* @__PURE__ */ ((c) => {
194
- c["CONNECT"] = "CONNECT";
195
- c["WALLET"] = "WALLET";
196
- c["SALE"] = "SALE";
197
- c["SWAP"] = "SWAP";
198
- c["BRIDGE"] = "BRIDGE";
199
- c["ONRAMP"] = "ONRAMP";
200
- c["ADD_TOKENS"] = "ADD_TOKENS";
201
- c["PURCHASE"] = "PURCHASE";
202
- return c;
203
- })(An || {});
204
+ var yn = /* @__PURE__ */ ((d) => {
205
+ d["CONNECT"] = "CONNECT";
206
+ d["WALLET"] = "WALLET";
207
+ d["SALE"] = "SALE";
208
+ d["SWAP"] = "SWAP";
209
+ d["BRIDGE"] = "BRIDGE";
210
+ d["ONRAMP"] = "ONRAMP";
211
+ d["ADD_TOKENS"] = "ADD_TOKENS";
212
+ d["PURCHASE"] = "PURCHASE";
213
+ d["TRANSFER"] = "TRANSFER";
214
+ return d;
215
+ })(yn || {});
204
216
 
205
217
  // src/widgets/definitions/configurations/theme.ts
206
- var yn = /* @__PURE__ */ ((t) => {
218
+ var wn = /* @__PURE__ */ ((t) => {
207
219
  t["LIGHT"] = "light";
208
220
  t["DARK"] = "dark";
209
221
  return t;
210
- })(yn || {});
222
+ })(wn || {});
211
223
 
212
224
  // src/sdk.ts
213
- import { Environment as Wa } from "@imtbl/config";
225
+ import { Environment as Ua } from "@imtbl/config";
214
226
 
215
227
  // src/api/http/httpClient.ts
216
- import wn from "axios";
217
- var Sn = "pk_imapik-";
218
- var Pn = [
228
+ import Sn from "axios";
229
+ var Pn = "pk_imapik-";
230
+ var kn = [
219
231
  "https://checkout-api.dev.immutable.com",
220
232
  "https://checkout-api.sandbox.immutable.com",
221
233
  "https://checkout-api.immutable.com"
@@ -225,19 +237,19 @@ var de = class {
225
237
  axiosInstance;
226
238
  constructor(e) {
227
239
  this.config = e;
228
- this.axiosInstance = wn.create();
240
+ this.axiosInstance = Sn.create();
229
241
  this.setupInterceptors();
230
242
  }
231
243
  // eslint-disable-next-line class-methods-use-this
232
244
  shouldAddPublishableKey(e) {
233
- return Pn.some((t) => e.startsWith(t));
245
+ return kn.some((t) => e.startsWith(t));
234
246
  }
235
247
  setupInterceptors() {
236
248
  this.axiosInstance.interceptors.request.use(
237
249
  (e) => {
238
250
  const t = this.config?.baseConfig?.publishableKey;
239
251
  if (t && this.shouldAddPublishableKey(e.url || "")) {
240
- if (!t.startsWith(Sn)) {
252
+ if (!t.startsWith(Pn)) {
241
253
  throw new Error(
242
254
  "Invalid Publishable key. Create your Publishable key in Immutable developer hub. https://hub.immutable.com"
243
255
  );
@@ -287,7 +299,7 @@ var de = class {
287
299
 
288
300
  // src/availability/availability.ts
289
301
  import { Environment as Dt } from "@imtbl/config";
290
- import Nn from "axios";
302
+ import _n from "axios";
291
303
 
292
304
  // src/errors/checkoutError.ts
293
305
  var w = /* @__PURE__ */ ((h) => {
@@ -404,7 +416,7 @@ var we = {
404
416
  decimals: G,
405
417
  address: _
406
418
  };
407
- var kn = {
419
+ var vn = {
408
420
  name: "tIMX",
409
421
  symbol: "tIMX",
410
422
  decimals: G,
@@ -475,7 +487,7 @@ var ye = /* @__PURE__ */ new Map([
475
487
  chainIdHex: `0x${13473 .toString(16)}`,
476
488
  chainName: "Immutable zkEVM Testnet",
477
489
  rpcUrls: ["https://rpc.testnet.immutable.com"],
478
- nativeCurrency: kn
490
+ nativeCurrency: vn
479
491
  }
480
492
  ]
481
493
  ]);
@@ -789,8 +801,8 @@ var nt = {
789
801
  };
790
802
 
791
803
  // src/env/env.ts
792
- var vn = "2.1.7";
793
- var le = () => vn;
804
+ var Nn = "2.1.8-alpha.1";
805
+ var le = () => Nn;
794
806
 
795
807
  // src/availability/availability.ts
796
808
  var Pe = (r, e) => {
@@ -802,7 +814,7 @@ var Pe = (r, e) => {
802
814
  const n = async () => {
803
815
  let o;
804
816
  try {
805
- o = await Nn.post(`${t()}/v1/availability/checkout/swap`);
817
+ o = await _n.post(`${t()}/v1/availability/checkout/swap`);
806
818
  } catch (a) {
807
819
  o = a.response;
808
820
  if (o.status === 403) return false;
@@ -821,7 +833,7 @@ var Pe = (r, e) => {
821
833
 
822
834
  // src/balances/balances.ts
823
835
  import { HttpStatusCode as dt } from "axios";
824
- import { Contract as qn, formatUnits as pt } from "ethers";
836
+ import { Contract as jn, formatUnits as pt } from "ethers";
825
837
 
826
838
  // src/types/gasEstimate.ts
827
839
  var ot = /* @__PURE__ */ ((t) => {
@@ -853,7 +865,7 @@ var Ft = /* @__PURE__ */ ((e) => {
853
865
 
854
866
  // src/types/provider.ts
855
867
  import {
856
- BrowserProvider as _n
868
+ BrowserProvider as On
857
869
  } from "ethers";
858
870
  var ue = /* @__PURE__ */ ((n) => {
859
871
  n["PASSPORT"] = "passport";
@@ -871,7 +883,7 @@ var Ut = {
871
883
  allowMistmatchedChainId: false,
872
884
  allowUnsupportedProvider: false
873
885
  };
874
- var b = class extends _n {
886
+ var b = class extends On {
875
887
  ethereumProvider;
876
888
  // eslint-disable-next-line max-len
877
889
  constructor(e, t, n) {
@@ -938,7 +950,7 @@ var Gt = /* @__PURE__ */ ((e) => {
938
950
  })(Gt || {});
939
951
 
940
952
  // src/provider/getUnderlyingProvider.ts
941
- async function On(r) {
953
+ async function Mn(r) {
942
954
  if (!r.send) {
943
955
  throw new l(
944
956
  "Parsed provider is not a valid WrappedBrowserProvider",
@@ -956,17 +968,17 @@ async function Re(r) {
956
968
  if (e.chainId && typeof e.chainId === "bigint") {
957
969
  return e.chainId;
958
970
  }
959
- return On(r);
971
+ return Mn(r);
960
972
  }
961
973
 
962
974
  // src/network/network.ts
963
- var Mn = 4902;
964
- async function Bn(r, e, t) {
975
+ var Bn = 4902;
976
+ async function xn(r, e, t) {
965
977
  return await e.send("wallet_switchEthereumChain", [
966
978
  { chainId: r.get(t)?.chainIdHex }
967
979
  ]);
968
980
  }
969
- async function it(r, e, t) {
981
+ async function st(r, e, t) {
970
982
  if (e.send) {
971
983
  const n = r.get(t);
972
984
  const o = {
@@ -988,16 +1000,16 @@ async function Y(r, { type: e = "all", exclude: t }) {
988
1000
  if (!o) {
989
1001
  console.warn("No allowed networks configured");
990
1002
  }
991
- const a = (o || []).filter((s) => {
1003
+ const a = (o || []).filter((i) => {
992
1004
  const c = e === "all";
993
- const d = !(t || []).map((p) => p.chainId).includes(s.chainId);
1005
+ const d = !(t || []).map((p) => p.chainId).includes(i.chainId);
994
1006
  return c && d;
995
1007
  });
996
- const i = [];
997
- a.forEach((s) => {
998
- const c = n.get(s.chainId);
1008
+ const s = [];
1009
+ a.forEach((i) => {
1010
+ const c = n.get(i.chainId);
999
1011
  if (c) {
1000
- i.push({
1012
+ s.push({
1001
1013
  name: c.chainName,
1002
1014
  chainId: parseInt(c.chainIdHex, 16),
1003
1015
  nativeCurrency: c.nativeCurrency,
@@ -1006,7 +1018,7 @@ async function Y(r, { type: e = "all", exclude: t }) {
1006
1018
  }
1007
1019
  });
1008
1020
  return {
1009
- networks: i
1021
+ networks: s
1010
1022
  };
1011
1023
  }
1012
1024
  async function Ce(r, e) {
@@ -1062,7 +1074,7 @@ async function jt(r, e, t) {
1062
1074
  }
1063
1075
  try {
1064
1076
  if (e && "ethereumProvider" in e) {
1065
- await Bn(n, e, t);
1077
+ await xn(n, e, t);
1066
1078
  } else {
1067
1079
  throw new l(
1068
1080
  "Incorrect provider type",
@@ -1071,10 +1083,10 @@ async function jt(r, e, t) {
1071
1083
  }
1072
1084
  } catch (c) {
1073
1085
  console.error(c);
1074
- if (c.code === Mn) {
1086
+ if (c.code === Bn) {
1075
1087
  try {
1076
1088
  if ("ethereumProvider" in e) {
1077
- await it(n, e, t);
1089
+ await st(n, e, t);
1078
1090
  } else {
1079
1091
  throw new l(
1080
1092
  "Incorrect provider type",
@@ -1096,22 +1108,22 @@ async function jt(r, e, t) {
1096
1108
  }
1097
1109
  }
1098
1110
  const a = new b(e.ethereumProvider);
1099
- const i = await a.getNetwork();
1100
- if (Number(i.chainId) !== t) {
1111
+ const s = await a.getNetwork();
1112
+ if (Number(s.chainId) !== t) {
1101
1113
  throw new l(
1102
1114
  "User cancelled switch network request",
1103
1115
  "USER_REJECTED_REQUEST_ERROR"
1104
1116
  );
1105
1117
  }
1106
- const s = await Ce(r, a);
1118
+ const i = await Ce(r, a);
1107
1119
  return {
1108
- network: s,
1120
+ network: i,
1109
1121
  provider: a
1110
1122
  };
1111
1123
  }
1112
1124
 
1113
1125
  // src/tokens/tokens.ts
1114
- import { Contract as Fn } from "ethers";
1126
+ import { Contract as Wn } from "ethers";
1115
1127
 
1116
1128
  // src/config/config.ts
1117
1129
  import { Environment as Kt } from "@imtbl/config";
@@ -1178,7 +1190,7 @@ var ve = class {
1178
1190
 
1179
1191
  // src/config/tokensFetcher.ts
1180
1192
  import { Environment as zt } from "@imtbl/config";
1181
- var xn = "0x0000000000000000000000000000000000000eee";
1193
+ var bn = "0x0000000000000000000000000000000000000eee";
1182
1194
  var Ne = class {
1183
1195
  httpClient;
1184
1196
  remoteConfig;
@@ -1257,7 +1269,7 @@ var Ne = class {
1257
1269
  if (!t[a]) {
1258
1270
  t[a] = [];
1259
1271
  }
1260
- const i = {
1272
+ const s = {
1261
1273
  address: o.contract_address.toLowerCase(),
1262
1274
  decimals: o.decimals,
1263
1275
  name: o.name,
@@ -1265,21 +1277,21 @@ var Ne = class {
1265
1277
  icon: o.image_url ?? void 0,
1266
1278
  bridge: o.bridge_used ?? null
1267
1279
  };
1268
- t[a]?.push(i);
1269
- const s = parseInt(
1280
+ t[a]?.push(s);
1281
+ const i = parseInt(
1270
1282
  o.root_chain_id?.split("eip155:").pop() || "",
1271
1283
  10
1272
1284
  );
1273
1285
  let c = o.root_contract_address?.toLowerCase();
1274
- if (s && c) {
1275
- if (!t[s]) {
1276
- t[s] = [];
1286
+ if (i && c) {
1287
+ if (!t[i]) {
1288
+ t[i] = [];
1277
1289
  }
1278
- if (c === xn) {
1290
+ if (c === bn) {
1279
1291
  c = "native";
1280
1292
  }
1281
- t[s]?.push({
1282
- ...i,
1293
+ t[i]?.push({
1294
+ ...s,
1283
1295
  address: c
1284
1296
  });
1285
1297
  }
@@ -1310,14 +1322,14 @@ var Ne = class {
1310
1322
  };
1311
1323
 
1312
1324
  // src/config/config.ts
1313
- var st = class extends Error {
1325
+ var it = class extends Error {
1314
1326
  message;
1315
1327
  constructor(e) {
1316
1328
  super(e);
1317
1329
  this.message = e;
1318
1330
  }
1319
1331
  };
1320
- var bn = (r, e) => {
1332
+ var Ln = (r, e) => {
1321
1333
  if (e) return Lt;
1322
1334
  if (r) return Ae;
1323
1335
  return ye;
@@ -1331,7 +1343,7 @@ var A = (r) => {
1331
1343
  if (r.isProduction) return 13371;
1332
1344
  return 13473;
1333
1345
  };
1334
- var Ie = class {
1346
+ var Te = class {
1335
1347
  // This is a hidden feature that is only available
1336
1348
  // when building the project from source code.
1337
1349
  // This will be used to get around the lack of
@@ -1349,7 +1361,7 @@ var Ie = class {
1349
1361
  overrides;
1350
1362
  constructor(e, t) {
1351
1363
  if (!Object.values(Kt).includes(e.baseConfig.environment)) {
1352
- throw new st(
1364
+ throw new it(
1353
1365
  "Invalid checkout configuration of environment"
1354
1366
  );
1355
1367
  }
@@ -1359,7 +1371,7 @@ var Ie = class {
1359
1371
  this.isSwapEnabled = e.swap?.enable ?? Bt;
1360
1372
  this.isBridgeEnabled = e.bridge?.enable ?? xt;
1361
1373
  this.publishableKey = e.publishableKey ?? "<no-publishable-key>";
1362
- this.networkMap = bn(this.isProduction, this.isDevelopment);
1374
+ this.networkMap = Ln(this.isProduction, this.isDevelopment);
1363
1375
  this.remote = new ve(t, {
1364
1376
  isDevelopment: this.isDevelopment,
1365
1377
  isProduction: this.isProduction
@@ -1377,9 +1389,9 @@ var Ie = class {
1377
1389
  };
1378
1390
 
1379
1391
  // src/utils/utils.ts
1380
- var I = (r = "", e = "") => r.toLowerCase() === e.toLowerCase();
1392
+ var T = (r = "", e = "") => r.toLowerCase() === e.toLowerCase();
1381
1393
  var Qt = (r) => r === 15003 || r === 13473 || r === 13371;
1382
- var Ln = (r, e) => {
1394
+ var Dn = (r, e) => {
1383
1395
  const t = r.indexOf(".");
1384
1396
  const n = r.substring(t + e + 1);
1385
1397
  if (n && parseFloat(n) >= 1) {
@@ -1392,12 +1404,12 @@ var Ln = (r, e) => {
1392
1404
  var Q = (r, e = Ot) => {
1393
1405
  const t = r.indexOf(".");
1394
1406
  if (t === -1) return r;
1395
- const n = Ln(r, e);
1407
+ const n = Dn(r, e);
1396
1408
  return n;
1397
1409
  };
1398
1410
 
1399
1411
  // src/tokens/tokens.ts
1400
- var Wn = "native";
1412
+ var Un = "native";
1401
1413
  var H = async (r, {
1402
1414
  type: e = "all",
1403
1415
  chainId: t,
@@ -1405,14 +1417,14 @@ var H = async (r, {
1405
1417
  }) => {
1406
1418
  let o = [];
1407
1419
  let a;
1408
- let i;
1409
- const s = t ?? N(r);
1420
+ let s;
1421
+ const i = t ?? N(r);
1410
1422
  const c = A(r);
1411
1423
  switch (e) {
1412
1424
  case "swap":
1413
1425
  o = await r.tokens.getTokensConfig(c);
1414
- i = ((await r.remote.getConfig("dex"))?.blocklist || []).map((d) => d.address.toLowerCase());
1415
- o = o.filter((d) => d.address && !i.includes(d.address));
1426
+ s = ((await r.remote.getConfig("dex"))?.blocklist || []).map((d) => d.address.toLowerCase());
1427
+ o = o.filter((d) => d.address && !s.includes(d.address));
1416
1428
  break;
1417
1429
  case "onramp":
1418
1430
  a = await r.remote.getConfig("onramp");
@@ -1420,22 +1432,22 @@ var H = async (r, {
1420
1432
  o = a["201811419111"]?.tokens || [];
1421
1433
  break;
1422
1434
  case "bridge":
1423
- o = (await r.tokens.getTokensConfig(s)).filter((d) => d.bridge === Wn);
1435
+ o = (await r.tokens.getTokensConfig(i)).filter((d) => d.bridge === Un);
1424
1436
  break;
1425
1437
  case "all":
1426
1438
  default:
1427
- o = await r.tokens.getTokensConfig(s);
1439
+ o = await r.tokens.getTokensConfig(i);
1428
1440
  }
1429
1441
  if (!n || n?.length === 0) return { tokens: o };
1430
1442
  return {
1431
1443
  tokens: o.filter((d) => !n.map((p) => p.address).includes(d.address || ""))
1432
1444
  };
1433
1445
  };
1434
- var O = (r) => !r || I(r, _);
1446
+ var O = (r) => !r || T(r, _);
1435
1447
  async function _e(r, e) {
1436
1448
  return await x(
1437
1449
  async () => {
1438
- const t = new Fn(e, JSON.stringify(L), r);
1450
+ const t = new Wn(e, JSON.stringify(L), r);
1439
1451
  const [n, o, a] = await Promise.all([
1440
1452
  t.name(),
1441
1453
  t.symbol(),
@@ -1456,8 +1468,8 @@ async function _e(r, e) {
1456
1468
  import Zt, {
1457
1469
  HttpStatusCode as Yt
1458
1470
  } from "axios";
1459
- var Gn = 5;
1460
- var Te = class {
1471
+ var qn = 5;
1472
+ var Ie = class {
1461
1473
  url;
1462
1474
  nativeToken;
1463
1475
  ttl;
@@ -1490,7 +1502,7 @@ var Te = class {
1490
1502
  symbol: o.symbol
1491
1503
  };
1492
1504
  this.cacheMap = {};
1493
- this.ttl = n !== void 0 ? n : Gn;
1505
+ this.ttl = n !== void 0 ? n : qn;
1494
1506
  }
1495
1507
  /**
1496
1508
  * isChainSupported verifies if the chain is supported by Blockscout
@@ -1518,7 +1530,7 @@ var Te = class {
1518
1530
  const o = await this.httpClient.get(t);
1519
1531
  const a = {
1520
1532
  items: o.data?.items?.filter(
1521
- (i) => i.token.address && i.token.address !== this.nativeToken.address
1533
+ (s) => s.token.address && s.token.address !== this.nativeToken.address
1522
1534
  ),
1523
1535
  // eslint-disable-next-line @typescript-eslint/naming-convention
1524
1536
  next_page_params: o.data?.next_page_params
@@ -1572,8 +1584,8 @@ var S = async (r, e, t) => {
1572
1584
  const n = performance.now();
1573
1585
  const o = await t;
1574
1586
  const a = performance.now();
1575
- const i = (a - n) / 1e3;
1576
- ct(r, e, i);
1587
+ const s = (a - n) / 1e3;
1588
+ ct(r, e, s);
1577
1589
  return o;
1578
1590
  };
1579
1591
 
@@ -1603,7 +1615,7 @@ var ut = async (r, e, t) => await x(
1603
1615
  async function mt(r, e, t) {
1604
1616
  return await x(
1605
1617
  async () => {
1606
- const n = new qn(
1618
+ const n = new jn(
1607
1619
  t,
1608
1620
  JSON.stringify(L),
1609
1621
  r
@@ -1612,10 +1624,10 @@ async function mt(r, e, t) {
1612
1624
  _e(r, t),
1613
1625
  n.balanceOf(e)
1614
1626
  ]).then(([o, a]) => {
1615
- const i = pt(a, o.decimals);
1627
+ const s = pt(a, o.decimals);
1616
1628
  return {
1617
1629
  balance: a,
1618
- formattedBalance: i,
1630
+ formattedBalance: s,
1619
1631
  token: {
1620
1632
  name: o.name,
1621
1633
  symbol: o.symbol,
@@ -1630,19 +1642,19 @@ async function mt(r, e, t) {
1630
1642
  }
1631
1643
  var lt = /* @__PURE__ */ new Map();
1632
1644
  var ft = () => lt.clear();
1633
- var jn = async (r, e, t, n) => {
1645
+ var Vn = async (r, e, t, n) => {
1634
1646
  const o = n !== void 0;
1635
1647
  const a = Object.assign(
1636
1648
  {},
1637
1649
  ...(n ?? []).map((m) => ({ [m.address?.toLowerCase() || _]: m }))
1638
1650
  );
1639
- let i = lt.get(t);
1640
- if (!i) {
1651
+ let s = lt.get(t);
1652
+ if (!s) {
1641
1653
  const m = r.remote.getHttpClient();
1642
- i = new Te(m, t);
1643
- lt.set(t, i);
1654
+ s = new Ie(m, t);
1655
+ lt.set(t, s);
1644
1656
  }
1645
- const s = [];
1657
+ const i = [];
1646
1658
  const c = "ERC-20";
1647
1659
  const d = async (m) => {
1648
1660
  let E;
@@ -1653,7 +1665,7 @@ var jn = async (r, e, t, n) => {
1653
1665
  tokenType: c,
1654
1666
  nextPage: E?.next_page_params
1655
1667
  });
1656
- s.push(...E.items);
1668
+ i.push(...E.items);
1657
1669
  } while (E.next_page_params);
1658
1670
  } catch (g) {
1659
1671
  if (g?.code !== dt.NotFound) {
@@ -1669,7 +1681,7 @@ var jn = async (r, e, t, n) => {
1669
1681
  try {
1670
1682
  const E = await m.getNativeTokenByWalletAddress({ walletAddress: e });
1671
1683
  E.token.address ||= _;
1672
- s.push(E);
1684
+ i.push(E);
1673
1685
  } catch (E) {
1674
1686
  if (E?.code !== dt.NotFound) {
1675
1687
  throw new l(
@@ -1681,11 +1693,11 @@ var jn = async (r, e, t, n) => {
1681
1693
  }
1682
1694
  };
1683
1695
  await Promise.all([
1684
- d(i),
1685
- p(i)
1696
+ d(s),
1697
+ p(s)
1686
1698
  ]);
1687
1699
  const u = [];
1688
- s.forEach((m) => {
1700
+ i.forEach((m) => {
1689
1701
  const E = a[m.token.address.toLowerCase()];
1690
1702
  if (o && !E) return;
1691
1703
  const g = m.token || {};
@@ -1693,40 +1705,40 @@ var jn = async (r, e, t, n) => {
1693
1705
  const f = BigInt(m.value);
1694
1706
  let R = parseInt(g.decimals, 10);
1695
1707
  if (Number.isNaN(R)) R = G;
1696
- const T = g.icon_url ?? E.icon;
1708
+ const I = g.icon_url ?? E.icon;
1697
1709
  const C = {
1698
1710
  ...g,
1699
1711
  decimals: R,
1700
- icon: T
1712
+ icon: I
1701
1713
  };
1702
1714
  const y = pt(m.value, C.decimals);
1703
1715
  u.push({ balance: f, formattedBalance: y, token: C });
1704
1716
  });
1705
1717
  return { balances: u };
1706
1718
  };
1707
- var Vn = async (r, e, t, n) => {
1719
+ var Hn = async (r, e, t, n) => {
1708
1720
  const o = [];
1709
- n.forEach((s) => {
1710
- if (!s.address || I(s.address, _)) {
1721
+ n.forEach((i) => {
1722
+ if (!i.address || T(i.address, _)) {
1711
1723
  o.push(
1712
1724
  ut(r, e, t)
1713
1725
  );
1714
1726
  } else {
1715
1727
  o.push(
1716
- mt(e, t, s.address)
1728
+ mt(e, t, i.address)
1717
1729
  );
1718
1730
  }
1719
1731
  });
1720
1732
  const a = await Promise.allSettled(o);
1721
- const i = a.filter(
1722
- (s) => s.status === "fulfilled"
1723
- ).map((s) => {
1724
- const c = s;
1733
+ const s = a.filter(
1734
+ (i) => i.status === "fulfilled"
1735
+ ).map((i) => {
1736
+ const c = i;
1725
1737
  const { token: d } = c.value;
1726
- if (!d.address || I(d.address, _)) c.value.token.address = _;
1738
+ if (!d.address || T(d.address, _)) c.value.token.address = _;
1727
1739
  return c.value;
1728
1740
  });
1729
- return { balances: i };
1741
+ return { balances: s };
1730
1742
  };
1731
1743
  var Jt = async (r, e, t, n, o) => {
1732
1744
  if (!e) {
@@ -1740,7 +1752,7 @@ var Jt = async (r, e, t, n, o) => {
1740
1752
  return await S(
1741
1753
  r,
1742
1754
  `Time to fetch balances using RPC for ${n}`,
1743
- Vn(r, e, a, o)
1755
+ Hn(r, e, a, o)
1744
1756
  );
1745
1757
  };
1746
1758
  var q = async (r, e, t, n, o = false) => {
@@ -1766,19 +1778,19 @@ var q = async (r, e, t, n, o = false) => {
1766
1778
  if (o) {
1767
1779
  ft();
1768
1780
  }
1769
- if (Te.isChainSupported(n)) {
1770
- const i = t ?? await (await e?.getSigner())?.getAddress();
1781
+ if (Ie.isChainSupported(n)) {
1782
+ const s = t ?? await (await e?.getSigner())?.getAddress();
1771
1783
  try {
1772
1784
  return await S(
1773
1785
  r,
1774
1786
  `Time to fetch balances using blockscout for ${n}`,
1775
- jn(r, i, n, a)
1787
+ Vn(r, s, n, a)
1776
1788
  );
1777
- } catch (s) {
1778
- if (s.type === "GET_INDEXER_BALANCE_ERROR" && s.data?.error?.code === dt.TooManyRequests) {
1789
+ } catch (i) {
1790
+ if (i.type === "GET_INDEXER_BALANCE_ERROR" && i.data?.error?.code === dt.TooManyRequests) {
1779
1791
  return Jt(r, e, t, n, a);
1780
1792
  }
1781
- throw s;
1793
+ throw i;
1782
1794
  }
1783
1795
  }
1784
1796
  return Jt(r, e, t, n, a);
@@ -1920,7 +1932,7 @@ var Oe = class {
1920
1932
  };
1921
1933
 
1922
1934
  // src/gasEstimate/gasEstimator.ts
1923
- import { parseUnits as ro } from "ethers";
1935
+ import { parseUnits as no } from "ethers";
1924
1936
 
1925
1937
  // src/gasEstimate/bridgeGasEstimate.ts
1926
1938
  import {
@@ -1940,16 +1952,16 @@ async function rr(r, e, t, n) {
1940
1952
 
1941
1953
  // src/instance/instance.ts
1942
1954
  import {
1943
- BridgeConfiguration as Kn,
1944
- ETH_MAINNET_TO_ZKEVM_MAINNET as Qn,
1945
- ETH_SEPOLIA_TO_ZKEVM_DEVNET as Zn,
1946
- ETH_SEPOLIA_TO_ZKEVM_TESTNET as Yn,
1947
- TokenBridge as Jn
1955
+ BridgeConfiguration as Qn,
1956
+ ETH_MAINNET_TO_ZKEVM_MAINNET as Zn,
1957
+ ETH_SEPOLIA_TO_ZKEVM_DEVNET as Yn,
1958
+ ETH_SEPOLIA_TO_ZKEVM_TESTNET as Jn,
1959
+ TokenBridge as $n
1948
1960
  } from "@imtbl/bridge-sdk";
1949
1961
  import { ImmutableConfiguration as nr } from "@imtbl/config";
1950
- import { Exchange as $n } from "@imtbl/dex-sdk";
1951
- import { Orderbook as Xn } from "@imtbl/orderbook";
1952
- import { BlockchainData as eo } from "@imtbl/blockchain-data";
1962
+ import { Exchange as Xn } from "@imtbl/dex-sdk";
1963
+ import { Orderbook as eo } from "@imtbl/orderbook";
1964
+ import { BlockchainData as to } from "@imtbl/blockchain-data";
1953
1965
  function Me(r, e, t, n) {
1954
1966
  const o = t.get(r);
1955
1967
  const a = t.get(e);
@@ -1965,22 +1977,22 @@ function Me(r, e, t, n) {
1965
1977
  "CHAIN_NOT_SUPPORTED_ERROR"
1966
1978
  );
1967
1979
  }
1968
- let i = Yn;
1969
- if (n.isDevelopment) i = Zn;
1970
- if (n.isProduction) i = Qn;
1971
- const s = new Kn({
1980
+ let s = Jn;
1981
+ if (n.isDevelopment) s = Yn;
1982
+ if (n.isProduction) s = Zn;
1983
+ const i = new Qn({
1972
1984
  baseConfig: new nr({ environment: n.environment }),
1973
- bridgeInstance: i,
1985
+ bridgeInstance: s,
1974
1986
  rootProvider: o,
1975
1987
  childProvider: a
1976
1988
  });
1977
- return new Jn(s);
1989
+ return new $n(i);
1978
1990
  }
1979
1991
  async function oe(r, e) {
1980
1992
  const t = await e.remote.getConfig(
1981
1993
  "dex"
1982
1994
  );
1983
- return new $n({
1995
+ return new Xn({
1984
1996
  chainId: r,
1985
1997
  baseConfig: new nr({
1986
1998
  environment: e.environment
@@ -1990,14 +2002,14 @@ async function oe(r, e) {
1990
2002
  });
1991
2003
  }
1992
2004
  function ae(r) {
1993
- return new Xn({
2005
+ return new eo({
1994
2006
  baseConfig: {
1995
2007
  environment: r.environment
1996
2008
  }
1997
2009
  });
1998
2010
  }
1999
2011
  function Be(r) {
2000
- return new eo({
2012
+ return new to({
2001
2013
  baseConfig: {
2002
2014
  environment: r.environment
2003
2015
  }
@@ -2006,16 +2018,16 @@ function Be(r) {
2006
2018
 
2007
2019
  // src/instance/contract.ts
2008
2020
  import {
2009
- Contract as to
2021
+ Contract as ro
2010
2022
  } from "ethers";
2011
2023
  function or(r, e, t) {
2012
- return new to(r, e, t);
2024
+ return new ro(r, e, t);
2013
2025
  }
2014
2026
 
2015
2027
  // src/gasEstimate/gasEstimator.ts
2016
- var no = "0x0000000000000000000000000000000000000001";
2028
+ var oo = "0x0000000000000000000000000000000000000001";
2017
2029
  var ar = 18;
2018
- async function oo(r, e) {
2030
+ async function ao(r, e) {
2019
2031
  const t = N(e);
2020
2032
  const n = A(e);
2021
2033
  const o = r.get(t);
@@ -2027,7 +2039,7 @@ async function oo(r, e) {
2027
2039
  r,
2028
2040
  e
2029
2041
  );
2030
- const i = await rr(
2042
+ const s = await rr(
2031
2043
  a,
2032
2044
  t,
2033
2045
  n,
@@ -2035,7 +2047,7 @@ async function oo(r, e) {
2035
2047
  );
2036
2048
  return {
2037
2049
  gasEstimateType: "BRIDGE_TO_L2",
2038
- fees: i,
2050
+ fees: s,
2039
2051
  token: e.networkMap.get(t)?.nativeCurrency
2040
2052
  };
2041
2053
  } catch {
@@ -2052,7 +2064,7 @@ async function oo(r, e) {
2052
2064
  };
2053
2065
  }
2054
2066
  }
2055
- async function ao(r) {
2067
+ async function so(r) {
2056
2068
  const e = A(r);
2057
2069
  const t = await r.remote.getConfig(
2058
2070
  "gasEstimateTokens"
@@ -2060,13 +2072,13 @@ async function ao(r) {
2060
2072
  const { inAddress: n, outAddress: o } = t[e].swapAddresses;
2061
2073
  try {
2062
2074
  const a = await oe(e, r);
2063
- const { swap: i } = await a.getUnsignedSwapTxFromAmountIn(
2064
- no,
2075
+ const { swap: s } = await a.getUnsignedSwapTxFromAmountIn(
2076
+ oo,
2065
2077
  n,
2066
2078
  o,
2067
- BigInt(ro("1", ar))
2079
+ BigInt(no("1", ar))
2068
2080
  );
2069
- if (!i.gasFeeEstimate) {
2081
+ if (!s.gasFeeEstimate) {
2070
2082
  return {
2071
2083
  gasEstimateType: "SWAP",
2072
2084
  fees: {}
@@ -2075,12 +2087,12 @@ async function ao(r) {
2075
2087
  return {
2076
2088
  gasEstimateType: "SWAP",
2077
2089
  fees: {
2078
- totalFees: i.gasFeeEstimate.value ? BigInt(i.gasFeeEstimate.value) : void 0,
2090
+ totalFees: s.gasFeeEstimate.value ? BigInt(s.gasFeeEstimate.value) : void 0,
2079
2091
  token: {
2080
- address: i.gasFeeEstimate.token.address,
2081
- symbol: i.gasFeeEstimate.token.symbol ?? "",
2082
- name: i.gasFeeEstimate.token.name ?? "",
2083
- decimals: i.gasFeeEstimate.token.decimals ?? ar
2092
+ address: s.gasFeeEstimate.token.address,
2093
+ symbol: s.gasFeeEstimate.token.symbol ?? "",
2094
+ name: s.gasFeeEstimate.token.name ?? "",
2095
+ decimals: s.gasFeeEstimate.token.decimals ?? ar
2084
2096
  }
2085
2097
  }
2086
2098
  };
@@ -2091,15 +2103,15 @@ async function ao(r) {
2091
2103
  };
2092
2104
  }
2093
2105
  }
2094
- async function ir(r, e, t) {
2106
+ async function sr(r, e, t) {
2095
2107
  switch (r.gasEstimateType) {
2096
2108
  case "BRIDGE_TO_L2":
2097
- return await oo(
2109
+ return await ao(
2098
2110
  e,
2099
2111
  t
2100
2112
  );
2101
2113
  case "SWAP":
2102
- return await ao(t);
2114
+ return await so(t);
2103
2115
  default:
2104
2116
  throw new l(
2105
2117
  "Invalid type provided for gasEstimateType",
@@ -2122,7 +2134,7 @@ var Et = (r) => {
2122
2134
  };
2123
2135
 
2124
2136
  // src/provider/provider.ts
2125
- import po from "@metamask/detect-provider";
2137
+ import uo from "@metamask/detect-provider";
2126
2138
 
2127
2139
  // src/provider/injected/utils.ts
2128
2140
  function gt(r) {
@@ -2244,19 +2256,19 @@ var be = {
2244
2256
  rdns: "com.immutable.passport",
2245
2257
  uuid: "b90118be-7234-4c89-b89b-d5d267663eb5"
2246
2258
  };
2247
- var co = (r) => ({
2259
+ var lo = (r) => ({
2248
2260
  info: be,
2249
2261
  provider: r
2250
2262
  });
2251
- var lo = (r) => ({
2263
+ var po = (r) => ({
2252
2264
  info: xe,
2253
2265
  provider: r
2254
2266
  });
2255
2267
 
2256
2268
  // src/provider/provider.ts
2257
- async function uo() {
2269
+ async function mo() {
2258
2270
  const r = await x(
2259
- async () => await po(),
2271
+ async () => await uo(),
2260
2272
  { type: "METAMASK_PROVIDER_ERROR" }
2261
2273
  );
2262
2274
  if (!r || !r.request) {
@@ -2267,7 +2279,7 @@ async function uo() {
2267
2279
  }
2268
2280
  return new b(r);
2269
2281
  }
2270
- async function sr(r, e) {
2282
+ async function ir(r, e) {
2271
2283
  let t = null;
2272
2284
  let n;
2273
2285
  switch (r) {
@@ -2293,7 +2305,7 @@ async function sr(r, e) {
2293
2305
  case "metamask": {
2294
2306
  n = D.getInstance().findProvider({ rdns: xe.rdns });
2295
2307
  if (!n) {
2296
- t = await uo();
2308
+ t = await mo();
2297
2309
  }
2298
2310
  break;
2299
2311
  }
@@ -2362,11 +2374,11 @@ async function B(r, e, t) {
2362
2374
  "WEB3_PROVIDER_ERROR"
2363
2375
  );
2364
2376
  }
2365
- const i = await Y(r, {
2377
+ const s = await Y(r, {
2366
2378
  type: "all"
2367
2379
  });
2368
- const s = i.networks.some((c) => c.chainId === Number(o));
2369
- if (!s && !n.allowUnsupportedProvider) {
2380
+ const i = s.networks.some((c) => c.chainId === Number(o));
2381
+ if (!i && !n.allowUnsupportedProvider) {
2370
2382
  throw new l(
2371
2383
  "Your wallet is connected to an unsupported network, please switch to a supported network",
2372
2384
  "WEB3_PROVIDER_ERROR"
@@ -2381,7 +2393,7 @@ async function B(r, e, t) {
2381
2393
  }
2382
2394
 
2383
2395
  // src/readOnlyProviders/readOnlyProvider.ts
2384
- import { JsonRpcProvider as fo } from "ethers";
2396
+ import { JsonRpcProvider as Eo } from "ethers";
2385
2397
  async function Le(r, e) {
2386
2398
  if (r.isProduction && e?.has(1)) return e;
2387
2399
  if (e?.has(11155111)) return e;
@@ -2391,8 +2403,8 @@ async function Le(r, e) {
2391
2403
  });
2392
2404
  n.networks.forEach((o) => {
2393
2405
  const a = r.networkMap.get(Number(o.chainId))?.rpcUrls[0];
2394
- const i = new fo(a);
2395
- t.set(Number(o.chainId), i);
2406
+ const s = new Eo(a);
2407
+ t.set(Number(o.chainId), s);
2396
2408
  });
2397
2409
  return t;
2398
2410
  }
@@ -2419,7 +2431,7 @@ var dr = (r, e, t) => {
2419
2431
  };
2420
2432
 
2421
2433
  // src/smartCheckout/aggregators/itemAggregator.ts
2422
- var Eo = (r) => {
2434
+ var go = (r) => {
2423
2435
  const e = /* @__PURE__ */ new Map();
2424
2436
  const t = [];
2425
2437
  r.forEach((n) => {
@@ -2432,17 +2444,17 @@ var Eo = (r) => {
2432
2444
  ...n,
2433
2445
  isFee: "isFee" in n ? n.isFee : false
2434
2446
  };
2435
- const { amount: i } = a;
2436
- const s = e.get(o);
2437
- if (s && s.type === "NATIVE") {
2438
- s.amount += i;
2447
+ const { amount: s } = a;
2448
+ const i = e.get(o);
2449
+ if (i && i.type === "NATIVE") {
2450
+ i.amount += s;
2439
2451
  } else {
2440
2452
  e.set(o, { ...a });
2441
2453
  }
2442
2454
  });
2443
2455
  return t.concat(Array.from(e.values()));
2444
2456
  };
2445
- var go = (r) => {
2457
+ var Ro = (r) => {
2446
2458
  const e = /* @__PURE__ */ new Map();
2447
2459
  const t = [];
2448
2460
  r.forEach((n) => {
@@ -2455,8 +2467,8 @@ var go = (r) => {
2455
2467
  ...n,
2456
2468
  isFee: "isFee" in n ? n.isFee : false
2457
2469
  };
2458
- const { tokenAddress: i, spenderAddress: s, amount: c } = a;
2459
- const d = `${i}${s}`;
2470
+ const { tokenAddress: s, spenderAddress: i, amount: c } = a;
2471
+ const d = `${s}${i}`;
2460
2472
  const p = e.get(d);
2461
2473
  if (p && p.type === "ERC20") {
2462
2474
  p.amount += c;
@@ -2466,7 +2478,7 @@ var go = (r) => {
2466
2478
  });
2467
2479
  return t.concat(Array.from(e.values()));
2468
2480
  };
2469
- var Ro = (r) => {
2481
+ var Co = (r) => {
2470
2482
  const e = /* @__PURE__ */ new Map();
2471
2483
  const t = [];
2472
2484
  r.forEach((n) => {
@@ -2475,14 +2487,14 @@ var Ro = (r) => {
2475
2487
  t.push(n);
2476
2488
  return;
2477
2489
  }
2478
- const { contractAddress: a, spenderAddress: i, id: s } = n;
2479
- const c = `${a}${i}${s}`;
2490
+ const { contractAddress: a, spenderAddress: s, id: i } = n;
2491
+ const c = `${a}${s}${i}`;
2480
2492
  const d = e.get(c);
2481
2493
  if (!d) e.set(c, { ...n });
2482
2494
  });
2483
2495
  return t.concat(Array.from(e.values()));
2484
2496
  };
2485
- var Co = (r) => {
2497
+ var To = (r) => {
2486
2498
  const e = /* @__PURE__ */ new Map();
2487
2499
  const t = [];
2488
2500
  r.forEach((n) => {
@@ -2493,11 +2505,11 @@ var Co = (r) => {
2493
2505
  }
2494
2506
  const {
2495
2507
  contractAddress: a,
2496
- spenderAddress: i,
2497
- id: s,
2508
+ spenderAddress: s,
2509
+ id: i,
2498
2510
  amount: c
2499
2511
  } = n;
2500
- const d = `${a}${i}${s}`;
2512
+ const d = `${a}${s}${i}`;
2501
2513
  const p = e.get(d);
2502
2514
  if (p && p.type === "ERC1155") {
2503
2515
  p.amount += c;
@@ -2507,7 +2519,7 @@ var Co = (r) => {
2507
2519
  });
2508
2520
  return t.concat(Array.from(e.values()));
2509
2521
  };
2510
- var Ct = (r) => Co(Ro(go(Eo(r))));
2522
+ var Ct = (r) => To(Co(Ro(go(r))));
2511
2523
 
2512
2524
  // src/smartCheckout/allowance/erc20.ts
2513
2525
  import { Contract as lr } from "ethers";
@@ -2527,16 +2539,16 @@ var Io = async (r, e, t, n) => {
2527
2539
  );
2528
2540
  }
2529
2541
  };
2530
- var To = async (r, e, t, n, o) => {
2542
+ var ho = async (r, e, t, n, o) => {
2531
2543
  try {
2532
2544
  const a = new lr(
2533
2545
  t,
2534
2546
  JSON.stringify(L),
2535
2547
  r
2536
2548
  );
2537
- const i = await a.approve.populateTransaction(n, o);
2538
- if (i) i.from = e;
2539
- return i;
2549
+ const s = await a.approve.populateTransaction(n, o);
2550
+ if (s) s.from = e;
2551
+ return s;
2540
2552
  } catch (a) {
2541
2553
  throw new l(
2542
2554
  "Failed to get the approval transaction for ERC20",
@@ -2549,21 +2561,21 @@ var pr = async (r, e, t) => {
2549
2561
  let n = true;
2550
2562
  const o = [];
2551
2563
  const a = /* @__PURE__ */ new Map();
2552
- const i = /* @__PURE__ */ new Map();
2553
2564
  const s = /* @__PURE__ */ new Map();
2565
+ const i = /* @__PURE__ */ new Map();
2554
2566
  const c = /* @__PURE__ */ new Map();
2555
2567
  for (const E of t) {
2556
2568
  if (E.type !== "ERC20") continue;
2557
2569
  const { tokenAddress: g, spenderAddress: f } = E;
2558
2570
  const R = `${g}${f}`;
2559
2571
  a.set(R, E);
2560
- i.set(
2572
+ s.set(
2561
2573
  R,
2562
2574
  Io(r, e, g, f)
2563
2575
  );
2564
2576
  }
2565
- const d = await Promise.all(i.values());
2566
- const p = Array.from(i.keys());
2577
+ const d = await Promise.all(s.values());
2578
+ const p = Array.from(s.keys());
2567
2579
  for (let E = 0; E < d.length; E++) {
2568
2580
  const g = a.get(p[E]);
2569
2581
  if (!g || g.type !== "ERC20") continue;
@@ -2576,10 +2588,10 @@ var pr = async (r, e, t) => {
2576
2588
  }
2577
2589
  n = false;
2578
2590
  const { tokenAddress: f, spenderAddress: R } = g;
2579
- const T = `${f}${R}`;
2591
+ const I = `${f}${R}`;
2580
2592
  const C = g.amount - d[E];
2581
- s.set(
2582
- T,
2593
+ i.set(
2594
+ I,
2583
2595
  {
2584
2596
  type: "ERC20",
2585
2597
  sufficient: false,
@@ -2589,8 +2601,8 @@ var pr = async (r, e, t) => {
2589
2601
  }
2590
2602
  );
2591
2603
  c.set(
2592
- T,
2593
- To(
2604
+ I,
2605
+ ho(
2594
2606
  r,
2595
2607
  e,
2596
2608
  f,
@@ -2602,19 +2614,19 @@ var pr = async (r, e, t) => {
2602
2614
  const u = await Promise.all(c.values());
2603
2615
  const m = Array.from(c.keys());
2604
2616
  u.forEach((E, g) => {
2605
- const f = s.get(m[g]);
2617
+ const f = i.get(m[g]);
2606
2618
  if (!f) return;
2607
2619
  if (f.sufficient) return;
2608
2620
  f.approvalTransaction = E;
2609
2621
  });
2610
- return { sufficient: n, allowances: o.concat(Array.from(s.values())) };
2622
+ return { sufficient: n, allowances: o.concat(Array.from(i.values())) };
2611
2623
  };
2612
2624
 
2613
2625
  // src/smartCheckout/allowance/erc721.ts
2614
- import { Contract as It } from "ethers";
2615
- var ho = async (r, e, t, n) => {
2626
+ import { Contract as Tt } from "ethers";
2627
+ var Ao = async (r, e, t, n) => {
2616
2628
  try {
2617
- const o = new It(
2629
+ const o = new Tt(
2618
2630
  t,
2619
2631
  JSON.stringify(re),
2620
2632
  r
@@ -2633,16 +2645,16 @@ var ho = async (r, e, t, n) => {
2633
2645
  );
2634
2646
  }
2635
2647
  };
2636
- var Ao = async (r, e, t, n, o) => {
2648
+ var yo = async (r, e, t, n, o) => {
2637
2649
  try {
2638
- const a = new It(
2650
+ const a = new Tt(
2639
2651
  t,
2640
2652
  JSON.stringify(re),
2641
2653
  r
2642
2654
  );
2643
- const i = await a.approve.populateTransaction(n, o);
2644
- if (i) i.from = e;
2645
- return i;
2655
+ const s = await a.approve.populateTransaction(n, o);
2656
+ if (s) s.from = e;
2657
+ return s;
2646
2658
  } catch (a) {
2647
2659
  throw new l(
2648
2660
  "Failed to get the approval transaction for ERC721",
@@ -2657,9 +2669,9 @@ var Ao = async (r, e, t, n, o) => {
2657
2669
  );
2658
2670
  }
2659
2671
  };
2660
- var yo = async (r, e, t) => {
2672
+ var wo = async (r, e, t) => {
2661
2673
  try {
2662
- const n = new It(
2674
+ const n = new Tt(
2663
2675
  e,
2664
2676
  JSON.stringify(re),
2665
2677
  r
@@ -2695,16 +2707,16 @@ var ur = (r, e) => {
2695
2707
  );
2696
2708
  }
2697
2709
  };
2698
- var wo = async (r, e, t) => {
2710
+ var So = async (r, e, t) => {
2699
2711
  const n = /* @__PURE__ */ new Map();
2700
2712
  const o = /* @__PURE__ */ new Map();
2701
- for (const s of e) {
2702
- if (s.type !== "ERC721") continue;
2703
- const { contractAddress: c, spenderAddress: d } = s;
2713
+ for (const i of e) {
2714
+ if (i.type !== "ERC721") continue;
2715
+ const { contractAddress: c, spenderAddress: d } = i;
2704
2716
  const p = `${c}-${d}`;
2705
2717
  n.set(p, false);
2706
2718
  if (o.has(p)) continue;
2707
- o.set(p, ho(
2719
+ o.set(p, Ao(
2708
2720
  r,
2709
2721
  t,
2710
2722
  c,
@@ -2712,9 +2724,9 @@ var wo = async (r, e, t) => {
2712
2724
  ));
2713
2725
  }
2714
2726
  const a = await Promise.all(o.values());
2715
- const i = Array.from(o.keys());
2716
- a.forEach((s, c) => {
2717
- n.set(i[c], s);
2727
+ const s = Array.from(o.keys());
2728
+ a.forEach((i, c) => {
2729
+ n.set(s[c], i);
2718
2730
  });
2719
2731
  return n;
2720
2732
  };
@@ -2722,18 +2734,18 @@ var mr = async (r, e, t) => {
2722
2734
  let n = true;
2723
2735
  const o = [];
2724
2736
  const a = /* @__PURE__ */ new Map();
2725
- const i = /* @__PURE__ */ new Map();
2726
2737
  const s = /* @__PURE__ */ new Map();
2738
+ const i = /* @__PURE__ */ new Map();
2727
2739
  const c = /* @__PURE__ */ new Map();
2728
- const d = await wo(
2740
+ const d = await So(
2729
2741
  r,
2730
2742
  t,
2731
2743
  e
2732
2744
  );
2733
2745
  for (const g of t) {
2734
2746
  if (g.type !== "ERC721") continue;
2735
- const { contractAddress: f, id: R, spenderAddress: T } = g;
2736
- const C = `${f}-${T}`;
2747
+ const { contractAddress: f, id: R, spenderAddress: I } = g;
2748
+ const C = `${f}-${I}`;
2737
2749
  const y = d.get(C);
2738
2750
  if (y) {
2739
2751
  o.push({
@@ -2745,13 +2757,13 @@ var mr = async (r, e, t) => {
2745
2757
  const P = `${f}-${R}`;
2746
2758
  const v = ur(R, f);
2747
2759
  a.set(P, g);
2748
- i.set(
2760
+ s.set(
2749
2761
  P,
2750
- yo(r, f, v)
2762
+ wo(r, f, v)
2751
2763
  );
2752
2764
  }
2753
- const p = await Promise.all(i.values());
2754
- const u = Array.from(i.keys());
2765
+ const p = await Promise.all(s.values());
2766
+ const u = Array.from(s.keys());
2755
2767
  for (let g = 0; g < p.length; g++) {
2756
2768
  const f = a.get(u[g]);
2757
2769
  if (!f || f.type !== "ERC721") continue;
@@ -2763,10 +2775,10 @@ var mr = async (r, e, t) => {
2763
2775
  continue;
2764
2776
  }
2765
2777
  n = false;
2766
- const { contractAddress: R, id: T, spenderAddress: C } = f;
2767
- const y = `${R}-${T}`;
2768
- const P = ur(T, R);
2769
- s.set(
2778
+ const { contractAddress: R, id: I, spenderAddress: C } = f;
2779
+ const y = `${R}-${I}`;
2780
+ const P = ur(I, R);
2781
+ i.set(
2770
2782
  y,
2771
2783
  {
2772
2784
  type: "ERC721",
@@ -2777,7 +2789,7 @@ var mr = async (r, e, t) => {
2777
2789
  );
2778
2790
  c.set(
2779
2791
  y,
2780
- Ao(
2792
+ yo(
2781
2793
  r,
2782
2794
  e,
2783
2795
  R,
@@ -2789,17 +2801,17 @@ var mr = async (r, e, t) => {
2789
2801
  const m = await Promise.all(c.values());
2790
2802
  const E = Array.from(c.keys());
2791
2803
  m.forEach((g, f) => {
2792
- const R = s.get(E[f]);
2804
+ const R = i.get(E[f]);
2793
2805
  if (!R) return;
2794
2806
  if (R.sufficient) return;
2795
2807
  R.approvalTransaction = g;
2796
2808
  });
2797
- return { sufficient: n, allowances: o.concat(Array.from(s.values())) };
2809
+ return { sufficient: n, allowances: o.concat(Array.from(i.values())) };
2798
2810
  };
2799
2811
 
2800
2812
  // src/smartCheckout/allowance/erc1155.ts
2801
2813
  import { Contract as fr } from "ethers";
2802
- var So = async (r, e, t, n) => {
2814
+ var Po = async (r, e, t, n) => {
2803
2815
  try {
2804
2816
  const o = new fr(
2805
2817
  t,
@@ -2820,7 +2832,7 @@ var So = async (r, e, t, n) => {
2820
2832
  );
2821
2833
  }
2822
2834
  };
2823
- var Po = async (r, e, t, n) => {
2835
+ var ko = async (r, e, t, n) => {
2824
2836
  try {
2825
2837
  const o = new fr(
2826
2838
  t,
@@ -2849,19 +2861,19 @@ var Er = async (r, e, t) => {
2849
2861
  );
2850
2862
  const o = await Promise.all(
2851
2863
  n.map(async (a) => {
2852
- const i = await So(
2864
+ const s = await Po(
2853
2865
  r,
2854
2866
  e,
2855
2867
  a.contractAddress,
2856
2868
  a.spenderAddress
2857
2869
  );
2858
- if (i) {
2870
+ if (s) {
2859
2871
  return {
2860
2872
  sufficient: true,
2861
2873
  itemRequirement: a
2862
2874
  };
2863
2875
  }
2864
- const s = await Po(
2876
+ const i = await ko(
2865
2877
  r,
2866
2878
  e,
2867
2879
  a.contractAddress,
@@ -2871,7 +2883,7 @@ var Er = async (r, e, t) => {
2871
2883
  type: "ERC1155",
2872
2884
  sufficient: false,
2873
2885
  itemRequirement: a,
2874
- approvalTransaction: s
2886
+ approvalTransaction: i
2875
2887
  };
2876
2888
  })
2877
2889
  );
@@ -2882,10 +2894,10 @@ var Er = async (r, e, t) => {
2882
2894
  };
2883
2895
 
2884
2896
  // src/smartCheckout/balanceCheck/balanceCheck.ts
2885
- import { Contract as Oo, formatUnits as Mo } from "ethers";
2897
+ import { Contract as Mo, formatUnits as Bo } from "ethers";
2886
2898
 
2887
2899
  // src/smartCheckout/aggregators/balanceAggregator.ts
2888
- var ko = (r) => {
2900
+ var vo = (r) => {
2889
2901
  const e = /* @__PURE__ */ new Map();
2890
2902
  const t = [];
2891
2903
  r.forEach((n) => {
@@ -2895,16 +2907,16 @@ var ko = (r) => {
2895
2907
  return;
2896
2908
  }
2897
2909
  const { amount: a } = n;
2898
- const i = e.get(o);
2899
- if (i && i.type === "NATIVE") {
2900
- i.amount += a;
2910
+ const s = e.get(o);
2911
+ if (s && s.type === "NATIVE") {
2912
+ s.amount += a;
2901
2913
  } else {
2902
2914
  e.set(o, { ...n });
2903
2915
  }
2904
2916
  });
2905
2917
  return t.concat(Array.from(e.values()));
2906
2918
  };
2907
- var vo = (r) => {
2919
+ var No = (r) => {
2908
2920
  const e = /* @__PURE__ */ new Map();
2909
2921
  const t = [];
2910
2922
  r.forEach((n) => {
@@ -2913,18 +2925,18 @@ var vo = (r) => {
2913
2925
  t.push(n);
2914
2926
  return;
2915
2927
  }
2916
- const { tokenAddress: a, amount: i } = n;
2917
- const s = `${a}`;
2918
- const c = e.get(s);
2928
+ const { tokenAddress: a, amount: s } = n;
2929
+ const i = `${a}`;
2930
+ const c = e.get(i);
2919
2931
  if (c && c.type === "ERC20") {
2920
- c.amount += i;
2932
+ c.amount += s;
2921
2933
  } else {
2922
- e.set(s, { ...n });
2934
+ e.set(i, { ...n });
2923
2935
  }
2924
2936
  });
2925
2937
  return t.concat(Array.from(e.values()));
2926
2938
  };
2927
- var No = (r) => {
2939
+ var _o = (r) => {
2928
2940
  const e = /* @__PURE__ */ new Map();
2929
2941
  const t = [];
2930
2942
  r.forEach((n) => {
@@ -2933,17 +2945,17 @@ var No = (r) => {
2933
2945
  t.push(n);
2934
2946
  return;
2935
2947
  }
2936
- const { contractAddress: a, id: i } = n;
2937
- const s = `${a}${i}`;
2938
- const c = e.get(s);
2939
- if (!c) e.set(s, { ...n });
2948
+ const { contractAddress: a, id: s } = n;
2949
+ const i = `${a}${s}`;
2950
+ const c = e.get(i);
2951
+ if (!c) e.set(i, { ...n });
2940
2952
  });
2941
2953
  return t.concat(Array.from(e.values()));
2942
2954
  };
2943
- var gr = (r) => No(vo(ko(r)));
2955
+ var gr = (r) => _o(No(vo(r)));
2944
2956
 
2945
2957
  // src/smartCheckout/balanceCheck/balanceRequirement.ts
2946
- import { Contract as _o, formatUnits as De } from "ethers";
2958
+ import { Contract as Oo, formatUnits as De } from "ethers";
2947
2959
  var Rr = (r) => r.map((e) => {
2948
2960
  switch (e.type) {
2949
2961
  case "ERC20":
@@ -2963,18 +2975,18 @@ var Rr = (r) => r.map((e) => {
2963
2975
  });
2964
2976
  var Cr = (r, e) => {
2965
2977
  const t = BigInt(1);
2966
- const n = e.find((s) => {
2967
- const c = s;
2968
- return I(
2978
+ const n = e.find((i) => {
2979
+ const c = i;
2980
+ return T(
2969
2981
  c.contractAddress,
2970
2982
  r.contractAddress
2971
2983
  ) && c.id === r.id;
2972
2984
  });
2973
2985
  const o = t < 0 || t === 0n || n && n.balance >= t;
2974
2986
  const a = t - (n?.balance ?? BigInt(0));
2975
- let i = n;
2976
- if (!i) {
2977
- i = {
2987
+ let s = n;
2988
+ if (!s) {
2989
+ s = {
2978
2990
  type: "ERC721",
2979
2991
  balance: BigInt(0),
2980
2992
  formattedBalance: "0",
@@ -2989,19 +3001,19 @@ var Cr = (r, e) => {
2989
3001
  balance: a,
2990
3002
  formattedBalance: a.toString()
2991
3003
  },
2992
- current: i,
3004
+ current: s,
2993
3005
  required: {
2994
- ...i,
3006
+ ...s,
2995
3007
  balance: BigInt(1),
2996
3008
  formattedBalance: "1"
2997
3009
  },
2998
3010
  isFee: false
2999
3011
  };
3000
3012
  };
3001
- var Ir = (r, e) => {
3013
+ var Tr = (r, e) => {
3002
3014
  if (r.type === "ERC20") {
3003
3015
  return e.find((t) => {
3004
- return I(
3016
+ return T(
3005
3017
  t.token?.address,
3006
3018
  r.tokenAddress
3007
3019
  );
@@ -3011,25 +3023,25 @@ var Ir = (r, e) => {
3011
3023
  return O(t.token?.address);
3012
3024
  });
3013
3025
  };
3014
- var Tr = async (r, e, t) => {
3026
+ var Ir = async (r, e, t) => {
3015
3027
  const n = {};
3016
3028
  for (const o of r) {
3017
3029
  if (o.type === "NATIVE") {
3018
3030
  n[_] = we;
3019
3031
  continue;
3020
3032
  }
3021
- const a = Ir(o, e);
3022
- let i = a?.token.address ?? "";
3023
- let s = a?.token.name ?? "";
3033
+ const a = Tr(o, e);
3034
+ let s = a?.token.address ?? "";
3035
+ let i = a?.token.name ?? "";
3024
3036
  let c = a?.token.symbol ?? "";
3025
3037
  let d = a?.token.decimals ?? G;
3026
3038
  if (!a && o.type === "ERC20") {
3027
- i = o.tokenAddress;
3028
- if (i.toLowerCase() in n) {
3039
+ s = o.tokenAddress;
3040
+ if (s.toLowerCase() in n) {
3029
3041
  continue;
3030
3042
  }
3031
3043
  try {
3032
- const p = new _o(
3044
+ const p = new Oo(
3033
3045
  o.tokenAddress,
3034
3046
  JSON.stringify(L),
3035
3047
  t
@@ -3039,9 +3051,9 @@ var Tr = async (r, e, t) => {
3039
3051
  p.symbol(),
3040
3052
  p.decimals()
3041
3053
  ]);
3042
- i = o.tokenAddress;
3054
+ s = o.tokenAddress;
3043
3055
  d = E;
3044
- s = u;
3056
+ i = u;
3045
3057
  c = m;
3046
3058
  } catch (p) {
3047
3059
  console.error(
@@ -3050,9 +3062,9 @@ var Tr = async (r, e, t) => {
3050
3062
  );
3051
3063
  }
3052
3064
  }
3053
- n[i.toLowerCase()] = {
3054
- address: i,
3055
- name: s,
3065
+ n[s.toLowerCase()] = {
3066
+ address: s,
3067
+ name: i,
3056
3068
  symbol: c,
3057
3069
  decimals: d
3058
3070
  };
@@ -3060,10 +3072,10 @@ var Tr = async (r, e, t) => {
3060
3072
  return n;
3061
3073
  };
3062
3074
  var hr = (r, e, t) => {
3063
- let n = Ir(r, e);
3075
+ let n = Tr(r, e);
3064
3076
  const o = r.amount;
3065
3077
  const a = o < 0 || o === 0n || n && n?.balance >= o;
3066
- const i = o - (n?.balance ?? BigInt(0));
3078
+ const s = o - (n?.balance ?? BigInt(0));
3067
3079
  if (r.type === "NATIVE") {
3068
3080
  if (!n) {
3069
3081
  n = {
@@ -3077,8 +3089,8 @@ var hr = (r, e, t) => {
3077
3089
  sufficient: a ?? false,
3078
3090
  type: "NATIVE",
3079
3091
  delta: {
3080
- balance: i,
3081
- formattedBalance: De(i, t.decimals)
3092
+ balance: s,
3093
+ formattedBalance: De(s, t.decimals)
3082
3094
  },
3083
3095
  current: {
3084
3096
  ...n,
@@ -3107,8 +3119,8 @@ var hr = (r, e, t) => {
3107
3119
  sufficient: a ?? false,
3108
3120
  type: "ERC20",
3109
3121
  delta: {
3110
- balance: i,
3111
- formattedBalance: De(i, t.decimals)
3122
+ balance: s,
3123
+ formattedBalance: De(s, t.decimals)
3112
3124
  },
3113
3125
  current: {
3114
3126
  ...n,
@@ -3125,18 +3137,18 @@ var hr = (r, e, t) => {
3125
3137
  };
3126
3138
 
3127
3139
  // src/smartCheckout/balanceCheck/balanceCheck.ts
3128
- var Bo = async (r, e, t, n, o = false) => {
3140
+ var xo = async (r, e, t, n, o = false) => {
3129
3141
  try {
3130
3142
  const a = /* @__PURE__ */ new Map();
3131
3143
  Rr(n).forEach(
3132
- (s) => {
3133
- if (!s.address) return;
3134
- a.set(s.address.toLocaleLowerCase(), s);
3144
+ (i) => {
3145
+ if (!i.address) return;
3146
+ a.set(i.address.toLocaleLowerCase(), i);
3135
3147
  }
3136
3148
  );
3137
- const { balances: i } = await q(r, e, t, A(r), o);
3138
- return i.filter(
3139
- (s) => a.get((s.token.address || _).toLocaleLowerCase())
3149
+ const { balances: s } = await q(r, e, t, A(r), o);
3150
+ return s.filter(
3151
+ (i) => a.get((i.token.address || _).toLocaleLowerCase())
3140
3152
  );
3141
3153
  } catch (a) {
3142
3154
  throw new l(
@@ -3146,27 +3158,27 @@ var Bo = async (r, e, t, n, o = false) => {
3146
3158
  );
3147
3159
  }
3148
3160
  };
3149
- var xo = async (r, e, t) => {
3161
+ var bo = async (r, e, t) => {
3150
3162
  const n = [];
3151
3163
  const o = /* @__PURE__ */ new Map();
3152
3164
  const a = /* @__PURE__ */ new Map();
3153
- t.forEach((i) => {
3154
- if (i.type !== "ERC721") return;
3155
- const s = new Oo(
3156
- i.contractAddress,
3165
+ t.forEach((s) => {
3166
+ if (s.type !== "ERC721") return;
3167
+ const i = new Mo(
3168
+ s.contractAddress,
3157
3169
  JSON.stringify(re),
3158
3170
  r
3159
3171
  );
3160
- o.set(i.contractAddress, i);
3161
- a.set(i.contractAddress, s.ownerOf(i.id));
3172
+ o.set(s.contractAddress, s);
3173
+ a.set(s.contractAddress, i.ownerOf(s.id));
3162
3174
  });
3163
3175
  try {
3164
- const i = await Promise.all(a.values());
3165
- const s = Array.from(a.keys());
3166
- i.forEach((c, d) => {
3167
- const p = o.get(s[d]);
3176
+ const s = await Promise.all(a.values());
3177
+ const i = Array.from(a.keys());
3178
+ s.forEach((c, d) => {
3179
+ const p = o.get(i[d]);
3168
3180
  let u = 0;
3169
- if (p && I(e, c)) {
3181
+ if (p && T(e, c)) {
3170
3182
  u = 1;
3171
3183
  }
3172
3184
  n.push({
@@ -3177,59 +3189,59 @@ var xo = async (r, e, t) => {
3177
3189
  id: p.id
3178
3190
  });
3179
3191
  });
3180
- } catch (i) {
3192
+ } catch (s) {
3181
3193
  throw new l(
3182
3194
  "Failed to get ERC721 balances",
3183
3195
  "GET_ERC721_BALANCE_ERROR",
3184
- { error: i }
3196
+ { error: s }
3185
3197
  );
3186
3198
  }
3187
3199
  return n;
3188
3200
  };
3189
3201
  var Ar = async (r, e, t, n, o = false) => {
3190
3202
  const a = gr(n);
3191
- const i = [];
3192
3203
  const s = [];
3204
+ const i = [];
3193
3205
  a.forEach((m) => {
3194
3206
  switch (m.type) {
3195
3207
  case "ERC20":
3196
3208
  case "NATIVE":
3197
- i.push(m);
3209
+ s.push(m);
3198
3210
  break;
3199
3211
  case "ERC721":
3200
- s.push(m);
3212
+ i.push(m);
3201
3213
  break;
3202
3214
  default:
3203
3215
  }
3204
3216
  });
3205
- i.sort((m) => "isFee" in m && m.isFee ? 1 : -1);
3206
- if (s.length === 0 && i.length === 0) {
3217
+ s.sort((m) => "isFee" in m && m.isFee ? 1 : -1);
3218
+ if (i.length === 0 && s.length === 0) {
3207
3219
  throw new l(
3208
3220
  "Unsupported item requirement balance check",
3209
3221
  "UNSUPPORTED_BALANCE_REQUIREMENT_ERROR"
3210
3222
  );
3211
3223
  }
3212
3224
  const c = [];
3213
- if (i.length > 0) {
3214
- c.push(Bo(r, e, t, a, o));
3215
- }
3216
3225
  if (s.length > 0) {
3217
- c.push(xo(e, t, a));
3226
+ c.push(xo(r, e, t, a, o));
3227
+ }
3228
+ if (i.length > 0) {
3229
+ c.push(bo(e, t, a));
3218
3230
  }
3219
3231
  const d = await Promise.all(c);
3220
3232
  const p = [];
3221
- if (i.length > 0) {
3233
+ if (s.length > 0) {
3222
3234
  const m = d.shift() ?? [];
3223
3235
  const E = new Map(m.map((f) => {
3224
3236
  const R = f.type === "NATIVE" ? _ : f.token.address?.toLowerCase();
3225
3237
  return [R, f];
3226
3238
  }));
3227
- const g = await Tr(i, m, e);
3228
- i.forEach((f) => {
3239
+ const g = await Ir(s, m, e);
3240
+ s.forEach((f) => {
3229
3241
  const R = (f.tokenAddress ?? _).toLowerCase();
3230
- const T = g[R];
3242
+ const I = g[R];
3231
3243
  const C = E.get(R);
3232
- const y = hr(f, [...E.values()], T);
3244
+ const y = hr(f, [...E.values()], I);
3233
3245
  p.push(y);
3234
3246
  if (!C) {
3235
3247
  return;
@@ -3238,13 +3250,13 @@ var Ar = async (r, e, t, n, o = false) => {
3238
3250
  E.set(R, {
3239
3251
  ...C,
3240
3252
  balance: P,
3241
- formattedBalance: Mo(P, y.required.token.decimals)
3253
+ formattedBalance: Bo(P, y.required.token.decimals)
3242
3254
  });
3243
3255
  });
3244
3256
  }
3245
- if (s.length > 0) {
3257
+ if (i.length > 0) {
3246
3258
  const m = d.shift() ?? [];
3247
- s.forEach((E) => {
3259
+ i.forEach((E) => {
3248
3260
  p.push(Cr(E, m));
3249
3261
  });
3250
3262
  }
@@ -3267,7 +3279,7 @@ var yr = async (r, e) => {
3267
3279
  );
3268
3280
  }
3269
3281
  };
3270
- var bo = (r, e) => {
3282
+ var Lo = (r, e) => {
3271
3283
  if (e.type === "TRANSACTION" || e.gasToken.type === "NATIVE") {
3272
3284
  return {
3273
3285
  type: "NATIVE",
@@ -3286,26 +3298,26 @@ var bo = (r, e) => {
3286
3298
  var wr = async (r, e, t) => {
3287
3299
  const n = [];
3288
3300
  let o = BigInt(0);
3289
- for (const i of e) {
3290
- if (i.approvalTransaction === void 0) continue;
3291
- n.push(yr(r, i.approvalTransaction));
3301
+ for (const s of e) {
3302
+ if (s.approvalTransaction === void 0) continue;
3303
+ n.push(yr(r, s.approvalTransaction));
3292
3304
  }
3293
3305
  if (t.type === "TRANSACTION") {
3294
3306
  n.push(yr(r, t.transaction));
3295
3307
  } else {
3296
- const i = await r.getFeeData();
3297
- const s = Et(i);
3298
- if (s !== null) {
3299
- const c = s * t.gasToken.limit;
3308
+ const s = await r.getFeeData();
3309
+ const i = Et(s);
3310
+ if (i !== null) {
3311
+ const c = i * t.gasToken.limit;
3300
3312
  if (c) o += c;
3301
3313
  }
3302
3314
  }
3303
3315
  const a = await Promise.all(n);
3304
- a.forEach((i) => {
3305
- o += i;
3316
+ a.forEach((s) => {
3317
+ o += s;
3306
3318
  });
3307
3319
  if (o === 0n) return null;
3308
- return bo(o, t);
3320
+ return Lo(o, t);
3309
3321
  };
3310
3322
 
3311
3323
  // src/smartCheckout/routing/geoBlocking.ts
@@ -3320,7 +3332,7 @@ var Pr = async (r) => {
3320
3332
  };
3321
3333
 
3322
3334
  // src/smartCheckout/routing/routingOptions.ts
3323
- function Tt(r) {
3335
+ function It(r) {
3324
3336
  return r?.ethereumProvider?.isPassport === true;
3325
3337
  }
3326
3338
  var kr = async (r, e) => {
@@ -3337,14 +3349,14 @@ var kr = async (r, e) => {
3337
3349
  n.push({ id: "swap", promise: Pr(r) });
3338
3350
  }
3339
3351
  if (n.length > 0) {
3340
- const o = n.map((i) => i.promise);
3352
+ const o = n.map((s) => s.promise);
3341
3353
  const a = await Promise.allSettled(o);
3342
- a.forEach((i, s) => {
3343
- const c = n[s].id;
3344
- t[c] = t[c] && i.status === "fulfilled" && i.value;
3354
+ a.forEach((s, i) => {
3355
+ const c = n[i].id;
3356
+ t[c] = t[c] && s.status === "fulfilled" && s.value;
3345
3357
  });
3346
3358
  }
3347
- t.bridge = t.bridge && !Tt(e);
3359
+ t.bridge = t.bridge && !It(e);
3348
3360
  return t;
3349
3361
  };
3350
3362
 
@@ -3353,52 +3365,52 @@ var vr = async (r, e, t, n) => {
3353
3365
  const o = /* @__PURE__ */ new Map();
3354
3366
  const a = /* @__PURE__ */ new Map();
3355
3367
  if (e.size === 0) {
3356
- const s = {
3368
+ const i = {
3357
3369
  success: false,
3358
3370
  error: new l("No L1 or L2 provider available", "PROVIDER_ERROR"),
3359
3371
  balances: []
3360
3372
  };
3361
- o.set(N(r), s);
3362
- o.set(A(r), s);
3373
+ o.set(N(r), i);
3374
+ o.set(A(r), i);
3363
3375
  return o;
3364
3376
  }
3365
3377
  if (n.bridge) {
3366
- const s = N(r);
3367
- if (e.has(s)) {
3368
- a.set(s, q(
3378
+ const i = N(r);
3379
+ if (e.has(i)) {
3380
+ a.set(i, q(
3369
3381
  r,
3370
- e.get(s),
3382
+ e.get(i),
3371
3383
  t,
3372
- s
3384
+ i
3373
3385
  ));
3374
3386
  } else {
3375
3387
  o.set(N(r), {
3376
3388
  success: false,
3377
- error: new l(`No L1 provider available for ${s}`, "PROVIDER_ERROR"),
3389
+ error: new l(`No L1 provider available for ${i}`, "PROVIDER_ERROR"),
3378
3390
  balances: []
3379
3391
  });
3380
3392
  }
3381
3393
  }
3382
- const i = A(r);
3383
- if (e.has(i)) {
3384
- a.set(i, q(
3394
+ const s = A(r);
3395
+ if (e.has(s)) {
3396
+ a.set(s, q(
3385
3397
  r,
3386
- e.get(i),
3398
+ e.get(s),
3387
3399
  t,
3388
- i
3400
+ s
3389
3401
  ));
3390
3402
  } else {
3391
3403
  o.set(A(r), {
3392
3404
  success: false,
3393
- error: new l(`No L2 provider available for ${i}`, "PROVIDER_ERROR"),
3405
+ error: new l(`No L2 provider available for ${s}`, "PROVIDER_ERROR"),
3394
3406
  balances: []
3395
3407
  });
3396
3408
  }
3397
3409
  if (a.size > 0) {
3398
- const s = Array.from(a.keys());
3410
+ const i = Array.from(a.keys());
3399
3411
  const c = await Promise.allSettled(a.values());
3400
3412
  c.forEach((d, p) => {
3401
- const u = s[p];
3413
+ const u = i[p];
3402
3414
  if (d.status === "fulfilled") {
3403
3415
  o.set(u, {
3404
3416
  success: true,
@@ -3407,7 +3419,7 @@ var vr = async (r, e, t, n) => {
3407
3419
  } else {
3408
3420
  o.set(u, {
3409
3421
  success: false,
3410
- error: new l(`Error getting ${i} balances`, "GET_BALANCE_ERROR"),
3422
+ error: new l(`Error getting ${s} balances`, "GET_BALANCE_ERROR"),
3411
3423
  balances: []
3412
3424
  });
3413
3425
  }
@@ -3422,19 +3434,19 @@ import { formatUnits as We } from "ethers";
3422
3434
  // src/smartCheckout/routing/swap/quoteFetcher.ts
3423
3435
  var Fe = async (r, e, t, n, o) => {
3424
3436
  const a = /* @__PURE__ */ new Map();
3425
- const i = 1;
3437
+ const s = 1;
3426
3438
  try {
3427
- const s = await oe(e, r);
3439
+ const i = await oe(e, r);
3428
3440
  const c = [];
3429
3441
  const d = [];
3430
3442
  for (const u of o) {
3431
3443
  if (u === n.address) continue;
3432
- c.push(s.getUnsignedSwapTxFromAmountOut(
3444
+ c.push(i.getUnsignedSwapTxFromAmountOut(
3433
3445
  t,
3434
3446
  u,
3435
3447
  n.address,
3436
3448
  n.amount,
3437
- i
3449
+ s
3438
3450
  ));
3439
3451
  d.push(u);
3440
3452
  }
@@ -3459,7 +3471,7 @@ var Fe = async (r, e, t, n, o) => {
3459
3471
  };
3460
3472
 
3461
3473
  // src/smartCheckout/routing/swap/swapRoute.ts
3462
- var Lo = (r, e, t) => {
3474
+ var Do = (r, e, t) => {
3463
3475
  let n = BigInt(0);
3464
3476
  let o = "0";
3465
3477
  let a;
@@ -3473,12 +3485,12 @@ var Lo = (r, e, t) => {
3473
3485
  decimals: r.token.decimals
3474
3486
  };
3475
3487
  }
3476
- let i = BigInt(0);
3477
- let s = "0";
3488
+ let s = BigInt(0);
3489
+ let i = "0";
3478
3490
  let c;
3479
3491
  if (e) {
3480
- i = e.value;
3481
- s = We(e.value, e.token.decimals);
3492
+ s = e.value;
3493
+ i = We(e.value, e.token.decimals);
3482
3494
  c = {
3483
3495
  name: e.token.name ?? "",
3484
3496
  symbol: e.token.symbol ?? "",
@@ -3510,14 +3522,14 @@ var Lo = (r, e, t) => {
3510
3522
  },
3511
3523
  swapGasFee: {
3512
3524
  type: "GAS",
3513
- amount: i,
3514
- formattedAmount: s,
3525
+ amount: s,
3526
+ formattedAmount: i,
3515
3527
  token: c
3516
3528
  },
3517
3529
  swapFees: d
3518
3530
  };
3519
3531
  };
3520
- var Do = (r, e, t, n) => {
3532
+ var Fo = (r, e, t, n) => {
3521
3533
  const o = t.token.address;
3522
3534
  let a = "ERC20";
3523
3535
  if (O(o)) {
@@ -3544,7 +3556,7 @@ var Do = (r, e, t, n) => {
3544
3556
  fees: n
3545
3557
  };
3546
3558
  };
3547
- var Fo = (r) => {
3559
+ var Wo = (r) => {
3548
3560
  if (r.type === "ERC20") {
3549
3561
  return !!r.required.token.address;
3550
3562
  }
@@ -3553,7 +3565,7 @@ var Fo = (r) => {
3553
3565
  }
3554
3566
  return false;
3555
3567
  };
3556
- var Wo = (r) => {
3568
+ var Uo = (r) => {
3557
3569
  let e = "";
3558
3570
  let t = BigInt(0);
3559
3571
  switch (r.type) {
@@ -3569,7 +3581,7 @@ var Wo = (r) => {
3569
3581
  }
3570
3582
  return { address: e, amount: t };
3571
3583
  };
3572
- var Uo = (r, e) => {
3584
+ var Go = (r, e) => {
3573
3585
  if (!e) return { sufficient: true, approvalGasFee: BigInt(0), approvalGasTokenAddress: "" };
3574
3586
  const t = e.value;
3575
3587
  const n = e.token.address;
@@ -3581,7 +3593,7 @@ var Uo = (r, e) => {
3581
3593
  };
3582
3594
  }
3583
3595
  const o = r.find(
3584
- (a) => O(a.token.address) && O(n) || I(a.token.address, n)
3596
+ (a) => O(a.token.address) && O(n) || T(a.token.address, n)
3585
3597
  );
3586
3598
  if (!o) return { sufficient: false, approvalGasFee: t, approvalGasTokenAddress: n };
3587
3599
  if (o.balance < t) {
@@ -3593,84 +3605,84 @@ var Uo = (r, e) => {
3593
3605
  }
3594
3606
  return { sufficient: true, approvalGasFee: t, approvalGasTokenAddress: n };
3595
3607
  };
3596
- var Go = (r, e, t, n, o) => {
3608
+ var qo = (r, e, t, n, o) => {
3597
3609
  const a = /* @__PURE__ */ new Map();
3598
3610
  if (e.approvalGasFee > BigInt(0)) {
3599
3611
  a.set(e.approvalGasTokenAddress, e.approvalGasFee);
3600
3612
  }
3601
3613
  if (t) {
3602
- const i = a.get(t.token.address);
3603
- if (i) {
3604
- a.set(t.token.address, i + t.value);
3614
+ const s = a.get(t.token.address);
3615
+ if (s) {
3616
+ a.set(t.token.address, s + t.value);
3605
3617
  } else {
3606
3618
  a.set(t.token.address, t.value);
3607
3619
  }
3608
3620
  }
3609
3621
  if (o) {
3610
- const i = a.get(o.address);
3611
- if (i) {
3612
- a.set(o.address, i + o.amount);
3622
+ const s = a.get(o.address);
3623
+ if (s) {
3624
+ a.set(o.address, s + o.amount);
3613
3625
  } else {
3614
3626
  a.set(o.address, o.amount);
3615
3627
  }
3616
3628
  }
3617
- for (const i of n) {
3618
- const s = a.get(i.amount.token.address);
3619
- if (s) {
3620
- a.set(i.amount.token.address, s + i.amount.value);
3629
+ for (const s of n) {
3630
+ const i = a.get(s.amount.token.address);
3631
+ if (i) {
3632
+ a.set(s.amount.token.address, i + s.amount.value);
3621
3633
  continue;
3622
3634
  }
3623
- a.set(i.amount.token.address, i.amount.value);
3635
+ a.set(s.amount.token.address, s.amount.value);
3624
3636
  }
3625
- for (const [i, s] of a.entries()) {
3626
- if (s === BigInt(0)) continue;
3637
+ for (const [s, i] of a.entries()) {
3638
+ if (i === BigInt(0)) continue;
3627
3639
  const c = r.find(
3628
- (d) => O(d.token.address) && O(i) || I(d.token.address, i)
3640
+ (d) => O(d.token.address) && O(s) || T(d.token.address, s)
3629
3641
  );
3630
3642
  if (!c) {
3631
3643
  return false;
3632
3644
  }
3633
- if (c.balance < s) {
3645
+ if (c.balance < i) {
3634
3646
  return false;
3635
3647
  }
3636
3648
  }
3637
3649
  return true;
3638
3650
  };
3639
- var qo = (r, e, t, n, o, a) => {
3640
- let i = BigInt(0);
3641
- let s = "";
3651
+ var jo = (r, e, t, n, o, a) => {
3652
+ let s = BigInt(0);
3653
+ let i = "";
3642
3654
  let c = false;
3643
3655
  e.balanceRequirements.forEach((d) => {
3644
3656
  if (d.type === "NATIVE" || d.type === "ERC20") {
3645
- if (d.required.token.address && I(d.required.token.address, t)) {
3646
- s = d.required.token.address;
3657
+ if (d.required.token.address && T(d.required.token.address, t)) {
3658
+ i = d.required.token.address;
3647
3659
  c = true;
3648
- i = r - d.required.balance;
3660
+ s = r - d.required.balance;
3649
3661
  }
3650
3662
  }
3651
3663
  });
3652
3664
  if (!c) return true;
3653
- if (I(o.approvalGasTokenAddress, s)) {
3654
- i -= o.approvalGasFee;
3665
+ if (T(o.approvalGasTokenAddress, i)) {
3666
+ s -= o.approvalGasFee;
3655
3667
  }
3656
3668
  for (const d of a) {
3657
- if (I(d.amount.token.address, s)) {
3658
- i -= d.amount.value;
3669
+ if (T(d.amount.token.address, i)) {
3670
+ s -= d.amount.value;
3659
3671
  }
3660
3672
  }
3661
- return i >= n;
3673
+ return s >= n;
3662
3674
  };
3663
- var Ue = async (r, e, t, n, o, a, i) => {
3664
- const s = [];
3665
- if (!e.swap) return s;
3666
- if (a.length === 0) return s;
3667
- if (!Fo(n)) return s;
3668
- const c = Wo(n);
3675
+ var Ue = async (r, e, t, n, o, a, s) => {
3676
+ const i = [];
3677
+ if (!e.swap) return i;
3678
+ if (a.length === 0) return i;
3679
+ if (!Wo(n)) return i;
3680
+ const c = Uo(n);
3669
3681
  const d = A(r);
3670
3682
  const p = o.get(d);
3671
- if (!p) return s;
3683
+ if (!p) return i;
3672
3684
  const u = p.balances;
3673
- if (u.length === 0) return s;
3685
+ if (u.length === 0) return i;
3674
3686
  const m = await Fe(
3675
3687
  r,
3676
3688
  A(r),
@@ -3683,42 +3695,42 @@ var Ue = async (r, e, t, n, o, a, i) => {
3683
3695
  const f = m.get(g);
3684
3696
  if (!f) continue;
3685
3697
  const R = u.find(
3686
- (P) => I(P.token.address, g)
3698
+ (P) => T(P.token.address, g)
3687
3699
  );
3688
3700
  if (!R) continue;
3689
- const T = f.quote.amountWithMaxSlippage;
3690
- if (R.balance < T.value) continue;
3691
- const C = Uo(u, f.approval);
3701
+ const I = f.quote.amountWithMaxSlippage;
3702
+ if (R.balance < I.value) continue;
3703
+ const C = Go(u, f.approval);
3692
3704
  if (!C.sufficient) continue;
3693
- if (!Go(
3705
+ if (!qo(
3694
3706
  u,
3695
3707
  C,
3696
3708
  f.swap,
3697
3709
  f.quote.fees,
3698
3710
  {
3699
- amount: T.value,
3711
+ amount: I.value,
3700
3712
  address: g
3701
3713
  }
3702
3714
  )) continue;
3703
- if (!qo(
3715
+ if (!jo(
3704
3716
  R.balance,
3705
- i,
3717
+ s,
3706
3718
  g,
3707
- T.value,
3719
+ I.value,
3708
3720
  C,
3709
3721
  f.quote.fees
3710
3722
  )) continue;
3711
- const y = Lo(f.approval, f.swap, f.quote.fees);
3712
- s.push(
3713
- Do(
3723
+ const y = Do(f.approval, f.swap, f.quote.fees);
3724
+ i.push(
3725
+ Fo(
3714
3726
  d,
3715
- T.value,
3727
+ I.value,
3716
3728
  R,
3717
3729
  y
3718
3730
  )
3719
3731
  );
3720
3732
  }
3721
- return s;
3733
+ return i;
3722
3734
  };
3723
3735
 
3724
3736
  // src/smartCheckout/allowList/allowListCheck.ts
@@ -3727,7 +3739,7 @@ var Nr = (r, e) => {
3727
3739
  return r.filter((t) => {
3728
3740
  if ("address" in t) {
3729
3741
  return e.balances.find(
3730
- (n) => I(n.token.address, t.address) && n.balance > 0
3742
+ (n) => T(n.token.address, t.address) && n.balance > 0
3731
3743
  );
3732
3744
  }
3733
3745
  return e.balances.find((n) => !("address" in n.token) && n.balance > 0);
@@ -3751,7 +3763,7 @@ var At = async (r, e, t) => {
3751
3763
  }
3752
3764
  return [];
3753
3765
  };
3754
- var jo = async (r, e, t) => {
3766
+ var Vo = async (r, e, t) => {
3755
3767
  if (t.swap) {
3756
3768
  const n = (await H(r, { type: "swap" })).tokens;
3757
3769
  const o = e.get(A(r));
@@ -3761,14 +3773,14 @@ var jo = async (r, e, t) => {
3761
3773
  };
3762
3774
  var _r = async (r, e, t) => {
3763
3775
  const n = {};
3764
- n.swap = await jo(r, e, t);
3776
+ n.swap = await Vo(r, e, t);
3765
3777
  n.bridge = await At(r, e, t);
3766
3778
  n.onRamp = await ht(r, t);
3767
3779
  return n;
3768
3780
  };
3769
3781
 
3770
3782
  // src/smartCheckout/routing/bridgeAndSwap/bridgeAndSwapRoute.ts
3771
- import { formatUnits as $o } from "ethers";
3783
+ import { formatUnits as Xo } from "ethers";
3772
3784
 
3773
3785
  // src/smartCheckout/routing/bridge/bridgeRoute.ts
3774
3786
  import { formatUnits as qe } from "ethers";
@@ -3784,7 +3796,7 @@ var Or = (r) => {
3784
3796
  };
3785
3797
 
3786
3798
  // src/smartCheckout/routing/bridge/getBridgeFeeEstimate.ts
3787
- import { BridgeFeeActions as Vo } from "@imtbl/bridge-sdk";
3799
+ import { BridgeFeeActions as Ho } from "@imtbl/bridge-sdk";
3788
3800
  var Mr = async (r, e, t, n) => {
3789
3801
  const o = Me(
3790
3802
  t,
@@ -3795,7 +3807,7 @@ var Mr = async (r, e, t, n) => {
3795
3807
  try {
3796
3808
  const a = await o.getFee(
3797
3809
  {
3798
- action: Vo.DEPOSIT,
3810
+ action: Ho.DEPOSIT,
3799
3811
  gasMultiplier: "auto",
3800
3812
  sourceChainId: t.toString(),
3801
3813
  destinationChainId: n.toString()
@@ -3816,13 +3828,13 @@ var Mr = async (r, e, t, n) => {
3816
3828
 
3817
3829
  // src/smartCheckout/routing/indexer/fetchL1Representation.ts
3818
3830
  var J = "0x0000000000000000000000000000000000000eee";
3819
- var Ho = (r) => {
3831
+ var zo = (r) => {
3820
3832
  if (r === 13371) return "imtbl-zkevm-mainnet";
3821
3833
  if (r === 13473) return "imtbl-zkevm-testnet";
3822
3834
  if (r === 15003) return "imtbl-zkevm-devnet";
3823
3835
  return "";
3824
3836
  };
3825
- var zo = async (r, e) => {
3837
+ var Ko = async (r, e) => {
3826
3838
  const t = await e.remote.getConfig(
3827
3839
  "imxAddressMapping"
3828
3840
  );
@@ -3831,18 +3843,18 @@ var zo = async (r, e) => {
3831
3843
  var Ge = async (r, e) => {
3832
3844
  if (O(e)) {
3833
3845
  return {
3834
- l1address: await zo(N(r), r),
3846
+ l1address: await Ko(N(r), r),
3835
3847
  l2address: _
3836
3848
  };
3837
3849
  }
3838
- const t = Ho(A(r));
3850
+ const t = zo(A(r));
3839
3851
  const n = Be(r);
3840
3852
  const o = await n.getToken({
3841
3853
  chainName: t,
3842
3854
  contractAddress: e
3843
3855
  });
3844
3856
  const a = o.result.root_contract_address;
3845
- if (I(a ?? "", J)) {
3857
+ if (T(a ?? "", J)) {
3846
3858
  return {
3847
3859
  l1address: "native",
3848
3860
  l2address: e
@@ -3856,15 +3868,15 @@ var Ge = async (r, e) => {
3856
3868
  };
3857
3869
 
3858
3870
  // src/smartCheckout/routing/bridge/bridgeRoute.ts
3859
- var Ko = (r, e) => {
3871
+ var Qo = (r, e) => {
3860
3872
  const t = Or(r);
3861
3873
  return t >= e;
3862
3874
  };
3863
3875
  var Br = (r, e, t, n, o) => {
3864
3876
  const a = o?.decimals ?? G;
3865
- const i = [];
3877
+ const s = [];
3866
3878
  if (e > 0) {
3867
- i.push({
3879
+ s.push({
3868
3880
  type: "BRIDGE_FEE",
3869
3881
  amount: e,
3870
3882
  formattedAmount: qe(e, a),
@@ -3872,7 +3884,7 @@ var Br = (r, e, t, n, o) => {
3872
3884
  });
3873
3885
  }
3874
3886
  if (t > 0) {
3875
- i.push({
3887
+ s.push({
3876
3888
  type: "IMMUTABLE_FEE",
3877
3889
  amount: t,
3878
3890
  formattedAmount: qe(t, a),
@@ -3892,7 +3904,7 @@ var Br = (r, e, t, n, o) => {
3892
3904
  formattedAmount: qe(r, G),
3893
3905
  token: o
3894
3906
  },
3895
- bridgeFees: i
3907
+ bridgeFees: s
3896
3908
  };
3897
3909
  };
3898
3910
  var xr = (r, e, t, n, o) => ({
@@ -3920,8 +3932,8 @@ var xr = (r, e, t, n, o) => ({
3920
3932
  var je = async (r, e, t, n, o) => {
3921
3933
  if (!t.bridge) return void 0;
3922
3934
  const a = N(r);
3923
- const i = A(r);
3924
- const s = r.networkMap.get(a)?.nativeCurrency;
3935
+ const s = A(r);
3936
+ const i = r.networkMap.get(a)?.nativeCurrency;
3925
3937
  const c = o.get(a);
3926
3938
  const d = e.get(a);
3927
3939
  if (!d) {
@@ -3939,47 +3951,47 @@ var je = async (r, e, t, n, o) => {
3939
3951
  const { l1address: m } = u;
3940
3952
  if (O(m)) {
3941
3953
  if (!p.find((P) => O(P.address))) return void 0;
3942
- } else if (!p.find((P) => I(P.address, m))) {
3954
+ } else if (!p.find((P) => T(P.address, m))) {
3943
3955
  return void 0;
3944
3956
  }
3945
3957
  const E = await Mr(
3946
3958
  r,
3947
3959
  e,
3948
3960
  a,
3949
- i
3961
+ s
3950
3962
  );
3951
3963
  const {
3952
3964
  sourceChainGas: g,
3953
3965
  approvalGas: f,
3954
3966
  bridgeFee: R,
3955
- imtblFee: T,
3967
+ imtblFee: I,
3956
3968
  totalFees: C
3957
3969
  } = E;
3958
- if (!Ko(c, C)) return void 0;
3970
+ if (!Qo(c, C)) return void 0;
3959
3971
  if (O(m)) {
3960
3972
  const P = c.balances.find((v) => O(v.token.address));
3961
3973
  if (P && P.balance >= n.amount + C) {
3962
3974
  const v = Br(
3963
3975
  g,
3964
3976
  R,
3965
- T,
3977
+ I,
3966
3978
  f,
3967
- s
3979
+ i
3968
3980
  );
3969
3981
  return xr(a, P, n, "NATIVE", v);
3970
3982
  }
3971
3983
  return void 0;
3972
3984
  }
3973
3985
  const y = c.balances.find(
3974
- (P) => I(P.token.address, m)
3986
+ (P) => T(P.token.address, m)
3975
3987
  );
3976
3988
  if (y && y.balance >= n.amount) {
3977
3989
  const P = Br(
3978
3990
  g,
3979
3991
  R,
3980
- T,
3992
+ I,
3981
3993
  f,
3982
- s
3994
+ i
3983
3995
  );
3984
3996
  return xr(a, y, n, "ERC20", P);
3985
3997
  }
@@ -3998,37 +4010,37 @@ var br = (r, e) => {
3998
4010
  if (o.error !== void 0) return t;
3999
4011
  if (!o.success) return t;
4000
4012
  const a = n.balances;
4001
- const i = o.balances;
4002
- return { l1balances: a, l2balances: i };
4013
+ const s = o.balances;
4014
+ return { l1balances: a, l2balances: s };
4003
4015
  };
4004
4016
 
4005
4017
  // src/smartCheckout/routing/bridgeAndSwap/constructBridgeRequirements.ts
4006
- import { formatUnits as Qo } from "ethers";
4007
- var Zo = (r, e) => {
4018
+ import { formatUnits as Zo } from "ethers";
4019
+ var Yo = (r, e) => {
4008
4020
  let t = BigInt(0);
4009
4021
  r.quote.fees.forEach((n) => {
4010
- if (I(n.amount.token.address, e)) {
4022
+ if (T(n.amount.token.address, e)) {
4011
4023
  t += n.amount.value;
4012
4024
  }
4013
4025
  });
4014
4026
  if (r.approval) {
4015
- if (I(r.approval.token.address, e)) {
4027
+ if (T(r.approval.token.address, e)) {
4016
4028
  t += r.approval.value;
4017
4029
  }
4018
4030
  }
4019
4031
  return t;
4020
4032
  };
4021
- var Yo = (r, e) => {
4033
+ var Jo = (r, e) => {
4022
4034
  for (const t of r.balanceRequirements) {
4023
4035
  if (t.type === "NATIVE" || t.type === "ERC20") {
4024
- if (I(t.required.token.address, e)) {
4036
+ if (T(t.required.token.address, e)) {
4025
4037
  return t.required.balance;
4026
4038
  }
4027
4039
  }
4028
4040
  }
4029
4041
  return BigInt(0);
4030
4042
  };
4031
- var Jo = (r, e, t) => {
4043
+ var $o = (r, e, t) => {
4032
4044
  const n = t?.balance ?? BigInt(0);
4033
4045
  if (n >= r + e) {
4034
4046
  return BigInt(0);
@@ -4044,38 +4056,38 @@ var Jo = (r, e, t) => {
4044
4056
  };
4045
4057
  var Lr = (r, e, t, n, o) => {
4046
4058
  const a = [];
4047
- for (const [i, s] of r) {
4048
- const c = t.find((C) => I(C.token.address, i));
4059
+ for (const [s, i] of r) {
4060
+ const c = t.find((C) => T(C.token.address, s));
4049
4061
  const d = n.find(
4050
- (C) => I(C.l2address, i)
4062
+ (C) => T(C.l2address, s)
4051
4063
  );
4052
4064
  if (!d) continue;
4053
4065
  const { l1address: p, l2address: u } = d;
4054
4066
  if (!p) continue;
4055
4067
  const m = e.find((C) => {
4056
- if (C.token.address === void 0 && I(p, J)) {
4068
+ if (C.token.address === void 0 && T(p, J)) {
4057
4069
  return true;
4058
4070
  }
4059
- return I(C.token.address, p);
4071
+ return T(C.token.address, p);
4060
4072
  });
4061
4073
  if (!m) continue;
4062
- const E = s.quote.amountWithMaxSlippage.value;
4063
- const g = Zo(s, i);
4074
+ const E = i.quote.amountWithMaxSlippage.value;
4075
+ const g = Yo(i, s);
4064
4076
  const f = E + g;
4065
- const R = Yo(
4077
+ const R = Jo(
4066
4078
  o,
4067
- i
4079
+ s
4068
4080
  );
4069
- const T = Jo(f, R, c);
4070
- if (T <= 0) {
4081
+ const I = $o(f, R, c);
4082
+ if (I <= 0) {
4071
4083
  continue;
4072
4084
  }
4073
- if (T >= m.balance) {
4085
+ if (I >= m.balance) {
4074
4086
  continue;
4075
4087
  }
4076
4088
  a.push({
4077
- amount: T,
4078
- formattedAmount: Q(Qo(T, m.token.decimals)),
4089
+ amount: I,
4090
+ formattedAmount: Q(Zo(I, m.token.decimals)),
4079
4091
  // L2 address is used for the bridge requirement as the bridge route uses the indexer to find L1 address
4080
4092
  l2address: u
4081
4093
  });
@@ -4093,11 +4105,11 @@ var Dr = async (r, e) => {
4093
4105
  // src/smartCheckout/routing/bridgeAndSwap/getDexQuotes.ts
4094
4106
  var Fr = async (r, e, t, n, o) => {
4095
4107
  const a = [];
4096
- for (const s of o) {
4097
- if (!s.address) continue;
4098
- a.push(s.address);
4108
+ for (const i of o) {
4109
+ if (!i.address) continue;
4110
+ a.push(i.address);
4099
4111
  }
4100
- const i = await Fe(
4112
+ const s = await Fe(
4101
4113
  r,
4102
4114
  A(r),
4103
4115
  e,
@@ -4107,11 +4119,11 @@ var Fr = async (r, e, t, n, o) => {
4107
4119
  },
4108
4120
  a
4109
4121
  );
4110
- return i;
4122
+ return s;
4111
4123
  };
4112
4124
 
4113
4125
  // src/smartCheckout/routing/bridgeAndSwap/bridgeAndSwapRoute.ts
4114
- var Xo = (r, e, t, n, o, a) => {
4126
+ var ea = (r, e, t, n, o, a) => {
4115
4127
  if (r.length === 0) return true;
4116
4128
  if (e.length === 0) return true;
4117
4129
  if (t.length === 0) return true;
@@ -4122,20 +4134,20 @@ var Xo = (r, e, t, n, o, a) => {
4122
4134
  if (a === "") return true;
4123
4135
  return false;
4124
4136
  };
4125
- var ea = (r, e, t, n) => {
4137
+ var ta = (r, e, t, n) => {
4126
4138
  const o = [];
4127
4139
  for (const a of n) {
4128
4140
  if (!e.includes(a.l1address)) continue;
4129
- if (I(a.l2address, r)) continue;
4130
- const i = t.find(
4131
- (s) => I(s.address, a.l2address)
4141
+ if (T(a.l2address, r)) continue;
4142
+ const s = t.find(
4143
+ (i) => T(i.address, a.l2address)
4132
4144
  );
4133
- if (!i) continue;
4134
- o.push(i);
4145
+ if (!s) continue;
4146
+ o.push(s);
4135
4147
  }
4136
4148
  return o;
4137
4149
  };
4138
- var ta = (r, e, t, n, o) => {
4150
+ var ra = (r, e, t, n, o) => {
4139
4151
  const a = /* @__PURE__ */ new Map();
4140
4152
  for (const [c, d] of e) {
4141
4153
  a.set(c, {
@@ -4143,103 +4155,103 @@ var ta = (r, e, t, n, o) => {
4143
4155
  balances: d.balances
4144
4156
  });
4145
4157
  }
4146
- const i = /* @__PURE__ */ new Map();
4158
+ const s = /* @__PURE__ */ new Map();
4147
4159
  for (const c of t) {
4148
4160
  if (!c.token.address) continue;
4149
- i.set(c.token.address, c);
4161
+ s.set(c.token.address, c);
4150
4162
  }
4151
4163
  for (const c of n) {
4152
4164
  const { amount: d, l2address: p } = c;
4153
4165
  if (p === "") continue;
4154
4166
  let u = BigInt(0);
4155
- const m = i.get(p);
4167
+ const m = s.get(p);
4156
4168
  if (m) u = m.balance;
4157
4169
  const E = u + d;
4158
- const g = o.find((f) => I(f.address, p));
4159
- i.set(p, {
4170
+ const g = o.find((f) => T(f.address, p));
4171
+ s.set(p, {
4160
4172
  balance: E,
4161
- formattedBalance: $o(
4173
+ formattedBalance: Xo(
4162
4174
  E,
4163
4175
  g.decimals
4164
4176
  ),
4165
4177
  token: g
4166
4178
  });
4167
4179
  }
4168
- const s = Array.from(i.values());
4180
+ const i = Array.from(s.values());
4169
4181
  a.set(
4170
4182
  A(r),
4171
4183
  {
4172
4184
  success: true,
4173
- balances: s
4185
+ balances: i
4174
4186
  }
4175
4187
  );
4176
4188
  return a;
4177
4189
  };
4178
- var ra = (r, e) => {
4190
+ var na = (r, e) => {
4179
4191
  const t = [];
4180
4192
  for (const n of e) {
4181
4193
  const { chainId: o, fundingItem: a } = n;
4182
- const { userBalance: i } = n.fundingItem;
4183
- const s = r.get(o);
4184
- if (!s) continue;
4194
+ const { userBalance: s } = n.fundingItem;
4195
+ const i = r.get(o);
4196
+ if (!i) continue;
4185
4197
  let c = BigInt(0);
4186
4198
  let d = "0";
4187
- const p = s.balances.find(
4188
- (u) => I(u.token.address, a.token.address)
4199
+ const p = i.balances.find(
4200
+ (u) => T(u.token.address, a.token.address)
4189
4201
  );
4190
4202
  if (p) {
4191
4203
  c = p.balance;
4192
4204
  d = p.formattedBalance;
4193
4205
  }
4194
- i.balance = c;
4195
- i.formattedBalance = d;
4206
+ s.balance = c;
4207
+ s.formattedBalance = d;
4196
4208
  t.push(n);
4197
4209
  }
4198
4210
  return t;
4199
4211
  };
4200
- var na = (r, e, t) => {
4212
+ var oa = (r, e, t) => {
4201
4213
  const n = [];
4202
4214
  for (const o of r) {
4203
4215
  if (!o) continue;
4204
4216
  const a = t.find(
4205
- (s) => {
4217
+ (i) => {
4206
4218
  if (o.fundingItem.token.address === void 0) {
4207
- return I(s.l1address, J) && s.l2address;
4219
+ return T(i.l1address, J) && i.l2address;
4208
4220
  }
4209
- return I(
4210
- s.l1address,
4221
+ return T(
4222
+ i.l1address,
4211
4223
  o.fundingItem.token.address
4212
- ) && s.l2address;
4224
+ ) && i.l2address;
4213
4225
  }
4214
4226
  );
4215
4227
  if (!a) continue;
4216
- const i = e.find(
4217
- (s) => I(s.fundingItem.token.address, a.l2address)
4228
+ const s = e.find(
4229
+ (i) => T(i.fundingItem.token.address, a.l2address)
4218
4230
  );
4219
- if (!i) continue;
4231
+ if (!s) continue;
4220
4232
  n.push({
4221
4233
  bridgeFundingStep: o,
4222
- swapFundingStep: i
4234
+ swapFundingStep: s
4223
4235
  });
4224
4236
  }
4225
4237
  return n;
4226
4238
  };
4227
- var Wr = async (r, e, t, n, o, a, i, s, c) => {
4239
+ var Wr = async (r, e, t, n, o, a, s, i, c) => {
4228
4240
  const { l1balances: d, l2balances: p } = br(r, a);
4229
4241
  const u = n.required.token.address;
4230
- if (Xo(
4231
- i,
4242
+ if (ea(
4232
4243
  s,
4244
+ i,
4233
4245
  d,
4234
4246
  p,
4235
4247
  t,
4236
4248
  u
4237
4249
  )) return [];
4238
- const m = await Dr(r, s);
4239
- const E = ea(
4250
+ const m = await Dr(r, i);
4251
+ const E = ta(
4240
4252
  u,
4241
- i,
4242
4253
  s,
4254
+ i,
4243
4255
  m
4244
4256
  );
4245
4257
  if (E.length === 0) return [];
@@ -4259,7 +4271,7 @@ var Wr = async (r, e, t, n, o, a, i, s, c) => {
4259
4271
  );
4260
4272
  if (f.length === 0) return [];
4261
4273
  const R = /* @__PURE__ */ new Map();
4262
- const T = /* @__PURE__ */ new Map();
4274
+ const I = /* @__PURE__ */ new Map();
4263
4275
  const C = [];
4264
4276
  for (const W of f) {
4265
4277
  if (!W.l2address) continue;
@@ -4273,7 +4285,7 @@ var Wr = async (r, e, t, n, o, a, i, s, c) => {
4273
4285
  a
4274
4286
  )
4275
4287
  );
4276
- T.set(W.l2address, {
4288
+ I.set(W.l2address, {
4277
4289
  amount: W.amount,
4278
4290
  formattedAmount: W.formattedAmount,
4279
4291
  l2address: W.l2address
@@ -4286,7 +4298,7 @@ var Wr = async (r, e, t, n, o, a, i, s, c) => {
4286
4298
  const j = P[Xe];
4287
4299
  if (W === void 0) return;
4288
4300
  v.push(j);
4289
- const k = T.get(j);
4301
+ const k = I.get(j);
4290
4302
  if (!k) return;
4291
4303
  C.push({
4292
4304
  amount: k.amount,
@@ -4296,12 +4308,12 @@ var Wr = async (r, e, t, n, o, a, i, s, c) => {
4296
4308
  });
4297
4309
  if (v.length === 0) return [];
4298
4310
  if (C.length === 0) return [];
4299
- const z = ta(
4311
+ const z = ra(
4300
4312
  r,
4301
4313
  a,
4302
4314
  p,
4303
4315
  C,
4304
- s
4316
+ i
4305
4317
  );
4306
4318
  const ce = await Ue(
4307
4319
  r,
@@ -4313,11 +4325,11 @@ var Wr = async (r, e, t, n, o, a, i, s, c) => {
4313
4325
  c
4314
4326
  );
4315
4327
  if (!ce) return [];
4316
- const $ = ra(
4328
+ const $ = na(
4317
4329
  a,
4318
4330
  ce
4319
4331
  );
4320
- return na(
4332
+ return oa(
4321
4333
  y,
4322
4334
  $,
4323
4335
  m
@@ -4328,16 +4340,16 @@ var Wr = async (r, e, t, n, o, a, i, s, c) => {
4328
4340
  var Ur = async (r, e, t) => {
4329
4341
  if (!["ERC20", "NATIVE"].includes(t.type)) return void 0;
4330
4342
  const { required: n, current: o, delta: a } = t;
4331
- let i = false;
4332
- const s = await ht(r, e);
4333
- s.forEach((c) => {
4343
+ let s = false;
4344
+ const i = await ht(r, e);
4345
+ i.forEach((c) => {
4334
4346
  if (!c.address) return;
4335
4347
  if (!n.token) return;
4336
- if (O(n.token.address) || I(c.address, n.token.address)) {
4337
- i = true;
4348
+ if (O(n.token.address) || T(c.address, n.token.address)) {
4349
+ s = true;
4338
4350
  }
4339
4351
  });
4340
- if (!i) return void 0;
4352
+ if (!s) return void 0;
4341
4353
  return {
4342
4354
  type: "ONRAMP",
4343
4355
  chainId: A(r),
@@ -4357,8 +4369,8 @@ var Ur = async (r, e, t) => {
4357
4369
  };
4358
4370
 
4359
4371
  // src/smartCheckout/routing/routingCalculator.ts
4360
- var oa = (r) => r.bridge || r.swap || r.onRamp;
4361
- var aa = (r) => {
4372
+ var aa = (r) => r.bridge || r.swap || r.onRamp;
4373
+ var sa = (r) => {
4362
4374
  let e = 0;
4363
4375
  let t;
4364
4376
  for (const n of r.balanceRequirements) {
@@ -4376,7 +4388,7 @@ var ia = async (r, e, t, n, o) => {
4376
4388
  if (n.type !== "NATIVE" && n.type !== "ERC20") {
4377
4389
  return void 0;
4378
4390
  }
4379
- const i = {
4391
+ const s = {
4380
4392
  amount: n.delta.balance,
4381
4393
  formattedAmount: n.delta.formattedBalance,
4382
4394
  l2address: n.required.token.address ?? ""
@@ -4386,23 +4398,23 @@ var ia = async (r, e, t, n, o) => {
4386
4398
  r,
4387
4399
  e,
4388
4400
  t,
4389
- i,
4401
+ s,
4390
4402
  o
4391
4403
  );
4392
4404
  }
4393
4405
  return a;
4394
4406
  };
4395
- var sa = async (r, e, t, n, o, a, i) => {
4396
- const s = [];
4397
- if (!e.swap) return s;
4398
- if (t === void 0) return s;
4399
- if (a === void 0) return s;
4407
+ var ca = async (r, e, t, n, o, a, s) => {
4408
+ const i = [];
4409
+ if (!e.swap) return i;
4410
+ if (t === void 0) return i;
4411
+ if (a === void 0) return i;
4400
4412
  const c = o.get(A(r));
4401
- if (!c) return s;
4402
- if (c.error !== void 0 || !c.success) return s;
4403
- if (a.length === 0) return s;
4413
+ if (!c) return i;
4414
+ if (c.error !== void 0 || !c.success) return i;
4415
+ if (a.length === 0) return i;
4404
4416
  const d = a.filter((p) => p.address).map((p) => p.address);
4405
- if (d.length === 0) return s;
4417
+ if (d.length === 0) return i;
4406
4418
  return await Ue(
4407
4419
  r,
4408
4420
  e,
@@ -4410,10 +4422,10 @@ var sa = async (r, e, t, n, o, a, i) => {
4410
4422
  t,
4411
4423
  o,
4412
4424
  d,
4413
- i
4425
+ s
4414
4426
  );
4415
4427
  };
4416
- var ca = async (r, e, t, n, o, a, i, s) => {
4428
+ var da = async (r, e, t, n, o, a, s, i) => {
4417
4429
  if (!n) return [];
4418
4430
  const c = a.get(N(r));
4419
4431
  const d = a.get(A(r));
@@ -4421,12 +4433,12 @@ var ca = async (r, e, t, n, o, a, i, s) => {
4421
4433
  if (c.error !== void 0 || !c.success) return [];
4422
4434
  if (!d) return [];
4423
4435
  if (d.error !== void 0 || !d.success) return [];
4424
- const p = i?.bridge ?? [];
4436
+ const p = s?.bridge ?? [];
4425
4437
  const u = p.map((g) => {
4426
4438
  if (g.address === void 0) return J;
4427
4439
  return g.address;
4428
4440
  });
4429
- const m = i?.swap ?? [];
4441
+ const m = s?.swap ?? [];
4430
4442
  if (n.type !== "NATIVE" && n.type !== "ERC20") {
4431
4443
  return [];
4432
4444
  }
@@ -4439,11 +4451,11 @@ var ca = async (r, e, t, n, o, a, i, s) => {
4439
4451
  a,
4440
4452
  u,
4441
4453
  m,
4442
- s
4454
+ i
4443
4455
  );
4444
4456
  return E;
4445
4457
  };
4446
- var da = async (r, e, t) => {
4458
+ var la = async (r, e, t) => {
4447
4459
  if (!e.onRamp) return void 0;
4448
4460
  if (t === void 0) return void 0;
4449
4461
  const n = await Ur(
@@ -4472,7 +4484,7 @@ var He = (r, e, t, n) => {
4472
4484
  n?.(a);
4473
4485
  };
4474
4486
  var Gr = async (r, e, t, n, o) => {
4475
- if (!oa(n)) {
4487
+ if (!aa(n)) {
4476
4488
  return {
4477
4489
  type: "NO_ROUTE_OPTIONS",
4478
4490
  message: "No routing options are available"
@@ -4488,7 +4500,7 @@ var Gr = async (r, e, t, n, o) => {
4488
4500
  { error: u }
4489
4501
  );
4490
4502
  }
4491
- const i = await S(
4503
+ const s = await S(
4492
4504
  r,
4493
4505
  "Time to get token balances inside router",
4494
4506
  vr(
@@ -4498,23 +4510,23 @@ var Gr = async (r, e, t, n, o) => {
4498
4510
  n
4499
4511
  )
4500
4512
  );
4501
- const s = await S(
4513
+ const i = await S(
4502
4514
  r,
4503
4515
  "Time to get routing allowlist",
4504
- _r(r, i, n)
4516
+ _r(r, s, n)
4505
4517
  );
4506
- const c = aa(t);
4518
+ const c = sa(t);
4507
4519
  const d = [];
4508
4520
  const p = [];
4509
4521
  if (n.swap) {
4510
4522
  d.push(
4511
- sa(
4523
+ ca(
4512
4524
  r,
4513
4525
  n,
4514
4526
  c,
4515
4527
  e,
4516
- i,
4517
- s.swap,
4528
+ s,
4529
+ i.swap,
4518
4530
  t
4519
4531
  ).then((u) => {
4520
4532
  u.forEach((m) => {
@@ -4535,7 +4547,7 @@ var Gr = async (r, e, t, n, o) => {
4535
4547
  a,
4536
4548
  n,
4537
4549
  c,
4538
- i
4550
+ s
4539
4551
  ).then((u) => {
4540
4552
  He(
4541
4553
  u,
@@ -4548,7 +4560,7 @@ var Gr = async (r, e, t, n, o) => {
4548
4560
  }
4549
4561
  if (n.onRamp) {
4550
4562
  d.push(
4551
- da(
4563
+ la(
4552
4564
  r,
4553
4565
  n,
4554
4566
  c
@@ -4564,14 +4576,14 @@ var Gr = async (r, e, t, n, o) => {
4564
4576
  }
4565
4577
  if (n.swap && n.bridge) {
4566
4578
  d.push(
4567
- ca(
4579
+ da(
4568
4580
  r,
4569
4581
  a,
4570
4582
  n,
4571
4583
  c,
4572
4584
  e,
4573
- i,
4574
4585
  s,
4586
+ i,
4575
4587
  t
4576
4588
  ).then((u) => {
4577
4589
  u.forEach((m) => {
@@ -4603,7 +4615,7 @@ var Gr = async (r, e, t, n, o) => {
4603
4615
  };
4604
4616
 
4605
4617
  // src/smartCheckout/smartCheckout.ts
4606
- var la = (r) => {
4618
+ var pa = (r) => {
4607
4619
  const e = r.balanceRequirements.map(
4608
4620
  (t) => {
4609
4621
  if (t.type === "ERC20" && t.sufficient) {
@@ -4624,8 +4636,8 @@ var la = (r) => {
4624
4636
  balanceRequirements: e
4625
4637
  };
4626
4638
  };
4627
- var qr = async (r, e, t, n, o, a, i, s, c) => {
4628
- const d = !i || t && s ? la(a) : a;
4639
+ var qr = async (r, e, t, n, o, a, s, i, c) => {
4640
+ const d = !s || t && i ? pa(a) : a;
4629
4641
  const p = await S(
4630
4642
  r,
4631
4643
  "Total time to run the routing calculator",
@@ -4637,7 +4649,7 @@ var qr = async (r, e, t, n, o, a, i, s, c) => {
4637
4649
  c
4638
4650
  )
4639
4651
  );
4640
- s?.({
4652
+ i?.({
4641
4653
  sufficient: t,
4642
4654
  transactionRequirements: o,
4643
4655
  router: {
@@ -4647,7 +4659,7 @@ var qr = async (r, e, t, n, o, a, i, s, c) => {
4647
4659
  });
4648
4660
  return p;
4649
4661
  };
4650
- var se = async (r, e, t, n, o, a, i, s = false) => {
4662
+ var ie = async (r, e, t, n, o, a, s, i = false) => {
4651
4663
  const c = await (await e.getSigner()).getAddress();
4652
4664
  let d = Ct(t);
4653
4665
  const p = pr(
@@ -4692,7 +4704,7 @@ var se = async (r, e, t, n, o, a, i, s = false) => {
4692
4704
  "Time to run balance checks",
4693
4705
  Ar(r, e, c, d, true)
4694
4706
  );
4695
- const { sufficient: T } = R;
4707
+ const { sufficient: I } = R;
4696
4708
  const C = R.balanceRequirements;
4697
4709
  const y = await S(
4698
4710
  r,
@@ -4706,38 +4718,38 @@ var se = async (r, e, t, n, o, a, i, s = false) => {
4706
4718
  qr(
4707
4719
  r,
4708
4720
  c,
4709
- T,
4721
+ I,
4710
4722
  y,
4711
4723
  C,
4712
4724
  R,
4713
- s,
4725
+ i,
4714
4726
  a,
4715
- i
4727
+ s
4716
4728
  );
4717
4729
  return {
4718
- sufficient: T,
4730
+ sufficient: I,
4719
4731
  transactionRequirements: C
4720
4732
  };
4721
4733
  }
4722
- if (T) {
4734
+ if (I) {
4723
4735
  return {
4724
- sufficient: T,
4736
+ sufficient: I,
4725
4737
  transactionRequirements: C
4726
4738
  };
4727
4739
  }
4728
4740
  const P = await qr(
4729
4741
  r,
4730
4742
  c,
4731
- T,
4743
+ I,
4732
4744
  y,
4733
4745
  C,
4734
4746
  R,
4735
- s,
4747
+ i,
4736
4748
  a,
4737
- i
4749
+ s
4738
4750
  );
4739
4751
  return {
4740
- sufficient: T,
4752
+ sufficient: I,
4741
4753
  transactionRequirements: C,
4742
4754
  router: {
4743
4755
  availableRoutingOptions: y,
@@ -4749,23 +4761,23 @@ var se = async (r, e, t, n, o, a, i, s = false) => {
4749
4761
  // src/smartCheckout/buy/buy.ts
4750
4762
  import {
4751
4763
  constants as Ia,
4752
- OrderStatusName as Ta
4764
+ OrderStatusName as ha
4753
4765
  } from "@imtbl/orderbook";
4754
- import { track as ha } from "@imtbl/metrics";
4766
+ import { track as Aa } from "@imtbl/metrics";
4755
4767
 
4756
4768
  // src/transaction/transaction.ts
4757
4769
  function yt(r) {
4758
4770
  return r?.ethereumProvider?.isPassport === true;
4759
4771
  }
4760
- function ua(r) {
4772
+ function ma(r) {
4761
4773
  return yt(r);
4762
4774
  }
4763
- var ma = async (r, e) => {
4775
+ var fa = async (r, e) => {
4764
4776
  const t = e;
4765
4777
  const { chainId: n } = await r.getNetwork();
4766
4778
  if (!Qt(Number(n))) return t;
4767
4779
  if (typeof t.gasPrice !== "undefined") return t;
4768
- if (ua(r)) {
4780
+ if (ma(r)) {
4769
4781
  t.gasPrice = BigInt(0);
4770
4782
  } else {
4771
4783
  t.maxFeePerGas = nt.maxFeePerGas;
@@ -4797,7 +4809,7 @@ var wt = (r) => {
4797
4809
  var F = async (r, e) => {
4798
4810
  try {
4799
4811
  const t = await r.getSigner();
4800
- const n = await ma(r, e);
4812
+ const n = await fa(r, e);
4801
4813
  const o = await t.sendTransaction(n);
4802
4814
  return {
4803
4815
  transactionResponse: o
@@ -4887,7 +4899,7 @@ var jr = async (r, e) => {
4887
4899
  import {
4888
4900
  TransactionPurpose as Qe,
4889
4901
  ActionType as Ze,
4890
- SignablePurpose as Ea
4902
+ SignablePurpose as ga
4891
4903
  } from "@imtbl/orderbook";
4892
4904
  var Vr = async (r) => {
4893
4905
  let e = [];
@@ -4938,7 +4950,7 @@ var zr = (r, e, t) => {
4938
4950
  let n;
4939
4951
  for (const o of t) {
4940
4952
  if (o.type !== Ze.SIGNABLE) continue;
4941
- if (o.purpose === Ea.CREATE_LISTING) {
4953
+ if (o.purpose === ga.CREATE_LISTING) {
4942
4954
  n = {
4943
4955
  domain: o.message.domain,
4944
4956
  types: o.message.types,
@@ -4955,32 +4967,32 @@ var zr = (r, e, t) => {
4955
4967
  };
4956
4968
 
4957
4969
  // src/smartCheckout/fees/fees.ts
4958
- import { parseUnits as ga } from "ethers";
4970
+ import { parseUnits as Ra } from "ethers";
4959
4971
  var Kr = 1;
4960
4972
  var Ye = 6;
4961
- var Ra = (r, e, t = BigInt(1)) => {
4973
+ var Ca = (r, e, t = BigInt(1)) => {
4962
4974
  const n = r.amount;
4963
4975
  const o = Math.round(n.percentageDecimal * 10 ** Ye);
4964
4976
  const a = e * BigInt(o) / BigInt(10 ** Ye);
4965
4977
  return a - a % t;
4966
4978
  };
4967
- var Ca = (r, e) => {
4979
+ var Ta = (r, e) => {
4968
4980
  const t = r.amount;
4969
- const n = ga(t.token, e);
4981
+ const n = Ra(t.token, e);
4970
4982
  return n;
4971
4983
  };
4972
4984
  var Je = (r, e, t = 18, n = BigInt(1)) => {
4973
4985
  let o = BigInt(0);
4974
4986
  const a = BigInt(e);
4975
- const i = a * BigInt(Kr * 10 ** Ye) / BigInt(10 ** Ye);
4976
- const s = [];
4987
+ const s = a * BigInt(Kr * 10 ** Ye) / BigInt(10 ** Ye);
4988
+ const i = [];
4977
4989
  for (const c of r) {
4978
4990
  let d = BigInt(0);
4979
4991
  if (Object.hasOwn(c.amount, "percentageDecimal")) {
4980
- d = Ra(c, a, n);
4992
+ d = Ca(c, a, n);
4981
4993
  o += d;
4982
4994
  } else if (Object.hasOwn(c.amount, "token")) {
4983
- d = Ca(c, t);
4995
+ d = Ta(c, t);
4984
4996
  o += d;
4985
4997
  } else {
4986
4998
  throw new l(
@@ -4988,24 +5000,24 @@ var Je = (r, e, t = 18, n = BigInt(1)) => {
4988
5000
  "ORDER_FEE_ERROR"
4989
5001
  );
4990
5002
  }
4991
- if (o > i) {
5003
+ if (o > s) {
4992
5004
  throw new l(
4993
5005
  `The combined fees are above the allowed maximum of ${Kr * 100}%`,
4994
5006
  "ORDER_FEE_ERROR"
4995
5007
  );
4996
5008
  }
4997
5009
  if (d > 0) {
4998
- s.push({
5010
+ i.push({
4999
5011
  amount: d.toString(),
5000
5012
  recipientAddress: c.recipient
5001
5013
  });
5002
5014
  }
5003
5015
  }
5004
- return s;
5016
+ return i;
5005
5017
  };
5006
5018
 
5007
5019
  // src/smartCheckout/buy/buy.ts
5008
- var Aa = (r, e, t, n, o = false) => {
5020
+ var ya = (r, e, t, n, o = false) => {
5009
5021
  switch (r) {
5010
5022
  case "ERC20":
5011
5023
  return {
@@ -5024,7 +5036,7 @@ var Aa = (r, e, t, n, o = false) => {
5024
5036
  };
5025
5037
  }
5026
5038
  };
5027
- var ya = (r, e) => {
5039
+ var wa = (r, e) => {
5028
5040
  if (e.length > 0) {
5029
5041
  return {
5030
5042
  type: "TRANSACTION",
@@ -5042,7 +5054,7 @@ var ya = (r, e) => {
5042
5054
  var Qr = async (r, e, t, n = {
5043
5055
  waitFulfillmentSettlements: true
5044
5056
  }) => {
5045
- ha("checkout_sdk", "buy_initiated");
5057
+ Aa("checkout_sdk", "buy_initiated");
5046
5058
  if (t.length === 0) {
5047
5059
  throw new l(
5048
5060
  "No orders were provided to the orders array. Please provide at least one order.",
@@ -5051,8 +5063,8 @@ var Qr = async (r, e, t, n = {
5051
5063
  }
5052
5064
  let o;
5053
5065
  let a = "";
5054
- let i = 18;
5055
- const s = Ia.estimatedFulfillmentGasGwei;
5066
+ let s = 18;
5067
+ const i = Ia.estimatedFulfillmentGasGwei;
5056
5068
  const c = ae(r);
5057
5069
  const d = Be(r);
5058
5070
  const p = await S(
@@ -5101,14 +5113,14 @@ var Qr = async (r, e, t, n = {
5101
5113
  "Time to get decimals of token contract for the buy token",
5102
5114
  d.getToken({ contractAddress: f.contractAddress, chainName: g })
5103
5115
  );
5104
- if (k.result.decimals) i = k.result.decimals;
5116
+ if (k.result.decimals) s = k.result.decimals;
5105
5117
  }
5106
5118
  let R = [];
5107
5119
  if (m && m.length > 0) {
5108
5120
  const k = o.result.sell[0].type === "ERC721" ? BigInt(1) : BigInt(o.result.sell[0].amount);
5109
- R = Je(m, f.amount, i, k);
5121
+ R = Je(m, f.amount, s, k);
5110
5122
  }
5111
- let T = [];
5123
+ let I = [];
5112
5124
  let C = [];
5113
5125
  let y = [];
5114
5126
  const P = performance.now();
@@ -5119,7 +5131,7 @@ var Qr = async (r, e, t, n = {
5119
5131
  c.fulfillOrder(u, p, R, E)
5120
5132
  );
5121
5133
  y = k;
5122
- T = await S(
5134
+ I = await S(
5123
5135
  r,
5124
5136
  "Time to construct the unsigned approval transactions",
5125
5137
  Hr(k)
@@ -5127,7 +5139,7 @@ var Qr = async (r, e, t, n = {
5127
5139
  } catch (k) {
5128
5140
  const X = (performance.now() - P) / 1e3;
5129
5141
  ct(r, "Time to call fulfillOrder from the orderbook", X);
5130
- if (k.message.includes(Ta.EXPIRED)) {
5142
+ if (k.message.includes(ha.EXPIRED)) {
5131
5143
  throw new l("Order is expired", "ORDER_EXPIRED_ERROR", { orderId: u });
5132
5144
  }
5133
5145
  if (!k.message.includes("The fulfiller does not have the balances needed to fulfill")) {
@@ -5185,23 +5197,23 @@ var Qr = async (r, e, t, n = {
5185
5197
  v = v * BigInt(E) / BigInt(o.result.sell[0].amount);
5186
5198
  }
5187
5199
  const Xe = [
5188
- Aa(z, ce, v, a)
5200
+ ya(z, ce, v, a)
5189
5201
  ];
5190
5202
  const j = await S(
5191
5203
  r,
5192
5204
  "Total time running smart checkout",
5193
- se(
5205
+ ie(
5194
5206
  r,
5195
5207
  e,
5196
5208
  Xe,
5197
- ya(
5198
- s,
5209
+ wa(
5210
+ i,
5199
5211
  C
5200
5212
  )
5201
5213
  )
5202
5214
  );
5203
5215
  if (j.sufficient) {
5204
- const k = await ze(e, T);
5216
+ const k = await ze(e, I);
5205
5217
  if (k.type === "FAILED") {
5206
5218
  return {
5207
5219
  status: "FAILED",
@@ -5264,7 +5276,7 @@ var Qr = async (r, e, t, n = {
5264
5276
  };
5265
5277
 
5266
5278
  // src/smartCheckout/cancel/cancel.ts
5267
- var Sa = async (r, e, t, n, o) => {
5279
+ var Pa = async (r, e, t, n, o) => {
5268
5280
  let a;
5269
5281
  if (n.length === 0) {
5270
5282
  throw new l(
@@ -5272,7 +5284,7 @@ var Sa = async (r, e, t, n, o) => {
5272
5284
  "CANCEL_ORDER_LISTING_ERROR"
5273
5285
  );
5274
5286
  }
5275
- const i = n[0];
5287
+ const s = n[0];
5276
5288
  try {
5277
5289
  const c = await S(
5278
5290
  r,
@@ -5283,7 +5295,7 @@ var Sa = async (r, e, t, n, o) => {
5283
5295
  r,
5284
5296
  "Time to get the cancel order from the orderbook",
5285
5297
  e.cancelOrdersOnChain(
5286
- [i],
5298
+ [s],
5287
5299
  c
5288
5300
  )
5289
5301
  );
@@ -5293,7 +5305,7 @@ var Sa = async (r, e, t, n, o) => {
5293
5305
  "An error occurred while cancelling the order listing",
5294
5306
  "CANCEL_ORDER_LISTING_ERROR",
5295
5307
  {
5296
- orderId: i,
5308
+ orderId: s,
5297
5309
  error: c
5298
5310
  }
5299
5311
  );
@@ -5311,12 +5323,12 @@ var Sa = async (r, e, t, n, o) => {
5311
5323
  status: "SUCCESS"
5312
5324
  };
5313
5325
  }
5314
- let s;
5326
+ let i;
5315
5327
  try {
5316
5328
  const c = await Promise.all([a].map(
5317
5329
  (d) => F(t, d)
5318
5330
  ));
5319
- s = c.map((d) => d.transactionResponse);
5331
+ i = c.map((d) => d.transactionResponse);
5320
5332
  } catch (c) {
5321
5333
  throw new l(
5322
5334
  "An error occurred while executing the fulfillment transaction",
@@ -5328,35 +5340,35 @@ var Sa = async (r, e, t, n, o) => {
5328
5340
  }
5329
5341
  return {
5330
5342
  status: "FULFILLMENTS_UNSETTLED",
5331
- transactions: s
5343
+ transactions: i
5332
5344
  };
5333
5345
  };
5334
- var Pa = async (r, e, t) => {
5346
+ var ka = async (r, e, t) => {
5335
5347
  try {
5336
5348
  const n = await e.getSigner();
5337
5349
  const o = await n.getAddress();
5338
5350
  const { signableAction: a } = await r.prepareOrderCancellations(t);
5339
- const i = await n.signTypedData(
5351
+ const s = await n.signTypedData(
5340
5352
  a.message.domain,
5341
5353
  a.message.types,
5342
5354
  a.message.value
5343
5355
  );
5344
- const { result: s } = await r.cancelOrders(t, o, i);
5356
+ const { result: i } = await r.cancelOrders(t, o, s);
5345
5357
  const c = [];
5346
5358
  const d = [];
5347
5359
  const p = [];
5348
- for (const u of s.successful_cancellations) {
5360
+ for (const u of i.successful_cancellations) {
5349
5361
  c.push({
5350
5362
  orderId: u
5351
5363
  });
5352
5364
  }
5353
- for (const u of s.failed_cancellations) {
5365
+ for (const u of i.failed_cancellations) {
5354
5366
  d.push({
5355
5367
  orderId: u.order,
5356
5368
  reason: u.reason_code
5357
5369
  });
5358
5370
  }
5359
- for (const u of s.pending_cancellations) {
5371
+ for (const u of i.pending_cancellations) {
5360
5372
  p.push({
5361
5373
  orderId: u
5362
5374
  });
@@ -5383,9 +5395,9 @@ var Zr = async (r, e, t, n = {
5383
5395
  }) => {
5384
5396
  const o = ae(r);
5385
5397
  if (n.useGaslessCancel) {
5386
- return await Pa(o, e, t);
5398
+ return await ka(o, e, t);
5387
5399
  }
5388
- return await Sa(
5400
+ return await Pa(
5389
5401
  r,
5390
5402
  o,
5391
5403
  e,
@@ -5400,12 +5412,12 @@ async function Jr(r, e) {
5400
5412
  const t = [];
5401
5413
  e.forEach((a) => {
5402
5414
  if (a.type === "ERC20") {
5403
- const { tokenAddress: i } = a;
5404
- t.push(or(i, L, r).decimals());
5415
+ const { tokenAddress: s } = a;
5416
+ t.push(or(s, L, r).decimals());
5405
5417
  }
5406
5418
  });
5407
5419
  const n = await Promise.all(t);
5408
- const o = e.map((a, i) => {
5420
+ const o = e.map((a, s) => {
5409
5421
  if (a.type === "NATIVE") {
5410
5422
  return {
5411
5423
  ...a,
@@ -5415,7 +5427,7 @@ async function Jr(r, e) {
5415
5427
  if (a.type === "ERC20") {
5416
5428
  return {
5417
5429
  ...a,
5418
- amount: Yr(a.amount, n[i])
5430
+ amount: Yr(a.amount, n[s])
5419
5431
  };
5420
5432
  }
5421
5433
  return a;
@@ -5424,26 +5436,26 @@ async function Jr(r, e) {
5424
5436
  }
5425
5437
 
5426
5438
  // src/smartCheckout/sell/sell.ts
5427
- import { Contract as va, parseUnits as Na } from "ethers";
5439
+ import { Contract as Na, parseUnits as _a } from "ethers";
5428
5440
  import {
5429
- constants as _a
5441
+ constants as Oa
5430
5442
  } from "@imtbl/orderbook";
5431
- import { track as Oa } from "@imtbl/metrics";
5432
- var Ma = (r, e, t) => ({
5443
+ import { track as Ma } from "@imtbl/metrics";
5444
+ var Ba = (r, e, t) => ({
5433
5445
  type: "ERC721",
5434
5446
  id: r,
5435
5447
  contractAddress: e,
5436
5448
  spenderAddress: t
5437
5449
  });
5438
- var Ba = (r, e, t, n) => ({
5450
+ var xa = (r, e, t, n) => ({
5439
5451
  type: "ERC1155",
5440
5452
  id: r,
5441
5453
  contractAddress: e,
5442
5454
  spenderAddress: t,
5443
5455
  amount: BigInt(n)
5444
5456
  });
5445
- var xa = (r, e = 18) => {
5446
- const t = Na(r.amount, e);
5457
+ var ba = (r, e = 18) => {
5458
+ const t = _a(r.amount, e);
5447
5459
  if (r.type === "NATIVE") {
5448
5460
  return {
5449
5461
  type: "NATIVE",
@@ -5460,7 +5472,7 @@ var $r = async (r, e, t) => {
5460
5472
  let n;
5461
5473
  let o;
5462
5474
  let a = "";
5463
- Oa("checkout_sdk", "sell_initiated");
5475
+ Ma("checkout_sdk", "sell_initiated");
5464
5476
  if (t.length === 0) {
5465
5477
  throw new l(
5466
5478
  "No orders were provided to the orders array. Please provide at least one order.",
@@ -5468,15 +5480,15 @@ var $r = async (r, e, t) => {
5468
5480
  );
5469
5481
  }
5470
5482
  const {
5471
- buyToken: i,
5472
- sellToken: s,
5483
+ buyToken: s,
5484
+ sellToken: i,
5473
5485
  makerFees: c,
5474
5486
  orderExpiry: d
5475
5487
  } = t[0];
5476
5488
  let p = 18;
5477
- if (i.type === "ERC20") {
5478
- const f = new va(
5479
- i.tokenAddress,
5489
+ if (s.type === "ERC20") {
5490
+ const f = new Na(
5491
+ s.tokenAddress,
5480
5492
  JSON.stringify(L),
5481
5493
  e
5482
5494
  );
@@ -5486,8 +5498,8 @@ var $r = async (r, e, t) => {
5486
5498
  f.decimals()
5487
5499
  );
5488
5500
  }
5489
- const u = xa(i, p);
5490
- const m = "type" in s;
5501
+ const u = ba(s, p);
5502
+ const m = "type" in i;
5491
5503
  try {
5492
5504
  const f = await S(
5493
5505
  r,
@@ -5497,15 +5509,15 @@ var $r = async (r, e, t) => {
5497
5509
  n = ae(r);
5498
5510
  const { seaportContractAddress: R } = n.config();
5499
5511
  a = R;
5500
- const T = m && s.type === "ERC1155" ? {
5512
+ const I = m && i.type === "ERC1155" ? {
5501
5513
  type: "ERC1155",
5502
- contractAddress: s.collectionAddress,
5503
- tokenId: s.id,
5504
- amount: s.amount
5514
+ contractAddress: i.collectionAddress,
5515
+ tokenId: i.id,
5516
+ amount: i.amount
5505
5517
  } : {
5506
5518
  type: "ERC721",
5507
- contractAddress: s.collectionAddress,
5508
- tokenId: s.id
5519
+ contractAddress: i.collectionAddress,
5520
+ tokenId: i.id
5509
5521
  };
5510
5522
  o = await S(
5511
5523
  r,
@@ -5513,7 +5525,7 @@ var $r = async (r, e, t) => {
5513
5525
  n.prepareListing({
5514
5526
  makerAddress: f,
5515
5527
  buy: u,
5516
- sell: T,
5528
+ sell: I,
5517
5529
  orderExpiry: d
5518
5530
  })
5519
5531
  );
@@ -5523,30 +5535,30 @@ var $r = async (r, e, t) => {
5523
5535
  "PREPARE_ORDER_LISTING_ERROR",
5524
5536
  {
5525
5537
  error: f,
5526
- id: s.id,
5527
- collectionAddress: s.collectionAddress
5538
+ id: i.id,
5539
+ collectionAddress: i.collectionAddress
5528
5540
  }
5529
5541
  );
5530
5542
  }
5531
5543
  const E = [];
5532
- if (m && s.type === "ERC1155") {
5533
- const f = Ba(
5534
- s.id,
5535
- s.collectionAddress,
5544
+ if (m && i.type === "ERC1155") {
5545
+ const f = xa(
5546
+ i.id,
5547
+ i.collectionAddress,
5536
5548
  a,
5537
- s.amount
5549
+ i.amount
5538
5550
  );
5539
5551
  E.push(f);
5540
5552
  } else {
5541
- const f = Ma(s.id, s.collectionAddress, a);
5553
+ const f = Ba(i.id, i.collectionAddress, a);
5542
5554
  E.push(f);
5543
5555
  }
5544
5556
  let g;
5545
- if (!Tt(e)) {
5557
+ if (!It(e)) {
5546
5558
  g = await S(
5547
5559
  r,
5548
5560
  "Total time running smart checkout",
5549
- se(
5561
+ ie(
5550
5562
  r,
5551
5563
  e,
5552
5564
  E,
@@ -5554,7 +5566,7 @@ var $r = async (r, e, t) => {
5554
5566
  type: "GAS",
5555
5567
  gasToken: {
5556
5568
  type: "NATIVE",
5557
- limit: BigInt(_a.estimatedFulfillmentGasGwei)
5569
+ limit: BigInt(Oa.estimatedFulfillmentGasGwei)
5558
5570
  }
5559
5571
  }
5560
5572
  )
@@ -5573,24 +5585,24 @@ var $r = async (r, e, t) => {
5573
5585
  smartCheckoutResult: g
5574
5586
  };
5575
5587
  }
5576
- const T = zr(
5588
+ const I = zr(
5577
5589
  o.orderHash,
5578
5590
  o.orderComponents,
5579
5591
  o.actions
5580
5592
  );
5581
- if (!T) {
5593
+ if (!I) {
5582
5594
  throw new l(
5583
5595
  "The unsigned message is missing after preparing the listing",
5584
5596
  "SIGN_MESSAGE_ERROR",
5585
5597
  {
5586
- id: s.id,
5587
- collectionAddress: s.collectionAddress
5598
+ id: i.id,
5599
+ collectionAddress: i.collectionAddress
5588
5600
  }
5589
5601
  );
5590
5602
  }
5591
5603
  const C = await jr(
5592
5604
  e,
5593
- T
5605
+ I
5594
5606
  );
5595
5607
  let y = "";
5596
5608
  const P = {
@@ -5601,7 +5613,7 @@ var $r = async (r, e, t) => {
5601
5613
  };
5602
5614
  if (c !== void 0) {
5603
5615
  let v = BigInt(1);
5604
- if (m && s.type === "ERC1155") v = BigInt(s.amount);
5616
+ if (m && i.type === "ERC1155") v = BigInt(i.amount);
5605
5617
  const z = Je(c, u.amount, p, v);
5606
5618
  if (z.length !== c.length) {
5607
5619
  throw new l(
@@ -5620,8 +5632,8 @@ var $r = async (r, e, t) => {
5620
5632
  "CREATE_ORDER_LISTING_ERROR",
5621
5633
  {
5622
5634
  error: v,
5623
- collectionId: s.id,
5624
- collectionAddress: s.collectionAddress
5635
+ collectionId: i.id,
5636
+ collectionAddress: i.collectionAddress
5625
5637
  }
5626
5638
  );
5627
5639
  }
@@ -5639,7 +5651,7 @@ var $r = async (r, e, t) => {
5639
5651
 
5640
5652
  // src/swap/swap.ts
5641
5653
  import { parseUnits as Xr } from "ethers";
5642
- var kt = async (r, e, t, n, o, a, i, s, c) => {
5654
+ var kt = async (r, e, t, n, o, a, s, i, c) => {
5643
5655
  if (!t.address || t.decimals === 0) {
5644
5656
  throw new l(
5645
5657
  "fromToken address or decimals is missing.",
@@ -5673,8 +5685,8 @@ var kt = async (r, e, t, n, o, a, i, s, c) => {
5673
5685
  t.address,
5674
5686
  n.address,
5675
5687
  BigInt(Xr(o, t.decimals)),
5676
- i,
5677
5688
  s,
5689
+ i,
5678
5690
  c
5679
5691
  );
5680
5692
  }
@@ -5683,12 +5695,12 @@ var kt = async (r, e, t, n, o, a, i, s, c) => {
5683
5695
  t.address,
5684
5696
  n.address,
5685
5697
  BigInt(Xr(a, n.decimals)),
5686
- i,
5687
5698
  s,
5699
+ i,
5688
5700
  c
5689
5701
  );
5690
5702
  };
5691
- var en = async (r, e, t, n, o, a, i, s, c) => {
5703
+ var en = async (r, e, t, n, o, a, s, i, c) => {
5692
5704
  const d = await kt(
5693
5705
  r,
5694
5706
  e,
@@ -5696,8 +5708,8 @@ var en = async (r, e, t, n, o, a, i, s, c) => {
5696
5708
  n,
5697
5709
  o,
5698
5710
  a,
5699
- i,
5700
5711
  s,
5712
+ i,
5701
5713
  c
5702
5714
  );
5703
5715
  if (d.approval) {
@@ -5744,7 +5756,7 @@ async function tn(r) {
5744
5756
  }
5745
5757
 
5746
5758
  // src/riskAssessment/riskAssessment.ts
5747
- import Fa from "axios";
5759
+ import Wa from "axios";
5748
5760
  var vt = async (r, e) => {
5749
5761
  const t = Object.fromEntries(
5750
5762
  r.map((o) => [o.toLowerCase(), { sanctioned: false }])
@@ -5754,16 +5766,16 @@ var vt = async (r, e) => {
5754
5766
  return t;
5755
5767
  }
5756
5768
  try {
5757
- const o = n?.levels.map((i) => i.toLowerCase()) ?? [];
5758
- const a = await Fa.post(
5769
+ const o = n?.levels.map((s) => s.toLowerCase()) ?? [];
5770
+ const a = await Wa.post(
5759
5771
  `${U[e.environment]}/v1/sanctions/check`,
5760
5772
  {
5761
5773
  addresses: r
5762
5774
  }
5763
5775
  );
5764
- for (const i of a.data) {
5765
- t[i.address.toLowerCase()].sanctioned = o.includes(
5766
- i.risk.toLowerCase()
5776
+ for (const s of a.data) {
5777
+ t[s.address.toLowerCase()].sanctioned = o.includes(
5778
+ s.risk.toLowerCase()
5767
5779
  );
5768
5780
  }
5769
5781
  return t;
@@ -5780,9 +5792,9 @@ var Nt = (r, e) => {
5780
5792
  };
5781
5793
 
5782
5794
  // src/sdk.ts
5783
- var Ua = {
5795
+ var Ga = {
5784
5796
  baseConfig: {
5785
- environment: Wa.SANDBOX
5797
+ environment: Ua.SANDBOX
5786
5798
  },
5787
5799
  passport: void 0
5788
5800
  };
@@ -5797,9 +5809,9 @@ var _t = class {
5797
5809
  * Constructs a new instance of the CheckoutModule class.
5798
5810
  * @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
5799
5811
  */
5800
- constructor(e = Ua) {
5812
+ constructor(e = Ga) {
5801
5813
  this.httpClient = new de(e);
5802
- this.config = new Ie(e, this.httpClient);
5814
+ this.config = new Te(e, this.httpClient);
5803
5815
  this.fiatRampService = new Oe(this.config);
5804
5816
  this.readOnlyProviders = /* @__PURE__ */ new Map();
5805
5817
  this.availability = Pe(
@@ -5843,7 +5855,7 @@ var _t = class {
5843
5855
  * @returns {Promise<CreateProviderResult>} A promise that resolves to the created provider.
5844
5856
  */
5845
5857
  async createProvider(e) {
5846
- return await sr(
5858
+ return await ir(
5847
5859
  e.walletProviderName,
5848
5860
  this.passport
5849
5861
  );
@@ -5948,7 +5960,7 @@ var _t = class {
5948
5960
  allowMistmatchedChainId: true
5949
5961
  }
5950
5962
  );
5951
- const n = await it(
5963
+ const n = await st(
5952
5964
  this.config.networkMap,
5953
5965
  t,
5954
5966
  e.chainId
@@ -6195,7 +6207,7 @@ var _t = class {
6195
6207
  { error: o }
6196
6208
  );
6197
6209
  }
6198
- return await se(
6210
+ return await ie(
6199
6211
  this.config,
6200
6212
  t,
6201
6213
  n,
@@ -6224,7 +6236,7 @@ var _t = class {
6224
6236
  this.config,
6225
6237
  this.readOnlyProviders
6226
6238
  );
6227
- return await ir(
6239
+ return await sr(
6228
6240
  e,
6229
6241
  this.readOnlyProviders,
6230
6242
  this.config
@@ -6240,16 +6252,16 @@ var _t = class {
6240
6252
  let n = "IMX";
6241
6253
  let o;
6242
6254
  const a = "request" in e.browserProvider ? new b(e.browserProvider) : e.browserProvider;
6243
- const i = await (await a.getSigner()).getAddress();
6244
- const s = a.ethereumProvider?.isPassport || false;
6245
- if (s && e.passport) {
6255
+ const s = await (await a.getSigner()).getAddress();
6256
+ const i = a.ethereumProvider?.isPassport || false;
6257
+ if (i && e.passport) {
6246
6258
  const u = await e.passport.getUserInfo();
6247
6259
  o = u?.email;
6248
6260
  }
6249
6261
  const c = await H(this.config, {
6250
6262
  type: "onramp"
6251
6263
  });
6252
- const d = c.tokens?.find((u) => I(u.address, e.tokenAddress));
6264
+ const d = c.tokens?.find((u) => T(u.address, e.tokenAddress));
6253
6265
  if (d) {
6254
6266
  t = e.tokenAmount;
6255
6267
  n = d.symbol;
@@ -6257,8 +6269,8 @@ var _t = class {
6257
6269
  const p = c?.tokens?.filter((u) => u.symbol).map((u) => u.symbol);
6258
6270
  return await this.fiatRampService.createWidgetUrl({
6259
6271
  exchangeType: e.exchangeType,
6260
- isPassport: s,
6261
- walletAddress: i,
6272
+ isPassport: i,
6273
+ walletAddress: s,
6262
6274
  tokenAmount: t,
6263
6275
  tokenSymbol: n,
6264
6276
  email: o,
@@ -6347,17 +6359,17 @@ export {
6347
6359
  tt as ChainName,
6348
6360
  he as ChainSlug,
6349
6361
  _t as Checkout,
6350
- Ie as CheckoutConfiguration,
6362
+ Te as CheckoutConfiguration,
6351
6363
  l as CheckoutError,
6352
6364
  w as CheckoutErrorType,
6353
6365
  me as CheckoutStatus,
6354
6366
  mn as CommerceEventType,
6355
6367
  En as CommerceFailureEventType,
6356
- An as CommerceFlowType,
6368
+ yn as CommerceFlowType,
6357
6369
  fn as CommerceSuccessEventType,
6358
6370
  gn as CommerceUserActionEventType,
6359
6371
  on as ConnectEventType,
6360
- Tn as ConnectTargetLayer,
6372
+ hn as ConnectTargetLayer,
6361
6373
  Gt as ExchangeType,
6362
6374
  ke as FeeType,
6363
6375
  ge as FundingStepType,
@@ -6374,21 +6386,22 @@ export {
6374
6386
  at as RoutingOutcomeType,
6375
6387
  cn as SaleEventType,
6376
6388
  dn as SalePaymentTypes,
6377
- hn as SwapDirection,
6389
+ An as SwapDirection,
6378
6390
  sn as SwapEventType,
6379
6391
  ne as TokenFilterTypes,
6380
6392
  fe as TransactionOrGasType,
6393
+ Tn as TransferEventType,
6381
6394
  an as WalletEventType,
6382
6395
  Ft as WalletFilterTypes,
6383
6396
  ue as WalletProviderName,
6384
6397
  Wt as WalletProviderRdns,
6385
- yn as WidgetTheme,
6398
+ wn as WidgetTheme,
6386
6399
  In as WidgetType,
6387
6400
  b as WrappedBrowserProvider,
6388
6401
  vt as fetchRiskAssessment,
6389
6402
  Et as getGasPriceInWei,
6390
- lo as getMetaMaskProviderDetail,
6391
- co as getPassportProviderDetail,
6403
+ po as getMetaMaskProviderDetail,
6404
+ lo as getPassportProviderDetail,
6392
6405
  Re as getUnderlyingChainId,
6393
6406
  Nt as isAddressSanctioned,
6394
6407
  xe as metaMaskProviderInfo,