@imtbl/checkout-sdk 2.7.6-alpha.3 → 2.7.6-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -301,7 +301,7 @@ var ue = class {
301
301
 
302
302
  // src/availability/availability.ts
303
303
  import { Environment as Ut } from "@imtbl/config";
304
- import xo from "axios";
304
+ import Oo from "axios";
305
305
 
306
306
  // src/errors/checkoutError.ts
307
307
  var S = /* @__PURE__ */ ((y) => {
@@ -411,18 +411,18 @@ var we = /* @__PURE__ */ ((a) => {
411
411
  var J = "development";
412
412
  var q = 18;
413
413
  var Mt = 6;
414
- var O = "native";
414
+ var x = "native";
415
415
  var ke = {
416
416
  name: "IMX",
417
417
  symbol: "IMX",
418
418
  decimals: q,
419
- address: O
419
+ address: x
420
420
  };
421
421
  var No = {
422
422
  name: "tIMX",
423
423
  symbol: "tIMX",
424
424
  decimals: q,
425
- address: O
425
+ address: x
426
426
  };
427
427
  var H = {
428
428
  [J]: "https://api.dev.immutable.com",
@@ -803,7 +803,7 @@ var it = {
803
803
  };
804
804
 
805
805
  // src/env/env.ts
806
- var _o = "2.7.6-alpha.3";
806
+ var _o = "2.7.6-alpha.4";
807
807
  var me = () => _o;
808
808
 
809
809
  // src/availability/availability.ts
@@ -816,7 +816,7 @@ var Ne = (r, e) => {
816
816
  const o = async () => {
817
817
  let n;
818
818
  try {
819
- n = await xo.post(`${t()}/v1/availability/checkout/swap`);
819
+ n = await Oo.post(`${t()}/v1/availability/checkout/swap`);
820
820
  } catch (a) {
821
821
  n = a.response;
822
822
  if (n.status === 403) return false;
@@ -867,7 +867,7 @@ var Gt = /* @__PURE__ */ ((e) => {
867
867
 
868
868
  // src/types/provider.ts
869
869
  import {
870
- BrowserProvider as Oo
870
+ BrowserProvider as xo
871
871
  } from "ethers";
872
872
  var fe = /* @__PURE__ */ ((o) => {
873
873
  o["PASSPORT"] = "passport";
@@ -885,7 +885,7 @@ var jt = {
885
885
  allowMistmatchedChainId: false,
886
886
  allowUnsupportedProvider: false
887
887
  };
888
- var D = class extends Oo {
888
+ var D = class extends xo {
889
889
  ethereumProvider;
890
890
  // eslint-disable-next-line max-len
891
891
  constructor(e, t, o) {
@@ -1118,7 +1118,7 @@ import { Contract as jo } from "ethers";
1118
1118
  import { Environment as ie } from "@imtbl/config";
1119
1119
 
1120
1120
  // src/config/remoteConfigFetcher.ts
1121
- var xe = class {
1121
+ var Oe = class {
1122
1122
  httpClient;
1123
1123
  endpoint;
1124
1124
  configCache;
@@ -1171,7 +1171,7 @@ var xe = class {
1171
1171
 
1172
1172
  // src/config/tokensFetcher.ts
1173
1173
  var Lo = "0x0000000000000000000000000000000000000eee";
1174
- var Oe = class {
1174
+ var xe = class {
1175
1175
  httpClient;
1176
1176
  remoteConfig;
1177
1177
  baseUrl;
@@ -1360,10 +1360,10 @@ var Ae = class {
1360
1360
  this.publishableKey = e.publishableKey ?? "<no-publishable-key>";
1361
1361
  this.networkMap = e.overrides?.networkMap ?? Do(this.isProduction, this.isDevelopment);
1362
1362
  const o = e.overrides?.remoteConfigEndpoint ?? Uo(this.isProduction, this.isDevelopment);
1363
- this.remote = new xe(t, {
1363
+ this.remote = new Oe(t, {
1364
1364
  remoteConfigEndpoint: o
1365
1365
  });
1366
- this.tokens = new Oe(t, this.remote, {
1366
+ this.tokens = new xe(t, this.remote, {
1367
1367
  baseUrl: e.overrides?.baseUrl ?? Wo(this.isProduction, this.isDevelopment),
1368
1368
  chainSlug: e.overrides?.chainSlug ?? Fo(this.isProduction, this.isDevelopment)
1369
1369
  });
@@ -1432,7 +1432,7 @@ var z = async (r, {
1432
1432
  tokens: n.filter((p) => !o.map((u) => u.address).includes(p.address || ""))
1433
1433
  };
1434
1434
  };
1435
- var B = (r) => !r || h(r, O);
1435
+ var B = (r) => !r || h(r, x);
1436
1436
  async function Be(r, e) {
1437
1437
  return await L(
1438
1438
  async () => {
@@ -1648,7 +1648,7 @@ var Qo = async (r, e, t, o) => {
1648
1648
  const n = o !== void 0;
1649
1649
  const a = Object.assign(
1650
1650
  {},
1651
- ...(o ?? []).map((f) => ({ [f.address?.toLowerCase() || O]: f }))
1651
+ ...(o ?? []).map((f) => ({ [f.address?.toLowerCase() || x]: f }))
1652
1652
  );
1653
1653
  let i = mt.get(t);
1654
1654
  if (!i) {
@@ -1682,7 +1682,7 @@ var Qo = async (r, e, t, o) => {
1682
1682
  const u = async (f) => {
1683
1683
  try {
1684
1684
  const R = await f.getNativeTokenByWalletAddress({ walletAddress: e });
1685
- R.token.address ||= O;
1685
+ R.token.address ||= x;
1686
1686
  s.push(R);
1687
1687
  } catch (R) {
1688
1688
  if (R?.code !== ut.NotFound) {
@@ -1721,7 +1721,7 @@ var Qo = async (r, e, t, o) => {
1721
1721
  var Zo = async (r, e, t, o) => {
1722
1722
  const n = [];
1723
1723
  o.forEach((i) => {
1724
- if (!i.address || h(i.address, O)) {
1724
+ if (!i.address || h(i.address, x)) {
1725
1725
  n.push(
1726
1726
  ft(r, e, t)
1727
1727
  );
@@ -1735,8 +1735,8 @@ var Zo = async (r, e, t, o) => {
1735
1735
  return a.reduce((i, s) => {
1736
1736
  if (s.status !== "fulfilled" || s.value.balance === 0n) return i;
1737
1737
  const { value: c } = s;
1738
- if (!c.token.address || h(c.token.address, O)) {
1739
- c.token.address = O;
1738
+ if (!c.token.address || h(c.token.address, x)) {
1739
+ c.token.address = x;
1740
1740
  }
1741
1741
  i.balances.push(c);
1742
1742
  return i;
@@ -1948,7 +1948,7 @@ async function or(r, e, t, o) {
1948
1948
  gasMultiplier: "auto",
1949
1949
  sourceChainId: e.toString(),
1950
1950
  destinationChainId: t.toString(),
1951
- token: O.toUpperCase(),
1951
+ token: x.toUpperCase(),
1952
1952
  amount: BigInt(0)
1953
1953
  });
1954
1954
  }
@@ -2758,11 +2758,11 @@ var gr = async (r, e, t) => {
2758
2758
  continue;
2759
2759
  }
2760
2760
  const v = `${E}-${T}`;
2761
- const x = mr(T, E);
2761
+ const O = mr(T, E);
2762
2762
  a.set(v, C);
2763
2763
  i.set(
2764
2764
  v,
2765
- vn(r, E, x)
2765
+ vn(r, E, O)
2766
2766
  );
2767
2767
  }
2768
2768
  const u = await Promise.all(i.values());
@@ -2835,7 +2835,7 @@ var _n = async (r, e, t, o) => {
2835
2835
  );
2836
2836
  }
2837
2837
  };
2838
- var xn = async (r, e, t, o) => {
2838
+ var On = async (r, e, t, o) => {
2839
2839
  try {
2840
2840
  const n = new fr(
2841
2841
  t,
@@ -2876,7 +2876,7 @@ var Er = async (r, e, t) => {
2876
2876
  itemRequirement: a
2877
2877
  };
2878
2878
  }
2879
- const s = await xn(
2879
+ const s = await On(
2880
2880
  r,
2881
2881
  e,
2882
2882
  a.contractAddress,
@@ -2900,7 +2900,7 @@ var Er = async (r, e, t) => {
2900
2900
  import { Contract as Ln, formatUnits as Dn } from "ethers";
2901
2901
 
2902
2902
  // src/smartCheckout/aggregators/balanceAggregator.ts
2903
- var On = (r) => {
2903
+ var xn = (r) => {
2904
2904
  const e = /* @__PURE__ */ new Map();
2905
2905
  const t = [];
2906
2906
  r.forEach((o) => {
@@ -2955,7 +2955,7 @@ var Mn = (r) => {
2955
2955
  });
2956
2956
  return t.concat(Array.from(e.values()));
2957
2957
  };
2958
- var Rr = (r) => Mn(Bn(On(r)));
2958
+ var Rr = (r) => Mn(Bn(xn(r)));
2959
2959
 
2960
2960
  // src/smartCheckout/balanceCheck/balanceRequirement.ts
2961
2961
  import { Contract as bn, formatUnits as Ue } from "ethers";
@@ -2967,7 +2967,7 @@ var Cr = (r) => r.map((e) => {
2967
2967
  };
2968
2968
  case "NATIVE":
2969
2969
  return {
2970
- address: O
2970
+ address: x
2971
2971
  };
2972
2972
  case "ERC721":
2973
2973
  default:
@@ -3030,7 +3030,7 @@ var hr = async (r, e, t) => {
3030
3030
  const o = {};
3031
3031
  for (const n of r) {
3032
3032
  if (n.type === "NATIVE") {
3033
- o[O] = ke;
3033
+ o[x] = ke;
3034
3034
  continue;
3035
3035
  }
3036
3036
  const a = Ir(n, e);
@@ -3151,7 +3151,7 @@ var Wn = async (r, e, t, o, n = false) => {
3151
3151
  );
3152
3152
  const { balances: i } = await j(r, e, t, w(r), n);
3153
3153
  return i.filter(
3154
- (s) => a.get((s.token.address || O).toLocaleLowerCase())
3154
+ (s) => a.get((s.token.address || x).toLocaleLowerCase())
3155
3155
  );
3156
3156
  } catch (a) {
3157
3157
  throw new m(
@@ -3236,12 +3236,12 @@ var yr = async (r, e, t, o, n = false) => {
3236
3236
  if (i.length > 0) {
3237
3237
  const f = p.shift() ?? [];
3238
3238
  const R = new Map(f.map((E) => {
3239
- const T = E.type === "NATIVE" ? O : E.token.address?.toLowerCase();
3239
+ const T = E.type === "NATIVE" ? x : E.token.address?.toLowerCase();
3240
3240
  return [T, E];
3241
3241
  }));
3242
3242
  const C = await hr(i, f, e);
3243
3243
  i.forEach((E) => {
3244
- const T = (E.tokenAddress ?? O).toLowerCase();
3244
+ const T = (E.tokenAddress ?? x).toLowerCase();
3245
3245
  const A = C[T];
3246
3246
  const I = R.get(T);
3247
3247
  const P = Ar(E, [...R.values()], A);
@@ -3774,7 +3774,7 @@ var Qn = async (r, e, t) => {
3774
3774
  }
3775
3775
  return [];
3776
3776
  };
3777
- var xr = async (r, e, t) => {
3777
+ var Or = async (r, e, t) => {
3778
3778
  const o = {};
3779
3779
  o.swap = await Qn(r, e, t);
3780
3780
  o.bridge = await Pt(r, e, t);
@@ -3789,7 +3789,7 @@ import { formatUnits as oa } from "ethers";
3789
3789
  import { formatUnits as Ke } from "ethers";
3790
3790
 
3791
3791
  // src/smartCheckout/routing/bridge/getEthBalance.ts
3792
- var Or = (r) => {
3792
+ var xr = (r) => {
3793
3793
  for (const e of r.balances) {
3794
3794
  if (B(e.token.address)) {
3795
3795
  return e.balance;
@@ -3847,7 +3847,7 @@ var Ve = async (r, e) => {
3847
3847
  if (B(e)) {
3848
3848
  return {
3849
3849
  l1address: await Jn(_(r), r),
3850
- l2address: O
3850
+ l2address: x
3851
3851
  };
3852
3852
  }
3853
3853
  const t = Yn(w(r));
@@ -3872,7 +3872,7 @@ var Ve = async (r, e) => {
3872
3872
 
3873
3873
  // src/smartCheckout/routing/bridge/bridgeRoute.ts
3874
3874
  var $n = (r, e) => {
3875
- const t = Or(r);
3875
+ const t = xr(r);
3876
3876
  return t >= e;
3877
3877
  };
3878
3878
  var Mr = (r, e, t, o, n) => {
@@ -3972,16 +3972,16 @@ var He = async (r, e, t, o, n) => {
3972
3972
  } = R;
3973
3973
  if (!$n(c, I)) return void 0;
3974
3974
  if (B(f)) {
3975
- const v = c.balances.find((x) => B(x.token.address));
3975
+ const v = c.balances.find((O) => B(O.token.address));
3976
3976
  if (v && v.balance >= o.amount + I) {
3977
- const x = Mr(
3977
+ const O = Mr(
3978
3978
  C,
3979
3979
  T,
3980
3980
  A,
3981
3981
  E,
3982
3982
  s
3983
3983
  );
3984
- return br(a, v, o, "NATIVE", x);
3984
+ return br(a, v, o, "NATIVE", O);
3985
3985
  }
3986
3986
  return void 0;
3987
3987
  }
@@ -4296,11 +4296,11 @@ var Ur = async (r, e, t, o, n, a, i, s, c) => {
4296
4296
  }
4297
4297
  const P = await Promise.all(T.values());
4298
4298
  const v = Array.from(T.keys());
4299
- const x = [];
4299
+ const O = [];
4300
4300
  P.forEach((G, rt) => {
4301
4301
  const V = v[rt];
4302
4302
  if (G === void 0) return;
4303
- x.push(V);
4303
+ O.push(V);
4304
4304
  const N = A.get(V);
4305
4305
  if (!N) return;
4306
4306
  I.push({
@@ -4309,7 +4309,7 @@ var Ur = async (r, e, t, o, n, a, i, s, c) => {
4309
4309
  l2address: N.l2address
4310
4310
  });
4311
4311
  });
4312
- if (x.length === 0) return [];
4312
+ if (O.length === 0) return [];
4313
4313
  if (I.length === 0) return [];
4314
4314
  const Q = ia(
4315
4315
  r,
@@ -4324,7 +4324,7 @@ var Ur = async (r, e, t, o, n, a, i, s, c) => {
4324
4324
  n,
4325
4325
  o,
4326
4326
  Q,
4327
- x,
4327
+ O,
4328
4328
  c
4329
4329
  );
4330
4330
  if (!pe) return [];
@@ -4516,7 +4516,7 @@ var qr = async (r, e, t, o, n) => {
4516
4516
  const s = await k(
4517
4517
  r,
4518
4518
  "Time to get routing allowlist",
4519
- xr(r, i, o)
4519
+ Or(r, i, o)
4520
4520
  );
4521
4521
  const c = la(t);
4522
4522
  const p = [];
@@ -5164,7 +5164,7 @@ var Zr = async (r, e, t, o = {
5164
5164
  );
5165
5165
  } catch {
5166
5166
  }
5167
- let x = BigInt("0");
5167
+ let O = BigInt("0");
5168
5168
  let Q = "NATIVE";
5169
5169
  let pe = "";
5170
5170
  const ee = n.result.buy;
@@ -5189,18 +5189,18 @@ var Zr = async (r, e, t, o = {
5189
5189
  }
5190
5190
  ee.forEach((N) => {
5191
5191
  if (N.type !== "ERC721") {
5192
- x += BigInt(N.amount);
5192
+ O += BigInt(N.amount);
5193
5193
  }
5194
5194
  });
5195
5195
  const G = n.result.fees;
5196
5196
  G.forEach((N) => {
5197
- x += BigInt(N.amount);
5197
+ O += BigInt(N.amount);
5198
5198
  });
5199
5199
  if (n.result.sell[0].type === "ERC1155" && R) {
5200
- x = x * BigInt(R) / BigInt(n.result.sell[0].amount);
5200
+ O = O * BigInt(R) / BigInt(n.result.sell[0].amount);
5201
5201
  }
5202
5202
  const rt = [
5203
- ka(Q, pe, x, a)
5203
+ ka(Q, pe, O, a)
5204
5204
  ];
5205
5205
  const V = await k(
5206
5206
  r,
@@ -5346,7 +5346,7 @@ var _a = async (r, e, t, o, n) => {
5346
5346
  transactions: s
5347
5347
  };
5348
5348
  };
5349
- var xa = async (r, e, t) => {
5349
+ var Oa = async (r, e, t) => {
5350
5350
  try {
5351
5351
  const o = await e.getSigner();
5352
5352
  const n = await o.getAddress();
@@ -5398,7 +5398,7 @@ var Yr = async (r, e, t, o = {
5398
5398
  }) => {
5399
5399
  const n = ce(r);
5400
5400
  if (o.useGaslessCancel) {
5401
- return await xa(n, e, t);
5401
+ return await Oa(n, e, t);
5402
5402
  }
5403
5403
  return await _a(
5404
5404
  r,
@@ -5615,9 +5615,9 @@ var Xr = async (r, e, t) => {
5615
5615
  makerFees: []
5616
5616
  };
5617
5617
  if (c !== void 0) {
5618
- let x = BigInt(1);
5619
- if (f && s.type === "ERC1155") x = BigInt(s.amount);
5620
- const Q = et(c, g.amount, u, x);
5618
+ let O = BigInt(1);
5619
+ if (f && s.type === "ERC1155") O = BigInt(s.amount);
5620
+ const Q = et(c, g.amount, u, O);
5621
5621
  if (Q.length !== c.length) {
5622
5622
  throw new m(
5623
5623
  "One of the fees is too small, must be greater than 0.000001",
@@ -5627,14 +5627,14 @@ var Xr = async (r, e, t) => {
5627
5627
  v.makerFees = Q;
5628
5628
  }
5629
5629
  try {
5630
- const x = await o.createListing(v);
5631
- P = x.result.id;
5632
- } catch (x) {
5630
+ const O = await o.createListing(v);
5631
+ P = O.result.id;
5632
+ } catch (O) {
5633
5633
  throw new m(
5634
5634
  "An error occurred while creating the listing",
5635
5635
  "CREATE_ORDER_LISTING_ERROR",
5636
5636
  {
5637
- error: x,
5637
+ error: O,
5638
5638
  collectionId: s.id,
5639
5639
  collectionAddress: s.collectionAddress
5640
5640
  }
@@ -5759,12 +5759,12 @@ async function ro(r) {
5759
5759
  }
5760
5760
 
5761
5761
  // src/riskAssessment/riskAssessment.ts
5762
- var xt = async (r, e) => Object.fromEntries(
5762
+ var Ot = async (r, e) => Object.fromEntries(
5763
5763
  r.map((t) => [t.toLowerCase(), { sanctioned: false }])
5764
5764
  );
5765
5765
 
5766
5766
  // src/riskAssessment/common.ts
5767
- var Ot = (r, e) => false;
5767
+ var xt = (r, e) => false;
5768
5768
  var ja = (r, e) => false;
5769
5769
  var Va = (r) => false;
5770
5770
 
@@ -5890,7 +5890,7 @@ var Bt = class {
5890
5890
  * @returns {Promise<AssessmentResult>} - A promise that resolves to the risk assessment result.
5891
5891
  */
5892
5892
  async getRiskAssessment(e) {
5893
- return await xt(e, this.config);
5893
+ return await Ot(e, this.config);
5894
5894
  }
5895
5895
  /**
5896
5896
  * Helper method that checks if given risk assessment results contain sanctioned addresses.
@@ -5900,7 +5900,7 @@ var Bt = class {
5900
5900
  * @returns {boolean} - Result of the check.
5901
5901
  */
5902
5902
  checkIsAddressSanctioned(e, t) {
5903
- return Ot(e, t);
5903
+ return xt(e, t);
5904
5904
  }
5905
5905
  /**
5906
5906
  * Connects to a blockchain network using the specified provider.
@@ -6379,12 +6379,12 @@ export {
6379
6379
  Po as WidgetTheme,
6380
6380
  ho as WidgetType,
6381
6381
  D as WrappedBrowserProvider,
6382
- xt as fetchRiskAssessment,
6382
+ Ot as fetchRiskAssessment,
6383
6383
  Ct as getGasPriceInWei,
6384
6384
  fn as getMetaMaskProviderDetail,
6385
6385
  gn as getPassportProviderDetail,
6386
6386
  Ie as getUnderlyingChainId,
6387
- Ot as isAddressSanctioned,
6387
+ xt as isAddressSanctioned,
6388
6388
  ja as isSingleAddressSanctioned,
6389
6389
  De as metaMaskProviderInfo,
6390
6390
  We as passportProviderInfo,
@@ -803,7 +803,7 @@ var ot = {
803
803
  };
804
804
 
805
805
  // src/env/env.ts
806
- var vn = "2.7.6-alpha.3";
806
+ var vn = "2.7.6-alpha.4";
807
807
  var pe = () => vn;
808
808
 
809
809
  // src/availability/availability.ts
@@ -803,7 +803,7 @@ var ot = {
803
803
  };
804
804
 
805
805
  // src/env/env.ts
806
- var vn = "2.7.6-alpha.3";
806
+ var vn = "2.7.6-alpha.4";
807
807
  var pe = () => vn;
808
808
 
809
809
  // src/availability/availability.ts
@@ -5,3 +5,6 @@ export declare enum WidgetTheme {
5
5
  LIGHT = "light",
6
6
  DARK = "dark"
7
7
  }
8
+ export type ThemeOverrides = {
9
+ drawerBackground?: string;
10
+ };
@@ -1,4 +1,4 @@
1
- import { WidgetTheme } from './theme';
1
+ import { ThemeOverrides, WidgetTheme } from './theme';
2
2
  /**
3
3
  * Widget Configuration represents the shared configuration options for the Commerce Widgets.
4
4
  * @property {WidgetTheme | undefined} theme
@@ -8,6 +8,7 @@ import { WidgetTheme } from './theme';
8
8
  export type WidgetConfiguration = {
9
9
  /** The theme of the Commerce Widget (default: "DARK") */
10
10
  theme?: WidgetTheme;
11
+ themeOverrides?: ThemeOverrides;
11
12
  language?: WidgetLanguage;
12
13
  walletConnect?: WalletConnectConfig;
13
14
  };
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@imtbl/checkout-sdk",
3
3
  "description": "Immutable Checkout SDK",
4
- "version": "2.7.6-alpha.3",
4
+ "version": "2.7.6-alpha.4",
5
5
  "author": "immutable",
6
6
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
7
7
  "dependencies": {
8
- "@imtbl/blockchain-data": "2.7.6-alpha.3",
9
- "@imtbl/bridge-sdk": "2.7.6-alpha.3",
10
- "@imtbl/config": "2.7.6-alpha.3",
11
- "@imtbl/dex-sdk": "2.7.6-alpha.3",
12
- "@imtbl/generated-clients": "2.7.6-alpha.3",
13
- "@imtbl/metrics": "2.7.6-alpha.3",
14
- "@imtbl/orderbook": "2.7.6-alpha.3",
15
- "@imtbl/passport": "2.7.6-alpha.3",
8
+ "@imtbl/blockchain-data": "2.7.6-alpha.4",
9
+ "@imtbl/bridge-sdk": "2.7.6-alpha.4",
10
+ "@imtbl/config": "2.7.6-alpha.4",
11
+ "@imtbl/dex-sdk": "2.7.6-alpha.4",
12
+ "@imtbl/generated-clients": "2.7.6-alpha.4",
13
+ "@imtbl/metrics": "2.7.6-alpha.4",
14
+ "@imtbl/orderbook": "2.7.6-alpha.4",
15
+ "@imtbl/passport": "2.7.6-alpha.4",
16
16
  "@metamask/detect-provider": "^2.0.0",
17
17
  "axios": "^1.6.5",
18
18
  "ethers": "^6.13.4",