@cartridge/controller 0.11.3 → 0.12.0

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 Qt, constants as Z, num as ct, shortString as Qe } from "starknet";
2
- import { R as Q, t as Ht, i as jt, K as lt, B as Wt, N as A, p as Yt, v as Vt, A as qt, s as dt } from "./provider-DCZ6z1Gs.js";
3
- import { a as Ps, d as Ts, E as Rs, f as Us, e as Ms, F as zs, I as Os, h as Ds, n as Fs, b as Qs, c as Hs } from "./provider-DCZ6z1Gs.js";
2
+ import { R as Q, t as Ht, i as jt, K as lt, B as Wt, N as _, p as Yt, v as Vt, A as qt, s as dt } from "./provider-BYY0uIsZ.js";
3
+ import { a as Ps, d as Ts, E as Rs, f as Us, e as Ms, F as zs, I as Os, h as Ds, n as Fs, b as Qs, c as Hs } from "./provider-BYY0uIsZ.js";
4
4
  class He extends Qt {
5
5
  keychain;
6
6
  modal;
@@ -142,32 +142,32 @@ const Zt = (t, e) => {
142
142
  }
143
143
  const h = d.data, { methodName: f, args: u, id: p } = h;
144
144
  r(`${n}: Received ${f}() call`);
145
- const b = (y) => (w) => {
145
+ const b = (y) => (I) => {
146
146
  if (r(`${n}: Sending ${f}() reply`), l) {
147
147
  r(`${n}: Unable to send ${f}() reply due to destroyed connection`);
148
148
  return;
149
149
  }
150
- const x = {
150
+ const m = {
151
151
  penpal: B.Reply,
152
152
  id: p,
153
153
  resolution: y,
154
- returnValue: w
154
+ returnValue: I
155
155
  };
156
- y === M.Rejected && w instanceof Error && (x.returnValue = je(w), x.returnValueIsError = !0);
156
+ y === M.Rejected && I instanceof Error && (m.returnValue = je(I), m.returnValueIsError = !0);
157
157
  try {
158
- o.postMessage(x, a);
159
- } catch (m) {
160
- if (m.name === ve.DataCloneError) {
161
- const _ = {
158
+ o.postMessage(m, a);
159
+ } catch (w) {
160
+ if (w.name === ve.DataCloneError) {
161
+ const E = {
162
162
  penpal: B.Reply,
163
163
  id: p,
164
164
  resolution: M.Rejected,
165
- returnValue: je(m),
165
+ returnValue: je(w),
166
166
  returnValueIsError: !0
167
167
  };
168
- o.postMessage(_, a);
168
+ o.postMessage(E, a);
169
169
  }
170
- throw m;
170
+ throw w;
171
171
  }
172
172
  };
173
173
  new Promise((y) => y(e[f].call(e, d.origin).apply(e, u))).then(b(M.Fulfilled), b(M.Rejected));
@@ -210,27 +210,27 @@ const sr = () => ++nr, ht = ".", ft = (t) => t ? t.split(ht) : [], or = (t) => t
210
210
  const y = new Error(`Unable to send ${u}() call due to destroyed connection`);
211
211
  throw y.code = G.ConnectionDestroyed, y;
212
212
  }
213
- return new Promise((y, w) => {
214
- const x = sr(), m = (L) => {
215
- if (L.source !== i || L.data.penpal !== B.Reply || L.data.id !== x)
213
+ return new Promise((y, I) => {
214
+ const m = sr(), w = (L) => {
215
+ if (L.source !== i || L.data.penpal !== B.Reply || L.data.id !== m)
216
216
  return;
217
217
  if (c !== "*" && L.origin !== c) {
218
218
  s(`${o} received message from origin ${L.origin} which did not match expected origin ${c}`);
219
219
  return;
220
220
  }
221
221
  const ue = L.data;
222
- s(`${o}: Received ${u}() reply`), a.removeEventListener(R.Message, m);
222
+ s(`${o}: Received ${u}() reply`), a.removeEventListener(R.Message, w);
223
223
  let pe = ue.returnValue;
224
- ue.returnValueIsError && (pe = tr(pe)), (ue.resolution === M.Fulfilled ? y : w)(pe);
224
+ ue.returnValueIsError && (pe = tr(pe)), (ue.resolution === M.Fulfilled ? y : I)(pe);
225
225
  };
226
- a.addEventListener(R.Message, m);
227
- const _ = {
226
+ a.addEventListener(R.Message, w);
227
+ const E = {
228
228
  penpal: B.Call,
229
- id: x,
229
+ id: m,
230
230
  methodName: u,
231
231
  args: p
232
232
  };
233
- i.postMessage(_, l);
233
+ i.postMessage(E, l);
234
234
  });
235
235
  }, f = r.reduce((u, p) => (u[p] = h(p), u), {});
236
236
  return Object.assign(t, cr(f)), () => {
@@ -299,21 +299,21 @@ const sr = () => ++nr, ht = ".", ft = (t) => t ? t.split(ht) : [], or = (t) => t
299
299
  const d = n === "null" ? "*" : n, h = ut(r), f = hr(a, h, n, d), u = dr(h, n, d, i, a);
300
300
  return {
301
301
  promise: new Promise((b, y) => {
302
- const w = pr(s, c), x = (m) => {
303
- if (!(m.source !== e.contentWindow || !m.data)) {
304
- if (m.data.penpal === B.Syn) {
305
- f(m);
302
+ const I = pr(s, c), m = (w) => {
303
+ if (!(w.source !== e.contentWindow || !w.data)) {
304
+ if (w.data.penpal === B.Syn) {
305
+ f(w);
306
306
  return;
307
307
  }
308
- if (m.data.penpal === B.Ack) {
309
- const _ = u(m);
310
- _ && (w(), b(_));
308
+ if (w.data.penpal === B.Ack) {
309
+ const E = u(w);
310
+ E && (I(), b(E));
311
311
  return;
312
312
  }
313
313
  }
314
314
  };
315
- window.addEventListener(R.Message, x), a("Parent: Awaiting handshake"), ur(e, i), l((m) => {
316
- window.removeEventListener(R.Message, x), m && y(m);
315
+ window.addEventListener(R.Message, m), a("Parent: Awaiting handshake"), ur(e, i), l((w) => {
316
+ window.removeEventListener(R.Message, m), w && y(w);
317
317
  });
318
318
  }),
319
319
  destroy() {
@@ -1482,17 +1482,17 @@ const St = (t) => {
1482
1482
  return r;
1483
1483
  }
1484
1484
  };
1485
- }, E = {
1485
+ }, k = {
1486
1486
  BITS: 32,
1487
1487
  FULL_MASK: -1 >>> 0,
1488
1488
  // 1<<32 will overflow
1489
1489
  len: (t) => Math.ceil(t / 32),
1490
- create: (t) => new Uint32Array(E.len(t)),
1490
+ create: (t) => new Uint32Array(k.len(t)),
1491
1491
  clean: (t) => t.fill(0),
1492
1492
  debug: (t) => Array.from(t).map((e) => (e >>> 0).toString(2).padStart(32, "0")),
1493
1493
  checkLen: (t, e) => {
1494
- if (E.len(e) !== t.length)
1495
- throw new Error(`wrong length=${t.length}. Expected: ${E.len(e)}`);
1494
+ if (k.len(e) !== t.length)
1495
+ throw new Error(`wrong length=${t.length}. Expected: ${k.len(e)}`);
1496
1496
  },
1497
1497
  chunkLen: (t, e, r) => {
1498
1498
  if (e < 0)
@@ -1506,8 +1506,8 @@ const St = (t) => {
1506
1506
  mask: 1 << 32 - (t + e) % 32 - 1
1507
1507
  }),
1508
1508
  indices: (t, e, r = !1) => {
1509
- E.checkLen(t, e);
1510
- const { FULL_MASK: n, BITS: s } = E, o = s - e % s, a = o ? n >>> o << o : n, i = [];
1509
+ k.checkLen(t, e);
1510
+ const { FULL_MASK: n, BITS: s } = k, o = s - e % s, a = o ? n >>> o << o : n, i = [];
1511
1511
  for (let l = 0; l < t.length; l++) {
1512
1512
  let c = t[l];
1513
1513
  if (r && (c = ~c), l === t.length - 1 && (c &= a), c !== 0)
@@ -1525,19 +1525,19 @@ const St = (t) => {
1525
1525
  r === void 0 || n !== r.pos + r.length ? e.push(r = { pos: n, length: 1 }) : r.length += 1;
1526
1526
  return e;
1527
1527
  },
1528
- rangeDebug: (t, e, r = !1) => `[${E.range(E.indices(t, e, r)).map((n) => `(${n.pos}/${n.length})`).join(", ")}]`,
1528
+ rangeDebug: (t, e, r = !1) => `[${k.range(k.indices(t, e, r)).map((n) => `(${n.pos}/${n.length})`).join(", ")}]`,
1529
1529
  setRange: (t, e, r, n, s = !0) => {
1530
- E.chunkLen(e, r, n);
1531
- const { FULL_MASK: o, BITS: a } = E, i = r % a ? Math.floor(r / a) : void 0, l = r + n, c = l % a ? Math.floor(l / a) : void 0;
1530
+ k.chunkLen(e, r, n);
1531
+ const { FULL_MASK: o, BITS: a } = k, i = r % a ? Math.floor(r / a) : void 0, l = r + n, c = l % a ? Math.floor(l / a) : void 0;
1532
1532
  if (i !== void 0 && i === c)
1533
- return E.set(t, i, o >>> a - n << a - n - r, s);
1534
- if (i !== void 0 && !E.set(t, i, o >>> r % a, s))
1533
+ return k.set(t, i, o >>> a - n << a - n - r, s);
1534
+ if (i !== void 0 && !k.set(t, i, o >>> r % a, s))
1535
1535
  return !1;
1536
1536
  const d = i !== void 0 ? i + 1 : r / a, h = c !== void 0 ? c : l / a;
1537
1537
  for (let f = d; f < h; f++)
1538
- if (!E.set(t, f, o, s))
1538
+ if (!k.set(t, f, o, s))
1539
1539
  return !1;
1540
- return !(c !== void 0 && i !== c && !E.set(t, c, o << a - l % a, s));
1540
+ return !(c !== void 0 && i !== c && !k.set(t, c, o << a - l % a, s));
1541
1541
  }
1542
1542
  }, O = {
1543
1543
  /**
@@ -1586,10 +1586,10 @@ class Ue {
1586
1586
  _enablePointers() {
1587
1587
  if (this.parent)
1588
1588
  return this.parent._enablePointers();
1589
- this.bs || (this.bs = E.create(this.data.length), E.setRange(this.bs, this.data.length, 0, this.pos, this.opts.allowMultipleReads));
1589
+ this.bs || (this.bs = k.create(this.data.length), k.setRange(this.bs, this.data.length, 0, this.pos, this.opts.allowMultipleReads));
1590
1590
  }
1591
1591
  markBytesBS(e, r) {
1592
- return this.parent ? this.parent.markBytesBS(this.parentOffset + e, r) : !r || !this.bs ? !0 : E.setRange(this.bs, this.data.length, e, r, !1);
1592
+ return this.parent ? this.parent.markBytesBS(this.parentOffset + e, r) : !r || !this.bs ? !0 : k.setRange(this.bs, this.data.length, e, r, !1);
1593
1593
  }
1594
1594
  markBytes(e) {
1595
1595
  const r = this.pos;
@@ -1621,9 +1621,9 @@ class Ue {
1621
1621
  if (this.bitPos)
1622
1622
  throw this.err(`${this.bitPos} bits left after unpack: ${we.encode(this.data.slice(this.pos))}`);
1623
1623
  if (this.bs && !this.parent) {
1624
- const e = E.indices(this.bs, this.data.length, !0);
1624
+ const e = k.indices(this.bs, this.data.length, !0);
1625
1625
  if (e.length) {
1626
- const r = E.range(e).map(({ pos: n, length: s }) => `(${n}/${s})[${we.encode(this.data.subarray(n, n + s))}]`).join(", ");
1626
+ const r = k.range(e).map(({ pos: n, length: s }) => `(${n}/${s})[${we.encode(this.data.subarray(n, n + s))}]`).join(", ");
1627
1627
  throw this.err(`unread byte ranges: ${r} (total=${this.data.length})`);
1628
1628
  } else
1629
1629
  return;
@@ -1813,7 +1813,7 @@ function Nt(t, e) {
1813
1813
  }
1814
1814
  });
1815
1815
  }
1816
- const I = (t) => {
1816
+ const A = (t) => {
1817
1817
  const e = Lt(t);
1818
1818
  return t.validate ? Nt(e, t.validate) : e;
1819
1819
  }, he = (t) => D(t) && typeof t.decode == "function" && typeof t.encode == "function";
@@ -1948,7 +1948,7 @@ const kn = (t) => {
1948
1948
  if (typeof n != "boolean")
1949
1949
  throw new Error(`bigint/sized: expected boolean, got ${typeof n}`);
1950
1950
  const s = BigInt(t), o = 2n ** (8n * s - 1n);
1951
- return I({
1951
+ return A({
1952
1952
  size: n ? t : void 0,
1953
1953
  encodeStream: (a, i) => {
1954
1954
  r && i < 0 && (i = i | o);
@@ -1977,7 +1977,7 @@ const kn = (t) => {
1977
1977
  return wn(a, 8n * s, !!r), a;
1978
1978
  }
1979
1979
  });
1980
- }, k = /* @__PURE__ */ En(8, !0), _n = (t, e) => I({
1980
+ }, v = /* @__PURE__ */ En(8, !0), _n = (t, e) => A({
1981
1981
  size: t,
1982
1982
  encodeStream: (r, n) => r.writeView(t, (s) => e.write(s, n)),
1983
1983
  decodeStream: (r) => r.readView(t, e.read),
@@ -2009,7 +2009,7 @@ const kn = (t) => {
2009
2009
  }), $ = /* @__PURE__ */ Bt(1, !1, {
2010
2010
  read: (t, e) => t.getUint8(e),
2011
2011
  write: (t, e) => t.setUint8(0, e)
2012
- }), Ae = /* @__PURE__ */ I({
2012
+ }), Ae = /* @__PURE__ */ A({
2013
2013
  size: 1,
2014
2014
  encodeStream: (t, e) => t.byte(e ? 1 : 0),
2015
2015
  decodeStream: (t) => {
@@ -2027,7 +2027,7 @@ const kn = (t) => {
2027
2027
  if (typeof e != "boolean")
2028
2028
  throw new Error(`bytes/le: expected boolean, got ${typeof e}`);
2029
2029
  const r = St(t), n = T(t);
2030
- return I({
2030
+ return A({
2031
2031
  size: typeof t == "number" ? t : void 0,
2032
2032
  encodeStream: (s, o) => {
2033
2033
  n || r.encodeStream(s, o.length), s.bytes(e ? _e(o) : o), n && s.bytes(t);
@@ -2059,7 +2059,7 @@ function In(t, e) {
2059
2059
  throw new Error(`apply: invalid inner value ${t}`);
2060
2060
  if (!he(e))
2061
2061
  throw new Error(`apply: invalid base value ${t}`);
2062
- return I({
2062
+ return A({
2063
2063
  size: t.size,
2064
2064
  encodeStream: (r, n) => {
2065
2065
  let s;
@@ -2083,7 +2083,7 @@ function In(t, e) {
2083
2083
  function K(t, e, r) {
2084
2084
  if (!S(t) || !S(e))
2085
2085
  throw new Error(`optional: invalid flag or inner value flag=${t} inner=${e}`);
2086
- return I({
2086
+ return A({
2087
2087
  size: r !== void 0 && t.size && e.size ? t.size + e.size : void 0,
2088
2088
  encodeStream: (n, s) => {
2089
2089
  t.encodeStream(n, !!s), s ? e.encodeStream(n, s) : r !== void 0 && e.encodeStream(n, r);
@@ -2096,7 +2096,7 @@ function K(t, e, r) {
2096
2096
  });
2097
2097
  }
2098
2098
  function $n(t) {
2099
- return I({
2099
+ return A({
2100
2100
  encodeStream: (e, r) => {
2101
2101
  if (r !== t)
2102
2102
  throw new Error(`constant: invalid value ${r} (exp: ${t})`);
@@ -2121,7 +2121,7 @@ function g(t) {
2121
2121
  for (const e in t)
2122
2122
  if (!S(t[e]))
2123
2123
  throw new Error(`struct: field ${e} is not CoderType`);
2124
- return I({
2124
+ return A({
2125
2125
  size: Sn(Object.values(t)),
2126
2126
  encodeStream: (e, r) => {
2127
2127
  e.pushObj(r, (n) => {
@@ -2147,7 +2147,7 @@ function ne(t, e) {
2147
2147
  if (!S(e))
2148
2148
  throw new Error(`array: invalid inner value ${e}`);
2149
2149
  const r = St(typeof t == "string" ? `../${t}` : t);
2150
- return I({
2150
+ return A({
2151
2151
  size: typeof t == "number" && e.size ? t * e.size : void 0,
2152
2152
  encodeStream: (n, s) => {
2153
2153
  const o = n;
@@ -2203,7 +2203,7 @@ function Me(t, e) {
2203
2203
  const r = /* @__PURE__ */ new Map();
2204
2204
  for (const n in e)
2205
2205
  r.set(e[n], n);
2206
- return I({
2206
+ return A({
2207
2207
  size: t.size,
2208
2208
  encodeStream: (n, s) => t.encodeStream(n, e[s]),
2209
2209
  decodeStream: (n) => {
@@ -2229,7 +2229,7 @@ function Ln(t, e) {
2229
2229
  for (const r in e)
2230
2230
  if (!S(e[r]))
2231
2231
  throw new Error(`tag: variant ${r} is not CoderType`);
2232
- return I({
2232
+ return A({
2233
2233
  size: t.size,
2234
2234
  encodeStream: (r, n) => {
2235
2235
  const { TAG: s, data: o } = n, a = e[s];
@@ -2261,7 +2261,7 @@ function Pt(t, e, r) {
2261
2261
  if (r !== void 0 && typeof r != "function")
2262
2262
  throw new Error(`padRight: wrong padFn=${typeof r}`);
2263
2263
  const n = r || Nn;
2264
- return I({
2264
+ return A({
2265
2265
  size: e.size ? e.size + ye(t, e.size) : void 0,
2266
2266
  encodeStream: (s, o) => {
2267
2267
  const a = s, i = a.pos;
@@ -2276,7 +2276,7 @@ function Pt(t, e, r) {
2276
2276
  }
2277
2277
  });
2278
2278
  }
2279
- const Bn = 9, be = V.decimal(Bn), q = I({
2279
+ const Bn = 9, be = V.decimal(Bn), q = A({
2280
2280
  encodeStream: (t, e) => {
2281
2281
  if (!e)
2282
2282
  return t.byte(0);
@@ -2294,7 +2294,7 @@ const Bn = 9, be = V.decimal(Bn), q = I({
2294
2294
  }
2295
2295
  }), re = An(Pt(8, ce, void 0)), Pn = () => {
2296
2296
  const t = fe(32);
2297
- return I({
2297
+ return A({
2298
2298
  size: t.size,
2299
2299
  encodeStream: (e, r) => t.encodeStream(e, ke.decode(r)),
2300
2300
  decodeStream: (e) => ke.encode(t.decodeStream(e))
@@ -2317,7 +2317,7 @@ const Un = (t, e, r, n, s) => ({
2317
2317
  }), nt = g({
2318
2318
  signatures: ne(q, fe(64)),
2319
2319
  msg: Tn
2320
- }), Ie = I({
2320
+ }), Ie = A({
2321
2321
  encodeStream: (t, e) => {
2322
2322
  const { msg: r, signatures: n } = e, s = {}, o = (h, f, u) => {
2323
2323
  let p = s[h] || (s[h] = { sign: !1, write: !1 });
@@ -2422,7 +2422,7 @@ function ze(t, e, r) {
2422
2422
  }
2423
2423
  const Ce = "SysvarRecentB1ockHashes11111111111111111111", z = "SysvarRent111111111111111111111111111111111", Tt = "11111111111111111111111111111111", Rt = ze(Tt, ce, {
2424
2424
  createAccount: {
2425
- coder: g({ lamports: k, space: k, owner: C }),
2425
+ coder: g({ lamports: v, space: v, owner: C }),
2426
2426
  keys: {
2427
2427
  source: { sign: !0, write: !0 },
2428
2428
  newAccount: { sign: !0, write: !0 }
@@ -2435,7 +2435,7 @@ const Ce = "SysvarRecentB1ockHashes11111111111111111111", z = "SysvarRent1111111
2435
2435
  hint: (t) => `Assign account=${t.account} to owner program=${t.owner}`
2436
2436
  },
2437
2437
  transfer: {
2438
- coder: g({ lamports: k }),
2438
+ coder: g({ lamports: v }),
2439
2439
  keys: { source: { sign: !0, write: !0 }, destination: { sign: !1, write: !0 } },
2440
2440
  hint: (t) => `Transfer ${be.encode(t.lamports)} SOL from ${t.source} to ${t.destination}`
2441
2441
  },
@@ -2443,8 +2443,8 @@ const Ce = "SysvarRecentB1ockHashes11111111111111111111", z = "SysvarRent1111111
2443
2443
  coder: g({
2444
2444
  base: C,
2445
2445
  seed: re,
2446
- lamports: k,
2447
- space: k,
2446
+ lamports: v,
2447
+ space: v,
2448
2448
  owner: C
2449
2449
  }),
2450
2450
  keys: {
@@ -2463,7 +2463,7 @@ const Ce = "SysvarRecentB1ockHashes11111111111111111111", z = "SysvarRent1111111
2463
2463
  hint: (t) => `Consume nonce in nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority})`
2464
2464
  },
2465
2465
  withdrawFromNonce: {
2466
- coder: g({ lamports: k }),
2466
+ coder: g({ lamports: v }),
2467
2467
  keys: {
2468
2468
  nonceAccount: { sign: !1, write: !0 },
2469
2469
  destination: { sign: !1, write: !0 },
@@ -2490,7 +2490,7 @@ const Ce = "SysvarRecentB1ockHashes11111111111111111111", z = "SysvarRent1111111
2490
2490
  hint: (t) => `Change owner of nonce account=${t.nonceAccount} from ${t.nonceAuthority} to ${t.newAuthorized}`
2491
2491
  },
2492
2492
  allocate: {
2493
- coder: g({ space: k }),
2493
+ coder: g({ space: v }),
2494
2494
  keys: {
2495
2495
  account: { sign: !0, write: !0 }
2496
2496
  }
@@ -2499,7 +2499,7 @@ const Ce = "SysvarRecentB1ockHashes11111111111111111111", z = "SysvarRent1111111
2499
2499
  coder: g({
2500
2500
  base: C,
2501
2501
  seed: re,
2502
- space: k,
2502
+ space: v,
2503
2503
  owner: C
2504
2504
  }),
2505
2505
  keys: {
@@ -2520,7 +2520,7 @@ const Ce = "SysvarRecentB1ockHashes11111111111111111111", z = "SysvarRent1111111
2520
2520
  },
2521
2521
  transferWithSeed: {
2522
2522
  coder: g({
2523
- lamports: k,
2523
+ lamports: v,
2524
2524
  sourceSeed: re,
2525
2525
  sourceOwner: C
2526
2526
  }),
@@ -2572,7 +2572,7 @@ ze(Mt, $, {
2572
2572
  hint: (t, e) => `Initialize multi-sig token account=${t.account} with signatures=${t.m}`
2573
2573
  },
2574
2574
  transfer: {
2575
- coder: g({ amount: k }),
2575
+ coder: g({ amount: v }),
2576
2576
  keys: {
2577
2577
  source: { sign: !1, write: !0 },
2578
2578
  destination: { sign: !1, write: !0 },
@@ -2581,7 +2581,7 @@ ze(Mt, $, {
2581
2581
  hint: (t, e) => `Transfer ${t.amount} from token account=${t.source} of owner=${t.owner} to ${t.destination}`
2582
2582
  },
2583
2583
  approve: {
2584
- coder: g({ amount: k }),
2584
+ coder: g({ amount: v }),
2585
2585
  keys: {
2586
2586
  account: { sign: !1, write: !0 },
2587
2587
  delegate: { sign: !1, write: !1 },
@@ -2609,7 +2609,7 @@ ze(Mt, $, {
2609
2609
  hint: (t, e) => `Sets a new authority=${t.newAuthority} of a mint or account=${t.account}. Current authority=${t.currentAuthority}. Authority Type: ${t.authorityType}`
2610
2610
  },
2611
2611
  mintTo: {
2612
- coder: g({ amount: k }),
2612
+ coder: g({ amount: v }),
2613
2613
  keys: {
2614
2614
  mint: { sign: !1, write: !0 },
2615
2615
  dest: { sign: !1, write: !0 },
@@ -2617,7 +2617,7 @@ ze(Mt, $, {
2617
2617
  }
2618
2618
  },
2619
2619
  burn: {
2620
- coder: g({ amount: k }),
2620
+ coder: g({ amount: v }),
2621
2621
  keys: {
2622
2622
  account: { sign: !1, write: !0 },
2623
2623
  mint: { sign: !1, write: !0 },
@@ -2653,7 +2653,7 @@ ze(Mt, $, {
2653
2653
  hint: (t, e) => `Thaw a frozne token account=${t.account} of mint=${t.mint} using freeze_authority=${t.authority}`
2654
2654
  },
2655
2655
  transferChecked: {
2656
- coder: g({ amount: k, decimals: $ }),
2656
+ coder: g({ amount: v, decimals: $ }),
2657
2657
  keys: {
2658
2658
  source: { sign: !1, write: !0 },
2659
2659
  mint: { sign: !1, write: !1 },
@@ -2663,7 +2663,7 @@ ze(Mt, $, {
2663
2663
  hint: (t, e) => `Transfer ${V.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)} from token account=${t.source} of owner=${t.owner} to ${t.destination}`
2664
2664
  },
2665
2665
  approveChecked: {
2666
- coder: g({ amount: k, decimals: $ }),
2666
+ coder: g({ amount: v, decimals: $ }),
2667
2667
  keys: {
2668
2668
  source: { sign: !1, write: !0 },
2669
2669
  mint: { sign: !1, write: !1 },
@@ -2673,7 +2673,7 @@ ze(Mt, $, {
2673
2673
  hint: (t, e) => `Approve delgate=${t.delegate} authority on behalf account=${t.source} owner=${t.owner} over ${V.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)}`
2674
2674
  },
2675
2675
  mintToChecked: {
2676
- coder: g({ amount: k, decimals: $ }),
2676
+ coder: g({ amount: v, decimals: $ }),
2677
2677
  keys: {
2678
2678
  mint: { sign: !1, write: !0 },
2679
2679
  dest: { sign: !1, write: !0 },
@@ -2682,7 +2682,7 @@ ze(Mt, $, {
2682
2682
  hint: (t, e) => `Mint new tokens (${V.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)}) to account=${t.dest} using authority=${t.authority}`
2683
2683
  },
2684
2684
  burnChecked: {
2685
- coder: g({ amount: k, decimals: $ }),
2685
+ coder: g({ amount: v, decimals: $ }),
2686
2686
  keys: {
2687
2687
  mint: { sign: !1, write: !0 },
2688
2688
  account: { sign: !1, write: !0 },
@@ -2710,7 +2710,7 @@ g({
2710
2710
  state: ce,
2711
2711
  authority: C,
2712
2712
  nonce: C,
2713
- lamportPerSignature: k
2713
+ lamportPerSignature: v
2714
2714
  });
2715
2715
  const zn = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
2716
2716
  ze(zn, $n(0), {
@@ -2732,15 +2732,15 @@ const xe = Pt(4, Ae, () => 0);
2732
2732
  g({
2733
2733
  mint: C,
2734
2734
  owner: C,
2735
- amount: k,
2735
+ amount: v,
2736
2736
  delegate: K(xe, C, "11111111111111111111111111111111"),
2737
2737
  state: Me($, {
2738
2738
  uninitialized: 0,
2739
2739
  initialized: 1,
2740
2740
  frozen: 2
2741
2741
  }),
2742
- isNative: K(xe, k, 0n),
2743
- delegateAmount: k,
2742
+ isNative: K(xe, v, 0n),
2743
+ delegateAmount: v,
2744
2744
  closeAuthority: K(xe, C, "11111111111111111111111111111111")
2745
2745
  });
2746
2746
  function ot(t, e, r) {
@@ -2775,20 +2775,20 @@ function On(t) {
2775
2775
  f++, d++;
2776
2776
  const p = (u - f) * o + 1 >>> 0, b = new Uint8Array(p);
2777
2777
  for (; f !== u; ) {
2778
- let x = c[f], m = 0;
2779
- for (let _ = p - 1; (x !== 0 || m < h) && _ !== -1; _--, m++)
2780
- x += 256 * b[_] >>> 0, b[_] = x % r >>> 0, x = x / r >>> 0;
2781
- if (x !== 0)
2778
+ let m = c[f], w = 0;
2779
+ for (let E = p - 1; (m !== 0 || w < h) && E !== -1; E--, w++)
2780
+ m += 256 * b[E] >>> 0, b[E] = m % r >>> 0, m = m / r >>> 0;
2781
+ if (m !== 0)
2782
2782
  throw new Error("Non-zero carry");
2783
- h = m, f++;
2783
+ h = w, f++;
2784
2784
  }
2785
2785
  let y = p - h;
2786
2786
  for (; y !== p && b[y] === 0; )
2787
2787
  y++;
2788
- let w = n.repeat(d);
2788
+ let I = n.repeat(d);
2789
2789
  for (; y < p; ++y)
2790
- w += t.charAt(b[y]);
2791
- return w;
2790
+ I += t.charAt(b[y]);
2791
+ return I;
2792
2792
  }
2793
2793
  function i(c) {
2794
2794
  if (typeof c != "string")
@@ -2800,26 +2800,26 @@ function On(t) {
2800
2800
  h++, d++;
2801
2801
  const u = (c.length - d) * s + 1 >>> 0, p = new Uint8Array(u);
2802
2802
  for (; d < c.length; ) {
2803
- const x = c.charCodeAt(d);
2804
- if (x > 255)
2803
+ const m = c.charCodeAt(d);
2804
+ if (m > 255)
2805
2805
  return;
2806
- let m = e[x];
2807
- if (m === 255)
2806
+ let w = e[m];
2807
+ if (w === 255)
2808
2808
  return;
2809
- let _ = 0;
2810
- for (let L = u - 1; (m !== 0 || _ < f) && L !== -1; L--, _++)
2811
- m += r * p[L] >>> 0, p[L] = m % 256 >>> 0, m = m / 256 >>> 0;
2812
- if (m !== 0)
2809
+ let E = 0;
2810
+ for (let L = u - 1; (w !== 0 || E < f) && L !== -1; L--, E++)
2811
+ w += r * p[L] >>> 0, p[L] = w % 256 >>> 0, w = w / 256 >>> 0;
2812
+ if (w !== 0)
2813
2813
  throw new Error("Non-zero carry");
2814
- f = _, d++;
2814
+ f = E, d++;
2815
2815
  }
2816
2816
  let b = u - f;
2817
2817
  for (; b !== u && p[b] === 0; )
2818
2818
  b++;
2819
2819
  const y = new Uint8Array(h + (u - b));
2820
- let w = h;
2820
+ let I = h;
2821
2821
  for (; b !== u; )
2822
- y[w++] = p[b++];
2822
+ y[I++] = p[b++];
2823
2823
  return y;
2824
2824
  }
2825
2825
  function l(c) {
@@ -3318,27 +3318,28 @@ class Yn extends wr {
3318
3318
  username: u,
3319
3319
  onSessionCreated: p,
3320
3320
  encryptedBlob: b,
3321
- ...y
3321
+ propagateSessionErrors: y,
3322
+ ...I
3322
3323
  }) {
3323
- const w = new URL(e ?? lt), x = new Wn();
3324
- n && w.searchParams.set("v", encodeURIComponent(n)), s && w.searchParams.set("ps", encodeURIComponent(s)), o && w.searchParams.set("ns", encodeURIComponent(o)), a?.erc20 && w.searchParams.set(
3324
+ const m = new URL(e ?? lt), w = new Wn();
3325
+ y && m.searchParams.set("propagate_error", "true"), n && m.searchParams.set("v", encodeURIComponent(n)), s && m.searchParams.set("ps", encodeURIComponent(s)), o && m.searchParams.set("ns", encodeURIComponent(o)), a?.erc20 && m.searchParams.set(
3325
3326
  "erc20",
3326
3327
  encodeURIComponent(a.erc20.toString())
3327
- ), c && w.searchParams.set("rpc_url", encodeURIComponent(c)), d && w.searchParams.set("ref", encodeURIComponent(d)), h && w.searchParams.set("ref_group", encodeURIComponent(h)), f && w.searchParams.set("needs_session_creation", "true"), u && w.searchParams.set("username", encodeURIComponent(u)), (!i || l) && r ? w.searchParams.set(
3328
+ ), c && m.searchParams.set("rpc_url", encodeURIComponent(c)), d && m.searchParams.set("ref", encodeURIComponent(d)), h && m.searchParams.set("ref_group", encodeURIComponent(h)), f && m.searchParams.set("needs_session_creation", "true"), u && m.searchParams.set("username", encodeURIComponent(u)), (!i || l) && r ? m.searchParams.set(
3328
3329
  "policies",
3329
3330
  encodeURIComponent(JSON.stringify(r))
3330
- ) : i && w.searchParams.set("preset", i), b && (w.hash = `kc=${encodeURIComponent(b)}`), super({
3331
- ...y,
3331
+ ) : i && m.searchParams.set("preset", i), b && (m.hash = `kc=${encodeURIComponent(b)}`), super({
3332
+ ...I,
3332
3333
  id: "controller-keychain",
3333
- url: w,
3334
+ url: m,
3334
3335
  methods: {
3335
- ...x.getIFrameMethods(),
3336
+ ...w.getIFrameMethods(),
3336
3337
  // Expose callback for keychain to notify parent that session was created and storage access granted
3337
- onSessionCreated: (m) => () => {
3338
+ onSessionCreated: (E) => () => {
3338
3339
  p && p();
3339
3340
  }
3340
3341
  }
3341
- }), this.walletBridge = x, typeof window < "u" && (window.external_wallets = this.walletBridge);
3342
+ }), this.walletBridge = w, typeof window < "u" && (window.external_wallets = this.walletBridge);
3342
3343
  }
3343
3344
  getWalletBridge() {
3344
3345
  return this.walletBridge;
@@ -3426,7 +3427,7 @@ class vs extends Wt {
3426
3427
  }
3427
3428
  async logout() {
3428
3429
  if (!this.keychain) {
3429
- console.error(new A().message);
3430
+ console.error(new _().message);
3430
3431
  return;
3431
3432
  }
3432
3433
  try {
@@ -3444,7 +3445,7 @@ class vs extends Wt {
3444
3445
  if (this.iframes) {
3445
3446
  try {
3446
3447
  if (this.iframes.keychain || (this.iframes.keychain = this.createKeychainIframe()), await this.waitForKeychain(), !this.keychain) {
3447
- console.error(new A().message);
3448
+ console.error(new _().message);
3448
3449
  return;
3449
3450
  }
3450
3451
  const e = await this.keychain.probe(this.rpcUrl());
@@ -3464,29 +3465,30 @@ class vs extends Wt {
3464
3465
  return this.account;
3465
3466
  }
3466
3467
  }
3467
- async connect() {
3468
+ async connect(e) {
3468
3469
  if (this.iframes) {
3469
3470
  if (this.account)
3470
3471
  return this.account;
3471
3472
  if (this.iframes.keychain || (this.iframes.keychain = this.createKeychainIframe(), await this.waitForKeychain()), !this.keychain || !this.iframes.keychain) {
3472
- console.error(new A().message);
3473
+ console.error(new _().message);
3473
3474
  return;
3474
3475
  }
3475
3476
  this.iframes.keychain.open();
3476
3477
  try {
3477
- let e = await this.keychain.connect(this.options.signupOptions);
3478
- if (e.code !== Q.SUCCESS)
3479
- throw new Error(e.message);
3480
- return e = e, this.account = new He(
3478
+ const r = e ?? this.options.signupOptions;
3479
+ let n = await this.keychain.connect(r);
3480
+ if (n.code !== Q.SUCCESS)
3481
+ throw new Error(n.message);
3482
+ return n = n, this.account = new He(
3481
3483
  this,
3482
3484
  this.rpcUrl(),
3483
- e.address,
3485
+ n.address,
3484
3486
  this.keychain,
3485
3487
  this.options,
3486
3488
  this.iframes.keychain
3487
3489
  ), this.account;
3488
- } catch (e) {
3489
- console.log(e);
3490
+ } catch (r) {
3491
+ console.log(r);
3490
3492
  } finally {
3491
3493
  this.iframes.keychain.close();
3492
3494
  }
@@ -3496,7 +3498,7 @@ class vs extends Wt {
3496
3498
  if (!this.iframes)
3497
3499
  return !1;
3498
3500
  if (!this.keychain || !this.iframes.keychain)
3499
- return console.error(new A().message), !1;
3501
+ return console.error(new _().message), !1;
3500
3502
  const r = this.selectedChain;
3501
3503
  try {
3502
3504
  this.selectedChain = e, await this.keychain.switchChain(this.rpcUrl());
@@ -3510,7 +3512,7 @@ class vs extends Wt {
3510
3512
  }
3511
3513
  async disconnect() {
3512
3514
  if (!this.keychain) {
3513
- console.error(new A().message);
3515
+ console.error(new _().message);
3514
3516
  return;
3515
3517
  }
3516
3518
  return this.account = void 0, this.keychain.disconnect();
@@ -3519,7 +3521,7 @@ class vs extends Wt {
3519
3521
  if (!this.iframes)
3520
3522
  return;
3521
3523
  if (!this.keychain || !this.iframes.keychain) {
3522
- console.error(new A().message);
3524
+ console.error(new _().message);
3523
3525
  return;
3524
3526
  }
3525
3527
  if (!this.account) {
@@ -3535,7 +3537,7 @@ class vs extends Wt {
3535
3537
  if (!this.iframes)
3536
3538
  return;
3537
3539
  if (!this.keychain || !this.iframes.keychain) {
3538
- console.error(new A().message);
3540
+ console.error(new _().message);
3539
3541
  return;
3540
3542
  }
3541
3543
  if (!this.account) {
@@ -3550,7 +3552,7 @@ class vs extends Wt {
3550
3552
  async openProfileAt(e) {
3551
3553
  if (this.iframes) {
3552
3554
  if (!this.keychain || !this.iframes.keychain) {
3553
- console.error(new A().message);
3555
+ console.error(new _().message);
3554
3556
  return;
3555
3557
  }
3556
3558
  if (!this.account) {
@@ -3563,14 +3565,14 @@ class vs extends Wt {
3563
3565
  openSettings() {
3564
3566
  if (this.iframes) {
3565
3567
  if (!this.keychain || !this.iframes.keychain) {
3566
- console.error(new A().message);
3568
+ console.error(new _().message);
3567
3569
  return;
3568
3570
  }
3569
3571
  this.iframes.keychain.open(), this.keychain.openSettings();
3570
3572
  }
3571
3573
  }
3572
3574
  revoke(e, r) {
3573
- return this.keychain ? this.keychain.revoke(e) : (console.error(new A().message), null);
3575
+ return this.keychain ? this.keychain.revoke(e) : (console.error(new _().message), null);
3574
3576
  }
3575
3577
  rpcUrl() {
3576
3578
  const e = this.chains.get(this.selectedChain);
@@ -3586,7 +3588,7 @@ class vs extends Wt {
3586
3588
  }
3587
3589
  username() {
3588
3590
  if (!this.keychain) {
3589
- console.error(new A().message);
3591
+ console.error(new _().message);
3590
3592
  return;
3591
3593
  }
3592
3594
  return this.keychain.username();
@@ -3594,7 +3596,7 @@ class vs extends Wt {
3594
3596
  openPurchaseCredits() {
3595
3597
  if (this.iframes) {
3596
3598
  if (!this.keychain || !this.iframes.keychain) {
3597
- console.error(new A().message);
3599
+ console.error(new _().message);
3598
3600
  return;
3599
3601
  }
3600
3602
  this.keychain.navigate("/purchase/credits").then(() => {
@@ -3605,7 +3607,7 @@ class vs extends Wt {
3605
3607
  async openStarterPack(e, r) {
3606
3608
  if (this.iframes) {
3607
3609
  if (!this.keychain || !this.iframes.keychain) {
3608
- console.error(new A().message);
3610
+ console.error(new _().message);
3609
3611
  return;
3610
3612
  }
3611
3613
  await this.keychain.openStarterPack(e, r), this.iframes.keychain?.open();
@@ -3615,7 +3617,7 @@ class vs extends Wt {
3615
3617
  if (!this.iframes)
3616
3618
  return;
3617
3619
  if (!this.keychain || !this.iframes.keychain) {
3618
- console.error(new A().message);
3620
+ console.error(new _().message);
3619
3621
  return;
3620
3622
  }
3621
3623
  let n = this.selectedChain;
@@ -3627,7 +3629,7 @@ class vs extends Wt {
3627
3629
  };
3628
3630
  }
3629
3631
  async delegateAccount() {
3630
- return this.keychain ? await this.keychain.delegateAccount() : (console.error(new A().message), null);
3632
+ return this.keychain ? await this.keychain.delegateAccount() : (console.error(new _().message), null);
3631
3633
  }
3632
3634
  /**
3633
3635
  * Opens the keychain in standalone mode (first-party context) for authentication.
@@ -3741,7 +3743,7 @@ async function Es(t) {
3741
3743
  t.map((r) => [r, H.get(r)]).filter((r) => r[1] !== void 0)
3742
3744
  );
3743
3745
  }
3744
- const v = "cartridge-toast-container", qn = 3e3, Zn = "bottom-right", Ot = "cartridge-toast-show";
3746
+ const x = "cartridge-toast-container", qn = 3e3, Zn = "bottom-right", Ot = "cartridge-toast-show";
3745
3747
  function De() {
3746
3748
  try {
3747
3749
  return typeof window < "u" && window.self !== window.top;
@@ -3762,8 +3764,8 @@ function Kn() {
3762
3764
  return document;
3763
3765
  }
3764
3766
  function Gn(t, e) {
3765
- let r = t.getElementById(v);
3766
- return r || (r = t.createElement("div"), r.id = v, t.body && t.body.appendChild(r)), r.className = e, r;
3767
+ let r = t.getElementById(x);
3768
+ return r || (r = t.createElement("div"), r.id = x, t.body && t.body.appendChild(r)), r.className = e, r;
3767
3769
  }
3768
3770
  function Xn(t) {
3769
3771
  t.classList.add("closing"), setTimeout(() => {
@@ -3778,7 +3780,7 @@ function Jn(t) {
3778
3780
  }
3779
3781
  function es() {
3780
3782
  return `
3781
- #${v} {
3783
+ #${x} {
3782
3784
  position: fixed;
3783
3785
  z-index: 999999;
3784
3786
  pointer-events: none;
@@ -3788,38 +3790,38 @@ function es() {
3788
3790
  gap: 12px;
3789
3791
  }
3790
3792
 
3791
- #${v}.top-left {
3793
+ #${x}.top-left {
3792
3794
  top: 20px;
3793
3795
  left: 20px;
3794
3796
  align-items: flex-start;
3795
3797
  }
3796
3798
 
3797
- #${v}.top-right {
3799
+ #${x}.top-right {
3798
3800
  top: 20px;
3799
3801
  right: 20px;
3800
3802
  align-items: flex-end;
3801
3803
  }
3802
3804
 
3803
- #${v}.top-center {
3805
+ #${x}.top-center {
3804
3806
  top: 20px;
3805
3807
  left: 50%;
3806
3808
  transform: translateX(-50%);
3807
3809
  align-items: center;
3808
3810
  }
3809
3811
 
3810
- #${v}.bottom-left {
3812
+ #${x}.bottom-left {
3811
3813
  bottom: 20px;
3812
3814
  left: 20px;
3813
3815
  align-items: flex-start;
3814
3816
  }
3815
3817
 
3816
- #${v}.bottom-right {
3818
+ #${x}.bottom-right {
3817
3819
  bottom: 20px;
3818
3820
  right: 20px;
3819
3821
  align-items: flex-end;
3820
3822
  }
3821
3823
 
3822
- #${v}.bottom-center {
3824
+ #${x}.bottom-center {
3823
3825
  bottom: 20px;
3824
3826
  left: 50%;
3825
3827
  transform: translateX(-50%);
@@ -3835,18 +3837,18 @@ function es() {
3835
3837
  pointer-events: auto;
3836
3838
  }
3837
3839
 
3838
- #${v}.top-right .cartridge-toast,
3839
- #${v}.bottom-right .cartridge-toast {
3840
+ #${x}.top-right .cartridge-toast,
3841
+ #${x}.bottom-right .cartridge-toast {
3840
3842
  align-self: flex-end;
3841
3843
  }
3842
3844
 
3843
- #${v}.top-left .cartridge-toast,
3844
- #${v}.bottom-left .cartridge-toast {
3845
+ #${x}.top-left .cartridge-toast,
3846
+ #${x}.bottom-left .cartridge-toast {
3845
3847
  align-self: flex-start;
3846
3848
  }
3847
3849
 
3848
- #${v}.top-center .cartridge-toast,
3849
- #${v}.bottom-center .cartridge-toast {
3850
+ #${x}.top-center .cartridge-toast,
3851
+ #${x}.bottom-center .cartridge-toast {
3850
3852
  align-self: center;
3851
3853
  }
3852
3854
 
@@ -3882,9 +3884,9 @@ function es() {
3882
3884
  max-width: calc(100vw - 40px);
3883
3885
  }
3884
3886
 
3885
- #${v}.top-left,
3886
- #${v}.top-right,
3887
- #${v}.top-center {
3887
+ #${x}.top-left,
3888
+ #${x}.top-right,
3889
+ #${x}.top-center {
3888
3890
  top: 10px;
3889
3891
  left: 20px;
3890
3892
  right: 20px;
@@ -3892,9 +3894,9 @@ function es() {
3892
3894
  align-items: stretch;
3893
3895
  }
3894
3896
 
3895
- #${v}.bottom-left,
3896
- #${v}.bottom-right,
3897
- #${v}.bottom-center {
3897
+ #${x}.bottom-left,
3898
+ #${x}.bottom-right,
3899
+ #${x}.bottom-center {
3898
3900
  bottom: 10px;
3899
3901
  left: 20px;
3900
3902
  right: 20px;
@@ -5443,7 +5445,7 @@ export {
5443
5445
  zs as FeeSource,
5444
5446
  Os as IMPLEMENTED_AUTH_OPTIONS,
5445
5447
  sn as MetaMaskWallet,
5446
- A as NotReadyToConnect,
5448
+ _ as NotReadyToConnect,
5447
5449
  Qn as PhantomEVMWallet,
5448
5450
  Fn as PhantomWallet,
5449
5451
  Hn as RabbyWallet,