@fleet-sdk/blockchain-providers 0.8.2 → 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/CHANGELOG.md +16 -0
- package/dist/index.d.mts +559 -2
- package/dist/index.d.ts +559 -2
- package/dist/index.js +51 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -5,7 +5,7 @@ var core = require('@fleet-sdk/core');
|
|
5
5
|
|
6
6
|
// src/ergo-graphql/ergoGraphQLProvider.ts
|
7
7
|
|
8
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
8
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
|
9
9
|
function isBytes(a) {
|
10
10
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
11
11
|
}
|
@@ -28,8 +28,11 @@ function aoutput(out, instance) {
|
|
28
28
|
throw new Error("digestInto() expects output buffer of length at least " + min);
|
29
29
|
}
|
30
30
|
}
|
31
|
-
|
32
|
-
|
31
|
+
function clean(...arrays) {
|
32
|
+
for (let i = 0; i < arrays.length; i++) {
|
33
|
+
arrays[i].fill(0);
|
34
|
+
}
|
35
|
+
}
|
33
36
|
function createView(arr) {
|
34
37
|
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
35
38
|
}
|
@@ -38,7 +41,7 @@ function rotr(word, shift) {
|
|
38
41
|
}
|
39
42
|
function utf8ToBytes(str) {
|
40
43
|
if (typeof str !== "string")
|
41
|
-
throw new Error("
|
44
|
+
throw new Error("string expected");
|
42
45
|
return new Uint8Array(new TextEncoder().encode(str));
|
43
46
|
}
|
44
47
|
function toBytes(data) {
|
@@ -48,12 +51,8 @@ function toBytes(data) {
|
|
48
51
|
return data;
|
49
52
|
}
|
50
53
|
var Hash = class {
|
51
|
-
// Safe version that clones internal state
|
52
|
-
clone() {
|
53
|
-
return this._cloneInto();
|
54
|
-
}
|
55
54
|
};
|
56
|
-
function
|
55
|
+
function createHasher(hashCons) {
|
57
56
|
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
58
57
|
const tmp = hashCons();
|
59
58
|
hashC.outputLen = tmp.outputLen;
|
@@ -62,7 +61,7 @@ function wrapConstructor(hashCons) {
|
|
62
61
|
return hashC;
|
63
62
|
}
|
64
63
|
|
65
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
64
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
|
66
65
|
function setBigUint64(view, byteOffset, value, isLE) {
|
67
66
|
if (typeof view.setBigUint64 === "function")
|
68
67
|
return view.setBigUint64(byteOffset, value, isLE);
|
@@ -84,21 +83,22 @@ function Maj(a, b, c) {
|
|
84
83
|
var HashMD = class extends Hash {
|
85
84
|
constructor(blockLen, outputLen, padOffset, isLE) {
|
86
85
|
super();
|
87
|
-
this.blockLen = blockLen;
|
88
|
-
this.outputLen = outputLen;
|
89
|
-
this.padOffset = padOffset;
|
90
|
-
this.isLE = isLE;
|
91
86
|
this.finished = false;
|
92
87
|
this.length = 0;
|
93
88
|
this.pos = 0;
|
94
89
|
this.destroyed = false;
|
90
|
+
this.blockLen = blockLen;
|
91
|
+
this.outputLen = outputLen;
|
92
|
+
this.padOffset = padOffset;
|
93
|
+
this.isLE = isLE;
|
95
94
|
this.buffer = new Uint8Array(blockLen);
|
96
95
|
this.view = createView(this.buffer);
|
97
96
|
}
|
98
97
|
update(data) {
|
99
98
|
aexists(this);
|
100
|
-
const { view, buffer, blockLen } = this;
|
101
99
|
data = toBytes(data);
|
100
|
+
abytes(data);
|
101
|
+
const { view, buffer, blockLen } = this;
|
102
102
|
const len = data.length;
|
103
103
|
for (let pos = 0; pos < len; ) {
|
104
104
|
const take = Math.min(blockLen - this.pos, len - pos);
|
@@ -127,7 +127,7 @@ var HashMD = class extends Hash {
|
|
127
127
|
const { buffer, view, blockLen, isLE } = this;
|
128
128
|
let { pos } = this;
|
129
129
|
buffer[pos++] = 128;
|
130
|
-
this.buffer.subarray(pos)
|
130
|
+
clean(this.buffer.subarray(pos));
|
131
131
|
if (this.padOffset > blockLen - pos) {
|
132
132
|
this.process(view, 0);
|
133
133
|
pos = 0;
|
@@ -158,18 +158,31 @@ var HashMD = class extends Hash {
|
|
158
158
|
to || (to = new this.constructor());
|
159
159
|
to.set(...this.get());
|
160
160
|
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
161
|
+
to.destroyed = destroyed;
|
162
|
+
to.finished = finished;
|
161
163
|
to.length = length;
|
162
164
|
to.pos = pos;
|
163
|
-
to.finished = finished;
|
164
|
-
to.destroyed = destroyed;
|
165
165
|
if (length % blockLen)
|
166
166
|
to.buffer.set(buffer);
|
167
167
|
return to;
|
168
168
|
}
|
169
|
+
clone() {
|
170
|
+
return this._cloneInto();
|
171
|
+
}
|
169
172
|
};
|
173
|
+
var SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
174
|
+
1779033703,
|
175
|
+
3144134277,
|
176
|
+
1013904242,
|
177
|
+
2773480762,
|
178
|
+
1359893119,
|
179
|
+
2600822924,
|
180
|
+
528734635,
|
181
|
+
1541459225
|
182
|
+
]);
|
170
183
|
|
171
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
172
|
-
var SHA256_K = /* @__PURE__ */
|
184
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js
|
185
|
+
var SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
173
186
|
1116352408,
|
174
187
|
1899447441,
|
175
188
|
3049323471,
|
@@ -235,20 +248,10 @@ var SHA256_K = /* @__PURE__ */ new Uint32Array([
|
|
235
248
|
3204031479,
|
236
249
|
3329325298
|
237
250
|
]);
|
238
|
-
var SHA256_IV = /* @__PURE__ */ new Uint32Array([
|
239
|
-
1779033703,
|
240
|
-
3144134277,
|
241
|
-
1013904242,
|
242
|
-
2773480762,
|
243
|
-
1359893119,
|
244
|
-
2600822924,
|
245
|
-
528734635,
|
246
|
-
1541459225
|
247
|
-
]);
|
248
251
|
var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
249
252
|
var SHA256 = class extends HashMD {
|
250
|
-
constructor() {
|
251
|
-
super(64,
|
253
|
+
constructor(outputLen = 32) {
|
254
|
+
super(64, outputLen, 8, false);
|
252
255
|
this.A = SHA256_IV[0] | 0;
|
253
256
|
this.B = SHA256_IV[1] | 0;
|
254
257
|
this.C = SHA256_IV[2] | 0;
|
@@ -309,16 +312,19 @@ var SHA256 = class extends HashMD {
|
|
309
312
|
this.set(A, B2, C, D, E, F, G, H);
|
310
313
|
}
|
311
314
|
roundClean() {
|
312
|
-
SHA256_W
|
315
|
+
clean(SHA256_W);
|
313
316
|
}
|
314
317
|
destroy() {
|
315
318
|
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
316
|
-
this.buffer
|
319
|
+
clean(this.buffer);
|
317
320
|
}
|
318
321
|
};
|
319
|
-
var sha256 = /* @__PURE__ */
|
322
|
+
var sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
|
323
|
+
|
324
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha256.js
|
325
|
+
var sha2562 = sha256;
|
320
326
|
|
321
|
-
// ../../node_modules/.pnpm/@scure+base@1.2.
|
327
|
+
// ../../node_modules/.pnpm/@scure+base@1.2.5/node_modules/@scure/base/lib/esm/index.js
|
322
328
|
function isBytes2(a) {
|
323
329
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
324
330
|
}
|
@@ -387,7 +393,7 @@ function alphabet(letters) {
|
|
387
393
|
return input.map((letter) => {
|
388
394
|
astr("alphabet.decode", letter);
|
389
395
|
const i = indexes.get(letter);
|
390
|
-
if (i ===
|
396
|
+
if (i === void 0)
|
391
397
|
throw new Error(`Unknown letter: "${letter}". Allowed: ${letters}`);
|
392
398
|
return i;
|
393
399
|
});
|
@@ -500,7 +506,7 @@ function checksum(len, fn) {
|
|
500
506
|
}
|
501
507
|
var genBase58 = /* @__NO_SIDE_EFFECTS__ */ (abc) => /* @__PURE__ */ chain(/* @__PURE__ */ radix(58), /* @__PURE__ */ alphabet(abc), /* @__PURE__ */ join(""));
|
502
508
|
var base58 = /* @__PURE__ */ genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
|
503
|
-
var createBase58check = (
|
509
|
+
var createBase58check = (sha2564) => /* @__PURE__ */ chain(checksum(4, (data) => sha2564(sha2564(data))), base58);
|
504
510
|
var base58check = createBase58check;
|
505
511
|
var HEXES = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
506
512
|
var HexChar = {
|
@@ -547,12 +553,12 @@ var hex2 = {
|
|
547
553
|
encode: bytesToHex,
|
548
554
|
decode: hexToBytes
|
549
555
|
};
|
550
|
-
base58check(
|
556
|
+
base58check(sha2563);
|
551
557
|
function ensureBytes(input) {
|
552
558
|
return typeof input === "string" ? hex2.decode(input) : input;
|
553
559
|
}
|
554
|
-
function
|
555
|
-
return
|
560
|
+
function sha2563(message) {
|
561
|
+
return sha2562(ensureBytes(message));
|
556
562
|
}
|
557
563
|
var RETRY_STATUS_CODES = /* @__PURE__ */ new Set([
|
558
564
|
408,
|
@@ -631,7 +637,7 @@ function createGqlOperation(query, options) {
|
|
631
637
|
body: (options?.parser ?? JSON).stringify({
|
632
638
|
operationName: getOpName(query),
|
633
639
|
query,
|
634
|
-
variables: variables ? common.clearUndefined(variables) :
|
640
|
+
variables: variables ? common.clearUndefined(variables) : void 0
|
635
641
|
})
|
636
642
|
}
|
637
643
|
});
|
@@ -852,7 +858,7 @@ function buildGqlBoxQueries(query) {
|
|
852
858
|
);
|
853
859
|
const baseQuery = {
|
854
860
|
spent: false,
|
855
|
-
boxIds: query.where.boxId ? [query.where.boxId] :
|
861
|
+
boxIds: query.where.boxId ? [query.where.boxId] : void 0,
|
856
862
|
ergoTreeTemplateHash: query.where.templateHash,
|
857
863
|
tokenId: query.where.tokenId,
|
858
864
|
skip: query.skip ?? 0,
|
@@ -872,7 +878,7 @@ function buildGqlUnconfirmedTxQueries(query) {
|
|
872
878
|
].flat()
|
873
879
|
);
|
874
880
|
const baseQuery = {
|
875
|
-
transactionIds: query.where.transactionId ? [query.where.transactionId] :
|
881
|
+
transactionIds: query.where.transactionId ? [query.where.transactionId] : void 0,
|
876
882
|
skip: query.skip ?? 0,
|
877
883
|
take: query.take ?? PAGE_SIZE
|
878
884
|
};
|
@@ -964,7 +970,7 @@ function mapConfirmedTransaction(tx, mapper) {
|
|
964
970
|
};
|
965
971
|
}
|
966
972
|
function isRequestParam(obj) {
|
967
|
-
return typeof obj === "object" && obj.url !==
|
973
|
+
return typeof obj === "object" && obj.url !== void 0;
|
968
974
|
}
|
969
975
|
/*! Bundled license information:
|
970
976
|
|