@cartridge/controller 0.13.6 → 0.13.7

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,9 +1,9 @@
1
- import { WalletAccount as kn, constants as Ue, num as Tt, shortString as ht } from "starknet";
2
- import { R as O, t as vn, i as En, K as Nt, B as An, N as L, H as he, p as Sn, v as $n, A as Ln, s as Bt } from "./index-BdTFKueB.js";
3
- import { b as Ei, j as Ai, E as Si, l as $i, k as Li, F as _i, a as Ii, c as Pi, I as Ti, m as Ni, o as Bi, q as Ui, r as Mi, g as Ri, h as Oi, u as zi, w as Fi, n as ji, f as Hi, d as Wi, e as Vi } from "./index-BdTFKueB.js";
4
- const _n = "standard:connect", In = "standard:disconnect", Pn = "standard:events", Tn = "0.1.1";
5
- function Nn() {
6
- return Tn;
1
+ import { WalletAccount as En, constants as we, num as Tt, shortString as ht } from "starknet";
2
+ import { R as O, t as An, i as Sn, K as Nt, A as Bt, I as $n, B as Ln, N as L, H as he, p as _n, v as In, s as Ut } from "./index-CYAUAqql.js";
3
+ import { c as Pi, j as Ti, E as Ni, l as Bi, k as Ui, F as Mi, b as Ri, a as Oi, m as zi, o as ji, q as Fi, r as Hi, g as Wi, h as qi, u as Vi, w as Di, n as Zi, f as Ki, d as Xi, e as Gi } from "./index-CYAUAqql.js";
4
+ const Pn = "standard:connect", Tn = "standard:disconnect", Nn = "standard:events", Bn = "0.1.1";
5
+ function Un() {
6
+ return Bn;
7
7
  }
8
8
  class ie extends Error {
9
9
  constructor(e, n = {}) {
@@ -59,26 +59,26 @@ class ie extends Error {
59
59
  enumerable: !0,
60
60
  configurable: !0,
61
61
  writable: !0,
62
- value: `ox@${Nn()}`
62
+ value: `ox@${Un()}`
63
63
  }), this.cause = n.cause, this.details = r, this.docs = o, this.docsPath = s, this.shortMessage = e;
64
64
  }
65
65
  walk(e) {
66
- return Ut(this, e);
66
+ return Mt(this, e);
67
67
  }
68
68
  }
69
- function Ut(t, e) {
70
- return e?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause ? Ut(t.cause, e) : e ? null : t;
69
+ function Mt(t, e) {
70
+ return e?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause ? Mt(t.cause, e) : e ? null : t;
71
71
  }
72
72
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
73
- function Bn(t) {
73
+ function Mn(t) {
74
74
  return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
75
75
  }
76
76
  function ut(t) {
77
77
  if (!Number.isSafeInteger(t) || t < 0)
78
78
  throw new Error("positive integer expected, got " + t);
79
79
  }
80
- function we(t, ...e) {
81
- if (!Bn(t))
80
+ function ge(t, ...e) {
81
+ if (!Mn(t))
82
82
  throw new Error("Uint8Array expected");
83
83
  if (e.length > 0 && !e.includes(t.length))
84
84
  throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
@@ -89,66 +89,66 @@ function ft(t, e = !0) {
89
89
  if (e && t.finished)
90
90
  throw new Error("Hash#digest() has already been called");
91
91
  }
92
- function Un(t, e) {
93
- we(t);
92
+ function Rn(t, e) {
93
+ ge(t);
94
94
  const n = e.outputLen;
95
95
  if (t.length < n)
96
96
  throw new Error("digestInto() expects output buffer of length at least " + n);
97
97
  }
98
- function Mn(t) {
98
+ function On(t) {
99
99
  return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
100
100
  }
101
- function Mt(...t) {
101
+ function Rt(...t) {
102
102
  for (let e = 0; e < t.length; e++)
103
103
  t[e].fill(0);
104
104
  }
105
- const Rn = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
106
- function On(t) {
105
+ const zn = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
106
+ function jn(t) {
107
107
  return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
108
108
  }
109
- function zn(t) {
109
+ function Fn(t) {
110
110
  for (let e = 0; e < t.length; e++)
111
- t[e] = On(t[e]);
111
+ t[e] = jn(t[e]);
112
112
  return t;
113
113
  }
114
- const pt = Rn ? (t) => t : zn;
115
- function Fn(t) {
114
+ const pt = zn ? (t) => t : Fn;
115
+ function Hn(t) {
116
116
  if (typeof t != "string")
117
117
  throw new Error("string expected");
118
118
  return new Uint8Array(new TextEncoder().encode(t));
119
119
  }
120
- function Rt(t) {
121
- return typeof t == "string" && (t = Fn(t)), we(t), t;
120
+ function Ot(t) {
121
+ return typeof t == "string" && (t = Hn(t)), ge(t), t;
122
122
  }
123
- class jn {
123
+ class Wn {
124
124
  }
125
- function Hn(t) {
126
- const e = (r) => t().update(Rt(r)).digest(), n = t();
125
+ function qn(t) {
126
+ const e = (r) => t().update(Ot(r)).digest(), n = t();
127
127
  return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
128
128
  }
129
129
  const ue = /* @__PURE__ */ BigInt(2 ** 32 - 1), wt = /* @__PURE__ */ BigInt(32);
130
- function Wn(t, e = !1) {
130
+ function Vn(t, e = !1) {
131
131
  return e ? { h: Number(t & ue), l: Number(t >> wt & ue) } : { h: Number(t >> wt & ue) | 0, l: Number(t & ue) | 0 };
132
132
  }
133
- function Vn(t, e = !1) {
133
+ function Dn(t, e = !1) {
134
134
  const n = t.length;
135
135
  let r = new Uint32Array(n), s = new Uint32Array(n);
136
136
  for (let i = 0; i < n; i++) {
137
- const { h: o, l: a } = Wn(t[i], e);
137
+ const { h: o, l: a } = Vn(t[i], e);
138
138
  [r[i], s[i]] = [o, a];
139
139
  }
140
140
  return [r, s];
141
141
  }
142
- const qn = (t, e, n) => t << n | e >>> 32 - n, Dn = (t, e, n) => e << n | t >>> 32 - n, Zn = (t, e, n) => e << n - 32 | t >>> 64 - n, Kn = (t, e, n) => t << n - 32 | e >>> 64 - n, Xn = BigInt(0), ee = BigInt(1), Gn = BigInt(2), Yn = BigInt(7), Jn = BigInt(256), Qn = BigInt(113), Ot = [], zt = [], Ft = [];
142
+ const Zn = (t, e, n) => t << n | e >>> 32 - n, Kn = (t, e, n) => e << n | t >>> 32 - n, Xn = (t, e, n) => e << n - 32 | t >>> 64 - n, Gn = (t, e, n) => t << n - 32 | e >>> 64 - n, Yn = BigInt(0), ee = BigInt(1), Jn = BigInt(2), Qn = BigInt(7), er = BigInt(256), tr = BigInt(113), zt = [], jt = [], Ft = [];
143
143
  for (let t = 0, e = ee, n = 1, r = 0; t < 24; t++) {
144
- [n, r] = [r, (2 * n + 3 * r) % 5], Ot.push(2 * (5 * r + n)), zt.push((t + 1) * (t + 2) / 2 % 64);
145
- let s = Xn;
144
+ [n, r] = [r, (2 * n + 3 * r) % 5], zt.push(2 * (5 * r + n)), jt.push((t + 1) * (t + 2) / 2 % 64);
145
+ let s = Yn;
146
146
  for (let i = 0; i < 7; i++)
147
- e = (e << ee ^ (e >> Yn) * Qn) % Jn, e & Gn && (s ^= ee << (ee << /* @__PURE__ */ BigInt(i)) - ee);
147
+ e = (e << ee ^ (e >> Qn) * tr) % er, e & Jn && (s ^= ee << (ee << /* @__PURE__ */ BigInt(i)) - ee);
148
148
  Ft.push(s);
149
149
  }
150
- const jt = Vn(Ft, !0), er = jt[0], tr = jt[1], gt = (t, e, n) => n > 32 ? Zn(t, e, n) : qn(t, e, n), mt = (t, e, n) => n > 32 ? Kn(t, e, n) : Dn(t, e, n);
151
- function nr(t, e = 24) {
150
+ const Ht = Dn(Ft, !0), nr = Ht[0], rr = Ht[1], gt = (t, e, n) => n > 32 ? Xn(t, e, n) : Zn(t, e, n), mt = (t, e, n) => n > 32 ? Gn(t, e, n) : Kn(t, e, n);
151
+ function sr(t, e = 24) {
152
152
  const n = new Uint32Array(10);
153
153
  for (let r = 24 - e; r < 24; r++) {
154
154
  for (let o = 0; o < 10; o++)
@@ -160,7 +160,7 @@ function nr(t, e = 24) {
160
160
  }
161
161
  let s = t[2], i = t[3];
162
162
  for (let o = 0; o < 24; o++) {
163
- const a = zt[o], l = gt(s, i, a), c = mt(s, i, a), d = Ot[o];
163
+ const a = jt[o], l = gt(s, i, a), c = mt(s, i, a), d = zt[o];
164
164
  s = t[d], i = t[d + 1], t[d] = l, t[d + 1] = c;
165
165
  }
166
166
  for (let o = 0; o < 50; o += 10) {
@@ -169,25 +169,25 @@ function nr(t, e = 24) {
169
169
  for (let a = 0; a < 10; a++)
170
170
  t[o + a] ^= ~n[(a + 2) % 10] & n[(a + 4) % 10];
171
171
  }
172
- t[0] ^= er[r], t[1] ^= tr[r];
172
+ t[0] ^= nr[r], t[1] ^= rr[r];
173
173
  }
174
- Mt(n);
174
+ Rt(n);
175
175
  }
176
- class Ge extends jn {
176
+ class Ge extends Wn {
177
177
  // NOTE: we accept arguments in bytes instead of bits here.
178
178
  constructor(e, n, r, s = !1, i = 24) {
179
179
  if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = i, ut(r), !(0 < e && e < 200))
180
180
  throw new Error("only keccak-f1600 function is supported");
181
- this.state = new Uint8Array(200), this.state32 = Mn(this.state);
181
+ this.state = new Uint8Array(200), this.state32 = On(this.state);
182
182
  }
183
183
  clone() {
184
184
  return this._cloneInto();
185
185
  }
186
186
  keccak() {
187
- pt(this.state32), nr(this.state32, this.rounds), pt(this.state32), this.posOut = 0, this.pos = 0;
187
+ pt(this.state32), sr(this.state32, this.rounds), pt(this.state32), this.posOut = 0, this.pos = 0;
188
188
  }
189
189
  update(e) {
190
- ft(this), e = Rt(e), we(e);
190
+ ft(this), e = Ot(e), ge(e);
191
191
  const { blockLen: n, state: r } = this, s = e.length;
192
192
  for (let i = 0; i < s; ) {
193
193
  const o = Math.min(n - this.pos, s - i);
@@ -205,7 +205,7 @@ class Ge extends jn {
205
205
  e[r] ^= n, (n & 128) !== 0 && r === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
206
206
  }
207
207
  writeInto(e) {
208
- ft(this, !1), we(e), this.finish();
208
+ ft(this, !1), ge(e), this.finish();
209
209
  const n = this.state, { blockLen: r } = this;
210
210
  for (let s = 0, i = e.length; s < i; ) {
211
211
  this.posOut >= r && this.keccak();
@@ -223,7 +223,7 @@ class Ge extends jn {
223
223
  return ut(e), this.xofInto(new Uint8Array(e));
224
224
  }
225
225
  digestInto(e) {
226
- if (Un(e, this), this.finished)
226
+ if (Rn(e, this), this.finished)
227
227
  throw new Error("digest() was already called");
228
228
  return this.writeInto(e), this.destroy(), e;
229
229
  }
@@ -231,18 +231,18 @@ class Ge extends jn {
231
231
  return this.digestInto(new Uint8Array(this.outputLen));
232
232
  }
233
233
  destroy() {
234
- this.destroyed = !0, Mt(this.state);
234
+ this.destroyed = !0, Rt(this.state);
235
235
  }
236
236
  _cloneInto(e) {
237
237
  const { blockLen: n, suffix: r, outputLen: s, rounds: i, enableXOF: o } = this;
238
238
  return e || (e = new Ge(n, r, s, o, i)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = i, e.suffix = r, e.outputLen = s, e.enableXOF = o, e.destroyed = this.destroyed, e;
239
239
  }
240
240
  }
241
- const rr = (t, e, n) => Hn(() => new Ge(e, t, n)), sr = rr(1, 136, 256 / 8), ir = "#__bigint";
242
- function or(t, e, n) {
243
- return JSON.stringify(t, (r, s) => typeof s == "bigint" ? s.toString() + ir : s, n);
241
+ const ir = (t, e, n) => qn(() => new Ge(e, t, n)), or = ir(1, 136, 256 / 8), ar = "#__bigint";
242
+ function cr(t, e, n) {
243
+ return JSON.stringify(t, (r, s) => typeof s == "bigint" ? s.toString() + ar : s, n);
244
244
  }
245
- function ar(t, e = {}) {
245
+ function lr(t, e = {}) {
246
246
  const { strict: n = !1 } = e;
247
247
  if (!t)
248
248
  throw new yt(t);
@@ -253,17 +253,17 @@ function ar(t, e = {}) {
253
253
  if (!t.startsWith("0x"))
254
254
  throw new Ct(t);
255
255
  }
256
- function Ht(t, e = {}) {
256
+ function Wt(t, e = {}) {
257
257
  const { strict: n = !1 } = e;
258
258
  try {
259
- return ar(t, { strict: n }), !0;
259
+ return lr(t, { strict: n }), !0;
260
260
  } catch {
261
261
  return !1;
262
262
  }
263
263
  }
264
264
  class yt extends ie {
265
265
  constructor(e) {
266
- super(`Value \`${typeof e == "object" ? or(e) : e}\` of type \`${typeof e}\` is an invalid hex type.`, {
266
+ super(`Value \`${typeof e == "object" ? cr(e) : e}\` of type \`${typeof e}\` is an invalid hex type.`, {
267
267
  metaMessages: ['Hex types must be represented as `"0x${string}"`.']
268
268
  }), Object.defineProperty(this, "name", {
269
269
  enumerable: !0,
@@ -287,28 +287,28 @@ class Ct extends ie {
287
287
  });
288
288
  }
289
289
  }
290
- const cr = "starknet:";
291
- class lr extends Error {
290
+ const dr = "starknet:";
291
+ class hr extends Error {
292
292
  constructor(e) {
293
293
  super(e), this.name = "StarknetChainError";
294
294
  }
295
295
  }
296
- const dr = [
296
+ const ur = [
297
297
  "starknet:0x534e5f4d41494e",
298
298
  // mainnet
299
299
  "starknet:0x534e5f5345504f4c4941"
300
300
  // sepolia
301
301
  ];
302
- function Wt(t) {
302
+ function qt(t) {
303
303
  const e = t.split(":");
304
- return e.length !== 2 || e[0] !== "starknet" ? !1 : Ht(e[1]);
304
+ return e.length !== 2 || e[0] !== "starknet" ? !1 : Wt(e[1]);
305
305
  }
306
306
  function Vt(t) {
307
- if (!Ht(t))
308
- throw new lr(`Invalid Starknet chain id: ${t}`);
309
- return `${cr}${t}`;
307
+ if (!Wt(t))
308
+ throw new hr(`Invalid Starknet chain id: ${t}`);
309
+ return `${dr}${t}`;
310
310
  }
311
- const hr = "starknet:walletApi";
311
+ const fr = "starknet:walletApi";
312
312
  var Ye = (t, e, n) => {
313
313
  if (!e.has(t))
314
314
  throw TypeError("Cannot " + n);
@@ -316,10 +316,10 @@ var Ye = (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
- }, ge = (t, e, n, r) => (Ye(t, e, "write to private field"), e.set(t, n), n), _ = (t, e, n) => (Ye(t, e, "access private method"), n), z, $, Me, Re, Oe, D, J, ze, qt, oe, ke, Fe, Dt, je, Zt, me, Je, He, Kt, Qe, Xt;
320
- class ur {
319
+ }, me = (t, e, n, r) => (Ye(t, e, "write to private field"), e.set(t, n), n), _ = (t, e, n) => (Ye(t, e, "access private method"), n), z, $, Me, Re, Oe, D, J, ze, Dt, oe, ve, je, Zt, Fe, Kt, ye, Je, He, Xt, Qe, Gt;
320
+ class pr {
321
321
  constructor(e) {
322
- this.injected = e, N(this, D), N(this, ze), N(this, oe), N(this, Fe), N(this, je), N(this, me), N(this, He), N(this, Qe), N(this, z, {}), N(this, $, null), N(this, Me, async ({ silent: n }) => {
322
+ this.injected = e, N(this, D), N(this, ze), N(this, oe), N(this, je), N(this, Fe), N(this, ye), N(this, He), N(this, Qe), N(this, z, {}), N(this, $, null), N(this, Me, async ({ silent: n }) => {
323
323
  if (!E(this, $)) {
324
324
  const r = await this.injected.request({
325
325
  type: "wallet_requestAccounts",
@@ -329,12 +329,12 @@ class ur {
329
329
  });
330
330
  if (r.length === 0)
331
331
  return { accounts: [] };
332
- await _(this, me, Je).call(this, r);
332
+ await _(this, ye, Je).call(this, r);
333
333
  }
334
334
  return { accounts: this.accounts };
335
335
  }), N(this, Re, async () => {
336
- _(this, oe, ke).call(this);
337
- }), N(this, Oe, (n, r) => (E(this, z)[n] || (E(this, z)[n] = []), E(this, z)[n].push(r), () => _(this, ze, qt).call(this, n, r))), this.injected.on("accountsChanged", _(this, Fe, Dt).bind(this)), this.injected.on("networkChanged", _(this, je, Zt).bind(this));
336
+ _(this, oe, ve).call(this);
337
+ }), N(this, Oe, (n, r) => (E(this, z)[n] || (E(this, z)[n] = []), E(this, z)[n].push(r), () => _(this, ze, Dt).call(this, n, r))), this.injected.on("accountsChanged", _(this, je, Zt).bind(this)), this.injected.on("networkChanged", _(this, Fe, Kt).bind(this));
338
338
  }
339
339
  get version() {
340
340
  return "1.0.0";
@@ -347,27 +347,27 @@ class ur {
347
347
  }
348
348
  get features() {
349
349
  return {
350
- [_n]: {
350
+ [Pn]: {
351
351
  version: "1.0.0",
352
352
  connect: E(this, Me).bind(this)
353
353
  },
354
- [In]: {
354
+ [Tn]: {
355
355
  version: "1.0.0",
356
356
  disconnect: E(this, Re).bind(this)
357
357
  },
358
- [Pn]: {
358
+ [Nn]: {
359
359
  version: "1.0.0",
360
360
  on: E(this, Oe).bind(this)
361
361
  },
362
- [hr]: {
362
+ [fr]: {
363
363
  version: "1.0.0",
364
- request: _(this, He, Kt).bind(this),
364
+ request: _(this, He, Xt).bind(this),
365
365
  walletVersion: this.injected.version
366
366
  }
367
367
  };
368
368
  }
369
369
  get chains() {
370
- return dr.slice();
370
+ return ur.slice();
371
371
  }
372
372
  get accounts() {
373
373
  return E(this, $) ? [
@@ -392,41 +392,41 @@ J = function(t, ...e) {
392
392
  n.apply(null, e);
393
393
  };
394
394
  ze = /* @__PURE__ */ new WeakSet();
395
- qt = function(t, e) {
395
+ Dt = function(t, e) {
396
396
  E(this, z)[t] = E(this, z)[t]?.filter(
397
397
  (n) => e !== n
398
398
  );
399
399
  };
400
400
  oe = /* @__PURE__ */ new WeakSet();
401
- ke = function() {
402
- E(this, $) && (ge(this, $, null), _(this, D, J).call(this, "change", { accounts: this.accounts }));
401
+ ve = function() {
402
+ E(this, $) && (me(this, $, null), _(this, D, J).call(this, "change", { accounts: this.accounts }));
403
403
  };
404
- Fe = /* @__PURE__ */ new WeakSet();
405
- Dt = async function(t) {
404
+ je = /* @__PURE__ */ new WeakSet();
405
+ Zt = async function(t) {
406
406
  if (!t || t.length === 0) {
407
- _(this, oe, ke).call(this);
407
+ _(this, oe, ve).call(this);
408
408
  return;
409
409
  }
410
- E(this, $) && await _(this, me, Je).call(this, t);
410
+ E(this, $) && await _(this, ye, Je).call(this, t);
411
411
  };
412
- je = /* @__PURE__ */ new WeakSet();
413
- Zt = function(t, e) {
412
+ Fe = /* @__PURE__ */ new WeakSet();
413
+ Kt = function(t, e) {
414
414
  if (!t) {
415
- _(this, oe, ke).call(this);
415
+ _(this, oe, ve).call(this);
416
416
  return;
417
417
  }
418
418
  if (!E(this, $))
419
419
  return;
420
420
  const n = Vt(t);
421
- if (!Wt(n))
421
+ if (!qt(n))
422
422
  throw new Error(`Invalid Starknet chain: ${n}`);
423
423
  if (e?.length > 0) {
424
424
  const [r] = e;
425
- ge(this, $, { address: r, chain: n }), _(this, D, J).call(this, "change", { accounts: this.accounts });
425
+ me(this, $, { address: r, chain: n }), _(this, D, J).call(this, "change", { accounts: this.accounts });
426
426
  } else
427
- ge(this, $, { address: E(this, $)?.address, chain: n }), _(this, D, J).call(this, "change", { accounts: this.accounts });
427
+ me(this, $, { address: E(this, $)?.address, chain: n }), _(this, D, J).call(this, "change", { accounts: this.accounts });
428
428
  };
429
- me = /* @__PURE__ */ new WeakSet();
429
+ ye = /* @__PURE__ */ new WeakSet();
430
430
  Je = async function(t) {
431
431
  if (t.length === 0)
432
432
  return;
@@ -434,24 +434,24 @@ Je = async function(t) {
434
434
  if (E(this, $)?.chain)
435
435
  E(this, $).address = e, _(this, D, J).call(this, "change", { accounts: this.accounts });
436
436
  else {
437
- const n = await _(this, Qe, Xt).call(this);
438
- ge(this, $, { address: e, chain: n }), _(this, D, J).call(this, "change", { accounts: this.accounts });
437
+ const n = await _(this, Qe, Gt).call(this);
438
+ me(this, $, { address: e, chain: n }), _(this, D, J).call(this, "change", { accounts: this.accounts });
439
439
  }
440
440
  };
441
441
  He = /* @__PURE__ */ new WeakSet();
442
- Kt = function(...t) {
442
+ Xt = function(...t) {
443
443
  return this.injected.request(...t);
444
444
  };
445
445
  Qe = /* @__PURE__ */ new WeakSet();
446
- Xt = async function() {
446
+ Gt = async function() {
447
447
  const t = await this.injected.request({
448
448
  type: "wallet_requestChainId"
449
449
  }), e = Vt(t);
450
- if (!Wt(e))
450
+ if (!qt(e))
451
451
  throw new Error(`Invalid Starknet chain: ${e}`);
452
452
  return e;
453
453
  };
454
- class $e extends kn {
454
+ class Le extends En {
455
455
  keychain;
456
456
  modal;
457
457
  options;
@@ -475,7 +475,7 @@ class $e extends kn {
475
475
  * @returns response from addTransaction
476
476
  */
477
477
  async execute(e) {
478
- return e = vn(e), new Promise(async (n, r) => {
478
+ return e = An(e), new Promise(async (n, r) => {
479
479
  const s = await this.keychain.execute(
480
480
  e,
481
481
  void 0,
@@ -500,7 +500,7 @@ class $e extends kn {
500
500
  return;
501
501
  }
502
502
  if (i === "notification" && !a) {
503
- const { toast: c } = await Promise.resolve().then(() => gi);
503
+ const { toast: c } = await Promise.resolve().then(() => vi);
504
504
  let d = !1, h;
505
505
  h = c({
506
506
  variant: "error",
@@ -556,10 +556,10 @@ var M;
556
556
  (function(t) {
557
557
  t.Call = "call", t.Reply = "reply", t.Syn = "syn", t.SynAck = "synAck", t.Ack = "ack";
558
558
  })(M || (M = {}));
559
- var V;
559
+ var q;
560
560
  (function(t) {
561
561
  t.Fulfilled = "fulfilled", t.Rejected = "rejected";
562
- })(V || (V = {}));
562
+ })(q || (q = {}));
563
563
  var ae;
564
564
  (function(t) {
565
565
  t.ConnectionDestroyed = "ConnectionDestroyed", t.ConnectionTimeout = "ConnectionTimeout", t.NoIframeSrc = "NoIframeSrc";
@@ -572,7 +572,7 @@ var H;
572
572
  (function(t) {
573
573
  t.Message = "message";
574
574
  })(H || (H = {}));
575
- const fr = (t, e) => {
575
+ const wr = (t, e) => {
576
576
  const n = [];
577
577
  let r = !1;
578
578
  return {
@@ -585,27 +585,27 @@ const fr = (t, e) => {
585
585
  r ? s() : n.push(s);
586
586
  }
587
587
  };
588
- }, pr = (t) => (...e) => {
588
+ }, gr = (t) => (...e) => {
589
589
  t && console.log("[Penpal]", ...e);
590
- }, wr = {
590
+ }, mr = {
591
591
  "http:": "80",
592
592
  "https:": "443"
593
- }, gr = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, mr = ["file:", "data:"], yr = (t) => {
594
- if (t && mr.find((a) => t.startsWith(a)))
593
+ }, yr = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, Cr = ["file:", "data:"], br = (t) => {
594
+ if (t && Cr.find((a) => t.startsWith(a)))
595
595
  return "null";
596
- const e = document.location, n = gr.exec(t);
596
+ const e = document.location, n = yr.exec(t);
597
597
  let r, s, i;
598
598
  n ? (r = n[1] ? n[1] : e.protocol, s = n[2], i = n[4]) : (r = e.protocol, s = e.hostname, i = e.port);
599
- const o = i && i !== wr[r] ? `:${i}` : "";
599
+ const o = i && i !== mr[r] ? `:${i}` : "";
600
600
  return `${r}//${s}${o}`;
601
601
  }, bt = ({ name: t, message: e, stack: n }) => ({
602
602
  name: t,
603
603
  message: e,
604
604
  stack: n
605
- }), Cr = (t) => {
605
+ }), xr = (t) => {
606
606
  const e = new Error();
607
607
  return Object.keys(t).forEach((n) => e[n] = t[n]), e;
608
- }, br = (t, e, n) => {
608
+ }, kr = (t, e, n) => {
609
609
  const { localName: r, local: s, remote: i, originForSending: o, originForReceiving: a } = t;
610
610
  let l = !1;
611
611
  const c = (d) => {
@@ -628,7 +628,7 @@ const fr = (t, e) => {
628
628
  resolution: y,
629
629
  returnValue: P
630
630
  };
631
- y === V.Rejected && P instanceof Error && (x.returnValue = bt(P), x.returnValueIsError = !0);
631
+ y === q.Rejected && P instanceof Error && (x.returnValue = bt(P), x.returnValueIsError = !0);
632
632
  try {
633
633
  i.postMessage(x, o);
634
634
  } catch (g) {
@@ -636,7 +636,7 @@ const fr = (t, e) => {
636
636
  const A = {
637
637
  penpal: M.Reply,
638
638
  id: w,
639
- resolution: V.Rejected,
639
+ resolution: q.Rejected,
640
640
  returnValue: bt(g),
641
641
  returnValueIsError: !0
642
642
  };
@@ -645,31 +645,31 @@ const fr = (t, e) => {
645
645
  throw g;
646
646
  }
647
647
  };
648
- new Promise((y) => y(e[u].call(e, d.origin).apply(e, f))).then(b(V.Fulfilled), b(V.Rejected));
648
+ new Promise((y) => y(e[u].call(e, d.origin).apply(e, f))).then(b(q.Fulfilled), b(q.Rejected));
649
649
  };
650
650
  return s.addEventListener(H.Message, c), () => {
651
651
  l = !0, s.removeEventListener(H.Message, c);
652
652
  };
653
653
  };
654
- let xr = 0;
655
- const kr = () => ++xr, Gt = ".", Yt = (t) => t ? t.split(Gt) : [], vr = (t) => t.join(Gt), Er = (t, e) => {
656
- const n = Yt(e || "");
657
- return n.push(t), vr(n);
658
- }, Ar = (t, e, n) => {
659
- const r = Yt(e);
654
+ let vr = 0;
655
+ const Er = () => ++vr, Yt = ".", Jt = (t) => t ? t.split(Yt) : [], Ar = (t) => t.join(Yt), Sr = (t, e) => {
656
+ const n = Jt(e || "");
657
+ return n.push(t), Ar(n);
658
+ }, $r = (t, e, n) => {
659
+ const r = Jt(e);
660
660
  return r.reduce((s, i, o) => (typeof s[i] > "u" && (s[i] = {}), o === r.length - 1 && (s[i] = n), s[i]), t), t;
661
- }, Jt = (t, e) => {
661
+ }, Qt = (t, e) => {
662
662
  const n = {};
663
663
  return Object.keys(t).forEach((r) => {
664
- const s = t[r], i = Er(r, e);
665
- typeof s == "object" && Object.assign(n, Jt(s, i)), typeof s == "function" && (n[i] = s);
664
+ const s = t[r], i = Sr(r, e);
665
+ typeof s == "object" && Object.assign(n, Qt(s, i)), typeof s == "function" && (n[i] = s);
666
666
  }), n;
667
- }, Sr = (t) => {
667
+ }, Lr = (t) => {
668
668
  const e = {};
669
669
  for (const n in t)
670
- Ar(e, n, t[n]);
670
+ $r(e, n, t[n]);
671
671
  return e;
672
- }, $r = (t, e, n, r, s) => {
672
+ }, _r = (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`);
@@ -686,7 +686,7 @@ const kr = () => ++xr, Gt = ".", Yt = (t) => t ? t.split(Gt) : [], vr = (t) => t
686
686
  throw y.code = ae.ConnectionDestroyed, y;
687
687
  }
688
688
  return new Promise((y, P) => {
689
- const x = kr(), g = (m) => {
689
+ const x = Er(), g = (m) => {
690
690
  if (m.source !== a || m.data.penpal !== M.Reply || m.data.id !== x)
691
691
  return;
692
692
  if (c !== "*" && m.origin !== c) {
@@ -695,8 +695,8 @@ const kr = () => ++xr, Gt = ".", Yt = (t) => t ? t.split(Gt) : [], vr = (t) => t
695
695
  }
696
696
  const X = m.data;
697
697
  s(`${i}: Received ${f}() reply`), o.removeEventListener(H.Message, g);
698
- let F = X.returnValue;
699
- X.returnValueIsError && (F = Cr(F)), (X.resolution === V.Fulfilled ? y : P)(F);
698
+ let j = X.returnValue;
699
+ X.returnValueIsError && (j = xr(j)), (X.resolution === q.Fulfilled ? y : P)(j);
700
700
  };
701
701
  o.addEventListener(H.Message, g);
702
702
  const A = {
@@ -708,10 +708,10 @@ const kr = () => ++xr, Gt = ".", Yt = (t) => t ? t.split(Gt) : [], vr = (t) => t
708
708
  a.postMessage(A, l);
709
709
  });
710
710
  }, u = n.reduce((f, w) => (f[w] = h(w), f), {});
711
- return Object.assign(t, Sr(u)), () => {
711
+ return Object.assign(t, Lr(u)), () => {
712
712
  d = !0;
713
713
  };
714
- }, Lr = (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 = {};
@@ -728,13 +728,13 @@ const kr = () => ++xr, Gt = ".", Yt = (t) => t ? t.split(Gt) : [], vr = (t) => t
728
728
  originForSending: n,
729
729
  originForReceiving: e
730
730
  };
731
- a && a(), a = br(h, t, s), o(a), l && l.forEach((f) => {
731
+ a && a(), a = kr(h, t, s), o(a), l && l.forEach((f) => {
732
732
  delete c[f];
733
733
  }), l = d.data.methodNames;
734
- const u = $r(c, h, l, i, s);
734
+ const u = _r(c, h, l, i, s);
735
735
  return o(u), c;
736
736
  };
737
- }, _r = (t, e, n, r) => (s) => {
737
+ }, Pr = (t, e, n, r) => (s) => {
738
738
  if (!s.source)
739
739
  return;
740
740
  if (n !== "*" && s.origin !== n) {
@@ -747,14 +747,14 @@ const kr = () => ++xr, Gt = ".", Yt = (t) => t ? t.split(Gt) : [], vr = (t) => t
747
747
  methodNames: Object.keys(e)
748
748
  };
749
749
  s.source.postMessage(i, r);
750
- }, Ir = 6e4, Pr = (t, e) => {
750
+ }, Tr = 6e4, Nr = (t, e) => {
751
751
  const { destroy: n, onDestroy: r } = e, s = setInterval(() => {
752
752
  t.isConnected || (clearInterval(s), n());
753
- }, Ir);
753
+ }, Tr);
754
754
  r(() => {
755
755
  clearInterval(s);
756
756
  });
757
- }, Tr = (t, e) => {
757
+ }, Br = (t, e) => {
758
758
  let n;
759
759
  return t !== void 0 && (n = window.setTimeout(() => {
760
760
  const r = new Error(`Connection timed out after ${t}ms`);
@@ -762,19 +762,19 @@ const kr = () => ++xr, Gt = ".", Yt = (t) => t ? t.split(Gt) : [], vr = (t) => t
762
762
  }, t)), () => {
763
763
  clearTimeout(n);
764
764
  };
765
- }, Nr = (t) => {
765
+ }, Ur = (t) => {
766
766
  if (!t.src && !t.srcdoc) {
767
767
  const e = new Error("Iframe must have src or srcdoc property defined.");
768
768
  throw e.code = ae.NoIframeSrc, e;
769
769
  }
770
- }, Br = (t) => {
770
+ }, Mr = (t) => {
771
771
  let { iframe: e, methods: n = {}, childOrigin: r, timeout: s, debug: i = !1 } = t;
772
- const o = pr(i), a = fr("Parent", o), { onDestroy: l, destroy: c } = a;
773
- r || (Nr(e), r = yr(e.src));
774
- const d = r === "null" ? "*" : r, h = Jt(n), u = _r(o, h, r, d), f = Lr(h, r, d, a, o);
772
+ const o = gr(i), a = wr("Parent", o), { onDestroy: l, destroy: c } = a;
773
+ r || (Ur(e), r = br(e.src));
774
+ const d = r === "null" ? "*" : r, h = Qt(n), u = Pr(o, h, r, d), f = Ir(h, r, d, a, o);
775
775
  return {
776
776
  promise: new Promise((b, y) => {
777
- const P = Tr(s, c), x = (g) => {
777
+ const P = Br(s, c), x = (g) => {
778
778
  if (!(g.source !== e.contentWindow || !g.data)) {
779
779
  if (g.data.penpal === M.Syn) {
780
780
  u(g);
@@ -787,7 +787,7 @@ const kr = () => ++xr, Gt = ".", Yt = (t) => t ? t.split(Gt) : [], vr = (t) => t
787
787
  }
788
788
  }
789
789
  };
790
- window.addEventListener(H.Message, x), o("Parent: Awaiting handshake"), Pr(e, a), l((g) => {
790
+ window.addEventListener(H.Message, x), o("Parent: Awaiting handshake"), Nr(e, a), l((g) => {
791
791
  window.removeEventListener(H.Message, x), g && y(g);
792
792
  });
793
793
  }),
@@ -795,29 +795,29 @@ const kr = () => ++xr, Gt = ".", Yt = (t) => t ? t.split(Gt) : [], vr = (t) => t
795
795
  c();
796
796
  }
797
797
  };
798
- }, Ur = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
799
- function Qt(t) {
798
+ }, Rr = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
799
+ function en(t) {
800
800
  const e = t.toLowerCase();
801
- return Ur.has(e) || e.endsWith(".localhost");
801
+ return Rr.has(e) || e.endsWith(".localhost");
802
802
  }
803
- function Mr(t) {
803
+ function Or(t) {
804
804
  if (t.username || t.password)
805
805
  throw new Error("Invalid keychain iframe URL: credentials are not allowed");
806
- if (t.protocol !== "https:" && !(t.protocol === "http:" && Qt(t.hostname)))
806
+ if (t.protocol !== "https:" && !(t.protocol === "http:" && en(t.hostname)))
807
807
  throw new Error(
808
808
  "Invalid keychain iframe URL: only https:// or local http:// URLs are allowed"
809
809
  );
810
810
  }
811
- function Rr(t) {
811
+ function zr(t) {
812
812
  const e = [
813
813
  "publickey-credentials-create *",
814
814
  "publickey-credentials-get *",
815
815
  "clipboard-write",
816
816
  "payment *"
817
817
  ];
818
- return Qt(t.hostname) && e.push("local-network-access *"), e.join("; ");
818
+ return en(t.hostname) && e.push("local-network-access *"), e.join("; ");
819
819
  }
820
- class Or {
820
+ class jr {
821
821
  url;
822
822
  iframe;
823
823
  container;
@@ -832,11 +832,11 @@ class Or {
832
832
  }) {
833
833
  if (typeof document > "u" || typeof window > "u")
834
834
  return;
835
- this.url = n, Mr(n);
835
+ this.url = n, Or(n);
836
836
  const o = document.head, a = document.createElement("meta");
837
837
  a.name = "viewport", a.id = "controller-viewport", a.content = "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, interactive-widget=resizes-content", o.appendChild(a);
838
838
  const l = document.createElement("iframe");
839
- l.src = n.toString(), l.id = e, l.style.border = "none", l.sandbox.add("allow-forms"), l.sandbox.add("allow-popups"), l.sandbox.add("allow-popups-to-escape-sandbox"), l.sandbox.add("allow-scripts"), l.sandbox.add("allow-same-origin"), l.allow = Rr(n), l.referrerPolicy = "no-referrer", l.style.scrollbarWidth = "none", l.style.setProperty("-ms-overflow-style", "none"), l.style.setProperty("-webkit-scrollbar", "none"), document.hasStorageAccess && l.sandbox.add("allow-storage-access-by-user-activation");
839
+ l.src = n.toString(), l.id = e, l.style.border = "none", l.sandbox.add("allow-forms"), l.sandbox.add("allow-popups"), l.sandbox.add("allow-popups-to-escape-sandbox"), l.sandbox.add("allow-scripts"), l.sandbox.add("allow-same-origin"), l.allow = zr(n), l.referrerPolicy = "no-referrer", l.style.scrollbarWidth = "none", l.style.setProperty("-ms-overflow-style", "none"), l.style.setProperty("-webkit-scrollbar", "none"), document.hasStorageAccess && l.sandbox.add("allow-storage-access-by-user-activation");
840
840
  const c = document.createElement("div");
841
841
  c.id = "controller", c.style.position = "fixed", c.style.height = "100%", c.style.width = "100%", c.style.top = "0", c.style.left = "0", c.style.zIndex = "10000", c.style.backgroundColor = "rgba(0,0,0,0.6)", c.style.display = "none", c.style.alignItems = "center", c.style.justifyContent = "center", c.style.transition = "opacity 0.2s ease", c.style.opacity = "0", c.style.pointerEvents = "auto", c.style.overscrollBehaviorY = "contain", c.style.scrollbarWidth = "none", c.style.setProperty("-ms-overflow-style", "none"), c.style.setProperty("-webkit-scrollbar", "none"), c.appendChild(l), c.addEventListener(
842
842
  "touchstart",
@@ -856,7 +856,7 @@ class Or {
856
856
  u.touches.length > 1 && u.preventDefault();
857
857
  },
858
858
  { passive: !1 }
859
- ), this.iframe = l, this.container = c, Br({
859
+ ), this.iframe = l, this.container = c, Mr({
860
860
  iframe: this.iframe,
861
861
  childOrigin: n.origin,
862
862
  methods: {
@@ -912,7 +912,7 @@ class Or {
912
912
  return this.container?.style.display !== "none";
913
913
  }
914
914
  }
915
- const zr = "6.13.7";
915
+ const Fr = "6.13.7";
916
916
  function xt(t, e, n) {
917
917
  for (let r in e) {
918
918
  let s = e[r];
@@ -950,7 +950,7 @@ function G(t) {
950
950
  }
951
951
  return "[ COULD NOT SERIALIZE ]";
952
952
  }
953
- function Fr(t, e, n) {
953
+ function Hr(t, e, n) {
954
954
  let r = t;
955
955
  {
956
956
  const i = [];
@@ -964,7 +964,7 @@ function Fr(t, e, n) {
964
964
  i.push(o + "=" + G(a));
965
965
  }
966
966
  }
967
- i.push(`code=${e}`), i.push(`version=${zr}`), i.length && (t += " (" + i.join(", ") + ")");
967
+ i.push(`code=${e}`), i.push(`version=${Fr}`), i.length && (t += " (" + i.join(", ") + ")");
968
968
  }
969
969
  let s;
970
970
  switch (e) {
@@ -980,12 +980,12 @@ function Fr(t, e, n) {
980
980
  }
981
981
  return xt(s, { code: e }), n && Object.assign(s, n), s.shortMessage == null && xt(s, { shortMessage: r }), s;
982
982
  }
983
- function jr(t, e, n, r) {
983
+ function Wr(t, e, n, r) {
984
984
  if (!t)
985
- throw Fr(e, n, r);
985
+ throw Hr(e, n, r);
986
986
  }
987
987
  function te(t, e, n, r) {
988
- jr(t, e, "INVALID_ARGUMENT", { argument: n, value: r });
988
+ Wr(t, e, "INVALID_ARGUMENT", { argument: n, value: r });
989
989
  }
990
990
  ["NFD", "NFC", "NFKD", "NFKC"].reduce((t, e) => {
991
991
  try {
@@ -998,7 +998,7 @@ function te(t, e, n, r) {
998
998
  }
999
999
  return t;
1000
1000
  }, []);
1001
- function Hr(t, e, n) {
1001
+ function qr(t, e, n) {
1002
1002
  if (t instanceof Uint8Array)
1003
1003
  return t;
1004
1004
  if (typeof t == "string" && t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {
@@ -1011,10 +1011,10 @@ function Hr(t, e, n) {
1011
1011
  te(!1, "invalid BytesLike value", e || "value", t);
1012
1012
  }
1013
1013
  function et(t, e) {
1014
- return Hr(t, e);
1014
+ return qr(t, e);
1015
1015
  }
1016
1016
  const kt = "0123456789abcdef";
1017
- function Wr(t) {
1017
+ function Vr(t) {
1018
1018
  const e = et(t);
1019
1019
  let n = "0x";
1020
1020
  for (let r = 0; r < e.length; r++) {
@@ -1023,26 +1023,26 @@ function Wr(t) {
1023
1023
  }
1024
1024
  return n;
1025
1025
  }
1026
- let en = !1;
1027
- const tn = function(t) {
1028
- return sr(t);
1026
+ let tn = !1;
1027
+ const nn = function(t) {
1028
+ return or(t);
1029
1029
  };
1030
- let nn = tn;
1030
+ let rn = nn;
1031
1031
  function ce(t) {
1032
1032
  const e = et(t, "data");
1033
- return Wr(nn(e));
1033
+ return Vr(rn(e));
1034
1034
  }
1035
- ce._ = tn;
1035
+ ce._ = nn;
1036
1036
  ce.lock = function() {
1037
- en = !0;
1037
+ tn = !0;
1038
1038
  };
1039
1039
  ce.register = function(t) {
1040
- if (en)
1040
+ if (tn)
1041
1041
  throw new TypeError("keccak256 is locked");
1042
- nn = t;
1042
+ rn = t;
1043
1043
  };
1044
1044
  Object.freeze(ce);
1045
- const Vr = BigInt(0), qr = BigInt(36);
1045
+ const Dr = BigInt(0), Zr = BigInt(36);
1046
1046
  function vt(t) {
1047
1047
  t = t.toLowerCase();
1048
1048
  const e = t.substring(2).split(""), n = new Uint8Array(40);
@@ -1059,7 +1059,7 @@ for (let t = 0; t < 10; t++)
1059
1059
  for (let t = 0; t < 26; t++)
1060
1060
  tt[String.fromCharCode(65 + t)] = String(10 + t);
1061
1061
  const Et = 15;
1062
- function Dr(t) {
1062
+ function Kr(t) {
1063
1063
  t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00";
1064
1064
  let e = t.split("").map((r) => tt[r]).join("");
1065
1065
  for (; e.length >= Et; ) {
@@ -1071,7 +1071,7 @@ function Dr(t) {
1071
1071
  n = "0" + n;
1072
1072
  return n;
1073
1073
  }
1074
- const Zr = function() {
1074
+ const Xr = function() {
1075
1075
  const t = {};
1076
1076
  for (let e = 0; e < 36; e++) {
1077
1077
  const n = "0123456789abcdefghijklmnopqrstuvwxyz"[e];
@@ -1079,11 +1079,11 @@ const Zr = function() {
1079
1079
  }
1080
1080
  return t;
1081
1081
  }();
1082
- function Kr(t) {
1082
+ function Gr(t) {
1083
1083
  t = t.toLowerCase();
1084
- let e = Vr;
1084
+ let e = Dr;
1085
1085
  for (let n = 0; n < t.length; n++)
1086
- e = e * qr + Zr[t[n]];
1086
+ e = e * Zr + Xr[t[n]];
1087
1087
  return e;
1088
1088
  }
1089
1089
  function R(t) {
@@ -1093,15 +1093,15 @@ function R(t) {
1093
1093
  return te(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || e === t, "bad address checksum", "address", t), e;
1094
1094
  }
1095
1095
  if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
1096
- te(t.substring(2, 4) === Dr(t), "bad icap checksum", "address", t);
1097
- let e = Kr(t.substring(4)).toString(16);
1096
+ te(t.substring(2, 4) === Kr(t), "bad icap checksum", "address", t);
1097
+ let e = Gr(t.substring(4)).toString(16);
1098
1098
  for (; e.length < 40; )
1099
1099
  e = "0" + e;
1100
1100
  return vt("0x" + e);
1101
1101
  }
1102
1102
  te(!1, "invalid address", "address", t);
1103
1103
  }
1104
- class Xr {
1104
+ class Yr {
1105
1105
  type = "argent";
1106
1106
  platform = "starknet";
1107
1107
  wallet = void 0;
@@ -1235,16 +1235,16 @@ class Xr {
1235
1235
  this.removeAccountChangeListener(), this.wallet = void 0, this.account = void 0, this.connectedAccounts = [];
1236
1236
  }
1237
1237
  }
1238
- function Gr(t) {
1238
+ function Jr(t) {
1239
1239
  if (typeof window > "u")
1240
1240
  return;
1241
1241
  const e = (n) => t(n.detail);
1242
1242
  return window.addEventListener("eip6963:announceProvider", e), window.dispatchEvent(new CustomEvent("eip6963:requestProvider")), () => window.removeEventListener("eip6963:announceProvider", e);
1243
1243
  }
1244
- function Yr() {
1244
+ function Qr() {
1245
1245
  const t = /* @__PURE__ */ new Set();
1246
1246
  let e = [];
1247
- const n = () => Gr((s) => {
1247
+ const n = () => Jr((s) => {
1248
1248
  e.some(({ info: i }) => i.uuid === s.info.uuid) || (e = [...e, s], t.forEach((i) => i(e, { added: [s] })));
1249
1249
  });
1250
1250
  let r = n();
@@ -1272,7 +1272,7 @@ function Yr() {
1272
1272
  }
1273
1273
  };
1274
1274
  }
1275
- const Jr = {
1275
+ const es = {
1276
1276
  "0x1": "ethereum",
1277
1277
  // ethereum mainnet
1278
1278
  "0xaa36a7": "ethereum",
@@ -1289,16 +1289,16 @@ const Jr = {
1289
1289
  // op mainnet
1290
1290
  "0xaa37dc": "optimism",
1291
1291
  // op sepolia
1292
- [Ue.StarknetChainId.SN_MAIN]: "starknet",
1293
- [Ue.StarknetChainId.SN_SEPOLIA]: "starknet"
1294
- }, Le = (t) => {
1295
- const e = Tt.toHex(t), n = Jr[e];
1292
+ [we.StarknetChainId.SN_MAIN]: "starknet",
1293
+ [we.StarknetChainId.SN_SEPOLIA]: "starknet"
1294
+ }, _e = (t) => {
1295
+ const e = Tt.toHex(t), n = es[e];
1296
1296
  return n || console.warn(`Unknown chain ID: ${e}`), n;
1297
1297
  };
1298
- class ve {
1298
+ class Ee {
1299
1299
  platform;
1300
1300
  account = void 0;
1301
- store = Yr();
1301
+ store = Qr();
1302
1302
  provider;
1303
1303
  connectedAccounts = [];
1304
1304
  constructor() {
@@ -1324,15 +1324,15 @@ class ve {
1324
1324
  }).catch(console.error), e.provider.request({
1325
1325
  method: "eth_chainId"
1326
1326
  }).then((n) => {
1327
- this.platform = Le(n);
1327
+ this.platform = _e(n);
1328
1328
  }).catch(console.error), e.provider?.on("chainChanged", (n) => {
1329
- this.platform = Le(n);
1329
+ this.platform = _e(n);
1330
1330
  }), e.provider?.on("accountsChanged", (n) => {
1331
1331
  n && (this.connectedAccounts = n.map((r) => R(r)), this.account = n.length > 0 ? R(n[0]) : void 0);
1332
1332
  }));
1333
1333
  }
1334
1334
  isAvailable() {
1335
- if (En())
1335
+ if (Sn())
1336
1336
  return !1;
1337
1337
  const e = this.getProvider();
1338
1338
  return !e && this.rdns === "io.metamask" && typeof window < "u" ? !!window.ethereum?.isMetaMask : (e && !this.initialized && this.initializeIfAvailable(), typeof window < "u" && !!e);
@@ -1484,7 +1484,7 @@ class ve {
1484
1484
  return await n.request({
1485
1485
  method: "wallet_switchEthereumChain",
1486
1486
  params: [{ chainId: e }]
1487
- }), this.platform = Le(e), !0;
1487
+ }), this.platform = _e(e), !0;
1488
1488
  } catch (r) {
1489
1489
  throw r.code === 4902 && console.warn(`Chain not added to ${this.displayName}`), r;
1490
1490
  }
@@ -1554,12 +1554,12 @@ class ve {
1554
1554
  }
1555
1555
  }
1556
1556
  }
1557
- class Qr extends ve {
1557
+ class ts extends Ee {
1558
1558
  type = "base";
1559
1559
  rdns = "com.coinbase.wallet";
1560
1560
  displayName = "Base Wallet";
1561
1561
  }
1562
- class es extends ve {
1562
+ class ns extends Ee {
1563
1563
  type = "metamask";
1564
1564
  rdns = "io.metamask";
1565
1565
  displayName = "MetaMask";
@@ -1568,16 +1568,16 @@ class es extends ve {
1568
1568
  function nt(t) {
1569
1569
  return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
1570
1570
  }
1571
- function rn(t, ...e) {
1571
+ function sn(t, ...e) {
1572
1572
  if (!nt(t))
1573
1573
  throw new Error("Uint8Array expected");
1574
1574
  if (e.length > 0 && !e.includes(t.length))
1575
1575
  throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
1576
1576
  }
1577
- function sn(t, e) {
1577
+ function on(t, e) {
1578
1578
  return Array.isArray(e) ? e.length === 0 ? !0 : t ? e.every((n) => typeof n == "string") : e.every((n) => Number.isSafeInteger(n)) : !1;
1579
1579
  }
1580
- function ts(t) {
1580
+ function rs(t) {
1581
1581
  if (typeof t != "function")
1582
1582
  throw new Error("function expected");
1583
1583
  return !0;
@@ -1591,16 +1591,16 @@ function le(t) {
1591
1591
  if (!Number.isSafeInteger(t))
1592
1592
  throw new Error(`invalid integer: ${t}`);
1593
1593
  }
1594
- function ye(t) {
1594
+ function Ce(t) {
1595
1595
  if (!Array.isArray(t))
1596
1596
  throw new Error("array expected");
1597
1597
  }
1598
- function Ce(t, e) {
1599
- if (!sn(!0, e))
1598
+ function be(t, e) {
1599
+ if (!on(!0, e))
1600
1600
  throw new Error(`${t}: array of strings expected`);
1601
1601
  }
1602
- function on(t, e) {
1603
- if (!sn(!1, e))
1602
+ function an(t, e) {
1603
+ if (!on(!1, e))
1604
1604
  throw new Error(`${t}: array of numbers expected`);
1605
1605
  }
1606
1606
  // @__NO_SIDE_EFFECTS__
@@ -1611,15 +1611,15 @@ function rt(...t) {
1611
1611
  // @__NO_SIDE_EFFECTS__
1612
1612
  function st(t) {
1613
1613
  const e = typeof t == "string" ? t.split("") : t, n = e.length;
1614
- Ce("alphabet", e);
1614
+ be("alphabet", e);
1615
1615
  const r = new Map(e.map((s, i) => [s, i]));
1616
1616
  return {
1617
- encode: (s) => (ye(s), s.map((i) => {
1617
+ encode: (s) => (Ce(s), s.map((i) => {
1618
1618
  if (!Number.isSafeInteger(i) || i < 0 || i >= n)
1619
1619
  throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${t}`);
1620
1620
  return e[i];
1621
1621
  })),
1622
- decode: (s) => (ye(s), s.map((i) => {
1622
+ decode: (s) => (Ce(s), s.map((i) => {
1623
1623
  Q("alphabet.decode", i);
1624
1624
  const o = r.get(i);
1625
1625
  if (o === void 0)
@@ -1631,20 +1631,20 @@ function st(t) {
1631
1631
  // @__NO_SIDE_EFFECTS__
1632
1632
  function it(t = "") {
1633
1633
  return Q("join", t), {
1634
- encode: (e) => (Ce("join.decode", e), e.join(t)),
1634
+ encode: (e) => (be("join.decode", e), e.join(t)),
1635
1635
  decode: (e) => (Q("join.decode", e), e.split(t))
1636
1636
  };
1637
1637
  }
1638
1638
  // @__NO_SIDE_EFFECTS__
1639
- function ns(t, e = "=") {
1639
+ function ss(t, e = "=") {
1640
1640
  return le(t), Q("padding", e), {
1641
1641
  encode(n) {
1642
- for (Ce("padding.encode", n); n.length * t % 8; )
1642
+ for (be("padding.encode", n); n.length * t % 8; )
1643
1643
  n.push(e);
1644
1644
  return n;
1645
1645
  },
1646
1646
  decode(n) {
1647
- Ce("padding.decode", n);
1647
+ be("padding.decode", n);
1648
1648
  let r = n.length;
1649
1649
  if (r * t % 8)
1650
1650
  throw new Error("padding: invalid, string should have whole number of bytes");
@@ -1656,15 +1656,15 @@ function ns(t, e = "=") {
1656
1656
  };
1657
1657
  }
1658
1658
  // @__NO_SIDE_EFFECTS__
1659
- function rs(t) {
1660
- return ts(t), { encode: (e) => e, decode: (e) => t(e) };
1659
+ function is(t) {
1660
+ return rs(t), { encode: (e) => e, decode: (e) => t(e) };
1661
1661
  }
1662
1662
  function At(t, e, n) {
1663
1663
  if (e < 2)
1664
1664
  throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);
1665
1665
  if (n < 2)
1666
1666
  throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);
1667
- if (ye(t), !t.length)
1667
+ if (Ce(t), !t.length)
1668
1668
  return [];
1669
1669
  let r = 0;
1670
1670
  const s = [], i = Array.from(t, (a) => {
@@ -1694,21 +1694,21 @@ function At(t, e, n) {
1694
1694
  s.push(0);
1695
1695
  return s.reverse();
1696
1696
  }
1697
- const an = (t, e) => e === 0 ? t : an(e, t % e), be = /* @__NO_SIDE_EFFECTS__ */ (t, e) => t + (e - an(t, e)), _e = /* @__PURE__ */ (() => {
1697
+ const cn = (t, e) => e === 0 ? t : cn(e, t % e), xe = /* @__NO_SIDE_EFFECTS__ */ (t, e) => t + (e - cn(t, e)), Ie = /* @__PURE__ */ (() => {
1698
1698
  let t = [];
1699
1699
  for (let e = 0; e < 40; e++)
1700
1700
  t.push(2 ** e);
1701
1701
  return t;
1702
1702
  })();
1703
1703
  function St(t, e, n, r) {
1704
- if (ye(t), e <= 0 || e > 32)
1704
+ if (Ce(t), e <= 0 || e > 32)
1705
1705
  throw new Error(`convertRadix2: wrong from=${e}`);
1706
1706
  if (n <= 0 || n > 32)
1707
1707
  throw new Error(`convertRadix2: wrong to=${n}`);
1708
- if (/* @__PURE__ */ be(e, n) > 32)
1709
- throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${/* @__PURE__ */ be(e, n)}`);
1708
+ if (/* @__PURE__ */ xe(e, n) > 32)
1709
+ throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${/* @__PURE__ */ xe(e, n)}`);
1710
1710
  let s = 0, i = 0;
1711
- const o = _e[e], a = _e[n] - 1, l = [];
1711
+ const o = Ie[e], a = Ie[n] - 1, l = [];
1712
1712
  for (const c of t) {
1713
1713
  if (le(c), c >= o)
1714
1714
  throw new Error(`convertRadix2: invalid data word=${c} from=${e}`);
@@ -1716,7 +1716,7 @@ function St(t, e, n, r) {
1716
1716
  throw new Error(`convertRadix2: carry overflow pos=${i} from=${e}`);
1717
1717
  for (i += e; i >= n; i -= n)
1718
1718
  l.push((s >> i - n & a) >>> 0);
1719
- const d = _e[i];
1719
+ const d = Ie[i];
1720
1720
  if (d === void 0)
1721
1721
  throw new Error("invalid carry");
1722
1722
  s &= d - 1;
@@ -1728,7 +1728,7 @@ function St(t, e, n, r) {
1728
1728
  return r && i > 0 && l.push(s >>> 0), l;
1729
1729
  }
1730
1730
  // @__NO_SIDE_EFFECTS__
1731
- function ss(t) {
1731
+ function os(t) {
1732
1732
  le(t);
1733
1733
  const e = 2 ** 8;
1734
1734
  return {
@@ -1737,14 +1737,14 @@ function ss(t) {
1737
1737
  throw new Error("radix.encode input should be Uint8Array");
1738
1738
  return At(Array.from(n), e, t);
1739
1739
  },
1740
- decode: (n) => (on("radix.decode", n), Uint8Array.from(At(n, t, e)))
1740
+ decode: (n) => (an("radix.decode", n), Uint8Array.from(At(n, t, e)))
1741
1741
  };
1742
1742
  }
1743
1743
  // @__NO_SIDE_EFFECTS__
1744
- function cn(t, e = !1) {
1744
+ function ln(t, e = !1) {
1745
1745
  if (le(t), t <= 0 || t > 32)
1746
1746
  throw new Error("radix2: bits should be in (0..32]");
1747
- if (/* @__PURE__ */ be(8, t) > 32 || /* @__PURE__ */ be(t, 8) > 32)
1747
+ if (/* @__PURE__ */ xe(8, t) > 32 || /* @__PURE__ */ xe(t, 8) > 32)
1748
1748
  throw new Error("radix2: carry overflow");
1749
1749
  return {
1750
1750
  encode: (n) => {
@@ -1752,32 +1752,32 @@ function cn(t, e = !1) {
1752
1752
  throw new Error("radix2.encode input should be Uint8Array");
1753
1753
  return St(Array.from(n), 8, t, !e);
1754
1754
  },
1755
- decode: (n) => (on("radix2.decode", n), Uint8Array.from(St(n, t, 8, e)))
1755
+ decode: (n) => (an("radix2.decode", n), Uint8Array.from(St(n, t, 8, e)))
1756
1756
  };
1757
1757
  }
1758
- const is = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", os = is ? {
1758
+ const as = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", cs = as ? {
1759
1759
  encode(t) {
1760
- return rn(t), t.toBase64();
1760
+ return sn(t), t.toBase64();
1761
1761
  },
1762
1762
  decode(t) {
1763
1763
  return Q("base64", t), Uint8Array.fromBase64(t, { lastChunkHandling: "strict" });
1764
1764
  }
1765
- } : /* @__PURE__ */ rt(/* @__PURE__ */ cn(6), /* @__PURE__ */ st("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ ns(6), /* @__PURE__ */ it("")), as = /* @__NO_SIDE_EFFECTS__ */ (t) => /* @__PURE__ */ rt(/* @__PURE__ */ ss(58), /* @__PURE__ */ st(t), /* @__PURE__ */ it("")), Ve = /* @__PURE__ */ as("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), cs = {
1765
+ } : /* @__PURE__ */ rt(/* @__PURE__ */ ln(6), /* @__PURE__ */ st("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ ss(6), /* @__PURE__ */ it("")), ls = /* @__NO_SIDE_EFFECTS__ */ (t) => /* @__PURE__ */ rt(/* @__PURE__ */ os(58), /* @__PURE__ */ st(t), /* @__PURE__ */ it("")), qe = /* @__PURE__ */ ls("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), ds = {
1766
1766
  encode: (t) => new TextDecoder().decode(t),
1767
1767
  decode: (t) => new TextEncoder().encode(t)
1768
- }, ls = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", ds = {
1768
+ }, hs = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", us = {
1769
1769
  encode(t) {
1770
- return rn(t), t.toHex();
1770
+ return sn(t), t.toHex();
1771
1771
  },
1772
1772
  decode(t) {
1773
1773
  return Q("hex", t), Uint8Array.fromHex(t);
1774
1774
  }
1775
- }, Ie = ls ? ds : /* @__PURE__ */ rt(/* @__PURE__ */ cn(4), /* @__PURE__ */ st("0123456789abcdef"), /* @__PURE__ */ it(""), /* @__PURE__ */ rs((t) => {
1775
+ }, Pe = hs ? us : /* @__PURE__ */ rt(/* @__PURE__ */ ln(4), /* @__PURE__ */ st("0123456789abcdef"), /* @__PURE__ */ it(""), /* @__PURE__ */ is((t) => {
1776
1776
  if (typeof t != "string" || t.length % 2 !== 0)
1777
1777
  throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);
1778
1778
  return t.toLowerCase();
1779
1779
  }));
1780
- function qe(t, e) {
1780
+ function Ve(t, e) {
1781
1781
  if (t.length !== e.length)
1782
1782
  return !1;
1783
1783
  for (let n = 0; n < t.length; n++)
@@ -1785,18 +1785,18 @@ function qe(t, e) {
1785
1785
  return !1;
1786
1786
  return !0;
1787
1787
  }
1788
- function j(t) {
1788
+ function F(t) {
1789
1789
  return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
1790
1790
  }
1791
- const ln = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength);
1791
+ const dn = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength);
1792
1792
  function K(t) {
1793
1793
  return Object.prototype.toString.call(t) === "[object Object]";
1794
1794
  }
1795
1795
  function U(t) {
1796
1796
  return Number.isSafeInteger(t);
1797
1797
  }
1798
- const dn = (t) => {
1799
- if (t !== null && typeof t != "string" && !B(t) && !j(t) && !U(t))
1798
+ const hn = (t) => {
1799
+ if (t !== null && typeof t != "string" && !B(t) && !F(t) && !U(t))
1800
1800
  throw new Error(`lengthCoder: expected null | number | Uint8Array | CoderType, got ${t} (${typeof t})`);
1801
1801
  return {
1802
1802
  encodeStream(e, n) {
@@ -1913,7 +1913,7 @@ const dn = (t) => {
1913
1913
  };
1914
1914
  class ot {
1915
1915
  constructor(e, n = {}, r = [], s = void 0, i = 0) {
1916
- this.pos = 0, this.bitBuf = 0, this.bitPos = 0, this.data = e, this.opts = n, this.stack = r, this.parent = s, this.parentOffset = i, this.view = ln(e);
1916
+ this.pos = 0, this.bitBuf = 0, this.bitPos = 0, this.data = e, this.opts = n, this.stack = r, this.parent = s, this.parentOffset = i, this.view = dn(e);
1917
1917
  }
1918
1918
  /** Internal method for pointers. */
1919
1919
  _enablePointers() {
@@ -1952,17 +1952,17 @@ class ot {
1952
1952
  finish() {
1953
1953
  if (!this.opts.allowUnreadBytes) {
1954
1954
  if (this.bitPos)
1955
- throw this.err(`${this.bitPos} bits left after unpack: ${Ie.encode(this.data.slice(this.pos))}`);
1955
+ throw this.err(`${this.bitPos} bits left after unpack: ${Pe.encode(this.data.slice(this.pos))}`);
1956
1956
  if (this.bs && !this.parent) {
1957
1957
  const e = S.indices(this.bs, this.data.length, !0);
1958
1958
  if (e.length) {
1959
- const n = S.range(e).map(({ pos: r, length: s }) => `(${r}/${s})[${Ie.encode(this.data.subarray(r, r + s))}]`).join(", ");
1959
+ const n = S.range(e).map(({ pos: r, length: s }) => `(${r}/${s})[${Pe.encode(this.data.subarray(r, r + s))}]`).join(", ");
1960
1960
  throw this.err(`unread byte ranges: ${n} (total=${this.data.length})`);
1961
1961
  } else
1962
1962
  return;
1963
1963
  }
1964
1964
  if (!this.isEnd())
1965
- throw this.err(`${this.leftBytes} bytes ${this.bitPos} bits left after unpack: ${Ie.encode(this.data.slice(this.pos))}`);
1965
+ throw this.err(`${this.leftBytes} bytes ${this.bitPos} bits left after unpack: ${Pe.encode(this.data.slice(this.pos))}`);
1966
1966
  }
1967
1967
  }
1968
1968
  // User methods
@@ -2014,7 +2014,7 @@ class ot {
2014
2014
  return n >>> 0;
2015
2015
  }
2016
2016
  find(e, n = this.pos) {
2017
- if (!j(e))
2017
+ if (!F(e))
2018
2018
  throw this.err(`find: needle is not bytes! ${e}`);
2019
2019
  if (this.bitPos)
2020
2020
  throw this.err("findByte: bitPos not empty");
@@ -2023,14 +2023,14 @@ class ot {
2023
2023
  for (let r = n; (r = this.data.indexOf(e[0], r)) !== -1; r++) {
2024
2024
  if (r === -1 || this.data.length - r < e.length)
2025
2025
  return;
2026
- if (qe(e, this.data.subarray(r, r + e.length)))
2026
+ if (Ve(e, this.data.subarray(r, r + e.length)))
2027
2027
  return r;
2028
2028
  }
2029
2029
  }
2030
2030
  }
2031
- class hs {
2031
+ class fs {
2032
2032
  constructor(e = []) {
2033
- this.pos = 0, this.buffers = [], this.ptrs = [], this.bitBuf = 0, this.bitPos = 0, this.viewBuf = new Uint8Array(8), this.finished = !1, this.stack = e, this.view = ln(this.viewBuf);
2033
+ this.pos = 0, this.buffers = [], this.ptrs = [], this.bitBuf = 0, this.bitPos = 0, this.viewBuf = new Uint8Array(8), this.finished = !1, this.stack = e, this.view = dn(this.viewBuf);
2034
2034
  }
2035
2035
  pushObj(e, n) {
2036
2036
  return Z.pushObj(this.stack, e, n);
@@ -2096,7 +2096,7 @@ class hs {
2096
2096
  }
2097
2097
  }
2098
2098
  const De = (t) => Uint8Array.from(t).reverse();
2099
- function us(t, e, n) {
2099
+ function ps(t, e, n) {
2100
2100
  if (n) {
2101
2101
  const r = 2n ** (e - 1n);
2102
2102
  if (t < -r || t >= r)
@@ -2104,14 +2104,14 @@ function us(t, e, n) {
2104
2104
  } else if (0n > t || t >= 2n ** e)
2105
2105
  throw new Error(`value out of unsigned bounds. Expected 0 <= ${t} < ${2n ** e}`);
2106
2106
  }
2107
- function hn(t) {
2107
+ function un(t) {
2108
2108
  return {
2109
2109
  // NOTE: we cannot export validate here, since it is likely mistake.
2110
2110
  encodeStream: t.encodeStream,
2111
2111
  decodeStream: t.decodeStream,
2112
2112
  size: t.size,
2113
2113
  encode: (e) => {
2114
- const n = new hs();
2114
+ const n = new fs();
2115
2115
  return t.encodeStream(n, e), n.finish();
2116
2116
  },
2117
2117
  decode: (e, n = {}) => {
@@ -2120,12 +2120,12 @@ function hn(t) {
2120
2120
  }
2121
2121
  };
2122
2122
  }
2123
- function un(t, e) {
2123
+ function fn(t, e) {
2124
2124
  if (!B(t))
2125
2125
  throw new Error(`validate: invalid inner value ${t}`);
2126
2126
  if (typeof e != "function")
2127
2127
  throw new Error("validate: fn should be function");
2128
- return hn({
2128
+ return un({
2129
2129
  size: t.size,
2130
2130
  encodeStream: (n, r) => {
2131
2131
  let s;
@@ -2147,13 +2147,13 @@ function un(t, e) {
2147
2147
  });
2148
2148
  }
2149
2149
  const I = (t) => {
2150
- const e = hn(t);
2151
- return t.validate ? un(e, t.validate) : e;
2152
- }, Ee = (t) => K(t) && typeof t.decode == "function" && typeof t.encode == "function";
2150
+ const e = un(t);
2151
+ return t.validate ? fn(e, t.validate) : e;
2152
+ }, Ae = (t) => K(t) && typeof t.decode == "function" && typeof t.encode == "function";
2153
2153
  function B(t) {
2154
- return K(t) && Ee(t) && typeof t.encodeStream == "function" && typeof t.decodeStream == "function" && (t.size === void 0 || U(t.size));
2154
+ return K(t) && Ae(t) && typeof t.encodeStream == "function" && typeof t.decodeStream == "function" && (t.size === void 0 || U(t.size));
2155
2155
  }
2156
- function fs() {
2156
+ function ws() {
2157
2157
  return {
2158
2158
  encode: (t) => {
2159
2159
  if (!Array.isArray(t))
@@ -2176,7 +2176,7 @@ function fs() {
2176
2176
  }
2177
2177
  };
2178
2178
  }
2179
- const ps = {
2179
+ const gs = {
2180
2180
  encode: (t) => {
2181
2181
  if (typeof t != "bigint")
2182
2182
  throw new Error(`expected bigint, got ${typeof t}`);
@@ -2190,7 +2190,7 @@ const ps = {
2190
2190
  return BigInt(t);
2191
2191
  }
2192
2192
  };
2193
- function ws(t) {
2193
+ function ms(t) {
2194
2194
  if (!K(t))
2195
2195
  throw new Error("plain object expected");
2196
2196
  return {
@@ -2206,7 +2206,7 @@ function ws(t) {
2206
2206
  }
2207
2207
  };
2208
2208
  }
2209
- function gs(t, e = !1) {
2209
+ function ys(t, e = !1) {
2210
2210
  if (!U(t))
2211
2211
  throw new Error(`decimal/precision: wrong value ${t}`);
2212
2212
  if (typeof e != "boolean")
@@ -2242,11 +2242,11 @@ function gs(t, e = !1) {
2242
2242
  }
2243
2243
  };
2244
2244
  }
2245
- function ms(t) {
2245
+ function Cs(t) {
2246
2246
  if (!Array.isArray(t))
2247
2247
  throw new Error(`expected array, got ${typeof t}`);
2248
2248
  for (const e of t)
2249
- if (!Ee(e))
2249
+ if (!Ae(e))
2250
2250
  throw new Error(`wrong base coder ${e}`);
2251
2251
  return {
2252
2252
  encode: (e) => {
@@ -2267,11 +2267,11 @@ function ms(t) {
2267
2267
  }
2268
2268
  };
2269
2269
  }
2270
- const ys = (t) => {
2271
- if (!Ee(t))
2270
+ const bs = (t) => {
2271
+ if (!Ae(t))
2272
2272
  throw new Error("BaseCoder expected");
2273
2273
  return { encode: t.decode, decode: t.encode };
2274
- }, ne = { dict: fs, numberBigint: ps, tsEnum: ws, decimal: gs, match: ms, reverse: ys }, Cs = (t, e = !1, n = !1, r = !0) => {
2274
+ }, ne = { dict: ws, numberBigint: gs, tsEnum: ms, decimal: ys, match: Cs, reverse: bs }, xs = (t, e = !1, n = !1, r = !0) => {
2275
2275
  if (!U(t))
2276
2276
  throw new Error(`bigint/size: wrong value ${t}`);
2277
2277
  if (typeof e != "boolean")
@@ -2307,10 +2307,10 @@ const ys = (t) => {
2307
2307
  validate: (o) => {
2308
2308
  if (typeof o != "bigint")
2309
2309
  throw new Error(`bigint: invalid value: ${o}`);
2310
- return us(o, 8n * s, !!n), o;
2310
+ return ps(o, 8n * s, !!n), o;
2311
2311
  }
2312
2312
  });
2313
- }, v = /* @__PURE__ */ Cs(8, !0), bs = (t, e) => I({
2313
+ }, v = /* @__PURE__ */ xs(8, !0), ks = (t, e) => I({
2314
2314
  size: t,
2315
2315
  encodeStream: (n, r) => n.writeView(t, (s) => e.write(s, r)),
2316
2316
  decodeStream: (n) => n.readView(t, e.read),
@@ -2319,7 +2319,7 @@ const ys = (t) => {
2319
2319
  throw new Error(`viewCoder: expected number, got ${typeof n}`);
2320
2320
  return e.validate && e.validate(n), n;
2321
2321
  }
2322
- }), fn = (t, e, n) => {
2322
+ }), pn = (t, e, n) => {
2323
2323
  const r = t * 8, s = 2 ** (r - 1), i = (l) => {
2324
2324
  if (!U(l))
2325
2325
  throw new Error(`sintView: value is not safe integer: ${l}`);
@@ -2331,15 +2331,15 @@ const ys = (t) => {
2331
2331
  if (0 > l || l >= o)
2332
2332
  throw new Error(`uintView: value out of bounds. Expected 0 <= ${l} < ${o}`);
2333
2333
  };
2334
- return bs(t, {
2334
+ return ks(t, {
2335
2335
  write: n.write,
2336
2336
  read: n.read,
2337
2337
  validate: e ? i : a
2338
2338
  });
2339
- }, xe = /* @__PURE__ */ fn(4, !1, {
2339
+ }, ke = /* @__PURE__ */ pn(4, !1, {
2340
2340
  read: (t, e) => t.getUint32(e, !0),
2341
2341
  write: (t, e) => t.setUint32(0, e, !0)
2342
- }), T = /* @__PURE__ */ fn(1, !1, {
2342
+ }), T = /* @__PURE__ */ pn(1, !1, {
2343
2343
  read: (t, e) => t.getUint8(e),
2344
2344
  write: (t, e) => t.setUint8(0, e)
2345
2345
  }), Ze = /* @__PURE__ */ I({
@@ -2356,10 +2356,10 @@ const ys = (t) => {
2356
2356
  throw new Error(`bool: invalid value ${t}`);
2357
2357
  return t;
2358
2358
  }
2359
- }), Ae = (t, e = !1) => {
2359
+ }), Se = (t, e = !1) => {
2360
2360
  if (typeof e != "boolean")
2361
2361
  throw new Error(`bytes/le: expected boolean, got ${typeof e}`);
2362
- const n = dn(t), r = j(t);
2362
+ const n = hn(t), r = F(t);
2363
2363
  return I({
2364
2364
  size: typeof t == "number" ? t : void 0,
2365
2365
  encodeStream: (s, i) => {
@@ -2377,20 +2377,20 @@ const ys = (t) => {
2377
2377
  return e ? De(i) : i;
2378
2378
  },
2379
2379
  validate: (s) => {
2380
- if (!j(s))
2380
+ if (!F(s))
2381
2381
  throw new Error(`bytes: invalid value ${s}`);
2382
2382
  return s;
2383
2383
  }
2384
2384
  });
2385
- }, xs = (t, e = !1) => un(ks(Ae(t, e), cs), (n) => {
2385
+ }, vs = (t, e = !1) => fn(Es(Se(t, e), ds), (n) => {
2386
2386
  if (typeof n != "string")
2387
2387
  throw new Error(`expected string, got ${typeof n}`);
2388
2388
  return n;
2389
2389
  });
2390
- function ks(t, e) {
2390
+ function Es(t, e) {
2391
2391
  if (!B(t))
2392
2392
  throw new Error(`apply: invalid inner value ${t}`);
2393
- if (!Ee(e))
2393
+ if (!Ae(e))
2394
2394
  throw new Error(`apply: invalid base value ${t}`);
2395
2395
  return I({
2396
2396
  size: t.size,
@@ -2428,7 +2428,7 @@ function se(t, e, n) {
2428
2428
  }
2429
2429
  });
2430
2430
  }
2431
- function vs(t) {
2431
+ function As(t) {
2432
2432
  return I({
2433
2433
  encodeStream: (e, n) => {
2434
2434
  if (n !== t)
@@ -2437,7 +2437,7 @@ function vs(t) {
2437
2437
  decodeStream: (e) => t
2438
2438
  });
2439
2439
  }
2440
- function Es(t) {
2440
+ function Ss(t) {
2441
2441
  let e = 0;
2442
2442
  for (const n of t) {
2443
2443
  if (n.size === void 0)
@@ -2455,7 +2455,7 @@ function p(t) {
2455
2455
  if (!B(t[e]))
2456
2456
  throw new Error(`struct: field ${e} is not CoderType`);
2457
2457
  return I({
2458
- size: Es(Object.values(t)),
2458
+ size: Ss(Object.values(t)),
2459
2459
  encodeStream: (e, n) => {
2460
2460
  e.pushObj(n, (r) => {
2461
2461
  for (const s in t)
@@ -2479,25 +2479,25 @@ function p(t) {
2479
2479
  function pe(t, e) {
2480
2480
  if (!B(e))
2481
2481
  throw new Error(`array: invalid inner value ${e}`);
2482
- const n = dn(typeof t == "string" ? `../${t}` : t);
2482
+ const n = hn(typeof t == "string" ? `../${t}` : t);
2483
2483
  return I({
2484
2484
  size: typeof t == "number" && e.size ? t * e.size : void 0,
2485
2485
  encodeStream: (r, s) => {
2486
2486
  const i = r;
2487
2487
  i.pushObj(s, (o) => {
2488
- j(t) || n.encodeStream(r, s.length);
2488
+ F(t) || n.encodeStream(r, s.length);
2489
2489
  for (let a = 0; a < s.length; a++)
2490
2490
  o(`${a}`, () => {
2491
2491
  const l = s[a], c = r.pos;
2492
- if (e.encodeStream(r, l), j(t)) {
2492
+ if (e.encodeStream(r, l), F(t)) {
2493
2493
  if (t.length > i.pos - c)
2494
2494
  return;
2495
2495
  const d = i.finish(!1).subarray(c, i.pos);
2496
- if (qe(d.subarray(0, t.length), t))
2496
+ if (Ve(d.subarray(0, t.length), t))
2497
2497
  throw i.err(`array: inner element encoding same as separator. elm=${l} data=${d}`);
2498
2498
  }
2499
2499
  });
2500
- }), j(t) && r.bytes(t);
2500
+ }), F(t) && r.bytes(t);
2501
2501
  },
2502
2502
  decodeStream: (r) => {
2503
2503
  const s = [];
@@ -2505,9 +2505,9 @@ function pe(t, e) {
2505
2505
  if (t === null)
2506
2506
  for (let o = 0; !r.isEnd() && (i(`${o}`, () => s.push(e.decodeStream(r))), !(e.size && r.leftBytes < e.size)); o++)
2507
2507
  ;
2508
- else if (j(t))
2508
+ else if (F(t))
2509
2509
  for (let o = 0; ; o++) {
2510
- if (qe(r.bytes(t.length, !0), t)) {
2510
+ if (Ve(r.bytes(t.length, !0), t)) {
2511
2511
  r.bytes(t.length);
2512
2512
  break;
2513
2513
  }
@@ -2554,7 +2554,7 @@ function at(t, e) {
2554
2554
  }
2555
2555
  });
2556
2556
  }
2557
- function As(t, e) {
2557
+ function $s(t, e) {
2558
2558
  if (!B(t))
2559
2559
  throw new Error(`tag: invalid tag value ${t}`);
2560
2560
  if (!K(e))
@@ -2582,34 +2582,34 @@ function As(t, e) {
2582
2582
  }
2583
2583
  });
2584
2584
  }
2585
- const Ss = (t) => 0;
2586
- function Pe(t, e) {
2585
+ const Ls = (t) => 0;
2586
+ function Te(t, e) {
2587
2587
  return e % t === 0 ? 0 : t - e % t;
2588
2588
  }
2589
- function pn(t, e, n) {
2589
+ function wn(t, e, n) {
2590
2590
  if (!B(e))
2591
2591
  throw new Error(`padRight: invalid inner value ${e}`);
2592
2592
  if (!U(t) || t <= 0)
2593
2593
  throw new Error(`padLeft: wrong blockSize=${t}`);
2594
2594
  if (n !== void 0 && typeof n != "function")
2595
2595
  throw new Error(`padRight: wrong padFn=${typeof n}`);
2596
- const r = n || Ss;
2596
+ const r = n || Ls;
2597
2597
  return I({
2598
- size: e.size ? e.size + Pe(t, e.size) : void 0,
2598
+ size: e.size ? e.size + Te(t, e.size) : void 0,
2599
2599
  encodeStream: (s, i) => {
2600
2600
  const o = s, a = o.pos;
2601
2601
  e.encodeStream(s, i);
2602
- const l = Pe(t, o.pos - a);
2602
+ const l = Te(t, o.pos - a);
2603
2603
  for (let c = 0; c < l; c++)
2604
2604
  s.byte(r(c));
2605
2605
  },
2606
2606
  decodeStream: (s) => {
2607
2607
  const i = s.pos, o = e.decodeStream(s);
2608
- return s.bytes(Pe(t, s.pos - i)), o;
2608
+ return s.bytes(Te(t, s.pos - i)), o;
2609
2609
  }
2610
2610
  });
2611
2611
  }
2612
- const $s = 9, Te = ne.decimal($s), re = I({
2612
+ const _s = 9, Ne = ne.decimal(_s), re = I({
2613
2613
  encodeStream: (t, e) => {
2614
2614
  if (!e)
2615
2615
  return t.byte(0);
@@ -2625,31 +2625,31 @@ const $s = 9, Te = ne.decimal($s), re = I({
2625
2625
  }
2626
2626
  return e;
2627
2627
  }
2628
- }), fe = xs(pn(8, xe, void 0)), Ls = () => {
2629
- const t = Ae(32);
2628
+ }), fe = vs(wn(8, ke, void 0)), Is = () => {
2629
+ const t = Se(32);
2630
2630
  return I({
2631
2631
  size: t.size,
2632
- encodeStream: (e, n) => t.encodeStream(e, Ve.decode(n)),
2633
- decodeStream: (e) => Ve.encode(t.decodeStream(e))
2632
+ encodeStream: (e, n) => t.encodeStream(e, qe.decode(n)),
2633
+ decodeStream: (e) => qe.encode(t.decodeStream(e))
2634
2634
  });
2635
- }, C = Ls(), _s = p({
2635
+ }, C = Is(), Ps = p({
2636
2636
  requiredSignatures: T,
2637
2637
  readSigned: T,
2638
2638
  readUnsigned: T,
2639
2639
  keys: pe(re, C),
2640
2640
  blockhash: C,
2641
- instructions: pe(re, p({ programIdx: T, keys: pe(re, T), data: Ae(re) }))
2641
+ instructions: pe(re, p({ programIdx: T, keys: pe(re, T), data: Se(re) }))
2642
2642
  });
2643
- function Is(t) {
2644
- if (Ve.decode(t).length !== 32)
2643
+ function Ts(t) {
2644
+ if (qe.decode(t).length !== 32)
2645
2645
  throw new Error("Invalid Solana address");
2646
2646
  }
2647
- const Ps = (t, e, n, r, s) => ({
2647
+ const Ns = (t, e, n, r, s) => ({
2648
2648
  sign: t < e,
2649
2649
  write: t < e - n || t >= e && t < s - r
2650
2650
  }), $t = p({
2651
- signatures: pe(re, Ae(64)),
2652
- msg: _s
2651
+ signatures: pe(re, Se(64)),
2652
+ msg: Ps
2653
2653
  }), Ke = I({
2654
2654
  encodeStream: (t, e) => {
2655
2655
  const { msg: n, signatures: r } = e, s = {}, i = (h, u, f) => {
@@ -2702,7 +2702,7 @@ const Ps = (t, e, n, r, s) => ({
2702
2702
  for (let i = 0; i < n.keys.length; i++)
2703
2703
  s.push({
2704
2704
  address: n.keys[i],
2705
- ...Ps(i, n.requiredSignatures, n.readSigned, n.readUnsigned, n.keys.length)
2705
+ ...Ns(i, n.requiredSignatures, n.readSigned, n.readUnsigned, n.keys.length)
2706
2706
  });
2707
2707
  if (!s.length)
2708
2708
  throw new Error("SOL.tx: empty accounts array");
@@ -2723,7 +2723,7 @@ const Ps = (t, e, n, r, s) => ({
2723
2723
  function ct(t, e, n) {
2724
2724
  if (Lt[t])
2725
2725
  throw new Error("SOL: program for this address already defined");
2726
- const r = at(e, Object.keys(n).reduce((a, l, c) => ({ ...a, [l]: c }), {})), s = Object.keys(n).reduce((a, l) => ({ ...a, [l]: n[l].coder }), {}), i = As(r, s);
2726
+ const r = at(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);
2727
2727
  Lt[t] = (a, l) => {
2728
2728
  if (a.program !== t)
2729
2729
  throw new Error("SOL.parseInstruction: Wrong instruction program address");
@@ -2748,19 +2748,19 @@ function ct(t, e, n) {
2748
2748
  data: i.encode({ TAG: a, data: l }),
2749
2749
  keys: Object.keys(n[a].keys).map((c) => {
2750
2750
  let { sign: d, write: h, address: u } = n[a].keys[c];
2751
- return u || (u = l[c]), Is(u), { address: u, sign: d, write: h };
2751
+ return u || (u = l[c]), Ts(u), { address: u, sign: d, write: h };
2752
2752
  })
2753
2753
  });
2754
2754
  return o;
2755
2755
  }
2756
- const Ne = "SysvarRecentB1ockHashes11111111111111111111", q = "SysvarRent111111111111111111111111111111111", wn = "11111111111111111111111111111111", gn = ct(wn, xe, {
2756
+ const Be = "SysvarRecentB1ockHashes11111111111111111111", V = "SysvarRent111111111111111111111111111111111", gn = "11111111111111111111111111111111", mn = ct(gn, ke, {
2757
2757
  createAccount: {
2758
2758
  coder: p({ lamports: v, space: v, owner: C }),
2759
2759
  keys: {
2760
2760
  source: { sign: !0, write: !0 },
2761
2761
  newAccount: { sign: !0, write: !0 }
2762
2762
  },
2763
- hint: (t) => `Create new account=${t.newAccount} with balance of ${Te.encode(t.lamports)} and owner program ${t.owner}, using funding account ${t.source}`
2763
+ hint: (t) => `Create new account=${t.newAccount} with balance of ${Ne.encode(t.lamports)} and owner program ${t.owner}, using funding account ${t.source}`
2764
2764
  },
2765
2765
  assign: {
2766
2766
  coder: p({ owner: C }),
@@ -2770,7 +2770,7 @@ const Ne = "SysvarRecentB1ockHashes11111111111111111111", q = "SysvarRent1111111
2770
2770
  transfer: {
2771
2771
  coder: p({ lamports: v }),
2772
2772
  keys: { source: { sign: !0, write: !0 }, destination: { sign: !1, write: !0 } },
2773
- hint: (t) => `Transfer ${Te.encode(t.lamports)} SOL from ${t.source} to ${t.destination}`
2773
+ hint: (t) => `Transfer ${Ne.encode(t.lamports)} SOL from ${t.source} to ${t.destination}`
2774
2774
  },
2775
2775
  createAccountWithSeed: {
2776
2776
  coder: p({
@@ -2790,7 +2790,7 @@ const Ne = "SysvarRecentB1ockHashes11111111111111111111", q = "SysvarRent1111111
2790
2790
  coder: p({}),
2791
2791
  keys: {
2792
2792
  nonceAccount: { sign: !1, write: !0 },
2793
- _recent_bh: { address: Ne, sign: !1, write: !1 },
2793
+ _recent_bh: { address: Be, sign: !1, write: !1 },
2794
2794
  nonceAuthority: { sign: !0, write: !1 }
2795
2795
  },
2796
2796
  hint: (t) => `Consume nonce in nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority})`
@@ -2800,18 +2800,18 @@ const Ne = "SysvarRecentB1ockHashes11111111111111111111", q = "SysvarRent1111111
2800
2800
  keys: {
2801
2801
  nonceAccount: { sign: !1, write: !0 },
2802
2802
  destination: { sign: !1, write: !0 },
2803
- _recent_bh: { address: Ne, sign: !1, write: !1 },
2804
- _rent: { address: q, sign: !1, write: !1 },
2803
+ _recent_bh: { address: Be, sign: !1, write: !1 },
2804
+ _rent: { address: V, sign: !1, write: !1 },
2805
2805
  nonceAuthority: { sign: !0, write: !1 }
2806
2806
  },
2807
- hint: (t) => `Withdraw ${Te.encode(t.lamports)} SOL from nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority}) to ${t.destination}`
2807
+ hint: (t) => `Withdraw ${Ne.encode(t.lamports)} SOL from nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority}) to ${t.destination}`
2808
2808
  },
2809
2809
  initializeNonce: {
2810
2810
  coder: p({ nonceAuthority: C }),
2811
2811
  keys: {
2812
2812
  nonceAccount: { sign: !1, write: !0 },
2813
- _recent_bh: { address: Ne, sign: !1, write: !1 },
2814
- _rent: { address: q, sign: !1, write: !1 }
2813
+ _recent_bh: { address: Be, sign: !1, write: !1 },
2814
+ _rent: { address: V, sign: !1, write: !1 }
2815
2815
  }
2816
2816
  },
2817
2817
  authorizeNonce: {
@@ -2863,17 +2863,17 @@ const Ne = "SysvarRecentB1ockHashes11111111111111111111", q = "SysvarRent1111111
2863
2863
  destination: { sign: !1, write: !0 }
2864
2864
  }
2865
2865
  }
2866
- }), mn = (t) => {
2866
+ }), yn = (t) => {
2867
2867
  };
2868
- mn(gn.transfer);
2869
- mn(gn.advanceNonce);
2870
- const Ts = at(T, {
2868
+ yn(mn.transfer);
2869
+ yn(mn.advanceNonce);
2870
+ const Bs = at(T, {
2871
2871
  MintTokens: 0,
2872
2872
  FreezeAccount: 1,
2873
2873
  AccountOwner: 2,
2874
2874
  CloseAccount: 3
2875
- }), W = (t, e) => e[t]?.symbol || t, yn = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
2876
- ct(yn, T, {
2875
+ }), W = (t, e) => e[t]?.symbol || t, Cn = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
2876
+ ct(Cn, T, {
2877
2877
  initializeMint: {
2878
2878
  coder: p({
2879
2879
  decimals: T,
@@ -2882,7 +2882,7 @@ ct(yn, T, {
2882
2882
  }),
2883
2883
  keys: {
2884
2884
  mint: { sign: !1, write: !0 },
2885
- _rent: { address: q, sign: !1, write: !1 }
2885
+ _rent: { address: V, sign: !1, write: !1 }
2886
2886
  }
2887
2887
  },
2888
2888
  initializeAccount: {
@@ -2891,7 +2891,7 @@ ct(yn, T, {
2891
2891
  account: { sign: !1, write: !0 },
2892
2892
  mint: { sign: !1, write: !1 },
2893
2893
  owner: { sign: !1, write: !1 },
2894
- _rent: { address: q, sign: !1, write: !1 }
2894
+ _rent: { address: V, sign: !1, write: !1 }
2895
2895
  },
2896
2896
  hint: (t, e) => `Initialize token account=${t.account} with owner=${t.owner} token=${W(t.mint, e)}`
2897
2897
  },
@@ -2900,7 +2900,7 @@ ct(yn, T, {
2900
2900
  coder: p({ m: T }),
2901
2901
  keys: {
2902
2902
  account: { sign: !1, write: !0 },
2903
- _rent: { address: q, sign: !1, write: !1 }
2903
+ _rent: { address: V, sign: !1, write: !1 }
2904
2904
  },
2905
2905
  hint: (t, e) => `Initialize multi-sig token account=${t.account} with signatures=${t.m}`
2906
2906
  },
@@ -2932,7 +2932,7 @@ ct(yn, T, {
2932
2932
  },
2933
2933
  setAuthority: {
2934
2934
  coder: p({
2935
- authorityType: Ts,
2935
+ authorityType: Bs,
2936
2936
  newAuthority: se(Ze, C, "11111111111111111111111111111111")
2937
2937
  }),
2938
2938
  keys: {
@@ -3028,7 +3028,7 @@ ct(yn, T, {
3028
3028
  keys: {
3029
3029
  account: { sign: !1, write: !0 },
3030
3030
  mint: { sign: !1, write: !1 },
3031
- _rent: { address: q, sign: !1, write: !1 }
3031
+ _rent: { address: V, sign: !1, write: !1 }
3032
3032
  },
3033
3033
  hint: (t, e) => `Initialize token account=${t.account} with owner=${t.owner} token=${W(t.mint, e)}`
3034
3034
  },
@@ -3039,14 +3039,14 @@ ct(yn, T, {
3039
3039
  }
3040
3040
  });
3041
3041
  p({
3042
- version: xe,
3043
- state: xe,
3042
+ version: ke,
3043
+ state: ke,
3044
3044
  authority: C,
3045
3045
  nonce: C,
3046
3046
  lamportPerSignature: v
3047
3047
  });
3048
- const Ns = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
3049
- ct(Ns, vs(0), {
3048
+ const Us = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
3049
+ ct(Us, As(0), {
3050
3050
  create: {
3051
3051
  coder: p({}),
3052
3052
  keys: {
@@ -3054,37 +3054,37 @@ ct(Ns, vs(0), {
3054
3054
  account: { sign: !1, write: !0 },
3055
3055
  wallet: { sign: !1, write: !1 },
3056
3056
  mint: { sign: !1, write: !1 },
3057
- _sys: { address: wn, sign: !1, write: !1 },
3058
- _token: { address: yn, sign: !1, write: !1 },
3059
- _rent: { address: q, sign: !1, write: !1 }
3057
+ _sys: { address: gn, sign: !1, write: !1 },
3058
+ _token: { address: Cn, sign: !1, write: !1 },
3059
+ _rent: { address: V, sign: !1, write: !1 }
3060
3060
  },
3061
3061
  hint: (t, e) => `Initialize associated token account=${t.account} with owner=${t.wallet} for token=${W(t.mint, e)}, payed by ${t.source}`
3062
3062
  }
3063
3063
  });
3064
- const Be = pn(4, Ze, () => 0);
3064
+ const Ue = wn(4, Ze, () => 0);
3065
3065
  p({
3066
3066
  mint: C,
3067
3067
  owner: C,
3068
3068
  amount: v,
3069
- delegate: se(Be, C, "11111111111111111111111111111111"),
3069
+ delegate: se(Ue, C, "11111111111111111111111111111111"),
3070
3070
  state: at(T, {
3071
3071
  uninitialized: 0,
3072
3072
  initialized: 1,
3073
3073
  frozen: 2
3074
3074
  }),
3075
- isNative: se(Be, v, 0n),
3075
+ isNative: se(Ue, v, 0n),
3076
3076
  delegateAmount: v,
3077
- closeAuthority: se(Be, C, "11111111111111111111111111111111")
3077
+ closeAuthority: se(Ue, C, "11111111111111111111111111111111")
3078
3078
  });
3079
3079
  function _t(t, e, n) {
3080
3080
  if (!e.length)
3081
3081
  throw new Error("SOLPublic: empty instructions array");
3082
- return os.encode(Ke.encode({
3082
+ return cs.encode(Ke.encode({
3083
3083
  msg: { feePayer: t, blockhash: n, instructions: e },
3084
3084
  signatures: {}
3085
3085
  }));
3086
3086
  }
3087
- function Bs(t) {
3087
+ function Ms(t) {
3088
3088
  if (t.length >= 255)
3089
3089
  throw new TypeError("Alphabet too long");
3090
3090
  const e = new Uint8Array(256);
@@ -3167,8 +3167,8 @@ function Bs(t) {
3167
3167
  decode: l
3168
3168
  };
3169
3169
  }
3170
- var Us = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
3171
- Bs(Us);
3170
+ var Rs = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
3171
+ Ms(Rs);
3172
3172
  class lt {
3173
3173
  _transaction;
3174
3174
  signatures = [];
@@ -3208,7 +3208,7 @@ class lt {
3208
3208
  return Buffer.from(e, "hex");
3209
3209
  }
3210
3210
  }
3211
- class Ms {
3211
+ class Os {
3212
3212
  type = "phantom";
3213
3213
  platform = "solana";
3214
3214
  account = void 0;
@@ -3318,17 +3318,17 @@ class Ms {
3318
3318
  };
3319
3319
  }
3320
3320
  }
3321
- class Rs extends ve {
3321
+ class zs extends Ee {
3322
3322
  type = "phantom-evm";
3323
3323
  rdns = "app.phantom";
3324
3324
  displayName = "Phantom";
3325
3325
  }
3326
- class Os extends ve {
3326
+ class js extends Ee {
3327
3327
  type = "rabby";
3328
3328
  rdns = "io.rabby";
3329
3329
  displayName = "Rabby";
3330
3330
  }
3331
- class zs {
3331
+ class Fs {
3332
3332
  type = "braavos";
3333
3333
  platform = "starknet";
3334
3334
  wallet = void 0;
@@ -3462,24 +3462,24 @@ class zs {
3462
3462
  this.removeAccountChangeListener(), this.wallet = void 0, this.account = void 0, this.connectedAccounts = [];
3463
3463
  }
3464
3464
  }
3465
- class Fs {
3465
+ class Hs {
3466
3466
  walletAdapters;
3467
3467
  constructor() {
3468
3468
  if (this.walletAdapters = /* @__PURE__ */ new Map(), typeof window > "u")
3469
3469
  return;
3470
- const e = new es();
3470
+ const e = new ns();
3471
3471
  this.walletAdapters.set("metamask", e);
3472
- const n = new Ms();
3472
+ const n = new Os();
3473
3473
  this.walletAdapters.set("phantom", n);
3474
- const r = new Rs();
3474
+ const r = new zs();
3475
3475
  this.walletAdapters.set("phantom-evm", r);
3476
- const s = new Xr();
3476
+ const s = new Yr();
3477
3477
  this.walletAdapters.set("argent", s);
3478
- const i = new zs();
3478
+ const i = new Fs();
3479
3479
  this.walletAdapters.set("braavos", i);
3480
- const o = new Os();
3480
+ const o = new js();
3481
3481
  this.walletAdapters.set("rabby", o);
3482
- const a = new Qr();
3482
+ const a = new ts();
3483
3483
  this.walletAdapters.set("base", a), window.wallet_bridge = this;
3484
3484
  }
3485
3485
  getIFrameMethods() {
@@ -3633,8 +3633,8 @@ class Fs {
3633
3633
  }
3634
3634
  }
3635
3635
  }
3636
- const js = 200;
3637
- class Hs extends Or {
3636
+ const Ws = 200;
3637
+ class qs extends jr {
3638
3638
  walletBridge;
3639
3639
  onStarterpackPlay;
3640
3640
  constructor({
@@ -3659,7 +3659,7 @@ class Hs extends Or {
3659
3659
  ...g
3660
3660
  }) {
3661
3661
  let A;
3662
- const m = new URL(e ?? Nt), X = new Fs();
3662
+ const m = new URL(e ?? Nt), X = new Hs();
3663
3663
  P && m.searchParams.set("propagate_error", "true"), x && m.searchParams.set("error_display_mode", x), r && m.searchParams.set("v", encodeURIComponent(r)), s && m.searchParams.set("ps", encodeURIComponent(s)), i && m.searchParams.set("ns", encodeURIComponent(i)), o?.erc20 && m.searchParams.set(
3664
3664
  "erc20",
3665
3665
  encodeURIComponent(o.erc20.toString())
@@ -3675,22 +3675,22 @@ class Hs extends Or {
3675
3675
  methods: {
3676
3676
  ...X.getIFrameMethods(),
3677
3677
  // Expose callback for keychain to notify parent that session was created and storage access granted
3678
- onSessionCreated: (F) => () => w?.(),
3679
- onStarterpackPlay: (F) => async () => {
3678
+ onSessionCreated: (j) => () => w?.(),
3679
+ onStarterpackPlay: (j) => async () => {
3680
3680
  A && await A();
3681
3681
  }
3682
3682
  }
3683
3683
  }), this.walletBridge = X, this.onStarterpackPlay = b, A = async () => {
3684
3684
  this.close();
3685
- const F = this.onStarterpackPlay;
3686
- if (this.onStarterpackPlay = void 0, !!F) {
3685
+ const j = this.onStarterpackPlay;
3686
+ if (this.onStarterpackPlay = void 0, !!j) {
3687
3687
  await new Promise(
3688
- (Se) => setTimeout(Se, js)
3688
+ ($e) => setTimeout($e, Ws)
3689
3689
  );
3690
3690
  try {
3691
- F();
3692
- } catch (Se) {
3693
- console.error("Failed to run starterpack play callback:", Se);
3691
+ j();
3692
+ } catch ($e) {
3693
+ console.error("Failed to run starterpack play callback:", $e);
3694
3694
  }
3695
3695
  }
3696
3696
  }, typeof window < "u" && (window.external_wallets = this.walletBridge);
@@ -3702,7 +3702,140 @@ class Hs extends Or {
3702
3702
  this.onStarterpackPlay = e;
3703
3703
  }
3704
3704
  }
3705
- function Ws(t) {
3705
+ const Y = /* @__PURE__ */ new Map(), Vs = `${Bt}/query`;
3706
+ async function bn(t) {
3707
+ if (!t.addresses?.length && !t.usernames?.length)
3708
+ return { results: [] };
3709
+ const e = await fetch(`${Bt}/lookup`, {
3710
+ method: "POST",
3711
+ headers: {
3712
+ "Content-Type": "application/json"
3713
+ },
3714
+ body: JSON.stringify(t)
3715
+ });
3716
+ if (!e.ok)
3717
+ throw new Error(`HTTP error! status: ${e.status}`);
3718
+ return e.json();
3719
+ }
3720
+ async function Ds(t) {
3721
+ const e = await fetch(Vs, {
3722
+ method: "POST",
3723
+ headers: {
3724
+ "Content-Type": "application/json"
3725
+ },
3726
+ body: JSON.stringify({
3727
+ query: `
3728
+ query LookupSigners($username: String!) {
3729
+ account(username: $username) {
3730
+ username
3731
+ controllers(first: 1) {
3732
+ edges {
3733
+ node {
3734
+ signers {
3735
+ isOriginal
3736
+ isRevoked
3737
+ metadata {
3738
+ __typename
3739
+ ... on Eip191Credentials {
3740
+ eip191 {
3741
+ provider
3742
+ ethAddress
3743
+ }
3744
+ }
3745
+ }
3746
+ }
3747
+ }
3748
+ }
3749
+ }
3750
+ }
3751
+ }
3752
+ `,
3753
+ variables: { username: t }
3754
+ })
3755
+ });
3756
+ if (!e.ok)
3757
+ throw new Error(`HTTP error! status: ${e.status}`);
3758
+ return e.json();
3759
+ }
3760
+ function Zs(t) {
3761
+ const e = t.toLowerCase();
3762
+ if (xn.includes(e))
3763
+ return e;
3764
+ }
3765
+ const xn = [
3766
+ "google",
3767
+ "webauthn",
3768
+ "discord",
3769
+ "walletconnect",
3770
+ "password",
3771
+ "metamask",
3772
+ "rabby",
3773
+ "phantom-evm"
3774
+ ].filter((t) => $n.includes(t));
3775
+ function Ks(t, e) {
3776
+ if (!t || t.length === 0)
3777
+ return [];
3778
+ const n = e === we.StarknetChainId.SN_MAIN, r = t.filter(
3779
+ (i) => !i.isRevoked && (n || i.isOriginal)
3780
+ ), s = /* @__PURE__ */ new Set();
3781
+ for (const i of r)
3782
+ switch (i.metadata.__typename) {
3783
+ case "WebauthnCredentials":
3784
+ s.add("webauthn");
3785
+ break;
3786
+ case "PasswordCredentials":
3787
+ s.add("password");
3788
+ break;
3789
+ case "Eip191Credentials":
3790
+ i.metadata.eip191?.forEach((o) => {
3791
+ const a = Zs(o.provider);
3792
+ a && s.add(a);
3793
+ });
3794
+ break;
3795
+ }
3796
+ return xn.filter((i) => s.has(i));
3797
+ }
3798
+ async function Xs(t, e) {
3799
+ const n = await Ds(t);
3800
+ if (n.errors?.length)
3801
+ throw new Error(n.errors[0].message || "Lookup query failed");
3802
+ const r = n.data?.account;
3803
+ if (!r)
3804
+ return {
3805
+ username: t,
3806
+ exists: !1,
3807
+ signers: []
3808
+ };
3809
+ const s = r.controllers?.edges?.[0]?.node, i = Ks(
3810
+ s?.signers ?? void 0,
3811
+ e
3812
+ );
3813
+ return {
3814
+ username: r.username,
3815
+ exists: !0,
3816
+ signers: i
3817
+ };
3818
+ }
3819
+ async function Si(t) {
3820
+ const e = t.filter((n) => !Y.has(n));
3821
+ return e.length > 0 && (await bn({ usernames: e })).results.forEach((r) => {
3822
+ Y.set(r.username, r.addresses[0]);
3823
+ }), new Map(
3824
+ t.map((n) => [n, Y.get(n)]).filter((n) => n[1] !== void 0)
3825
+ );
3826
+ }
3827
+ async function $i(t) {
3828
+ t = t.map(Tt.toHex);
3829
+ const e = t.filter((n) => !Y.has(n));
3830
+ return e.length > 0 && (await bn({
3831
+ addresses: e
3832
+ })).results.forEach((r) => {
3833
+ Y.set(r.addresses[0], r.username);
3834
+ }), new Map(
3835
+ t.map((n) => [n, Y.get(n)]).filter((n) => n[1] !== void 0)
3836
+ );
3837
+ }
3838
+ function Gs(t) {
3706
3839
  if (!t || t.trim() === "")
3707
3840
  return { isValid: !1, error: "Redirect URL is empty" };
3708
3841
  let e;
@@ -3734,7 +3867,7 @@ function Ws(t) {
3734
3867
  }
3735
3868
  return { isValid: !0 };
3736
3869
  }
3737
- class Ci extends An {
3870
+ class Li extends Ln {
3738
3871
  keychain;
3739
3872
  options;
3740
3873
  iframes;
@@ -3750,7 +3883,7 @@ class Ci extends An {
3750
3883
  const r = [...[
3751
3884
  { rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia/rpc/v0_9" },
3752
3885
  { rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet/rpc/v0_9" }
3753
- ], ...e.chains || []], s = e.defaultChainId || Ue.StarknetChainId.SN_MAIN;
3886
+ ], ...e.chains || []], s = e.defaultChainId || we.StarknetChainId.SN_MAIN;
3754
3887
  this.selectedChain = s, this.chains = /* @__PURE__ */ new Map();
3755
3888
  const i = typeof window < "u" ? new URLSearchParams(window.location.search) : null;
3756
3889
  if (this.referral = {
@@ -3807,7 +3940,7 @@ class Ci extends An {
3807
3940
  }
3808
3941
  const e = await this.keychain.probe(this.rpcUrl());
3809
3942
  let n = e?.rpcUrl || this.rpcUrl();
3810
- this.account = new $e(
3943
+ this.account = new Le(
3811
3944
  this,
3812
3945
  n,
3813
3946
  e.address,
@@ -3853,7 +3986,7 @@ class Ci extends An {
3853
3986
  throw new he(
3854
3987
  "Headless authentication failed"
3855
3988
  );
3856
- return this.account = new $e(
3989
+ return this.account = new Le(
3857
3990
  this,
3858
3991
  this.rpcUrl(),
3859
3992
  a,
@@ -3869,7 +4002,7 @@ class Ci extends An {
3869
4002
  });
3870
4003
  if (i.code !== O.SUCCESS)
3871
4004
  throw new Error(i.message);
3872
- return i = i, this.account = new $e(
4005
+ return i = i, this.account = new Le(
3873
4006
  this,
3874
4007
  this.rpcUrl(),
3875
4008
  i.address,
@@ -3997,6 +4130,12 @@ class Ci extends An {
3997
4130
  }
3998
4131
  return this.keychain.username();
3999
4132
  }
4133
+ async lookupUsername(e) {
4134
+ const n = e.trim();
4135
+ if (!n)
4136
+ throw new Error("Username is required");
4137
+ return Xs(n, this.selectedChain);
4138
+ }
4000
4139
  openPurchaseCredits() {
4001
4140
  if (this.iframes) {
4002
4141
  if (!this.keychain || !this.iframes.keychain) {
@@ -4046,7 +4185,7 @@ class Ci extends An {
4046
4185
  typeof window < "u" && console.warn(
4047
4186
  "Casting Controller to WalletWithStarknetFeatures is an experimental feature. Please report any issues at https://github.com/cartridge-gg/controller/issues"
4048
4187
  );
4049
- const e = this, n = new ur(e), r = {
4188
+ const e = this, n = new pr(e), r = {
4050
4189
  "standard:disconnect": {
4051
4190
  version: "1.0.0",
4052
4191
  disconnect: async () => {
@@ -4085,7 +4224,7 @@ class Ci extends An {
4085
4224
  console.error("open can only be called in browser context");
4086
4225
  return;
4087
4226
  }
4088
- const n = new URL(this.options.url || Nt), r = e.redirectUrl || window.location.href, s = Ws(r);
4227
+ const n = new URL(this.options.url || Nt), r = e.redirectUrl || window.location.href, s = Gs(r);
4089
4228
  if (!s.isValid) {
4090
4229
  console.error(
4091
4230
  `Invalid redirect URL: ${s.error}`,
@@ -4101,7 +4240,7 @@ class Ci extends An {
4101
4240
  initializeChains(e) {
4102
4241
  for (const n of e)
4103
4242
  try {
4104
- const r = new URL(n.rpcUrl), s = Sn(r);
4243
+ const r = new URL(n.rpcUrl), s = _n(r);
4105
4244
  this.chains.set(s, n);
4106
4245
  } catch (r) {
4107
4246
  throw console.error(`Failed to parse chainId for ${n.rpcUrl}:`, r), r;
@@ -4113,7 +4252,7 @@ class Ci extends An {
4113
4252
  createKeychainIframe() {
4114
4253
  const e = typeof window < "u" && typeof sessionStorage < "u" && sessionStorage.getItem("controller_standalone") === "1", r = (typeof window < "u" ? new URLSearchParams(window.location.search) : void 0)?.get("username") ?? void 0, s = this.encryptedBlob;
4115
4254
  e && sessionStorage.removeItem("controller_standalone"), s && (this.encryptedBlob = void 0);
4116
- const i = new Hs({
4255
+ const i = new qs({
4117
4256
  ...this.options,
4118
4257
  rpcUrl: this.rpcUrl(),
4119
4258
  onClose: () => {
@@ -4122,7 +4261,7 @@ class Ci extends An {
4122
4261
  onConnect: (o) => {
4123
4262
  this.keychain = o;
4124
4263
  },
4125
- version: $n,
4264
+ version: In,
4126
4265
  ref: this.referral.ref,
4127
4266
  refGroup: this.referral.refGroup,
4128
4267
  needsSessionCreation: e,
@@ -4152,41 +4291,7 @@ class Ci extends An {
4152
4291
  });
4153
4292
  }
4154
4293
  }
4155
- const Y = /* @__PURE__ */ new Map();
4156
- async function Cn(t) {
4157
- if (!t.addresses?.length && !t.usernames?.length)
4158
- return { results: [] };
4159
- const e = await fetch(`${Ln}/lookup`, {
4160
- method: "POST",
4161
- headers: {
4162
- "Content-Type": "application/json"
4163
- },
4164
- body: JSON.stringify(t)
4165
- });
4166
- if (!e.ok)
4167
- throw new Error(`HTTP error! status: ${e.status}`);
4168
- return e.json();
4169
- }
4170
- async function bi(t) {
4171
- const e = t.filter((n) => !Y.has(n));
4172
- return e.length > 0 && (await Cn({ usernames: e })).results.forEach((r) => {
4173
- Y.set(r.username, r.addresses[0]);
4174
- }), new Map(
4175
- t.map((n) => [n, Y.get(n)]).filter((n) => n[1] !== void 0)
4176
- );
4177
- }
4178
- async function xi(t) {
4179
- t = t.map(Tt.toHex);
4180
- const e = t.filter((n) => !Y.has(n));
4181
- return e.length > 0 && (await Cn({
4182
- addresses: e
4183
- })).results.forEach((r) => {
4184
- Y.set(r.addresses[0], r.username);
4185
- }), new Map(
4186
- t.map((n) => [n, Y.get(n)]).filter((n) => n[1] !== void 0)
4187
- );
4188
- }
4189
- const k = "cartridge-toast-container", Vs = 3e3, qs = "bottom-right", bn = "cartridge-toast-show";
4294
+ const k = "cartridge-toast-container", Ys = 3e3, Js = "bottom-right", kn = "cartridge-toast-show";
4190
4295
  function dt() {
4191
4296
  try {
4192
4297
  return typeof window < "u" && window.self !== window.top;
@@ -4194,7 +4299,7 @@ function dt() {
4194
4299
  return !0;
4195
4300
  }
4196
4301
  }
4197
- function Ds() {
4302
+ function Qs() {
4198
4303
  if (typeof document > "u")
4199
4304
  return null;
4200
4305
  if (dt())
@@ -4206,22 +4311,22 @@ function Ds() {
4206
4311
  }
4207
4312
  return document;
4208
4313
  }
4209
- function Zs(t, e) {
4314
+ function ei(t, e) {
4210
4315
  let n = t.getElementById(k);
4211
4316
  return n || (n = t.createElement("div"), n.id = k, t.body && t.body.appendChild(n)), n.className = e, n;
4212
4317
  }
4213
- function Ks(t) {
4318
+ function ti(t) {
4214
4319
  t.classList.add("closing"), setTimeout(() => {
4215
4320
  t.parentNode && t.parentNode.removeChild(t);
4216
4321
  }, 200);
4217
4322
  }
4218
- function Xs(t) {
4323
+ function ni(t) {
4219
4324
  if (t.getElementById("cartridge-toast-styles"))
4220
4325
  return;
4221
4326
  const e = t.createElement("style");
4222
- e.id = "cartridge-toast-styles", e.textContent = Gs(), t.head.appendChild(e);
4327
+ e.id = "cartridge-toast-styles", e.textContent = ri(), t.head.appendChild(e);
4223
4328
  }
4224
- function Gs() {
4329
+ function ri() {
4225
4330
  return `
4226
4331
  #${k} {
4227
4332
  position: fixed;
@@ -4397,7 +4502,7 @@ const de = (t = !1) => {
4397
4502
  }
4398
4503
  return e.appendChild(n), e;
4399
4504
  };
4400
- function Ys(t) {
4505
+ function si(t) {
4401
4506
  if (t.getElementById("cartridge-toast-error-styles"))
4402
4507
  return;
4403
4508
  const e = t.createElement("style");
@@ -4471,7 +4576,7 @@ function Ys(t) {
4471
4576
  }
4472
4577
  `, t.head.appendChild(e);
4473
4578
  }
4474
- function Js(t) {
4579
+ function ii(t) {
4475
4580
  const e = document.createElement("div");
4476
4581
  e.className = "cartridge-toast error";
4477
4582
  const n = document.createElement("div");
@@ -4491,7 +4596,7 @@ function Js(t) {
4491
4596
  const a = de(!0);
4492
4597
  return o.appendChild(a), e.appendChild(o), e;
4493
4598
  }
4494
- function Qs(t) {
4599
+ function oi(t) {
4495
4600
  if (t.getElementById("cartridge-toast-transaction-styles"))
4496
4601
  return;
4497
4602
  const e = t.createElement("style");
@@ -4628,7 +4733,7 @@ function Qs(t) {
4628
4733
  }
4629
4734
  `, t.head.appendChild(e);
4630
4735
  }
4631
- function ei(t) {
4736
+ function ai(t) {
4632
4737
  const e = document.createElement("div");
4633
4738
  if (e.className = `cartridge-toast transaction ${t.isExpanded ? "expanded" : "collapsed"}`, t.isExpanded) {
4634
4739
  const n = document.createElement("div");
@@ -4683,7 +4788,7 @@ function ei(t) {
4683
4788
  }
4684
4789
  return e;
4685
4790
  }
4686
- function ti(t) {
4791
+ function ci(t) {
4687
4792
  if (t.getElementById("cartridge-toast-network-switch-styles"))
4688
4793
  return;
4689
4794
  const e = t.createElement("style");
@@ -4707,15 +4812,15 @@ function ti(t) {
4707
4812
  }
4708
4813
  `, t.head.appendChild(e);
4709
4814
  }
4710
- function ni(t) {
4815
+ function li(t) {
4711
4816
  const e = document.createElement("div");
4712
4817
  e.className = "cartridge-toast network-switch";
4713
4818
  const n = document.createElement(t.networkIcon ? "img" : "div");
4714
- n.className = "icon", n.style.width = "24px", n.style.height = "24px", n.style.aspectRatio = "1/1", t.networkIcon ? (n.src = Bt(t.networkIcon), n.alt = t.networkName) : (n.style.backgroundColor = "#161A17", n.innerHTML = t.networkName.charAt(0).toUpperCase(), n.style.color = "#ffffff", n.style.fontWeight = "600", n.style.fontSize = "12px", n.style.lineHeight = "16px", n.style.textAlign = "center", n.style.textTransform = "uppercase", n.style.borderRadius = "4px", n.style.padding = "4px");
4819
+ n.className = "icon", n.style.width = "24px", n.style.height = "24px", n.style.aspectRatio = "1/1", t.networkIcon ? (n.src = Ut(t.networkIcon), n.alt = t.networkName) : (n.style.backgroundColor = "#161A17", n.innerHTML = t.networkName.charAt(0).toUpperCase(), n.style.color = "#ffffff", n.style.fontWeight = "600", n.style.fontSize = "12px", n.style.lineHeight = "16px", n.style.textAlign = "center", n.style.textTransform = "uppercase", n.style.borderRadius = "4px", n.style.padding = "4px");
4715
4820
  const r = document.createElement("p");
4716
4821
  return r.className = "content", r.textContent = `Switched to ${t.networkName}`, e.appendChild(n), e.appendChild(r), e;
4717
4822
  }
4718
- function ri(t) {
4823
+ function di(t) {
4719
4824
  if (t.getElementById("cartridge-toast-achievement-styles"))
4720
4825
  return;
4721
4826
  const e = t.createElement("style");
@@ -4818,14 +4923,14 @@ function ri(t) {
4818
4923
  }
4819
4924
  `, t.head.appendChild(e);
4820
4925
  }
4821
- function si(t) {
4926
+ function hi(t) {
4822
4927
  const e = document.createElement("div");
4823
4928
  e.className = "cartridge-toast achievement";
4824
4929
  const n = document.createElement("div");
4825
4930
  n.className = "image-content-container";
4826
4931
  const r = document.createElement("div");
4827
4932
  r.className = "image-container";
4828
- const s = ii(t.isDraft);
4933
+ const s = ui(t.isDraft);
4829
4934
  s.className = "image", r.appendChild(s);
4830
4935
  const i = document.createElement("div");
4831
4936
  i.className = "content";
@@ -4837,14 +4942,14 @@ function si(t) {
4837
4942
  l.className = "xp-section-container";
4838
4943
  const c = document.createElement("div");
4839
4944
  c.className = "xp-section";
4840
- const d = oi(!t.isDraft);
4945
+ const d = fi(!t.isDraft);
4841
4946
  d.setAttribute("class", "xp-icon"), c.appendChild(d);
4842
4947
  const h = document.createElement("span");
4843
4948
  h.className = "xp-amount", h.textContent = `${t.xpAmount}`, c.appendChild(h), l.appendChild(c);
4844
4949
  const u = de(!1);
4845
4950
  return e.appendChild(n), e.appendChild(l), e.appendChild(u), e;
4846
4951
  }
4847
- const ii = (t = !1) => {
4952
+ const ui = (t = !1) => {
4848
4953
  const e = document.createElement("div"), n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
4849
4954
  switch (n.setAttribute("width", "34"), n.setAttribute("height", "34"), n.setAttribute("viewBox", "0 0 30 30"), n.style.width = "100%", n.style.height = "100%", t) {
4850
4955
  case !0:
@@ -4858,7 +4963,7 @@ const ii = (t = !1) => {
4858
4963
  `;
4859
4964
  }
4860
4965
  return e.appendChild(n), e;
4861
- }, oi = (t) => {
4966
+ }, fi = (t) => {
4862
4967
  const e = document.createElementNS(
4863
4968
  "http://www.w3.org/2000/svg",
4864
4969
  "svg"
@@ -4894,7 +4999,7 @@ const ii = (t = !1) => {
4894
4999
  }
4895
5000
  return e;
4896
5001
  };
4897
- function ai(t) {
5002
+ function pi(t) {
4898
5003
  if (t.getElementById("cartridge-toast-marketplace-styles"))
4899
5004
  return;
4900
5005
  const e = t.createElement("style");
@@ -4978,7 +5083,7 @@ function ai(t) {
4978
5083
  }
4979
5084
  `, t.head.appendChild(e);
4980
5085
  }
4981
- function ci(t) {
5086
+ function wi(t) {
4982
5087
  const e = document.createElement("div");
4983
5088
  e.className = "cartridge-toast marketplace";
4984
5089
  const n = document.createElement("div");
@@ -4986,7 +5091,7 @@ function ci(t) {
4986
5091
  const r = document.createElement("div");
4987
5092
  r.className = "image-container";
4988
5093
  const s = document.createElement("img");
4989
- s.className = "image", s.src = Bt(t.itemImages[0]), s.alt = t.itemNames[0], r.appendChild(s);
5094
+ s.className = "image", s.src = Ut(t.itemImages[0]), s.alt = t.itemNames[0], r.appendChild(s);
4990
5095
  const i = document.createElement("div");
4991
5096
  i.className = "content";
4992
5097
  const o = {
@@ -5004,7 +5109,7 @@ function ci(t) {
5004
5109
  const d = de(!1);
5005
5110
  return c.appendChild(d), e.appendChild(n), e.appendChild(c), e;
5006
5111
  }
5007
- function li(t) {
5112
+ function gi(t) {
5008
5113
  if (t.getElementById("cartridge-toast-quest-styles"))
5009
5114
  return;
5010
5115
  const e = t.createElement("style");
@@ -5107,14 +5212,14 @@ function li(t) {
5107
5212
  }
5108
5213
  `, t.head.appendChild(e);
5109
5214
  }
5110
- function di(t) {
5215
+ function mi(t) {
5111
5216
  const e = document.createElement("div");
5112
5217
  e.className = "cartridge-toast quest";
5113
5218
  const n = document.createElement("div");
5114
5219
  n.className = "image-content-container";
5115
5220
  const r = document.createElement("div");
5116
5221
  r.className = "image-container";
5117
- const s = hi();
5222
+ const s = yi();
5118
5223
  s.className = "image", r.appendChild(s);
5119
5224
  const i = document.createElement("div");
5120
5225
  i.className = "content";
@@ -5125,10 +5230,10 @@ function di(t) {
5125
5230
  const l = de(!1);
5126
5231
  return e.appendChild(n), e.appendChild(l), e;
5127
5232
  }
5128
- const hi = () => {
5233
+ const yi = () => {
5129
5234
  const t = document.createElement("div"), e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
5130
5235
  return e.setAttribute("width", "34"), e.setAttribute("height", "34"), e.setAttribute("viewBox", "0 0 30 30"), e.style.width = "100%", e.style.height = "100%", e.innerHTML = '<path d="M3 6.5V8C3 8.55312 3.44687 9 4 9H4.5H6V6.5C6 5.67188 5.32812 5 4.5 5C3.67188 5 3 5.67188 3 6.5ZM6.5 5C6.8125 5.41875 7 5.9375 7 6.5V16C7 17.1031 7.89687 18 9 18C10.1031 18 11 17.1031 11 16V15.8344C11 14.8219 11.8219 14 12.8344 14H18V8C18 6.34375 16.6562 5 15 5H6.5ZM17.5 19C19.4344 19 21 17.4344 21 15.5C21 15.225 20.775 15 20.5 15H12.8344C12.375 15 12 15.3719 12 15.8344V16C12 17.6562 10.6562 19 9 19H14.5H17.5Z" fill="white"/>', t.appendChild(e), t;
5131
- }, ui = (t) => {
5236
+ }, Ci = (t) => {
5132
5237
  const e = t.borderRadius ?? 8, n = !isFinite(t.duration) || t.duration <= 0, r = document.createElement("div");
5133
5238
  r.className = "cartridge-toast-progress-bar", r.style.position = "absolute", r.style.bottom = "0", r.style.left = "0", r.style.right = "0", r.style.height = "4px", r.style.overflow = "hidden", r.style.borderBottomLeftRadius = `${e}px`, r.style.borderBottomRightRadius = `${e}px`, r.style.backgroundColor = "rgba(255, 255, 255, 0.2)";
5134
5239
  const s = document.createElement("div");
@@ -5141,54 +5246,54 @@ const hi = () => {
5141
5246
  }, t.duration)), r.appendChild(s), r;
5142
5247
  };
5143
5248
  function It(t, e, n, r) {
5144
- const s = ui({
5249
+ const s = Ci({
5145
5250
  duration: e,
5146
5251
  onComplete: n,
5147
5252
  borderRadius: r
5148
5253
  });
5149
5254
  t.appendChild(s);
5150
5255
  }
5151
- function fi(t) {
5256
+ function bi(t) {
5152
5257
  switch (t.variant) {
5153
5258
  case "error":
5154
- return Js(t);
5259
+ return ii(t);
5155
5260
  case "transaction":
5156
- return ei(t);
5261
+ return ai(t);
5157
5262
  case "network-switch":
5158
- return ni(t);
5263
+ return li(t);
5159
5264
  case "achievement":
5160
- return si(t);
5265
+ return hi(t);
5161
5266
  case "quest":
5162
- return di(t);
5267
+ return mi(t);
5163
5268
  case "marketplace":
5164
- return ci(t);
5269
+ return wi(t);
5165
5270
  }
5166
5271
  }
5167
- function pi(t, e) {
5272
+ function xi(t, e) {
5168
5273
  switch (e) {
5169
5274
  case "error":
5170
- Ys(t);
5275
+ si(t);
5171
5276
  break;
5172
5277
  case "transaction":
5173
- Qs(t);
5278
+ oi(t);
5174
5279
  break;
5175
5280
  case "network-switch":
5176
- ti(t);
5281
+ ci(t);
5177
5282
  break;
5178
5283
  case "achievement":
5179
- ri(t);
5284
+ di(t);
5180
5285
  break;
5181
5286
  case "quest":
5182
- li(t);
5287
+ gi(t);
5183
5288
  break;
5184
5289
  case "marketplace":
5185
- ai(t);
5290
+ pi(t);
5186
5291
  break;
5187
5292
  }
5188
5293
  }
5189
5294
  function Xe(t, e) {
5190
- Xs(t), pi(t, e.variant);
5191
- const n = e.position || qs, r = Zs(t, n), s = fi(e), i = () => Ks(s);
5295
+ ni(t), xi(t, e.variant);
5296
+ const n = e.position || Js, r = ei(t, n), s = bi(e), i = () => ti(s);
5192
5297
  r.appendChild(s), e.onClick && (s.style.cursor = "pointer", s.addEventListener("click", (d) => {
5193
5298
  !d.target.closest("#close-button") && e.onClick && e.onClick();
5194
5299
  }));
@@ -5197,7 +5302,7 @@ function Xe(t, e) {
5197
5302
  d.stopPropagation(), i();
5198
5303
  });
5199
5304
  let a = null;
5200
- const l = e.duration ?? Vs, c = !isFinite(l) || l <= 0;
5305
+ const l = e.duration ?? Ys, c = !isFinite(l) || l <= 0;
5201
5306
  if (e.variant !== "network-switch") {
5202
5307
  const d = e.variant === "error" || e.variant === "transaction" ? 8 : 4;
5203
5308
  c ? It(s, 1 / 0, () => {
@@ -5208,26 +5313,26 @@ function Xe(t, e) {
5208
5313
  };
5209
5314
  }
5210
5315
  let Pt = !1;
5211
- function xn() {
5316
+ function vn() {
5212
5317
  Pt || typeof window > "u" || dt() || (window.addEventListener("message", (t) => {
5213
- if (t.data?.type === bn && t.data?.options) {
5318
+ if (t.data?.type === kn && t.data?.options) {
5214
5319
  const e = document;
5215
5320
  e && Xe(e, t.data.options);
5216
5321
  }
5217
5322
  }), Pt = !0);
5218
5323
  }
5219
- function wi(t) {
5324
+ function ki(t) {
5220
5325
  if (typeof window > "u" || typeof document > "u")
5221
5326
  return console.warn("Toast can only be used in a browser environment"), () => {
5222
5327
  };
5223
- if (xn(), dt()) {
5224
- const e = Ds();
5328
+ if (vn(), dt()) {
5329
+ const e = Qs();
5225
5330
  if (e)
5226
5331
  return Xe(e, t);
5227
5332
  try {
5228
5333
  window.parent && window.parent.postMessage(
5229
5334
  {
5230
- type: bn,
5335
+ type: kn,
5231
5336
  options: t
5232
5337
  },
5233
5338
  "*"
@@ -5241,53 +5346,54 @@ function wi(t) {
5241
5346
  } else
5242
5347
  return Xe(document, t);
5243
5348
  }
5244
- typeof window < "u" && xn();
5245
- const gi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5349
+ typeof window < "u" && vn();
5350
+ const vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5246
5351
  __proto__: null,
5247
- toast: wi
5352
+ toast: ki
5248
5353
  }, Symbol.toStringTag, { value: "Module" }));
5249
5354
  export {
5250
- Ei as ALL_AUTH_OPTIONS,
5251
- Ai as AUTH_EXTERNAL_WALLETS,
5252
- Xr as ArgentWallet,
5253
- Qr as BaseWallet,
5254
- zs as BraavosWallet,
5255
- Si as EMBEDDED_WALLETS,
5256
- $i as EXTERNAL_WALLETS,
5257
- Li as EXTRA_EXTERNAL_WALLETS,
5258
- ve as EthereumWalletBase,
5259
- _i as FeeSource,
5355
+ Pi as ALL_AUTH_OPTIONS,
5356
+ Ti as AUTH_EXTERNAL_WALLETS,
5357
+ Yr as ArgentWallet,
5358
+ ts as BaseWallet,
5359
+ Fs as BraavosWallet,
5360
+ Ni as EMBEDDED_WALLETS,
5361
+ Bi as EXTERNAL_WALLETS,
5362
+ Ui as EXTRA_EXTERNAL_WALLETS,
5363
+ Ee as EthereumWalletBase,
5364
+ Mi as FeeSource,
5260
5365
  he as HeadlessAuthenticationError,
5261
- Ii as HeadlessModeNotSupportedError,
5262
- Pi as IMPLEMENTED_AUTH_OPTIONS,
5263
- Ti as InvalidCredentialsError,
5264
- es as MetaMaskWallet,
5366
+ Ri as HeadlessModeNotSupportedError,
5367
+ $n as IMPLEMENTED_AUTH_OPTIONS,
5368
+ Oi as InvalidCredentialsError,
5369
+ ns as MetaMaskWallet,
5265
5370
  L as NotReadyToConnect,
5266
- Rs as PhantomEVMWallet,
5267
- Ms as PhantomWallet,
5268
- Os as RabbyWallet,
5371
+ zs as PhantomEVMWallet,
5372
+ Os as PhantomWallet,
5373
+ js as RabbyWallet,
5269
5374
  O as ResponseCodes,
5270
- Fs as WalletBridge,
5271
- Le as chainIdToPlatform,
5272
- Ci as default,
5273
- Ni as defaultTheme,
5274
- Bi as erc20Metadata,
5275
- Ui as getAvailableConfigs,
5276
- Mi as getConfigsIndex,
5277
- Ri as getPresetSessionPolicies,
5278
- Oi as humanizeString,
5279
- En as isMobile,
5280
- zi as loadAllConfigs,
5281
- Fi as loadConfig,
5282
- xi as lookupAddresses,
5283
- bi as lookupUsernames,
5284
- ji as normalizeCalls,
5285
- Sn as parseChainId,
5286
- Hi as parsePolicies,
5287
- Bt as sanitizeImageSrc,
5288
- vn as toArray,
5289
- Wi as toSessionPolicies,
5290
- Vi as toWasmPolicies,
5291
- wi as toast
5375
+ Hs as WalletBridge,
5376
+ _e as chainIdToPlatform,
5377
+ Li as default,
5378
+ zi as defaultTheme,
5379
+ ji as erc20Metadata,
5380
+ Fi as getAvailableConfigs,
5381
+ Hi as getConfigsIndex,
5382
+ Wi as getPresetSessionPolicies,
5383
+ qi as humanizeString,
5384
+ Sn as isMobile,
5385
+ Vi as loadAllConfigs,
5386
+ Di as loadConfig,
5387
+ $i as lookupAddresses,
5388
+ Xs as lookupUsername,
5389
+ Si as lookupUsernames,
5390
+ Zi as normalizeCalls,
5391
+ _n as parseChainId,
5392
+ Ki as parsePolicies,
5393
+ Ut as sanitizeImageSrc,
5394
+ An as toArray,
5395
+ Xi as toSessionPolicies,
5396
+ Gi as toWasmPolicies,
5397
+ ki as toast
5292
5398
  };
5293
5399
  //# sourceMappingURL=index.js.map