@frak-labs/nexus-sdk 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-ALy_TEwJ.d.ts → FrakContext-CDVlUN75.d.ts} +9 -1
- package/dist/{client-DaEox5q4.d.cts → FrakContext-DBdWC7ls.d.cts} +9 -1
- package/dist/bundle/bundle.js +3 -3
- package/dist/{chunk-QRECYKIR.cjs → chunk-4CWA7EWX.cjs} +68 -48
- package/dist/{chunk-A3XYA7S7.cjs → chunk-4OJ2NPAS.cjs} +15 -15
- package/dist/chunk-F3F4BCGV.cjs +860 -0
- package/dist/chunk-H3T2GAEC.js +79 -0
- package/dist/{chunk-TIKEZMSD.js → chunk-P4QEVLVV.js} +1 -1
- package/dist/{chunk-6LI5YIZB.js → chunk-Q3SIIAX2.js} +60 -40
- package/dist/chunk-QSXZKZJA.cjs +79 -0
- package/dist/{chunk-2SDBW6QC.cjs → chunk-QYOOKB34.cjs} +20 -18
- package/dist/{chunk-54MUKMZK.js → chunk-VVF4NKYR.js} +3 -1
- package/dist/chunk-ZQSA2VQ4.js +860 -0
- package/dist/core/actions/index.cjs +5 -5
- package/dist/core/actions/index.d.cts +6 -21
- package/dist/core/actions/index.d.ts +6 -21
- package/dist/core/actions/index.js +4 -4
- package/dist/core/index.cjs +4 -4
- package/dist/core/index.d.cts +8 -7
- package/dist/core/index.d.ts +8 -7
- package/dist/core/index.js +3 -3
- package/dist/core/interactions/index.cjs +3 -3
- package/dist/core/interactions/index.js +2 -2
- package/dist/processReferral-BWSIamn2.d.cts +53 -0
- package/dist/processReferral-CFyGAENf.d.ts +53 -0
- package/dist/react/index.cjs +31 -28
- package/dist/react/index.d.cts +8 -3
- package/dist/react/index.d.ts +8 -3
- package/dist/react/index.js +10 -7
- package/package.json +2 -11
- package/dist/FrakContext-LbQht1ep.d.cts +0 -10
- package/dist/FrakContext-LbQht1ep.d.ts +0 -10
- package/dist/chunk-7K4L7VQC.js +0 -288
- package/dist/chunk-HY6YATLS.js +0 -53
- package/dist/chunk-UFJ7W6CQ.cjs +0 -53
- package/dist/chunk-YDZBXUC4.cjs +0 -288
- package/dist/sendTransaction-BOd-pvXr.d.ts +0 -30
- package/dist/sendTransaction-MhdJPTWd.d.cts +0 -30
|
@@ -0,0 +1,860 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkQSXZKZJAcjs = require('./chunk-QSXZKZJA.cjs');
|
|
6
|
+
|
|
7
|
+
// ../../node_modules/async-lz-string/libs/async-lz-string.js
|
|
8
|
+
var require_async_lz_string = _chunkQSXZKZJAcjs.__commonJS.call(void 0, {
|
|
9
|
+
"../../node_modules/async-lz-string/libs/async-lz-string.js"(exports, module) {
|
|
10
|
+
"use strict";
|
|
11
|
+
!function(t, e) {
|
|
12
|
+
if ("object" == typeof exports && "object" == typeof module) module.exports = e();
|
|
13
|
+
else if ("function" == typeof define && define.amd) define([], e);
|
|
14
|
+
else {
|
|
15
|
+
var n = e();
|
|
16
|
+
for (var r in n) ("object" == typeof exports ? exports : t)[r] = n[r];
|
|
17
|
+
}
|
|
18
|
+
}(exports, () => (() => {
|
|
19
|
+
"use strict";
|
|
20
|
+
var t = { 48: function(t2, e2, n) {
|
|
21
|
+
var r = this && this.__awaiter || function(t3, e3, n2, r2) {
|
|
22
|
+
return new (n2 || (n2 = Promise))(function(a2, o2) {
|
|
23
|
+
function i2(t4) {
|
|
24
|
+
try {
|
|
25
|
+
u2(r2.next(t4));
|
|
26
|
+
} catch (t5) {
|
|
27
|
+
o2(t5);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function s2(t4) {
|
|
31
|
+
try {
|
|
32
|
+
u2(r2.throw(t4));
|
|
33
|
+
} catch (t5) {
|
|
34
|
+
o2(t5);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function u2(t4) {
|
|
38
|
+
var e4;
|
|
39
|
+
t4.done ? a2(t4.value) : (e4 = t4.value, e4 instanceof n2 ? e4 : new n2(function(t5) {
|
|
40
|
+
t5(e4);
|
|
41
|
+
})).then(i2, s2);
|
|
42
|
+
}
|
|
43
|
+
u2((r2 = r2.apply(t3, e3 || [])).next());
|
|
44
|
+
});
|
|
45
|
+
}, a = this && this.__generator || function(t3, e3) {
|
|
46
|
+
var n2, r2, a2, o2, i2 = { label: 0, sent: function() {
|
|
47
|
+
if (1 & a2[0]) throw a2[1];
|
|
48
|
+
return a2[1];
|
|
49
|
+
}, trys: [], ops: [] };
|
|
50
|
+
return o2 = { next: s2(0), throw: s2(1), return: s2(2) }, "function" == typeof Symbol && (o2[Symbol.iterator] = function() {
|
|
51
|
+
return this;
|
|
52
|
+
}), o2;
|
|
53
|
+
function s2(s3) {
|
|
54
|
+
return function(u2) {
|
|
55
|
+
return function(s4) {
|
|
56
|
+
if (n2) throw new TypeError("Generator is already executing.");
|
|
57
|
+
for (; o2 && (o2 = 0, s4[0] && (i2 = 0)), i2; ) try {
|
|
58
|
+
if (n2 = 1, r2 && (a2 = 2 & s4[0] ? r2.return : s4[0] ? r2.throw || ((a2 = r2.return) && a2.call(r2), 0) : r2.next) && !(a2 = a2.call(r2, s4[1])).done) return a2;
|
|
59
|
+
switch (r2 = 0, a2 && (s4 = [2 & s4[0], a2.value]), s4[0]) {
|
|
60
|
+
case 0:
|
|
61
|
+
case 1:
|
|
62
|
+
a2 = s4;
|
|
63
|
+
break;
|
|
64
|
+
case 4:
|
|
65
|
+
return i2.label++, { value: s4[1], done: false };
|
|
66
|
+
case 5:
|
|
67
|
+
i2.label++, r2 = s4[1], s4 = [0];
|
|
68
|
+
continue;
|
|
69
|
+
case 7:
|
|
70
|
+
s4 = i2.ops.pop(), i2.trys.pop();
|
|
71
|
+
continue;
|
|
72
|
+
default:
|
|
73
|
+
if (!((a2 = (a2 = i2.trys).length > 0 && a2[a2.length - 1]) || 6 !== s4[0] && 2 !== s4[0])) {
|
|
74
|
+
i2 = 0;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (3 === s4[0] && (!a2 || s4[1] > a2[0] && s4[1] < a2[3])) {
|
|
78
|
+
i2.label = s4[1];
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
if (6 === s4[0] && i2.label < a2[1]) {
|
|
82
|
+
i2.label = a2[1], a2 = s4;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
if (a2 && i2.label < a2[2]) {
|
|
86
|
+
i2.label = a2[2], i2.ops.push(s4);
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
a2[2] && i2.ops.pop(), i2.trys.pop();
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
s4 = e3.call(t3, i2);
|
|
93
|
+
} catch (t4) {
|
|
94
|
+
s4 = [6, t4], r2 = 0;
|
|
95
|
+
} finally {
|
|
96
|
+
n2 = a2 = 0;
|
|
97
|
+
}
|
|
98
|
+
if (5 & s4[0]) throw s4[1];
|
|
99
|
+
return { value: s4[0] ? s4[1] : void 0, done: true };
|
|
100
|
+
}([s3, u2]);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
Object.defineProperty(e2, "__esModule", { value: true }), e2.decompressFromUTF16 = e2.compressToUTF16 = e2.decompressFromBase64 = e2.compressToBase64 = void 0;
|
|
105
|
+
var o = n(304), i = n(134), s = new o.CompressorImpl(), u = new i.DecompressorImpl(), c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", l = {};
|
|
106
|
+
e2.compressToBase64 = function(t3) {
|
|
107
|
+
return r(this, void 0, void 0, function() {
|
|
108
|
+
var e3;
|
|
109
|
+
return a(this, function(n2) {
|
|
110
|
+
switch (n2.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
return null === t3 ? [2, ""] : [4, s.compress(t3, 6, function(t4) {
|
|
113
|
+
return c.charAt(t4);
|
|
114
|
+
})];
|
|
115
|
+
case 1:
|
|
116
|
+
switch ((e3 = n2.sent()).length % 4) {
|
|
117
|
+
default:
|
|
118
|
+
case 0:
|
|
119
|
+
return [2, e3];
|
|
120
|
+
case 1:
|
|
121
|
+
return [2, e3 + "==="];
|
|
122
|
+
case 2:
|
|
123
|
+
return [2, e3 + "=="];
|
|
124
|
+
case 3:
|
|
125
|
+
return [2, e3 + "="];
|
|
126
|
+
}
|
|
127
|
+
return [2];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}, e2.decompressFromBase64 = function(t3) {
|
|
132
|
+
return r(this, void 0, void 0, function() {
|
|
133
|
+
return a(this, function(e3) {
|
|
134
|
+
switch (e3.label) {
|
|
135
|
+
case 0:
|
|
136
|
+
return null === t3 ? [2, ""] : "" === t3 ? [2, null] : [4, u.decompress(t3.length, 32, function(e4) {
|
|
137
|
+
return function(t4, e5) {
|
|
138
|
+
if (!l[t4]) {
|
|
139
|
+
l[t4] = {};
|
|
140
|
+
for (var n2 = 0; n2 < t4.length; n2++) l[t4][t4.charAt(n2)] = n2;
|
|
141
|
+
}
|
|
142
|
+
return l[t4][e5];
|
|
143
|
+
}(c, t3.charAt(e4));
|
|
144
|
+
})];
|
|
145
|
+
case 1:
|
|
146
|
+
return [2, e3.sent()];
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}, e2.compressToUTF16 = function(t3) {
|
|
151
|
+
return r(this, void 0, void 0, function() {
|
|
152
|
+
return a(this, function(e3) {
|
|
153
|
+
switch (e3.label) {
|
|
154
|
+
case 0:
|
|
155
|
+
return null === t3 ? [2, ""] : [4, s.compress(t3, 15, function(t4) {
|
|
156
|
+
return String.fromCharCode(t4 + 32);
|
|
157
|
+
})];
|
|
158
|
+
case 1:
|
|
159
|
+
return [2, e3.sent() + " "];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}, e2.decompressFromUTF16 = function(t3) {
|
|
164
|
+
return r(this, void 0, void 0, function() {
|
|
165
|
+
return a(this, function(e3) {
|
|
166
|
+
switch (e3.label) {
|
|
167
|
+
case 0:
|
|
168
|
+
return null === t3 ? [2, ""] : "" === t3 ? [2, null] : [4, u.decompress(t3.length, 16384, function(e4) {
|
|
169
|
+
return t3.charCodeAt(e4) - 32;
|
|
170
|
+
})];
|
|
171
|
+
case 1:
|
|
172
|
+
return [2, e3.sent()];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
}, 304: function(t2, e2, n) {
|
|
178
|
+
var r = this && this.__awaiter || function(t3, e3, n2, r2) {
|
|
179
|
+
return new (n2 || (n2 = Promise))(function(a2, o2) {
|
|
180
|
+
function i2(t4) {
|
|
181
|
+
try {
|
|
182
|
+
u(r2.next(t4));
|
|
183
|
+
} catch (t5) {
|
|
184
|
+
o2(t5);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function s2(t4) {
|
|
188
|
+
try {
|
|
189
|
+
u(r2.throw(t4));
|
|
190
|
+
} catch (t5) {
|
|
191
|
+
o2(t5);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function u(t4) {
|
|
195
|
+
var e4;
|
|
196
|
+
t4.done ? a2(t4.value) : (e4 = t4.value, e4 instanceof n2 ? e4 : new n2(function(t5) {
|
|
197
|
+
t5(e4);
|
|
198
|
+
})).then(i2, s2);
|
|
199
|
+
}
|
|
200
|
+
u((r2 = r2.apply(t3, e3 || [])).next());
|
|
201
|
+
});
|
|
202
|
+
}, a = this && this.__generator || function(t3, e3) {
|
|
203
|
+
var n2, r2, a2, o2, i2 = { label: 0, sent: function() {
|
|
204
|
+
if (1 & a2[0]) throw a2[1];
|
|
205
|
+
return a2[1];
|
|
206
|
+
}, trys: [], ops: [] };
|
|
207
|
+
return o2 = { next: s2(0), throw: s2(1), return: s2(2) }, "function" == typeof Symbol && (o2[Symbol.iterator] = function() {
|
|
208
|
+
return this;
|
|
209
|
+
}), o2;
|
|
210
|
+
function s2(s3) {
|
|
211
|
+
return function(u) {
|
|
212
|
+
return function(s4) {
|
|
213
|
+
if (n2) throw new TypeError("Generator is already executing.");
|
|
214
|
+
for (; o2 && (o2 = 0, s4[0] && (i2 = 0)), i2; ) try {
|
|
215
|
+
if (n2 = 1, r2 && (a2 = 2 & s4[0] ? r2.return : s4[0] ? r2.throw || ((a2 = r2.return) && a2.call(r2), 0) : r2.next) && !(a2 = a2.call(r2, s4[1])).done) return a2;
|
|
216
|
+
switch (r2 = 0, a2 && (s4 = [2 & s4[0], a2.value]), s4[0]) {
|
|
217
|
+
case 0:
|
|
218
|
+
case 1:
|
|
219
|
+
a2 = s4;
|
|
220
|
+
break;
|
|
221
|
+
case 4:
|
|
222
|
+
return i2.label++, { value: s4[1], done: false };
|
|
223
|
+
case 5:
|
|
224
|
+
i2.label++, r2 = s4[1], s4 = [0];
|
|
225
|
+
continue;
|
|
226
|
+
case 7:
|
|
227
|
+
s4 = i2.ops.pop(), i2.trys.pop();
|
|
228
|
+
continue;
|
|
229
|
+
default:
|
|
230
|
+
if (!((a2 = (a2 = i2.trys).length > 0 && a2[a2.length - 1]) || 6 !== s4[0] && 2 !== s4[0])) {
|
|
231
|
+
i2 = 0;
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
if (3 === s4[0] && (!a2 || s4[1] > a2[0] && s4[1] < a2[3])) {
|
|
235
|
+
i2.label = s4[1];
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
if (6 === s4[0] && i2.label < a2[1]) {
|
|
239
|
+
i2.label = a2[1], a2 = s4;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
if (a2 && i2.label < a2[2]) {
|
|
243
|
+
i2.label = a2[2], i2.ops.push(s4);
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
a2[2] && i2.ops.pop(), i2.trys.pop();
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
s4 = e3.call(t3, i2);
|
|
250
|
+
} catch (t4) {
|
|
251
|
+
s4 = [6, t4], r2 = 0;
|
|
252
|
+
} finally {
|
|
253
|
+
n2 = a2 = 0;
|
|
254
|
+
}
|
|
255
|
+
if (5 & s4[0]) throw s4[1];
|
|
256
|
+
return { value: s4[0] ? s4[1] : void 0, done: true };
|
|
257
|
+
}([s3, u]);
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
Object.defineProperty(e2, "__esModule", { value: true }), e2.CompressorImpl = void 0;
|
|
262
|
+
var o = n(658), i = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], s = function() {
|
|
263
|
+
function t3() {
|
|
264
|
+
}
|
|
265
|
+
return t3.writeValueToData = function(t4, e3, n2, r2, a2) {
|
|
266
|
+
if (n2 % 4 != 0 || t4.dataPosition + n2 > r2 - 1) for (var o2 = 0; o2 < n2; o2++) t4.dataVal = t4.dataVal << 1 | 1 & e3, t4.dataPosition == r2 - 1 ? (t4.dataPosition = 0, t4.data.push(a2(t4.dataVal)), t4.dataVal = 0) : t4.dataPosition++, e3 >>= 1;
|
|
267
|
+
else t4.dataVal <<= n2, t4.dataVal |= function(t5, e4) {
|
|
268
|
+
for (var n3 = 0, r3 = 0; r3 < e4; ++r3) n3 <<= 4, n3 |= i[15 & t5], t5 >>= 4;
|
|
269
|
+
return n3;
|
|
270
|
+
}(e3, n2 / 4), t4.dataPosition += n2;
|
|
271
|
+
}, t3.writeWToDataVal = function(e3, n2, r2) {
|
|
272
|
+
e3.dictionaryToCreate.has(e3.w) ? (e3.w.charCodeAt(0) < 256 ? (t3.writeValueToData(e3, 0, e3.numBits, n2, r2), t3.writeValueToData(e3, e3.w.charCodeAt(0), 8, n2, r2)) : (t3.writeValueToData(e3, 1, e3.numBits, n2, r2), t3.writeValueToData(e3, e3.w.charCodeAt(0), 16, n2, r2)), e3.enlargeIn--, 0 == e3.enlargeIn && (e3.enlargeIn = Math.pow(2, e3.numBits), e3.numBits++), e3.dictionaryToCreate.delete(e3.w)) : t3.writeValueToData(e3, e3.dictionary.get(e3.w), e3.numBits, n2, r2), e3.enlargeIn--, 0 == e3.enlargeIn && (e3.enlargeIn = Math.pow(2, e3.numBits), e3.numBits++);
|
|
273
|
+
}, t3.loopIteration = function(t4, e3, n2, r2, a2) {
|
|
274
|
+
var o2 = t4.charAt(e3);
|
|
275
|
+
a2.dictionary.has(o2) || (a2.dictionary.set(o2, a2.dictSize++), a2.dictionaryToCreate.set(o2, true));
|
|
276
|
+
var i2 = a2.w + o2;
|
|
277
|
+
a2.dictionary.has(i2) ? a2.w = i2 : (this.writeWToDataVal(a2, n2, r2), a2.dictionary.set(i2, a2.dictSize++), a2.w = String(o2));
|
|
278
|
+
}, t3.prototype.compress = function(e3, n2, i2) {
|
|
279
|
+
var s2 = this;
|
|
280
|
+
return new Promise(function(u) {
|
|
281
|
+
return r(s2, void 0, void 0, function() {
|
|
282
|
+
var r2, s3;
|
|
283
|
+
return a(this, function(a2) {
|
|
284
|
+
switch (a2.label) {
|
|
285
|
+
case 0:
|
|
286
|
+
if (null == e3) return u(""), [2];
|
|
287
|
+
r2 = { data: [], dataPosition: 0, dataVal: 0, dictionary: /* @__PURE__ */ new Map(), dictionaryToCreate: /* @__PURE__ */ new Map(), dictSize: 3, enlargeIn: 2, numBits: 2, w: "" }, s3 = 0, a2.label = 1;
|
|
288
|
+
case 1:
|
|
289
|
+
return s3 < e3.length ? (t3.loopIteration(e3, s3, n2, i2, r2), s3 % 1e4 != 0 ? [3, 3] : [4, (0, o.wait)()]) : [3, 4];
|
|
290
|
+
case 2:
|
|
291
|
+
a2.sent(), a2.label = 3;
|
|
292
|
+
case 3:
|
|
293
|
+
return s3 += 1, [3, 1];
|
|
294
|
+
case 4:
|
|
295
|
+
return "" !== r2.w && t3.writeWToDataVal(r2, n2, i2), t3.writeValueToData(r2, 2, r2.numBits, n2, i2), r2.dataVal <<= n2 - r2.dataPosition, r2.data.push(i2(r2.dataVal)), u(r2.data.join("")), [2];
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
}, t3;
|
|
301
|
+
}();
|
|
302
|
+
e2.CompressorImpl = s;
|
|
303
|
+
}, 134: function(t2, e2, n) {
|
|
304
|
+
var r = this && this.__awaiter || function(t3, e3, n2, r2) {
|
|
305
|
+
return new (n2 || (n2 = Promise))(function(a2, o2) {
|
|
306
|
+
function i2(t4) {
|
|
307
|
+
try {
|
|
308
|
+
u(r2.next(t4));
|
|
309
|
+
} catch (t5) {
|
|
310
|
+
o2(t5);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function s(t4) {
|
|
314
|
+
try {
|
|
315
|
+
u(r2.throw(t4));
|
|
316
|
+
} catch (t5) {
|
|
317
|
+
o2(t5);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function u(t4) {
|
|
321
|
+
var e4;
|
|
322
|
+
t4.done ? a2(t4.value) : (e4 = t4.value, e4 instanceof n2 ? e4 : new n2(function(t5) {
|
|
323
|
+
t5(e4);
|
|
324
|
+
})).then(i2, s);
|
|
325
|
+
}
|
|
326
|
+
u((r2 = r2.apply(t3, e3 || [])).next());
|
|
327
|
+
});
|
|
328
|
+
}, a = this && this.__generator || function(t3, e3) {
|
|
329
|
+
var n2, r2, a2, o2, i2 = { label: 0, sent: function() {
|
|
330
|
+
if (1 & a2[0]) throw a2[1];
|
|
331
|
+
return a2[1];
|
|
332
|
+
}, trys: [], ops: [] };
|
|
333
|
+
return o2 = { next: s(0), throw: s(1), return: s(2) }, "function" == typeof Symbol && (o2[Symbol.iterator] = function() {
|
|
334
|
+
return this;
|
|
335
|
+
}), o2;
|
|
336
|
+
function s(s2) {
|
|
337
|
+
return function(u) {
|
|
338
|
+
return function(s3) {
|
|
339
|
+
if (n2) throw new TypeError("Generator is already executing.");
|
|
340
|
+
for (; o2 && (o2 = 0, s3[0] && (i2 = 0)), i2; ) try {
|
|
341
|
+
if (n2 = 1, r2 && (a2 = 2 & s3[0] ? r2.return : s3[0] ? r2.throw || ((a2 = r2.return) && a2.call(r2), 0) : r2.next) && !(a2 = a2.call(r2, s3[1])).done) return a2;
|
|
342
|
+
switch (r2 = 0, a2 && (s3 = [2 & s3[0], a2.value]), s3[0]) {
|
|
343
|
+
case 0:
|
|
344
|
+
case 1:
|
|
345
|
+
a2 = s3;
|
|
346
|
+
break;
|
|
347
|
+
case 4:
|
|
348
|
+
return i2.label++, { value: s3[1], done: false };
|
|
349
|
+
case 5:
|
|
350
|
+
i2.label++, r2 = s3[1], s3 = [0];
|
|
351
|
+
continue;
|
|
352
|
+
case 7:
|
|
353
|
+
s3 = i2.ops.pop(), i2.trys.pop();
|
|
354
|
+
continue;
|
|
355
|
+
default:
|
|
356
|
+
if (!((a2 = (a2 = i2.trys).length > 0 && a2[a2.length - 1]) || 6 !== s3[0] && 2 !== s3[0])) {
|
|
357
|
+
i2 = 0;
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
if (3 === s3[0] && (!a2 || s3[1] > a2[0] && s3[1] < a2[3])) {
|
|
361
|
+
i2.label = s3[1];
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
if (6 === s3[0] && i2.label < a2[1]) {
|
|
365
|
+
i2.label = a2[1], a2 = s3;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
if (a2 && i2.label < a2[2]) {
|
|
369
|
+
i2.label = a2[2], i2.ops.push(s3);
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
a2[2] && i2.ops.pop(), i2.trys.pop();
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
s3 = e3.call(t3, i2);
|
|
376
|
+
} catch (t4) {
|
|
377
|
+
s3 = [6, t4], r2 = 0;
|
|
378
|
+
} finally {
|
|
379
|
+
n2 = a2 = 0;
|
|
380
|
+
}
|
|
381
|
+
if (5 & s3[0]) throw s3[1];
|
|
382
|
+
return { value: s3[0] ? s3[1] : void 0, done: true };
|
|
383
|
+
}([s2, u]);
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
Object.defineProperty(e2, "__esModule", { value: true }), e2.DecompressorImpl = void 0;
|
|
388
|
+
var o = n(658), i = function() {
|
|
389
|
+
function t3() {
|
|
390
|
+
}
|
|
391
|
+
return t3.prototype.decompress = function(t4, e3, n2) {
|
|
392
|
+
var i2 = this;
|
|
393
|
+
return new Promise(function(s) {
|
|
394
|
+
return r(i2, void 0, void 0, function() {
|
|
395
|
+
var r2, i3, u;
|
|
396
|
+
return a(this, function(a2) {
|
|
397
|
+
switch (a2.label) {
|
|
398
|
+
case 0:
|
|
399
|
+
for (r2 = { bits: 0, c: null, dataIndex: 1, dataPosition: e3, dataVal: n2(0), dictionary: /* @__PURE__ */ new Map(), dictSize: 4, enlargeIn: 4, entry: "", maxPower: Math.pow(2, 2), numBits: 3, power: 1, resb: null, result: [], w: null }, i3 = 0; i3 < 3; i3 += 1) r2.dictionary.set(i3, i3);
|
|
400
|
+
for (; r2.power != r2.maxPower; ) r2.resb = r2.dataVal & r2.dataPosition, r2.dataPosition >>= 1, 0 == r2.dataPosition && (r2.dataPosition = e3, r2.dataVal = n2(r2.dataIndex++)), r2.bits |= (r2.resb > 0 ? 1 : 0) * r2.power, r2.power <<= 1;
|
|
401
|
+
switch (r2.bits) {
|
|
402
|
+
case 0:
|
|
403
|
+
for (r2.bits = 0, r2.maxPower = Math.pow(2, 8), r2.power = 1; r2.power != r2.maxPower; ) r2.resb = r2.dataVal & r2.dataPosition, r2.dataPosition >>= 1, 0 == r2.dataPosition && (r2.dataPosition = e3, r2.dataVal = n2(r2.dataIndex++)), r2.bits |= (r2.resb > 0 ? 1 : 0) * r2.power, r2.power <<= 1;
|
|
404
|
+
r2.c = String.fromCharCode(r2.bits);
|
|
405
|
+
break;
|
|
406
|
+
case 1:
|
|
407
|
+
for (r2.bits = 0, r2.maxPower = Math.pow(2, 16), r2.power = 1; r2.power !== r2.maxPower; ) r2.resb = r2.dataVal & r2.dataPosition, r2.dataPosition >>= 1, 0 === r2.dataPosition && (r2.dataPosition = e3, r2.dataVal = n2(r2.dataIndex++)), r2.bits |= (r2.resb > 0 ? 1 : 0) * r2.power, r2.power <<= 1;
|
|
408
|
+
r2.c = String.fromCharCode(r2.bits);
|
|
409
|
+
break;
|
|
410
|
+
case 2:
|
|
411
|
+
return s(""), [2];
|
|
412
|
+
}
|
|
413
|
+
r2.dictionary[3] = r2.c, r2.w = r2.c, r2.result.push(r2.c), u = 1, a2.label = 1;
|
|
414
|
+
case 1:
|
|
415
|
+
return u % 2e4 != 0 ? [3, 3] : [4, (0, o.wait)()];
|
|
416
|
+
case 2:
|
|
417
|
+
a2.sent(), a2.label = 3;
|
|
418
|
+
case 3:
|
|
419
|
+
if (r2.dataIndex > t4) return s(""), [2];
|
|
420
|
+
for (r2.bits = 0, r2.maxPower = Math.pow(2, r2.numBits), r2.power = 1; r2.power != r2.maxPower; ) r2.resb = r2.dataVal & r2.dataPosition, r2.dataPosition >>= 1, 0 == r2.dataPosition && (r2.dataPosition = e3, r2.dataVal = n2(r2.dataIndex++)), r2.bits |= (r2.resb > 0 ? 1 : 0) * r2.power, r2.power <<= 1;
|
|
421
|
+
switch (r2.c = r2.bits) {
|
|
422
|
+
case 0:
|
|
423
|
+
for (r2.bits = 0, r2.maxPower = Math.pow(2, 8), r2.power = 1; r2.power !== r2.maxPower; ) r2.resb = r2.dataVal & r2.dataPosition, r2.dataPosition >>= 1, 0 == r2.dataPosition && (r2.dataPosition = e3, r2.dataVal = n2(r2.dataIndex++)), r2.bits |= (r2.resb > 0 ? 1 : 0) * r2.power, r2.power <<= 1;
|
|
424
|
+
r2.dictionary[r2.dictSize++] = String.fromCharCode(r2.bits), r2.c = r2.dictSize - 1, r2.enlargeIn--;
|
|
425
|
+
break;
|
|
426
|
+
case 1:
|
|
427
|
+
for (r2.bits = 0, r2.maxPower = Math.pow(2, 16), r2.power = 1; r2.power !== r2.maxPower; ) r2.resb = r2.dataVal & r2.dataPosition, r2.dataPosition >>= 1, 0 == r2.dataPosition && (r2.dataPosition = e3, r2.dataVal = n2(r2.dataIndex++)), r2.bits |= (r2.resb > 0 ? 1 : 0) * r2.power, r2.power <<= 1;
|
|
428
|
+
r2.dictionary[r2.dictSize++] = String.fromCharCode(r2.bits), r2.c = r2.dictSize - 1, r2.enlargeIn--;
|
|
429
|
+
break;
|
|
430
|
+
case 2:
|
|
431
|
+
return s(r2.result.join("")), [2];
|
|
432
|
+
}
|
|
433
|
+
if (0 == r2.enlargeIn && (r2.enlargeIn = Math.pow(2, r2.numBits), r2.numBits++), r2.dictionary[r2.c]) r2.entry = r2.dictionary[r2.c];
|
|
434
|
+
else {
|
|
435
|
+
if (r2.c !== r2.dictSize) return s(null), [2];
|
|
436
|
+
r2.entry = r2.w + r2.w.charAt(0);
|
|
437
|
+
}
|
|
438
|
+
return r2.result.push(r2.entry), r2.dictionary[r2.dictSize++] = r2.w + r2.entry.charAt(0), r2.enlargeIn--, r2.w = r2.entry, 0 == r2.enlargeIn && (r2.enlargeIn = Math.pow(2, r2.numBits), r2.numBits++), u++, [3, 1];
|
|
439
|
+
case 4:
|
|
440
|
+
return [2];
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
}, t3;
|
|
446
|
+
}();
|
|
447
|
+
e2.DecompressorImpl = i;
|
|
448
|
+
}, 658: function(t2, e2) {
|
|
449
|
+
var n = this && this.__awaiter || function(t3, e3, n2, r2) {
|
|
450
|
+
return new (n2 || (n2 = Promise))(function(a, o) {
|
|
451
|
+
function i(t4) {
|
|
452
|
+
try {
|
|
453
|
+
u(r2.next(t4));
|
|
454
|
+
} catch (t5) {
|
|
455
|
+
o(t5);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
function s(t4) {
|
|
459
|
+
try {
|
|
460
|
+
u(r2.throw(t4));
|
|
461
|
+
} catch (t5) {
|
|
462
|
+
o(t5);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
function u(t4) {
|
|
466
|
+
var e4;
|
|
467
|
+
t4.done ? a(t4.value) : (e4 = t4.value, e4 instanceof n2 ? e4 : new n2(function(t5) {
|
|
468
|
+
t5(e4);
|
|
469
|
+
})).then(i, s);
|
|
470
|
+
}
|
|
471
|
+
u((r2 = r2.apply(t3, e3 || [])).next());
|
|
472
|
+
});
|
|
473
|
+
}, r = this && this.__generator || function(t3, e3) {
|
|
474
|
+
var n2, r2, a, o, i = { label: 0, sent: function() {
|
|
475
|
+
if (1 & a[0]) throw a[1];
|
|
476
|
+
return a[1];
|
|
477
|
+
}, trys: [], ops: [] };
|
|
478
|
+
return o = { next: s(0), throw: s(1), return: s(2) }, "function" == typeof Symbol && (o[Symbol.iterator] = function() {
|
|
479
|
+
return this;
|
|
480
|
+
}), o;
|
|
481
|
+
function s(s2) {
|
|
482
|
+
return function(u) {
|
|
483
|
+
return function(s3) {
|
|
484
|
+
if (n2) throw new TypeError("Generator is already executing.");
|
|
485
|
+
for (; o && (o = 0, s3[0] && (i = 0)), i; ) try {
|
|
486
|
+
if (n2 = 1, r2 && (a = 2 & s3[0] ? r2.return : s3[0] ? r2.throw || ((a = r2.return) && a.call(r2), 0) : r2.next) && !(a = a.call(r2, s3[1])).done) return a;
|
|
487
|
+
switch (r2 = 0, a && (s3 = [2 & s3[0], a.value]), s3[0]) {
|
|
488
|
+
case 0:
|
|
489
|
+
case 1:
|
|
490
|
+
a = s3;
|
|
491
|
+
break;
|
|
492
|
+
case 4:
|
|
493
|
+
return i.label++, { value: s3[1], done: false };
|
|
494
|
+
case 5:
|
|
495
|
+
i.label++, r2 = s3[1], s3 = [0];
|
|
496
|
+
continue;
|
|
497
|
+
case 7:
|
|
498
|
+
s3 = i.ops.pop(), i.trys.pop();
|
|
499
|
+
continue;
|
|
500
|
+
default:
|
|
501
|
+
if (!((a = (a = i.trys).length > 0 && a[a.length - 1]) || 6 !== s3[0] && 2 !== s3[0])) {
|
|
502
|
+
i = 0;
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
if (3 === s3[0] && (!a || s3[1] > a[0] && s3[1] < a[3])) {
|
|
506
|
+
i.label = s3[1];
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
if (6 === s3[0] && i.label < a[1]) {
|
|
510
|
+
i.label = a[1], a = s3;
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
if (a && i.label < a[2]) {
|
|
514
|
+
i.label = a[2], i.ops.push(s3);
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
a[2] && i.ops.pop(), i.trys.pop();
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
s3 = e3.call(t3, i);
|
|
521
|
+
} catch (t4) {
|
|
522
|
+
s3 = [6, t4], r2 = 0;
|
|
523
|
+
} finally {
|
|
524
|
+
n2 = a = 0;
|
|
525
|
+
}
|
|
526
|
+
if (5 & s3[0]) throw s3[1];
|
|
527
|
+
return { value: s3[0] ? s3[1] : void 0, done: true };
|
|
528
|
+
}([s2, u]);
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
Object.defineProperty(e2, "__esModule", { value: true }), e2.wait = void 0, e2.wait = function() {
|
|
533
|
+
return n(this, void 0, void 0, function() {
|
|
534
|
+
return r(this, function(t3) {
|
|
535
|
+
return [2, new Promise(function(t4) {
|
|
536
|
+
setTimeout(t4, 0);
|
|
537
|
+
})];
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
};
|
|
541
|
+
} }, e = {};
|
|
542
|
+
return function n(r) {
|
|
543
|
+
var a = e[r];
|
|
544
|
+
if (void 0 !== a) return a.exports;
|
|
545
|
+
var o = e[r] = { exports: {} };
|
|
546
|
+
return t[r].call(o.exports, o, o.exports, n), o.exports;
|
|
547
|
+
}(48);
|
|
548
|
+
})());
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
// src/core/types/rpc/error.ts
|
|
553
|
+
var FrakRpcError = class extends Error {
|
|
554
|
+
constructor(code, message, data) {
|
|
555
|
+
super(message);
|
|
556
|
+
this.code = code;
|
|
557
|
+
this.data = data;
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
var InternalError = class extends FrakRpcError {
|
|
561
|
+
constructor(message) {
|
|
562
|
+
super(RpcErrorCodes.internalError, message);
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
var ClientNotFound = class extends FrakRpcError {
|
|
566
|
+
constructor() {
|
|
567
|
+
super(RpcErrorCodes.clientNotConnected, "Client not found");
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
var RpcErrorCodes = {
|
|
571
|
+
// Standard JSON-RPC 2.0 errors
|
|
572
|
+
parseError: -32700,
|
|
573
|
+
invalidRequest: -32600,
|
|
574
|
+
methodNotFound: -32601,
|
|
575
|
+
invalidParams: -32602,
|
|
576
|
+
internalError: -32603,
|
|
577
|
+
serverError: -32e3,
|
|
578
|
+
// Frak specific errors (from -32001 to -32099)
|
|
579
|
+
clientNotConnected: -32001,
|
|
580
|
+
configError: -32002,
|
|
581
|
+
corruptedResponse: -32003,
|
|
582
|
+
clientAborted: -32004,
|
|
583
|
+
walletNotConnected: -32005,
|
|
584
|
+
serverErrorForInteractionDelegation: -32006
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
// src/core/utils/Deferred.ts
|
|
588
|
+
var Deferred = class {
|
|
589
|
+
constructor() {
|
|
590
|
+
_chunkQSXZKZJAcjs.__publicField.call(void 0, this, "_promise");
|
|
591
|
+
_chunkQSXZKZJAcjs.__publicField.call(void 0, this, "_resolve");
|
|
592
|
+
_chunkQSXZKZJAcjs.__publicField.call(void 0, this, "_reject");
|
|
593
|
+
_chunkQSXZKZJAcjs.__publicField.call(void 0, this, "resolve", (value) => {
|
|
594
|
+
_optionalChain([this, 'access', _2 => _2._resolve, 'optionalCall', _3 => _3(value)]);
|
|
595
|
+
});
|
|
596
|
+
_chunkQSXZKZJAcjs.__publicField.call(void 0, this, "reject", (reason) => {
|
|
597
|
+
_optionalChain([this, 'access', _4 => _4._reject, 'optionalCall', _5 => _5(reason)]);
|
|
598
|
+
});
|
|
599
|
+
this._promise = new Promise((resolve, reject) => {
|
|
600
|
+
this._resolve = resolve;
|
|
601
|
+
this._reject = reject;
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
get promise() {
|
|
605
|
+
return this._promise;
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// src/core/utils/compression/compress.ts
|
|
610
|
+
var import_async_lz_string = _chunkQSXZKZJAcjs.__toESM.call(void 0, require_async_lz_string(), 1);
|
|
611
|
+
var _jssha256 = require('js-sha256');
|
|
612
|
+
async function hashAndCompressData(data) {
|
|
613
|
+
const validationHash = _jssha256.sha256.call(void 0, JSON.stringify(data));
|
|
614
|
+
const hashProtectedData = {
|
|
615
|
+
...data,
|
|
616
|
+
validationHash
|
|
617
|
+
};
|
|
618
|
+
const compressed = await compressJson(hashProtectedData);
|
|
619
|
+
const compressedHash = _jssha256.sha256.call(void 0, compressed);
|
|
620
|
+
return {
|
|
621
|
+
compressed,
|
|
622
|
+
compressedHash
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
async function compressJson(data) {
|
|
626
|
+
return (0, import_async_lz_string.compressToBase64)(JSON.stringify(data));
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// src/core/utils/compression/decompress.ts
|
|
630
|
+
var import_async_lz_string2 = _chunkQSXZKZJAcjs.__toESM.call(void 0, require_async_lz_string(), 1);
|
|
631
|
+
|
|
632
|
+
async function decompressDataAndCheckHash(compressedData) {
|
|
633
|
+
if (!(_optionalChain([compressedData, 'optionalAccess', _6 => _6.compressed]) && _optionalChain([compressedData, 'optionalAccess', _7 => _7.compressedHash]))) {
|
|
634
|
+
throw new FrakRpcError(
|
|
635
|
+
RpcErrorCodes.corruptedResponse,
|
|
636
|
+
"Missing compressed data"
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
const parsedData = await decompressJson(
|
|
640
|
+
compressedData.compressed
|
|
641
|
+
);
|
|
642
|
+
if (!parsedData) {
|
|
643
|
+
throw new FrakRpcError(
|
|
644
|
+
RpcErrorCodes.corruptedResponse,
|
|
645
|
+
"Invalid compressed data"
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
if (!_optionalChain([parsedData, 'optionalAccess', _8 => _8.validationHash])) {
|
|
649
|
+
throw new FrakRpcError(
|
|
650
|
+
RpcErrorCodes.corruptedResponse,
|
|
651
|
+
"Missing validation hash"
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
const expectedCompressedHash = _jssha256.sha256.call(void 0, compressedData.compressed);
|
|
655
|
+
if (expectedCompressedHash !== compressedData.compressedHash) {
|
|
656
|
+
throw new FrakRpcError(
|
|
657
|
+
RpcErrorCodes.corruptedResponse,
|
|
658
|
+
"Invalid compressed hash"
|
|
659
|
+
);
|
|
660
|
+
}
|
|
661
|
+
const { validationHash: _, ...rawResultData } = parsedData;
|
|
662
|
+
const expectedValidationHash = _jssha256.sha256.call(void 0, JSON.stringify(rawResultData));
|
|
663
|
+
if (expectedValidationHash !== parsedData.validationHash) {
|
|
664
|
+
throw new FrakRpcError(
|
|
665
|
+
RpcErrorCodes.corruptedResponse,
|
|
666
|
+
"Invalid data validation hash"
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
return parsedData;
|
|
670
|
+
}
|
|
671
|
+
async function decompressJson(data) {
|
|
672
|
+
const decompressed = await (0, import_async_lz_string2.decompressFromBase64)(data);
|
|
673
|
+
try {
|
|
674
|
+
return JSON.parse(decompressed);
|
|
675
|
+
} catch (e) {
|
|
676
|
+
console.error("Invalid compressed data", { e, decompressed });
|
|
677
|
+
return null;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
// src/core/utils/buttonShare.ts
|
|
682
|
+
var getButtonShare = (selector = "#nexus-share-button > button") => document.querySelector(selector);
|
|
683
|
+
var setButtonDisabled = (disabled, button) => {
|
|
684
|
+
if (disabled) {
|
|
685
|
+
_optionalChain([button, 'optionalAccess', _9 => _9.removeAttribute, 'call', _10 => _10("disabled")]);
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
_optionalChain([button, 'optionalAccess', _11 => _11.setAttribute, 'call', _12 => _12("disabled", "")]);
|
|
689
|
+
};
|
|
690
|
+
var toggleButtonDisabled = (disabled) => (config) => {
|
|
691
|
+
const button = getButtonShare(_optionalChain([config, 'optionalAccess', _13 => _13.metadata, 'optionalAccess', _14 => _14.buttonShare]));
|
|
692
|
+
setButtonDisabled(disabled, button);
|
|
693
|
+
};
|
|
694
|
+
var enableButtonShare = toggleButtonDisabled(true);
|
|
695
|
+
var disableButtonShare = toggleButtonDisabled(false);
|
|
696
|
+
|
|
697
|
+
// src/core/utils/iframeHelper.ts
|
|
698
|
+
var baseIframeProps = {
|
|
699
|
+
id: "nexus-wallet",
|
|
700
|
+
name: "nexus-wallet",
|
|
701
|
+
allow: "publickey-credentials-get *; clipboard-write; web-share *",
|
|
702
|
+
style: {
|
|
703
|
+
width: "0",
|
|
704
|
+
height: "0",
|
|
705
|
+
border: "0",
|
|
706
|
+
position: "absolute",
|
|
707
|
+
zIndex: 1e3,
|
|
708
|
+
top: "-1000px",
|
|
709
|
+
left: "-1000px"
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
function createIframe({
|
|
713
|
+
walletBaseUrl,
|
|
714
|
+
config
|
|
715
|
+
}) {
|
|
716
|
+
disableButtonShare(config);
|
|
717
|
+
const alreadyCreatedIFrame = document.querySelector("#nexus-wallet");
|
|
718
|
+
if (alreadyCreatedIFrame) {
|
|
719
|
+
return Promise.resolve(alreadyCreatedIFrame);
|
|
720
|
+
}
|
|
721
|
+
const iframe = document.createElement("iframe");
|
|
722
|
+
iframe.id = baseIframeProps.id;
|
|
723
|
+
iframe.name = baseIframeProps.name;
|
|
724
|
+
iframe.allow = baseIframeProps.allow;
|
|
725
|
+
iframe.style.zIndex = baseIframeProps.style.zIndex.toString();
|
|
726
|
+
changeIframeVisibility({ iframe, isVisible: false });
|
|
727
|
+
document.body.appendChild(iframe);
|
|
728
|
+
return new Promise((resolve) => {
|
|
729
|
+
_optionalChain([iframe, 'optionalAccess', _15 => _15.addEventListener, 'call', _16 => _16("load", () => resolve(iframe))]);
|
|
730
|
+
iframe.src = `${walletBaseUrl}/listener`;
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
function changeIframeVisibility({
|
|
734
|
+
iframe,
|
|
735
|
+
isVisible
|
|
736
|
+
}) {
|
|
737
|
+
if (!isVisible) {
|
|
738
|
+
iframe.style.width = "0";
|
|
739
|
+
iframe.style.height = "0";
|
|
740
|
+
iframe.style.border = "0";
|
|
741
|
+
iframe.style.position = "fixed";
|
|
742
|
+
iframe.style.top = "-1000px";
|
|
743
|
+
iframe.style.left = "-1000px";
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
iframe.style.position = "fixed";
|
|
747
|
+
iframe.style.top = "0";
|
|
748
|
+
iframe.style.left = "0";
|
|
749
|
+
iframe.style.width = "100%";
|
|
750
|
+
iframe.style.height = "100%";
|
|
751
|
+
iframe.style.pointerEvents = "auto";
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// src/core/utils/FrakContext.ts
|
|
755
|
+
var _viem = require('viem');
|
|
756
|
+
var contextKey = "fCtx";
|
|
757
|
+
function base64url_encode(buffer) {
|
|
758
|
+
return btoa(Array.from(buffer, (b) => String.fromCharCode(b)).join("")).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
759
|
+
}
|
|
760
|
+
function base64url_decode(value) {
|
|
761
|
+
const m = value.length % 4;
|
|
762
|
+
return Uint8Array.from(
|
|
763
|
+
atob(
|
|
764
|
+
value.replace(/-/g, "+").replace(/_/g, "/").padEnd(value.length + (m === 0 ? 0 : 4 - m), "=")
|
|
765
|
+
),
|
|
766
|
+
(c) => c.charCodeAt(0)
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
function compress(context) {
|
|
770
|
+
if (!_optionalChain([context, 'optionalAccess', _17 => _17.r])) return;
|
|
771
|
+
try {
|
|
772
|
+
const bytes = _viem.hexToBytes.call(void 0, context.r);
|
|
773
|
+
return base64url_encode(bytes);
|
|
774
|
+
} catch (e) {
|
|
775
|
+
console.error("Error compressing Frak context", { e, context });
|
|
776
|
+
}
|
|
777
|
+
return void 0;
|
|
778
|
+
}
|
|
779
|
+
function decompress(context) {
|
|
780
|
+
if (!context || context.length === 0) return;
|
|
781
|
+
try {
|
|
782
|
+
const bytes = base64url_decode(context);
|
|
783
|
+
return { r: _viem.bytesToHex.call(void 0, bytes, { size: 20 }) };
|
|
784
|
+
} catch (e) {
|
|
785
|
+
console.error("Error decompressing Frak context", { e, context });
|
|
786
|
+
}
|
|
787
|
+
return void 0;
|
|
788
|
+
}
|
|
789
|
+
function parse({ url }) {
|
|
790
|
+
if (!url) return null;
|
|
791
|
+
const urlObj = new URL(url);
|
|
792
|
+
const frakContext = urlObj.searchParams.get(contextKey);
|
|
793
|
+
if (!frakContext) return null;
|
|
794
|
+
return decompress(frakContext);
|
|
795
|
+
}
|
|
796
|
+
function update({
|
|
797
|
+
url,
|
|
798
|
+
context
|
|
799
|
+
}) {
|
|
800
|
+
if (!url) return null;
|
|
801
|
+
const currentContext = parse({ url });
|
|
802
|
+
const mergedContext = currentContext ? { ...currentContext, ...context } : context;
|
|
803
|
+
if (!mergedContext.r) return null;
|
|
804
|
+
const compressedContext = compress(mergedContext);
|
|
805
|
+
if (!compressedContext) return null;
|
|
806
|
+
const urlObj = new URL(url);
|
|
807
|
+
urlObj.searchParams.set(contextKey, compressedContext);
|
|
808
|
+
return urlObj.toString();
|
|
809
|
+
}
|
|
810
|
+
function remove(url) {
|
|
811
|
+
const urlObj = new URL(url);
|
|
812
|
+
urlObj.searchParams.delete(contextKey);
|
|
813
|
+
return urlObj.toString();
|
|
814
|
+
}
|
|
815
|
+
function replaceUrl({
|
|
816
|
+
url: baseUrl,
|
|
817
|
+
context
|
|
818
|
+
}) {
|
|
819
|
+
if (!_optionalChain([window, 'access', _18 => _18.location, 'optionalAccess', _19 => _19.href]) || typeof window === "undefined") {
|
|
820
|
+
console.error("No window found, can't update context");
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
const url = _nullishCoalesce(baseUrl, () => ( window.location.href));
|
|
824
|
+
let newUrl;
|
|
825
|
+
if (context !== null) {
|
|
826
|
+
newUrl = update({
|
|
827
|
+
url,
|
|
828
|
+
context
|
|
829
|
+
});
|
|
830
|
+
} else {
|
|
831
|
+
newUrl = remove(url);
|
|
832
|
+
}
|
|
833
|
+
if (!newUrl) return;
|
|
834
|
+
window.history.replaceState(null, "", newUrl.toString());
|
|
835
|
+
}
|
|
836
|
+
var FrakContextManager = {
|
|
837
|
+
compress,
|
|
838
|
+
decompress,
|
|
839
|
+
parse,
|
|
840
|
+
update,
|
|
841
|
+
remove,
|
|
842
|
+
replaceUrl
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
exports.FrakRpcError = FrakRpcError; exports.InternalError = InternalError; exports.ClientNotFound = ClientNotFound; exports.RpcErrorCodes = RpcErrorCodes; exports.Deferred = Deferred; exports.enableButtonShare = enableButtonShare; exports.hashAndCompressData = hashAndCompressData; exports.compressJson = compressJson; exports.decompressDataAndCheckHash = decompressDataAndCheckHash; exports.decompressJson = decompressJson; exports.baseIframeProps = baseIframeProps; exports.createIframe = createIframe; exports.changeIframeVisibility = changeIframeVisibility; exports.FrakContextManager = FrakContextManager;
|