@cartridge/controller 0.11.2 → 0.11.3
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/.turbo/turbo-build$colon$deps.log +18 -18
- package/.turbo/turbo-build.log +16 -16
- package/dist/iframe/base.d.ts +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1854 -811
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/{provider-s-80NdXp.js → provider-DCZ6z1Gs.js} +38 -24
- package/dist/provider-DCZ6z1Gs.js.map +1 -0
- package/dist/session.js +2 -2
- package/dist/stats.html +1 -1
- package/dist/toast/components/close-button.d.ts +1 -0
- package/dist/toast/components/progress-bar.d.ts +6 -0
- package/dist/toast/index.d.ts +57 -0
- package/dist/toast/styles.d.ts +1 -0
- package/dist/toast/types.d.ts +39 -0
- package/dist/toast/utils/progress-bar.d.ts +9 -0
- package/dist/toast/utils.d.ts +8 -0
- package/dist/toast/variants/achievement.d.ts +3 -0
- package/dist/toast/variants/error.d.ts +3 -0
- package/dist/toast/variants/index.d.ts +6 -0
- package/dist/toast/variants/marketplace.d.ts +3 -0
- package/dist/toast/variants/network-switch.d.ts +3 -0
- package/dist/toast/variants/quest.d.ts +3 -0
- package/dist/toast/variants/transaction.d.ts +3 -0
- package/dist/types.d.ts +3 -3
- package/dist/utils.d.ts +1 -0
- package/dist/wallets/index.d.ts +1 -0
- package/dist/wallets/phantom-evm/index.d.ts +7 -0
- package/dist/wallets/types.d.ts +2 -2
- package/package.json +2 -3
- package/src/iframe/base.ts +2 -20
- package/src/index.ts +1 -0
- package/src/toast/components/close-button.ts +82 -0
- package/src/toast/components/progress-bar.ts +60 -0
- package/src/toast/index.ts +263 -0
- package/src/toast/styles.ts +142 -0
- package/src/toast/types.ts +67 -0
- package/src/toast/utils/progress-bar.ts +23 -0
- package/src/toast/utils.ts +65 -0
- package/src/toast/variants/achievement.ts +244 -0
- package/src/toast/variants/error.ts +107 -0
- package/src/toast/variants/index.ts +6 -0
- package/src/toast/variants/marketplace.ts +145 -0
- package/src/toast/variants/network-switch.ts +72 -0
- package/src/toast/variants/quest.ts +164 -0
- package/src/toast/variants/transaction.ts +256 -0
- package/src/types.ts +1 -0
- package/src/utils.ts +15 -0
- package/src/wallets/bridge.ts +4 -0
- package/src/wallets/index.ts +1 -0
- package/src/wallets/phantom-evm/index.ts +8 -0
- package/src/wallets/types.ts +5 -1
- package/dist/provider-s-80NdXp.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { WalletAccount as
|
|
2
|
-
import { R as Q, t as
|
|
3
|
-
import { a as
|
|
4
|
-
class
|
|
1
|
+
import { WalletAccount as Qt, constants as Z, num as ct, shortString as Qe } from "starknet";
|
|
2
|
+
import { R as Q, t as Ht, i as jt, K as lt, B as Wt, N as A, p as Yt, v as Vt, A as qt, s as dt } from "./provider-DCZ6z1Gs.js";
|
|
3
|
+
import { a as Ps, d as Ts, E as Rs, f as Us, e as Ms, F as zs, I as Os, h as Ds, n as Fs, b as Qs, c as Hs } from "./provider-DCZ6z1Gs.js";
|
|
4
|
+
class He extends Qt {
|
|
5
5
|
keychain;
|
|
6
6
|
modal;
|
|
7
7
|
options;
|
|
8
|
-
constructor(e, r, n, s, o,
|
|
8
|
+
constructor(e, r, n, s, o, a) {
|
|
9
9
|
super({
|
|
10
10
|
provider: { nodeUrl: r },
|
|
11
11
|
walletProvider: e,
|
|
12
12
|
address: n
|
|
13
|
-
}), this.keychain = s, this.options = o, this.modal =
|
|
13
|
+
}), this.keychain = s, this.options = o, this.modal = a;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Invoke execute function in account contract
|
|
@@ -25,7 +25,7 @@ class Oe extends Rt {
|
|
|
25
25
|
* @returns response from addTransaction
|
|
26
26
|
*/
|
|
27
27
|
async execute(e) {
|
|
28
|
-
return e =
|
|
28
|
+
return e = Ht(e), new Promise(async (r, n) => {
|
|
29
29
|
const s = await this.keychain.execute(
|
|
30
30
|
e,
|
|
31
31
|
void 0,
|
|
@@ -81,23 +81,23 @@ var B;
|
|
|
81
81
|
(function(t) {
|
|
82
82
|
t.Call = "call", t.Reply = "reply", t.Syn = "syn", t.SynAck = "synAck", t.Ack = "ack";
|
|
83
83
|
})(B || (B = {}));
|
|
84
|
-
var
|
|
84
|
+
var M;
|
|
85
85
|
(function(t) {
|
|
86
86
|
t.Fulfilled = "fulfilled", t.Rejected = "rejected";
|
|
87
|
-
})(
|
|
87
|
+
})(M || (M = {}));
|
|
88
88
|
var G;
|
|
89
89
|
(function(t) {
|
|
90
90
|
t.ConnectionDestroyed = "ConnectionDestroyed", t.ConnectionTimeout = "ConnectionTimeout", t.NoIframeSrc = "NoIframeSrc";
|
|
91
91
|
})(G || (G = {}));
|
|
92
|
-
var
|
|
92
|
+
var ve;
|
|
93
93
|
(function(t) {
|
|
94
94
|
t.DataCloneError = "DataCloneError";
|
|
95
|
-
})(
|
|
96
|
-
var
|
|
95
|
+
})(ve || (ve = {}));
|
|
96
|
+
var R;
|
|
97
97
|
(function(t) {
|
|
98
98
|
t.Message = "message";
|
|
99
|
-
})(
|
|
100
|
-
const
|
|
99
|
+
})(R || (R = {}));
|
|
100
|
+
const Zt = (t, e) => {
|
|
101
101
|
const r = [];
|
|
102
102
|
let n = !1;
|
|
103
103
|
return {
|
|
@@ -110,99 +110,99 @@ const Mt = (t, e) => {
|
|
|
110
110
|
n ? s() : r.push(s);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
-
},
|
|
113
|
+
}, Kt = (t) => (...e) => {
|
|
114
114
|
t && console.log("[Penpal]", ...e);
|
|
115
|
-
},
|
|
115
|
+
}, Gt = {
|
|
116
116
|
"http:": "80",
|
|
117
117
|
"https:": "443"
|
|
118
|
-
},
|
|
119
|
-
if (t &&
|
|
118
|
+
}, Xt = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, Jt = ["file:", "data:"], er = (t) => {
|
|
119
|
+
if (t && Jt.find((i) => t.startsWith(i)))
|
|
120
120
|
return "null";
|
|
121
|
-
const e = document.location, r =
|
|
121
|
+
const e = document.location, r = Xt.exec(t);
|
|
122
122
|
let n, s, o;
|
|
123
123
|
r ? (n = r[1] ? r[1] : e.protocol, s = r[2], o = r[4]) : (n = e.protocol, s = e.hostname, o = e.port);
|
|
124
|
-
const
|
|
125
|
-
return `${n}//${s}${
|
|
126
|
-
},
|
|
124
|
+
const a = o && o !== Gt[n] ? `:${o}` : "";
|
|
125
|
+
return `${n}//${s}${a}`;
|
|
126
|
+
}, je = ({ name: t, message: e, stack: r }) => ({
|
|
127
127
|
name: t,
|
|
128
128
|
message: e,
|
|
129
129
|
stack: r
|
|
130
|
-
}),
|
|
130
|
+
}), tr = (t) => {
|
|
131
131
|
const e = new Error();
|
|
132
132
|
return Object.keys(t).forEach((r) => e[r] = t[r]), e;
|
|
133
|
-
},
|
|
134
|
-
const { localName: n, local: s, remote: o, originForSending:
|
|
133
|
+
}, rr = (t, e, r) => {
|
|
134
|
+
const { localName: n, local: s, remote: o, originForSending: a, originForReceiving: i } = t;
|
|
135
135
|
let l = !1;
|
|
136
136
|
const c = (d) => {
|
|
137
137
|
if (d.source !== o || d.data.penpal !== B.Call)
|
|
138
138
|
return;
|
|
139
|
-
if (
|
|
140
|
-
r(`${n} received message from origin ${d.origin} which did not match expected origin ${
|
|
139
|
+
if (i !== "*" && d.origin !== i) {
|
|
140
|
+
r(`${n} received message from origin ${d.origin} which did not match expected origin ${i}`);
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
const h = d.data, { methodName: f, args: u, id:
|
|
143
|
+
const h = d.data, { methodName: f, args: u, id: p } = h;
|
|
144
144
|
r(`${n}: Received ${f}() call`);
|
|
145
|
-
const b = (y) => (
|
|
145
|
+
const b = (y) => (w) => {
|
|
146
146
|
if (r(`${n}: Sending ${f}() reply`), l) {
|
|
147
147
|
r(`${n}: Unable to send ${f}() reply due to destroyed connection`);
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
const
|
|
150
|
+
const x = {
|
|
151
151
|
penpal: B.Reply,
|
|
152
|
-
id:
|
|
152
|
+
id: p,
|
|
153
153
|
resolution: y,
|
|
154
|
-
returnValue:
|
|
154
|
+
returnValue: w
|
|
155
155
|
};
|
|
156
|
-
y ===
|
|
156
|
+
y === M.Rejected && w instanceof Error && (x.returnValue = je(w), x.returnValueIsError = !0);
|
|
157
157
|
try {
|
|
158
|
-
o.postMessage(
|
|
159
|
-
} catch (
|
|
160
|
-
if (
|
|
161
|
-
const
|
|
158
|
+
o.postMessage(x, a);
|
|
159
|
+
} catch (m) {
|
|
160
|
+
if (m.name === ve.DataCloneError) {
|
|
161
|
+
const _ = {
|
|
162
162
|
penpal: B.Reply,
|
|
163
|
-
id:
|
|
164
|
-
resolution:
|
|
165
|
-
returnValue:
|
|
163
|
+
id: p,
|
|
164
|
+
resolution: M.Rejected,
|
|
165
|
+
returnValue: je(m),
|
|
166
166
|
returnValueIsError: !0
|
|
167
167
|
};
|
|
168
|
-
o.postMessage(
|
|
168
|
+
o.postMessage(_, a);
|
|
169
169
|
}
|
|
170
|
-
throw
|
|
170
|
+
throw m;
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
new Promise((y) => y(e[f].call(e, d.origin).apply(e, u))).then(b(
|
|
173
|
+
new Promise((y) => y(e[f].call(e, d.origin).apply(e, u))).then(b(M.Fulfilled), b(M.Rejected));
|
|
174
174
|
};
|
|
175
|
-
return s.addEventListener(
|
|
176
|
-
l = !0, s.removeEventListener(
|
|
175
|
+
return s.addEventListener(R.Message, c), () => {
|
|
176
|
+
l = !0, s.removeEventListener(R.Message, c);
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
-
let
|
|
180
|
-
const
|
|
181
|
-
const r =
|
|
182
|
-
return r.push(t),
|
|
183
|
-
},
|
|
184
|
-
const n =
|
|
185
|
-
return n.reduce((s, o,
|
|
186
|
-
},
|
|
179
|
+
let nr = 0;
|
|
180
|
+
const sr = () => ++nr, ht = ".", ft = (t) => t ? t.split(ht) : [], or = (t) => t.join(ht), ar = (t, e) => {
|
|
181
|
+
const r = ft(e || "");
|
|
182
|
+
return r.push(t), or(r);
|
|
183
|
+
}, ir = (t, e, r) => {
|
|
184
|
+
const n = ft(e);
|
|
185
|
+
return n.reduce((s, o, a) => (typeof s[o] > "u" && (s[o] = {}), a === n.length - 1 && (s[o] = r), s[o]), t), t;
|
|
186
|
+
}, ut = (t, e) => {
|
|
187
187
|
const r = {};
|
|
188
188
|
return Object.keys(t).forEach((n) => {
|
|
189
|
-
const s = t[n], o =
|
|
190
|
-
typeof s == "object" && Object.assign(r,
|
|
189
|
+
const s = t[n], o = ar(n, e);
|
|
190
|
+
typeof s == "object" && Object.assign(r, ut(s, o)), typeof s == "function" && (r[o] = s);
|
|
191
191
|
}), r;
|
|
192
|
-
},
|
|
192
|
+
}, cr = (t) => {
|
|
193
193
|
const e = {};
|
|
194
194
|
for (const r in t)
|
|
195
|
-
|
|
195
|
+
ir(e, r, t[r]);
|
|
196
196
|
return e;
|
|
197
|
-
},
|
|
198
|
-
const { localName: o, local:
|
|
197
|
+
}, lr = (t, e, r, n, s) => {
|
|
198
|
+
const { localName: o, local: a, remote: i, originForSending: l, originForReceiving: c } = e;
|
|
199
199
|
let d = !1;
|
|
200
200
|
s(`${o}: Connecting call sender`);
|
|
201
|
-
const h = (u) => (...
|
|
201
|
+
const h = (u) => (...p) => {
|
|
202
202
|
s(`${o}: Sending ${u}() call`);
|
|
203
203
|
let b;
|
|
204
204
|
try {
|
|
205
|
-
|
|
205
|
+
i.closed && (b = !0);
|
|
206
206
|
} catch {
|
|
207
207
|
b = !0;
|
|
208
208
|
}
|
|
@@ -210,35 +210,35 @@ const qt = () => ++Kt, st = ".", ot = (t) => t ? t.split(st) : [], Gt = (t) => t
|
|
|
210
210
|
const y = new Error(`Unable to send ${u}() call due to destroyed connection`);
|
|
211
211
|
throw y.code = G.ConnectionDestroyed, y;
|
|
212
212
|
}
|
|
213
|
-
return new Promise((y,
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
213
|
+
return new Promise((y, w) => {
|
|
214
|
+
const x = sr(), m = (L) => {
|
|
215
|
+
if (L.source !== i || L.data.penpal !== B.Reply || L.data.id !== x)
|
|
216
216
|
return;
|
|
217
|
-
if (c !== "*" &&
|
|
218
|
-
s(`${o} received message from origin ${
|
|
217
|
+
if (c !== "*" && L.origin !== c) {
|
|
218
|
+
s(`${o} received message from origin ${L.origin} which did not match expected origin ${c}`);
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
|
-
const
|
|
222
|
-
s(`${o}: Received ${u}() reply`),
|
|
223
|
-
let
|
|
224
|
-
|
|
221
|
+
const ue = L.data;
|
|
222
|
+
s(`${o}: Received ${u}() reply`), a.removeEventListener(R.Message, m);
|
|
223
|
+
let pe = ue.returnValue;
|
|
224
|
+
ue.returnValueIsError && (pe = tr(pe)), (ue.resolution === M.Fulfilled ? y : w)(pe);
|
|
225
225
|
};
|
|
226
|
-
|
|
227
|
-
const
|
|
226
|
+
a.addEventListener(R.Message, m);
|
|
227
|
+
const _ = {
|
|
228
228
|
penpal: B.Call,
|
|
229
|
-
id:
|
|
229
|
+
id: x,
|
|
230
230
|
methodName: u,
|
|
231
|
-
args:
|
|
231
|
+
args: p
|
|
232
232
|
};
|
|
233
|
-
|
|
233
|
+
i.postMessage(_, l);
|
|
234
234
|
});
|
|
235
|
-
}, f = r.reduce((u,
|
|
236
|
-
return Object.assign(t,
|
|
235
|
+
}, f = r.reduce((u, p) => (u[p] = h(p), u), {});
|
|
236
|
+
return Object.assign(t, cr(f)), () => {
|
|
237
237
|
d = !0;
|
|
238
238
|
};
|
|
239
|
-
},
|
|
240
|
-
const { destroy: o, onDestroy:
|
|
241
|
-
let
|
|
239
|
+
}, dr = (t, e, r, n, s) => {
|
|
240
|
+
const { destroy: o, onDestroy: a } = n;
|
|
241
|
+
let i, l;
|
|
242
242
|
const c = {};
|
|
243
243
|
return (d) => {
|
|
244
244
|
if (e !== "*" && d.origin !== e) {
|
|
@@ -253,13 +253,13 @@ const qt = () => ++Kt, st = ".", ot = (t) => t ? t.split(st) : [], Gt = (t) => t
|
|
|
253
253
|
originForSending: r,
|
|
254
254
|
originForReceiving: e
|
|
255
255
|
};
|
|
256
|
-
|
|
256
|
+
i && i(), i = rr(h, t, s), a(i), l && l.forEach((u) => {
|
|
257
257
|
delete c[u];
|
|
258
258
|
}), l = d.data.methodNames;
|
|
259
|
-
const f =
|
|
260
|
-
return
|
|
259
|
+
const f = lr(c, h, l, o, s);
|
|
260
|
+
return a(f), c;
|
|
261
261
|
};
|
|
262
|
-
},
|
|
262
|
+
}, hr = (t, e, r, n) => (s) => {
|
|
263
263
|
if (!s.source)
|
|
264
264
|
return;
|
|
265
265
|
if (r !== "*" && s.origin !== r) {
|
|
@@ -272,14 +272,14 @@ const qt = () => ++Kt, st = ".", ot = (t) => t ? t.split(st) : [], Gt = (t) => t
|
|
|
272
272
|
methodNames: Object.keys(e)
|
|
273
273
|
};
|
|
274
274
|
s.source.postMessage(o, n);
|
|
275
|
-
},
|
|
275
|
+
}, fr = 6e4, ur = (t, e) => {
|
|
276
276
|
const { destroy: r, onDestroy: n } = e, s = setInterval(() => {
|
|
277
277
|
t.isConnected || (clearInterval(s), r());
|
|
278
|
-
},
|
|
278
|
+
}, fr);
|
|
279
279
|
n(() => {
|
|
280
280
|
clearInterval(s);
|
|
281
281
|
});
|
|
282
|
-
},
|
|
282
|
+
}, pr = (t, e) => {
|
|
283
283
|
let r;
|
|
284
284
|
return t !== void 0 && (r = window.setTimeout(() => {
|
|
285
285
|
const n = new Error(`Connection timed out after ${t}ms`);
|
|
@@ -287,33 +287,33 @@ const qt = () => ++Kt, st = ".", ot = (t) => t ? t.split(st) : [], Gt = (t) => t
|
|
|
287
287
|
}, t)), () => {
|
|
288
288
|
clearTimeout(r);
|
|
289
289
|
};
|
|
290
|
-
},
|
|
290
|
+
}, gr = (t) => {
|
|
291
291
|
if (!t.src && !t.srcdoc) {
|
|
292
292
|
const e = new Error("Iframe must have src or srcdoc property defined.");
|
|
293
293
|
throw e.code = G.NoIframeSrc, e;
|
|
294
294
|
}
|
|
295
|
-
},
|
|
295
|
+
}, mr = (t) => {
|
|
296
296
|
let { iframe: e, methods: r = {}, childOrigin: n, timeout: s, debug: o = !1 } = t;
|
|
297
|
-
const
|
|
298
|
-
n || (
|
|
299
|
-
const d = n === "null" ? "*" : n, h =
|
|
297
|
+
const a = Kt(o), i = Zt("Parent", a), { onDestroy: l, destroy: c } = i;
|
|
298
|
+
n || (gr(e), n = er(e.src));
|
|
299
|
+
const d = n === "null" ? "*" : n, h = ut(r), f = hr(a, h, n, d), u = dr(h, n, d, i, a);
|
|
300
300
|
return {
|
|
301
301
|
promise: new Promise((b, y) => {
|
|
302
|
-
const
|
|
303
|
-
if (!(
|
|
304
|
-
if (
|
|
305
|
-
f(
|
|
302
|
+
const w = pr(s, c), x = (m) => {
|
|
303
|
+
if (!(m.source !== e.contentWindow || !m.data)) {
|
|
304
|
+
if (m.data.penpal === B.Syn) {
|
|
305
|
+
f(m);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
if (
|
|
309
|
-
const
|
|
310
|
-
|
|
308
|
+
if (m.data.penpal === B.Ack) {
|
|
309
|
+
const _ = u(m);
|
|
310
|
+
_ && (w(), b(_));
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
|
-
window.addEventListener(
|
|
316
|
-
window.removeEventListener(
|
|
315
|
+
window.addEventListener(R.Message, x), a("Parent: Awaiting handshake"), ur(e, i), l((m) => {
|
|
316
|
+
window.removeEventListener(R.Message, x), m && y(m);
|
|
317
317
|
});
|
|
318
318
|
}),
|
|
319
319
|
destroy() {
|
|
@@ -321,12 +321,11 @@ const qt = () => ++Kt, st = ".", ot = (t) => t ? t.split(st) : [], Gt = (t) => t
|
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
};
|
|
324
|
-
class
|
|
324
|
+
class wr {
|
|
325
325
|
url;
|
|
326
326
|
iframe;
|
|
327
327
|
container;
|
|
328
328
|
onClose;
|
|
329
|
-
child;
|
|
330
329
|
closeTimeout;
|
|
331
330
|
constructor({
|
|
332
331
|
id: e,
|
|
@@ -338,10 +337,10 @@ class cr {
|
|
|
338
337
|
if (typeof document > "u" || typeof window > "u")
|
|
339
338
|
return;
|
|
340
339
|
this.url = r;
|
|
341
|
-
const
|
|
342
|
-
|
|
340
|
+
const a = document.head, i = document.createElement("meta");
|
|
341
|
+
i.name = "viewport", i.id = "controller-viewport", i.content = "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, interactive-widget=resizes-content", a.appendChild(i);
|
|
343
342
|
const l = document.createElement("iframe");
|
|
344
|
-
l.src = r.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 = "publickey-credentials-create *; publickey-credentials-get *; clipboard-write", 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");
|
|
343
|
+
l.src = r.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 = "publickey-credentials-create *; publickey-credentials-get *; clipboard-write; local-network-access *; payment *", 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");
|
|
345
344
|
const c = document.createElement("div");
|
|
346
345
|
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(
|
|
347
346
|
"touchstart",
|
|
@@ -361,18 +360,14 @@ class cr {
|
|
|
361
360
|
f.touches.length > 1 && f.preventDefault();
|
|
362
361
|
},
|
|
363
362
|
{ passive: !1 }
|
|
364
|
-
),
|
|
365
|
-
f.target === c && (e === "controller-keychain" && this.child && this.child.reset?.().catch((u) => console.error("Error resetting context:", u)), this.close());
|
|
366
|
-
}), this.iframe = l, this.container = c, ar({
|
|
363
|
+
), this.iframe = l, this.container = c, mr({
|
|
367
364
|
iframe: this.iframe,
|
|
368
365
|
methods: {
|
|
369
366
|
close: (f) => () => this.close(),
|
|
370
367
|
reload: (f) => () => window.location.reload(),
|
|
371
368
|
...o
|
|
372
369
|
}
|
|
373
|
-
}).promise.then((
|
|
374
|
-
this.child = f, s(f);
|
|
375
|
-
}), this.resize(), window.addEventListener("resize", () => this.resize());
|
|
370
|
+
}).promise.then(s), this.resize(), window.addEventListener("resize", () => this.resize());
|
|
376
371
|
const d = new MutationObserver(() => {
|
|
377
372
|
if (typeof document > "u") return;
|
|
378
373
|
const f = document.getElementById("controller");
|
|
@@ -414,18 +409,18 @@ class cr {
|
|
|
414
409
|
return this.container?.style.display !== "none";
|
|
415
410
|
}
|
|
416
411
|
}
|
|
417
|
-
const
|
|
418
|
-
function
|
|
412
|
+
const yr = "6.13.7";
|
|
413
|
+
function We(t, e, r) {
|
|
419
414
|
for (let n in e) {
|
|
420
415
|
let s = e[n];
|
|
421
416
|
Object.defineProperty(t, n, { enumerable: !0, value: s, writable: !1 });
|
|
422
417
|
}
|
|
423
418
|
}
|
|
424
|
-
function
|
|
419
|
+
function F(t) {
|
|
425
420
|
if (t == null)
|
|
426
421
|
return "null";
|
|
427
422
|
if (Array.isArray(t))
|
|
428
|
-
return "[ " + t.map(
|
|
423
|
+
return "[ " + t.map(F).join(", ") + " ]";
|
|
429
424
|
if (t instanceof Uint8Array) {
|
|
430
425
|
const e = "0123456789abcdef";
|
|
431
426
|
let r = "0x";
|
|
@@ -434,7 +429,7 @@ function M(t) {
|
|
|
434
429
|
return r;
|
|
435
430
|
}
|
|
436
431
|
if (typeof t == "object" && typeof t.toJSON == "function")
|
|
437
|
-
return
|
|
432
|
+
return F(t.toJSON());
|
|
438
433
|
switch (typeof t) {
|
|
439
434
|
case "boolean":
|
|
440
435
|
case "symbol":
|
|
@@ -447,26 +442,26 @@ function M(t) {
|
|
|
447
442
|
return JSON.stringify(t);
|
|
448
443
|
case "object": {
|
|
449
444
|
const e = Object.keys(t);
|
|
450
|
-
return e.sort(), "{ " + e.map((r) => `${
|
|
445
|
+
return e.sort(), "{ " + e.map((r) => `${F(r)}: ${F(t[r])}`).join(", ") + " }";
|
|
451
446
|
}
|
|
452
447
|
}
|
|
453
448
|
return "[ COULD NOT SERIALIZE ]";
|
|
454
449
|
}
|
|
455
|
-
function
|
|
450
|
+
function br(t, e, r) {
|
|
456
451
|
let n = t;
|
|
457
452
|
{
|
|
458
453
|
const o = [];
|
|
459
454
|
if (r) {
|
|
460
455
|
if ("message" in r || "code" in r || "name" in r)
|
|
461
|
-
throw new Error(`value will overwrite populated values: ${
|
|
462
|
-
for (const
|
|
463
|
-
if (
|
|
456
|
+
throw new Error(`value will overwrite populated values: ${F(r)}`);
|
|
457
|
+
for (const a in r) {
|
|
458
|
+
if (a === "shortMessage")
|
|
464
459
|
continue;
|
|
465
|
-
const
|
|
466
|
-
o.push(
|
|
460
|
+
const i = r[a];
|
|
461
|
+
o.push(a + "=" + F(i));
|
|
467
462
|
}
|
|
468
463
|
}
|
|
469
|
-
o.push(`code=${e}`), o.push(`version=${
|
|
464
|
+
o.push(`code=${e}`), o.push(`version=${yr}`), o.length && (t += " (" + o.join(", ") + ")");
|
|
470
465
|
}
|
|
471
466
|
let s;
|
|
472
467
|
switch (e) {
|
|
@@ -480,14 +475,14 @@ function dr(t, e, r) {
|
|
|
480
475
|
default:
|
|
481
476
|
s = new Error(t);
|
|
482
477
|
}
|
|
483
|
-
return
|
|
478
|
+
return We(s, { code: e }), r && Object.assign(s, r), s.shortMessage == null && We(s, { shortMessage: n }), s;
|
|
484
479
|
}
|
|
485
|
-
function
|
|
480
|
+
function Cr(t, e, r, n) {
|
|
486
481
|
if (!t)
|
|
487
|
-
throw
|
|
482
|
+
throw br(e, r, n);
|
|
488
483
|
}
|
|
489
484
|
function Y(t, e, r, n) {
|
|
490
|
-
|
|
485
|
+
Cr(t, e, "INVALID_ARGUMENT", { argument: r, value: n });
|
|
491
486
|
}
|
|
492
487
|
["NFD", "NFC", "NFKD", "NFKC"].reduce((t, e) => {
|
|
493
488
|
try {
|
|
@@ -500,7 +495,7 @@ function Y(t, e, r, n) {
|
|
|
500
495
|
}
|
|
501
496
|
return t;
|
|
502
497
|
}, []);
|
|
503
|
-
function
|
|
498
|
+
function xr(t, e, r) {
|
|
504
499
|
if (t instanceof Uint8Array)
|
|
505
500
|
return t;
|
|
506
501
|
if (typeof t == "string" && t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {
|
|
@@ -512,142 +507,142 @@ function fr(t, e, r) {
|
|
|
512
507
|
}
|
|
513
508
|
Y(!1, "invalid BytesLike value", e || "value", t);
|
|
514
509
|
}
|
|
515
|
-
function
|
|
516
|
-
return
|
|
510
|
+
function Se(t, e) {
|
|
511
|
+
return xr(t, e);
|
|
517
512
|
}
|
|
518
|
-
const
|
|
519
|
-
function
|
|
520
|
-
const e =
|
|
513
|
+
const Ye = "0123456789abcdef";
|
|
514
|
+
function vr(t) {
|
|
515
|
+
const e = Se(t);
|
|
521
516
|
let r = "0x";
|
|
522
517
|
for (let n = 0; n < e.length; n++) {
|
|
523
518
|
const s = e[n];
|
|
524
|
-
r +=
|
|
519
|
+
r += Ye[(s & 240) >> 4] + Ye[s & 15];
|
|
525
520
|
}
|
|
526
521
|
return r;
|
|
527
522
|
}
|
|
528
523
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
529
|
-
function
|
|
524
|
+
function kr(t) {
|
|
530
525
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
531
526
|
}
|
|
532
|
-
function
|
|
527
|
+
function Ve(t) {
|
|
533
528
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
534
529
|
throw new Error("positive integer expected, got " + t);
|
|
535
530
|
}
|
|
536
|
-
function
|
|
537
|
-
if (!
|
|
531
|
+
function se(t, ...e) {
|
|
532
|
+
if (!kr(t))
|
|
538
533
|
throw new Error("Uint8Array expected");
|
|
539
534
|
if (e.length > 0 && !e.includes(t.length))
|
|
540
535
|
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
|
|
541
536
|
}
|
|
542
|
-
function
|
|
537
|
+
function qe(t, e = !0) {
|
|
543
538
|
if (t.destroyed)
|
|
544
539
|
throw new Error("Hash instance has been destroyed");
|
|
545
540
|
if (e && t.finished)
|
|
546
541
|
throw new Error("Hash#digest() has already been called");
|
|
547
542
|
}
|
|
548
|
-
function
|
|
549
|
-
|
|
543
|
+
function Er(t, e) {
|
|
544
|
+
se(t);
|
|
550
545
|
const r = e.outputLen;
|
|
551
546
|
if (t.length < r)
|
|
552
547
|
throw new Error("digestInto() expects output buffer of length at least " + r);
|
|
553
548
|
}
|
|
554
|
-
function
|
|
549
|
+
function _r(t) {
|
|
555
550
|
return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
556
551
|
}
|
|
557
|
-
function
|
|
552
|
+
function pt(...t) {
|
|
558
553
|
for (let e = 0; e < t.length; e++)
|
|
559
554
|
t[e].fill(0);
|
|
560
555
|
}
|
|
561
|
-
const
|
|
562
|
-
function
|
|
556
|
+
const Ar = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
557
|
+
function Ir(t) {
|
|
563
558
|
return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
564
559
|
}
|
|
565
|
-
function
|
|
560
|
+
function $r(t) {
|
|
566
561
|
for (let e = 0; e < t.length; e++)
|
|
567
|
-
t[e] =
|
|
562
|
+
t[e] = Ir(t[e]);
|
|
568
563
|
return t;
|
|
569
564
|
}
|
|
570
|
-
const
|
|
571
|
-
function
|
|
565
|
+
const Ze = Ar ? (t) => t : $r;
|
|
566
|
+
function Sr(t) {
|
|
572
567
|
if (typeof t != "string")
|
|
573
568
|
throw new Error("string expected");
|
|
574
569
|
return new Uint8Array(new TextEncoder().encode(t));
|
|
575
570
|
}
|
|
576
|
-
function
|
|
577
|
-
return typeof t == "string" && (t =
|
|
571
|
+
function gt(t) {
|
|
572
|
+
return typeof t == "string" && (t = Sr(t)), se(t), t;
|
|
578
573
|
}
|
|
579
|
-
class
|
|
574
|
+
class Lr {
|
|
580
575
|
}
|
|
581
|
-
function
|
|
582
|
-
const e = (n) => t().update(
|
|
576
|
+
function Nr(t) {
|
|
577
|
+
const e = (n) => t().update(gt(n)).digest(), r = t();
|
|
583
578
|
return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e;
|
|
584
579
|
}
|
|
585
|
-
const
|
|
586
|
-
function
|
|
587
|
-
return e ? { h: Number(t &
|
|
580
|
+
const te = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ke = /* @__PURE__ */ BigInt(32);
|
|
581
|
+
function Br(t, e = !1) {
|
|
582
|
+
return e ? { h: Number(t & te), l: Number(t >> Ke & te) } : { h: Number(t >> Ke & te) | 0, l: Number(t & te) | 0 };
|
|
588
583
|
}
|
|
589
|
-
function
|
|
584
|
+
function Pr(t, e = !1) {
|
|
590
585
|
const r = t.length;
|
|
591
586
|
let n = new Uint32Array(r), s = new Uint32Array(r);
|
|
592
587
|
for (let o = 0; o < r; o++) {
|
|
593
|
-
const { h:
|
|
594
|
-
[n[o], s[o]] = [
|
|
588
|
+
const { h: a, l: i } = Br(t[o], e);
|
|
589
|
+
[n[o], s[o]] = [a, i];
|
|
595
590
|
}
|
|
596
591
|
return [n, s];
|
|
597
592
|
}
|
|
598
|
-
const
|
|
599
|
-
for (let t = 0, e =
|
|
600
|
-
[r, n] = [n, (2 * r + 3 * n) % 5],
|
|
601
|
-
let s =
|
|
593
|
+
const Tr = (t, e, r) => t << r | e >>> 32 - r, Rr = (t, e, r) => e << r | t >>> 32 - r, Ur = (t, e, r) => e << r - 32 | t >>> 64 - r, Mr = (t, e, r) => t << r - 32 | e >>> 64 - r, zr = BigInt(0), W = BigInt(1), Or = BigInt(2), Dr = BigInt(7), Fr = BigInt(256), Qr = BigInt(113), mt = [], wt = [], yt = [];
|
|
594
|
+
for (let t = 0, e = W, r = 1, n = 0; t < 24; t++) {
|
|
595
|
+
[r, n] = [n, (2 * r + 3 * n) % 5], mt.push(2 * (5 * n + r)), wt.push((t + 1) * (t + 2) / 2 % 64);
|
|
596
|
+
let s = zr;
|
|
602
597
|
for (let o = 0; o < 7; o++)
|
|
603
|
-
e = (e <<
|
|
604
|
-
|
|
598
|
+
e = (e << W ^ (e >> Dr) * Qr) % Fr, e & Or && (s ^= W << (W << /* @__PURE__ */ BigInt(o)) - W);
|
|
599
|
+
yt.push(s);
|
|
605
600
|
}
|
|
606
|
-
const
|
|
607
|
-
function
|
|
601
|
+
const bt = Pr(yt, !0), Hr = bt[0], jr = bt[1], Ge = (t, e, r) => r > 32 ? Ur(t, e, r) : Tr(t, e, r), Xe = (t, e, r) => r > 32 ? Mr(t, e, r) : Rr(t, e, r);
|
|
602
|
+
function Wr(t, e = 24) {
|
|
608
603
|
const r = new Uint32Array(10);
|
|
609
604
|
for (let n = 24 - e; n < 24; n++) {
|
|
610
|
-
for (let
|
|
611
|
-
r[
|
|
612
|
-
for (let
|
|
613
|
-
const
|
|
605
|
+
for (let a = 0; a < 10; a++)
|
|
606
|
+
r[a] = t[a] ^ t[a + 10] ^ t[a + 20] ^ t[a + 30] ^ t[a + 40];
|
|
607
|
+
for (let a = 0; a < 10; a += 2) {
|
|
608
|
+
const i = (a + 8) % 10, l = (a + 2) % 10, c = r[l], d = r[l + 1], h = Ge(c, d, 1) ^ r[i], f = Xe(c, d, 1) ^ r[i + 1];
|
|
614
609
|
for (let u = 0; u < 50; u += 10)
|
|
615
|
-
t[
|
|
610
|
+
t[a + u] ^= h, t[a + u + 1] ^= f;
|
|
616
611
|
}
|
|
617
612
|
let s = t[2], o = t[3];
|
|
618
|
-
for (let
|
|
619
|
-
const
|
|
613
|
+
for (let a = 0; a < 24; a++) {
|
|
614
|
+
const i = wt[a], l = Ge(s, o, i), c = Xe(s, o, i), d = mt[a];
|
|
620
615
|
s = t[d], o = t[d + 1], t[d] = l, t[d + 1] = c;
|
|
621
616
|
}
|
|
622
|
-
for (let
|
|
623
|
-
for (let
|
|
624
|
-
r[
|
|
625
|
-
for (let
|
|
626
|
-
t[
|
|
617
|
+
for (let a = 0; a < 50; a += 10) {
|
|
618
|
+
for (let i = 0; i < 10; i++)
|
|
619
|
+
r[i] = t[a + i];
|
|
620
|
+
for (let i = 0; i < 10; i++)
|
|
621
|
+
t[a + i] ^= ~r[(i + 2) % 10] & r[(i + 4) % 10];
|
|
627
622
|
}
|
|
628
|
-
t[0] ^=
|
|
623
|
+
t[0] ^= Hr[n], t[1] ^= jr[n];
|
|
629
624
|
}
|
|
630
|
-
|
|
625
|
+
pt(r);
|
|
631
626
|
}
|
|
632
|
-
class
|
|
627
|
+
class Le extends Lr {
|
|
633
628
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
634
629
|
constructor(e, r, n, s = !1, o = 24) {
|
|
635
|
-
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = s, this.rounds = o,
|
|
630
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = r, this.outputLen = n, this.enableXOF = s, this.rounds = o, Ve(n), !(0 < e && e < 200))
|
|
636
631
|
throw new Error("only keccak-f1600 function is supported");
|
|
637
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
632
|
+
this.state = new Uint8Array(200), this.state32 = _r(this.state);
|
|
638
633
|
}
|
|
639
634
|
clone() {
|
|
640
635
|
return this._cloneInto();
|
|
641
636
|
}
|
|
642
637
|
keccak() {
|
|
643
|
-
|
|
638
|
+
Ze(this.state32), Wr(this.state32, this.rounds), Ze(this.state32), this.posOut = 0, this.pos = 0;
|
|
644
639
|
}
|
|
645
640
|
update(e) {
|
|
646
|
-
|
|
641
|
+
qe(this), e = gt(e), se(e);
|
|
647
642
|
const { blockLen: r, state: n } = this, s = e.length;
|
|
648
643
|
for (let o = 0; o < s; ) {
|
|
649
|
-
const
|
|
650
|
-
for (let
|
|
644
|
+
const a = Math.min(r - this.pos, s - o);
|
|
645
|
+
for (let i = 0; i < a; i++)
|
|
651
646
|
n[this.pos++] ^= e[o++];
|
|
652
647
|
this.pos === r && this.keccak();
|
|
653
648
|
}
|
|
@@ -661,12 +656,12 @@ class $e extends kr {
|
|
|
661
656
|
e[n] ^= r, (r & 128) !== 0 && n === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
662
657
|
}
|
|
663
658
|
writeInto(e) {
|
|
664
|
-
|
|
659
|
+
qe(this, !1), se(e), this.finish();
|
|
665
660
|
const r = this.state, { blockLen: n } = this;
|
|
666
661
|
for (let s = 0, o = e.length; s < o; ) {
|
|
667
662
|
this.posOut >= n && this.keccak();
|
|
668
|
-
const
|
|
669
|
-
e.set(r.subarray(this.posOut, this.posOut +
|
|
663
|
+
const a = Math.min(n - this.posOut, o - s);
|
|
664
|
+
e.set(r.subarray(this.posOut, this.posOut + a), s), this.posOut += a, s += a;
|
|
670
665
|
}
|
|
671
666
|
return e;
|
|
672
667
|
}
|
|
@@ -676,10 +671,10 @@ class $e extends kr {
|
|
|
676
671
|
return this.writeInto(e);
|
|
677
672
|
}
|
|
678
673
|
xof(e) {
|
|
679
|
-
return
|
|
674
|
+
return Ve(e), this.xofInto(new Uint8Array(e));
|
|
680
675
|
}
|
|
681
676
|
digestInto(e) {
|
|
682
|
-
if (
|
|
677
|
+
if (Er(e, this), this.finished)
|
|
683
678
|
throw new Error("digest() was already called");
|
|
684
679
|
return this.writeInto(e), this.destroy(), e;
|
|
685
680
|
}
|
|
@@ -687,55 +682,55 @@ class $e extends kr {
|
|
|
687
682
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
688
683
|
}
|
|
689
684
|
destroy() {
|
|
690
|
-
this.destroyed = !0,
|
|
685
|
+
this.destroyed = !0, pt(this.state);
|
|
691
686
|
}
|
|
692
687
|
_cloneInto(e) {
|
|
693
|
-
const { blockLen: r, suffix: n, outputLen: s, rounds: o, enableXOF:
|
|
694
|
-
return e || (e = new
|
|
688
|
+
const { blockLen: r, suffix: n, outputLen: s, rounds: o, enableXOF: a } = this;
|
|
689
|
+
return e || (e = new Le(r, n, s, a, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = n, e.outputLen = s, e.enableXOF = a, e.destroyed = this.destroyed, e;
|
|
695
690
|
}
|
|
696
691
|
}
|
|
697
|
-
const
|
|
698
|
-
let
|
|
699
|
-
const
|
|
700
|
-
return
|
|
692
|
+
const Yr = (t, e, r) => Nr(() => new Le(e, t, r)), Vr = Yr(1, 136, 256 / 8);
|
|
693
|
+
let Ct = !1;
|
|
694
|
+
const xt = function(t) {
|
|
695
|
+
return Vr(t);
|
|
701
696
|
};
|
|
702
|
-
let
|
|
697
|
+
let vt = xt;
|
|
703
698
|
function X(t) {
|
|
704
|
-
const e =
|
|
705
|
-
return
|
|
699
|
+
const e = Se(t, "data");
|
|
700
|
+
return vr(vt(e));
|
|
706
701
|
}
|
|
707
|
-
X._ =
|
|
702
|
+
X._ = xt;
|
|
708
703
|
X.lock = function() {
|
|
709
|
-
|
|
704
|
+
Ct = !0;
|
|
710
705
|
};
|
|
711
706
|
X.register = function(t) {
|
|
712
|
-
if (
|
|
707
|
+
if (Ct)
|
|
713
708
|
throw new TypeError("keccak256 is locked");
|
|
714
|
-
|
|
709
|
+
vt = t;
|
|
715
710
|
};
|
|
716
711
|
Object.freeze(X);
|
|
717
|
-
const
|
|
718
|
-
function
|
|
712
|
+
const qr = BigInt(0), Zr = BigInt(36);
|
|
713
|
+
function Je(t) {
|
|
719
714
|
t = t.toLowerCase();
|
|
720
715
|
const e = t.substring(2).split(""), r = new Uint8Array(40);
|
|
721
716
|
for (let s = 0; s < 40; s++)
|
|
722
717
|
r[s] = e[s].charCodeAt(0);
|
|
723
|
-
const n =
|
|
718
|
+
const n = Se(X(r));
|
|
724
719
|
for (let s = 0; s < 40; s += 2)
|
|
725
720
|
n[s >> 1] >> 4 >= 8 && (e[s] = e[s].toUpperCase()), (n[s >> 1] & 15) >= 8 && (e[s + 1] = e[s + 1].toUpperCase());
|
|
726
721
|
return "0x" + e.join("");
|
|
727
722
|
}
|
|
728
|
-
const
|
|
723
|
+
const Ne = {};
|
|
729
724
|
for (let t = 0; t < 10; t++)
|
|
730
|
-
|
|
725
|
+
Ne[String(t)] = String(t);
|
|
731
726
|
for (let t = 0; t < 26; t++)
|
|
732
|
-
|
|
733
|
-
const
|
|
734
|
-
function
|
|
727
|
+
Ne[String.fromCharCode(65 + t)] = String(10 + t);
|
|
728
|
+
const et = 15;
|
|
729
|
+
function Kr(t) {
|
|
735
730
|
t = t.toUpperCase(), t = t.substring(4) + t.substring(0, 2) + "00";
|
|
736
|
-
let e = t.split("").map((n) =>
|
|
737
|
-
for (; e.length >=
|
|
738
|
-
let n = e.substring(0,
|
|
731
|
+
let e = t.split("").map((n) => Ne[n]).join("");
|
|
732
|
+
for (; e.length >= et; ) {
|
|
733
|
+
let n = e.substring(0, et);
|
|
739
734
|
e = parseInt(n, 10) % 97 + e.substring(n.length);
|
|
740
735
|
}
|
|
741
736
|
let r = String(98 - parseInt(e, 10) % 97);
|
|
@@ -743,7 +738,7 @@ function Qr(t) {
|
|
|
743
738
|
r = "0" + r;
|
|
744
739
|
return r;
|
|
745
740
|
}
|
|
746
|
-
const
|
|
741
|
+
const Gr = function() {
|
|
747
742
|
const t = {};
|
|
748
743
|
for (let e = 0; e < 36; e++) {
|
|
749
744
|
const r = "0123456789abcdefghijklmnopqrstuvwxyz"[e];
|
|
@@ -751,29 +746,29 @@ const Fr = function() {
|
|
|
751
746
|
}
|
|
752
747
|
return t;
|
|
753
748
|
}();
|
|
754
|
-
function
|
|
749
|
+
function Xr(t) {
|
|
755
750
|
t = t.toLowerCase();
|
|
756
|
-
let e =
|
|
751
|
+
let e = qr;
|
|
757
752
|
for (let r = 0; r < t.length; r++)
|
|
758
|
-
e = e *
|
|
753
|
+
e = e * Zr + Gr[t[r]];
|
|
759
754
|
return e;
|
|
760
755
|
}
|
|
761
|
-
function
|
|
756
|
+
function P(t) {
|
|
762
757
|
if (Y(typeof t == "string", "invalid address", "address", t), t.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
|
763
758
|
t.startsWith("0x") || (t = "0x" + t);
|
|
764
|
-
const e =
|
|
759
|
+
const e = Je(t);
|
|
765
760
|
return Y(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || e === t, "bad address checksum", "address", t), e;
|
|
766
761
|
}
|
|
767
762
|
if (t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
|
768
|
-
Y(t.substring(2, 4) ===
|
|
769
|
-
let e =
|
|
763
|
+
Y(t.substring(2, 4) === Kr(t), "bad icap checksum", "address", t);
|
|
764
|
+
let e = Xr(t.substring(4)).toString(16);
|
|
770
765
|
for (; e.length < 40; )
|
|
771
766
|
e = "0" + e;
|
|
772
|
-
return
|
|
767
|
+
return Je("0x" + e);
|
|
773
768
|
}
|
|
774
769
|
Y(!1, "invalid address", "address", t);
|
|
775
770
|
}
|
|
776
|
-
class
|
|
771
|
+
class Jr {
|
|
777
772
|
type = "argent";
|
|
778
773
|
platform = "starknet";
|
|
779
774
|
wallet = void 0;
|
|
@@ -907,16 +902,16 @@ class jr {
|
|
|
907
902
|
this.removeAccountChangeListener(), this.wallet = void 0, this.account = void 0, this.connectedAccounts = [];
|
|
908
903
|
}
|
|
909
904
|
}
|
|
910
|
-
function
|
|
905
|
+
function en(t) {
|
|
911
906
|
if (typeof window > "u")
|
|
912
907
|
return;
|
|
913
908
|
const e = (r) => t(r.detail);
|
|
914
909
|
return window.addEventListener("eip6963:announceProvider", e), window.dispatchEvent(new CustomEvent("eip6963:requestProvider")), () => window.removeEventListener("eip6963:announceProvider", e);
|
|
915
910
|
}
|
|
916
|
-
function
|
|
911
|
+
function tn() {
|
|
917
912
|
const t = /* @__PURE__ */ new Set();
|
|
918
913
|
let e = [];
|
|
919
|
-
const r = () =>
|
|
914
|
+
const r = () => en((s) => {
|
|
920
915
|
e.some(({ info: o }) => o.uuid === s.info.uuid) || (e = [...e, s], t.forEach((o) => o(e, { added: [s] })));
|
|
921
916
|
});
|
|
922
917
|
let n = r();
|
|
@@ -944,7 +939,7 @@ function Hr() {
|
|
|
944
939
|
}
|
|
945
940
|
};
|
|
946
941
|
}
|
|
947
|
-
const
|
|
942
|
+
const rn = {
|
|
948
943
|
"0x1": "ethereum",
|
|
949
944
|
// ethereum mainnet
|
|
950
945
|
"0xaa36a7": "ethereum",
|
|
@@ -961,16 +956,16 @@ const Vr = {
|
|
|
961
956
|
// op mainnet
|
|
962
957
|
"0xaa37dc": "optimism",
|
|
963
958
|
// op sepolia
|
|
964
|
-
[
|
|
965
|
-
[
|
|
966
|
-
},
|
|
967
|
-
const e =
|
|
959
|
+
[Z.StarknetChainId.SN_MAIN]: "starknet",
|
|
960
|
+
[Z.StarknetChainId.SN_SEPOLIA]: "starknet"
|
|
961
|
+
}, ge = (t) => {
|
|
962
|
+
const e = ct.toHex(t), r = rn[e];
|
|
968
963
|
return r || console.warn(`Unknown chain ID: ${e}`), r;
|
|
969
964
|
};
|
|
970
|
-
class
|
|
965
|
+
class de {
|
|
971
966
|
platform;
|
|
972
967
|
account = void 0;
|
|
973
|
-
store =
|
|
968
|
+
store = tn();
|
|
974
969
|
provider;
|
|
975
970
|
connectedAccounts = [];
|
|
976
971
|
constructor() {
|
|
@@ -992,19 +987,19 @@ class Se {
|
|
|
992
987
|
e && (e.provider.request({
|
|
993
988
|
method: "eth_accounts"
|
|
994
989
|
}).then((r) => {
|
|
995
|
-
this.connectedAccounts = r.map(
|
|
990
|
+
this.connectedAccounts = r.map(P), r.length > 0 && (this.account = P(r[0]));
|
|
996
991
|
}).catch(console.error), e.provider.request({
|
|
997
992
|
method: "eth_chainId"
|
|
998
993
|
}).then((r) => {
|
|
999
|
-
this.platform =
|
|
994
|
+
this.platform = ge(r);
|
|
1000
995
|
}).catch(console.error), e.provider?.on("chainChanged", (r) => {
|
|
1001
|
-
this.platform =
|
|
996
|
+
this.platform = ge(r);
|
|
1002
997
|
}), e.provider?.on("accountsChanged", (r) => {
|
|
1003
|
-
r && (this.connectedAccounts = r.map((n) =>
|
|
998
|
+
r && (this.connectedAccounts = r.map((n) => P(n)), this.account = r.length > 0 ? P(r[0]) : void 0);
|
|
1004
999
|
}));
|
|
1005
1000
|
}
|
|
1006
1001
|
isAvailable() {
|
|
1007
|
-
if (
|
|
1002
|
+
if (jt())
|
|
1008
1003
|
return !1;
|
|
1009
1004
|
const e = this.getProvider();
|
|
1010
1005
|
return !e && this.rdns === "io.metamask" && typeof window < "u" ? !!window.ethereum?.isMetaMask : (e && !this.initialized && this.initializeIfAvailable(), typeof window < "u" && !!e);
|
|
@@ -1025,7 +1020,7 @@ class Se {
|
|
|
1025
1020
|
return this.connectedAccounts;
|
|
1026
1021
|
}
|
|
1027
1022
|
async connect(e) {
|
|
1028
|
-
if (e && this.connectedAccounts.includes(
|
|
1023
|
+
if (e && this.connectedAccounts.includes(P(e)) && (this.account = P(e)), this.account)
|
|
1029
1024
|
return { success: !0, wallet: this.type, account: this.account };
|
|
1030
1025
|
try {
|
|
1031
1026
|
if (!this.isAvailable())
|
|
@@ -1038,7 +1033,7 @@ class Se {
|
|
|
1038
1033
|
method: "eth_requestAccounts"
|
|
1039
1034
|
});
|
|
1040
1035
|
if (s && s.length > 0)
|
|
1041
|
-
return this.account =
|
|
1036
|
+
return this.account = P(s[0]), this.connectedAccounts = s.map(P), !n && this.rdns === "io.metamask" && (this.provider = {
|
|
1042
1037
|
info: {
|
|
1043
1038
|
uuid: "metamask-fallback",
|
|
1044
1039
|
name: "MetaMask",
|
|
@@ -1156,7 +1151,7 @@ class Se {
|
|
|
1156
1151
|
return await r.request({
|
|
1157
1152
|
method: "wallet_switchEthereumChain",
|
|
1158
1153
|
params: [{ chainId: e }]
|
|
1159
|
-
}), this.platform =
|
|
1154
|
+
}), this.platform = ge(e), !0;
|
|
1160
1155
|
} catch (n) {
|
|
1161
1156
|
throw n.code === 4902 && console.warn(`Chain not added to ${this.displayName}`), n;
|
|
1162
1157
|
}
|
|
@@ -1201,17 +1196,17 @@ class Se {
|
|
|
1201
1196
|
throw new Error(`${this.displayName} is not connected`);
|
|
1202
1197
|
const s = Date.now(), o = 1e3;
|
|
1203
1198
|
for (; Date.now() - s < r; ) {
|
|
1204
|
-
const
|
|
1199
|
+
const a = await n.request({
|
|
1205
1200
|
method: "eth_getTransactionReceipt",
|
|
1206
1201
|
params: [e]
|
|
1207
1202
|
});
|
|
1208
|
-
if (
|
|
1203
|
+
if (a)
|
|
1209
1204
|
return {
|
|
1210
1205
|
success: !0,
|
|
1211
1206
|
wallet: this.type,
|
|
1212
|
-
result:
|
|
1207
|
+
result: a
|
|
1213
1208
|
};
|
|
1214
|
-
await new Promise((
|
|
1209
|
+
await new Promise((i) => setTimeout(i, o));
|
|
1215
1210
|
}
|
|
1216
1211
|
throw new Error("Transaction confirmation timed out");
|
|
1217
1212
|
} catch (n) {
|
|
@@ -1226,35 +1221,35 @@ class Se {
|
|
|
1226
1221
|
}
|
|
1227
1222
|
}
|
|
1228
1223
|
}
|
|
1229
|
-
class
|
|
1224
|
+
class nn extends de {
|
|
1230
1225
|
type = "base";
|
|
1231
1226
|
rdns = "com.coinbase.wallet";
|
|
1232
1227
|
displayName = "Base Wallet";
|
|
1233
1228
|
}
|
|
1234
|
-
class
|
|
1229
|
+
class sn extends de {
|
|
1235
1230
|
type = "metamask";
|
|
1236
1231
|
rdns = "io.metamask";
|
|
1237
1232
|
displayName = "MetaMask";
|
|
1238
1233
|
}
|
|
1239
1234
|
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1240
|
-
function
|
|
1235
|
+
function Be(t) {
|
|
1241
1236
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
1242
1237
|
}
|
|
1243
|
-
function
|
|
1244
|
-
if (!
|
|
1238
|
+
function kt(t, ...e) {
|
|
1239
|
+
if (!Be(t))
|
|
1245
1240
|
throw new Error("Uint8Array expected");
|
|
1246
1241
|
if (e.length > 0 && !e.includes(t.length))
|
|
1247
1242
|
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
|
|
1248
1243
|
}
|
|
1249
|
-
function
|
|
1244
|
+
function Et(t, e) {
|
|
1250
1245
|
return Array.isArray(e) ? e.length === 0 ? !0 : t ? e.every((r) => typeof r == "string") : e.every((r) => Number.isSafeInteger(r)) : !1;
|
|
1251
1246
|
}
|
|
1252
|
-
function
|
|
1247
|
+
function on(t) {
|
|
1253
1248
|
if (typeof t != "function")
|
|
1254
1249
|
throw new Error("function expected");
|
|
1255
1250
|
return !0;
|
|
1256
1251
|
}
|
|
1257
|
-
function
|
|
1252
|
+
function j(t, e) {
|
|
1258
1253
|
if (typeof e != "string")
|
|
1259
1254
|
throw new Error(`${t}: string expected`);
|
|
1260
1255
|
return !0;
|
|
@@ -1263,60 +1258,60 @@ function J(t) {
|
|
|
1263
1258
|
if (!Number.isSafeInteger(t))
|
|
1264
1259
|
throw new Error(`invalid integer: ${t}`);
|
|
1265
1260
|
}
|
|
1266
|
-
function
|
|
1261
|
+
function oe(t) {
|
|
1267
1262
|
if (!Array.isArray(t))
|
|
1268
1263
|
throw new Error("array expected");
|
|
1269
1264
|
}
|
|
1270
|
-
function
|
|
1271
|
-
if (!
|
|
1265
|
+
function ae(t, e) {
|
|
1266
|
+
if (!Et(!0, e))
|
|
1272
1267
|
throw new Error(`${t}: array of strings expected`);
|
|
1273
1268
|
}
|
|
1274
|
-
function
|
|
1275
|
-
if (!
|
|
1269
|
+
function _t(t, e) {
|
|
1270
|
+
if (!Et(!1, e))
|
|
1276
1271
|
throw new Error(`${t}: array of numbers expected`);
|
|
1277
1272
|
}
|
|
1278
1273
|
// @__NO_SIDE_EFFECTS__
|
|
1279
1274
|
function Pe(...t) {
|
|
1280
|
-
const e = (o) => o, r = (o,
|
|
1275
|
+
const e = (o) => o, r = (o, a) => (i) => o(a(i)), n = t.map((o) => o.encode).reduceRight(r, e), s = t.map((o) => o.decode).reduce(r, e);
|
|
1281
1276
|
return { encode: n, decode: s };
|
|
1282
1277
|
}
|
|
1283
1278
|
// @__NO_SIDE_EFFECTS__
|
|
1284
|
-
function
|
|
1279
|
+
function Te(t) {
|
|
1285
1280
|
const e = typeof t == "string" ? t.split("") : t, r = e.length;
|
|
1286
|
-
|
|
1281
|
+
ae("alphabet", e);
|
|
1287
1282
|
const n = new Map(e.map((s, o) => [s, o]));
|
|
1288
1283
|
return {
|
|
1289
|
-
encode: (s) => (
|
|
1284
|
+
encode: (s) => (oe(s), s.map((o) => {
|
|
1290
1285
|
if (!Number.isSafeInteger(o) || o < 0 || o >= r)
|
|
1291
1286
|
throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${t}`);
|
|
1292
1287
|
return e[o];
|
|
1293
1288
|
})),
|
|
1294
|
-
decode: (s) => (
|
|
1295
|
-
|
|
1296
|
-
const
|
|
1297
|
-
if (
|
|
1289
|
+
decode: (s) => (oe(s), s.map((o) => {
|
|
1290
|
+
j("alphabet.decode", o);
|
|
1291
|
+
const a = n.get(o);
|
|
1292
|
+
if (a === void 0)
|
|
1298
1293
|
throw new Error(`Unknown letter: "${o}". Allowed: ${t}`);
|
|
1299
|
-
return
|
|
1294
|
+
return a;
|
|
1300
1295
|
}))
|
|
1301
1296
|
};
|
|
1302
1297
|
}
|
|
1303
1298
|
// @__NO_SIDE_EFFECTS__
|
|
1304
|
-
function
|
|
1305
|
-
return
|
|
1306
|
-
encode: (e) => (
|
|
1307
|
-
decode: (e) => (
|
|
1299
|
+
function Re(t = "") {
|
|
1300
|
+
return j("join", t), {
|
|
1301
|
+
encode: (e) => (ae("join.decode", e), e.join(t)),
|
|
1302
|
+
decode: (e) => (j("join.decode", e), e.split(t))
|
|
1308
1303
|
};
|
|
1309
1304
|
}
|
|
1310
1305
|
// @__NO_SIDE_EFFECTS__
|
|
1311
|
-
function
|
|
1312
|
-
return J(t),
|
|
1306
|
+
function an(t, e = "=") {
|
|
1307
|
+
return J(t), j("padding", e), {
|
|
1313
1308
|
encode(r) {
|
|
1314
|
-
for (
|
|
1309
|
+
for (ae("padding.encode", r); r.length * t % 8; )
|
|
1315
1310
|
r.push(e);
|
|
1316
1311
|
return r;
|
|
1317
1312
|
},
|
|
1318
1313
|
decode(r) {
|
|
1319
|
-
|
|
1314
|
+
ae("padding.decode", r);
|
|
1320
1315
|
let n = r.length;
|
|
1321
1316
|
if (n * t % 8)
|
|
1322
1317
|
throw new Error("padding: invalid, string should have whole number of bytes");
|
|
@@ -1328,128 +1323,128 @@ function Xr(t, e = "=") {
|
|
|
1328
1323
|
};
|
|
1329
1324
|
}
|
|
1330
1325
|
// @__NO_SIDE_EFFECTS__
|
|
1331
|
-
function
|
|
1332
|
-
return
|
|
1326
|
+
function cn(t) {
|
|
1327
|
+
return on(t), { encode: (e) => e, decode: (e) => t(e) };
|
|
1333
1328
|
}
|
|
1334
|
-
function
|
|
1329
|
+
function tt(t, e, r) {
|
|
1335
1330
|
if (e < 2)
|
|
1336
1331
|
throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);
|
|
1337
1332
|
if (r < 2)
|
|
1338
1333
|
throw new Error(`convertRadix: invalid to=${r}, base cannot be less than 2`);
|
|
1339
|
-
if (
|
|
1334
|
+
if (oe(t), !t.length)
|
|
1340
1335
|
return [];
|
|
1341
1336
|
let n = 0;
|
|
1342
|
-
const s = [], o = Array.from(t, (
|
|
1343
|
-
if (J(
|
|
1344
|
-
throw new Error(`invalid integer: ${
|
|
1345
|
-
return
|
|
1346
|
-
}),
|
|
1337
|
+
const s = [], o = Array.from(t, (i) => {
|
|
1338
|
+
if (J(i), i < 0 || i >= e)
|
|
1339
|
+
throw new Error(`invalid integer: ${i}`);
|
|
1340
|
+
return i;
|
|
1341
|
+
}), a = o.length;
|
|
1347
1342
|
for (; ; ) {
|
|
1348
|
-
let
|
|
1349
|
-
for (let c = n; c <
|
|
1350
|
-
const d = o[c], h = e *
|
|
1351
|
-
if (!Number.isSafeInteger(f) || h / e !==
|
|
1343
|
+
let i = 0, l = !0;
|
|
1344
|
+
for (let c = n; c < a; c++) {
|
|
1345
|
+
const d = o[c], h = e * i, f = h + d;
|
|
1346
|
+
if (!Number.isSafeInteger(f) || h / e !== i || f - d !== h)
|
|
1352
1347
|
throw new Error("convertRadix: carry overflow");
|
|
1353
1348
|
const u = f / r;
|
|
1354
|
-
|
|
1355
|
-
const
|
|
1356
|
-
if (o[c] =
|
|
1349
|
+
i = f % r;
|
|
1350
|
+
const p = Math.floor(u);
|
|
1351
|
+
if (o[c] = p, !Number.isSafeInteger(p) || p * r + i !== f)
|
|
1357
1352
|
throw new Error("convertRadix: carry overflow");
|
|
1358
1353
|
if (l)
|
|
1359
|
-
|
|
1354
|
+
p ? l = !1 : n = c;
|
|
1360
1355
|
else continue;
|
|
1361
1356
|
}
|
|
1362
|
-
if (s.push(
|
|
1357
|
+
if (s.push(i), l)
|
|
1363
1358
|
break;
|
|
1364
1359
|
}
|
|
1365
|
-
for (let
|
|
1360
|
+
for (let i = 0; i < t.length - 1 && t[i] === 0; i++)
|
|
1366
1361
|
s.push(0);
|
|
1367
1362
|
return s.reverse();
|
|
1368
1363
|
}
|
|
1369
|
-
const
|
|
1364
|
+
const At = (t, e) => e === 0 ? t : At(e, t % e), ie = /* @__NO_SIDE_EFFECTS__ */ (t, e) => t + (e - At(t, e)), me = /* @__PURE__ */ (() => {
|
|
1370
1365
|
let t = [];
|
|
1371
1366
|
for (let e = 0; e < 40; e++)
|
|
1372
1367
|
t.push(2 ** e);
|
|
1373
1368
|
return t;
|
|
1374
1369
|
})();
|
|
1375
|
-
function
|
|
1376
|
-
if (
|
|
1370
|
+
function rt(t, e, r, n) {
|
|
1371
|
+
if (oe(t), e <= 0 || e > 32)
|
|
1377
1372
|
throw new Error(`convertRadix2: wrong from=${e}`);
|
|
1378
1373
|
if (r <= 0 || r > 32)
|
|
1379
1374
|
throw new Error(`convertRadix2: wrong to=${r}`);
|
|
1380
|
-
if (/* @__PURE__ */
|
|
1381
|
-
throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${/* @__PURE__ */
|
|
1375
|
+
if (/* @__PURE__ */ ie(e, r) > 32)
|
|
1376
|
+
throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${/* @__PURE__ */ ie(e, r)}`);
|
|
1382
1377
|
let s = 0, o = 0;
|
|
1383
|
-
const
|
|
1378
|
+
const a = me[e], i = me[r] - 1, l = [];
|
|
1384
1379
|
for (const c of t) {
|
|
1385
|
-
if (J(c), c >=
|
|
1380
|
+
if (J(c), c >= a)
|
|
1386
1381
|
throw new Error(`convertRadix2: invalid data word=${c} from=${e}`);
|
|
1387
1382
|
if (s = s << e | c, o + e > 32)
|
|
1388
1383
|
throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);
|
|
1389
1384
|
for (o += e; o >= r; o -= r)
|
|
1390
|
-
l.push((s >> o - r &
|
|
1391
|
-
const d =
|
|
1385
|
+
l.push((s >> o - r & i) >>> 0);
|
|
1386
|
+
const d = me[o];
|
|
1392
1387
|
if (d === void 0)
|
|
1393
1388
|
throw new Error("invalid carry");
|
|
1394
1389
|
s &= d - 1;
|
|
1395
1390
|
}
|
|
1396
|
-
if (s = s << r - o &
|
|
1391
|
+
if (s = s << r - o & i, !n && o >= e)
|
|
1397
1392
|
throw new Error("Excess padding");
|
|
1398
1393
|
if (!n && s > 0)
|
|
1399
1394
|
throw new Error(`Non-zero padding: ${s}`);
|
|
1400
1395
|
return n && o > 0 && l.push(s >>> 0), l;
|
|
1401
1396
|
}
|
|
1402
1397
|
// @__NO_SIDE_EFFECTS__
|
|
1403
|
-
function
|
|
1398
|
+
function ln(t) {
|
|
1404
1399
|
J(t);
|
|
1405
1400
|
const e = 2 ** 8;
|
|
1406
1401
|
return {
|
|
1407
1402
|
encode: (r) => {
|
|
1408
|
-
if (!
|
|
1403
|
+
if (!Be(r))
|
|
1409
1404
|
throw new Error("radix.encode input should be Uint8Array");
|
|
1410
|
-
return
|
|
1405
|
+
return tt(Array.from(r), e, t);
|
|
1411
1406
|
},
|
|
1412
|
-
decode: (r) => (
|
|
1407
|
+
decode: (r) => (_t("radix.decode", r), Uint8Array.from(tt(r, t, e)))
|
|
1413
1408
|
};
|
|
1414
1409
|
}
|
|
1415
1410
|
// @__NO_SIDE_EFFECTS__
|
|
1416
|
-
function
|
|
1411
|
+
function It(t, e = !1) {
|
|
1417
1412
|
if (J(t), t <= 0 || t > 32)
|
|
1418
1413
|
throw new Error("radix2: bits should be in (0..32]");
|
|
1419
|
-
if (/* @__PURE__ */
|
|
1414
|
+
if (/* @__PURE__ */ ie(8, t) > 32 || /* @__PURE__ */ ie(t, 8) > 32)
|
|
1420
1415
|
throw new Error("radix2: carry overflow");
|
|
1421
1416
|
return {
|
|
1422
1417
|
encode: (r) => {
|
|
1423
|
-
if (!
|
|
1418
|
+
if (!Be(r))
|
|
1424
1419
|
throw new Error("radix2.encode input should be Uint8Array");
|
|
1425
|
-
return
|
|
1420
|
+
return rt(Array.from(r), 8, t, !e);
|
|
1426
1421
|
},
|
|
1427
|
-
decode: (r) => (
|
|
1422
|
+
decode: (r) => (_t("radix2.decode", r), Uint8Array.from(rt(r, t, 8, e)))
|
|
1428
1423
|
};
|
|
1429
1424
|
}
|
|
1430
|
-
const
|
|
1425
|
+
const dn = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", hn = dn ? {
|
|
1431
1426
|
encode(t) {
|
|
1432
|
-
return
|
|
1427
|
+
return kt(t), t.toBase64();
|
|
1433
1428
|
},
|
|
1434
1429
|
decode(t) {
|
|
1435
|
-
return
|
|
1430
|
+
return j("base64", t), Uint8Array.fromBase64(t, { lastChunkHandling: "strict" });
|
|
1436
1431
|
}
|
|
1437
|
-
} : /* @__PURE__ */ Pe(/* @__PURE__ */
|
|
1432
|
+
} : /* @__PURE__ */ Pe(/* @__PURE__ */ It(6), /* @__PURE__ */ Te("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ an(6), /* @__PURE__ */ Re("")), fn = /* @__NO_SIDE_EFFECTS__ */ (t) => /* @__PURE__ */ Pe(/* @__PURE__ */ ln(58), /* @__PURE__ */ Te(t), /* @__PURE__ */ Re("")), ke = /* @__PURE__ */ fn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), un = {
|
|
1438
1433
|
encode: (t) => new TextDecoder().decode(t),
|
|
1439
1434
|
decode: (t) => new TextEncoder().encode(t)
|
|
1440
|
-
},
|
|
1435
|
+
}, pn = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", gn = {
|
|
1441
1436
|
encode(t) {
|
|
1442
|
-
return
|
|
1437
|
+
return kt(t), t.toHex();
|
|
1443
1438
|
},
|
|
1444
1439
|
decode(t) {
|
|
1445
|
-
return
|
|
1440
|
+
return j("hex", t), Uint8Array.fromHex(t);
|
|
1446
1441
|
}
|
|
1447
|
-
}, we =
|
|
1442
|
+
}, we = pn ? gn : /* @__PURE__ */ Pe(/* @__PURE__ */ It(4), /* @__PURE__ */ Te("0123456789abcdef"), /* @__PURE__ */ Re(""), /* @__PURE__ */ cn((t) => {
|
|
1448
1443
|
if (typeof t != "string" || t.length % 2 !== 0)
|
|
1449
1444
|
throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);
|
|
1450
1445
|
return t.toLowerCase();
|
|
1451
1446
|
}));
|
|
1452
|
-
function
|
|
1447
|
+
function Ee(t, e) {
|
|
1453
1448
|
if (t.length !== e.length)
|
|
1454
1449
|
return !1;
|
|
1455
1450
|
for (let r = 0; r < t.length; r++)
|
|
@@ -1457,18 +1452,18 @@ function ke(t, e) {
|
|
|
1457
1452
|
return !1;
|
|
1458
1453
|
return !0;
|
|
1459
1454
|
}
|
|
1460
|
-
function
|
|
1455
|
+
function T(t) {
|
|
1461
1456
|
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
1462
1457
|
}
|
|
1463
|
-
const
|
|
1464
|
-
function
|
|
1458
|
+
const $t = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
1459
|
+
function D(t) {
|
|
1465
1460
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
1466
1461
|
}
|
|
1467
|
-
function
|
|
1462
|
+
function N(t) {
|
|
1468
1463
|
return Number.isSafeInteger(t);
|
|
1469
1464
|
}
|
|
1470
|
-
const
|
|
1471
|
-
if (t !== null && typeof t != "string" && !S(t) && !
|
|
1465
|
+
const St = (t) => {
|
|
1466
|
+
if (t !== null && typeof t != "string" && !S(t) && !T(t) && !N(t))
|
|
1472
1467
|
throw new Error(`lengthCoder: expected null | number | Uint8Array | CoderType, got ${t} (${typeof t})`);
|
|
1473
1468
|
return {
|
|
1474
1469
|
encodeStream(e, r) {
|
|
@@ -1477,12 +1472,12 @@ const At = (t) => {
|
|
|
1477
1472
|
if (S(t))
|
|
1478
1473
|
return t.encodeStream(e, r);
|
|
1479
1474
|
let n;
|
|
1480
|
-
if (typeof t == "number" ? n = t : typeof t == "string" && (n =
|
|
1475
|
+
if (typeof t == "number" ? n = t : typeof t == "string" && (n = O.resolve(e.stack, t)), typeof n == "bigint" && (n = Number(n)), n === void 0 || n !== r)
|
|
1481
1476
|
throw e.err(`Wrong length: ${n} len=${t} exp=${r} (${typeof r})`);
|
|
1482
1477
|
},
|
|
1483
1478
|
decodeStream(e) {
|
|
1484
1479
|
let r;
|
|
1485
|
-
if (S(t) ? r = Number(t.decodeStream(e)) : typeof t == "number" ? r = t : typeof t == "string" && (r =
|
|
1480
|
+
if (S(t) ? r = Number(t.decodeStream(e)) : typeof t == "number" ? r = t : typeof t == "string" && (r = O.resolve(e.stack, t)), typeof r == "bigint" && (r = Number(r)), typeof r != "number")
|
|
1486
1481
|
throw e.err(`Wrong length: ${r}`);
|
|
1487
1482
|
return r;
|
|
1488
1483
|
}
|
|
@@ -1512,16 +1507,16 @@ const At = (t) => {
|
|
|
1512
1507
|
}),
|
|
1513
1508
|
indices: (t, e, r = !1) => {
|
|
1514
1509
|
E.checkLen(t, e);
|
|
1515
|
-
const { FULL_MASK: n, BITS: s } = E, o = s - e % s,
|
|
1510
|
+
const { FULL_MASK: n, BITS: s } = E, o = s - e % s, a = o ? n >>> o << o : n, i = [];
|
|
1516
1511
|
for (let l = 0; l < t.length; l++) {
|
|
1517
1512
|
let c = t[l];
|
|
1518
|
-
if (r && (c = ~c), l === t.length - 1 && (c &=
|
|
1513
|
+
if (r && (c = ~c), l === t.length - 1 && (c &= a), c !== 0)
|
|
1519
1514
|
for (let d = 0; d < s; d++) {
|
|
1520
1515
|
const h = 1 << s - d - 1;
|
|
1521
|
-
c & h &&
|
|
1516
|
+
c & h && i.push(l * s + d);
|
|
1522
1517
|
}
|
|
1523
1518
|
}
|
|
1524
|
-
return
|
|
1519
|
+
return i;
|
|
1525
1520
|
},
|
|
1526
1521
|
range: (t) => {
|
|
1527
1522
|
const e = [];
|
|
@@ -1533,18 +1528,18 @@ const At = (t) => {
|
|
|
1533
1528
|
rangeDebug: (t, e, r = !1) => `[${E.range(E.indices(t, e, r)).map((n) => `(${n.pos}/${n.length})`).join(", ")}]`,
|
|
1534
1529
|
setRange: (t, e, r, n, s = !0) => {
|
|
1535
1530
|
E.chunkLen(e, r, n);
|
|
1536
|
-
const { FULL_MASK: o, BITS:
|
|
1537
|
-
if (
|
|
1538
|
-
return E.set(t,
|
|
1539
|
-
if (
|
|
1531
|
+
const { FULL_MASK: o, BITS: a } = E, i = r % a ? Math.floor(r / a) : void 0, l = r + n, c = l % a ? Math.floor(l / a) : void 0;
|
|
1532
|
+
if (i !== void 0 && i === c)
|
|
1533
|
+
return E.set(t, i, o >>> a - n << a - n - r, s);
|
|
1534
|
+
if (i !== void 0 && !E.set(t, i, o >>> r % a, s))
|
|
1540
1535
|
return !1;
|
|
1541
|
-
const d =
|
|
1536
|
+
const d = i !== void 0 ? i + 1 : r / a, h = c !== void 0 ? c : l / a;
|
|
1542
1537
|
for (let f = d; f < h; f++)
|
|
1543
1538
|
if (!E.set(t, f, o, s))
|
|
1544
1539
|
return !1;
|
|
1545
|
-
return !(c !== void 0 &&
|
|
1540
|
+
return !(c !== void 0 && i !== c && !E.set(t, c, o << a - l % a, s));
|
|
1546
1541
|
}
|
|
1547
|
-
},
|
|
1542
|
+
}, O = {
|
|
1548
1543
|
/**
|
|
1549
1544
|
* Internal method for handling stack of paths (debug, errors, dynamic fields via path)
|
|
1550
1545
|
* This is looks ugly (callback), but allows us to force stack cleaning by construction (.pop always after function).
|
|
@@ -1566,11 +1561,11 @@ const At = (t) => {
|
|
|
1566
1561
|
return e.join("/");
|
|
1567
1562
|
},
|
|
1568
1563
|
err: (t, e, r) => {
|
|
1569
|
-
const n = new Error(`${t}(${
|
|
1564
|
+
const n = new Error(`${t}(${O.path(e)}): ${typeof r == "string" ? r : r.message}`);
|
|
1570
1565
|
return r instanceof Error && r.stack && (n.stack = r.stack), n;
|
|
1571
1566
|
},
|
|
1572
1567
|
resolve: (t, e) => {
|
|
1573
|
-
const r = e.split("/"), n = t.map((
|
|
1568
|
+
const r = e.split("/"), n = t.map((a) => a.obj);
|
|
1574
1569
|
let s = 0;
|
|
1575
1570
|
for (; s < r.length && r[s] === ".."; s++)
|
|
1576
1571
|
n.pop();
|
|
@@ -1583,9 +1578,9 @@ const At = (t) => {
|
|
|
1583
1578
|
return o;
|
|
1584
1579
|
}
|
|
1585
1580
|
};
|
|
1586
|
-
class
|
|
1581
|
+
class Ue {
|
|
1587
1582
|
constructor(e, r = {}, n = [], s = void 0, o = 0) {
|
|
1588
|
-
this.pos = 0, this.bitBuf = 0, this.bitPos = 0, this.data = e, this.opts = r, this.stack = n, this.parent = s, this.parentOffset = o, this.view =
|
|
1583
|
+
this.pos = 0, this.bitBuf = 0, this.bitPos = 0, this.data = e, this.opts = r, this.stack = n, this.parent = s, this.parentOffset = o, this.view = $t(e);
|
|
1589
1584
|
}
|
|
1590
1585
|
/** Internal method for pointers. */
|
|
1591
1586
|
_enablePointers() {
|
|
@@ -1605,7 +1600,7 @@ class Re {
|
|
|
1605
1600
|
return n;
|
|
1606
1601
|
}
|
|
1607
1602
|
pushObj(e, r) {
|
|
1608
|
-
return
|
|
1603
|
+
return O.pushObj(this.stack, e, r);
|
|
1609
1604
|
}
|
|
1610
1605
|
readView(e, r) {
|
|
1611
1606
|
if (!Number.isFinite(e))
|
|
@@ -1639,12 +1634,12 @@ class Re {
|
|
|
1639
1634
|
}
|
|
1640
1635
|
// User methods
|
|
1641
1636
|
err(e) {
|
|
1642
|
-
return
|
|
1637
|
+
return O.err("Reader", this.stack, e);
|
|
1643
1638
|
}
|
|
1644
1639
|
offsetReader(e) {
|
|
1645
1640
|
if (e > this.data.length)
|
|
1646
1641
|
throw this.err("offsetReader: Unexpected end of buffer");
|
|
1647
|
-
return new
|
|
1642
|
+
return new Ue(this.absBytes(e), this.opts, this.stack, this, e);
|
|
1648
1643
|
}
|
|
1649
1644
|
bytes(e, r = !1) {
|
|
1650
1645
|
if (this.bitPos)
|
|
@@ -1686,7 +1681,7 @@ class Re {
|
|
|
1686
1681
|
return r >>> 0;
|
|
1687
1682
|
}
|
|
1688
1683
|
find(e, r = this.pos) {
|
|
1689
|
-
if (!
|
|
1684
|
+
if (!T(e))
|
|
1690
1685
|
throw this.err(`find: needle is not bytes! ${e}`);
|
|
1691
1686
|
if (this.bitPos)
|
|
1692
1687
|
throw this.err("findByte: bitPos not empty");
|
|
@@ -1695,22 +1690,22 @@ class Re {
|
|
|
1695
1690
|
for (let n = r; (n = this.data.indexOf(e[0], n)) !== -1; n++) {
|
|
1696
1691
|
if (n === -1 || this.data.length - n < e.length)
|
|
1697
1692
|
return;
|
|
1698
|
-
if (
|
|
1693
|
+
if (Ee(e, this.data.subarray(n, n + e.length)))
|
|
1699
1694
|
return n;
|
|
1700
1695
|
}
|
|
1701
1696
|
}
|
|
1702
1697
|
}
|
|
1703
|
-
class
|
|
1698
|
+
class mn {
|
|
1704
1699
|
constructor(e = []) {
|
|
1705
|
-
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 =
|
|
1700
|
+
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 = $t(this.viewBuf);
|
|
1706
1701
|
}
|
|
1707
1702
|
pushObj(e, r) {
|
|
1708
|
-
return
|
|
1703
|
+
return O.pushObj(this.stack, e, r);
|
|
1709
1704
|
}
|
|
1710
1705
|
writeView(e, r) {
|
|
1711
1706
|
if (this.finished)
|
|
1712
1707
|
throw this.err("buffer: finished");
|
|
1713
|
-
if (!
|
|
1708
|
+
if (!N(e) || e > 8)
|
|
1714
1709
|
throw new Error(`wrong writeView length=${e}`);
|
|
1715
1710
|
r(this.view), this.bytes(this.viewBuf.slice(0, e)), this.viewBuf.fill(0);
|
|
1716
1711
|
}
|
|
@@ -1718,7 +1713,7 @@ class an {
|
|
|
1718
1713
|
err(e) {
|
|
1719
1714
|
if (this.finished)
|
|
1720
1715
|
throw this.err("buffer: finished");
|
|
1721
|
-
return
|
|
1716
|
+
return O.err("Reader", this.stack, e);
|
|
1722
1717
|
}
|
|
1723
1718
|
bytes(e) {
|
|
1724
1719
|
if (this.finished)
|
|
@@ -1739,14 +1734,14 @@ class an {
|
|
|
1739
1734
|
throw this.err("buffer: finished");
|
|
1740
1735
|
if (this.bitPos)
|
|
1741
1736
|
throw this.err("buffer: ends with non-empty bit buffer");
|
|
1742
|
-
const r = this.buffers.concat(this.ptrs.map((o) => o.buffer)), n = r.map((o) => o.length).reduce((o,
|
|
1743
|
-
for (let o = 0,
|
|
1744
|
-
const
|
|
1745
|
-
s.set(
|
|
1737
|
+
const r = this.buffers.concat(this.ptrs.map((o) => o.buffer)), n = r.map((o) => o.length).reduce((o, a) => o + a, 0), s = new Uint8Array(n);
|
|
1738
|
+
for (let o = 0, a = 0; o < r.length; o++) {
|
|
1739
|
+
const i = r[o];
|
|
1740
|
+
s.set(i, a), a += i.length;
|
|
1746
1741
|
}
|
|
1747
|
-
for (let o = this.pos,
|
|
1748
|
-
const
|
|
1749
|
-
s.set(
|
|
1742
|
+
for (let o = this.pos, a = 0; a < this.ptrs.length; a++) {
|
|
1743
|
+
const i = this.ptrs[a];
|
|
1744
|
+
s.set(i.ptr.encode(o), i.pos), o += i.buffer.length;
|
|
1750
1745
|
}
|
|
1751
1746
|
if (e) {
|
|
1752
1747
|
this.buffers = [];
|
|
@@ -1767,8 +1762,8 @@ class an {
|
|
|
1767
1762
|
}
|
|
1768
1763
|
}
|
|
1769
1764
|
}
|
|
1770
|
-
const
|
|
1771
|
-
function
|
|
1765
|
+
const _e = (t) => Uint8Array.from(t).reverse();
|
|
1766
|
+
function wn(t, e, r) {
|
|
1772
1767
|
if (r) {
|
|
1773
1768
|
const n = 2n ** (e - 1n);
|
|
1774
1769
|
if (t < -n || t >= n)
|
|
@@ -1776,28 +1771,28 @@ function cn(t, e, r) {
|
|
|
1776
1771
|
} else if (0n > t || t >= 2n ** e)
|
|
1777
1772
|
throw new Error(`value out of unsigned bounds. Expected 0 <= ${t} < ${2n ** e}`);
|
|
1778
1773
|
}
|
|
1779
|
-
function
|
|
1774
|
+
function Lt(t) {
|
|
1780
1775
|
return {
|
|
1781
1776
|
// NOTE: we cannot export validate here, since it is likely mistake.
|
|
1782
1777
|
encodeStream: t.encodeStream,
|
|
1783
1778
|
decodeStream: t.decodeStream,
|
|
1784
1779
|
size: t.size,
|
|
1785
1780
|
encode: (e) => {
|
|
1786
|
-
const r = new
|
|
1781
|
+
const r = new mn();
|
|
1787
1782
|
return t.encodeStream(r, e), r.finish();
|
|
1788
1783
|
},
|
|
1789
1784
|
decode: (e, r = {}) => {
|
|
1790
|
-
const n = new
|
|
1785
|
+
const n = new Ue(e, r), s = t.decodeStream(n);
|
|
1791
1786
|
return n.finish(), s;
|
|
1792
1787
|
}
|
|
1793
1788
|
};
|
|
1794
1789
|
}
|
|
1795
|
-
function
|
|
1790
|
+
function Nt(t, e) {
|
|
1796
1791
|
if (!S(t))
|
|
1797
1792
|
throw new Error(`validate: invalid inner value ${t}`);
|
|
1798
1793
|
if (typeof e != "function")
|
|
1799
1794
|
throw new Error("validate: fn should be function");
|
|
1800
|
-
return
|
|
1795
|
+
return Lt({
|
|
1801
1796
|
size: t.size,
|
|
1802
1797
|
encodeStream: (r, n) => {
|
|
1803
1798
|
let s;
|
|
@@ -1818,14 +1813,14 @@ function vt(t, e) {
|
|
|
1818
1813
|
}
|
|
1819
1814
|
});
|
|
1820
1815
|
}
|
|
1821
|
-
const
|
|
1822
|
-
const e =
|
|
1823
|
-
return t.validate ?
|
|
1824
|
-
},
|
|
1816
|
+
const I = (t) => {
|
|
1817
|
+
const e = Lt(t);
|
|
1818
|
+
return t.validate ? Nt(e, t.validate) : e;
|
|
1819
|
+
}, he = (t) => D(t) && typeof t.decode == "function" && typeof t.encode == "function";
|
|
1825
1820
|
function S(t) {
|
|
1826
|
-
return
|
|
1821
|
+
return D(t) && he(t) && typeof t.encodeStream == "function" && typeof t.decodeStream == "function" && (t.size === void 0 || N(t.size));
|
|
1827
1822
|
}
|
|
1828
|
-
function
|
|
1823
|
+
function yn() {
|
|
1829
1824
|
return {
|
|
1830
1825
|
encode: (t) => {
|
|
1831
1826
|
if (!Array.isArray(t))
|
|
@@ -1842,13 +1837,13 @@ function ln() {
|
|
|
1842
1837
|
return e;
|
|
1843
1838
|
},
|
|
1844
1839
|
decode: (t) => {
|
|
1845
|
-
if (!
|
|
1840
|
+
if (!D(t))
|
|
1846
1841
|
throw new Error(`expected plain object, got ${t}`);
|
|
1847
1842
|
return Object.entries(t);
|
|
1848
1843
|
}
|
|
1849
1844
|
};
|
|
1850
1845
|
}
|
|
1851
|
-
const
|
|
1846
|
+
const bn = {
|
|
1852
1847
|
encode: (t) => {
|
|
1853
1848
|
if (typeof t != "bigint")
|
|
1854
1849
|
throw new Error(`expected bigint, got ${typeof t}`);
|
|
@@ -1857,17 +1852,17 @@ const dn = {
|
|
|
1857
1852
|
return Number(t);
|
|
1858
1853
|
},
|
|
1859
1854
|
decode: (t) => {
|
|
1860
|
-
if (!
|
|
1855
|
+
if (!N(t))
|
|
1861
1856
|
throw new Error("element is not a safe integer");
|
|
1862
1857
|
return BigInt(t);
|
|
1863
1858
|
}
|
|
1864
1859
|
};
|
|
1865
|
-
function
|
|
1866
|
-
if (!
|
|
1860
|
+
function Cn(t) {
|
|
1861
|
+
if (!D(t))
|
|
1867
1862
|
throw new Error("plain object expected");
|
|
1868
1863
|
return {
|
|
1869
1864
|
encode: (e) => {
|
|
1870
|
-
if (!
|
|
1865
|
+
if (!N(e) || !(e in t))
|
|
1871
1866
|
throw new Error(`wrong value ${e}`);
|
|
1872
1867
|
return t[e];
|
|
1873
1868
|
},
|
|
@@ -1878,8 +1873,8 @@ function hn(t) {
|
|
|
1878
1873
|
}
|
|
1879
1874
|
};
|
|
1880
1875
|
}
|
|
1881
|
-
function
|
|
1882
|
-
if (!
|
|
1876
|
+
function xn(t, e = !1) {
|
|
1877
|
+
if (!N(t))
|
|
1883
1878
|
throw new Error(`decimal/precision: wrong value ${t}`);
|
|
1884
1879
|
if (typeof e != "boolean")
|
|
1885
1880
|
throw new Error(`decimal/round: expected boolean, got ${typeof e}`);
|
|
@@ -1890,11 +1885,11 @@ function fn(t, e = !1) {
|
|
|
1890
1885
|
throw new Error(`expected bigint, got ${typeof n}`);
|
|
1891
1886
|
let s = (n < 0n ? -n : n).toString(10), o = s.length - t;
|
|
1892
1887
|
o < 0 && (s = s.padStart(s.length - o, "0"), o = 0);
|
|
1893
|
-
let
|
|
1894
|
-
for (;
|
|
1888
|
+
let a = s.length - 1;
|
|
1889
|
+
for (; a >= o && s[a] === "0"; a--)
|
|
1895
1890
|
;
|
|
1896
|
-
let
|
|
1897
|
-
return
|
|
1891
|
+
let i = s.slice(0, o), l = s.slice(o, a + 1);
|
|
1892
|
+
return i || (i = "0"), n < 0n && (i = "-" + i), l ? `${i}.${l}` : i;
|
|
1898
1893
|
},
|
|
1899
1894
|
decode: (n) => {
|
|
1900
1895
|
if (typeof n != "string")
|
|
@@ -1906,19 +1901,19 @@ function fn(t, e = !1) {
|
|
|
1906
1901
|
throw new Error(`wrong string value=${n}`);
|
|
1907
1902
|
let o = n.indexOf(".");
|
|
1908
1903
|
o = o === -1 ? n.length : o;
|
|
1909
|
-
const
|
|
1910
|
-
if (!e &&
|
|
1904
|
+
const a = n.slice(0, o), i = n.slice(o + 1).replace(/0+$/, ""), l = BigInt(a) * r;
|
|
1905
|
+
if (!e && i.length > t)
|
|
1911
1906
|
throw new Error(`fractional part cannot be represented with this precision (num=${n}, prec=${t})`);
|
|
1912
|
-
const c = Math.min(
|
|
1907
|
+
const c = Math.min(i.length, t), d = BigInt(i.slice(0, c)) * 10n ** BigInt(t - c), h = l + d;
|
|
1913
1908
|
return s ? -h : h;
|
|
1914
1909
|
}
|
|
1915
1910
|
};
|
|
1916
1911
|
}
|
|
1917
|
-
function
|
|
1912
|
+
function vn(t) {
|
|
1918
1913
|
if (!Array.isArray(t))
|
|
1919
1914
|
throw new Error(`expected array, got ${typeof t}`);
|
|
1920
1915
|
for (const e of t)
|
|
1921
|
-
if (!
|
|
1916
|
+
if (!he(e))
|
|
1922
1917
|
throw new Error(`wrong base coder ${e}`);
|
|
1923
1918
|
return {
|
|
1924
1919
|
encode: (e) => {
|
|
@@ -1939,12 +1934,12 @@ function un(t) {
|
|
|
1939
1934
|
}
|
|
1940
1935
|
};
|
|
1941
1936
|
}
|
|
1942
|
-
const
|
|
1943
|
-
if (!
|
|
1937
|
+
const kn = (t) => {
|
|
1938
|
+
if (!he(t))
|
|
1944
1939
|
throw new Error("BaseCoder expected");
|
|
1945
1940
|
return { encode: t.decode, decode: t.encode };
|
|
1946
|
-
},
|
|
1947
|
-
if (!
|
|
1941
|
+
}, V = { dict: yn, numberBigint: bn, tsEnum: Cn, decimal: xn, match: vn, reverse: kn }, En = (t, e = !1, r = !1, n = !0) => {
|
|
1942
|
+
if (!N(t))
|
|
1948
1943
|
throw new Error(`bigint/size: wrong value ${t}`);
|
|
1949
1944
|
if (typeof e != "boolean")
|
|
1950
1945
|
throw new Error(`bigint/le: expected boolean, got ${typeof e}`);
|
|
@@ -1953,13 +1948,13 @@ const wn = (t) => {
|
|
|
1953
1948
|
if (typeof n != "boolean")
|
|
1954
1949
|
throw new Error(`bigint/sized: expected boolean, got ${typeof n}`);
|
|
1955
1950
|
const s = BigInt(t), o = 2n ** (8n * s - 1n);
|
|
1956
|
-
return
|
|
1951
|
+
return I({
|
|
1957
1952
|
size: n ? t : void 0,
|
|
1958
|
-
encodeStream: (
|
|
1959
|
-
r &&
|
|
1953
|
+
encodeStream: (a, i) => {
|
|
1954
|
+
r && i < 0 && (i = i | o);
|
|
1960
1955
|
const l = [];
|
|
1961
1956
|
for (let d = 0; d < t; d++)
|
|
1962
|
-
l.push(Number(
|
|
1957
|
+
l.push(Number(i & 255n)), i >>= 8n;
|
|
1963
1958
|
let c = new Uint8Array(l).reverse();
|
|
1964
1959
|
if (!n) {
|
|
1965
1960
|
let d = 0;
|
|
@@ -1967,22 +1962,22 @@ const wn = (t) => {
|
|
|
1967
1962
|
;
|
|
1968
1963
|
c = c.subarray(d);
|
|
1969
1964
|
}
|
|
1970
|
-
|
|
1965
|
+
a.bytes(e ? c.reverse() : c);
|
|
1971
1966
|
},
|
|
1972
|
-
decodeStream: (
|
|
1973
|
-
const
|
|
1967
|
+
decodeStream: (a) => {
|
|
1968
|
+
const i = a.bytes(n ? t : Math.min(t, a.leftBytes)), l = e ? i : _e(i);
|
|
1974
1969
|
let c = 0n;
|
|
1975
1970
|
for (let d = 0; d < l.length; d++)
|
|
1976
1971
|
c |= BigInt(l[d]) << 8n * BigInt(d);
|
|
1977
1972
|
return r && c & o && (c = (c ^ o) - o), c;
|
|
1978
1973
|
},
|
|
1979
|
-
validate: (
|
|
1980
|
-
if (typeof
|
|
1981
|
-
throw new Error(`bigint: invalid value: ${
|
|
1982
|
-
return
|
|
1974
|
+
validate: (a) => {
|
|
1975
|
+
if (typeof a != "bigint")
|
|
1976
|
+
throw new Error(`bigint: invalid value: ${a}`);
|
|
1977
|
+
return wn(a, 8n * s, !!r), a;
|
|
1983
1978
|
}
|
|
1984
1979
|
});
|
|
1985
|
-
},
|
|
1980
|
+
}, k = /* @__PURE__ */ En(8, !0), _n = (t, e) => I({
|
|
1986
1981
|
size: t,
|
|
1987
1982
|
encodeStream: (r, n) => r.writeView(t, (s) => e.write(s, n)),
|
|
1988
1983
|
decodeStream: (r) => r.readView(t, e.read),
|
|
@@ -1991,30 +1986,30 @@ const wn = (t) => {
|
|
|
1991
1986
|
throw new Error(`viewCoder: expected number, got ${typeof r}`);
|
|
1992
1987
|
return e.validate && e.validate(r), r;
|
|
1993
1988
|
}
|
|
1994
|
-
}),
|
|
1989
|
+
}), Bt = (t, e, r) => {
|
|
1995
1990
|
const n = t * 8, s = 2 ** (n - 1), o = (l) => {
|
|
1996
|
-
if (!
|
|
1991
|
+
if (!N(l))
|
|
1997
1992
|
throw new Error(`sintView: value is not safe integer: ${l}`);
|
|
1998
1993
|
if (l < -s || l >= s)
|
|
1999
1994
|
throw new Error(`sintView: value out of bounds. Expected ${-s} <= ${l} < ${s}`);
|
|
2000
|
-
},
|
|
2001
|
-
if (!
|
|
1995
|
+
}, a = 2 ** n, i = (l) => {
|
|
1996
|
+
if (!N(l))
|
|
2002
1997
|
throw new Error(`uintView: value is not safe integer: ${l}`);
|
|
2003
|
-
if (0 > l || l >=
|
|
2004
|
-
throw new Error(`uintView: value out of bounds. Expected 0 <= ${l} < ${
|
|
1998
|
+
if (0 > l || l >= a)
|
|
1999
|
+
throw new Error(`uintView: value out of bounds. Expected 0 <= ${l} < ${a}`);
|
|
2005
2000
|
};
|
|
2006
|
-
return
|
|
2001
|
+
return _n(t, {
|
|
2007
2002
|
write: r.write,
|
|
2008
2003
|
read: r.read,
|
|
2009
|
-
validate: e ? o :
|
|
2004
|
+
validate: e ? o : i
|
|
2010
2005
|
});
|
|
2011
|
-
},
|
|
2006
|
+
}, ce = /* @__PURE__ */ Bt(4, !1, {
|
|
2012
2007
|
read: (t, e) => t.getUint32(e, !0),
|
|
2013
2008
|
write: (t, e) => t.setUint32(0, e, !0)
|
|
2014
|
-
}),
|
|
2009
|
+
}), $ = /* @__PURE__ */ Bt(1, !1, {
|
|
2015
2010
|
read: (t, e) => t.getUint8(e),
|
|
2016
2011
|
write: (t, e) => t.setUint8(0, e)
|
|
2017
|
-
}),
|
|
2012
|
+
}), Ae = /* @__PURE__ */ I({
|
|
2018
2013
|
size: 1,
|
|
2019
2014
|
encodeStream: (t, e) => t.byte(e ? 1 : 0),
|
|
2020
2015
|
decodeStream: (t) => {
|
|
@@ -2028,43 +2023,43 @@ const wn = (t) => {
|
|
|
2028
2023
|
throw new Error(`bool: invalid value ${t}`);
|
|
2029
2024
|
return t;
|
|
2030
2025
|
}
|
|
2031
|
-
}),
|
|
2026
|
+
}), fe = (t, e = !1) => {
|
|
2032
2027
|
if (typeof e != "boolean")
|
|
2033
2028
|
throw new Error(`bytes/le: expected boolean, got ${typeof e}`);
|
|
2034
|
-
const r =
|
|
2035
|
-
return
|
|
2029
|
+
const r = St(t), n = T(t);
|
|
2030
|
+
return I({
|
|
2036
2031
|
size: typeof t == "number" ? t : void 0,
|
|
2037
2032
|
encodeStream: (s, o) => {
|
|
2038
|
-
n || r.encodeStream(s, o.length), s.bytes(e ?
|
|
2033
|
+
n || r.encodeStream(s, o.length), s.bytes(e ? _e(o) : o), n && s.bytes(t);
|
|
2039
2034
|
},
|
|
2040
2035
|
decodeStream: (s) => {
|
|
2041
2036
|
let o;
|
|
2042
2037
|
if (n) {
|
|
2043
|
-
const
|
|
2044
|
-
if (!
|
|
2038
|
+
const a = s.find(t);
|
|
2039
|
+
if (!a)
|
|
2045
2040
|
throw s.err("bytes: cannot find terminator");
|
|
2046
|
-
o = s.bytes(
|
|
2041
|
+
o = s.bytes(a - s.pos), s.bytes(t.length);
|
|
2047
2042
|
} else
|
|
2048
2043
|
o = s.bytes(t === null ? s.leftBytes : r.decodeStream(s));
|
|
2049
|
-
return e ?
|
|
2044
|
+
return e ? _e(o) : o;
|
|
2050
2045
|
},
|
|
2051
2046
|
validate: (s) => {
|
|
2052
|
-
if (!
|
|
2047
|
+
if (!T(s))
|
|
2053
2048
|
throw new Error(`bytes: invalid value ${s}`);
|
|
2054
2049
|
return s;
|
|
2055
2050
|
}
|
|
2056
2051
|
});
|
|
2057
|
-
},
|
|
2052
|
+
}, An = (t, e = !1) => Nt(In(fe(t, e), un), (r) => {
|
|
2058
2053
|
if (typeof r != "string")
|
|
2059
2054
|
throw new Error(`expected string, got ${typeof r}`);
|
|
2060
2055
|
return r;
|
|
2061
2056
|
});
|
|
2062
|
-
function
|
|
2057
|
+
function In(t, e) {
|
|
2063
2058
|
if (!S(t))
|
|
2064
2059
|
throw new Error(`apply: invalid inner value ${t}`);
|
|
2065
|
-
if (!
|
|
2060
|
+
if (!he(e))
|
|
2066
2061
|
throw new Error(`apply: invalid base value ${t}`);
|
|
2067
|
-
return
|
|
2062
|
+
return I({
|
|
2068
2063
|
size: t.size,
|
|
2069
2064
|
encodeStream: (r, n) => {
|
|
2070
2065
|
let s;
|
|
@@ -2085,10 +2080,10 @@ function yn(t, e) {
|
|
|
2085
2080
|
}
|
|
2086
2081
|
});
|
|
2087
2082
|
}
|
|
2088
|
-
function
|
|
2083
|
+
function K(t, e, r) {
|
|
2089
2084
|
if (!S(t) || !S(e))
|
|
2090
2085
|
throw new Error(`optional: invalid flag or inner value flag=${t} inner=${e}`);
|
|
2091
|
-
return
|
|
2086
|
+
return I({
|
|
2092
2087
|
size: r !== void 0 && t.size && e.size ? t.size + e.size : void 0,
|
|
2093
2088
|
encodeStream: (n, s) => {
|
|
2094
2089
|
t.encodeStream(n, !!s), s ? e.encodeStream(n, s) : r !== void 0 && e.encodeStream(n, r);
|
|
@@ -2100,8 +2095,8 @@ function q(t, e, r) {
|
|
|
2100
2095
|
}
|
|
2101
2096
|
});
|
|
2102
2097
|
}
|
|
2103
|
-
function
|
|
2104
|
-
return
|
|
2098
|
+
function $n(t) {
|
|
2099
|
+
return I({
|
|
2105
2100
|
encodeStream: (e, r) => {
|
|
2106
2101
|
if (r !== t)
|
|
2107
2102
|
throw new Error(`constant: invalid value ${r} (exp: ${t})`);
|
|
@@ -2109,25 +2104,25 @@ function bn(t) {
|
|
|
2109
2104
|
decodeStream: (e) => t
|
|
2110
2105
|
});
|
|
2111
2106
|
}
|
|
2112
|
-
function
|
|
2107
|
+
function Sn(t) {
|
|
2113
2108
|
let e = 0;
|
|
2114
2109
|
for (const r of t) {
|
|
2115
2110
|
if (r.size === void 0)
|
|
2116
2111
|
return;
|
|
2117
|
-
if (!
|
|
2112
|
+
if (!N(r.size))
|
|
2118
2113
|
throw new Error(`sizeof: wrong element size=${e}`);
|
|
2119
2114
|
e += r.size;
|
|
2120
2115
|
}
|
|
2121
2116
|
return e;
|
|
2122
2117
|
}
|
|
2123
2118
|
function g(t) {
|
|
2124
|
-
if (!
|
|
2119
|
+
if (!D(t))
|
|
2125
2120
|
throw new Error(`struct: expected plain object, got ${t}`);
|
|
2126
2121
|
for (const e in t)
|
|
2127
2122
|
if (!S(t[e]))
|
|
2128
2123
|
throw new Error(`struct: field ${e} is not CoderType`);
|
|
2129
|
-
return
|
|
2130
|
-
size:
|
|
2124
|
+
return I({
|
|
2125
|
+
size: Sn(Object.values(t)),
|
|
2131
2126
|
encodeStream: (e, r) => {
|
|
2132
2127
|
e.pushObj(r, (n) => {
|
|
2133
2128
|
for (const s in t)
|
|
@@ -2148,48 +2143,48 @@ function g(t) {
|
|
|
2148
2143
|
}
|
|
2149
2144
|
});
|
|
2150
2145
|
}
|
|
2151
|
-
function
|
|
2146
|
+
function ne(t, e) {
|
|
2152
2147
|
if (!S(e))
|
|
2153
2148
|
throw new Error(`array: invalid inner value ${e}`);
|
|
2154
|
-
const r =
|
|
2155
|
-
return
|
|
2149
|
+
const r = St(typeof t == "string" ? `../${t}` : t);
|
|
2150
|
+
return I({
|
|
2156
2151
|
size: typeof t == "number" && e.size ? t * e.size : void 0,
|
|
2157
2152
|
encodeStream: (n, s) => {
|
|
2158
2153
|
const o = n;
|
|
2159
|
-
o.pushObj(s, (
|
|
2160
|
-
|
|
2161
|
-
for (let
|
|
2162
|
-
|
|
2163
|
-
const l = s[
|
|
2164
|
-
if (e.encodeStream(n, l),
|
|
2154
|
+
o.pushObj(s, (a) => {
|
|
2155
|
+
T(t) || r.encodeStream(n, s.length);
|
|
2156
|
+
for (let i = 0; i < s.length; i++)
|
|
2157
|
+
a(`${i}`, () => {
|
|
2158
|
+
const l = s[i], c = n.pos;
|
|
2159
|
+
if (e.encodeStream(n, l), T(t)) {
|
|
2165
2160
|
if (t.length > o.pos - c)
|
|
2166
2161
|
return;
|
|
2167
2162
|
const d = o.finish(!1).subarray(c, o.pos);
|
|
2168
|
-
if (
|
|
2163
|
+
if (Ee(d.subarray(0, t.length), t))
|
|
2169
2164
|
throw o.err(`array: inner element encoding same as separator. elm=${l} data=${d}`);
|
|
2170
2165
|
}
|
|
2171
2166
|
});
|
|
2172
|
-
}),
|
|
2167
|
+
}), T(t) && n.bytes(t);
|
|
2173
2168
|
},
|
|
2174
2169
|
decodeStream: (n) => {
|
|
2175
2170
|
const s = [];
|
|
2176
2171
|
return n.pushObj(s, (o) => {
|
|
2177
2172
|
if (t === null)
|
|
2178
|
-
for (let
|
|
2173
|
+
for (let a = 0; !n.isEnd() && (o(`${a}`, () => s.push(e.decodeStream(n))), !(e.size && n.leftBytes < e.size)); a++)
|
|
2179
2174
|
;
|
|
2180
|
-
else if (
|
|
2181
|
-
for (let
|
|
2182
|
-
if (
|
|
2175
|
+
else if (T(t))
|
|
2176
|
+
for (let a = 0; ; a++) {
|
|
2177
|
+
if (Ee(n.bytes(t.length, !0), t)) {
|
|
2183
2178
|
n.bytes(t.length);
|
|
2184
2179
|
break;
|
|
2185
2180
|
}
|
|
2186
|
-
o(`${
|
|
2181
|
+
o(`${a}`, () => s.push(e.decodeStream(n)));
|
|
2187
2182
|
}
|
|
2188
2183
|
else {
|
|
2189
|
-
let
|
|
2190
|
-
o("arrayLen", () =>
|
|
2191
|
-
for (let
|
|
2192
|
-
o(`${
|
|
2184
|
+
let a;
|
|
2185
|
+
o("arrayLen", () => a = r.decodeStream(n));
|
|
2186
|
+
for (let i = 0; i < a; i++)
|
|
2187
|
+
o(`${i}`, () => s.push(e.decodeStream(n)));
|
|
2193
2188
|
}
|
|
2194
2189
|
}), s;
|
|
2195
2190
|
},
|
|
@@ -2200,15 +2195,15 @@ function te(t, e) {
|
|
|
2200
2195
|
}
|
|
2201
2196
|
});
|
|
2202
2197
|
}
|
|
2203
|
-
function
|
|
2198
|
+
function Me(t, e) {
|
|
2204
2199
|
if (!S(t))
|
|
2205
2200
|
throw new Error(`map: invalid inner value ${t}`);
|
|
2206
|
-
if (!
|
|
2201
|
+
if (!D(e))
|
|
2207
2202
|
throw new Error("map: variants should be plain object");
|
|
2208
2203
|
const r = /* @__PURE__ */ new Map();
|
|
2209
2204
|
for (const n in e)
|
|
2210
2205
|
r.set(e[n], n);
|
|
2211
|
-
return
|
|
2206
|
+
return I({
|
|
2212
2207
|
size: t.size,
|
|
2213
2208
|
encodeStream: (n, s) => t.encodeStream(n, e[s]),
|
|
2214
2209
|
decodeStream: (n) => {
|
|
@@ -2226,19 +2221,19 @@ function Ue(t, e) {
|
|
|
2226
2221
|
}
|
|
2227
2222
|
});
|
|
2228
2223
|
}
|
|
2229
|
-
function
|
|
2224
|
+
function Ln(t, e) {
|
|
2230
2225
|
if (!S(t))
|
|
2231
2226
|
throw new Error(`tag: invalid tag value ${t}`);
|
|
2232
|
-
if (!
|
|
2227
|
+
if (!D(e))
|
|
2233
2228
|
throw new Error("tag: variants should be plain object");
|
|
2234
2229
|
for (const r in e)
|
|
2235
2230
|
if (!S(e[r]))
|
|
2236
2231
|
throw new Error(`tag: variant ${r} is not CoderType`);
|
|
2237
|
-
return
|
|
2232
|
+
return I({
|
|
2238
2233
|
size: t.size,
|
|
2239
2234
|
encodeStream: (r, n) => {
|
|
2240
|
-
const { TAG: s, data: o } = n,
|
|
2241
|
-
t.encodeStream(r, s),
|
|
2235
|
+
const { TAG: s, data: o } = n, a = e[s];
|
|
2236
|
+
t.encodeStream(r, s), a.encodeStream(r, o);
|
|
2242
2237
|
},
|
|
2243
2238
|
decodeStream: (r) => {
|
|
2244
2239
|
const n = t.decodeStream(r), s = e[n];
|
|
@@ -2254,34 +2249,34 @@ function kn(t, e) {
|
|
|
2254
2249
|
}
|
|
2255
2250
|
});
|
|
2256
2251
|
}
|
|
2257
|
-
const
|
|
2258
|
-
function
|
|
2252
|
+
const Nn = (t) => 0;
|
|
2253
|
+
function ye(t, e) {
|
|
2259
2254
|
return e % t === 0 ? 0 : t - e % t;
|
|
2260
2255
|
}
|
|
2261
|
-
function
|
|
2256
|
+
function Pt(t, e, r) {
|
|
2262
2257
|
if (!S(e))
|
|
2263
2258
|
throw new Error(`padRight: invalid inner value ${e}`);
|
|
2264
|
-
if (!
|
|
2259
|
+
if (!N(t) || t <= 0)
|
|
2265
2260
|
throw new Error(`padLeft: wrong blockSize=${t}`);
|
|
2266
2261
|
if (r !== void 0 && typeof r != "function")
|
|
2267
2262
|
throw new Error(`padRight: wrong padFn=${typeof r}`);
|
|
2268
|
-
const n = r ||
|
|
2269
|
-
return
|
|
2270
|
-
size: e.size ? e.size +
|
|
2263
|
+
const n = r || Nn;
|
|
2264
|
+
return I({
|
|
2265
|
+
size: e.size ? e.size + ye(t, e.size) : void 0,
|
|
2271
2266
|
encodeStream: (s, o) => {
|
|
2272
|
-
const
|
|
2267
|
+
const a = s, i = a.pos;
|
|
2273
2268
|
e.encodeStream(s, o);
|
|
2274
|
-
const l =
|
|
2269
|
+
const l = ye(t, a.pos - i);
|
|
2275
2270
|
for (let c = 0; c < l; c++)
|
|
2276
2271
|
s.byte(n(c));
|
|
2277
2272
|
},
|
|
2278
2273
|
decodeStream: (s) => {
|
|
2279
|
-
const o = s.pos,
|
|
2280
|
-
return s.bytes(
|
|
2274
|
+
const o = s.pos, a = e.decodeStream(s);
|
|
2275
|
+
return s.bytes(ye(t, s.pos - o)), a;
|
|
2281
2276
|
}
|
|
2282
2277
|
});
|
|
2283
2278
|
}
|
|
2284
|
-
const
|
|
2279
|
+
const Bn = 9, be = V.decimal(Bn), q = I({
|
|
2285
2280
|
encodeStream: (t, e) => {
|
|
2286
2281
|
if (!e)
|
|
2287
2282
|
return t.byte(0);
|
|
@@ -2297,36 +2292,36 @@ const En = 9, pe = H.decimal(En), V = $({
|
|
|
2297
2292
|
}
|
|
2298
2293
|
return e;
|
|
2299
2294
|
}
|
|
2300
|
-
}),
|
|
2301
|
-
const t =
|
|
2302
|
-
return
|
|
2295
|
+
}), re = An(Pt(8, ce, void 0)), Pn = () => {
|
|
2296
|
+
const t = fe(32);
|
|
2297
|
+
return I({
|
|
2303
2298
|
size: t.size,
|
|
2304
|
-
encodeStream: (e, r) => t.encodeStream(e,
|
|
2305
|
-
decodeStream: (e) =>
|
|
2299
|
+
encodeStream: (e, r) => t.encodeStream(e, ke.decode(r)),
|
|
2300
|
+
decodeStream: (e) => ke.encode(t.decodeStream(e))
|
|
2306
2301
|
});
|
|
2307
|
-
},
|
|
2308
|
-
requiredSignatures:
|
|
2309
|
-
readSigned:
|
|
2310
|
-
readUnsigned:
|
|
2311
|
-
keys:
|
|
2312
|
-
blockhash:
|
|
2313
|
-
instructions:
|
|
2302
|
+
}, C = Pn(), Tn = g({
|
|
2303
|
+
requiredSignatures: $,
|
|
2304
|
+
readSigned: $,
|
|
2305
|
+
readUnsigned: $,
|
|
2306
|
+
keys: ne(q, C),
|
|
2307
|
+
blockhash: C,
|
|
2308
|
+
instructions: ne(q, g({ programIdx: $, keys: ne(q, $), data: fe(q) }))
|
|
2314
2309
|
});
|
|
2315
|
-
function
|
|
2316
|
-
if (
|
|
2310
|
+
function Rn(t) {
|
|
2311
|
+
if (ke.decode(t).length !== 32)
|
|
2317
2312
|
throw new Error("Invalid Solana address");
|
|
2318
2313
|
}
|
|
2319
|
-
const
|
|
2314
|
+
const Un = (t, e, r, n, s) => ({
|
|
2320
2315
|
sign: t < e,
|
|
2321
2316
|
write: t < e - r || t >= e && t < s - n
|
|
2322
|
-
}),
|
|
2323
|
-
signatures:
|
|
2324
|
-
msg:
|
|
2325
|
-
}),
|
|
2317
|
+
}), nt = g({
|
|
2318
|
+
signatures: ne(q, fe(64)),
|
|
2319
|
+
msg: Tn
|
|
2320
|
+
}), Ie = I({
|
|
2326
2321
|
encodeStream: (t, e) => {
|
|
2327
2322
|
const { msg: r, signatures: n } = e, s = {}, o = (h, f, u) => {
|
|
2328
|
-
let
|
|
2329
|
-
|
|
2323
|
+
let p = s[h] || (s[h] = { sign: !1, write: !1 });
|
|
2324
|
+
p.write || (p.write = u), p.sign || (p.sign = f);
|
|
2330
2325
|
};
|
|
2331
2326
|
o(r.feePayer, !0, !0);
|
|
2332
2327
|
for (let h of r.instructions)
|
|
@@ -2334,27 +2329,27 @@ const In = (t, e, r, n, s) => ({
|
|
|
2334
2329
|
o(f.address, f.sign, f.write);
|
|
2335
2330
|
for (let h of r.instructions)
|
|
2336
2331
|
o(h.program, !1, !1);
|
|
2337
|
-
const
|
|
2332
|
+
const a = Object.keys(s), i = [
|
|
2338
2333
|
r.feePayer,
|
|
2339
|
-
...
|
|
2340
|
-
...
|
|
2341
|
-
...
|
|
2342
|
-
...
|
|
2334
|
+
...a.filter((h) => s[h].sign && s[h].write && h !== r.feePayer),
|
|
2335
|
+
...a.filter((h) => s[h].sign && !s[h].write),
|
|
2336
|
+
...a.filter((h) => !s[h].sign && s[h].write),
|
|
2337
|
+
...a.filter((h) => !s[h].sign && !s[h].write)
|
|
2343
2338
|
];
|
|
2344
2339
|
let l = 0, c = 0, d = 0;
|
|
2345
|
-
for (let h of
|
|
2340
|
+
for (let h of i)
|
|
2346
2341
|
s[h].sign && l++, !s[h].write && (s[h].sign ? c++ : d++);
|
|
2347
|
-
|
|
2348
|
-
signatures:
|
|
2342
|
+
nt.encodeStream(t, {
|
|
2343
|
+
signatures: i.filter((h) => s[h].sign).map((h) => n[h] || new Uint8Array(64)),
|
|
2349
2344
|
msg: {
|
|
2350
2345
|
requiredSignatures: l,
|
|
2351
2346
|
readSigned: c,
|
|
2352
2347
|
readUnsigned: d,
|
|
2353
|
-
keys:
|
|
2348
|
+
keys: i,
|
|
2354
2349
|
// indexOf potentially can be slow, but for most tx there will be ~3-5 keys, so doesn't matter much
|
|
2355
2350
|
instructions: r.instructions.map((h) => ({
|
|
2356
|
-
programIdx:
|
|
2357
|
-
keys: h.keys.map((f) =>
|
|
2351
|
+
programIdx: i.indexOf(h.program),
|
|
2352
|
+
keys: h.keys.map((f) => i.indexOf(f.address)),
|
|
2358
2353
|
data: h.data
|
|
2359
2354
|
})),
|
|
2360
2355
|
blockhash: r.blockhash
|
|
@@ -2362,7 +2357,7 @@ const In = (t, e, r, n, s) => ({
|
|
|
2362
2357
|
});
|
|
2363
2358
|
},
|
|
2364
2359
|
decodeStream: (t) => {
|
|
2365
|
-
const { signatures: e, msg: r } =
|
|
2360
|
+
const { signatures: e, msg: r } = nt.decodeStream(t);
|
|
2366
2361
|
if (e.length !== r.requiredSignatures)
|
|
2367
2362
|
throw new Error("SOL.tx: wrong signatures length");
|
|
2368
2363
|
if (r.keys.length < e.length)
|
|
@@ -2374,7 +2369,7 @@ const In = (t, e, r, n, s) => ({
|
|
|
2374
2369
|
for (let o = 0; o < r.keys.length; o++)
|
|
2375
2370
|
s.push({
|
|
2376
2371
|
address: r.keys[o],
|
|
2377
|
-
...
|
|
2372
|
+
...Un(o, r.requiredSignatures, r.readSigned, r.readUnsigned, r.keys.length)
|
|
2378
2373
|
});
|
|
2379
2374
|
if (!s.length)
|
|
2380
2375
|
throw new Error("SOL.tx: empty accounts array");
|
|
@@ -2384,73 +2379,73 @@ const In = (t, e, r, n, s) => ({
|
|
|
2384
2379
|
blockhash: r.blockhash,
|
|
2385
2380
|
instructions: r.instructions.map((o) => ({
|
|
2386
2381
|
program: s[o.programIdx].address,
|
|
2387
|
-
keys: o.keys.map((
|
|
2382
|
+
keys: o.keys.map((a) => s[a]),
|
|
2388
2383
|
data: o.data
|
|
2389
2384
|
}))
|
|
2390
2385
|
},
|
|
2391
2386
|
signatures: n
|
|
2392
2387
|
};
|
|
2393
2388
|
}
|
|
2394
|
-
}),
|
|
2395
|
-
function
|
|
2396
|
-
if (
|
|
2389
|
+
}), st = {};
|
|
2390
|
+
function ze(t, e, r) {
|
|
2391
|
+
if (st[t])
|
|
2397
2392
|
throw new Error("SOL: program for this address already defined");
|
|
2398
|
-
const n =
|
|
2399
|
-
|
|
2400
|
-
if (
|
|
2393
|
+
const n = Me(e, Object.keys(r).reduce((i, l, c) => ({ ...i, [l]: c }), {})), s = Object.keys(r).reduce((i, l) => ({ ...i, [l]: r[l].coder }), {}), o = Ln(n, s);
|
|
2394
|
+
st[t] = (i, l) => {
|
|
2395
|
+
if (i.program !== t)
|
|
2401
2396
|
throw new Error("SOL.parseInstruction: Wrong instruction program address");
|
|
2402
|
-
const { TAG: c, data: d } = o.decode(
|
|
2403
|
-
if (f.length !==
|
|
2397
|
+
const { TAG: c, data: d } = o.decode(i.data), h = { type: c, info: d }, f = Object.keys(r[c].keys);
|
|
2398
|
+
if (f.length !== i.keys.length)
|
|
2404
2399
|
throw new Error("SOL.parseInstruction: Keys length mismatch");
|
|
2405
2400
|
for (let u = 0; u < f.length; u++) {
|
|
2406
|
-
const
|
|
2407
|
-
if (r[c].keys[
|
|
2408
|
-
if (r[c].keys[
|
|
2409
|
-
throw new Error(`SOL.parseInstruction(${t}/${c}): Invalid constant address for key exp=${r[c].keys[
|
|
2401
|
+
const p = f[u];
|
|
2402
|
+
if (r[c].keys[p].address) {
|
|
2403
|
+
if (r[c].keys[p].address !== i.keys[u].address)
|
|
2404
|
+
throw new Error(`SOL.parseInstruction(${t}/${c}): Invalid constant address for key exp=${r[c].keys[p].address} got=${i.keys[u].address}`);
|
|
2410
2405
|
continue;
|
|
2411
2406
|
}
|
|
2412
|
-
h.info[f[u]] =
|
|
2407
|
+
h.info[f[u]] = i.keys[u].address;
|
|
2413
2408
|
}
|
|
2414
2409
|
return r[c].hint && (h.hint = r[c].hint(d, l)), h;
|
|
2415
2410
|
};
|
|
2416
|
-
const
|
|
2417
|
-
for (const
|
|
2418
|
-
i
|
|
2411
|
+
const a = {};
|
|
2412
|
+
for (const i in r)
|
|
2413
|
+
a[i] = (l) => ({
|
|
2419
2414
|
program: t,
|
|
2420
|
-
data: o.encode({ TAG:
|
|
2421
|
-
keys: Object.keys(r[
|
|
2422
|
-
let { sign: d, write: h, address: f } = r[
|
|
2423
|
-
return f || (f = l[c]),
|
|
2415
|
+
data: o.encode({ TAG: i, data: l }),
|
|
2416
|
+
keys: Object.keys(r[i].keys).map((c) => {
|
|
2417
|
+
let { sign: d, write: h, address: f } = r[i].keys[c];
|
|
2418
|
+
return f || (f = l[c]), Rn(f), { address: f, sign: d, write: h };
|
|
2424
2419
|
})
|
|
2425
2420
|
});
|
|
2426
|
-
return
|
|
2421
|
+
return a;
|
|
2427
2422
|
}
|
|
2428
|
-
const
|
|
2423
|
+
const Ce = "SysvarRecentB1ockHashes11111111111111111111", z = "SysvarRent111111111111111111111111111111111", Tt = "11111111111111111111111111111111", Rt = ze(Tt, ce, {
|
|
2429
2424
|
createAccount: {
|
|
2430
|
-
coder: g({ lamports:
|
|
2425
|
+
coder: g({ lamports: k, space: k, owner: C }),
|
|
2431
2426
|
keys: {
|
|
2432
2427
|
source: { sign: !0, write: !0 },
|
|
2433
2428
|
newAccount: { sign: !0, write: !0 }
|
|
2434
2429
|
},
|
|
2435
|
-
hint: (t) => `Create new account=${t.newAccount} with balance of ${
|
|
2430
|
+
hint: (t) => `Create new account=${t.newAccount} with balance of ${be.encode(t.lamports)} and owner program ${t.owner}, using funding account ${t.source}`
|
|
2436
2431
|
},
|
|
2437
2432
|
assign: {
|
|
2438
|
-
coder: g({ owner:
|
|
2433
|
+
coder: g({ owner: C }),
|
|
2439
2434
|
keys: { account: { sign: !0, write: !0 } },
|
|
2440
2435
|
hint: (t) => `Assign account=${t.account} to owner program=${t.owner}`
|
|
2441
2436
|
},
|
|
2442
2437
|
transfer: {
|
|
2443
|
-
coder: g({ lamports:
|
|
2438
|
+
coder: g({ lamports: k }),
|
|
2444
2439
|
keys: { source: { sign: !0, write: !0 }, destination: { sign: !1, write: !0 } },
|
|
2445
|
-
hint: (t) => `Transfer ${
|
|
2440
|
+
hint: (t) => `Transfer ${be.encode(t.lamports)} SOL from ${t.source} to ${t.destination}`
|
|
2446
2441
|
},
|
|
2447
2442
|
createAccountWithSeed: {
|
|
2448
2443
|
coder: g({
|
|
2449
|
-
base:
|
|
2450
|
-
seed:
|
|
2451
|
-
lamports:
|
|
2452
|
-
space:
|
|
2453
|
-
owner:
|
|
2444
|
+
base: C,
|
|
2445
|
+
seed: re,
|
|
2446
|
+
lamports: k,
|
|
2447
|
+
space: k,
|
|
2448
|
+
owner: C
|
|
2454
2449
|
}),
|
|
2455
2450
|
keys: {
|
|
2456
2451
|
source: { sign: !0, write: !0 },
|
|
@@ -2462,32 +2457,32 @@ const me = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
|
|
|
2462
2457
|
coder: g({}),
|
|
2463
2458
|
keys: {
|
|
2464
2459
|
nonceAccount: { sign: !1, write: !0 },
|
|
2465
|
-
_recent_bh: { address:
|
|
2460
|
+
_recent_bh: { address: Ce, sign: !1, write: !1 },
|
|
2466
2461
|
nonceAuthority: { sign: !0, write: !1 }
|
|
2467
2462
|
},
|
|
2468
2463
|
hint: (t) => `Consume nonce in nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority})`
|
|
2469
2464
|
},
|
|
2470
2465
|
withdrawFromNonce: {
|
|
2471
|
-
coder: g({ lamports:
|
|
2466
|
+
coder: g({ lamports: k }),
|
|
2472
2467
|
keys: {
|
|
2473
2468
|
nonceAccount: { sign: !1, write: !0 },
|
|
2474
2469
|
destination: { sign: !1, write: !0 },
|
|
2475
|
-
_recent_bh: { address:
|
|
2476
|
-
_rent: { address:
|
|
2470
|
+
_recent_bh: { address: Ce, sign: !1, write: !1 },
|
|
2471
|
+
_rent: { address: z, sign: !1, write: !1 },
|
|
2477
2472
|
nonceAuthority: { sign: !0, write: !1 }
|
|
2478
2473
|
},
|
|
2479
|
-
hint: (t) => `Withdraw ${
|
|
2474
|
+
hint: (t) => `Withdraw ${be.encode(t.lamports)} SOL from nonce account=${t.nonceAccount} (owner: ${t.nonceAuthority}) to ${t.destination}`
|
|
2480
2475
|
},
|
|
2481
2476
|
initializeNonce: {
|
|
2482
|
-
coder: g({ nonceAuthority:
|
|
2477
|
+
coder: g({ nonceAuthority: C }),
|
|
2483
2478
|
keys: {
|
|
2484
2479
|
nonceAccount: { sign: !1, write: !0 },
|
|
2485
|
-
_recent_bh: { address:
|
|
2486
|
-
_rent: { address:
|
|
2480
|
+
_recent_bh: { address: Ce, sign: !1, write: !1 },
|
|
2481
|
+
_rent: { address: z, sign: !1, write: !1 }
|
|
2487
2482
|
}
|
|
2488
2483
|
},
|
|
2489
2484
|
authorizeNonce: {
|
|
2490
|
-
coder: g({ newAuthorized:
|
|
2485
|
+
coder: g({ newAuthorized: C }),
|
|
2491
2486
|
keys: {
|
|
2492
2487
|
nonceAccount: { sign: !1, write: !0 },
|
|
2493
2488
|
nonceAuthority: { sign: !0, write: !1 }
|
|
@@ -2495,17 +2490,17 @@ const me = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
|
|
|
2495
2490
|
hint: (t) => `Change owner of nonce account=${t.nonceAccount} from ${t.nonceAuthority} to ${t.newAuthorized}`
|
|
2496
2491
|
},
|
|
2497
2492
|
allocate: {
|
|
2498
|
-
coder: g({ space:
|
|
2493
|
+
coder: g({ space: k }),
|
|
2499
2494
|
keys: {
|
|
2500
2495
|
account: { sign: !0, write: !0 }
|
|
2501
2496
|
}
|
|
2502
2497
|
},
|
|
2503
2498
|
allocateWithSeed: {
|
|
2504
2499
|
coder: g({
|
|
2505
|
-
base:
|
|
2506
|
-
seed:
|
|
2507
|
-
space:
|
|
2508
|
-
owner:
|
|
2500
|
+
base: C,
|
|
2501
|
+
seed: re,
|
|
2502
|
+
space: k,
|
|
2503
|
+
owner: C
|
|
2509
2504
|
}),
|
|
2510
2505
|
keys: {
|
|
2511
2506
|
account: { sign: !1, write: !0 },
|
|
@@ -2514,9 +2509,9 @@ const me = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
|
|
|
2514
2509
|
},
|
|
2515
2510
|
assignWithSeed: {
|
|
2516
2511
|
coder: g({
|
|
2517
|
-
base:
|
|
2518
|
-
seed:
|
|
2519
|
-
owner:
|
|
2512
|
+
base: C,
|
|
2513
|
+
seed: re,
|
|
2514
|
+
owner: C
|
|
2520
2515
|
}),
|
|
2521
2516
|
keys: {
|
|
2522
2517
|
account: { sign: !1, write: !0 },
|
|
@@ -2525,9 +2520,9 @@ const me = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
|
|
|
2525
2520
|
},
|
|
2526
2521
|
transferWithSeed: {
|
|
2527
2522
|
coder: g({
|
|
2528
|
-
lamports:
|
|
2529
|
-
sourceSeed:
|
|
2530
|
-
sourceOwner:
|
|
2523
|
+
lamports: k,
|
|
2524
|
+
sourceSeed: re,
|
|
2525
|
+
sourceOwner: C
|
|
2531
2526
|
}),
|
|
2532
2527
|
keys: {
|
|
2533
2528
|
source: { sign: !1, write: !0 },
|
|
@@ -2535,26 +2530,26 @@ const me = "SysvarRecentB1ockHashes11111111111111111111", L = "SysvarRent1111111
|
|
|
2535
2530
|
destination: { sign: !1, write: !0 }
|
|
2536
2531
|
}
|
|
2537
2532
|
}
|
|
2538
|
-
}),
|
|
2533
|
+
}), Ut = (t) => {
|
|
2539
2534
|
};
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
const
|
|
2535
|
+
Ut(Rt.transfer);
|
|
2536
|
+
Ut(Rt.advanceNonce);
|
|
2537
|
+
const Mn = Me($, {
|
|
2543
2538
|
MintTokens: 0,
|
|
2544
2539
|
FreezeAccount: 1,
|
|
2545
2540
|
AccountOwner: 2,
|
|
2546
2541
|
CloseAccount: 3
|
|
2547
|
-
}),
|
|
2548
|
-
|
|
2542
|
+
}), U = (t, e) => e[t]?.symbol || t, Mt = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2543
|
+
ze(Mt, $, {
|
|
2549
2544
|
initializeMint: {
|
|
2550
2545
|
coder: g({
|
|
2551
|
-
decimals:
|
|
2552
|
-
mintAuthority:
|
|
2553
|
-
freezeAuthority:
|
|
2546
|
+
decimals: $,
|
|
2547
|
+
mintAuthority: C,
|
|
2548
|
+
freezeAuthority: K(Ae, C, "11111111111111111111111111111111")
|
|
2554
2549
|
}),
|
|
2555
2550
|
keys: {
|
|
2556
2551
|
mint: { sign: !1, write: !0 },
|
|
2557
|
-
_rent: { address:
|
|
2552
|
+
_rent: { address: z, sign: !1, write: !1 }
|
|
2558
2553
|
}
|
|
2559
2554
|
},
|
|
2560
2555
|
initializeAccount: {
|
|
@@ -2563,21 +2558,21 @@ Te(Pt, I, {
|
|
|
2563
2558
|
account: { sign: !1, write: !0 },
|
|
2564
2559
|
mint: { sign: !1, write: !1 },
|
|
2565
2560
|
owner: { sign: !1, write: !1 },
|
|
2566
|
-
_rent: { address:
|
|
2561
|
+
_rent: { address: z, sign: !1, write: !1 }
|
|
2567
2562
|
},
|
|
2568
|
-
hint: (t, e) => `Initialize token account=${t.account} with owner=${t.owner} token=${
|
|
2563
|
+
hint: (t, e) => `Initialize token account=${t.account} with owner=${t.owner} token=${U(t.mint, e)}`
|
|
2569
2564
|
},
|
|
2570
2565
|
// TODO: multisig support?
|
|
2571
2566
|
initializeMultisig: {
|
|
2572
|
-
coder: g({ m:
|
|
2567
|
+
coder: g({ m: $ }),
|
|
2573
2568
|
keys: {
|
|
2574
2569
|
account: { sign: !1, write: !0 },
|
|
2575
|
-
_rent: { address:
|
|
2570
|
+
_rent: { address: z, sign: !1, write: !1 }
|
|
2576
2571
|
},
|
|
2577
2572
|
hint: (t, e) => `Initialize multi-sig token account=${t.account} with signatures=${t.m}`
|
|
2578
2573
|
},
|
|
2579
2574
|
transfer: {
|
|
2580
|
-
coder: g({ amount:
|
|
2575
|
+
coder: g({ amount: k }),
|
|
2581
2576
|
keys: {
|
|
2582
2577
|
source: { sign: !1, write: !0 },
|
|
2583
2578
|
destination: { sign: !1, write: !0 },
|
|
@@ -2586,7 +2581,7 @@ Te(Pt, I, {
|
|
|
2586
2581
|
hint: (t, e) => `Transfer ${t.amount} from token account=${t.source} of owner=${t.owner} to ${t.destination}`
|
|
2587
2582
|
},
|
|
2588
2583
|
approve: {
|
|
2589
|
-
coder: g({ amount:
|
|
2584
|
+
coder: g({ amount: k }),
|
|
2590
2585
|
keys: {
|
|
2591
2586
|
account: { sign: !1, write: !0 },
|
|
2592
2587
|
delegate: { sign: !1, write: !1 },
|
|
@@ -2604,8 +2599,8 @@ Te(Pt, I, {
|
|
|
2604
2599
|
},
|
|
2605
2600
|
setAuthority: {
|
|
2606
2601
|
coder: g({
|
|
2607
|
-
authorityType:
|
|
2608
|
-
newAuthority:
|
|
2602
|
+
authorityType: Mn,
|
|
2603
|
+
newAuthority: K(Ae, C, "11111111111111111111111111111111")
|
|
2609
2604
|
}),
|
|
2610
2605
|
keys: {
|
|
2611
2606
|
account: { sign: !1, write: !0 },
|
|
@@ -2614,7 +2609,7 @@ Te(Pt, I, {
|
|
|
2614
2609
|
hint: (t, e) => `Sets a new authority=${t.newAuthority} of a mint or account=${t.account}. Current authority=${t.currentAuthority}. Authority Type: ${t.authorityType}`
|
|
2615
2610
|
},
|
|
2616
2611
|
mintTo: {
|
|
2617
|
-
coder: g({ amount:
|
|
2612
|
+
coder: g({ amount: k }),
|
|
2618
2613
|
keys: {
|
|
2619
2614
|
mint: { sign: !1, write: !0 },
|
|
2620
2615
|
dest: { sign: !1, write: !0 },
|
|
@@ -2622,7 +2617,7 @@ Te(Pt, I, {
|
|
|
2622
2617
|
}
|
|
2623
2618
|
},
|
|
2624
2619
|
burn: {
|
|
2625
|
-
coder: g({ amount:
|
|
2620
|
+
coder: g({ amount: k }),
|
|
2626
2621
|
keys: {
|
|
2627
2622
|
account: { sign: !1, write: !0 },
|
|
2628
2623
|
mint: { sign: !1, write: !0 },
|
|
@@ -2658,51 +2653,51 @@ Te(Pt, I, {
|
|
|
2658
2653
|
hint: (t, e) => `Thaw a frozne token account=${t.account} of mint=${t.mint} using freeze_authority=${t.authority}`
|
|
2659
2654
|
},
|
|
2660
2655
|
transferChecked: {
|
|
2661
|
-
coder: g({ amount:
|
|
2656
|
+
coder: g({ amount: k, decimals: $ }),
|
|
2662
2657
|
keys: {
|
|
2663
2658
|
source: { sign: !1, write: !0 },
|
|
2664
2659
|
mint: { sign: !1, write: !1 },
|
|
2665
2660
|
destination: { sign: !1, write: !0 },
|
|
2666
2661
|
owner: { sign: !0, write: !1 }
|
|
2667
2662
|
},
|
|
2668
|
-
hint: (t, e) => `Transfer ${
|
|
2663
|
+
hint: (t, e) => `Transfer ${V.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)} from token account=${t.source} of owner=${t.owner} to ${t.destination}`
|
|
2669
2664
|
},
|
|
2670
2665
|
approveChecked: {
|
|
2671
|
-
coder: g({ amount:
|
|
2666
|
+
coder: g({ amount: k, decimals: $ }),
|
|
2672
2667
|
keys: {
|
|
2673
2668
|
source: { sign: !1, write: !0 },
|
|
2674
2669
|
mint: { sign: !1, write: !1 },
|
|
2675
2670
|
delegate: { sign: !1, write: !1 },
|
|
2676
2671
|
owner: { sign: !0, write: !1 }
|
|
2677
2672
|
},
|
|
2678
|
-
hint: (t, e) => `Approve delgate=${t.delegate} authority on behalf account=${t.source} owner=${t.owner} over ${
|
|
2673
|
+
hint: (t, e) => `Approve delgate=${t.delegate} authority on behalf account=${t.source} owner=${t.owner} over ${V.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)}`
|
|
2679
2674
|
},
|
|
2680
2675
|
mintToChecked: {
|
|
2681
|
-
coder: g({ amount:
|
|
2676
|
+
coder: g({ amount: k, decimals: $ }),
|
|
2682
2677
|
keys: {
|
|
2683
2678
|
mint: { sign: !1, write: !0 },
|
|
2684
2679
|
dest: { sign: !1, write: !0 },
|
|
2685
2680
|
authority: { sign: !0, write: !1 }
|
|
2686
2681
|
},
|
|
2687
|
-
hint: (t, e) => `Mint new tokens (${
|
|
2682
|
+
hint: (t, e) => `Mint new tokens (${V.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)}) to account=${t.dest} using authority=${t.authority}`
|
|
2688
2683
|
},
|
|
2689
2684
|
burnChecked: {
|
|
2690
|
-
coder: g({ amount:
|
|
2685
|
+
coder: g({ amount: k, decimals: $ }),
|
|
2691
2686
|
keys: {
|
|
2692
2687
|
mint: { sign: !1, write: !0 },
|
|
2693
2688
|
account: { sign: !1, write: !0 },
|
|
2694
2689
|
owner: { sign: !0, write: !1 }
|
|
2695
2690
|
},
|
|
2696
|
-
hint: (t, e) => `Burn tokens (${
|
|
2691
|
+
hint: (t, e) => `Burn tokens (${V.decimal(t.decimals).encode(t.amount)} ${U(t.mint, e)}) on account=${t.account} of owner=${t.owner}`
|
|
2697
2692
|
},
|
|
2698
2693
|
initializeAccount2: {
|
|
2699
|
-
coder: g({ owner:
|
|
2694
|
+
coder: g({ owner: C }),
|
|
2700
2695
|
keys: {
|
|
2701
2696
|
account: { sign: !1, write: !0 },
|
|
2702
2697
|
mint: { sign: !1, write: !1 },
|
|
2703
|
-
_rent: { address:
|
|
2698
|
+
_rent: { address: z, sign: !1, write: !1 }
|
|
2704
2699
|
},
|
|
2705
|
-
hint: (t, e) => `Initialize token account=${t.account} with owner=${t.owner} token=${
|
|
2700
|
+
hint: (t, e) => `Initialize token account=${t.account} with owner=${t.owner} token=${U(t.mint, e)}`
|
|
2706
2701
|
},
|
|
2707
2702
|
syncNative: {
|
|
2708
2703
|
coder: g({}),
|
|
@@ -2711,14 +2706,14 @@ Te(Pt, I, {
|
|
|
2711
2706
|
}
|
|
2712
2707
|
});
|
|
2713
2708
|
g({
|
|
2714
|
-
version:
|
|
2715
|
-
state:
|
|
2716
|
-
authority:
|
|
2717
|
-
nonce:
|
|
2718
|
-
lamportPerSignature:
|
|
2709
|
+
version: ce,
|
|
2710
|
+
state: ce,
|
|
2711
|
+
authority: C,
|
|
2712
|
+
nonce: C,
|
|
2713
|
+
lamportPerSignature: k
|
|
2719
2714
|
});
|
|
2720
|
-
const
|
|
2721
|
-
|
|
2715
|
+
const zn = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
2716
|
+
ze(zn, $n(0), {
|
|
2722
2717
|
create: {
|
|
2723
2718
|
coder: g({}),
|
|
2724
2719
|
keys: {
|
|
@@ -2726,37 +2721,37 @@ Te(Cn, bn(0), {
|
|
|
2726
2721
|
account: { sign: !1, write: !0 },
|
|
2727
2722
|
wallet: { sign: !1, write: !1 },
|
|
2728
2723
|
mint: { sign: !1, write: !1 },
|
|
2729
|
-
_sys: { address:
|
|
2730
|
-
_token: { address:
|
|
2731
|
-
_rent: { address:
|
|
2724
|
+
_sys: { address: Tt, sign: !1, write: !1 },
|
|
2725
|
+
_token: { address: Mt, sign: !1, write: !1 },
|
|
2726
|
+
_rent: { address: z, sign: !1, write: !1 }
|
|
2732
2727
|
},
|
|
2733
|
-
hint: (t, e) => `Initialize associated token account=${t.account} with owner=${t.wallet} for token=${
|
|
2728
|
+
hint: (t, e) => `Initialize associated token account=${t.account} with owner=${t.wallet} for token=${U(t.mint, e)}, payed by ${t.source}`
|
|
2734
2729
|
}
|
|
2735
2730
|
});
|
|
2736
|
-
const
|
|
2731
|
+
const xe = Pt(4, Ae, () => 0);
|
|
2737
2732
|
g({
|
|
2738
|
-
mint:
|
|
2739
|
-
owner:
|
|
2740
|
-
amount:
|
|
2741
|
-
delegate:
|
|
2742
|
-
state:
|
|
2733
|
+
mint: C,
|
|
2734
|
+
owner: C,
|
|
2735
|
+
amount: k,
|
|
2736
|
+
delegate: K(xe, C, "11111111111111111111111111111111"),
|
|
2737
|
+
state: Me($, {
|
|
2743
2738
|
uninitialized: 0,
|
|
2744
2739
|
initialized: 1,
|
|
2745
2740
|
frozen: 2
|
|
2746
2741
|
}),
|
|
2747
|
-
isNative:
|
|
2748
|
-
delegateAmount:
|
|
2749
|
-
closeAuthority:
|
|
2742
|
+
isNative: K(xe, k, 0n),
|
|
2743
|
+
delegateAmount: k,
|
|
2744
|
+
closeAuthority: K(xe, C, "11111111111111111111111111111111")
|
|
2750
2745
|
});
|
|
2751
|
-
function
|
|
2746
|
+
function ot(t, e, r) {
|
|
2752
2747
|
if (!e.length)
|
|
2753
2748
|
throw new Error("SOLPublic: empty instructions array");
|
|
2754
|
-
return
|
|
2749
|
+
return hn.encode(Ie.encode({
|
|
2755
2750
|
msg: { feePayer: t, blockhash: r, instructions: e },
|
|
2756
2751
|
signatures: {}
|
|
2757
2752
|
}));
|
|
2758
2753
|
}
|
|
2759
|
-
function
|
|
2754
|
+
function On(t) {
|
|
2760
2755
|
if (t.length >= 255)
|
|
2761
2756
|
throw new TypeError("Alphabet too long");
|
|
2762
2757
|
const e = new Uint8Array(256);
|
|
@@ -2769,7 +2764,7 @@ function Pn(t) {
|
|
|
2769
2764
|
e[h] = c;
|
|
2770
2765
|
}
|
|
2771
2766
|
const r = t.length, n = t.charAt(0), s = Math.log(r) / Math.log(256), o = Math.log(256) / Math.log(r);
|
|
2772
|
-
function
|
|
2767
|
+
function a(c) {
|
|
2773
2768
|
if (c instanceof Uint8Array || (ArrayBuffer.isView(c) ? c = new Uint8Array(c.buffer, c.byteOffset, c.byteLength) : Array.isArray(c) && (c = Uint8Array.from(c))), !(c instanceof Uint8Array))
|
|
2774
2769
|
throw new TypeError("Expected Uint8Array");
|
|
2775
2770
|
if (c.length === 0)
|
|
@@ -2778,24 +2773,24 @@ function Pn(t) {
|
|
|
2778
2773
|
const u = c.length;
|
|
2779
2774
|
for (; f !== u && c[f] === 0; )
|
|
2780
2775
|
f++, d++;
|
|
2781
|
-
const
|
|
2776
|
+
const p = (u - f) * o + 1 >>> 0, b = new Uint8Array(p);
|
|
2782
2777
|
for (; f !== u; ) {
|
|
2783
|
-
let
|
|
2784
|
-
for (let
|
|
2785
|
-
|
|
2786
|
-
if (
|
|
2778
|
+
let x = c[f], m = 0;
|
|
2779
|
+
for (let _ = p - 1; (x !== 0 || m < h) && _ !== -1; _--, m++)
|
|
2780
|
+
x += 256 * b[_] >>> 0, b[_] = x % r >>> 0, x = x / r >>> 0;
|
|
2781
|
+
if (x !== 0)
|
|
2787
2782
|
throw new Error("Non-zero carry");
|
|
2788
|
-
h =
|
|
2783
|
+
h = m, f++;
|
|
2789
2784
|
}
|
|
2790
|
-
let y =
|
|
2791
|
-
for (; y !==
|
|
2785
|
+
let y = p - h;
|
|
2786
|
+
for (; y !== p && b[y] === 0; )
|
|
2792
2787
|
y++;
|
|
2793
|
-
let
|
|
2794
|
-
for (; y <
|
|
2795
|
-
|
|
2796
|
-
return
|
|
2788
|
+
let w = n.repeat(d);
|
|
2789
|
+
for (; y < p; ++y)
|
|
2790
|
+
w += t.charAt(b[y]);
|
|
2791
|
+
return w;
|
|
2797
2792
|
}
|
|
2798
|
-
function
|
|
2793
|
+
function i(c) {
|
|
2799
2794
|
if (typeof c != "string")
|
|
2800
2795
|
throw new TypeError("Expected String");
|
|
2801
2796
|
if (c.length === 0)
|
|
@@ -2803,45 +2798,45 @@ function Pn(t) {
|
|
|
2803
2798
|
let d = 0, h = 0, f = 0;
|
|
2804
2799
|
for (; c[d] === n; )
|
|
2805
2800
|
h++, d++;
|
|
2806
|
-
const u = (c.length - d) * s + 1 >>> 0,
|
|
2801
|
+
const u = (c.length - d) * s + 1 >>> 0, p = new Uint8Array(u);
|
|
2807
2802
|
for (; d < c.length; ) {
|
|
2808
|
-
const
|
|
2809
|
-
if (
|
|
2803
|
+
const x = c.charCodeAt(d);
|
|
2804
|
+
if (x > 255)
|
|
2810
2805
|
return;
|
|
2811
|
-
let
|
|
2812
|
-
if (
|
|
2806
|
+
let m = e[x];
|
|
2807
|
+
if (m === 255)
|
|
2813
2808
|
return;
|
|
2814
|
-
let
|
|
2815
|
-
for (let
|
|
2816
|
-
|
|
2817
|
-
if (
|
|
2809
|
+
let _ = 0;
|
|
2810
|
+
for (let L = u - 1; (m !== 0 || _ < f) && L !== -1; L--, _++)
|
|
2811
|
+
m += r * p[L] >>> 0, p[L] = m % 256 >>> 0, m = m / 256 >>> 0;
|
|
2812
|
+
if (m !== 0)
|
|
2818
2813
|
throw new Error("Non-zero carry");
|
|
2819
|
-
f =
|
|
2814
|
+
f = _, d++;
|
|
2820
2815
|
}
|
|
2821
2816
|
let b = u - f;
|
|
2822
|
-
for (; b !== u &&
|
|
2817
|
+
for (; b !== u && p[b] === 0; )
|
|
2823
2818
|
b++;
|
|
2824
2819
|
const y = new Uint8Array(h + (u - b));
|
|
2825
|
-
let
|
|
2820
|
+
let w = h;
|
|
2826
2821
|
for (; b !== u; )
|
|
2827
|
-
y[
|
|
2822
|
+
y[w++] = p[b++];
|
|
2828
2823
|
return y;
|
|
2829
2824
|
}
|
|
2830
2825
|
function l(c) {
|
|
2831
|
-
const d =
|
|
2826
|
+
const d = i(c);
|
|
2832
2827
|
if (d)
|
|
2833
2828
|
return d;
|
|
2834
2829
|
throw new Error("Non-base" + r + " character");
|
|
2835
2830
|
}
|
|
2836
2831
|
return {
|
|
2837
|
-
encode:
|
|
2838
|
-
decodeUnsafe:
|
|
2832
|
+
encode: a,
|
|
2833
|
+
decodeUnsafe: i,
|
|
2839
2834
|
decode: l
|
|
2840
2835
|
};
|
|
2841
2836
|
}
|
|
2842
|
-
var
|
|
2843
|
-
|
|
2844
|
-
class
|
|
2837
|
+
var Dn = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2838
|
+
On(Dn);
|
|
2839
|
+
class Oe {
|
|
2845
2840
|
_transaction;
|
|
2846
2841
|
signatures = [];
|
|
2847
2842
|
feePayer;
|
|
@@ -2854,15 +2849,15 @@ class ze {
|
|
|
2854
2849
|
return this._instructions.push(...e), this;
|
|
2855
2850
|
}
|
|
2856
2851
|
static from(e) {
|
|
2857
|
-
const r = e instanceof Uint8Array ? e : new Uint8Array(e), n =
|
|
2852
|
+
const r = e instanceof Uint8Array ? e : new Uint8Array(e), n = Ie.decode(r), s = new Oe();
|
|
2858
2853
|
return s._transaction = n, s;
|
|
2859
2854
|
}
|
|
2860
2855
|
serialize(e) {
|
|
2861
2856
|
if (this._transaction)
|
|
2862
|
-
return Buffer.from(
|
|
2857
|
+
return Buffer.from(Ie.encode(this._transaction));
|
|
2863
2858
|
if (!this.feePayer || !this.recentBlockhash)
|
|
2864
2859
|
throw new Error("Transaction requires feePayer and recentBlockhash");
|
|
2865
|
-
const r =
|
|
2860
|
+
const r = ot(
|
|
2866
2861
|
this.feePayer.toString(),
|
|
2867
2862
|
this._instructions,
|
|
2868
2863
|
this.recentBlockhash
|
|
@@ -2872,7 +2867,7 @@ class ze {
|
|
|
2872
2867
|
serializeMessage() {
|
|
2873
2868
|
if (!this.feePayer || !this.recentBlockhash)
|
|
2874
2869
|
throw new Error("Transaction requires feePayer and recentBlockhash");
|
|
2875
|
-
const e =
|
|
2870
|
+
const e = ot(
|
|
2876
2871
|
this.feePayer.toString(),
|
|
2877
2872
|
this._instructions,
|
|
2878
2873
|
this.recentBlockhash
|
|
@@ -2880,7 +2875,7 @@ class ze {
|
|
|
2880
2875
|
return Buffer.from(e, "hex");
|
|
2881
2876
|
}
|
|
2882
2877
|
}
|
|
2883
|
-
class
|
|
2878
|
+
class Fn {
|
|
2884
2879
|
type = "phantom";
|
|
2885
2880
|
platform = "solana";
|
|
2886
2881
|
account = void 0;
|
|
@@ -2948,7 +2943,7 @@ class Nn {
|
|
|
2948
2943
|
if (!this.isAvailable() || !this.account)
|
|
2949
2944
|
throw new Error("Phantom is not connected");
|
|
2950
2945
|
try {
|
|
2951
|
-
const r =
|
|
2946
|
+
const r = Oe.from(e), s = await this.getProvider().signAndSendTransaction(r);
|
|
2952
2947
|
return {
|
|
2953
2948
|
success: !0,
|
|
2954
2949
|
wallet: this.type,
|
|
@@ -2990,12 +2985,17 @@ class Nn {
|
|
|
2990
2985
|
};
|
|
2991
2986
|
}
|
|
2992
2987
|
}
|
|
2993
|
-
class
|
|
2988
|
+
class Qn extends de {
|
|
2989
|
+
type = "phantom-evm";
|
|
2990
|
+
rdns = "app.phantom";
|
|
2991
|
+
displayName = "Phantom";
|
|
2992
|
+
}
|
|
2993
|
+
class Hn extends de {
|
|
2994
2994
|
type = "rabby";
|
|
2995
2995
|
rdns = "io.rabby";
|
|
2996
2996
|
displayName = "Rabby";
|
|
2997
2997
|
}
|
|
2998
|
-
class
|
|
2998
|
+
class jn {
|
|
2999
2999
|
type = "braavos";
|
|
3000
3000
|
platform = "starknet";
|
|
3001
3001
|
wallet = void 0;
|
|
@@ -3129,22 +3129,24 @@ class Un {
|
|
|
3129
3129
|
this.removeAccountChangeListener(), this.wallet = void 0, this.account = void 0, this.connectedAccounts = [];
|
|
3130
3130
|
}
|
|
3131
3131
|
}
|
|
3132
|
-
class
|
|
3132
|
+
class Wn {
|
|
3133
3133
|
walletAdapters;
|
|
3134
3134
|
constructor() {
|
|
3135
3135
|
if (this.walletAdapters = /* @__PURE__ */ new Map(), typeof window > "u")
|
|
3136
3136
|
return;
|
|
3137
|
-
const e = new
|
|
3137
|
+
const e = new sn();
|
|
3138
3138
|
this.walletAdapters.set("metamask", e);
|
|
3139
|
-
const r = new
|
|
3139
|
+
const r = new Fn();
|
|
3140
3140
|
this.walletAdapters.set("phantom", r);
|
|
3141
|
-
const n = new
|
|
3142
|
-
this.walletAdapters.set("
|
|
3143
|
-
const s = new
|
|
3144
|
-
this.walletAdapters.set("
|
|
3145
|
-
const o = new
|
|
3146
|
-
this.walletAdapters.set("
|
|
3147
|
-
const
|
|
3141
|
+
const n = new Qn();
|
|
3142
|
+
this.walletAdapters.set("phantom-evm", n);
|
|
3143
|
+
const s = new Jr();
|
|
3144
|
+
this.walletAdapters.set("argent", s);
|
|
3145
|
+
const o = new jn();
|
|
3146
|
+
this.walletAdapters.set("braavos", o);
|
|
3147
|
+
const a = new Hn();
|
|
3148
|
+
this.walletAdapters.set("rabby", a);
|
|
3149
|
+
const i = new nn();
|
|
3148
3150
|
this.walletAdapters.set("base", i), window.wallet_bridge = this;
|
|
3149
3151
|
}
|
|
3150
3152
|
getIFrameMethods() {
|
|
@@ -3172,15 +3174,15 @@ class Tn {
|
|
|
3172
3174
|
}
|
|
3173
3175
|
handleError(e, r, n, s) {
|
|
3174
3176
|
const o = r instanceof Error ? r.message : "Unknown error";
|
|
3175
|
-
let
|
|
3177
|
+
let a = "unknown";
|
|
3176
3178
|
if (typeof e == "string") {
|
|
3177
|
-
const
|
|
3178
|
-
|
|
3179
|
+
const i = this.getConnectedWalletAdapter(e);
|
|
3180
|
+
a = s ?? i?.type ?? e;
|
|
3179
3181
|
} else
|
|
3180
|
-
|
|
3182
|
+
a = e;
|
|
3181
3183
|
return console.error(`Error ${n} with ${e} wallet:`, r), {
|
|
3182
3184
|
success: !1,
|
|
3183
|
-
wallet:
|
|
3185
|
+
wallet: a,
|
|
3184
3186
|
error: o
|
|
3185
3187
|
};
|
|
3186
3188
|
}
|
|
@@ -3207,7 +3209,7 @@ class Tn {
|
|
|
3207
3209
|
getConnectedWalletAdapter(e) {
|
|
3208
3210
|
let r, n;
|
|
3209
3211
|
try {
|
|
3210
|
-
n =
|
|
3212
|
+
n = P(e);
|
|
3211
3213
|
} catch {
|
|
3212
3214
|
if (r = this.walletAdapters.get(e), !r)
|
|
3213
3215
|
throw new Error(`Wallet ${e} is not connected or supported`);
|
|
@@ -3298,7 +3300,7 @@ class Tn {
|
|
|
3298
3300
|
}
|
|
3299
3301
|
}
|
|
3300
3302
|
}
|
|
3301
|
-
class
|
|
3303
|
+
class Yn extends wr {
|
|
3302
3304
|
walletBridge;
|
|
3303
3305
|
constructor({
|
|
3304
3306
|
url: e,
|
|
@@ -3306,43 +3308,43 @@ class zn extends cr {
|
|
|
3306
3308
|
version: n,
|
|
3307
3309
|
slot: s,
|
|
3308
3310
|
namespace: o,
|
|
3309
|
-
tokens:
|
|
3310
|
-
preset:
|
|
3311
|
+
tokens: a,
|
|
3312
|
+
preset: i,
|
|
3311
3313
|
shouldOverridePresetPolicies: l,
|
|
3312
3314
|
rpcUrl: c,
|
|
3313
3315
|
ref: d,
|
|
3314
3316
|
refGroup: h,
|
|
3315
3317
|
needsSessionCreation: f,
|
|
3316
3318
|
username: u,
|
|
3317
|
-
onSessionCreated:
|
|
3319
|
+
onSessionCreated: p,
|
|
3318
3320
|
encryptedBlob: b,
|
|
3319
3321
|
...y
|
|
3320
3322
|
}) {
|
|
3321
|
-
const
|
|
3322
|
-
n &&
|
|
3323
|
+
const w = new URL(e ?? lt), x = new Wn();
|
|
3324
|
+
n && w.searchParams.set("v", encodeURIComponent(n)), s && w.searchParams.set("ps", encodeURIComponent(s)), o && w.searchParams.set("ns", encodeURIComponent(o)), a?.erc20 && w.searchParams.set(
|
|
3323
3325
|
"erc20",
|
|
3324
|
-
encodeURIComponent(
|
|
3325
|
-
), c &&
|
|
3326
|
+
encodeURIComponent(a.erc20.toString())
|
|
3327
|
+
), c && w.searchParams.set("rpc_url", encodeURIComponent(c)), d && w.searchParams.set("ref", encodeURIComponent(d)), h && w.searchParams.set("ref_group", encodeURIComponent(h)), f && w.searchParams.set("needs_session_creation", "true"), u && w.searchParams.set("username", encodeURIComponent(u)), (!i || l) && r ? w.searchParams.set(
|
|
3326
3328
|
"policies",
|
|
3327
3329
|
encodeURIComponent(JSON.stringify(r))
|
|
3328
|
-
) :
|
|
3330
|
+
) : i && w.searchParams.set("preset", i), b && (w.hash = `kc=${encodeURIComponent(b)}`), super({
|
|
3329
3331
|
...y,
|
|
3330
3332
|
id: "controller-keychain",
|
|
3331
|
-
url:
|
|
3333
|
+
url: w,
|
|
3332
3334
|
methods: {
|
|
3333
|
-
...
|
|
3335
|
+
...x.getIFrameMethods(),
|
|
3334
3336
|
// Expose callback for keychain to notify parent that session was created and storage access granted
|
|
3335
|
-
onSessionCreated: (
|
|
3336
|
-
|
|
3337
|
+
onSessionCreated: (m) => () => {
|
|
3338
|
+
p && p();
|
|
3337
3339
|
}
|
|
3338
3340
|
}
|
|
3339
|
-
}), this.walletBridge =
|
|
3341
|
+
}), this.walletBridge = x, typeof window < "u" && (window.external_wallets = this.walletBridge);
|
|
3340
3342
|
}
|
|
3341
3343
|
getWalletBridge() {
|
|
3342
3344
|
return this.walletBridge;
|
|
3343
3345
|
}
|
|
3344
3346
|
}
|
|
3345
|
-
function
|
|
3347
|
+
function Vn(t) {
|
|
3346
3348
|
if (!t || t.trim() === "")
|
|
3347
3349
|
return { isValid: !1, error: "Redirect URL is empty" };
|
|
3348
3350
|
let e;
|
|
@@ -3374,7 +3376,7 @@ function Ln(t) {
|
|
|
3374
3376
|
}
|
|
3375
3377
|
return { isValid: !0 };
|
|
3376
3378
|
}
|
|
3377
|
-
class
|
|
3379
|
+
class vs extends Wt {
|
|
3378
3380
|
keychain;
|
|
3379
3381
|
options;
|
|
3380
3382
|
iframes;
|
|
@@ -3390,23 +3392,23 @@ class Qn extends zt {
|
|
|
3390
3392
|
const n = [...[
|
|
3391
3393
|
{ rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia/rpc/v0_9" },
|
|
3392
3394
|
{ rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet/rpc/v0_9" }
|
|
3393
|
-
], ...e.chains || []], s = e.defaultChainId ||
|
|
3395
|
+
], ...e.chains || []], s = e.defaultChainId || Z.StarknetChainId.SN_MAIN;
|
|
3394
3396
|
this.selectedChain = s, this.chains = /* @__PURE__ */ new Map();
|
|
3395
3397
|
const o = typeof window < "u" ? new URLSearchParams(window.location.search) : null;
|
|
3396
3398
|
if (this.referral = {
|
|
3397
3399
|
ref: o?.get("ref") ?? void 0,
|
|
3398
3400
|
refGroup: o?.get("ref_group") ?? void 0
|
|
3399
3401
|
}, this.options = { ...e, chains: n, defaultChainId: s }, typeof window < "u" && typeof localStorage < "u") {
|
|
3400
|
-
const
|
|
3401
|
-
|
|
3402
|
-
const
|
|
3403
|
-
if (
|
|
3402
|
+
const a = o?.get("controller_standalone");
|
|
3403
|
+
a === "1" && sessionStorage.setItem("controller_standalone", "1");
|
|
3404
|
+
const i = o?.get("lastUsedConnector");
|
|
3405
|
+
if (i && localStorage.setItem("lastUsedConnector", i), window.location.hash) {
|
|
3404
3406
|
const c = new URLSearchParams(window.location.hash.slice(1)).get("kc");
|
|
3405
3407
|
c && (this.encryptedBlob = c);
|
|
3406
3408
|
}
|
|
3407
3409
|
if (o && window.history?.replaceState) {
|
|
3408
3410
|
let l = !1;
|
|
3409
|
-
|
|
3411
|
+
a && (o.delete("controller_standalone"), l = !0), i && (o.delete("lastUsedConnector"), l = !0);
|
|
3410
3412
|
let c = window.location.hash;
|
|
3411
3413
|
if (c) {
|
|
3412
3414
|
const d = new URLSearchParams(c.slice(1));
|
|
@@ -3424,7 +3426,7 @@ class Qn extends zt {
|
|
|
3424
3426
|
}
|
|
3425
3427
|
async logout() {
|
|
3426
3428
|
if (!this.keychain) {
|
|
3427
|
-
console.error(new
|
|
3429
|
+
console.error(new A().message);
|
|
3428
3430
|
return;
|
|
3429
3431
|
}
|
|
3430
3432
|
try {
|
|
@@ -3442,12 +3444,12 @@ class Qn extends zt {
|
|
|
3442
3444
|
if (this.iframes) {
|
|
3443
3445
|
try {
|
|
3444
3446
|
if (this.iframes.keychain || (this.iframes.keychain = this.createKeychainIframe()), await this.waitForKeychain(), !this.keychain) {
|
|
3445
|
-
console.error(new
|
|
3447
|
+
console.error(new A().message);
|
|
3446
3448
|
return;
|
|
3447
3449
|
}
|
|
3448
3450
|
const e = await this.keychain.probe(this.rpcUrl());
|
|
3449
3451
|
let r = e?.rpcUrl || this.rpcUrl();
|
|
3450
|
-
this.account = new
|
|
3452
|
+
this.account = new He(
|
|
3451
3453
|
this,
|
|
3452
3454
|
r,
|
|
3453
3455
|
e.address,
|
|
@@ -3467,7 +3469,7 @@ class Qn extends zt {
|
|
|
3467
3469
|
if (this.account)
|
|
3468
3470
|
return this.account;
|
|
3469
3471
|
if (this.iframes.keychain || (this.iframes.keychain = this.createKeychainIframe(), await this.waitForKeychain()), !this.keychain || !this.iframes.keychain) {
|
|
3470
|
-
console.error(new
|
|
3472
|
+
console.error(new A().message);
|
|
3471
3473
|
return;
|
|
3472
3474
|
}
|
|
3473
3475
|
this.iframes.keychain.open();
|
|
@@ -3475,7 +3477,7 @@ class Qn extends zt {
|
|
|
3475
3477
|
let e = await this.keychain.connect(this.options.signupOptions);
|
|
3476
3478
|
if (e.code !== Q.SUCCESS)
|
|
3477
3479
|
throw new Error(e.message);
|
|
3478
|
-
return e = e, this.account = new
|
|
3480
|
+
return e = e, this.account = new He(
|
|
3479
3481
|
this,
|
|
3480
3482
|
this.rpcUrl(),
|
|
3481
3483
|
e.address,
|
|
@@ -3494,7 +3496,7 @@ class Qn extends zt {
|
|
|
3494
3496
|
if (!this.iframes)
|
|
3495
3497
|
return !1;
|
|
3496
3498
|
if (!this.keychain || !this.iframes.keychain)
|
|
3497
|
-
return console.error(new
|
|
3499
|
+
return console.error(new A().message), !1;
|
|
3498
3500
|
const r = this.selectedChain;
|
|
3499
3501
|
try {
|
|
3500
3502
|
this.selectedChain = e, await this.keychain.switchChain(this.rpcUrl());
|
|
@@ -3508,7 +3510,7 @@ class Qn extends zt {
|
|
|
3508
3510
|
}
|
|
3509
3511
|
async disconnect() {
|
|
3510
3512
|
if (!this.keychain) {
|
|
3511
|
-
console.error(new
|
|
3513
|
+
console.error(new A().message);
|
|
3512
3514
|
return;
|
|
3513
3515
|
}
|
|
3514
3516
|
return this.account = void 0, this.keychain.disconnect();
|
|
@@ -3517,7 +3519,7 @@ class Qn extends zt {
|
|
|
3517
3519
|
if (!this.iframes)
|
|
3518
3520
|
return;
|
|
3519
3521
|
if (!this.keychain || !this.iframes.keychain) {
|
|
3520
|
-
console.error(new
|
|
3522
|
+
console.error(new A().message);
|
|
3521
3523
|
return;
|
|
3522
3524
|
}
|
|
3523
3525
|
if (!this.account) {
|
|
@@ -3533,7 +3535,7 @@ class Qn extends zt {
|
|
|
3533
3535
|
if (!this.iframes)
|
|
3534
3536
|
return;
|
|
3535
3537
|
if (!this.keychain || !this.iframes.keychain) {
|
|
3536
|
-
console.error(new
|
|
3538
|
+
console.error(new A().message);
|
|
3537
3539
|
return;
|
|
3538
3540
|
}
|
|
3539
3541
|
if (!this.account) {
|
|
@@ -3548,7 +3550,7 @@ class Qn extends zt {
|
|
|
3548
3550
|
async openProfileAt(e) {
|
|
3549
3551
|
if (this.iframes) {
|
|
3550
3552
|
if (!this.keychain || !this.iframes.keychain) {
|
|
3551
|
-
console.error(new
|
|
3553
|
+
console.error(new A().message);
|
|
3552
3554
|
return;
|
|
3553
3555
|
}
|
|
3554
3556
|
if (!this.account) {
|
|
@@ -3561,30 +3563,30 @@ class Qn extends zt {
|
|
|
3561
3563
|
openSettings() {
|
|
3562
3564
|
if (this.iframes) {
|
|
3563
3565
|
if (!this.keychain || !this.iframes.keychain) {
|
|
3564
|
-
console.error(new
|
|
3566
|
+
console.error(new A().message);
|
|
3565
3567
|
return;
|
|
3566
3568
|
}
|
|
3567
3569
|
this.iframes.keychain.open(), this.keychain.openSettings();
|
|
3568
3570
|
}
|
|
3569
3571
|
}
|
|
3570
3572
|
revoke(e, r) {
|
|
3571
|
-
return this.keychain ? this.keychain.revoke(e) : (console.error(new
|
|
3573
|
+
return this.keychain ? this.keychain.revoke(e) : (console.error(new A().message), null);
|
|
3572
3574
|
}
|
|
3573
3575
|
rpcUrl() {
|
|
3574
3576
|
const e = this.chains.get(this.selectedChain);
|
|
3575
3577
|
if (!e) {
|
|
3576
3578
|
const r = Array.from(this.chains.keys()).map(
|
|
3577
|
-
(n) =>
|
|
3579
|
+
(n) => Qe.decodeShortString(n)
|
|
3578
3580
|
);
|
|
3579
3581
|
throw new Error(
|
|
3580
|
-
`Chain not found: ${
|
|
3582
|
+
`Chain not found: ${Qe.decodeShortString(this.selectedChain)}. Available chains: ${r.join(", ")}`
|
|
3581
3583
|
);
|
|
3582
3584
|
}
|
|
3583
3585
|
return e.rpcUrl;
|
|
3584
3586
|
}
|
|
3585
3587
|
username() {
|
|
3586
3588
|
if (!this.keychain) {
|
|
3587
|
-
console.error(new
|
|
3589
|
+
console.error(new A().message);
|
|
3588
3590
|
return;
|
|
3589
3591
|
}
|
|
3590
3592
|
return this.keychain.username();
|
|
@@ -3592,7 +3594,7 @@ class Qn extends zt {
|
|
|
3592
3594
|
openPurchaseCredits() {
|
|
3593
3595
|
if (this.iframes) {
|
|
3594
3596
|
if (!this.keychain || !this.iframes.keychain) {
|
|
3595
|
-
console.error(new
|
|
3597
|
+
console.error(new A().message);
|
|
3596
3598
|
return;
|
|
3597
3599
|
}
|
|
3598
3600
|
this.keychain.navigate("/purchase/credits").then(() => {
|
|
@@ -3603,7 +3605,7 @@ class Qn extends zt {
|
|
|
3603
3605
|
async openStarterPack(e, r) {
|
|
3604
3606
|
if (this.iframes) {
|
|
3605
3607
|
if (!this.keychain || !this.iframes.keychain) {
|
|
3606
|
-
console.error(new
|
|
3608
|
+
console.error(new A().message);
|
|
3607
3609
|
return;
|
|
3608
3610
|
}
|
|
3609
3611
|
await this.keychain.openStarterPack(e, r), this.iframes.keychain?.open();
|
|
@@ -3613,7 +3615,7 @@ class Qn extends zt {
|
|
|
3613
3615
|
if (!this.iframes)
|
|
3614
3616
|
return;
|
|
3615
3617
|
if (!this.keychain || !this.iframes.keychain) {
|
|
3616
|
-
console.error(new
|
|
3618
|
+
console.error(new A().message);
|
|
3617
3619
|
return;
|
|
3618
3620
|
}
|
|
3619
3621
|
let n = this.selectedChain;
|
|
@@ -3625,7 +3627,7 @@ class Qn extends zt {
|
|
|
3625
3627
|
};
|
|
3626
3628
|
}
|
|
3627
3629
|
async delegateAccount() {
|
|
3628
|
-
return this.keychain ? await this.keychain.delegateAccount() : (console.error(new
|
|
3630
|
+
return this.keychain ? await this.keychain.delegateAccount() : (console.error(new A().message), null);
|
|
3629
3631
|
}
|
|
3630
3632
|
/**
|
|
3631
3633
|
* Opens the keychain in standalone mode (first-party context) for authentication.
|
|
@@ -3637,7 +3639,7 @@ class Qn extends zt {
|
|
|
3637
3639
|
console.error("open can only be called in browser context");
|
|
3638
3640
|
return;
|
|
3639
3641
|
}
|
|
3640
|
-
const r = new URL(this.options.url ||
|
|
3642
|
+
const r = new URL(this.options.url || lt), n = e.redirectUrl || window.location.href, s = Vn(n);
|
|
3641
3643
|
if (!s.isValid) {
|
|
3642
3644
|
console.error(
|
|
3643
3645
|
`Invalid redirect URL: ${s.error}`,
|
|
@@ -3653,8 +3655,8 @@ class Qn extends zt {
|
|
|
3653
3655
|
initializeChains(e) {
|
|
3654
3656
|
for (const r of e)
|
|
3655
3657
|
try {
|
|
3656
|
-
const n = new URL(r.rpcUrl), s =
|
|
3657
|
-
if ((o ||
|
|
3658
|
+
const n = new URL(r.rpcUrl), s = Yt(n), o = s === Z.StarknetChainId.SN_MAIN, a = s === Z.StarknetChainId.SN_SEPOLIA, i = n.hostname === "api.cartridge.gg", l = n.hostname === "localhost" || n.hostname === "127.0.0.1";
|
|
3659
|
+
if ((o || a) && !(i || l))
|
|
3658
3660
|
throw new Error(
|
|
3659
3661
|
`Only Cartridge RPC providers are allowed for ${o ? "mainnet" : "sepolia"}. Please use: https://api.cartridge.gg/x/starknet/${o ? "mainnet" : "sepolia"}/rpc/v0_9`
|
|
3660
3662
|
);
|
|
@@ -3669,14 +3671,14 @@ class Qn extends zt {
|
|
|
3669
3671
|
createKeychainIframe() {
|
|
3670
3672
|
const e = typeof window < "u" && typeof sessionStorage < "u" && sessionStorage.getItem("controller_standalone") === "1", n = (typeof window < "u" ? new URLSearchParams(window.location.search) : void 0)?.get("username") ?? void 0, s = this.encryptedBlob;
|
|
3671
3673
|
e && sessionStorage.removeItem("controller_standalone"), s && (this.encryptedBlob = void 0);
|
|
3672
|
-
const o = new
|
|
3674
|
+
const o = new Yn({
|
|
3673
3675
|
...this.options,
|
|
3674
3676
|
rpcUrl: this.rpcUrl(),
|
|
3675
3677
|
onClose: this.keychain?.reset,
|
|
3676
|
-
onConnect: (
|
|
3677
|
-
this.keychain =
|
|
3678
|
+
onConnect: (a) => {
|
|
3679
|
+
this.keychain = a;
|
|
3678
3680
|
},
|
|
3679
|
-
version:
|
|
3681
|
+
version: Vt,
|
|
3680
3682
|
ref: this.referral.ref,
|
|
3681
3683
|
refGroup: this.referral.refGroup,
|
|
3682
3684
|
needsSessionCreation: e,
|
|
@@ -3695,21 +3697,21 @@ class Qn extends zt {
|
|
|
3695
3697
|
interval: r = 100
|
|
3696
3698
|
} = {}) {
|
|
3697
3699
|
return new Promise((n, s) => {
|
|
3698
|
-
const o = Date.now(),
|
|
3700
|
+
const o = Date.now(), a = setInterval(() => {
|
|
3699
3701
|
if (Date.now() - o > e) {
|
|
3700
|
-
clearInterval(
|
|
3702
|
+
clearInterval(a), s(new Error("Timeout waiting for keychain"));
|
|
3701
3703
|
return;
|
|
3702
3704
|
}
|
|
3703
|
-
this.keychain && (clearInterval(
|
|
3705
|
+
this.keychain && (clearInterval(a), n());
|
|
3704
3706
|
}, r);
|
|
3705
3707
|
});
|
|
3706
3708
|
}
|
|
3707
3709
|
}
|
|
3708
|
-
const
|
|
3709
|
-
async function
|
|
3710
|
+
const H = /* @__PURE__ */ new Map();
|
|
3711
|
+
async function zt(t) {
|
|
3710
3712
|
if (!t.addresses?.length && !t.usernames?.length)
|
|
3711
3713
|
return { results: [] };
|
|
3712
|
-
const e = await fetch(`${
|
|
3714
|
+
const e = await fetch(`${qt}/lookup`, {
|
|
3713
3715
|
method: "POST",
|
|
3714
3716
|
headers: {
|
|
3715
3717
|
"Content-Type": "application/json"
|
|
@@ -3720,26 +3722,1064 @@ async function Bt(t) {
|
|
|
3720
3722
|
throw new Error(`HTTP error! status: ${e.status}`);
|
|
3721
3723
|
return e.json();
|
|
3722
3724
|
}
|
|
3723
|
-
async function
|
|
3724
|
-
const e = t.filter((r) => !
|
|
3725
|
-
return e.length > 0 && (await
|
|
3726
|
-
|
|
3725
|
+
async function ks(t) {
|
|
3726
|
+
const e = t.filter((r) => !H.has(r));
|
|
3727
|
+
return e.length > 0 && (await zt({ usernames: e })).results.forEach((n) => {
|
|
3728
|
+
H.set(n.username, n.addresses[0]);
|
|
3727
3729
|
}), new Map(
|
|
3728
|
-
t.map((r) => [r,
|
|
3730
|
+
t.map((r) => [r, H.get(r)]).filter((r) => r[1] !== void 0)
|
|
3729
3731
|
);
|
|
3730
3732
|
}
|
|
3731
|
-
async function
|
|
3732
|
-
t = t.map(
|
|
3733
|
-
const e = t.filter((r) => !
|
|
3734
|
-
return e.length > 0 && (await
|
|
3733
|
+
async function Es(t) {
|
|
3734
|
+
t = t.map(ct.toHex);
|
|
3735
|
+
const e = t.filter((r) => !H.has(r));
|
|
3736
|
+
return e.length > 0 && (await zt({
|
|
3735
3737
|
addresses: e
|
|
3736
3738
|
})).results.forEach((n) => {
|
|
3737
|
-
|
|
3739
|
+
H.set(n.addresses[0], n.username);
|
|
3738
3740
|
}), new Map(
|
|
3739
|
-
t.map((r) => [r,
|
|
3741
|
+
t.map((r) => [r, H.get(r)]).filter((r) => r[1] !== void 0)
|
|
3742
|
+
);
|
|
3743
|
+
}
|
|
3744
|
+
const v = "cartridge-toast-container", qn = 3e3, Zn = "bottom-right", Ot = "cartridge-toast-show";
|
|
3745
|
+
function De() {
|
|
3746
|
+
try {
|
|
3747
|
+
return typeof window < "u" && window.self !== window.top;
|
|
3748
|
+
} catch {
|
|
3749
|
+
return !0;
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3752
|
+
function Kn() {
|
|
3753
|
+
if (typeof document > "u")
|
|
3754
|
+
return null;
|
|
3755
|
+
if (De())
|
|
3756
|
+
try {
|
|
3757
|
+
if (window.parent && window.parent.document)
|
|
3758
|
+
return window.parent.document;
|
|
3759
|
+
} catch (t) {
|
|
3760
|
+
return console.warn("Failed to access parent document:", t), null;
|
|
3761
|
+
}
|
|
3762
|
+
return document;
|
|
3763
|
+
}
|
|
3764
|
+
function Gn(t, e) {
|
|
3765
|
+
let r = t.getElementById(v);
|
|
3766
|
+
return r || (r = t.createElement("div"), r.id = v, t.body && t.body.appendChild(r)), r.className = e, r;
|
|
3767
|
+
}
|
|
3768
|
+
function Xn(t) {
|
|
3769
|
+
t.classList.add("closing"), setTimeout(() => {
|
|
3770
|
+
t.parentNode && t.parentNode.removeChild(t);
|
|
3771
|
+
}, 200);
|
|
3772
|
+
}
|
|
3773
|
+
function Jn(t) {
|
|
3774
|
+
if (t.getElementById("cartridge-toast-styles"))
|
|
3775
|
+
return;
|
|
3776
|
+
const e = t.createElement("style");
|
|
3777
|
+
e.id = "cartridge-toast-styles", e.textContent = es(), t.head.appendChild(e);
|
|
3778
|
+
}
|
|
3779
|
+
function es() {
|
|
3780
|
+
return `
|
|
3781
|
+
#${v} {
|
|
3782
|
+
position: fixed;
|
|
3783
|
+
z-index: 999999;
|
|
3784
|
+
pointer-events: none;
|
|
3785
|
+
display: flex;
|
|
3786
|
+
flex-direction: column;
|
|
3787
|
+
align-items: flex-end;
|
|
3788
|
+
gap: 12px;
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
#${v}.top-left {
|
|
3792
|
+
top: 20px;
|
|
3793
|
+
left: 20px;
|
|
3794
|
+
align-items: flex-start;
|
|
3795
|
+
}
|
|
3796
|
+
|
|
3797
|
+
#${v}.top-right {
|
|
3798
|
+
top: 20px;
|
|
3799
|
+
right: 20px;
|
|
3800
|
+
align-items: flex-end;
|
|
3801
|
+
}
|
|
3802
|
+
|
|
3803
|
+
#${v}.top-center {
|
|
3804
|
+
top: 20px;
|
|
3805
|
+
left: 50%;
|
|
3806
|
+
transform: translateX(-50%);
|
|
3807
|
+
align-items: center;
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3810
|
+
#${v}.bottom-left {
|
|
3811
|
+
bottom: 20px;
|
|
3812
|
+
left: 20px;
|
|
3813
|
+
align-items: flex-start;
|
|
3814
|
+
}
|
|
3815
|
+
|
|
3816
|
+
#${v}.bottom-right {
|
|
3817
|
+
bottom: 20px;
|
|
3818
|
+
right: 20px;
|
|
3819
|
+
align-items: flex-end;
|
|
3820
|
+
}
|
|
3821
|
+
|
|
3822
|
+
#${v}.bottom-center {
|
|
3823
|
+
bottom: 20px;
|
|
3824
|
+
left: 50%;
|
|
3825
|
+
transform: translateX(-50%);
|
|
3826
|
+
align-items: center;
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
.cartridge-toast {
|
|
3830
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
3831
|
+
display: flex;
|
|
3832
|
+
align-items: center;
|
|
3833
|
+
animation: cartridge-toast-slide-in 0.3s ease-out;
|
|
3834
|
+
overflow: hidden;
|
|
3835
|
+
pointer-events: auto;
|
|
3836
|
+
}
|
|
3837
|
+
|
|
3838
|
+
#${v}.top-right .cartridge-toast,
|
|
3839
|
+
#${v}.bottom-right .cartridge-toast {
|
|
3840
|
+
align-self: flex-end;
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3843
|
+
#${v}.top-left .cartridge-toast,
|
|
3844
|
+
#${v}.bottom-left .cartridge-toast {
|
|
3845
|
+
align-self: flex-start;
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3848
|
+
#${v}.top-center .cartridge-toast,
|
|
3849
|
+
#${v}.bottom-center .cartridge-toast {
|
|
3850
|
+
align-self: center;
|
|
3851
|
+
}
|
|
3852
|
+
|
|
3853
|
+
@keyframes cartridge-toast-slide-in {
|
|
3854
|
+
from {
|
|
3855
|
+
opacity: 0;
|
|
3856
|
+
transform: translateY(10px);
|
|
3857
|
+
}
|
|
3858
|
+
to {
|
|
3859
|
+
opacity: 1;
|
|
3860
|
+
transform: translateY(0);
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
|
|
3864
|
+
.cartridge-toast.closing {
|
|
3865
|
+
animation: cartridge-toast-slide-out 0.2s ease-in forwards;
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3868
|
+
@keyframes cartridge-toast-slide-out {
|
|
3869
|
+
from {
|
|
3870
|
+
opacity: 1;
|
|
3871
|
+
transform: translateY(0);
|
|
3872
|
+
}
|
|
3873
|
+
to {
|
|
3874
|
+
opacity: 0;
|
|
3875
|
+
transform: translateY(10px);
|
|
3876
|
+
}
|
|
3877
|
+
}
|
|
3878
|
+
|
|
3879
|
+
@media (max-width: 640px) {
|
|
3880
|
+
.cartridge-toast {
|
|
3881
|
+
min-width: calc(100vw - 40px);
|
|
3882
|
+
max-width: calc(100vw - 40px);
|
|
3883
|
+
}
|
|
3884
|
+
|
|
3885
|
+
#${v}.top-left,
|
|
3886
|
+
#${v}.top-right,
|
|
3887
|
+
#${v}.top-center {
|
|
3888
|
+
top: 10px;
|
|
3889
|
+
left: 20px;
|
|
3890
|
+
right: 20px;
|
|
3891
|
+
transform: none;
|
|
3892
|
+
align-items: stretch;
|
|
3893
|
+
}
|
|
3894
|
+
|
|
3895
|
+
#${v}.bottom-left,
|
|
3896
|
+
#${v}.bottom-right,
|
|
3897
|
+
#${v}.bottom-center {
|
|
3898
|
+
bottom: 10px;
|
|
3899
|
+
left: 20px;
|
|
3900
|
+
right: 20px;
|
|
3901
|
+
transform: none;
|
|
3902
|
+
align-items: stretch;
|
|
3903
|
+
}
|
|
3904
|
+
}
|
|
3905
|
+
`;
|
|
3906
|
+
}
|
|
3907
|
+
const ee = (t = !1) => {
|
|
3908
|
+
const e = document.createElement("div");
|
|
3909
|
+
e.id = "close-button", e.style.display = "flex", e.style.alignItems = "center", e.style.justifyContent = "center";
|
|
3910
|
+
const r = document.createElement("button");
|
|
3911
|
+
r.className = t ? "cartridge-close-button translucent" : "cartridge-close-button";
|
|
3912
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3913
|
+
n.setAttribute("width", "20"), n.setAttribute("height", "20"), n.setAttribute("viewBox", "0 0 20 20"), n.setAttribute("fill", "none"), n.style.pointerEvents = "none";
|
|
3914
|
+
const s = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3915
|
+
s.setAttribute(
|
|
3916
|
+
"d",
|
|
3917
|
+
"M15.5465 14.343C15.8881 14.6837 15.8881 15.2364 15.5465 15.5772C15.2049 15.9179 14.6506 15.9178 14.309 15.5772L10.0006 11.2484L5.66162 15.5757C5.32001 15.9164 4.76575 15.9164 4.4241 15.5757C4.08245 15.235 4.08249 14.6822 4.4241 14.3415L8.76455 10.0157L4.4229 5.65573C4.08128 5.31504 4.08128 4.76227 4.4229 4.42155C4.76451 4.08082 5.31877 4.08086 5.66042 4.42155L10.0006 8.78299L14.3396 4.45573C14.6812 4.11504 15.2355 4.11504 15.5771 4.45573C15.9188 4.79642 15.9187 5.34918 15.5771 5.68991L11.2367 10.0157L15.5465 14.343Z"
|
|
3918
|
+
), s.setAttribute("class", "cartridge-close-icon"), n.appendChild(s), r.appendChild(n), r.style.display = "flex", r.style.alignItems = "center", r.style.justifyContent = "center", r.style.border = "none", r.style.background = "transparent", r.style.cursor = "pointer", r.style.borderRadius = "4px", r.style.padding = "10px", r.style.gap = "4px", r.style.transition = "background-color 0.2s ease";
|
|
3919
|
+
const o = e.ownerDocument;
|
|
3920
|
+
if (!o.getElementById("cartridge-close-button-style")) {
|
|
3921
|
+
const a = o.createElement("style");
|
|
3922
|
+
a.id = "cartridge-close-button-style", a.textContent = `
|
|
3923
|
+
.cartridge-close-button .cartridge-close-icon {
|
|
3924
|
+
fill: rgba(0, 0, 0, 0.48);
|
|
3925
|
+
transition: fill 0.2s ease;
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3928
|
+
.cartridge-close-button:not(.translucent):hover {
|
|
3929
|
+
background-color: #181c19;
|
|
3930
|
+
}
|
|
3931
|
+
|
|
3932
|
+
.cartridge-close-button:not(.translucent):hover .cartridge-close-icon {
|
|
3933
|
+
fill: rgba(255, 255, 255, 0.72);
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
.cartridge-close-button.translucent .cartridge-close-icon {
|
|
3937
|
+
fill: rgba(0, 0, 0, 0.48);
|
|
3938
|
+
}
|
|
3939
|
+
|
|
3940
|
+
.cartridge-close-button.translucent:hover {
|
|
3941
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
3942
|
+
}
|
|
3943
|
+
|
|
3944
|
+
.cartridge-close-button.translucent:hover .cartridge-close-icon {
|
|
3945
|
+
fill: rgba(0, 0, 0, 0.72);
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3948
|
+
.cartridge-close-button:active {
|
|
3949
|
+
transform: scale(0.95);
|
|
3950
|
+
}
|
|
3951
|
+
`, o.head.appendChild(a);
|
|
3952
|
+
}
|
|
3953
|
+
return e.appendChild(r), e;
|
|
3954
|
+
};
|
|
3955
|
+
function ts(t) {
|
|
3956
|
+
if (t.getElementById("cartridge-toast-error-styles"))
|
|
3957
|
+
return;
|
|
3958
|
+
const e = t.createElement("style");
|
|
3959
|
+
e.id = "cartridge-toast-error-styles", e.textContent = `
|
|
3960
|
+
/* Error Toast */
|
|
3961
|
+
.cartridge-toast.error {
|
|
3962
|
+
background-color: #E66666;
|
|
3963
|
+
border-radius: 8px;
|
|
3964
|
+
width: 360px;
|
|
3965
|
+
display: flex;
|
|
3966
|
+
align-items: flex-start;
|
|
3967
|
+
position: relative;
|
|
3968
|
+
overflow: hidden;
|
|
3969
|
+
box-sizing: border-box;
|
|
3970
|
+
}
|
|
3971
|
+
|
|
3972
|
+
.cartridge-toast.error .label-bar {
|
|
3973
|
+
display: flex;
|
|
3974
|
+
padding: 12px 12px 16px 12px;
|
|
3975
|
+
align-items: center;
|
|
3976
|
+
gap: 8px;
|
|
3977
|
+
flex: 1 0 0;
|
|
3978
|
+
}
|
|
3979
|
+
|
|
3980
|
+
.cartridge-toast.error .label-bar .label-container {
|
|
3981
|
+
display: flex;
|
|
3982
|
+
align-items: center;
|
|
3983
|
+
gap: 8px;
|
|
3984
|
+
}
|
|
3985
|
+
|
|
3986
|
+
.cartridge-toast.error .label-bar .icon-container {
|
|
3987
|
+
width: 24px;
|
|
3988
|
+
height: 24px;
|
|
3989
|
+
aspect-ratio: 1/1;
|
|
3990
|
+
display: flex;
|
|
3991
|
+
justify-content: center;
|
|
3992
|
+
align-items: center;
|
|
3993
|
+
flex-shrink: 0;
|
|
3994
|
+
}
|
|
3995
|
+
|
|
3996
|
+
.cartridge-toast.error .label-bar p {
|
|
3997
|
+
color: #0F1410;
|
|
3998
|
+
font-family: Inter;
|
|
3999
|
+
font-size: 14px;
|
|
4000
|
+
font-style: normal;
|
|
4001
|
+
font-weight: 500;
|
|
4002
|
+
line-height: 20px;
|
|
4003
|
+
}
|
|
4004
|
+
|
|
4005
|
+
.cartridge-toast.error .close-button-container {
|
|
4006
|
+
display: flex;
|
|
4007
|
+
padding: 4px;
|
|
4008
|
+
align-items: center;
|
|
4009
|
+
gap: 10px;
|
|
4010
|
+
}
|
|
4011
|
+
|
|
4012
|
+
.cartridge-toast.error {
|
|
4013
|
+
position: relative;
|
|
4014
|
+
overflow: hidden;
|
|
4015
|
+
}
|
|
4016
|
+
`, t.head.appendChild(e);
|
|
4017
|
+
}
|
|
4018
|
+
function rs(t) {
|
|
4019
|
+
const e = document.createElement("div");
|
|
4020
|
+
e.className = "cartridge-toast error";
|
|
4021
|
+
const r = document.createElement("div");
|
|
4022
|
+
r.className = "label-bar", e.appendChild(r);
|
|
4023
|
+
const n = document.createElement("div");
|
|
4024
|
+
n.className = "label-container", r.appendChild(n);
|
|
4025
|
+
const s = document.createElement("div");
|
|
4026
|
+
s.className = "icon-container", s.innerHTML = `
|
|
4027
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
4028
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.79313 0.326989L17.673 8.20771C18.109 8.6437 18.109 9.35713 17.673 9.79229L9.79229 17.673C9.3563 18.109 8.6437 18.109 8.20771 17.673L0.326989 9.79229C-0.108996 9.35713 -0.108996 8.6437 0.326989 8.20771L8.20856 0.326989C8.64454 -0.108996 9.35715 -0.108996 9.79313 0.326989ZM8.26159 4.84378C8.26159 4.37794 8.63953 4 9.10537 4C9.57121 4 9.94915 4.3797 9.94915 4.84378V9.34394C9.94915 9.80978 9.57121 10.1877 9.13701 10.1877C8.70282 10.1877 8.26159 9.81154 8.26159 9.34394V4.84378ZM9.10537 13.5628C8.49503 13.5628 8.00002 13.0678 8.00002 12.4575C8.00002 11.8472 8.49468 11.3521 9.10537 11.3521C9.71605 11.3521 10.2107 11.8472 10.2107 12.4575C10.2093 13.0671 9.71711 13.5628 9.10537 13.5628Z" fill="#0F1410"/>
|
|
4029
|
+
</svg>
|
|
4030
|
+
`, n.appendChild(s);
|
|
4031
|
+
const o = document.createElement("p");
|
|
4032
|
+
o.className = "content", o.textContent = t.message || "Error", n.appendChild(o);
|
|
4033
|
+
const a = document.createElement("div");
|
|
4034
|
+
a.className = "close-button-container";
|
|
4035
|
+
const i = ee(!0);
|
|
4036
|
+
return a.appendChild(i), e.appendChild(a), e;
|
|
4037
|
+
}
|
|
4038
|
+
function ns(t) {
|
|
4039
|
+
if (t.getElementById("cartridge-toast-transaction-styles"))
|
|
4040
|
+
return;
|
|
4041
|
+
const e = t.createElement("style");
|
|
4042
|
+
e.id = "cartridge-toast-transaction-styles", e.textContent = `
|
|
4043
|
+
/* Transaction Toast */
|
|
4044
|
+
.cartridge-toast.transaction {
|
|
4045
|
+
background-color: #161A17;
|
|
4046
|
+
border-radius: 8px;
|
|
4047
|
+
position: relative;
|
|
4048
|
+
overflow: hidden;
|
|
4049
|
+
}
|
|
4050
|
+
|
|
4051
|
+
/* Expanded State */
|
|
4052
|
+
.cartridge-toast.transaction.expanded {
|
|
4053
|
+
width: 360px;
|
|
4054
|
+
}
|
|
4055
|
+
|
|
4056
|
+
.cartridge-toast.transaction.expanded .toast-content {
|
|
4057
|
+
display: flex;
|
|
4058
|
+
align-items: center;
|
|
4059
|
+
justify-content: space-between;
|
|
4060
|
+
width: 100%;
|
|
4061
|
+
gap: 8px;
|
|
4062
|
+
box-sizing: border-box;
|
|
4063
|
+
}
|
|
4064
|
+
|
|
4065
|
+
.cartridge-toast.transaction.expanded .label-bar {
|
|
4066
|
+
display: flex;
|
|
4067
|
+
align-items: center;
|
|
4068
|
+
padding: 12px;
|
|
4069
|
+
gap: 8px;
|
|
4070
|
+
flex: 1 0 0;
|
|
4071
|
+
}
|
|
4072
|
+
|
|
4073
|
+
.cartridge-toast.transaction.expanded .label-bar .label-container {
|
|
4074
|
+
display: flex;
|
|
4075
|
+
align-items: center;
|
|
4076
|
+
gap: 8px;
|
|
4077
|
+
}
|
|
4078
|
+
|
|
4079
|
+
.cartridge-toast.transaction.expanded .label-bar .icon-container {
|
|
4080
|
+
width: 24px;
|
|
4081
|
+
height: 24px;
|
|
4082
|
+
display: flex;
|
|
4083
|
+
align-items: center;
|
|
4084
|
+
justify-content: center;
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
.cartridge-toast.transaction.expanded .label-bar p.status {
|
|
4088
|
+
color: #FFF;
|
|
4089
|
+
font-family: Inter;
|
|
4090
|
+
font-size: 14px;
|
|
4091
|
+
font-style: normal;
|
|
4092
|
+
font-weight: 500;
|
|
4093
|
+
line-height: 20px;
|
|
4094
|
+
margin: 0;
|
|
4095
|
+
}
|
|
4096
|
+
|
|
4097
|
+
.cartridge-toast.transaction.expanded .label-bar .activity-feed-container {
|
|
4098
|
+
display: flex;
|
|
4099
|
+
padding: 2px;
|
|
4100
|
+
align-items: center;
|
|
4101
|
+
border-radius: 2px;
|
|
4102
|
+
background: rgba(0, 0, 0, 0.08);
|
|
4103
|
+
}
|
|
4104
|
+
|
|
4105
|
+
.cartridge-toast.transaction.expanded .label-bar .activity-icon {
|
|
4106
|
+
width: 16px;
|
|
4107
|
+
height: 16px;
|
|
4108
|
+
display: flex;
|
|
4109
|
+
align-items: center;
|
|
4110
|
+
justify-content: center;
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
.cartridge-toast.transaction.expanded .label-bar .activity-label-container {
|
|
4114
|
+
display: flex;
|
|
4115
|
+
padding: 0 2px;
|
|
4116
|
+
justify-content: center;
|
|
4117
|
+
align-items: center;
|
|
4118
|
+
}
|
|
4119
|
+
|
|
4120
|
+
.cartridge-toast.transaction.expanded .label-bar span.activity-label {
|
|
4121
|
+
color: #3F3;
|
|
4122
|
+
font-family: Inter;
|
|
4123
|
+
font-size: 12px;
|
|
4124
|
+
font-style: normal;
|
|
4125
|
+
font-weight: 400;
|
|
4126
|
+
line-height: 16px;
|
|
4127
|
+
}
|
|
4128
|
+
|
|
4129
|
+
.cartridge-toast.transaction.expanded .close-button-container {
|
|
4130
|
+
display: flex;
|
|
4131
|
+
align-items: center;
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
/* Progress Bar - will be added dynamically */
|
|
4135
|
+
.cartridge-toast.transaction .cartridge-toast-progress-bar {
|
|
4136
|
+
background: rgba(255, 255, 255, 0.1);
|
|
4137
|
+
}
|
|
4138
|
+
|
|
4139
|
+
.cartridge-toast.transaction .cartridge-toast-progress-bar-fill {
|
|
4140
|
+
background: #3F3;
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
/* Collapsed State */
|
|
4144
|
+
.cartridge-toast.transaction.collapsed {
|
|
4145
|
+
display: inline-flex;
|
|
4146
|
+
padding: 10px;
|
|
4147
|
+
align-items: center;
|
|
4148
|
+
justify-content: center;
|
|
4149
|
+
}
|
|
4150
|
+
|
|
4151
|
+
.cartridge-toast.transaction.collapsed .collapsed-icon {
|
|
4152
|
+
width: 28px;
|
|
4153
|
+
height: 28px;
|
|
4154
|
+
display: flex;
|
|
4155
|
+
align-items: center;
|
|
4156
|
+
justify-content: center;
|
|
4157
|
+
}
|
|
4158
|
+
|
|
4159
|
+
/* Spinner Animation */
|
|
4160
|
+
@keyframes spin {
|
|
4161
|
+
from {
|
|
4162
|
+
transform: rotate(0deg);
|
|
4163
|
+
}
|
|
4164
|
+
to {
|
|
4165
|
+
transform: rotate(360deg);
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
|
|
4169
|
+
.cartridge-toast.transaction .icon-container.spinning,
|
|
4170
|
+
.cartridge-toast.transaction .collapsed-icon.spinning {
|
|
4171
|
+
animation: spin 1s linear infinite;
|
|
4172
|
+
}
|
|
4173
|
+
`, t.head.appendChild(e);
|
|
4174
|
+
}
|
|
4175
|
+
function ss(t) {
|
|
4176
|
+
const e = document.createElement("div");
|
|
4177
|
+
if (e.className = `cartridge-toast transaction ${t.isExpanded ? "expanded" : "collapsed"}`, t.isExpanded) {
|
|
4178
|
+
const r = document.createElement("div");
|
|
4179
|
+
r.className = "toast-content";
|
|
4180
|
+
const n = document.createElement("div");
|
|
4181
|
+
n.className = "label-bar";
|
|
4182
|
+
const s = document.createElement("div");
|
|
4183
|
+
s.className = "label-container";
|
|
4184
|
+
const o = document.createElement("div");
|
|
4185
|
+
o.className = "icon-container", t.status === "confirming" ? (o.classList.add("spinning"), o.innerHTML = `
|
|
4186
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
4187
|
+
<path d="M11.1111 5.77756C11.1111 5.28673 11.5083 4.88867 12 4.88867C15.9278 4.88867 19.1111 8.07201 19.1111 11.9998C19.1111 13.2942 18.7639 14.5109 18.1583 15.5553C17.9139 15.9803 17.3694 16.1276 16.9194 15.8803C16.5194 15.6359 16.375 15.0914 16.6194 14.6414C17.0722 13.8831 17.3333 12.972 17.3333 11.9748C17.3333 9.03034 14.9444 6.64145 12 6.64145C11.5083 6.64145 11.1111 6.26839 11.1111 5.75256V5.77756Z" fill="white"/>
|
|
4188
|
+
<path opacity="0.25" d="M11.975 6.66645C9.03058 6.66645 6.64169 9.03034 6.64169 11.9998C6.64169 14.9442 9.03058 17.3331 11.975 17.3331C13.9472 17.3331 15.6472 16.2914 16.5806 14.7331L16.5834 14.7359C16.3917 15.1498 16.5417 15.647 16.9195 15.8803C17.3695 16.1276 17.9139 15.9803 18.1584 15.5553C18.1639 15.547 18.1695 15.5387 18.1722 15.5303C16.9472 17.6692 14.6417 19.1109 12 19.1109C8.07225 19.1109 4.88892 15.9276 4.88892 11.9998C4.88892 8.07201 8.07225 4.88867 12 4.88867C11.5084 4.88867 11.1111 5.28673 11.1111 5.77756C11.1111 6.26839 11.5084 6.66645 12 6.66645H11.975Z" fill="white" fill-opacity="0.64"/>
|
|
4189
|
+
</svg>
|
|
4190
|
+
`) : o.innerHTML = `
|
|
4191
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
4192
|
+
<path d="M8.36382 18.5465L4 14.1827L5.45427 12.7284L8.36382 15.638L18.5457 5.45508L20 6.91032L8.36382 18.5465Z" fill="#33FF33"/>
|
|
4193
|
+
</svg>
|
|
4194
|
+
`;
|
|
4195
|
+
const a = document.createElement("p");
|
|
4196
|
+
if (a.className = "status", a.textContent = t.status === "confirming" ? "Confirming" : "Confirmed", s.appendChild(o), s.appendChild(a), t.label) {
|
|
4197
|
+
const c = document.createElement("div");
|
|
4198
|
+
c.className = "activity-feed-container";
|
|
4199
|
+
const d = document.createElement("div");
|
|
4200
|
+
d.className = "activity-icon", d.innerHTML = `
|
|
4201
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
4202
|
+
<path d="M7.985 4.0002C8.23167 3.99353 8.45 4.1552 8.515 4.39353L9.74833 8.91353L10.0433 8.32353C10.2233 7.96187 10.5933 7.73353 10.9967 7.73353H12.8C13.095 7.73353 13.3333 7.97187 13.3333 8.26687C13.3333 8.56187 13.095 8.8002 12.8 8.8002H10.9967L10.0767 10.6385C9.97833 10.8369 9.76667 10.9519 9.54667 10.9302C9.32667 10.9085 9.14333 10.7535 9.085 10.5402L8.06167 6.78853L6.92167 12.1119C6.87 12.3519 6.66333 12.5252 6.41833 12.5335C6.17333 12.5419 5.955 12.3819 5.88833 12.1469L4.93167 8.8002H3.2C2.905 8.8002 2.66667 8.56187 2.66667 8.26687C2.66667 7.97187 2.905 7.73353 3.2 7.73353H4.93167C5.40833 7.73353 5.82667 8.04853 5.95667 8.50687L6.32667 9.8002L7.47833 4.42187C7.53 4.18187 7.74 4.00687 7.985 4.0002Z" fill="#33FF33"/>
|
|
4203
|
+
</svg>
|
|
4204
|
+
`;
|
|
4205
|
+
const h = document.createElement("div");
|
|
4206
|
+
h.className = "activity-label-container";
|
|
4207
|
+
const f = document.createElement("span");
|
|
4208
|
+
f.className = "activity-label", f.textContent = t.label, h.appendChild(f), c.appendChild(d), c.appendChild(h), s.appendChild(c);
|
|
4209
|
+
}
|
|
4210
|
+
n.appendChild(s), r.appendChild(n);
|
|
4211
|
+
const i = document.createElement("div");
|
|
4212
|
+
i.className = "close-button-container";
|
|
4213
|
+
const l = ee();
|
|
4214
|
+
i.appendChild(l), r.appendChild(i), e.appendChild(r);
|
|
4215
|
+
} else {
|
|
4216
|
+
const r = document.createElement("div");
|
|
4217
|
+
r.className = "collapsed-icon", t.status === "confirming" ? (r.classList.add("spinning"), r.innerHTML = `
|
|
4218
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28" fill="none">
|
|
4219
|
+
<path d="M12.9629 6.74016C12.9629 6.16752 13.4264 5.70312 14 5.70312C18.5824 5.70312 22.2963 9.41701 22.2963 13.9994C22.2963 15.5096 21.8912 16.9291 21.1847 18.1476C20.8995 18.6434 20.2643 18.8152 19.7393 18.5267C19.2727 18.2416 19.1041 17.6064 19.3893 17.0814C19.9176 16.1966 20.2222 15.1337 20.2222 13.9703C20.2222 10.5351 17.4352 7.74803 14 7.74803C13.4264 7.74803 12.9629 7.3128 12.9629 6.711V6.74016Z" fill="white"/>
|
|
4220
|
+
<path opacity="0.25" d="M13.9709 7.7772C10.5357 7.7772 7.74864 10.5351 7.74864 13.9994C7.74864 17.4346 10.5357 20.2216 13.9709 20.2216C16.2718 20.2216 18.2551 19.0064 19.344 17.1883L19.3473 17.1916C19.1236 17.6744 19.2986 18.2545 19.7394 18.5267C20.2644 18.8152 20.8996 18.6434 21.1848 18.1476C21.1912 18.1378 21.1977 18.1281 21.201 18.1184C19.7718 20.6138 17.082 22.2957 14 22.2957C9.41762 22.2957 5.70374 18.5818 5.70374 13.9994C5.70374 9.41701 9.41762 5.70312 14 5.70312C13.4264 5.70312 12.963 6.16752 12.963 6.74016C12.963 7.3128 13.4264 7.7772 14 7.7772H13.9709Z" fill="white" fill-opacity="0.64"/>
|
|
4221
|
+
</svg>
|
|
4222
|
+
`) : r.innerHTML = `
|
|
4223
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28" fill="none">
|
|
4224
|
+
<path d="M9.75779 21.6366L4.66667 16.5455L6.36332 14.8489L9.75779 18.2433L21.6367 6.36328L23.3333 8.06107L9.75779 21.6366Z" fill="#33FF33"/>
|
|
4225
|
+
</svg>
|
|
4226
|
+
`, e.appendChild(r);
|
|
4227
|
+
}
|
|
4228
|
+
return e;
|
|
4229
|
+
}
|
|
4230
|
+
function os(t) {
|
|
4231
|
+
if (t.getElementById("cartridge-toast-network-switch-styles"))
|
|
4232
|
+
return;
|
|
4233
|
+
const e = t.createElement("style");
|
|
4234
|
+
e.id = "cartridge-toast-network-switch-styles", e.textContent = `
|
|
4235
|
+
/* Network Switch Toast */
|
|
4236
|
+
.cartridge-toast.network-switch {
|
|
4237
|
+
background-color: #161A17;
|
|
4238
|
+
border-radius: 8px;
|
|
4239
|
+
width: 360px;
|
|
4240
|
+
padding: 14px;
|
|
4241
|
+
gap: 12px;
|
|
4242
|
+
}
|
|
4243
|
+
|
|
4244
|
+
.cartridge-toast.network-switch p.content {
|
|
4245
|
+
color: #ffffff;
|
|
4246
|
+
font-family: Inter;
|
|
4247
|
+
font-size: 14px;
|
|
4248
|
+
font-style: normal;
|
|
4249
|
+
font-weight: 500;
|
|
4250
|
+
line-height: 20px; /* 142.857% */
|
|
4251
|
+
}
|
|
4252
|
+
`, t.head.appendChild(e);
|
|
4253
|
+
}
|
|
4254
|
+
function as(t) {
|
|
4255
|
+
const e = document.createElement("div");
|
|
4256
|
+
e.className = "cartridge-toast network-switch";
|
|
4257
|
+
const r = document.createElement(t.networkIcon ? "img" : "div");
|
|
4258
|
+
r.className = "icon", r.style.width = "24px", r.style.height = "24px", r.style.aspectRatio = "1/1", t.networkIcon ? (r.src = dt(t.networkIcon), r.alt = t.networkName) : (r.style.backgroundColor = "#161A17", r.innerHTML = t.networkName.charAt(0).toUpperCase(), r.style.color = "#ffffff", r.style.fontWeight = "600", r.style.fontSize = "12px", r.style.lineHeight = "16px", r.style.textAlign = "center", r.style.textTransform = "uppercase", r.style.borderRadius = "4px", r.style.padding = "4px");
|
|
4259
|
+
const n = document.createElement("p");
|
|
4260
|
+
return n.className = "content", n.textContent = `Switched to ${t.networkName}`, e.appendChild(r), e.appendChild(n), e;
|
|
4261
|
+
}
|
|
4262
|
+
function is(t) {
|
|
4263
|
+
if (t.getElementById("cartridge-toast-achievement-styles"))
|
|
4264
|
+
return;
|
|
4265
|
+
const e = t.createElement("style");
|
|
4266
|
+
e.id = "cartridge-toast-achievement-styles", e.textContent = `
|
|
4267
|
+
/* Achievement Toast */
|
|
4268
|
+
.cartridge-toast.achievement {
|
|
4269
|
+
background-color: #161A17;
|
|
4270
|
+
border-radius: 8px;
|
|
4271
|
+
width: 360px;
|
|
4272
|
+
padding: 12px;
|
|
4273
|
+
padding-bottom: 16px;
|
|
4274
|
+
display: flex;
|
|
4275
|
+
align-items: center;
|
|
4276
|
+
justify-content: space-between;
|
|
4277
|
+
position: relative;
|
|
4278
|
+
overflow: hidden;
|
|
4279
|
+
min-height: 52px;
|
|
4280
|
+
box-sizing: border-box;
|
|
4281
|
+
}
|
|
4282
|
+
|
|
4283
|
+
.cartridge-toast.achievement .image-content-container {
|
|
4284
|
+
display: flex;
|
|
4285
|
+
align-items: center;
|
|
4286
|
+
gap: 8px;
|
|
4287
|
+
flex: 1;
|
|
4288
|
+
}
|
|
4289
|
+
|
|
4290
|
+
.cartridge-toast.achievement .image {
|
|
4291
|
+
width: 30px;
|
|
4292
|
+
height: 30px;
|
|
4293
|
+
aspect-ratio: 1/1;
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
.cartridge-toast.achievement .image-container {
|
|
4297
|
+
display: flex;
|
|
4298
|
+
padding: 5px;
|
|
4299
|
+
justify-content: center;
|
|
4300
|
+
align-items: center;
|
|
4301
|
+
gap: 10px;
|
|
4302
|
+
border-radius: 4px;
|
|
4303
|
+
background: #161A17;
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
.cartridge-toast.achievement .content {
|
|
4307
|
+
display: flex;
|
|
4308
|
+
height: 40px;
|
|
4309
|
+
flex-direction: column;
|
|
4310
|
+
justify-content: center;
|
|
4311
|
+
align-items: flex-start;
|
|
4312
|
+
gap: 2px;
|
|
4313
|
+
}
|
|
4314
|
+
|
|
4315
|
+
.cartridge-toast.achievement .title {
|
|
4316
|
+
color: #FFF;
|
|
4317
|
+
font-family: Inter;
|
|
4318
|
+
font-size: 14px;
|
|
4319
|
+
font-style: normal;
|
|
4320
|
+
font-weight: 500;
|
|
4321
|
+
line-height: 20px;
|
|
4322
|
+
}
|
|
4323
|
+
|
|
4324
|
+
.cartridge-toast.achievement .subtitle {
|
|
4325
|
+
color: #808080;
|
|
4326
|
+
font-family: Inter;
|
|
4327
|
+
font-size: 12px;
|
|
4328
|
+
font-style: normal;
|
|
4329
|
+
font-weight: 400;
|
|
4330
|
+
line-height: 16px;
|
|
4331
|
+
}
|
|
4332
|
+
|
|
4333
|
+
.cartridge-toast.achievement .xp-section-container {
|
|
4334
|
+
display: flex;
|
|
4335
|
+
padding: 10px;
|
|
4336
|
+
flex-direction: column;
|
|
4337
|
+
align-items: flex-start;
|
|
4338
|
+
gap: 10px;
|
|
4339
|
+
}
|
|
4340
|
+
|
|
4341
|
+
.cartridge-toast.achievement .xp-section {
|
|
4342
|
+
display: flex;
|
|
4343
|
+
align-items: center;
|
|
4344
|
+
gap: 2px;
|
|
4345
|
+
align-self: stretch;
|
|
4346
|
+
}
|
|
4347
|
+
|
|
4348
|
+
.cartridge-toast.achievement .xp-section .xp-icon {
|
|
4349
|
+
width: 20px;
|
|
4350
|
+
height: 20px;
|
|
4351
|
+
aspect-ratio: 1/1;
|
|
4352
|
+
}
|
|
4353
|
+
|
|
4354
|
+
.cartridge-toast.achievement .xp-section .xp-amount {
|
|
4355
|
+
color: #FFF;
|
|
4356
|
+
/* Inter/Regular 14px */
|
|
4357
|
+
font-family: Inter;
|
|
4358
|
+
font-size: 14px;
|
|
4359
|
+
font-style: normal;
|
|
4360
|
+
font-weight: 400;
|
|
4361
|
+
line-height: 20px; /* 142.857% */
|
|
4362
|
+
}
|
|
4363
|
+
`, t.head.appendChild(e);
|
|
4364
|
+
}
|
|
4365
|
+
function cs(t) {
|
|
4366
|
+
const e = document.createElement("div");
|
|
4367
|
+
e.className = "cartridge-toast achievement";
|
|
4368
|
+
const r = document.createElement("div");
|
|
4369
|
+
r.className = "image-content-container";
|
|
4370
|
+
const n = document.createElement("div");
|
|
4371
|
+
n.className = "image-container";
|
|
4372
|
+
const s = ls(t.isDraft);
|
|
4373
|
+
s.className = "image", n.appendChild(s);
|
|
4374
|
+
const o = document.createElement("div");
|
|
4375
|
+
o.className = "content";
|
|
4376
|
+
const a = document.createElement("p");
|
|
4377
|
+
a.className = "title", a.textContent = t.title;
|
|
4378
|
+
const i = document.createElement("p");
|
|
4379
|
+
i.className = "subtitle", i.textContent = t.subtitle || "Earned!", o.appendChild(a), o.appendChild(i), r.appendChild(n), r.appendChild(o);
|
|
4380
|
+
const l = document.createElement("div");
|
|
4381
|
+
l.className = "xp-section-container";
|
|
4382
|
+
const c = document.createElement("div");
|
|
4383
|
+
c.className = "xp-section";
|
|
4384
|
+
const d = ds(!t.isDraft);
|
|
4385
|
+
d.setAttribute("class", "xp-icon"), c.appendChild(d);
|
|
4386
|
+
const h = document.createElement("span");
|
|
4387
|
+
h.className = "xp-amount", h.textContent = `${t.xpAmount}`, c.appendChild(h), l.appendChild(c);
|
|
4388
|
+
const f = ee(!1);
|
|
4389
|
+
return e.appendChild(r), e.appendChild(l), e.appendChild(f), e;
|
|
4390
|
+
}
|
|
4391
|
+
const ls = (t = !1) => {
|
|
4392
|
+
const e = document.createElement("div"), r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
4393
|
+
switch (r.setAttribute("width", "34"), r.setAttribute("height", "34"), r.setAttribute("viewBox", "0 0 30 30"), r.style.width = "100%", r.style.height = "100%", t) {
|
|
4394
|
+
case !0:
|
|
4395
|
+
r.innerHTML = `
|
|
4396
|
+
<path d="M26.25 5.15625C26.25 10.1484 22.5322 14.2749 17.7158 14.9121C17.4038 12.5654 16.3711 10.4473 14.8462 8.79053C16.5293 5.78467 19.7461 3.75 23.4375 3.75H24.8438C25.6216 3.75 26.25 4.37842 26.25 5.15625ZM3.75 7.96875C3.75 7.19092 4.37842 6.5625 5.15625 6.5625H6.5625C11.9985 6.5625 16.4062 10.9702 16.4062 16.4062V17.8125V24.8438C16.4062 25.6216 15.7778 26.25 15 26.25C14.2222 26.25 13.5938 25.6216 13.5938 24.8438V17.8125C8.15771 17.8125 3.75 13.4048 3.75 7.96875Z" fill="#33FF33"/>
|
|
4397
|
+
`;
|
|
4398
|
+
break;
|
|
4399
|
+
default:
|
|
4400
|
+
r.innerHTML = `
|
|
4401
|
+
<path d="M9.559 6.47461C9.73478 6.23633 10.016 6.0918 10.3129 6.0918H19.688C19.9848 6.0918 20.2661 6.23242 20.4419 6.47461L24.8169 12.4121C25.0825 12.7715 25.0552 13.2676 24.7583 13.5996L15.6957 23.5997C15.5161 23.795 15.2661 23.9083 15.0004 23.9083C14.7348 23.9083 14.4848 23.795 14.3051 23.5997L5.24257 13.5996C4.94179 13.2676 4.91835 12.7715 5.18398 12.4121L9.559 6.47461ZM11.0629 8.02931C10.934 8.12696 10.8988 8.30275 10.9809 8.43946L13.2231 12.1739L7.47305 12.6543C7.31289 12.666 7.18789 12.8028 7.18789 12.9668C7.18789 13.1309 7.31289 13.2637 7.47305 13.2793L14.9731 13.9043C14.9887 13.9043 15.0082 13.9043 15.0239 13.9043L22.5239 13.2793C22.6841 13.2676 22.8091 13.1309 22.8091 12.9668C22.8091 12.8028 22.6841 12.67 22.5239 12.6543L16.7778 12.1778L19.02 8.44337C19.102 8.30665 19.0669 8.12696 18.9379 8.03321C18.809 7.93946 18.6294 7.95509 18.52 8.07228L15.0004 11.8809L11.4809 8.06837C11.3715 7.95118 11.1918 7.93556 11.0629 8.02931Z" fill="#D3A4E5"/>
|
|
4402
|
+
`;
|
|
4403
|
+
}
|
|
4404
|
+
return e.appendChild(r), e;
|
|
4405
|
+
}, ds = (t) => {
|
|
4406
|
+
const e = document.createElementNS(
|
|
4407
|
+
"http://www.w3.org/2000/svg",
|
|
4408
|
+
"svg"
|
|
3740
4409
|
);
|
|
4410
|
+
switch (e.setAttribute("width", "12"), e.setAttribute("height", "12"), e.setAttribute("viewBox", "0 0 20 20"), t) {
|
|
4411
|
+
case !0:
|
|
4412
|
+
e.innerHTML = `
|
|
4413
|
+
<path d="M15 12.5C15.125 12.5 15.2373 12.5781 15.2815 12.6953L15.8333 14.1667L17.3046 14.7184C17.4218 14.7627 17.5 14.875 17.5 15C17.5 15.125 17.4218 15.2373 17.3046 15.2816L15.8333 15.8333L15.2815 17.3047C15.2373 17.4219 15.125 17.5 15 17.5C14.875 17.5 14.7627 17.4219 14.7184 17.3047L14.1666 15.8333L12.6953 15.2816C12.5781 15.2373 12.5 15.125 12.5 15C12.5 14.875 12.5781 14.7627 12.6953 14.7184L14.1666 14.1667L14.7184 12.6953C14.7627 12.5781 14.875 12.5 15 12.5Z" fill="white"/>
|
|
4414
|
+
<path d="M8.33492 3.33333C8.55184 3.33333 8.75177 3.45943 8.84273 3.65885L10.6217 7.51139C10.6632 7.60119 10.7353 7.67335 10.8252 7.71484L14.6744 9.49056C14.8739 9.58152 15 9.78146 15 9.99837C14.9999 10.2152 14.8738 10.4144 14.6744 10.5054L10.8219 12.2852C10.7321 12.3267 10.66 12.3988 10.6184 12.4886L8.83866 16.3411C8.74772 16.5405 8.54853 16.6666 8.33167 16.6667C8.11475 16.6667 7.91482 16.5406 7.82385 16.3411L6.04814 12.4919C6.00665 12.402 5.93449 12.3299 5.84469 12.2884L1.99215 10.5094C1.79272 10.4185 1.66663 10.222 1.66663 10.0016C1.66667 9.78126 1.79276 9.58151 1.99215 9.49056L5.84143 7.71159C5.93113 7.67013 6.00335 7.59781 6.04488 7.50814L7.82792 3.65885C7.91887 3.45947 8.11805 3.33338 8.33492 3.33333Z" fill="white"/>
|
|
4415
|
+
<path d="M15 2.5C15.125 2.5 15.2373 2.57812 15.2815 2.69531L15.8333 4.16667L17.3046 4.71842C17.4218 4.7627 17.5 4.875 17.5 5C17.5 5.125 17.4218 5.2373 17.3046 5.28158L15.8333 5.83333L15.2815 7.30469C15.2373 7.42188 15.125 7.5 15 7.5C14.875 7.5 14.7627 7.42188 14.7184 7.30469L14.1666 5.83333L12.6953 5.28158C12.5781 5.2373 12.5 5.125 12.5 5C12.5 4.875 12.5781 4.7627 12.6953 4.71842L14.1666 4.16667L14.7184 2.69531C14.7627 2.57812 14.875 2.5 15 2.5Z" fill="white"/>
|
|
4416
|
+
`;
|
|
4417
|
+
break;
|
|
4418
|
+
default:
|
|
4419
|
+
e.innerHTML = `
|
|
4420
|
+
<path d="M10.4094 15.4897C10.411 15.4905 10.4126 15.4914 10.4143 15.4922L10.4314 15.4995C10.6358 15.6012 10.726 15.8431 10.6397 16.0537L10.6356 16.0635C10.6329 16.0701 10.6305 16.0772 10.6275 16.0838L10.5087 16.3418C10.495 16.3716 10.478 16.3992 10.4598 16.4256C10.4582 16.428 10.4558 16.4306 10.4541 16.4329C10.4476 16.4421 10.4389 16.4494 10.4322 16.4582C10.4242 16.4681 10.4164 16.4781 10.4078 16.4875C10.402 16.4939 10.3962 16.5004 10.3907 16.507C10.3874 16.5102 10.3843 16.5136 10.3809 16.5168C10.3787 16.5181 10.377 16.5201 10.3752 16.5216C10.373 16.5236 10.3701 16.5246 10.3679 16.5265C10.3542 16.5386 10.3395 16.5492 10.3247 16.5599C10.303 16.5758 10.2802 16.5897 10.2564 16.6022C10.2458 16.6077 10.2356 16.6137 10.2246 16.6185C10.2214 16.6199 10.218 16.6215 10.2149 16.6234C10.2122 16.6245 10.2095 16.6255 10.2067 16.6266C10.201 16.6289 10.1954 16.6294 10.1897 16.6315C10.1684 16.6393 10.1468 16.6459 10.1246 16.651C10.1207 16.6519 10.1169 16.6529 10.1132 16.6543C10.1085 16.6552 10.104 16.6567 10.0993 16.6576C10.0969 16.6576 10.0944 16.658 10.092 16.6584C10.0653 16.6629 10.0382 16.6651 10.0106 16.6657C10.0076 16.6657 10.0047 16.6673 10.0017 16.6673L10 16.6665L9.99841 16.6673C9.99542 16.6673 9.99245 16.6657 9.98946 16.6657C9.96191 16.6651 9.93482 16.6629 9.90808 16.6584C9.90541 16.6579 9.90266 16.6577 9.89994 16.6576C9.89527 16.6567 9.89075 16.6553 9.88611 16.6543C9.88265 16.653 9.87909 16.6519 9.87553 16.651C9.85329 16.6459 9.83172 16.6393 9.81042 16.6315C9.80464 16.6294 9.79825 16.6289 9.79252 16.6266C9.7898 16.6255 9.78709 16.6245 9.78438 16.6234C9.78147 16.6216 9.77852 16.6199 9.77543 16.6185C9.76453 16.6137 9.75425 16.6077 9.74369 16.6022C9.71984 16.5897 9.69713 16.5758 9.67533 16.5599C9.66058 16.5492 9.64588 16.5386 9.6322 16.5265C9.63002 16.5246 9.62704 16.5236 9.62488 16.5216C9.62295 16.5199 9.6207 16.5182 9.61837 16.5168C9.61499 16.5136 9.6119 16.5102 9.6086 16.507L9.56791 16.4582C9.56115 16.4494 9.55246 16.4421 9.54594 16.4329C9.54426 16.4306 9.54187 16.428 9.54024 16.4256C9.52204 16.3992 9.50507 16.3716 9.49141 16.3418L9.37179 16.0838C9.36875 16.0772 9.36715 16.0701 9.36446 16.0635L9.35958 16.0537C9.27358 15.8434 9.36397 15.6014 9.56791 15.4995L9.58582 15.4922C9.58746 15.4914 9.58904 15.4905 9.5907 15.4897L9.82237 15.3823C9.93257 15.3312 10.0596 15.3307 10.1702 15.381L10.4094 15.4897Z" fill="white"/>
|
|
4421
|
+
<path d="M8.6711 13.4959C8.89565 13.3923 9.16217 13.4896 9.26599 13.714L9.50281 14.23C9.58063 14.3981 9.54569 14.5899 9.42875 14.7191C9.40896 14.741 9.38639 14.7606 9.36202 14.7785C9.33856 14.7956 9.31368 14.8114 9.28634 14.8241C9.22958 14.8502 9.17014 14.8624 9.11137 14.8639C9.0348 14.8666 8.95986 14.8483 8.89246 14.8143C8.80654 14.7705 8.73345 14.7003 8.68982 14.606L8.45219 14.09L8.45138 14.0892L8.45056 14.0868C8.35597 13.8818 8.42976 13.6441 8.61414 13.5252C8.6199 13.5235 8.62553 13.5214 8.63123 13.5195C8.64439 13.5117 8.6569 13.5025 8.6711 13.4959Z" fill="white"/>
|
|
4422
|
+
<path d="M10.7341 13.714C10.8379 13.4896 11.1044 13.3923 11.329 13.4959C11.3432 13.5025 11.3557 13.5117 11.3689 13.5195C11.3743 13.5213 11.3796 13.5236 11.3851 13.5252C11.5699 13.644 11.6442 13.8816 11.5495 14.0868L11.5487 14.0892L11.5479 14.09L11.3103 14.606C11.2666 14.7003 11.1935 14.7705 11.1076 14.8143C11.0402 14.8483 10.9653 14.8666 10.8887 14.8639C10.8299 14.8624 10.7705 14.8502 10.7137 14.8241C10.6862 14.8113 10.6609 14.7957 10.6372 14.7785C10.6131 14.7607 10.591 14.7409 10.5713 14.7191C10.5643 14.7113 10.5582 14.7028 10.5518 14.6947C10.5296 14.6666 10.5113 14.6365 10.4965 14.6043C10.4442 14.4895 10.4401 14.3534 10.4973 14.23L10.7341 13.714Z" fill="white"/>
|
|
4423
|
+
<path d="M7.17289 11.6388C7.27684 11.4148 7.54356 11.318 7.76778 11.4215L8.02576 11.5404L8.13888 11.5916C8.25956 11.6472 8.35637 11.7446 8.41231 11.8651L8.5824 12.2337C8.68602 12.4579 8.5892 12.7239 8.36511 12.8278C8.34249 12.8382 8.31926 12.8455 8.29594 12.8514L8.29106 12.8522C8.26967 12.8573 8.24828 12.8613 8.22677 12.8636C8.2011 12.8667 8.1757 12.8673 8.15027 12.866C7.98977 12.8578 7.83918 12.7648 7.76697 12.6089L7.72953 12.5283C7.67627 12.4133 7.58336 12.3211 7.4683 12.2679L7.38936 12.2313C7.17378 12.1316 7.07701 11.8826 7.1615 11.6641C7.16304 11.6616 7.16492 11.6593 7.16638 11.6567C7.16879 11.6509 7.17021 11.6446 7.17289 11.6388Z" fill="white"/>
|
|
4424
|
+
<path d="M12.2323 11.4215C12.4565 11.318 12.7232 11.4148 12.8272 11.6388C12.8299 11.6446 12.8313 11.6509 12.8337 11.6567C12.8351 11.6592 12.8363 11.6617 12.8378 11.6641C12.9224 11.8827 12.8264 12.1315 12.6107 12.2313L12.5318 12.2679C12.4167 12.3211 12.3238 12.4133 12.2705 12.5283L12.2331 12.6089C12.1505 12.7873 11.9652 12.8837 11.7798 12.8644C11.7774 12.8642 11.775 12.8639 11.7725 12.8636C11.7261 12.8585 11.6796 12.8484 11.635 12.8278C11.4109 12.7239 11.3141 12.4579 11.4177 12.2337L11.5878 11.8651C11.6437 11.7446 11.7405 11.6472 11.8612 11.5916L11.9743 11.5404L12.2323 11.4215Z" fill="white"/>
|
|
4425
|
+
<path d="M10 7.50065C10.125 7.50065 10.2373 7.57878 10.2816 7.69596L10.7666 8.98991C10.8089 9.10259 10.8981 9.1918 11.0108 9.23405L12.3047 9.71908C12.4219 9.76335 12.5 9.87565 12.5 10.0007C12.5 10.1257 12.4219 10.238 12.3047 10.2822L11.0108 10.7673C10.8981 10.8095 10.8089 10.8987 10.7666 11.0114L10.2816 12.3053C10.2373 12.4225 10.125 12.5007 10 12.5007C9.87504 12.5007 9.76274 12.4225 9.71846 12.3053L9.23344 11.0114C9.19119 10.8987 9.10197 10.8095 8.9893 10.7673L7.69535 10.2822C7.57817 10.238 7.50004 10.1257 7.50004 10.0007C7.50004 9.87565 7.57817 9.76335 7.69535 9.71908L8.9893 9.23405C9.10197 9.1918 9.19119 9.10259 9.23344 8.98991L9.71846 7.69596C9.76274 7.57878 9.87504 7.50065 10 7.50065Z" fill="white"/>
|
|
4426
|
+
<path d="M5.17582 10.7184C5.27971 10.4938 5.54608 10.3957 5.77071 10.4995L5.87162 10.5459L5.87325 10.5467L6.28992 10.738C6.5069 10.8384 6.60331 11.0913 6.51534 11.3109C6.51294 11.3167 6.5115 11.323 6.50883 11.3288C6.50648 11.3339 6.50321 11.3385 6.50069 11.3434C6.48189 11.3813 6.45788 11.4144 6.4307 11.4443C6.36347 11.5167 6.2748 11.5643 6.17924 11.5811C6.09138 11.5974 5.998 11.5887 5.91069 11.5485L5.39473 11.3109C5.19818 11.22 5.09874 11.0044 5.14653 10.8014L5.17582 10.7184Z" fill="white"/>
|
|
4427
|
+
<path d="M14.2294 10.4995C14.454 10.3957 14.7204 10.4938 14.8243 10.7184L14.8536 10.8014C14.9013 11.0044 14.8019 11.22 14.6053 11.3109L14.0894 11.5485C14.0021 11.5887 13.9087 11.5974 13.8208 11.5811C13.6811 11.5566 13.5551 11.4671 13.4913 11.3288C13.4886 11.3231 13.4879 11.3166 13.4856 11.3109C13.3974 11.0913 13.4931 10.8384 13.7102 10.738L14.1268 10.5467L14.1285 10.5459L14.2294 10.4995Z" fill="white"/>
|
|
4428
|
+
<path d="M3.96651 9.35205C4.17017 9.274 4.401 9.36373 4.49711 9.56201L4.51013 9.59049C4.51134 9.593 4.51303 9.59528 4.5142 9.59782L4.61902 9.83038C4.66826 9.93964 4.66807 10.0648 4.61849 10.1739L4.5142 10.4035C4.51313 10.4058 4.51123 10.4077 4.51013 10.41L4.49548 10.4409C4.39952 10.6364 4.17327 10.7248 3.97139 10.6501L3.94698 10.6387C3.93704 10.6351 3.92689 10.6319 3.91687 10.6281L3.65889 10.5093C3.63045 10.4963 3.60365 10.4809 3.57833 10.4637C3.57288 10.46 3.56816 10.4554 3.56287 10.4515C3.53866 10.4339 3.51543 10.4147 3.49451 10.3937C3.48924 10.3884 3.48408 10.383 3.47904 10.3774C3.47489 10.3729 3.47165 10.3675 3.46765 10.3628C3.4513 10.3437 3.43652 10.3236 3.42289 10.3026C3.41862 10.2959 3.41467 10.2891 3.41069 10.2822C3.39638 10.2579 3.38371 10.2329 3.37325 10.2065C3.37142 10.2019 3.36926 10.1974 3.36755 10.1927C3.35907 10.1698 3.35269 10.1461 3.34721 10.1219C3.34543 10.1138 3.34375 10.1057 3.34233 10.0975C3.33705 10.0664 3.33337 10.0346 3.33337 10.0023C3.33337 10.0004 3.33417 9.99848 3.33419 9.99658C3.33437 9.96506 3.33718 9.93408 3.34233 9.90381C3.34408 9.89365 3.34653 9.8837 3.34884 9.8737C3.3539 9.8524 3.35932 9.83138 3.36674 9.81104C3.37028 9.80114 3.37405 9.7914 3.37813 9.78174C3.38778 9.75923 3.39902 9.73761 3.4115 9.71663C3.41532 9.71013 3.41882 9.70344 3.42289 9.6971C3.43664 9.67601 3.45197 9.65601 3.46847 9.63688C3.47209 9.63263 3.47529 9.62801 3.47904 9.62386V9.62223C3.48395 9.61685 3.48938 9.61196 3.49451 9.60677C3.51639 9.58487 3.54076 9.56475 3.56612 9.54655C3.57053 9.54339 3.57463 9.53982 3.57914 9.53678C3.60419 9.51987 3.6308 9.50487 3.65889 9.49202L3.9185 9.37158C3.92793 9.368 3.9376 9.36521 3.94698 9.36182L3.96651 9.35205Z" fill="white"/>
|
|
4429
|
+
<path d="M15.5022 9.56201C15.5981 9.36374 15.8292 9.27444 16.0328 9.35205L16.0531 9.36182C16.0622 9.36513 16.0716 9.36813 16.0808 9.37158L16.3412 9.49202C16.3691 9.50477 16.3952 9.52002 16.4201 9.53678C16.4248 9.53994 16.4294 9.54326 16.434 9.54655C16.4592 9.56464 16.483 9.58503 16.5048 9.60677C16.5099 9.61196 16.5153 9.61685 16.5202 9.62223L16.521 9.62386C16.5248 9.62801 16.528 9.63263 16.5316 9.63688C16.5481 9.65601 16.5634 9.67601 16.5772 9.6971C16.5813 9.70344 16.5848 9.71013 16.5886 9.71663C16.601 9.73751 16.6115 9.75934 16.6211 9.78174C16.6377 9.82081 16.6504 9.86145 16.6578 9.90381C16.6629 9.93408 16.6657 9.96506 16.6659 9.99658C16.6659 9.99848 16.6667 10.0004 16.6667 10.0023C16.6667 10.0735 16.6521 10.1423 16.6268 10.2065C16.6164 10.2329 16.6037 10.2579 16.5894 10.2822C16.5854 10.2891 16.5815 10.2959 16.5772 10.3026C16.5636 10.3236 16.5488 10.3437 16.5324 10.3628C16.5284 10.3675 16.5244 10.3729 16.5202 10.3774C16.4909 10.4096 16.4584 10.4389 16.4218 10.4637C16.3964 10.4809 16.3696 10.4963 16.3412 10.5093L16.0824 10.6281C16.0726 10.6317 16.0628 10.6352 16.0531 10.6387L16.0279 10.6501C15.8261 10.7244 15.5995 10.6363 15.5038 10.4409L15.4899 10.41C15.4888 10.4077 15.4869 10.4058 15.4859 10.4035L15.3814 10.176C15.3309 10.0662 15.3306 9.93988 15.3806 9.82986L15.4859 9.59782C15.4871 9.59528 15.4887 9.593 15.4899 9.59049L15.5022 9.56201Z" fill="white"/>
|
|
4430
|
+
<path d="M6.17354 8.41781C6.24076 8.42866 6.30491 8.45486 6.36072 8.4943C6.36594 8.49804 6.37111 8.50173 6.37618 8.5057C6.39298 8.51868 6.40844 8.5334 6.42338 8.54883C6.45414 8.58106 6.48087 8.61756 6.50151 8.6595C6.50346 8.6634 6.50616 8.66693 6.50802 8.6709C6.6098 8.89465 6.51325 9.16001 6.28992 9.26335L5.87325 9.45459L5.77071 9.50179C5.54608 9.60561 5.27971 9.50747 5.17582 9.28288C5.16739 9.26458 5.16208 9.24546 5.15629 9.22673C5.09213 9.01602 5.18924 8.78544 5.39473 8.69043L5.91069 8.4528C5.99604 8.41351 6.08742 8.40301 6.17354 8.41781Z" fill="white"/>
|
|
4431
|
+
<path d="M13.8265 8.41781C13.9127 8.40301 14.004 8.41351 14.0894 8.4528L14.6053 8.69043C14.8108 8.78544 14.9079 9.01602 14.8438 9.22673C14.838 9.24546 14.8327 9.26458 14.8243 9.28288C14.7204 9.50747 14.454 9.60561 14.2294 9.50179L14.1268 9.45459L13.7102 9.26335C13.4869 9.16006 13.3897 8.89459 13.4913 8.6709C13.5562 8.53141 13.6849 8.44067 13.8265 8.41781Z" fill="white"/>
|
|
4432
|
+
<path d="M8.08191 7.14258C8.12914 7.13285 8.17781 7.13014 8.22677 7.13607C8.24823 7.1384 8.26974 7.14218 8.29106 7.14746L8.29594 7.14827C8.31935 7.15435 8.34238 7.16303 8.36511 7.1735C8.56102 7.26434 8.65923 7.47893 8.61169 7.68131C8.60496 7.70958 8.59583 7.73771 8.58321 7.76514L8.41231 8.13623C8.35637 8.25674 8.25956 8.35409 8.13888 8.40967L8.02576 8.46094L7.76778 8.57975C7.54356 8.6833 7.27684 8.58647 7.17289 8.36247C7.17011 8.35645 7.16888 8.34982 7.16638 8.34375C7.16463 8.34069 7.16259 8.33779 7.16069 8.3348C7.07785 8.11681 7.17457 7.86935 7.38936 7.77002L7.4683 7.7334C7.58336 7.68022 7.67627 7.58801 7.72953 7.47298L7.76697 7.39242C7.82881 7.25894 7.9481 7.17047 8.08191 7.14258Z" fill="white"/>
|
|
4433
|
+
<path d="M11.7798 7.13525C11.9651 7.11604 12.1505 7.21406 12.2331 7.39242L12.2705 7.47298C12.3238 7.58801 12.4167 7.68022 12.5318 7.7334L12.6107 7.77002C12.8256 7.86939 12.9216 8.11674 12.8386 8.3348C12.8368 8.33767 12.8354 8.34081 12.8337 8.34375C12.8312 8.34982 12.83 8.35645 12.8272 8.36247C12.8018 8.41716 12.7665 8.46398 12.7246 8.50244C12.7224 8.50452 12.7197 8.5061 12.7173 8.50814C12.588 8.62224 12.3988 8.65664 12.2323 8.57975L11.9743 8.46094L11.8612 8.40967C11.7405 8.35409 11.6437 8.25674 11.5878 8.13623L11.4169 7.76514C11.4042 7.73766 11.3943 7.70964 11.3876 7.68131C11.3401 7.47899 11.4391 7.26431 11.635 7.1735C11.6797 7.1529 11.7261 7.14117 11.7725 7.13607C11.7749 7.13577 11.7774 7.13551 11.7798 7.13525Z" fill="white"/>
|
|
4434
|
+
<path d="M9.18949 5.14632C9.1935 5.14715 9.19771 5.14701 9.2017 5.14795C9.22997 5.15459 9.25812 5.16391 9.28552 5.17643C9.31373 5.18956 9.33961 5.20577 9.36365 5.22363C9.45286 5.28964 9.51067 5.38576 9.53292 5.49056C9.55232 5.58202 9.54494 5.67999 9.50281 5.77132L9.26599 6.28727C9.16217 6.5117 8.89565 6.60897 8.6711 6.50537C8.65677 6.49874 8.6445 6.48886 8.63123 6.48096C8.62472 6.47885 8.61831 6.47634 8.61169 6.47445C8.42914 6.35505 8.35639 6.11858 8.45056 5.91455L8.51648 5.77214L8.68982 5.39534C8.71856 5.33319 8.75929 5.2802 8.80863 5.23909C8.8927 5.16966 9.00036 5.13309 9.10974 5.13656H9.11381C9.13907 5.13735 9.16427 5.14113 9.18949 5.14632Z" fill="white"/>
|
|
4435
|
+
<path d="M10.8903 5.13656C10.9995 5.13309 11.1066 5.16992 11.1906 5.23909C11.2402 5.28026 11.2814 5.33298 11.3103 5.39534L11.4836 5.77214L11.5495 5.91455C11.6438 6.1188 11.5706 6.35517 11.3876 6.47445C11.3812 6.47627 11.3751 6.47893 11.3689 6.48096C11.3556 6.48886 11.3433 6.49874 11.329 6.50537C11.1044 6.60897 10.8379 6.5117 10.7341 6.28727L10.4973 5.77132C10.4551 5.67999 10.4478 5.58202 10.4672 5.49056C10.4894 5.38576 10.5472 5.28964 10.6364 5.22363C10.6603 5.20591 10.6858 5.1895 10.7137 5.17643C10.7696 5.15079 10.8284 5.13837 10.8863 5.13656H10.8903Z" fill="white"/>
|
|
4436
|
+
<path d="M10.0106 3.3348C10.0381 3.3354 10.0653 3.33759 10.092 3.34212H10.0953C10.1029 3.34343 10.1105 3.34539 10.118 3.34701C10.1203 3.34772 10.1223 3.34892 10.1246 3.34945C10.1468 3.3546 10.1684 3.36122 10.1897 3.36898C10.1952 3.37101 10.2012 3.37179 10.2067 3.37386C10.2103 3.37525 10.2138 3.37647 10.2173 3.37793C10.2198 3.37925 10.2221 3.38088 10.2246 3.382C10.2355 3.38682 10.2458 3.39278 10.2564 3.39827C10.2802 3.41078 10.303 3.42474 10.3247 3.44059C10.3395 3.45123 10.3542 3.46189 10.3679 3.47396C10.3702 3.47599 10.3729 3.47758 10.3752 3.47965C10.3769 3.48116 10.3789 3.4825 10.3809 3.48372C10.3847 3.48725 10.3886 3.49067 10.3923 3.4943C10.3975 3.50048 10.4024 3.50699 10.4078 3.51302C10.4164 3.52234 10.4242 3.53238 10.4322 3.54232C10.4391 3.55124 10.4475 3.55906 10.4541 3.56836C10.4558 3.5707 10.4582 3.57333 10.4598 3.57568C10.478 3.60208 10.495 3.62965 10.5087 3.65951L10.6283 3.91748C10.6312 3.92383 10.633 3.9306 10.6356 3.93701L10.6389 3.94434C10.7268 4.15432 10.6373 4.39518 10.4346 4.49854L10.4167 4.50749C10.4142 4.5087 10.4119 4.51039 10.4094 4.51156L10.1763 4.61897C10.0664 4.66962 9.93997 4.67 9.82978 4.62002L9.5907 4.51156C9.58816 4.51039 9.58588 4.5087 9.58337 4.50749L9.56466 4.49854C9.36247 4.39504 9.2728 4.15403 9.36039 3.94434L9.36446 3.93701C9.36707 3.9306 9.36886 3.92383 9.37179 3.91748L9.49141 3.65951C9.50507 3.62965 9.52204 3.60208 9.54024 3.57568C9.54187 3.57333 9.54426 3.5707 9.54594 3.56836C9.55259 3.55906 9.56101 3.55124 9.56791 3.54232C9.57592 3.53238 9.5837 3.52234 9.59233 3.51302C9.59759 3.50712 9.60188 3.50036 9.60697 3.4943C9.61067 3.49066 9.61457 3.48725 9.61837 3.48372C9.62059 3.48237 9.62305 3.48131 9.62488 3.47965C9.62717 3.47758 9.62988 3.47599 9.6322 3.47396C9.64588 3.46189 9.66058 3.45123 9.67533 3.44059C9.69711 3.42474 9.71986 3.41078 9.74369 3.39827C9.75424 3.39278 9.76454 3.38682 9.77543 3.382C9.77776 3.38097 9.77969 3.37914 9.78194 3.37793C9.78543 3.37647 9.78901 3.37525 9.79252 3.37386C9.79826 3.37162 9.80465 3.3711 9.81042 3.36898C9.8317 3.36122 9.85332 3.3546 9.87553 3.34945C9.87753 3.34898 9.87926 3.34763 9.88123 3.34701C9.88881 3.34538 9.89634 3.34344 9.90401 3.34212H9.90808C9.93478 3.33759 9.96195 3.3354 9.98946 3.3348C9.99245 3.33474 9.99542 3.33398 9.99841 3.33398H10.0017C10.0047 3.33398 10.0076 3.33474 10.0106 3.3348Z" fill="white"/>
|
|
4437
|
+
`;
|
|
4438
|
+
}
|
|
4439
|
+
return e;
|
|
4440
|
+
};
|
|
4441
|
+
function hs(t) {
|
|
4442
|
+
if (t.getElementById("cartridge-toast-marketplace-styles"))
|
|
4443
|
+
return;
|
|
4444
|
+
const e = t.createElement("style");
|
|
4445
|
+
e.id = "cartridge-toast-marketplace-styles", e.textContent = `
|
|
4446
|
+
/* Marketplace Toast */
|
|
4447
|
+
.cartridge-toast.marketplace {
|
|
4448
|
+
background-color: #1E221F;
|
|
4449
|
+
border-radius: 4px;
|
|
4450
|
+
width: 400px;
|
|
4451
|
+
padding: 12px;
|
|
4452
|
+
padding-bottom: 16px;
|
|
4453
|
+
display: flex;
|
|
4454
|
+
align-items: center;
|
|
4455
|
+
justify-content: space-between;
|
|
4456
|
+
position: relative;
|
|
4457
|
+
overflow: hidden;
|
|
4458
|
+
box-sizing: border-box;
|
|
4459
|
+
}
|
|
4460
|
+
|
|
4461
|
+
.cartridge-toast.marketplace .image-container {
|
|
4462
|
+
display: flex;
|
|
4463
|
+
padding: 3px;
|
|
4464
|
+
align-items: center;
|
|
4465
|
+
gap: 10px;
|
|
4466
|
+
border-radius: 4px;
|
|
4467
|
+
background: #161A17;
|
|
4468
|
+
}
|
|
4469
|
+
|
|
4470
|
+
.cartridge-toast.marketplace .image-content-container {
|
|
4471
|
+
display: flex;
|
|
4472
|
+
align-items: center;
|
|
4473
|
+
gap: 8px;
|
|
4474
|
+
}
|
|
4475
|
+
|
|
4476
|
+
.cartridge-toast.marketplace .image {
|
|
4477
|
+
display: flex;
|
|
4478
|
+
width: 34px;
|
|
4479
|
+
height: 34px;
|
|
4480
|
+
padding: 2px;
|
|
4481
|
+
justify-content: center;
|
|
4482
|
+
align-items: center;
|
|
4483
|
+
aspect-ratio: 1/1;
|
|
4484
|
+
border-radius: 2px;
|
|
4485
|
+
background: #000;
|
|
4486
|
+
flex-shrink: 0;
|
|
4487
|
+
}
|
|
4488
|
+
|
|
4489
|
+
.cartridge-toast.marketplace .content {
|
|
4490
|
+
display: flex;
|
|
4491
|
+
height: 40px;
|
|
4492
|
+
flex-direction: column;
|
|
4493
|
+
justify-content: center;
|
|
4494
|
+
align-items: flex-start;
|
|
4495
|
+
gap: 2px;
|
|
4496
|
+
}
|
|
4497
|
+
|
|
4498
|
+
.cartridge-toast.marketplace .title {
|
|
4499
|
+
color: #FFF;
|
|
4500
|
+
font-family: Inter;
|
|
4501
|
+
font-size: 14px;
|
|
4502
|
+
font-style: normal;
|
|
4503
|
+
font-weight: 500;
|
|
4504
|
+
line-height: 20px; /* 142.857% */
|
|
4505
|
+
}
|
|
4506
|
+
|
|
4507
|
+
.cartridge-toast.marketplace .item-name {
|
|
4508
|
+
color: #808080;
|
|
4509
|
+
text-align: center;
|
|
4510
|
+
font-family: Inter;
|
|
4511
|
+
font-size: 12px;
|
|
4512
|
+
font-style: normal;
|
|
4513
|
+
font-weight: 400;
|
|
4514
|
+
line-height: 16px; /* 133.333% */
|
|
4515
|
+
}
|
|
4516
|
+
|
|
4517
|
+
.cartridge-toast.marketplace .close-button-container {
|
|
4518
|
+
display: flex;
|
|
4519
|
+
padding: 4px;
|
|
4520
|
+
align-items: center;
|
|
4521
|
+
gap: 10px;
|
|
4522
|
+
}
|
|
4523
|
+
`, t.head.appendChild(e);
|
|
4524
|
+
}
|
|
4525
|
+
function fs(t) {
|
|
4526
|
+
const e = document.createElement("div");
|
|
4527
|
+
e.className = "cartridge-toast marketplace";
|
|
4528
|
+
const r = document.createElement("div");
|
|
4529
|
+
r.className = "image-content-container";
|
|
4530
|
+
const n = document.createElement("div");
|
|
4531
|
+
n.className = "image-container";
|
|
4532
|
+
const s = document.createElement("img");
|
|
4533
|
+
s.className = "image", s.src = dt(t.itemImage), s.alt = t.itemName, n.appendChild(s);
|
|
4534
|
+
const o = document.createElement("div");
|
|
4535
|
+
o.className = "content";
|
|
4536
|
+
const a = {
|
|
4537
|
+
purchased: "Purchased!",
|
|
4538
|
+
sold: "Sold!"
|
|
4539
|
+
}, i = document.createElement("p");
|
|
4540
|
+
i.className = "title", i.textContent = a[t.action];
|
|
4541
|
+
const l = document.createElement("p");
|
|
4542
|
+
l.className = "item-name", l.textContent = t.itemName, o.appendChild(i), o.appendChild(l), r.appendChild(n), r.appendChild(o);
|
|
4543
|
+
const c = document.createElement("div");
|
|
4544
|
+
c.className = "close-button-container";
|
|
4545
|
+
const d = ee(!1);
|
|
4546
|
+
return c.appendChild(d), e.appendChild(r), e.appendChild(c), e;
|
|
4547
|
+
}
|
|
4548
|
+
function us(t) {
|
|
4549
|
+
if (t.getElementById("cartridge-toast-quest-styles"))
|
|
4550
|
+
return;
|
|
4551
|
+
const e = t.createElement("style");
|
|
4552
|
+
e.id = "cartridge-toast-quest-styles", e.textContent = `
|
|
4553
|
+
/* Quest Toast */
|
|
4554
|
+
.cartridge-toast.quest {
|
|
4555
|
+
background-color: #161A17;
|
|
4556
|
+
border-radius: 8px;
|
|
4557
|
+
width: 360px;
|
|
4558
|
+
padding: 12px;
|
|
4559
|
+
padding-bottom: 16px;
|
|
4560
|
+
display: flex;
|
|
4561
|
+
align-items: center;
|
|
4562
|
+
justify-content: space-between;
|
|
4563
|
+
position: relative;
|
|
4564
|
+
overflow: hidden;
|
|
4565
|
+
min-height: 52px;
|
|
4566
|
+
box-sizing: border-box;
|
|
4567
|
+
}
|
|
4568
|
+
|
|
4569
|
+
.cartridge-toast.quest .image-content-container {
|
|
4570
|
+
display: flex;
|
|
4571
|
+
align-items: center;
|
|
4572
|
+
gap: 8px;
|
|
4573
|
+
flex: 1;
|
|
4574
|
+
}
|
|
4575
|
+
|
|
4576
|
+
.cartridge-toast.quest .image {
|
|
4577
|
+
width: 30px;
|
|
4578
|
+
height: 30px;
|
|
4579
|
+
aspect-ratio: 1/1;
|
|
4580
|
+
}
|
|
4581
|
+
|
|
4582
|
+
.cartridge-toast.quest .image-container {
|
|
4583
|
+
display: flex;
|
|
4584
|
+
padding: 5px;
|
|
4585
|
+
justify-content: center;
|
|
4586
|
+
align-items: center;
|
|
4587
|
+
gap: 10px;
|
|
4588
|
+
border-radius: 4px;
|
|
4589
|
+
background: #161A17;
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4592
|
+
.cartridge-toast.quest .content {
|
|
4593
|
+
display: flex;
|
|
4594
|
+
height: 40px;
|
|
4595
|
+
flex-direction: column;
|
|
4596
|
+
justify-content: center;
|
|
4597
|
+
align-items: flex-start;
|
|
4598
|
+
gap: 2px;
|
|
4599
|
+
}
|
|
4600
|
+
|
|
4601
|
+
.cartridge-toast.quest .title {
|
|
4602
|
+
color: #FFF;
|
|
4603
|
+
font-family: Inter;
|
|
4604
|
+
font-size: 14px;
|
|
4605
|
+
font-style: normal;
|
|
4606
|
+
font-weight: 500;
|
|
4607
|
+
line-height: 20px;
|
|
4608
|
+
}
|
|
4609
|
+
|
|
4610
|
+
.cartridge-toast.quest .subtitle {
|
|
4611
|
+
color: #808080;
|
|
4612
|
+
font-family: Inter;
|
|
4613
|
+
font-size: 12px;
|
|
4614
|
+
font-style: normal;
|
|
4615
|
+
font-weight: 400;
|
|
4616
|
+
line-height: 16px;
|
|
4617
|
+
}
|
|
4618
|
+
|
|
4619
|
+
.cartridge-toast.quest .xp-section-container {
|
|
4620
|
+
display: flex;
|
|
4621
|
+
padding: 10px;
|
|
4622
|
+
flex-direction: column;
|
|
4623
|
+
align-items: flex-start;
|
|
4624
|
+
gap: 10px;
|
|
4625
|
+
}
|
|
4626
|
+
|
|
4627
|
+
.cartridge-toast.quest .xp-section {
|
|
4628
|
+
display: flex;
|
|
4629
|
+
align-items: center;
|
|
4630
|
+
gap: 2px;
|
|
4631
|
+
align-self: stretch;
|
|
4632
|
+
}
|
|
4633
|
+
|
|
4634
|
+
.cartridge-toast.quest .xp-section .xp-icon {
|
|
4635
|
+
width: 20px;
|
|
4636
|
+
height: 20px;
|
|
4637
|
+
aspect-ratio: 1/1;
|
|
4638
|
+
}
|
|
4639
|
+
|
|
4640
|
+
.cartridge-toast.quest .xp-section .xp-amount {
|
|
4641
|
+
color: #FFF;
|
|
4642
|
+
/* Inter/Regular 14px */
|
|
4643
|
+
font-family: Inter;
|
|
4644
|
+
font-size: 14px;
|
|
4645
|
+
font-style: normal;
|
|
4646
|
+
font-weight: 400;
|
|
4647
|
+
line-height: 20px; /* 142.857% */
|
|
4648
|
+
}
|
|
4649
|
+
`, t.head.appendChild(e);
|
|
4650
|
+
}
|
|
4651
|
+
function ps(t) {
|
|
4652
|
+
const e = document.createElement("div");
|
|
4653
|
+
e.className = "cartridge-toast quest";
|
|
4654
|
+
const r = document.createElement("div");
|
|
4655
|
+
r.className = "image-content-container";
|
|
4656
|
+
const n = document.createElement("div");
|
|
4657
|
+
n.className = "image-container";
|
|
4658
|
+
const s = gs();
|
|
4659
|
+
s.className = "image", n.appendChild(s);
|
|
4660
|
+
const o = document.createElement("div");
|
|
4661
|
+
o.className = "content";
|
|
4662
|
+
const a = document.createElement("p");
|
|
4663
|
+
a.className = "title", a.textContent = t.title;
|
|
4664
|
+
const i = document.createElement("p");
|
|
4665
|
+
i.className = "subtitle", i.textContent = t.subtitle || "Earned!", o.appendChild(a), o.appendChild(i), r.appendChild(n), r.appendChild(o);
|
|
4666
|
+
const l = ee(!1);
|
|
4667
|
+
return e.appendChild(r), e.appendChild(l), e;
|
|
4668
|
+
}
|
|
4669
|
+
const gs = () => {
|
|
4670
|
+
const t = document.createElement("div"), e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
4671
|
+
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;
|
|
4672
|
+
}, ms = (t) => {
|
|
4673
|
+
const e = t.borderRadius ?? 8, r = !isFinite(t.duration) || t.duration <= 0, n = document.createElement("div");
|
|
4674
|
+
n.className = "cartridge-toast-progress-bar", n.style.position = "absolute", n.style.bottom = "0", n.style.left = "0", n.style.right = "0", n.style.height = "4px", n.style.overflow = "hidden", n.style.borderBottomLeftRadius = `${e}px`, n.style.borderBottomRightRadius = `${e}px`, n.style.backgroundColor = "rgba(255, 255, 255, 0.2)";
|
|
4675
|
+
const s = document.createElement("div");
|
|
4676
|
+
return s.className = "cartridge-toast-progress-bar-fill", s.style.position = "absolute", s.style.bottom = "0", s.style.left = "0", s.style.height = "100%", s.style.backgroundColor = "rgba(255, 255, 255, 0.8)", s.style.borderBottomLeftRadius = `${e}px`, r ? (s.style.width = "100%", s.style.transition = "none") : (s.style.width = "0%", s.style.transition = `width ${t.duration}ms linear`, requestAnimationFrame(() => {
|
|
4677
|
+
requestAnimationFrame(() => {
|
|
4678
|
+
s.style.width = "100%";
|
|
4679
|
+
});
|
|
4680
|
+
}), t.onComplete && setTimeout(() => {
|
|
4681
|
+
t.onComplete?.();
|
|
4682
|
+
}, t.duration)), n.appendChild(s), n;
|
|
4683
|
+
};
|
|
4684
|
+
function at(t, e, r, n) {
|
|
4685
|
+
const s = ms({
|
|
4686
|
+
duration: e,
|
|
4687
|
+
onComplete: r,
|
|
4688
|
+
borderRadius: n
|
|
4689
|
+
});
|
|
4690
|
+
t.appendChild(s);
|
|
4691
|
+
}
|
|
4692
|
+
function ws(t) {
|
|
4693
|
+
switch (t.variant) {
|
|
4694
|
+
case "error":
|
|
4695
|
+
return rs(t);
|
|
4696
|
+
case "transaction":
|
|
4697
|
+
return ss(t);
|
|
4698
|
+
case "network-switch":
|
|
4699
|
+
return as(t);
|
|
4700
|
+
case "achievement":
|
|
4701
|
+
return cs(t);
|
|
4702
|
+
case "quest":
|
|
4703
|
+
return ps(t);
|
|
4704
|
+
case "marketplace":
|
|
4705
|
+
return fs(t);
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
function ys(t, e) {
|
|
4709
|
+
switch (e) {
|
|
4710
|
+
case "error":
|
|
4711
|
+
ts(t);
|
|
4712
|
+
break;
|
|
4713
|
+
case "transaction":
|
|
4714
|
+
ns(t);
|
|
4715
|
+
break;
|
|
4716
|
+
case "network-switch":
|
|
4717
|
+
os(t);
|
|
4718
|
+
break;
|
|
4719
|
+
case "achievement":
|
|
4720
|
+
is(t);
|
|
4721
|
+
break;
|
|
4722
|
+
case "quest":
|
|
4723
|
+
us(t);
|
|
4724
|
+
break;
|
|
4725
|
+
case "marketplace":
|
|
4726
|
+
hs(t);
|
|
4727
|
+
break;
|
|
4728
|
+
}
|
|
4729
|
+
}
|
|
4730
|
+
function $e(t, e) {
|
|
4731
|
+
Jn(t), ys(t, e.variant);
|
|
4732
|
+
const r = e.position || Zn, n = Gn(t, r), s = ws(e), o = () => Xn(s);
|
|
4733
|
+
n.appendChild(s);
|
|
4734
|
+
const a = s.querySelector("#close-button");
|
|
4735
|
+
a && a.addEventListener("click", o);
|
|
4736
|
+
let i = null;
|
|
4737
|
+
const l = e.duration ?? qn, c = !isFinite(l) || l <= 0;
|
|
4738
|
+
if (e.variant !== "network-switch") {
|
|
4739
|
+
const d = e.variant === "error" || e.variant === "transaction" ? 8 : 4;
|
|
4740
|
+
c ? at(s, 1 / 0, () => {
|
|
4741
|
+
}, d) : at(s, l, o, d);
|
|
4742
|
+
} else c || (i = setTimeout(o, l));
|
|
4743
|
+
return () => {
|
|
4744
|
+
i && clearTimeout(i), o();
|
|
4745
|
+
};
|
|
4746
|
+
}
|
|
4747
|
+
let it = !1;
|
|
4748
|
+
function Dt() {
|
|
4749
|
+
it || typeof window > "u" || De() || (window.addEventListener("message", (t) => {
|
|
4750
|
+
if (t.data?.type === Ot && t.data?.options) {
|
|
4751
|
+
const e = document;
|
|
4752
|
+
e && $e(e, t.data.options);
|
|
4753
|
+
}
|
|
4754
|
+
}), it = !0);
|
|
4755
|
+
}
|
|
4756
|
+
function _s(t) {
|
|
4757
|
+
if (typeof window > "u" || typeof document > "u")
|
|
4758
|
+
return console.warn("Toast can only be used in a browser environment"), () => {
|
|
4759
|
+
};
|
|
4760
|
+
if (Dt(), De()) {
|
|
4761
|
+
const e = Kn();
|
|
4762
|
+
if (e)
|
|
4763
|
+
return $e(e, t);
|
|
4764
|
+
try {
|
|
4765
|
+
window.parent && window.parent.postMessage(
|
|
4766
|
+
{
|
|
4767
|
+
type: Ot,
|
|
4768
|
+
options: t
|
|
4769
|
+
},
|
|
4770
|
+
"*"
|
|
4771
|
+
// In production, specify target origin
|
|
4772
|
+
);
|
|
4773
|
+
} catch (r) {
|
|
4774
|
+
console.warn("Failed to send toast message to parent:", r);
|
|
4775
|
+
}
|
|
4776
|
+
return () => {
|
|
4777
|
+
};
|
|
4778
|
+
} else
|
|
4779
|
+
return $e(document, t);
|
|
3741
4780
|
}
|
|
3742
|
-
|
|
4781
|
+
typeof window < "u" && Dt();
|
|
4782
|
+
var bs = [
|
|
3743
4783
|
{
|
|
3744
4784
|
name: "Wrapped BTC",
|
|
3745
4785
|
symbol: "WBTC",
|
|
@@ -4321,28 +5361,28 @@ var Dn = [
|
|
|
4321
5361
|
total_supply: null,
|
|
4322
5362
|
logo_url: " https://imagedelivery.net/0xPAQaDtnQhBs8IzYRIlNg/f96b51e2-e978-42e2-c67a-e84159015000/logo"
|
|
4323
5363
|
}
|
|
4324
|
-
],
|
|
5364
|
+
], Ft = {
|
|
4325
5365
|
theme: {
|
|
4326
5366
|
name: "Cartridge",
|
|
4327
5367
|
icon: "icon.svg"
|
|
4328
5368
|
}
|
|
4329
|
-
},
|
|
4330
|
-
async function
|
|
5369
|
+
}, le = "https://static.cartridge.gg/presets";
|
|
5370
|
+
async function Fe() {
|
|
4331
5371
|
try {
|
|
4332
|
-
const t = await fetch(`${
|
|
5372
|
+
const t = await fetch(`${le}/index.json`);
|
|
4333
5373
|
if (!t.ok)
|
|
4334
5374
|
throw new Error(`Failed to load configs index: ${t.statusText}`);
|
|
4335
5375
|
return await t.json();
|
|
4336
5376
|
} catch (t) {
|
|
4337
|
-
return console.error("Error loading configs index:", t), { configs: [], baseUrl:
|
|
5377
|
+
return console.error("Error loading configs index:", t), { configs: [], baseUrl: le };
|
|
4338
5378
|
}
|
|
4339
5379
|
}
|
|
4340
|
-
async function
|
|
4341
|
-
return (await
|
|
5380
|
+
async function As() {
|
|
5381
|
+
return (await Fe()).configs;
|
|
4342
5382
|
}
|
|
4343
|
-
async function
|
|
5383
|
+
async function Is(t) {
|
|
4344
5384
|
try {
|
|
4345
|
-
const n = `${(await
|
|
5385
|
+
const n = `${(await Fe()).baseUrl || le}/${t}`, s = await fetch(`${n}/config.json`);
|
|
4346
5386
|
if (!s.ok)
|
|
4347
5387
|
throw new Error(
|
|
4348
5388
|
`Failed to load config ${t}: ${s.statusText}`
|
|
@@ -4350,37 +5390,37 @@ async function Yn(t) {
|
|
|
4350
5390
|
const o = await s.json();
|
|
4351
5391
|
if (o && o.theme) {
|
|
4352
5392
|
o.theme.icon && !o.theme.icon.startsWith("http") && (o.theme.icon = `${n}/${o.theme.icon}`), o.theme.cover && (typeof o.theme.cover == "string" ? o.theme.cover.startsWith("http") || (o.theme.cover = `${n}/${o.theme.cover}`) : (o.theme.cover.light && !o.theme.cover.light.startsWith("http") && (o.theme.cover.light = `${n}/${o.theme.cover.light}`), o.theme.cover.dark && !o.theme.cover.dark.startsWith("http") && (o.theme.cover.dark = `${n}/${o.theme.cover.dark}`)));
|
|
4353
|
-
const
|
|
4354
|
-
if (
|
|
4355
|
-
for (const l in
|
|
4356
|
-
if (
|
|
4357
|
-
for (const c in
|
|
4358
|
-
|
|
5393
|
+
const a = (i) => {
|
|
5394
|
+
if (i) {
|
|
5395
|
+
for (const l in i)
|
|
5396
|
+
if (i[l])
|
|
5397
|
+
for (const c in i[l])
|
|
5398
|
+
i[l][c] && !i[l][c].startsWith("http") && (i[l][c] = `${n}/${i[l][c]}`);
|
|
4359
5399
|
}
|
|
4360
5400
|
};
|
|
4361
|
-
if (o.theme.optimizedIcon &&
|
|
5401
|
+
if (o.theme.optimizedIcon && a(o.theme.optimizedIcon), o.theme.optimizedCover)
|
|
4362
5402
|
if (typeof o.theme.optimizedCover == "string")
|
|
4363
5403
|
o.theme.optimizedCover.startsWith("http") || (o.theme.optimizedCover = `${n}/${o.theme.optimizedCover}`);
|
|
4364
5404
|
else if (o.theme.optimizedCover.light || o.theme.optimizedCover.dark) {
|
|
4365
|
-
const
|
|
4366
|
-
|
|
5405
|
+
const i = o.theme.optimizedCover;
|
|
5406
|
+
i.light && a(i.light), i.dark && a(i.dark);
|
|
4367
5407
|
} else
|
|
4368
|
-
|
|
5408
|
+
a(o.theme.optimizedCover);
|
|
4369
5409
|
}
|
|
4370
5410
|
return o;
|
|
4371
5411
|
} catch (e) {
|
|
4372
5412
|
return console.error(`Error loading config ${t}:`, e), null;
|
|
4373
5413
|
}
|
|
4374
5414
|
}
|
|
4375
|
-
async function
|
|
4376
|
-
const t = await
|
|
5415
|
+
async function $s() {
|
|
5416
|
+
const t = await Fe(), e = t.configs, r = t.baseUrl || le, n = {};
|
|
4377
5417
|
return await Promise.all(
|
|
4378
5418
|
e.map(async (s) => {
|
|
4379
5419
|
try {
|
|
4380
5420
|
const o = await fetch(`${r}/${s}/config.json`);
|
|
4381
5421
|
if (o.ok) {
|
|
4382
|
-
const
|
|
4383
|
-
n[s] =
|
|
5422
|
+
const a = await o.json();
|
|
5423
|
+
n[s] = a;
|
|
4384
5424
|
}
|
|
4385
5425
|
} catch (o) {
|
|
4386
5426
|
console.error(`Error loading config ${s}:`, o);
|
|
@@ -4388,42 +5428,45 @@ async function Hn() {
|
|
|
4388
5428
|
})
|
|
4389
5429
|
), n;
|
|
4390
5430
|
}
|
|
4391
|
-
|
|
4392
|
-
var
|
|
5431
|
+
Ft.theme.icon = "https://static.cartridge.gg/presets/cartridge/icon.svg";
|
|
5432
|
+
var Ss = bs, Ls = Ft.theme;
|
|
4393
5433
|
export {
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
5434
|
+
Ps as ALL_AUTH_OPTIONS,
|
|
5435
|
+
Ts as AUTH_EXTERNAL_WALLETS,
|
|
5436
|
+
Jr as ArgentWallet,
|
|
5437
|
+
nn as BaseWallet,
|
|
5438
|
+
jn as BraavosWallet,
|
|
5439
|
+
Rs as EMBEDDED_WALLETS,
|
|
5440
|
+
Us as EXTERNAL_WALLETS,
|
|
5441
|
+
Ms as EXTRA_EXTERNAL_WALLETS,
|
|
5442
|
+
de as EthereumWalletBase,
|
|
5443
|
+
zs as FeeSource,
|
|
5444
|
+
Os as IMPLEMENTED_AUTH_OPTIONS,
|
|
5445
|
+
sn as MetaMaskWallet,
|
|
5446
|
+
A as NotReadyToConnect,
|
|
5447
|
+
Qn as PhantomEVMWallet,
|
|
5448
|
+
Fn as PhantomWallet,
|
|
5449
|
+
Hn as RabbyWallet,
|
|
4409
5450
|
Q as ResponseCodes,
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
5451
|
+
Wn as WalletBridge,
|
|
5452
|
+
ge as chainIdToPlatform,
|
|
5453
|
+
vs as default,
|
|
5454
|
+
Ls as defaultTheme,
|
|
5455
|
+
Ss as erc20Metadata,
|
|
5456
|
+
As as getAvailableConfigs,
|
|
5457
|
+
Fe as getConfigsIndex,
|
|
5458
|
+
Ds as humanizeString,
|
|
5459
|
+
jt as isMobile,
|
|
5460
|
+
$s as loadAllConfigs,
|
|
5461
|
+
Is as loadConfig,
|
|
5462
|
+
Es as lookupAddresses,
|
|
5463
|
+
ks as lookupUsernames,
|
|
5464
|
+
Fs as normalizeCalls,
|
|
5465
|
+
Yt as parseChainId,
|
|
5466
|
+
dt as sanitizeImageSrc,
|
|
5467
|
+
Ht as toArray,
|
|
5468
|
+
Qs as toSessionPolicies,
|
|
5469
|
+
Hs as toWasmPolicies,
|
|
5470
|
+
_s as toast
|
|
4428
5471
|
};
|
|
4429
5472
|
//# sourceMappingURL=index.js.map
|