@cartridge/controller 0.13.11-alpha.1 → 0.13.11-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { WalletAccount as Sn, constants as ge, num as Bt, shortString as ft } from "starknet";
2
- import { R, t as $n, K as Ut, A as Mt, I as Ln, B as _n, N as $, H as ue, p as In, v as Pn, s as Rt } from "./index-hg9K2M84.js";
3
- import { c as Ni, i as Bi, E as Ui, k as Mi, j as Ri, F as Oi, b as Fi, a as zi, l as ji, m as Hi, o as Wi, q as qi, g as Vi, h as Di, r as Zi, u as Ki, n as Xi, f as Gi, d as Yi, e as Ji } from "./index-hg9K2M84.js";
2
+ import { R, t as $n, K as Ut, A as Mt, I as Ln, B as _n, N as A, H as ue, p as Pn, v as In, s as Rt } from "./index-D-vUjqmc.js";
3
+ import { c as Ni, i as Bi, E as Ui, k as Mi, j as Ri, F as Oi, b as Fi, a as zi, l as ji, m as Hi, o as Wi, q as qi, g as Vi, h as Di, r as Zi, u as Ki, n as Xi, f as Gi, d as Yi, e as Ji } from "./index-D-vUjqmc.js";
4
4
  const Tn = "standard:connect", Nn = "standard:disconnect", Bn = "standard:events", Un = "0.1.1";
5
5
  function Mn() {
6
6
  return Un;
@@ -316,7 +316,7 @@ var Qe = (t, e, n) => {
316
316
  if (e.has(t))
317
317
  throw TypeError("Cannot add the same private member more than once");
318
318
  e instanceof WeakSet ? e.add(t) : e.set(t, n);
319
- }, ye = (t, e, n, r) => (Qe(t, e, "write to private field"), e.set(t, n), n), I = (t, e, n) => (Qe(t, e, "access private method"), n), z, L, Oe, Fe, ze, D, J, je, Kt, oe, Ee, He, Xt, We, Gt, Ce, et, qe, Yt, tt, Jt;
319
+ }, ye = (t, e, n, r) => (Qe(t, e, "write to private field"), e.set(t, n), n), P = (t, e, n) => (Qe(t, e, "access private method"), n), z, L, Oe, Fe, ze, D, J, je, Kt, oe, Ee, He, Xt, We, Gt, Ce, et, qe, Yt, tt, Jt;
320
320
  class wr {
321
321
  constructor(e) {
322
322
  this.injected = e, B(this, D), B(this, je), B(this, oe), B(this, He), B(this, We), B(this, Ce), B(this, qe), B(this, tt), B(this, z, {}), B(this, L, null), B(this, Oe, async ({ silent: n }) => {
@@ -329,12 +329,12 @@ class wr {
329
329
  });
330
330
  if (r.length === 0)
331
331
  return { accounts: [] };
332
- await I(this, Ce, et).call(this, r);
332
+ await P(this, Ce, et).call(this, r);
333
333
  }
334
334
  return { accounts: this.accounts };
335
335
  }), B(this, Fe, async () => {
336
- I(this, oe, Ee).call(this);
337
- }), B(this, ze, (n, r) => (E(this, z)[n] || (E(this, z)[n] = []), E(this, z)[n].push(r), () => I(this, je, Kt).call(this, n, r))), this.injected.on("accountsChanged", I(this, He, Xt).bind(this)), this.injected.on("networkChanged", I(this, We, Gt).bind(this));
336
+ P(this, oe, Ee).call(this);
337
+ }), B(this, ze, (n, r) => (E(this, z)[n] || (E(this, z)[n] = []), E(this, z)[n].push(r), () => P(this, je, Kt).call(this, n, r))), this.injected.on("accountsChanged", P(this, He, Xt).bind(this)), this.injected.on("networkChanged", P(this, We, Gt).bind(this));
338
338
  }
339
339
  get version() {
340
340
  return "1.0.0";
@@ -361,7 +361,7 @@ class wr {
361
361
  },
362
362
  [pr]: {
363
363
  version: "1.0.0",
364
- request: I(this, qe, Yt).bind(this),
364
+ request: P(this, qe, Yt).bind(this),
365
365
  walletVersion: this.injected.version
366
366
  }
367
367
  };
@@ -399,20 +399,20 @@ Kt = function(t, e) {
399
399
  };
400
400
  oe = /* @__PURE__ */ new WeakSet();
401
401
  Ee = function() {
402
- E(this, L) && (ye(this, L, null), I(this, D, J).call(this, "change", { accounts: this.accounts }));
402
+ E(this, L) && (ye(this, L, null), P(this, D, J).call(this, "change", { accounts: this.accounts }));
403
403
  };
404
404
  He = /* @__PURE__ */ new WeakSet();
405
405
  Xt = async function(t) {
406
406
  if (!t || t.length === 0) {
407
- I(this, oe, Ee).call(this);
407
+ P(this, oe, Ee).call(this);
408
408
  return;
409
409
  }
410
- E(this, L) && await I(this, Ce, et).call(this, t);
410
+ E(this, L) && await P(this, Ce, et).call(this, t);
411
411
  };
412
412
  We = /* @__PURE__ */ new WeakSet();
413
413
  Gt = function(t, e) {
414
414
  if (!t) {
415
- I(this, oe, Ee).call(this);
415
+ P(this, oe, Ee).call(this);
416
416
  return;
417
417
  }
418
418
  if (!E(this, L))
@@ -422,9 +422,9 @@ Gt = function(t, e) {
422
422
  throw new Error(`Invalid Starknet chain: ${n}`);
423
423
  if (e?.length > 0) {
424
424
  const [r] = e;
425
- ye(this, L, { address: r, chain: n }), I(this, D, J).call(this, "change", { accounts: this.accounts });
425
+ ye(this, L, { address: r, chain: n }), P(this, D, J).call(this, "change", { accounts: this.accounts });
426
426
  } else
427
- ye(this, L, { address: E(this, L)?.address, chain: n }), I(this, D, J).call(this, "change", { accounts: this.accounts });
427
+ ye(this, L, { address: E(this, L)?.address, chain: n }), P(this, D, J).call(this, "change", { accounts: this.accounts });
428
428
  };
429
429
  Ce = /* @__PURE__ */ new WeakSet();
430
430
  et = async function(t) {
@@ -432,10 +432,10 @@ et = async function(t) {
432
432
  return;
433
433
  const [e] = t;
434
434
  if (E(this, L)?.chain)
435
- E(this, L).address = e, I(this, D, J).call(this, "change", { accounts: this.accounts });
435
+ E(this, L).address = e, P(this, D, J).call(this, "change", { accounts: this.accounts });
436
436
  else {
437
- const n = await I(this, tt, Jt).call(this);
438
- ye(this, L, { address: e, chain: n }), I(this, D, J).call(this, "change", { accounts: this.accounts });
437
+ const n = await P(this, tt, Jt).call(this);
438
+ ye(this, L, { address: e, chain: n }), P(this, D, J).call(this, "change", { accounts: this.accounts });
439
439
  }
440
440
  };
441
441
  qe = /* @__PURE__ */ new WeakSet();
@@ -633,14 +633,14 @@ const gr = (t, e) => {
633
633
  i.postMessage(b, o);
634
634
  } catch (g) {
635
635
  if (g.name === Ve.DataCloneError) {
636
- const S = {
636
+ const $ = {
637
637
  penpal: O.Reply,
638
638
  id: w,
639
639
  resolution: q.Rejected,
640
640
  returnValue: xt(g),
641
641
  returnValueIsError: !0
642
642
  };
643
- i.postMessage(S, o);
643
+ i.postMessage($, o);
644
644
  }
645
645
  throw g;
646
646
  }
@@ -669,7 +669,7 @@ const Ar = () => ++Er, Qt = ".", en = (t) => t ? t.split(Qt) : [], Sr = (t) => t
669
669
  for (const n in t)
670
670
  Lr(e, n, t[n]);
671
671
  return e;
672
- }, Ir = (t, e, n, r, s) => {
672
+ }, Pr = (t, e, n, r, s) => {
673
673
  const { localName: i, local: o, remote: a, originForSending: l, originForReceiving: c } = e;
674
674
  let d = !1;
675
675
  s(`${i}: Connecting call sender`);
@@ -699,19 +699,19 @@ const Ar = () => ++Er, Qt = ".", en = (t) => t ? t.split(Qt) : [], Sr = (t) => t
699
699
  k.returnValueIsError && (X = xr(X)), (k.resolution === q.Fulfilled ? m : T)(X);
700
700
  };
701
701
  o.addEventListener(H.Message, g);
702
- const S = {
702
+ const $ = {
703
703
  penpal: O.Call,
704
704
  id: b,
705
705
  methodName: f,
706
706
  args: w
707
707
  };
708
- a.postMessage(S, l);
708
+ a.postMessage($, l);
709
709
  });
710
710
  }, u = n.reduce((f, w) => (f[w] = h(w), f), {});
711
711
  return Object.assign(t, _r(u)), () => {
712
712
  d = !0;
713
713
  };
714
- }, Pr = (t, e, n, r, s) => {
714
+ }, Ir = (t, e, n, r, s) => {
715
715
  const { destroy: i, onDestroy: o } = r;
716
716
  let a, l;
717
717
  const c = {};
@@ -731,7 +731,7 @@ const Ar = () => ++Er, Qt = ".", en = (t) => t ? t.split(Qt) : [], Sr = (t) => t
731
731
  a && a(), a = vr(h, t, s), o(a), l && l.forEach((f) => {
732
732
  delete c[f];
733
733
  }), l = d.data.methodNames;
734
- const u = Ir(c, h, l, i, s);
734
+ const u = Pr(c, h, l, i, s);
735
735
  return o(u), c;
736
736
  };
737
737
  }, Tr = (t, e, n, r) => (s) => {
@@ -771,7 +771,7 @@ const Ar = () => ++Er, Qt = ".", en = (t) => t ? t.split(Qt) : [], Sr = (t) => t
771
771
  let { iframe: e, methods: n = {}, childOrigin: r, timeout: s, debug: i = !1 } = t;
772
772
  const o = mr(i), a = gr("Parent", o), { onDestroy: l, destroy: c } = a;
773
773
  r || (Mr(e), r = kr(e.src));
774
- const d = r === "null" ? "*" : r, h = tn(n), u = Tr(o, h, r, d), f = Pr(h, r, d, a, o);
774
+ const d = r === "null" ? "*" : r, h = tn(n), u = Tr(o, h, r, d), f = Ir(h, r, d, a, o);
775
775
  return {
776
776
  promise: new Promise((C, m) => {
777
777
  const T = Ur(s, c), b = (g) => {
@@ -781,8 +781,8 @@ const Ar = () => ++Er, Qt = ".", en = (t) => t ? t.split(Qt) : [], Sr = (t) => t
781
781
  return;
782
782
  }
783
783
  if (g.data.penpal === O.Ack) {
784
- const S = f(g);
785
- S && (T(), C(S));
784
+ const $ = f(g);
785
+ $ && (T(), C($));
786
786
  return;
787
787
  }
788
788
  }
@@ -813,6 +813,7 @@ function zr(t) {
813
813
  "publickey-credentials-create *",
814
814
  "publickey-credentials-get *",
815
815
  "clipboard-write",
816
+ "geolocation *",
816
817
  "payment *"
817
818
  ];
818
819
  return nn(t.hostname) && e.push("local-network-access *"), e.join("; ");
@@ -1291,13 +1292,13 @@ const ts = {
1291
1292
  // op sepolia
1292
1293
  [ge.StarknetChainId.SN_MAIN]: "starknet",
1293
1294
  [ge.StarknetChainId.SN_SEPOLIA]: "starknet"
1294
- }, Ie = (t) => {
1295
+ }, Pe = (t) => {
1295
1296
  const e = Bt.toHex(t), n = ts[e];
1296
1297
  return n || console.warn(`Unknown chain ID: ${e}`), n;
1297
1298
  };
1298
- let Pe;
1299
+ let Ie;
1299
1300
  function ns() {
1300
- return Pe || (Pe = es()), Pe;
1301
+ return Ie || (Ie = es()), Ie;
1301
1302
  }
1302
1303
  class Ae {
1303
1304
  platform;
@@ -1335,9 +1336,9 @@ class Ae {
1335
1336
  }).catch(console.error), e.provider.request({
1336
1337
  method: "eth_chainId"
1337
1338
  }).then((n) => {
1338
- this.platform = Ie(n);
1339
+ this.platform = Pe(n);
1339
1340
  }).catch(console.error), e.provider?.on("chainChanged", (n) => {
1340
- this.platform = Ie(n);
1341
+ this.platform = Pe(n);
1341
1342
  }), e.provider?.on("accountsChanged", (n) => {
1342
1343
  n && (this.connectedAccounts = n.map((r) => F(r)), this.account = n.length > 0 ? F(n[0]) : void 0);
1343
1344
  }));
@@ -1492,7 +1493,7 @@ class Ae {
1492
1493
  return await n.request({
1493
1494
  method: "wallet_switchEthereumChain",
1494
1495
  params: [{ chainId: e }]
1495
- }), this.platform = Ie(e), !0;
1496
+ }), this.platform = Pe(e), !0;
1496
1497
  } catch (r) {
1497
1498
  throw r.code === 4902 && console.warn(`Chain not added to ${this.displayName}`), r;
1498
1499
  }
@@ -1826,17 +1827,17 @@ const fn = (t) => {
1826
1827
  return n;
1827
1828
  }
1828
1829
  };
1829
- }, A = {
1830
+ }, S = {
1830
1831
  BITS: 32,
1831
1832
  FULL_MASK: -1 >>> 0,
1832
1833
  // 1<<32 will overflow
1833
1834
  len: (t) => Math.ceil(t / 32),
1834
- create: (t) => new Uint32Array(A.len(t)),
1835
+ create: (t) => new Uint32Array(S.len(t)),
1835
1836
  clean: (t) => t.fill(0),
1836
1837
  debug: (t) => Array.from(t).map((e) => (e >>> 0).toString(2).padStart(32, "0")),
1837
1838
  checkLen: (t, e) => {
1838
- if (A.len(e) !== t.length)
1839
- throw new Error(`wrong length=${t.length}. Expected: ${A.len(e)}`);
1839
+ if (S.len(e) !== t.length)
1840
+ throw new Error(`wrong length=${t.length}. Expected: ${S.len(e)}`);
1840
1841
  },
1841
1842
  chunkLen: (t, e, n) => {
1842
1843
  if (e < 0)
@@ -1850,8 +1851,8 @@ const fn = (t) => {
1850
1851
  mask: 1 << 32 - (t + e) % 32 - 1
1851
1852
  }),
1852
1853
  indices: (t, e, n = !1) => {
1853
- A.checkLen(t, e);
1854
- const { FULL_MASK: r, BITS: s } = A, i = s - e % s, o = i ? r >>> i << i : r, a = [];
1854
+ S.checkLen(t, e);
1855
+ const { FULL_MASK: r, BITS: s } = S, i = s - e % s, o = i ? r >>> i << i : r, a = [];
1855
1856
  for (let l = 0; l < t.length; l++) {
1856
1857
  let c = t[l];
1857
1858
  if (n && (c = ~c), l === t.length - 1 && (c &= o), c !== 0)
@@ -1869,19 +1870,19 @@ const fn = (t) => {
1869
1870
  n === void 0 || r !== n.pos + n.length ? e.push(n = { pos: r, length: 1 }) : n.length += 1;
1870
1871
  return e;
1871
1872
  },
1872
- rangeDebug: (t, e, n = !1) => `[${A.range(A.indices(t, e, n)).map((r) => `(${r.pos}/${r.length})`).join(", ")}]`,
1873
+ rangeDebug: (t, e, n = !1) => `[${S.range(S.indices(t, e, n)).map((r) => `(${r.pos}/${r.length})`).join(", ")}]`,
1873
1874
  setRange: (t, e, n, r, s = !0) => {
1874
- A.chunkLen(e, n, r);
1875
- const { FULL_MASK: i, BITS: o } = A, a = n % o ? Math.floor(n / o) : void 0, l = n + r, c = l % o ? Math.floor(l / o) : void 0;
1875
+ S.chunkLen(e, n, r);
1876
+ const { FULL_MASK: i, BITS: o } = S, a = n % o ? Math.floor(n / o) : void 0, l = n + r, c = l % o ? Math.floor(l / o) : void 0;
1876
1877
  if (a !== void 0 && a === c)
1877
- return A.set(t, a, i >>> o - r << o - r - n, s);
1878
- if (a !== void 0 && !A.set(t, a, i >>> n % o, s))
1878
+ return S.set(t, a, i >>> o - r << o - r - n, s);
1879
+ if (a !== void 0 && !S.set(t, a, i >>> n % o, s))
1879
1880
  return !1;
1880
1881
  const d = a !== void 0 ? a + 1 : n / o, h = c !== void 0 ? c : l / o;
1881
1882
  for (let u = d; u < h; u++)
1882
- if (!A.set(t, u, i, s))
1883
+ if (!S.set(t, u, i, s))
1883
1884
  return !1;
1884
- return !(c !== void 0 && a !== c && !A.set(t, c, i << o - l % o, s));
1885
+ return !(c !== void 0 && a !== c && !S.set(t, c, i << o - l % o, s));
1885
1886
  }
1886
1887
  }, Z = {
1887
1888
  /**
@@ -1930,10 +1931,10 @@ class ct {
1930
1931
  _enablePointers() {
1931
1932
  if (this.parent)
1932
1933
  return this.parent._enablePointers();
1933
- this.bs || (this.bs = A.create(this.data.length), A.setRange(this.bs, this.data.length, 0, this.pos, this.opts.allowMultipleReads));
1934
+ this.bs || (this.bs = S.create(this.data.length), S.setRange(this.bs, this.data.length, 0, this.pos, this.opts.allowMultipleReads));
1934
1935
  }
1935
1936
  markBytesBS(e, n) {
1936
- return this.parent ? this.parent.markBytesBS(this.parentOffset + e, n) : !n || !this.bs ? !0 : A.setRange(this.bs, this.data.length, e, n, !1);
1937
+ return this.parent ? this.parent.markBytesBS(this.parentOffset + e, n) : !n || !this.bs ? !0 : S.setRange(this.bs, this.data.length, e, n, !1);
1937
1938
  }
1938
1939
  markBytes(e) {
1939
1940
  const n = this.pos;
@@ -1965,9 +1966,9 @@ class ct {
1965
1966
  if (this.bitPos)
1966
1967
  throw this.err(`${this.bitPos} bits left after unpack: ${Ne.encode(this.data.slice(this.pos))}`);
1967
1968
  if (this.bs && !this.parent) {
1968
- const e = A.indices(this.bs, this.data.length, !0);
1969
+ const e = S.indices(this.bs, this.data.length, !0);
1969
1970
  if (e.length) {
1970
- const n = A.range(e).map(({ pos: r, length: s }) => `(${r}/${s})[${Ne.encode(this.data.subarray(r, r + s))}]`).join(", ");
1971
+ const n = S.range(e).map(({ pos: r, length: s }) => `(${r}/${s})[${Ne.encode(this.data.subarray(r, r + s))}]`).join(", ");
1971
1972
  throw this.err(`unread byte ranges: ${n} (total=${this.data.length})`);
1972
1973
  } else
1973
1974
  return;
@@ -2157,7 +2158,7 @@ function wn(t, e) {
2157
2158
  }
2158
2159
  });
2159
2160
  }
2160
- const P = (t) => {
2161
+ const I = (t) => {
2161
2162
  const e = pn(t);
2162
2163
  return t.validate ? wn(e, t.validate) : e;
2163
2164
  }, Se = (t) => K(t) && typeof t.decode == "function" && typeof t.encode == "function";
@@ -2292,7 +2293,7 @@ const xs = (t) => {
2292
2293
  if (typeof r != "boolean")
2293
2294
  throw new Error(`bigint/sized: expected boolean, got ${typeof r}`);
2294
2295
  const s = BigInt(t), i = 2n ** (8n * s - 1n);
2295
- return P({
2296
+ return I({
2296
2297
  size: r ? t : void 0,
2297
2298
  encodeStream: (o, a) => {
2298
2299
  n && a < 0 && (a = a | i);
@@ -2321,7 +2322,7 @@ const xs = (t) => {
2321
2322
  return gs(o, 8n * s, !!n), o;
2322
2323
  }
2323
2324
  });
2324
- }, v = /* @__PURE__ */ vs(8, !0), Es = (t, e) => P({
2325
+ }, v = /* @__PURE__ */ vs(8, !0), Es = (t, e) => I({
2325
2326
  size: t,
2326
2327
  encodeStream: (n, r) => n.writeView(t, (s) => e.write(s, r)),
2327
2328
  decodeStream: (n) => n.readView(t, e.read),
@@ -2353,7 +2354,7 @@ const xs = (t) => {
2353
2354
  }), N = /* @__PURE__ */ gn(1, !1, {
2354
2355
  read: (t, e) => t.getUint8(e),
2355
2356
  write: (t, e) => t.setUint8(0, e)
2356
- }), Xe = /* @__PURE__ */ P({
2357
+ }), Xe = /* @__PURE__ */ I({
2357
2358
  size: 1,
2358
2359
  encodeStream: (t, e) => t.byte(e ? 1 : 0),
2359
2360
  decodeStream: (t) => {
@@ -2371,7 +2372,7 @@ const xs = (t) => {
2371
2372
  if (typeof e != "boolean")
2372
2373
  throw new Error(`bytes/le: expected boolean, got ${typeof e}`);
2373
2374
  const n = fn(t), r = j(t);
2374
- return P({
2375
+ return I({
2375
2376
  size: typeof t == "number" ? t : void 0,
2376
2377
  encodeStream: (s, i) => {
2377
2378
  r || n.encodeStream(s, i.length), s.bytes(e ? Ke(i) : i), r && s.bytes(t);
@@ -2403,7 +2404,7 @@ function Ss(t, e) {
2403
2404
  throw new Error(`apply: invalid inner value ${t}`);
2404
2405
  if (!Se(e))
2405
2406
  throw new Error(`apply: invalid base value ${t}`);
2406
- return P({
2407
+ return I({
2407
2408
  size: t.size,
2408
2409
  encodeStream: (n, r) => {
2409
2410
  let s;
@@ -2427,7 +2428,7 @@ function Ss(t, e) {
2427
2428
  function se(t, e, n) {
2428
2429
  if (!U(t) || !U(e))
2429
2430
  throw new Error(`optional: invalid flag or inner value flag=${t} inner=${e}`);
2430
- return P({
2431
+ return I({
2431
2432
  size: n !== void 0 && t.size && e.size ? t.size + e.size : void 0,
2432
2433
  encodeStream: (r, s) => {
2433
2434
  t.encodeStream(r, !!s), s ? e.encodeStream(r, s) : n !== void 0 && e.encodeStream(r, n);
@@ -2440,7 +2441,7 @@ function se(t, e, n) {
2440
2441
  });
2441
2442
  }
2442
2443
  function $s(t) {
2443
- return P({
2444
+ return I({
2444
2445
  encodeStream: (e, n) => {
2445
2446
  if (n !== t)
2446
2447
  throw new Error(`constant: invalid value ${n} (exp: ${t})`);
@@ -2465,7 +2466,7 @@ function p(t) {
2465
2466
  for (const e in t)
2466
2467
  if (!U(t[e]))
2467
2468
  throw new Error(`struct: field ${e} is not CoderType`);
2468
- return P({
2469
+ return I({
2469
2470
  size: Ls(Object.values(t)),
2470
2471
  encodeStream: (e, n) => {
2471
2472
  e.pushObj(n, (r) => {
@@ -2491,7 +2492,7 @@ function we(t, e) {
2491
2492
  if (!U(e))
2492
2493
  throw new Error(`array: invalid inner value ${e}`);
2493
2494
  const n = fn(typeof t == "string" ? `../${t}` : t);
2494
- return P({
2495
+ return I({
2495
2496
  size: typeof t == "number" && e.size ? t * e.size : void 0,
2496
2497
  encodeStream: (r, s) => {
2497
2498
  const i = r;
@@ -2547,7 +2548,7 @@ function lt(t, e) {
2547
2548
  const n = /* @__PURE__ */ new Map();
2548
2549
  for (const r in e)
2549
2550
  n.set(e[r], r);
2550
- return P({
2551
+ return I({
2551
2552
  size: t.size,
2552
2553
  encodeStream: (r, s) => t.encodeStream(r, e[s]),
2553
2554
  decodeStream: (r) => {
@@ -2573,7 +2574,7 @@ function _s(t, e) {
2573
2574
  for (const n in e)
2574
2575
  if (!U(e[n]))
2575
2576
  throw new Error(`tag: variant ${n} is not CoderType`);
2576
- return P({
2577
+ return I({
2577
2578
  size: t.size,
2578
2579
  encodeStream: (n, r) => {
2579
2580
  const { TAG: s, data: i } = r, o = e[s];
@@ -2593,7 +2594,7 @@ function _s(t, e) {
2593
2594
  }
2594
2595
  });
2595
2596
  }
2596
- const Is = (t) => 0;
2597
+ const Ps = (t) => 0;
2597
2598
  function Be(t, e) {
2598
2599
  return e % t === 0 ? 0 : t - e % t;
2599
2600
  }
@@ -2604,8 +2605,8 @@ function mn(t, e, n) {
2604
2605
  throw new Error(`padLeft: wrong blockSize=${t}`);
2605
2606
  if (n !== void 0 && typeof n != "function")
2606
2607
  throw new Error(`padRight: wrong padFn=${typeof n}`);
2607
- const r = n || Is;
2608
- return P({
2608
+ const r = n || Ps;
2609
+ return I({
2609
2610
  size: e.size ? e.size + Be(t, e.size) : void 0,
2610
2611
  encodeStream: (s, i) => {
2611
2612
  const o = s, a = o.pos;
@@ -2620,7 +2621,7 @@ function mn(t, e, n) {
2620
2621
  }
2621
2622
  });
2622
2623
  }
2623
- const Ps = 9, Ue = ne.decimal(Ps), re = P({
2624
+ const Is = 9, Ue = ne.decimal(Is), re = I({
2624
2625
  encodeStream: (t, e) => {
2625
2626
  if (!e)
2626
2627
  return t.byte(0);
@@ -2638,7 +2639,7 @@ const Ps = 9, Ue = ne.decimal(Ps), re = P({
2638
2639
  }
2639
2640
  }), pe = As(mn(8, ve, void 0)), Ts = () => {
2640
2641
  const t = $e(32);
2641
- return P({
2642
+ return I({
2642
2643
  size: t.size,
2643
2644
  encodeStream: (e, n) => t.encodeStream(e, De.decode(n)),
2644
2645
  decodeStream: (e) => De.encode(t.decodeStream(e))
@@ -2661,7 +2662,7 @@ const Us = (t, e, n, r, s) => ({
2661
2662
  }), _t = p({
2662
2663
  signatures: we(re, $e(64)),
2663
2664
  msg: Ns
2664
- }), Ge = P({
2665
+ }), Ge = I({
2665
2666
  encodeStream: (t, e) => {
2666
2667
  const { msg: n, signatures: r } = e, s = {}, i = (h, u, f) => {
2667
2668
  let w = s[h] || (s[h] = { sign: !1, write: !1 });
@@ -2730,12 +2731,12 @@ const Us = (t, e, n, r, s) => ({
2730
2731
  signatures: r
2731
2732
  };
2732
2733
  }
2733
- }), It = {};
2734
+ }), Pt = {};
2734
2735
  function dt(t, e, n) {
2735
- if (It[t])
2736
+ if (Pt[t])
2736
2737
  throw new Error("SOL: program for this address already defined");
2737
2738
  const r = lt(e, Object.keys(n).reduce((a, l, c) => ({ ...a, [l]: c }), {})), s = Object.keys(n).reduce((a, l) => ({ ...a, [l]: n[l].coder }), {}), i = _s(r, s);
2738
- It[t] = (a, l) => {
2739
+ Pt[t] = (a, l) => {
2739
2740
  if (a.program !== t)
2740
2741
  throw new Error("SOL.parseInstruction: Wrong instruction program address");
2741
2742
  const { TAG: c, data: d } = i.decode(a.data), h = { type: c, info: d }, u = Object.keys(n[c].keys);
@@ -3087,7 +3088,7 @@ p({
3087
3088
  delegateAmount: v,
3088
3089
  closeAuthority: se(Re, y, "11111111111111111111111111111111")
3089
3090
  });
3090
- function Pt(t, e, n) {
3091
+ function It(t, e, n) {
3091
3092
  if (!e.length)
3092
3093
  throw new Error("SOLPublic: empty instructions array");
3093
3094
  return ds.encode(Ge.encode({
@@ -3120,8 +3121,8 @@ function Os(t) {
3120
3121
  const w = (f - u) * i + 1 >>> 0, C = new Uint8Array(w);
3121
3122
  for (; u !== f; ) {
3122
3123
  let b = c[u], g = 0;
3123
- for (let S = w - 1; (b !== 0 || g < h) && S !== -1; S--, g++)
3124
- b += 256 * C[S] >>> 0, C[S] = b % n >>> 0, b = b / n >>> 0;
3124
+ for (let $ = w - 1; (b !== 0 || g < h) && $ !== -1; $--, g++)
3125
+ b += 256 * C[$] >>> 0, C[$] = b % n >>> 0, b = b / n >>> 0;
3125
3126
  if (b !== 0)
3126
3127
  throw new Error("Non-zero carry");
3127
3128
  h = g, u++;
@@ -3150,12 +3151,12 @@ function Os(t) {
3150
3151
  let g = e[b];
3151
3152
  if (g === 255)
3152
3153
  return;
3153
- let S = 0;
3154
- for (let _ = f - 1; (g !== 0 || S < u) && _ !== -1; _--, S++)
3154
+ let $ = 0;
3155
+ for (let _ = f - 1; (g !== 0 || $ < u) && _ !== -1; _--, $++)
3155
3156
  g += n * w[_] >>> 0, w[_] = g % 256 >>> 0, g = g / 256 >>> 0;
3156
3157
  if (g !== 0)
3157
3158
  throw new Error("Non-zero carry");
3158
- u = S, d++;
3159
+ u = $, d++;
3159
3160
  }
3160
3161
  let C = f - u;
3161
3162
  for (; C !== f && w[C] === 0; )
@@ -3201,7 +3202,7 @@ class ht {
3201
3202
  return Buffer.from(Ge.encode(this._transaction));
3202
3203
  if (!this.feePayer || !this.recentBlockhash)
3203
3204
  throw new Error("Transaction requires feePayer and recentBlockhash");
3204
- const n = Pt(
3205
+ const n = It(
3205
3206
  this.feePayer.toString(),
3206
3207
  this._instructions,
3207
3208
  this.recentBlockhash
@@ -3211,7 +3212,7 @@ class ht {
3211
3212
  serializeMessage() {
3212
3213
  if (!this.feePayer || !this.recentBlockhash)
3213
3214
  throw new Error("Transaction requires feePayer and recentBlockhash");
3214
- const e = Pt(
3215
+ const e = It(
3215
3216
  this.feePayer.toString(),
3216
3217
  this._instructions,
3217
3218
  this.recentBlockhash
@@ -3671,7 +3672,7 @@ class Ds extends jr {
3671
3672
  propagateSessionErrors: T,
3672
3673
  errorDisplayMode: b,
3673
3674
  webauthnPopup: g,
3674
- ...S
3675
+ ...$
3675
3676
  }) {
3676
3677
  let _;
3677
3678
  const k = new URL(e ?? Ut), X = new qs();
@@ -3684,7 +3685,7 @@ class Ds extends jr {
3684
3685
  ) : a && n && console.warn(
3685
3686
  "[Controller] Both `preset` and `policies` provided to ControllerProvider. Policies are ignored when preset is set. Use `shouldOverridePresetPolicies: true` to override."
3686
3687
  ), m && (k.hash = `kc=${encodeURIComponent(m)}`), super({
3687
- ...S,
3688
+ ...$,
3688
3689
  id: "controller-keychain",
3689
3690
  url: k,
3690
3691
  methods: {
@@ -3885,7 +3886,7 @@ function Js(t) {
3885
3886
  }
3886
3887
  return { isValid: !0 };
3887
3888
  }
3888
- class Ii extends _n {
3889
+ class Pi extends _n {
3889
3890
  keychain;
3890
3891
  options;
3891
3892
  iframes;
@@ -3935,7 +3936,7 @@ class Ii extends _n {
3935
3936
  }
3936
3937
  async logout() {
3937
3938
  if (!this.keychain) {
3938
- console.error(new $().message);
3939
+ console.error(new A().message);
3939
3940
  return;
3940
3941
  }
3941
3942
  try {
@@ -3953,7 +3954,7 @@ class Ii extends _n {
3953
3954
  if (this.iframes) {
3954
3955
  try {
3955
3956
  if (this.iframes.keychain || (this.iframes.keychain = this.createKeychainIframe()), await this.waitForKeychain(), !this.keychain) {
3956
- console.error(new $().message);
3957
+ console.error(new A().message);
3957
3958
  return;
3958
3959
  }
3959
3960
  const e = await this.keychain.probe(this.rpcUrl());
@@ -3983,7 +3984,7 @@ class Ii extends _n {
3983
3984
  if (this.account)
3984
3985
  return this.account;
3985
3986
  if (this.iframes.keychain || (this.iframes.keychain = this.createKeychainIframe()), await this.waitForKeychain(), !this.keychain || !this.iframes.keychain) {
3986
- console.error(new $().message);
3987
+ console.error(new A().message);
3987
3988
  return;
3988
3989
  }
3989
3990
  try {
@@ -4045,7 +4046,7 @@ class Ii extends _n {
4045
4046
  if (!this.iframes)
4046
4047
  return !1;
4047
4048
  if (!this.keychain || !this.iframes.keychain)
4048
- return console.error(new $().message), !1;
4049
+ return console.error(new A().message), !1;
4049
4050
  const n = this.selectedChain;
4050
4051
  try {
4051
4052
  this.selectedChain = e, await this.keychain.switchChain(this.rpcUrl());
@@ -4070,7 +4071,7 @@ class Ii extends _n {
4070
4071
  } catch {
4071
4072
  }
4072
4073
  if (!this.keychain) {
4073
- console.error(new $().message);
4074
+ console.error(new A().message);
4074
4075
  return;
4075
4076
  }
4076
4077
  await this.keychain.disconnect(), this.close(), this.emitAccountsChanged([]);
@@ -4079,7 +4080,7 @@ class Ii extends _n {
4079
4080
  if (!this.iframes)
4080
4081
  return;
4081
4082
  if (!this.keychain || !this.iframes.keychain) {
4082
- console.error(new $().message);
4083
+ console.error(new A().message);
4083
4084
  return;
4084
4085
  }
4085
4086
  if (!this.account) {
@@ -4095,7 +4096,7 @@ class Ii extends _n {
4095
4096
  if (!this.iframes)
4096
4097
  return;
4097
4098
  if (!this.keychain || !this.iframes.keychain) {
4098
- console.error(new $().message);
4099
+ console.error(new A().message);
4099
4100
  return;
4100
4101
  }
4101
4102
  if (!this.account) {
@@ -4110,7 +4111,7 @@ class Ii extends _n {
4110
4111
  async openProfileAt(e) {
4111
4112
  if (this.iframes) {
4112
4113
  if (!this.keychain || !this.iframes.keychain) {
4113
- console.error(new $().message);
4114
+ console.error(new A().message);
4114
4115
  return;
4115
4116
  }
4116
4117
  if (!this.account) {
@@ -4123,7 +4124,7 @@ class Ii extends _n {
4123
4124
  openSettings() {
4124
4125
  if (this.iframes) {
4125
4126
  if (!this.keychain || !this.iframes.keychain) {
4126
- console.error(new $().message);
4127
+ console.error(new A().message);
4127
4128
  return;
4128
4129
  }
4129
4130
  this.iframes.keychain.open(), this.keychain.openSettings();
@@ -4137,7 +4138,7 @@ class Ii extends _n {
4137
4138
  throw new Error("Either `policies` or `preset` must be provided");
4138
4139
  if (this.iframes) {
4139
4140
  if (this.iframes.keychain || (this.iframes.keychain = this.createKeychainIframe()), await this.waitForKeychain(), !this.keychain || !this.iframes.keychain) {
4140
- console.error(new $().message);
4141
+ console.error(new A().message);
4141
4142
  return;
4142
4143
  }
4143
4144
  this.iframes.keychain.open();
@@ -4157,7 +4158,7 @@ class Ii extends _n {
4157
4158
  }
4158
4159
  }
4159
4160
  revoke(e, n) {
4160
- return this.keychain ? this.keychain.revoke(e) : (console.error(new $().message), null);
4161
+ return this.keychain ? this.keychain.revoke(e) : (console.error(new A().message), null);
4161
4162
  }
4162
4163
  rpcUrl() {
4163
4164
  const e = this.chains.get(this.selectedChain);
@@ -4173,11 +4174,26 @@ class Ii extends _n {
4173
4174
  }
4174
4175
  username() {
4175
4176
  if (!this.keychain) {
4176
- console.error(new $().message);
4177
+ console.error(new A().message);
4177
4178
  return;
4178
4179
  }
4179
4180
  return this.keychain.username();
4180
4181
  }
4182
+ async openLocationPrompt(e) {
4183
+ if (!this.iframes)
4184
+ return;
4185
+ if (!this.keychain || !this.iframes.keychain) {
4186
+ console.error(new A().message);
4187
+ return;
4188
+ }
4189
+ const n = this.keychain.openLocationPrompt(e);
4190
+ this.iframes.keychain.open();
4191
+ try {
4192
+ return await n;
4193
+ } finally {
4194
+ this.iframes.keychain.close();
4195
+ }
4196
+ }
4181
4197
  async lookupUsername(e) {
4182
4198
  const n = e.trim();
4183
4199
  if (!n)
@@ -4187,7 +4203,7 @@ class Ii extends _n {
4187
4203
  openPurchaseCredits() {
4188
4204
  if (this.iframes) {
4189
4205
  if (!this.keychain || !this.iframes.keychain) {
4190
- console.error(new $().message);
4206
+ console.error(new A().message);
4191
4207
  return;
4192
4208
  }
4193
4209
  this.keychain.navigate("/purchase/credits").then(() => {
@@ -4199,7 +4215,7 @@ class Ii extends _n {
4199
4215
  if (!this.iframes)
4200
4216
  return;
4201
4217
  if (!this.keychain || !this.iframes.keychain) {
4202
- console.error(new $().message);
4218
+ console.error(new A().message);
4203
4219
  return;
4204
4220
  }
4205
4221
  const { onPurchaseComplete: s, ...i } = r ?? {};
@@ -4211,7 +4227,7 @@ class Ii extends _n {
4211
4227
  if (!this.iframes)
4212
4228
  return;
4213
4229
  if (!this.keychain || !this.iframes.keychain) {
4214
- console.error(new $().message);
4230
+ console.error(new A().message);
4215
4231
  return;
4216
4232
  }
4217
4233
  const { onPurchaseComplete: r, ...s } = n ?? {};
@@ -4223,7 +4239,7 @@ class Ii extends _n {
4223
4239
  if (!this.iframes)
4224
4240
  return;
4225
4241
  if (!this.keychain || !this.iframes.keychain) {
4226
- console.error(new $().message);
4242
+ console.error(new A().message);
4227
4243
  return;
4228
4244
  }
4229
4245
  let r = this.selectedChain;
@@ -4235,7 +4251,7 @@ class Ii extends _n {
4235
4251
  };
4236
4252
  }
4237
4253
  async delegateAccount() {
4238
- return this.keychain ? await this.keychain.delegateAccount() : (console.error(new $().message), null);
4254
+ return this.keychain ? await this.keychain.delegateAccount() : (console.error(new A().message), null);
4239
4255
  }
4240
4256
  /**
4241
4257
  * Returns a wallet standard interface for the controller.
@@ -4300,7 +4316,7 @@ class Ii extends _n {
4300
4316
  initializeChains(e) {
4301
4317
  for (const n of e)
4302
4318
  try {
4303
- const r = new URL(n.rpcUrl), s = In(r);
4319
+ const r = new URL(n.rpcUrl), s = Pn(r);
4304
4320
  this.chains.set(s, n);
4305
4321
  } catch (r) {
4306
4322
  throw console.error(`Failed to parse chainId for ${n.rpcUrl}:`, r), r;
@@ -4321,7 +4337,7 @@ class Ii extends _n {
4321
4337
  onConnect: (o) => {
4322
4338
  this.keychain = o;
4323
4339
  },
4324
- version: Pn,
4340
+ version: In,
4325
4341
  ref: this.referral.ref,
4326
4342
  refGroup: this.referral.refGroup,
4327
4343
  needsSessionCreation: e,
@@ -5427,14 +5443,14 @@ export {
5427
5443
  Ln as IMPLEMENTED_AUTH_OPTIONS,
5428
5444
  zi as InvalidCredentialsError,
5429
5445
  ss as MetaMaskWallet,
5430
- $ as NotReadyToConnect,
5446
+ A as NotReadyToConnect,
5431
5447
  js as PhantomEVMWallet,
5432
5448
  zs as PhantomWallet,
5433
5449
  Hs as RabbyWallet,
5434
5450
  R as ResponseCodes,
5435
5451
  qs as WalletBridge,
5436
- Ie as chainIdToPlatform,
5437
- Ii as default,
5452
+ Pe as chainIdToPlatform,
5453
+ Pi as default,
5438
5454
  ji as defaultTheme,
5439
5455
  Hi as erc20Metadata,
5440
5456
  Wi as getAvailableConfigs,
@@ -5447,7 +5463,7 @@ export {
5447
5463
  Ys as lookupUsername,
5448
5464
  Li as lookupUsernames,
5449
5465
  Xi as normalizeCalls,
5450
- In as parseChainId,
5466
+ Pn as parseChainId,
5451
5467
  Gi as parsePolicies,
5452
5468
  Rt as sanitizeImageSrc,
5453
5469
  $n as toArray,