@massalabs/wallet-provider 1.3.1 → 1.3.2-dev.20230822174443
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/bundle.js +758 -2
- package/bundle.min.js +1 -1
- package/dist/bearbyWallet/BearbyAccount.js +2 -2
- package/dist/cmd/bearbyWallet/BearbyAccount.js +2 -2
- package/dist/cmd/bearbyWallet/BearbyAccount.js.map +1 -1
- package/dist/esm/bearbyWallet/BearbyAccount.js +2 -2
- package/dist/esm/bearbyWallet/BearbyAccount.js.map +1 -1
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -1,6 +1,533 @@
|
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
|
2
2
|
/******/ var __webpack_modules__ = ({
|
|
3
3
|
|
|
4
|
+
/***/ "./node_modules/@noble/hashes/_assert.js":
|
|
5
|
+
/*!***********************************************!*\
|
|
6
|
+
!*** ./node_modules/@noble/hashes/_assert.js ***!
|
|
7
|
+
\***********************************************/
|
|
8
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
9
|
+
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
13
|
+
exports.output = exports.exists = exports.hash = exports.bytes = exports.bool = exports.number = void 0;
|
|
14
|
+
function number(n) {
|
|
15
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
16
|
+
throw new Error(`Wrong positive integer: ${n}`);
|
|
17
|
+
}
|
|
18
|
+
exports.number = number;
|
|
19
|
+
function bool(b) {
|
|
20
|
+
if (typeof b !== 'boolean')
|
|
21
|
+
throw new Error(`Expected boolean, not ${b}`);
|
|
22
|
+
}
|
|
23
|
+
exports.bool = bool;
|
|
24
|
+
function bytes(b, ...lengths) {
|
|
25
|
+
if (!(b instanceof Uint8Array))
|
|
26
|
+
throw new Error('Expected Uint8Array');
|
|
27
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
28
|
+
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
|
29
|
+
}
|
|
30
|
+
exports.bytes = bytes;
|
|
31
|
+
function hash(hash) {
|
|
32
|
+
if (typeof hash !== 'function' || typeof hash.create !== 'function')
|
|
33
|
+
throw new Error('Hash should be wrapped by utils.wrapConstructor');
|
|
34
|
+
number(hash.outputLen);
|
|
35
|
+
number(hash.blockLen);
|
|
36
|
+
}
|
|
37
|
+
exports.hash = hash;
|
|
38
|
+
function exists(instance, checkFinished = true) {
|
|
39
|
+
if (instance.destroyed)
|
|
40
|
+
throw new Error('Hash instance has been destroyed');
|
|
41
|
+
if (checkFinished && instance.finished)
|
|
42
|
+
throw new Error('Hash#digest() has already been called');
|
|
43
|
+
}
|
|
44
|
+
exports.exists = exists;
|
|
45
|
+
function output(out, instance) {
|
|
46
|
+
bytes(out);
|
|
47
|
+
const min = instance.outputLen;
|
|
48
|
+
if (out.length < min) {
|
|
49
|
+
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.output = output;
|
|
53
|
+
const assert = {
|
|
54
|
+
number,
|
|
55
|
+
bool,
|
|
56
|
+
bytes,
|
|
57
|
+
hash,
|
|
58
|
+
exists,
|
|
59
|
+
output,
|
|
60
|
+
};
|
|
61
|
+
exports["default"] = assert;
|
|
62
|
+
//# sourceMappingURL=_assert.js.map
|
|
63
|
+
|
|
64
|
+
/***/ }),
|
|
65
|
+
|
|
66
|
+
/***/ "./node_modules/@noble/hashes/_sha2.js":
|
|
67
|
+
/*!*********************************************!*\
|
|
68
|
+
!*** ./node_modules/@noble/hashes/_sha2.js ***!
|
|
69
|
+
\*********************************************/
|
|
70
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
71
|
+
|
|
72
|
+
"use strict";
|
|
73
|
+
|
|
74
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
75
|
+
exports.SHA2 = void 0;
|
|
76
|
+
const _assert_js_1 = __webpack_require__(/*! ./_assert.js */ "./node_modules/@noble/hashes/_assert.js");
|
|
77
|
+
const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/hashes/utils.js");
|
|
78
|
+
// Polyfill for Safari 14
|
|
79
|
+
function setBigUint64(view, byteOffset, value, isLE) {
|
|
80
|
+
if (typeof view.setBigUint64 === 'function')
|
|
81
|
+
return view.setBigUint64(byteOffset, value, isLE);
|
|
82
|
+
const _32n = BigInt(32);
|
|
83
|
+
const _u32_max = BigInt(0xffffffff);
|
|
84
|
+
const wh = Number((value >> _32n) & _u32_max);
|
|
85
|
+
const wl = Number(value & _u32_max);
|
|
86
|
+
const h = isLE ? 4 : 0;
|
|
87
|
+
const l = isLE ? 0 : 4;
|
|
88
|
+
view.setUint32(byteOffset + h, wh, isLE);
|
|
89
|
+
view.setUint32(byteOffset + l, wl, isLE);
|
|
90
|
+
}
|
|
91
|
+
// Base SHA2 class (RFC 6234)
|
|
92
|
+
class SHA2 extends utils_js_1.Hash {
|
|
93
|
+
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
94
|
+
super();
|
|
95
|
+
this.blockLen = blockLen;
|
|
96
|
+
this.outputLen = outputLen;
|
|
97
|
+
this.padOffset = padOffset;
|
|
98
|
+
this.isLE = isLE;
|
|
99
|
+
this.finished = false;
|
|
100
|
+
this.length = 0;
|
|
101
|
+
this.pos = 0;
|
|
102
|
+
this.destroyed = false;
|
|
103
|
+
this.buffer = new Uint8Array(blockLen);
|
|
104
|
+
this.view = (0, utils_js_1.createView)(this.buffer);
|
|
105
|
+
}
|
|
106
|
+
update(data) {
|
|
107
|
+
_assert_js_1.default.exists(this);
|
|
108
|
+
const { view, buffer, blockLen } = this;
|
|
109
|
+
data = (0, utils_js_1.toBytes)(data);
|
|
110
|
+
const len = data.length;
|
|
111
|
+
for (let pos = 0; pos < len;) {
|
|
112
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
113
|
+
// Fast path: we have at least one block in input, cast it to view and process
|
|
114
|
+
if (take === blockLen) {
|
|
115
|
+
const dataView = (0, utils_js_1.createView)(data);
|
|
116
|
+
for (; blockLen <= len - pos; pos += blockLen)
|
|
117
|
+
this.process(dataView, pos);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
121
|
+
this.pos += take;
|
|
122
|
+
pos += take;
|
|
123
|
+
if (this.pos === blockLen) {
|
|
124
|
+
this.process(view, 0);
|
|
125
|
+
this.pos = 0;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
this.length += data.length;
|
|
129
|
+
this.roundClean();
|
|
130
|
+
return this;
|
|
131
|
+
}
|
|
132
|
+
digestInto(out) {
|
|
133
|
+
_assert_js_1.default.exists(this);
|
|
134
|
+
_assert_js_1.default.output(out, this);
|
|
135
|
+
this.finished = true;
|
|
136
|
+
// Padding
|
|
137
|
+
// We can avoid allocation of buffer for padding completely if it
|
|
138
|
+
// was previously not allocated here. But it won't change performance.
|
|
139
|
+
const { buffer, view, blockLen, isLE } = this;
|
|
140
|
+
let { pos } = this;
|
|
141
|
+
// append the bit '1' to the message
|
|
142
|
+
buffer[pos++] = 0b10000000;
|
|
143
|
+
this.buffer.subarray(pos).fill(0);
|
|
144
|
+
// we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again
|
|
145
|
+
if (this.padOffset > blockLen - pos) {
|
|
146
|
+
this.process(view, 0);
|
|
147
|
+
pos = 0;
|
|
148
|
+
}
|
|
149
|
+
// Pad until full block byte with zeros
|
|
150
|
+
for (let i = pos; i < blockLen; i++)
|
|
151
|
+
buffer[i] = 0;
|
|
152
|
+
// Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
|
|
153
|
+
// You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
|
|
154
|
+
// So we just write lowest 64 bits of that value.
|
|
155
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
156
|
+
this.process(view, 0);
|
|
157
|
+
const oview = (0, utils_js_1.createView)(out);
|
|
158
|
+
const len = this.outputLen;
|
|
159
|
+
// NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
|
|
160
|
+
if (len % 4)
|
|
161
|
+
throw new Error('_sha2: outputLen should be aligned to 32bit');
|
|
162
|
+
const outLen = len / 4;
|
|
163
|
+
const state = this.get();
|
|
164
|
+
if (outLen > state.length)
|
|
165
|
+
throw new Error('_sha2: outputLen bigger than state');
|
|
166
|
+
for (let i = 0; i < outLen; i++)
|
|
167
|
+
oview.setUint32(4 * i, state[i], isLE);
|
|
168
|
+
}
|
|
169
|
+
digest() {
|
|
170
|
+
const { buffer, outputLen } = this;
|
|
171
|
+
this.digestInto(buffer);
|
|
172
|
+
const res = buffer.slice(0, outputLen);
|
|
173
|
+
this.destroy();
|
|
174
|
+
return res;
|
|
175
|
+
}
|
|
176
|
+
_cloneInto(to) {
|
|
177
|
+
to || (to = new this.constructor());
|
|
178
|
+
to.set(...this.get());
|
|
179
|
+
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
180
|
+
to.length = length;
|
|
181
|
+
to.pos = pos;
|
|
182
|
+
to.finished = finished;
|
|
183
|
+
to.destroyed = destroyed;
|
|
184
|
+
if (length % blockLen)
|
|
185
|
+
to.buffer.set(buffer);
|
|
186
|
+
return to;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.SHA2 = SHA2;
|
|
190
|
+
//# sourceMappingURL=_sha2.js.map
|
|
191
|
+
|
|
192
|
+
/***/ }),
|
|
193
|
+
|
|
194
|
+
/***/ "./node_modules/@noble/hashes/crypto.js":
|
|
195
|
+
/*!**********************************************!*\
|
|
196
|
+
!*** ./node_modules/@noble/hashes/crypto.js ***!
|
|
197
|
+
\**********************************************/
|
|
198
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
199
|
+
|
|
200
|
+
"use strict";
|
|
201
|
+
|
|
202
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
203
|
+
exports.crypto = void 0;
|
|
204
|
+
exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
|
205
|
+
//# sourceMappingURL=crypto.js.map
|
|
206
|
+
|
|
207
|
+
/***/ }),
|
|
208
|
+
|
|
209
|
+
/***/ "./node_modules/@noble/hashes/sha256.js":
|
|
210
|
+
/*!**********************************************!*\
|
|
211
|
+
!*** ./node_modules/@noble/hashes/sha256.js ***!
|
|
212
|
+
\**********************************************/
|
|
213
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
214
|
+
|
|
215
|
+
"use strict";
|
|
216
|
+
|
|
217
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
218
|
+
exports.sha224 = exports.sha256 = void 0;
|
|
219
|
+
const _sha2_js_1 = __webpack_require__(/*! ./_sha2.js */ "./node_modules/@noble/hashes/_sha2.js");
|
|
220
|
+
const utils_js_1 = __webpack_require__(/*! ./utils.js */ "./node_modules/@noble/hashes/utils.js");
|
|
221
|
+
// Choice: a ? b : c
|
|
222
|
+
const Chi = (a, b, c) => (a & b) ^ (~a & c);
|
|
223
|
+
// Majority function, true if any two inpust is true
|
|
224
|
+
const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
|
|
225
|
+
// Round constants:
|
|
226
|
+
// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)
|
|
227
|
+
// prettier-ignore
|
|
228
|
+
const SHA256_K = new Uint32Array([
|
|
229
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
230
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
231
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
232
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
233
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
234
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
235
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
236
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
|
237
|
+
]);
|
|
238
|
+
// Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):
|
|
239
|
+
// prettier-ignore
|
|
240
|
+
const IV = new Uint32Array([
|
|
241
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
|
|
242
|
+
]);
|
|
243
|
+
// Temporary buffer, not used to store anything between runs
|
|
244
|
+
// Named this way because it matches specification.
|
|
245
|
+
const SHA256_W = new Uint32Array(64);
|
|
246
|
+
class SHA256 extends _sha2_js_1.SHA2 {
|
|
247
|
+
constructor() {
|
|
248
|
+
super(64, 32, 8, false);
|
|
249
|
+
// We cannot use array here since array allows indexing by variable
|
|
250
|
+
// which means optimizer/compiler cannot use registers.
|
|
251
|
+
this.A = IV[0] | 0;
|
|
252
|
+
this.B = IV[1] | 0;
|
|
253
|
+
this.C = IV[2] | 0;
|
|
254
|
+
this.D = IV[3] | 0;
|
|
255
|
+
this.E = IV[4] | 0;
|
|
256
|
+
this.F = IV[5] | 0;
|
|
257
|
+
this.G = IV[6] | 0;
|
|
258
|
+
this.H = IV[7] | 0;
|
|
259
|
+
}
|
|
260
|
+
get() {
|
|
261
|
+
const { A, B, C, D, E, F, G, H } = this;
|
|
262
|
+
return [A, B, C, D, E, F, G, H];
|
|
263
|
+
}
|
|
264
|
+
// prettier-ignore
|
|
265
|
+
set(A, B, C, D, E, F, G, H) {
|
|
266
|
+
this.A = A | 0;
|
|
267
|
+
this.B = B | 0;
|
|
268
|
+
this.C = C | 0;
|
|
269
|
+
this.D = D | 0;
|
|
270
|
+
this.E = E | 0;
|
|
271
|
+
this.F = F | 0;
|
|
272
|
+
this.G = G | 0;
|
|
273
|
+
this.H = H | 0;
|
|
274
|
+
}
|
|
275
|
+
process(view, offset) {
|
|
276
|
+
// Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
|
|
277
|
+
for (let i = 0; i < 16; i++, offset += 4)
|
|
278
|
+
SHA256_W[i] = view.getUint32(offset, false);
|
|
279
|
+
for (let i = 16; i < 64; i++) {
|
|
280
|
+
const W15 = SHA256_W[i - 15];
|
|
281
|
+
const W2 = SHA256_W[i - 2];
|
|
282
|
+
const s0 = (0, utils_js_1.rotr)(W15, 7) ^ (0, utils_js_1.rotr)(W15, 18) ^ (W15 >>> 3);
|
|
283
|
+
const s1 = (0, utils_js_1.rotr)(W2, 17) ^ (0, utils_js_1.rotr)(W2, 19) ^ (W2 >>> 10);
|
|
284
|
+
SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
|
|
285
|
+
}
|
|
286
|
+
// Compression function main loop, 64 rounds
|
|
287
|
+
let { A, B, C, D, E, F, G, H } = this;
|
|
288
|
+
for (let i = 0; i < 64; i++) {
|
|
289
|
+
const sigma1 = (0, utils_js_1.rotr)(E, 6) ^ (0, utils_js_1.rotr)(E, 11) ^ (0, utils_js_1.rotr)(E, 25);
|
|
290
|
+
const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
|
|
291
|
+
const sigma0 = (0, utils_js_1.rotr)(A, 2) ^ (0, utils_js_1.rotr)(A, 13) ^ (0, utils_js_1.rotr)(A, 22);
|
|
292
|
+
const T2 = (sigma0 + Maj(A, B, C)) | 0;
|
|
293
|
+
H = G;
|
|
294
|
+
G = F;
|
|
295
|
+
F = E;
|
|
296
|
+
E = (D + T1) | 0;
|
|
297
|
+
D = C;
|
|
298
|
+
C = B;
|
|
299
|
+
B = A;
|
|
300
|
+
A = (T1 + T2) | 0;
|
|
301
|
+
}
|
|
302
|
+
// Add the compressed chunk to the current hash value
|
|
303
|
+
A = (A + this.A) | 0;
|
|
304
|
+
B = (B + this.B) | 0;
|
|
305
|
+
C = (C + this.C) | 0;
|
|
306
|
+
D = (D + this.D) | 0;
|
|
307
|
+
E = (E + this.E) | 0;
|
|
308
|
+
F = (F + this.F) | 0;
|
|
309
|
+
G = (G + this.G) | 0;
|
|
310
|
+
H = (H + this.H) | 0;
|
|
311
|
+
this.set(A, B, C, D, E, F, G, H);
|
|
312
|
+
}
|
|
313
|
+
roundClean() {
|
|
314
|
+
SHA256_W.fill(0);
|
|
315
|
+
}
|
|
316
|
+
destroy() {
|
|
317
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
318
|
+
this.buffer.fill(0);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
|
|
322
|
+
class SHA224 extends SHA256 {
|
|
323
|
+
constructor() {
|
|
324
|
+
super();
|
|
325
|
+
this.A = 0xc1059ed8 | 0;
|
|
326
|
+
this.B = 0x367cd507 | 0;
|
|
327
|
+
this.C = 0x3070dd17 | 0;
|
|
328
|
+
this.D = 0xf70e5939 | 0;
|
|
329
|
+
this.E = 0xffc00b31 | 0;
|
|
330
|
+
this.F = 0x68581511 | 0;
|
|
331
|
+
this.G = 0x64f98fa7 | 0;
|
|
332
|
+
this.H = 0xbefa4fa4 | 0;
|
|
333
|
+
this.outputLen = 28;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* SHA2-256 hash function
|
|
338
|
+
* @param message - data that would be hashed
|
|
339
|
+
*/
|
|
340
|
+
exports.sha256 = (0, utils_js_1.wrapConstructor)(() => new SHA256());
|
|
341
|
+
exports.sha224 = (0, utils_js_1.wrapConstructor)(() => new SHA224());
|
|
342
|
+
//# sourceMappingURL=sha256.js.map
|
|
343
|
+
|
|
344
|
+
/***/ }),
|
|
345
|
+
|
|
346
|
+
/***/ "./node_modules/@noble/hashes/utils.js":
|
|
347
|
+
/*!*********************************************!*\
|
|
348
|
+
!*** ./node_modules/@noble/hashes/utils.js ***!
|
|
349
|
+
\*********************************************/
|
|
350
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
351
|
+
|
|
352
|
+
"use strict";
|
|
353
|
+
|
|
354
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
355
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
356
|
+
exports.randomBytes = exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.isLE = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0;
|
|
357
|
+
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
|
358
|
+
// node.js versions earlier than v19 don't declare it in global scope.
|
|
359
|
+
// For node.js, package.json#exports field mapping rewrites import
|
|
360
|
+
// from `crypto` to `cryptoNode`, which imports native module.
|
|
361
|
+
// Makes the utils un-importable in browsers without a bundler.
|
|
362
|
+
// Once node.js 18 is deprecated, we can just drop the import.
|
|
363
|
+
const crypto_1 = __webpack_require__(/*! @noble/hashes/crypto */ "./node_modules/@noble/hashes/crypto.js");
|
|
364
|
+
const u8a = (a) => a instanceof Uint8Array;
|
|
365
|
+
// Cast array to different type
|
|
366
|
+
const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
367
|
+
exports.u8 = u8;
|
|
368
|
+
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
369
|
+
exports.u32 = u32;
|
|
370
|
+
// Cast array to view
|
|
371
|
+
const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
372
|
+
exports.createView = createView;
|
|
373
|
+
// The rotate right (circular right shift) operation for uint32
|
|
374
|
+
const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);
|
|
375
|
+
exports.rotr = rotr;
|
|
376
|
+
// big-endian hardware is rare. Just in case someone still decides to run hashes:
|
|
377
|
+
// early-throw an error because we don't support BE yet.
|
|
378
|
+
exports.isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
|
|
379
|
+
if (!exports.isLE)
|
|
380
|
+
throw new Error('Non little-endian hardware is not supported');
|
|
381
|
+
const hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));
|
|
382
|
+
/**
|
|
383
|
+
* @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
|
|
384
|
+
*/
|
|
385
|
+
function bytesToHex(bytes) {
|
|
386
|
+
if (!u8a(bytes))
|
|
387
|
+
throw new Error('Uint8Array expected');
|
|
388
|
+
// pre-caching improves the speed 6x
|
|
389
|
+
let hex = '';
|
|
390
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
391
|
+
hex += hexes[bytes[i]];
|
|
392
|
+
}
|
|
393
|
+
return hex;
|
|
394
|
+
}
|
|
395
|
+
exports.bytesToHex = bytesToHex;
|
|
396
|
+
/**
|
|
397
|
+
* @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
|
|
398
|
+
*/
|
|
399
|
+
function hexToBytes(hex) {
|
|
400
|
+
if (typeof hex !== 'string')
|
|
401
|
+
throw new Error('hex string expected, got ' + typeof hex);
|
|
402
|
+
const len = hex.length;
|
|
403
|
+
if (len % 2)
|
|
404
|
+
throw new Error('padded hex string expected, got unpadded hex of length ' + len);
|
|
405
|
+
const array = new Uint8Array(len / 2);
|
|
406
|
+
for (let i = 0; i < array.length; i++) {
|
|
407
|
+
const j = i * 2;
|
|
408
|
+
const hexByte = hex.slice(j, j + 2);
|
|
409
|
+
const byte = Number.parseInt(hexByte, 16);
|
|
410
|
+
if (Number.isNaN(byte) || byte < 0)
|
|
411
|
+
throw new Error('Invalid byte sequence');
|
|
412
|
+
array[i] = byte;
|
|
413
|
+
}
|
|
414
|
+
return array;
|
|
415
|
+
}
|
|
416
|
+
exports.hexToBytes = hexToBytes;
|
|
417
|
+
// There is no setImmediate in browser and setTimeout is slow.
|
|
418
|
+
// call of async fn will return Promise, which will be fullfiled only on
|
|
419
|
+
// next scheduler queue processing step and this is exactly what we need.
|
|
420
|
+
const nextTick = async () => { };
|
|
421
|
+
exports.nextTick = nextTick;
|
|
422
|
+
// Returns control to thread each 'tick' ms to avoid blocking
|
|
423
|
+
async function asyncLoop(iters, tick, cb) {
|
|
424
|
+
let ts = Date.now();
|
|
425
|
+
for (let i = 0; i < iters; i++) {
|
|
426
|
+
cb(i);
|
|
427
|
+
// Date.now() is not monotonic, so in case if clock goes backwards we return return control too
|
|
428
|
+
const diff = Date.now() - ts;
|
|
429
|
+
if (diff >= 0 && diff < tick)
|
|
430
|
+
continue;
|
|
431
|
+
await (0, exports.nextTick)();
|
|
432
|
+
ts += diff;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
exports.asyncLoop = asyncLoop;
|
|
436
|
+
/**
|
|
437
|
+
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
|
|
438
|
+
*/
|
|
439
|
+
function utf8ToBytes(str) {
|
|
440
|
+
if (typeof str !== 'string')
|
|
441
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
442
|
+
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
443
|
+
}
|
|
444
|
+
exports.utf8ToBytes = utf8ToBytes;
|
|
445
|
+
/**
|
|
446
|
+
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
|
447
|
+
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
448
|
+
* Keep in mind for future mutable operations.
|
|
449
|
+
*/
|
|
450
|
+
function toBytes(data) {
|
|
451
|
+
if (typeof data === 'string')
|
|
452
|
+
data = utf8ToBytes(data);
|
|
453
|
+
if (!u8a(data))
|
|
454
|
+
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
|
455
|
+
return data;
|
|
456
|
+
}
|
|
457
|
+
exports.toBytes = toBytes;
|
|
458
|
+
/**
|
|
459
|
+
* Copies several Uint8Arrays into one.
|
|
460
|
+
*/
|
|
461
|
+
function concatBytes(...arrays) {
|
|
462
|
+
const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
|
|
463
|
+
let pad = 0; // walk through each item, ensure they have proper type
|
|
464
|
+
arrays.forEach((a) => {
|
|
465
|
+
if (!u8a(a))
|
|
466
|
+
throw new Error('Uint8Array expected');
|
|
467
|
+
r.set(a, pad);
|
|
468
|
+
pad += a.length;
|
|
469
|
+
});
|
|
470
|
+
return r;
|
|
471
|
+
}
|
|
472
|
+
exports.concatBytes = concatBytes;
|
|
473
|
+
// For runtime check if class implements interface
|
|
474
|
+
class Hash {
|
|
475
|
+
// Safe version that clones internal state
|
|
476
|
+
clone() {
|
|
477
|
+
return this._cloneInto();
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
exports.Hash = Hash;
|
|
481
|
+
// Check if object doens't have custom constructor (like Uint8Array/Array)
|
|
482
|
+
const isPlainObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]' && obj.constructor === Object;
|
|
483
|
+
function checkOpts(defaults, opts) {
|
|
484
|
+
if (opts !== undefined && (typeof opts !== 'object' || !isPlainObject(opts)))
|
|
485
|
+
throw new Error('Options should be object or undefined');
|
|
486
|
+
const merged = Object.assign(defaults, opts);
|
|
487
|
+
return merged;
|
|
488
|
+
}
|
|
489
|
+
exports.checkOpts = checkOpts;
|
|
490
|
+
function wrapConstructor(hashCons) {
|
|
491
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
492
|
+
const tmp = hashCons();
|
|
493
|
+
hashC.outputLen = tmp.outputLen;
|
|
494
|
+
hashC.blockLen = tmp.blockLen;
|
|
495
|
+
hashC.create = () => hashCons();
|
|
496
|
+
return hashC;
|
|
497
|
+
}
|
|
498
|
+
exports.wrapConstructor = wrapConstructor;
|
|
499
|
+
function wrapConstructorWithOpts(hashCons) {
|
|
500
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
501
|
+
const tmp = hashCons({});
|
|
502
|
+
hashC.outputLen = tmp.outputLen;
|
|
503
|
+
hashC.blockLen = tmp.blockLen;
|
|
504
|
+
hashC.create = (opts) => hashCons(opts);
|
|
505
|
+
return hashC;
|
|
506
|
+
}
|
|
507
|
+
exports.wrapConstructorWithOpts = wrapConstructorWithOpts;
|
|
508
|
+
function wrapXOFConstructorWithOpts(hashCons) {
|
|
509
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
510
|
+
const tmp = hashCons({});
|
|
511
|
+
hashC.outputLen = tmp.outputLen;
|
|
512
|
+
hashC.blockLen = tmp.blockLen;
|
|
513
|
+
hashC.create = (opts) => hashCons(opts);
|
|
514
|
+
return hashC;
|
|
515
|
+
}
|
|
516
|
+
exports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts;
|
|
517
|
+
/**
|
|
518
|
+
* Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.
|
|
519
|
+
*/
|
|
520
|
+
function randomBytes(bytesLength = 32) {
|
|
521
|
+
if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') {
|
|
522
|
+
return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
523
|
+
}
|
|
524
|
+
throw new Error('crypto.getRandomValues must be defined');
|
|
525
|
+
}
|
|
526
|
+
exports.randomBytes = randomBytes;
|
|
527
|
+
//# sourceMappingURL=utils.js.map
|
|
528
|
+
|
|
529
|
+
/***/ }),
|
|
530
|
+
|
|
4
531
|
/***/ "./node_modules/axios/index.js":
|
|
5
532
|
/*!*************************************!*\
|
|
6
533
|
!*** ./node_modules/axios/index.js ***!
|
|
@@ -2161,6 +2688,138 @@ module.exports = {
|
|
|
2161
2688
|
};
|
|
2162
2689
|
|
|
2163
2690
|
|
|
2691
|
+
/***/ }),
|
|
2692
|
+
|
|
2693
|
+
/***/ "./node_modules/base-x/src/index.js":
|
|
2694
|
+
/*!******************************************!*\
|
|
2695
|
+
!*** ./node_modules/base-x/src/index.js ***!
|
|
2696
|
+
\******************************************/
|
|
2697
|
+
/***/ ((module) => {
|
|
2698
|
+
|
|
2699
|
+
"use strict";
|
|
2700
|
+
|
|
2701
|
+
// base-x encoding / decoding
|
|
2702
|
+
// Copyright (c) 2018 base-x contributors
|
|
2703
|
+
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
2704
|
+
// Distributed under the MIT software license, see the accompanying
|
|
2705
|
+
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
2706
|
+
function base (ALPHABET) {
|
|
2707
|
+
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
2708
|
+
var BASE_MAP = new Uint8Array(256)
|
|
2709
|
+
for (var j = 0; j < BASE_MAP.length; j++) {
|
|
2710
|
+
BASE_MAP[j] = 255
|
|
2711
|
+
}
|
|
2712
|
+
for (var i = 0; i < ALPHABET.length; i++) {
|
|
2713
|
+
var x = ALPHABET.charAt(i)
|
|
2714
|
+
var xc = x.charCodeAt(0)
|
|
2715
|
+
if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
|
|
2716
|
+
BASE_MAP[xc] = i
|
|
2717
|
+
}
|
|
2718
|
+
var BASE = ALPHABET.length
|
|
2719
|
+
var LEADER = ALPHABET.charAt(0)
|
|
2720
|
+
var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up
|
|
2721
|
+
var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up
|
|
2722
|
+
function encode (source) {
|
|
2723
|
+
if (source instanceof Uint8Array) {
|
|
2724
|
+
} else if (ArrayBuffer.isView(source)) {
|
|
2725
|
+
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength)
|
|
2726
|
+
} else if (Array.isArray(source)) {
|
|
2727
|
+
source = Uint8Array.from(source)
|
|
2728
|
+
}
|
|
2729
|
+
if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
|
|
2730
|
+
if (source.length === 0) { return '' }
|
|
2731
|
+
// Skip & count leading zeroes.
|
|
2732
|
+
var zeroes = 0
|
|
2733
|
+
var length = 0
|
|
2734
|
+
var pbegin = 0
|
|
2735
|
+
var pend = source.length
|
|
2736
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
2737
|
+
pbegin++
|
|
2738
|
+
zeroes++
|
|
2739
|
+
}
|
|
2740
|
+
// Allocate enough space in big-endian base58 representation.
|
|
2741
|
+
var size = ((pend - pbegin) * iFACTOR + 1) >>> 0
|
|
2742
|
+
var b58 = new Uint8Array(size)
|
|
2743
|
+
// Process the bytes.
|
|
2744
|
+
while (pbegin !== pend) {
|
|
2745
|
+
var carry = source[pbegin]
|
|
2746
|
+
// Apply "b58 = b58 * 256 + ch".
|
|
2747
|
+
var i = 0
|
|
2748
|
+
for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
|
2749
|
+
carry += (256 * b58[it1]) >>> 0
|
|
2750
|
+
b58[it1] = (carry % BASE) >>> 0
|
|
2751
|
+
carry = (carry / BASE) >>> 0
|
|
2752
|
+
}
|
|
2753
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
2754
|
+
length = i
|
|
2755
|
+
pbegin++
|
|
2756
|
+
}
|
|
2757
|
+
// Skip leading zeroes in base58 result.
|
|
2758
|
+
var it2 = size - length
|
|
2759
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
2760
|
+
it2++
|
|
2761
|
+
}
|
|
2762
|
+
// Translate the result into a string.
|
|
2763
|
+
var str = LEADER.repeat(zeroes)
|
|
2764
|
+
for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) }
|
|
2765
|
+
return str
|
|
2766
|
+
}
|
|
2767
|
+
function decodeUnsafe (source) {
|
|
2768
|
+
if (typeof source !== 'string') { throw new TypeError('Expected String') }
|
|
2769
|
+
if (source.length === 0) { return new Uint8Array() }
|
|
2770
|
+
var psz = 0
|
|
2771
|
+
// Skip and count leading '1's.
|
|
2772
|
+
var zeroes = 0
|
|
2773
|
+
var length = 0
|
|
2774
|
+
while (source[psz] === LEADER) {
|
|
2775
|
+
zeroes++
|
|
2776
|
+
psz++
|
|
2777
|
+
}
|
|
2778
|
+
// Allocate enough space in big-endian base256 representation.
|
|
2779
|
+
var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up.
|
|
2780
|
+
var b256 = new Uint8Array(size)
|
|
2781
|
+
// Process the characters.
|
|
2782
|
+
while (source[psz]) {
|
|
2783
|
+
// Decode character
|
|
2784
|
+
var carry = BASE_MAP[source.charCodeAt(psz)]
|
|
2785
|
+
// Invalid character
|
|
2786
|
+
if (carry === 255) { return }
|
|
2787
|
+
var i = 0
|
|
2788
|
+
for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
|
2789
|
+
carry += (BASE * b256[it3]) >>> 0
|
|
2790
|
+
b256[it3] = (carry % 256) >>> 0
|
|
2791
|
+
carry = (carry / 256) >>> 0
|
|
2792
|
+
}
|
|
2793
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
2794
|
+
length = i
|
|
2795
|
+
psz++
|
|
2796
|
+
}
|
|
2797
|
+
// Skip leading zeroes in b256.
|
|
2798
|
+
var it4 = size - length
|
|
2799
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
2800
|
+
it4++
|
|
2801
|
+
}
|
|
2802
|
+
var vch = new Uint8Array(zeroes + (size - it4))
|
|
2803
|
+
var j = zeroes
|
|
2804
|
+
while (it4 !== size) {
|
|
2805
|
+
vch[j++] = b256[it4++]
|
|
2806
|
+
}
|
|
2807
|
+
return vch
|
|
2808
|
+
}
|
|
2809
|
+
function decode (string) {
|
|
2810
|
+
var buffer = decodeUnsafe(string)
|
|
2811
|
+
if (buffer) { return buffer }
|
|
2812
|
+
throw new Error('Non-base' + BASE + ' character')
|
|
2813
|
+
}
|
|
2814
|
+
return {
|
|
2815
|
+
encode: encode,
|
|
2816
|
+
decodeUnsafe: decodeUnsafe,
|
|
2817
|
+
decode: decode
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
module.exports = base
|
|
2821
|
+
|
|
2822
|
+
|
|
2164
2823
|
/***/ }),
|
|
2165
2824
|
|
|
2166
2825
|
/***/ "./node_modules/base64-js/index.js":
|
|
@@ -2322,6 +2981,103 @@ function fromByteArray (uint8) {
|
|
|
2322
2981
|
}
|
|
2323
2982
|
|
|
2324
2983
|
|
|
2984
|
+
/***/ }),
|
|
2985
|
+
|
|
2986
|
+
/***/ "./node_modules/bs58/index.js":
|
|
2987
|
+
/*!************************************!*\
|
|
2988
|
+
!*** ./node_modules/bs58/index.js ***!
|
|
2989
|
+
\************************************/
|
|
2990
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2991
|
+
|
|
2992
|
+
const basex = __webpack_require__(/*! base-x */ "./node_modules/base-x/src/index.js")
|
|
2993
|
+
const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
|
|
2994
|
+
|
|
2995
|
+
module.exports = basex(ALPHABET)
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
/***/ }),
|
|
2999
|
+
|
|
3000
|
+
/***/ "./node_modules/bs58check/base.js":
|
|
3001
|
+
/*!****************************************!*\
|
|
3002
|
+
!*** ./node_modules/bs58check/base.js ***!
|
|
3003
|
+
\****************************************/
|
|
3004
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
3005
|
+
|
|
3006
|
+
"use strict";
|
|
3007
|
+
|
|
3008
|
+
|
|
3009
|
+
var base58 = __webpack_require__(/*! bs58 */ "./node_modules/bs58/index.js")
|
|
3010
|
+
|
|
3011
|
+
module.exports = function (checksumFn) {
|
|
3012
|
+
// Encode a buffer as a base58-check encoded string
|
|
3013
|
+
function encode (payload) {
|
|
3014
|
+
var payloadU8 = Uint8Array.from(payload)
|
|
3015
|
+
var checksum = checksumFn(payloadU8)
|
|
3016
|
+
var length = payloadU8.length + 4
|
|
3017
|
+
var both = new Uint8Array(length)
|
|
3018
|
+
both.set(payloadU8, 0)
|
|
3019
|
+
both.set(checksum.subarray(0, 4), payloadU8.length)
|
|
3020
|
+
return base58.encode(both, length)
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
function decodeRaw (buffer) {
|
|
3024
|
+
var payload = buffer.slice(0, -4)
|
|
3025
|
+
var checksum = buffer.slice(-4)
|
|
3026
|
+
var newChecksum = checksumFn(payload)
|
|
3027
|
+
|
|
3028
|
+
if (checksum[0] ^ newChecksum[0] |
|
|
3029
|
+
checksum[1] ^ newChecksum[1] |
|
|
3030
|
+
checksum[2] ^ newChecksum[2] |
|
|
3031
|
+
checksum[3] ^ newChecksum[3]) return
|
|
3032
|
+
|
|
3033
|
+
return payload
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
// Decode a base58-check encoded string to a buffer, no result if checksum is wrong
|
|
3037
|
+
function decodeUnsafe (string) {
|
|
3038
|
+
var buffer = base58.decodeUnsafe(string)
|
|
3039
|
+
if (!buffer) return
|
|
3040
|
+
|
|
3041
|
+
return decodeRaw(buffer)
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
function decode (string) {
|
|
3045
|
+
var buffer = base58.decode(string)
|
|
3046
|
+
var payload = decodeRaw(buffer, checksumFn)
|
|
3047
|
+
if (!payload) throw new Error('Invalid checksum')
|
|
3048
|
+
return payload
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
return {
|
|
3052
|
+
encode: encode,
|
|
3053
|
+
decode: decode,
|
|
3054
|
+
decodeUnsafe: decodeUnsafe
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
|
|
3059
|
+
/***/ }),
|
|
3060
|
+
|
|
3061
|
+
/***/ "./node_modules/bs58check/index.js":
|
|
3062
|
+
/*!*****************************************!*\
|
|
3063
|
+
!*** ./node_modules/bs58check/index.js ***!
|
|
3064
|
+
\*****************************************/
|
|
3065
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
3066
|
+
|
|
3067
|
+
"use strict";
|
|
3068
|
+
|
|
3069
|
+
|
|
3070
|
+
var { sha256 } = __webpack_require__(/*! @noble/hashes/sha256 */ "./node_modules/@noble/hashes/sha256.js")
|
|
3071
|
+
var bs58checkBase = __webpack_require__(/*! ./base */ "./node_modules/bs58check/base.js")
|
|
3072
|
+
|
|
3073
|
+
// SHA256(SHA256(buffer))
|
|
3074
|
+
function sha256x2 (buffer) {
|
|
3075
|
+
return sha256(sha256(buffer))
|
|
3076
|
+
}
|
|
3077
|
+
|
|
3078
|
+
module.exports = bs58checkBase(sha256x2)
|
|
3079
|
+
|
|
3080
|
+
|
|
2325
3081
|
/***/ }),
|
|
2326
3082
|
|
|
2327
3083
|
/***/ "./node_modules/buffer/index.js":
|
|
@@ -5263,6 +6019,7 @@ const bearby_js_1 = __webpack_require__(/*! @hicaru/bearby.js */ "./node_modules
|
|
|
5263
6019
|
const RequestHandler_1 = __webpack_require__(/*! ../massaStation/RequestHandler */ "./src/massaStation/RequestHandler.ts");
|
|
5264
6020
|
const jsonRpcMethods_1 = __webpack_require__(/*! ./jsonRpcMethods */ "./src/bearbyWallet/jsonRpcMethods.ts");
|
|
5265
6021
|
const axios_1 = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
|
|
6022
|
+
const bs58check_1 = __webpack_require__(/*! bs58check */ "./node_modules/bs58check/index.js");
|
|
5266
6023
|
/**
|
|
5267
6024
|
* The maximum allowed gas for a read operation
|
|
5268
6025
|
*/
|
|
@@ -5340,7 +6097,6 @@ class BearbyAccount {
|
|
|
5340
6097
|
// need testing
|
|
5341
6098
|
async sign(data) {
|
|
5342
6099
|
await this.connect();
|
|
5343
|
-
const encoder = new TextEncoder();
|
|
5344
6100
|
let strData;
|
|
5345
6101
|
if (data instanceof Uint8Array) {
|
|
5346
6102
|
strData = new TextDecoder().decode(data);
|
|
@@ -5351,7 +6107,7 @@ class BearbyAccount {
|
|
|
5351
6107
|
const signature = await bearby_js_1.web3.wallet.signMessage(strData);
|
|
5352
6108
|
return {
|
|
5353
6109
|
publicKey: signature.publicKey,
|
|
5354
|
-
signature:
|
|
6110
|
+
signature: (0, bs58check_1.decode)(signature.signature),
|
|
5355
6111
|
};
|
|
5356
6112
|
}
|
|
5357
6113
|
// need testing
|