@fleet-sdk/blockchain-providers 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { ErgoAddress } from '@fleet-sdk/core';
3
3
 
4
4
  // src/ergo-graphql/ergoGraphQLProvider.ts
5
5
 
6
- // ../../node_modules/.pnpm/@noble+hashes@1.7.2/node_modules/@noble/hashes/esm/_assert.js
6
+ // ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
7
7
  function isBytes(a) {
8
8
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
9
9
  }
@@ -26,21 +26,20 @@ function aoutput(out, instance) {
26
26
  throw new Error("digestInto() expects output buffer of length at least " + min);
27
27
  }
28
28
  }
29
-
30
- // ../../node_modules/.pnpm/@noble+hashes@1.7.2/node_modules/@noble/hashes/esm/utils.js
29
+ function clean(...arrays) {
30
+ for (let i = 0; i < arrays.length; i++) {
31
+ arrays[i].fill(0);
32
+ }
33
+ }
31
34
  function createView(arr) {
32
35
  return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
33
36
  }
34
37
  function rotr(word, shift) {
35
38
  return word << 32 - shift | word >>> shift;
36
39
  }
37
- (
38
- // @ts-ignore
39
- typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function"
40
- );
41
40
  function utf8ToBytes(str) {
42
41
  if (typeof str !== "string")
43
- throw new Error("utf8ToBytes expected string, got " + typeof str);
42
+ throw new Error("string expected");
44
43
  return new Uint8Array(new TextEncoder().encode(str));
45
44
  }
46
45
  function toBytes(data) {
@@ -50,12 +49,8 @@ function toBytes(data) {
50
49
  return data;
51
50
  }
52
51
  var Hash = class {
53
- // Safe version that clones internal state
54
- clone() {
55
- return this._cloneInto();
56
- }
57
52
  };
58
- function wrapConstructor(hashCons) {
53
+ function createHasher(hashCons) {
59
54
  const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
60
55
  const tmp = hashCons();
61
56
  hashC.outputLen = tmp.outputLen;
@@ -64,7 +59,7 @@ function wrapConstructor(hashCons) {
64
59
  return hashC;
65
60
  }
66
61
 
67
- // ../../node_modules/.pnpm/@noble+hashes@1.7.2/node_modules/@noble/hashes/esm/_md.js
62
+ // ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
68
63
  function setBigUint64(view, byteOffset, value, isLE) {
69
64
  if (typeof view.setBigUint64 === "function")
70
65
  return view.setBigUint64(byteOffset, value, isLE);
@@ -99,8 +94,9 @@ var HashMD = class extends Hash {
99
94
  }
100
95
  update(data) {
101
96
  aexists(this);
102
- const { view, buffer, blockLen } = this;
103
97
  data = toBytes(data);
98
+ abytes(data);
99
+ const { view, buffer, blockLen } = this;
104
100
  const len = data.length;
105
101
  for (let pos = 0; pos < len; ) {
106
102
  const take = Math.min(blockLen - this.pos, len - pos);
@@ -129,7 +125,7 @@ var HashMD = class extends Hash {
129
125
  const { buffer, view, blockLen, isLE } = this;
130
126
  let { pos } = this;
131
127
  buffer[pos++] = 128;
132
- this.buffer.subarray(pos).fill(0);
128
+ clean(this.buffer.subarray(pos));
133
129
  if (this.padOffset > blockLen - pos) {
134
130
  this.process(view, 0);
135
131
  pos = 0;
@@ -160,18 +156,31 @@ var HashMD = class extends Hash {
160
156
  to || (to = new this.constructor());
161
157
  to.set(...this.get());
162
158
  const { blockLen, buffer, length, finished, destroyed, pos } = this;
159
+ to.destroyed = destroyed;
160
+ to.finished = finished;
163
161
  to.length = length;
164
162
  to.pos = pos;
165
- to.finished = finished;
166
- to.destroyed = destroyed;
167
163
  if (length % blockLen)
168
164
  to.buffer.set(buffer);
169
165
  return to;
170
166
  }
167
+ clone() {
168
+ return this._cloneInto();
169
+ }
171
170
  };
171
+ var SHA256_IV = /* @__PURE__ */ Uint32Array.from([
172
+ 1779033703,
173
+ 3144134277,
174
+ 1013904242,
175
+ 2773480762,
176
+ 1359893119,
177
+ 2600822924,
178
+ 528734635,
179
+ 1541459225
180
+ ]);
172
181
 
173
- // ../../node_modules/.pnpm/@noble+hashes@1.7.2/node_modules/@noble/hashes/esm/sha256.js
174
- var SHA256_K = /* @__PURE__ */ new Uint32Array([
182
+ // ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js
183
+ var SHA256_K = /* @__PURE__ */ Uint32Array.from([
175
184
  1116352408,
176
185
  1899447441,
177
186
  3049323471,
@@ -237,16 +246,6 @@ var SHA256_K = /* @__PURE__ */ new Uint32Array([
237
246
  3204031479,
238
247
  3329325298
239
248
  ]);
240
- var SHA256_IV = /* @__PURE__ */ new Uint32Array([
241
- 1779033703,
242
- 3144134277,
243
- 1013904242,
244
- 2773480762,
245
- 1359893119,
246
- 2600822924,
247
- 528734635,
248
- 1541459225
249
- ]);
250
249
  var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
251
250
  var SHA256 = class extends HashMD {
252
251
  constructor(outputLen = 32) {
@@ -311,16 +310,19 @@ var SHA256 = class extends HashMD {
311
310
  this.set(A, B2, C, D, E, F, G, H);
312
311
  }
313
312
  roundClean() {
314
- SHA256_W.fill(0);
313
+ clean(SHA256_W);
315
314
  }
316
315
  destroy() {
317
316
  this.set(0, 0, 0, 0, 0, 0, 0, 0);
318
- this.buffer.fill(0);
317
+ clean(this.buffer);
319
318
  }
320
319
  };
321
- var sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
320
+ var sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
321
+
322
+ // ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha256.js
323
+ var sha2562 = sha256;
322
324
 
323
- // ../../node_modules/.pnpm/@scure+base@1.2.4/node_modules/@scure/base/lib/esm/index.js
325
+ // ../../node_modules/.pnpm/@scure+base@1.2.5/node_modules/@scure/base/lib/esm/index.js
324
326
  function isBytes2(a) {
325
327
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
326
328
  }
@@ -502,7 +504,7 @@ function checksum(len, fn) {
502
504
  }
503
505
  var genBase58 = /* @__NO_SIDE_EFFECTS__ */ (abc) => /* @__PURE__ */ chain(/* @__PURE__ */ radix(58), /* @__PURE__ */ alphabet(abc), /* @__PURE__ */ join(""));
504
506
  var base58 = /* @__PURE__ */ genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
505
- var createBase58check = (sha2563) => /* @__PURE__ */ chain(checksum(4, (data) => sha2563(sha2563(data))), base58);
507
+ var createBase58check = (sha2564) => /* @__PURE__ */ chain(checksum(4, (data) => sha2564(sha2564(data))), base58);
506
508
  var base58check = createBase58check;
507
509
  var HEXES = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
508
510
  var HexChar = {
@@ -549,12 +551,12 @@ var hex2 = {
549
551
  encode: bytesToHex,
550
552
  decode: hexToBytes
551
553
  };
552
- base58check(sha2562);
554
+ base58check(sha2563);
553
555
  function ensureBytes(input) {
554
556
  return typeof input === "string" ? hex2.decode(input) : input;
555
557
  }
556
- function sha2562(message) {
557
- return sha256(ensureBytes(message));
558
+ function sha2563(message) {
559
+ return sha2562(ensureBytes(message));
558
560
  }
559
561
  var RETRY_STATUS_CODES = /* @__PURE__ */ new Set([
560
562
  408,