postchain-client 2.0.3 → 2.0.4
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/README.md +5 -0
- package/built/cjs/index.js +45 -45
- package/built/cjs/index.js.map +1 -1
- package/built/esm/index.js +3191 -377
- package/built/esm/index.js.map +1 -1
- package/built/src/ICCF/IccfProofTxMaterialBuilder.d.ts +1 -0
- package/built/src/ICCF/IccfProofTxMaterialBuilder.js.map +1 -1
- package/built/src/ICCF/error.d.ts +1 -0
- package/built/src/ICCF/error.js.map +1 -1
- package/built/src/ICCF/interfaces.d.ts +1 -0
- package/built/src/ICCF/types.d.ts +1 -0
- package/built/src/ICCF/utils.d.ts +1 -0
- package/built/src/ICCF/utils.js +1 -0
- package/built/src/ICCF/utils.js.map +1 -1
- package/built/src/blockchainClient/blockchainClient.js.map +1 -1
- package/built/src/blockchainClient/errors.d.ts +1 -0
- package/built/src/blockchainClient/errors.js.map +1 -1
- package/built/src/blockchainClient/httpUtil.d.ts +1 -0
- package/built/src/blockchainClient/httpUtil.js +1 -0
- package/built/src/blockchainClient/httpUtil.js.map +1 -1
- package/built/src/blockchainClient/interface.d.ts +1 -0
- package/built/src/blockchainClient/requestWithFailoverStrategy.d.ts +1 -0
- package/built/src/blockchainClient/requestWithFailoverStrategy.js.map +1 -1
- package/built/src/blockchainClient/types.d.ts +1 -0
- package/built/src/blockchainClient/utils.d.ts +1 -0
- package/built/src/blockchainClient/utils.js +1 -0
- package/built/src/blockchainClient/utils.js.map +1 -1
- package/built/src/blockchainClient/validation/anchoringTransaction.d.ts +1 -0
- package/built/src/blockchainClient/validation/anchoringTransaction.js +1 -0
- package/built/src/blockchainClient/validation/anchoringTransaction.js.map +1 -1
- package/built/src/blockchainClient/validation/bufferSchema.d.ts +1 -0
- package/built/src/blockchainClient/validation/bufferSchema.js +1 -0
- package/built/src/blockchainClient/validation/bufferSchema.js.map +1 -1
- package/built/src/blockchainClient/validation/merkleHash.js +0 -1
- package/built/src/blockchainClient/validation/merkleHash.js.map +1 -1
- package/built/src/blockchainClient/validation/rawGtx.js +1 -0
- package/built/src/blockchainClient/validation/rawGtx.js.map +1 -1
- package/built/src/blockchainClient/validation/requests.js +1 -0
- package/built/src/blockchainClient/validation/requests.js.map +1 -1
- package/built/src/blockchainClient/validation/txRid.d.ts +1 -0
- package/built/src/blockchainClient/validation/txRid.js.map +1 -1
- package/built/src/encryption/encryption.d.ts +1 -0
- package/built/src/encryption/encryption.js +1 -0
- package/built/src/encryption/encryption.js.map +1 -1
- package/built/src/encryption/errors.d.ts +1 -0
- package/built/src/encryption/errors.js.map +1 -1
- package/built/src/encryption/types.d.ts +1 -0
- package/built/src/formatter.d.ts +1 -0
- package/built/src/formatter.js +1 -0
- package/built/src/formatter.js.map +1 -1
- package/built/src/gtv/types.d.ts +1 -0
- package/built/src/gtx/gtx.d.ts +1 -0
- package/built/src/gtx/gtx.js +1 -0
- package/built/src/gtx/gtx.js.map +1 -1
- package/built/src/gtx/serialization.d.ts +1 -0
- package/built/src/gtx/serialization.js +1 -0
- package/built/src/gtx/serialization.js.map +1 -1
- package/built/src/gtx/types.d.ts +1 -0
- package/built/src/utils/calculateTransactionRid.d.ts +1 -0
- package/built/src/utils/calculateTransactionRid.js.map +1 -1
- package/built/src/utils/decodeTransactionToGtx.d.ts +1 -0
- package/built/src/utils/decodeTransactionToGtx.js.map +1 -1
- package/built/src/utils/dump.js +1 -0
- package/built/src/utils/dump.js.map +1 -1
- package/built/src/utils/encodeTransaction.d.ts +1 -0
- package/built/src/utils/encodeTransaction.js.map +1 -1
- package/built/umd/index.js +0 -1
- package/built/umd/index.js.map +1 -1
- package/changelog.md +17 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -451,6 +451,11 @@ Backend
|
|
|
451
451
|
|
|
452
452
|
## Contributing to the Project
|
|
453
453
|
|
|
454
|
+
### Code conventions
|
|
455
|
+
|
|
456
|
+
* Remember to `import { Buffer } from "buffer";` in all `.ts` and `.js` files in `src/` which refers to `Buffer` to
|
|
457
|
+
ensure seamless functionality in web browsers.
|
|
458
|
+
|
|
454
459
|
### Run tests
|
|
455
460
|
|
|
456
461
|
Unit tests:
|
package/built/cjs/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var merklehashts = require('merklehashts');
|
|
4
|
+
var buffer = require('buffer');
|
|
4
5
|
var bn_js = require('bn.js');
|
|
5
6
|
var zod = require('zod');
|
|
6
7
|
var crypto = require('crypto');
|
|
@@ -84,7 +85,7 @@ class MissingSignerException extends CustomError {
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
const bufferSchema = zod.z.custom(val => Buffer.isBuffer(val), {
|
|
88
|
+
const bufferSchema = zod.z.custom(val => buffer.Buffer.isBuffer(val), {
|
|
88
89
|
message: "Expected Buffer",
|
|
89
90
|
});
|
|
90
91
|
const rawGtvSchema = zod.z.lazy(() => zod.z.union([
|
|
@@ -105,11 +106,11 @@ function isRawGtx(value) {
|
|
|
105
106
|
return result.success;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
function pgBytes(buffer) {
|
|
109
|
-
if (!Buffer.isBuffer(buffer)) {
|
|
110
|
-
throw new PgBytesInputException(buffer);
|
|
109
|
+
function pgBytes(buffer$1) {
|
|
110
|
+
if (!buffer.Buffer.isBuffer(buffer$1)) {
|
|
111
|
+
throw new PgBytesInputException(buffer$1);
|
|
111
112
|
}
|
|
112
|
-
return `\\x${buffer.toString("hex")}`;
|
|
113
|
+
return `\\x${buffer$1.toString("hex")}`;
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
116
|
* Converts hex string to Buffer
|
|
@@ -117,7 +118,7 @@ function pgBytes(buffer) {
|
|
|
117
118
|
* @returns {Buffer}
|
|
118
119
|
*/
|
|
119
120
|
function toBuffer(key) {
|
|
120
|
-
return Buffer.from(key, "hex");
|
|
121
|
+
return buffer.Buffer.from(key, "hex");
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
123
124
|
* Converts Buffer to hex string
|
|
@@ -142,7 +143,7 @@ class PgBytesInputException extends Error {
|
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
function ensureBuffer(value) {
|
|
145
|
-
if (value instanceof Buffer) {
|
|
146
|
+
if (value instanceof buffer.Buffer) {
|
|
146
147
|
return value;
|
|
147
148
|
}
|
|
148
149
|
else {
|
|
@@ -162,7 +163,7 @@ function checkGtvType(value) {
|
|
|
162
163
|
if (value == null) {
|
|
163
164
|
return true;
|
|
164
165
|
}
|
|
165
|
-
if (Buffer.isBuffer(value)) {
|
|
166
|
+
if (buffer.Buffer.isBuffer(value)) {
|
|
166
167
|
return true;
|
|
167
168
|
}
|
|
168
169
|
if (typeof value === "string" || typeof value === "bigint") {
|
|
@@ -228,7 +229,7 @@ function removeDuplicateSigners(signers) {
|
|
|
228
229
|
});
|
|
229
230
|
const result = [];
|
|
230
231
|
signersAsString.forEach(item => {
|
|
231
|
-
result.push(Buffer.from(item, "hex"));
|
|
232
|
+
result.push(buffer.Buffer.from(item, "hex"));
|
|
232
233
|
});
|
|
233
234
|
return result;
|
|
234
235
|
}
|
|
@@ -317,7 +318,7 @@ function createTypedArg(value) {
|
|
|
317
318
|
if (value == null) {
|
|
318
319
|
return { type: "null", value: null };
|
|
319
320
|
}
|
|
320
|
-
if (Buffer.isBuffer(value)) {
|
|
321
|
+
if (buffer.Buffer.isBuffer(value)) {
|
|
321
322
|
return { type: "byteArray", value: value };
|
|
322
323
|
}
|
|
323
324
|
if (typeof value === "boolean") {
|
|
@@ -423,7 +424,7 @@ class MissingPrivKeyArgumentException extends Error {
|
|
|
423
424
|
|
|
424
425
|
function createPublicKey(privKey) {
|
|
425
426
|
validatePrivKeyFormat(privKey);
|
|
426
|
-
return Buffer.from(secp256k1__namespace.publicKeyCreate(privKey, true).buffer);
|
|
427
|
+
return buffer.Buffer.from(secp256k1__namespace.publicKeyCreate(privKey, true).buffer);
|
|
427
428
|
}
|
|
428
429
|
function randomBytes(size) {
|
|
429
430
|
return crypto__namespace.randomBytes(size);
|
|
@@ -433,7 +434,7 @@ function sha256(buffer) {
|
|
|
433
434
|
}
|
|
434
435
|
const hash256 = sha256;
|
|
435
436
|
function hashConcat(items) {
|
|
436
|
-
return hash256(Buffer.concat(items));
|
|
437
|
+
return hash256(buffer.Buffer.concat(items));
|
|
437
438
|
}
|
|
438
439
|
/**
|
|
439
440
|
* @param content the content that the signature signs. It will be digested before validating.
|
|
@@ -474,7 +475,7 @@ function sign$1(content, privKey) {
|
|
|
474
475
|
* @return the signature
|
|
475
476
|
*/
|
|
476
477
|
function signDigest(digestBuffer, privKey) {
|
|
477
|
-
return Buffer.from(secp256k1__namespace.ecdsaSign(digestBuffer, privKey).signature);
|
|
478
|
+
return buffer.Buffer.from(secp256k1__namespace.ecdsaSign(digestBuffer, privKey).signature);
|
|
478
479
|
}
|
|
479
480
|
/**
|
|
480
481
|
* Creates a key pair (which usually represents one user)
|
|
@@ -491,7 +492,7 @@ function makeKeyPair(privKey) {
|
|
|
491
492
|
do {
|
|
492
493
|
privKey = randomBytes(32);
|
|
493
494
|
} while (!secp256k1__namespace.privateKeyVerify(privKey));
|
|
494
|
-
pubKey = Buffer.from(secp256k1__namespace.publicKeyCreate(privKey).buffer);
|
|
495
|
+
pubKey = buffer.Buffer.from(secp256k1__namespace.publicKeyCreate(privKey).buffer);
|
|
495
496
|
}
|
|
496
497
|
return { pubKey, privKey };
|
|
497
498
|
}
|
|
@@ -509,14 +510,14 @@ function makeTuid() {
|
|
|
509
510
|
*/
|
|
510
511
|
function verifyKeyPair(privKey) {
|
|
511
512
|
validatePrivKeyFormat(privKey);
|
|
512
|
-
const pubKey = Buffer.from(secp256k1__namespace.publicKeyCreate(privKey).buffer);
|
|
513
|
+
const pubKey = buffer.Buffer.from(secp256k1__namespace.publicKeyCreate(privKey).buffer);
|
|
513
514
|
return { pubKey, privKey };
|
|
514
515
|
}
|
|
515
516
|
function validatePrivKeyFormat(privKey) {
|
|
516
517
|
if (!privKey) {
|
|
517
518
|
throw new MissingPrivKeyArgumentException();
|
|
518
519
|
}
|
|
519
|
-
if (!Buffer.isBuffer(privKey) || privKey.length !== 32) {
|
|
520
|
+
if (!buffer.Buffer.isBuffer(privKey) || privKey.length !== 32) {
|
|
520
521
|
throw new PrivKeyFormatException(privKey);
|
|
521
522
|
}
|
|
522
523
|
}
|
|
@@ -614,7 +615,7 @@ function gtxToRawGtx(gtx) {
|
|
|
614
615
|
}
|
|
615
616
|
function sign(gtx, privOrSigProv, merkleHashVersion, pubKey) {
|
|
616
617
|
return __awaiter$9(this, void 0, void 0, function* () {
|
|
617
|
-
if (privOrSigProv instanceof Buffer) {
|
|
618
|
+
if (privOrSigProv instanceof buffer.Buffer) {
|
|
618
619
|
const digestToSign = getDigestToSign(gtx, merkleHashVersion);
|
|
619
620
|
const signature = signDigest(digestToSign, privOrSigProv);
|
|
620
621
|
return addSignature(pubKey || makeKeyPair(privOrSigProv).pubKey, signature, gtx);
|
|
@@ -721,7 +722,7 @@ function rawGtvToGtx(gtv) {
|
|
|
721
722
|
throw new Error("Second element must be an array");
|
|
722
723
|
}
|
|
723
724
|
gtvArray[1].forEach(element => {
|
|
724
|
-
if (!Buffer.isBuffer(element)) {
|
|
725
|
+
if (!buffer.Buffer.isBuffer(element)) {
|
|
725
726
|
throw new Error("Element must be a buffer");
|
|
726
727
|
}
|
|
727
728
|
});
|
|
@@ -733,7 +734,7 @@ function rawGtvToGtxBody(gtv) {
|
|
|
733
734
|
throw new Error("Gtv must be an array of size 3");
|
|
734
735
|
}
|
|
735
736
|
const array = gtv;
|
|
736
|
-
if (!Buffer.isBuffer(array[0])) {
|
|
737
|
+
if (!buffer.Buffer.isBuffer(array[0])) {
|
|
737
738
|
throw new Error("First element must be a byte array");
|
|
738
739
|
}
|
|
739
740
|
if (!Array.isArray(array[1])) {
|
|
@@ -743,7 +744,7 @@ function rawGtvToGtxBody(gtv) {
|
|
|
743
744
|
throw new Error("Third element must be an array");
|
|
744
745
|
}
|
|
745
746
|
array[2].forEach(element => {
|
|
746
|
-
if (!Buffer.isBuffer(element)) {
|
|
747
|
+
if (!buffer.Buffer.isBuffer(element)) {
|
|
747
748
|
throw new Error("Element must be a buffer");
|
|
748
749
|
}
|
|
749
750
|
});
|
|
@@ -1095,7 +1096,7 @@ const createNodeManager = ({ nodeUrls, useStickyNode = false, unavailableDuratio
|
|
|
1095
1096
|
};
|
|
1096
1097
|
};
|
|
1097
1098
|
|
|
1098
|
-
const BufferSchema = zod.z.union([zod.z.instanceof(Uint8Array), zod.z.instanceof(Buffer)]);
|
|
1099
|
+
const BufferSchema = zod.z.union([zod.z.instanceof(Uint8Array), zod.z.instanceof(buffer.Buffer)]);
|
|
1099
1100
|
|
|
1100
1101
|
const TxRidSchema = BufferSchema.refine(x => x.length === 32, "Rid must be 32 bytes long");
|
|
1101
1102
|
const isTxRidValid = (rid, options) => {
|
|
@@ -1117,12 +1118,12 @@ const isTxRidValid = (rid, options) => {
|
|
|
1117
1118
|
};
|
|
1118
1119
|
|
|
1119
1120
|
const AnchoringTransactionSchema = zod.z.object({
|
|
1120
|
-
txRid: zod.z.instanceof(Buffer).superRefine((rid, refCtx) => {
|
|
1121
|
+
txRid: zod.z.instanceof(buffer.Buffer).superRefine((rid, refCtx) => {
|
|
1121
1122
|
const txRidValidation = TxRidSchema.safeParse(rid);
|
|
1122
1123
|
if (!txRidValidation.success)
|
|
1123
1124
|
txRidValidation.error.issues.forEach(issue => refCtx.addIssue(issue));
|
|
1124
1125
|
}),
|
|
1125
|
-
txData: zod.z.instanceof(Buffer).refine(data => data.length > 0, {
|
|
1126
|
+
txData: zod.z.instanceof(buffer.Buffer).refine(data => data.length > 0, {
|
|
1126
1127
|
message: "txData must be a non-empty Buffer",
|
|
1127
1128
|
}),
|
|
1128
1129
|
txOpIndex: zod.z.number().int().nonnegative({ message: "txOpIndex must be a non-negative integer" }),
|
|
@@ -1169,7 +1170,7 @@ const RawGtvSchema = zod.z.union([
|
|
|
1169
1170
|
zod.z.string(),
|
|
1170
1171
|
zod.z.number(),
|
|
1171
1172
|
zod.z.bigint(),
|
|
1172
|
-
zod.z.instanceof(Buffer),
|
|
1173
|
+
zod.z.instanceof(buffer.Buffer),
|
|
1173
1174
|
zod.z.array(zod.z.unknown()),
|
|
1174
1175
|
zod.z.record(zod.z.unknown()),
|
|
1175
1176
|
]);
|
|
@@ -1199,9 +1200,9 @@ const TransactionConfirmationProofSchema = zod.z.object({
|
|
|
1199
1200
|
proof: zod.z.string(),
|
|
1200
1201
|
});
|
|
1201
1202
|
const ConfirmationProofSchema = zod.z.object({
|
|
1202
|
-
hash: zod.z.instanceof(Buffer),
|
|
1203
|
-
blockHeader: zod.z.instanceof(Buffer),
|
|
1204
|
-
witness: zod.z.instanceof(Buffer),
|
|
1203
|
+
hash: zod.z.instanceof(buffer.Buffer),
|
|
1204
|
+
blockHeader: zod.z.instanceof(buffer.Buffer),
|
|
1205
|
+
witness: zod.z.instanceof(buffer.Buffer),
|
|
1205
1206
|
merkleProofTree: RawGtvSchema,
|
|
1206
1207
|
txIndex: zod.z.number(),
|
|
1207
1208
|
});
|
|
@@ -1216,17 +1217,17 @@ const TransactionInfoResponseSchema = zod.z.object({
|
|
|
1216
1217
|
txData: zod.z.string(),
|
|
1217
1218
|
});
|
|
1218
1219
|
const TransactionInfoSchema = zod.z.object({
|
|
1219
|
-
blockRid: zod.z.instanceof(Buffer),
|
|
1220
|
+
blockRid: zod.z.instanceof(buffer.Buffer),
|
|
1220
1221
|
blockHeight: zod.z.number(),
|
|
1221
|
-
blockHeader: zod.z.instanceof(Buffer),
|
|
1222
|
-
witness: zod.z.instanceof(Buffer),
|
|
1222
|
+
blockHeader: zod.z.instanceof(buffer.Buffer),
|
|
1223
|
+
witness: zod.z.instanceof(buffer.Buffer),
|
|
1223
1224
|
timestamp: zod.z.number(),
|
|
1224
|
-
txRid: zod.z.instanceof(Buffer),
|
|
1225
|
-
txHash: zod.z.instanceof(Buffer),
|
|
1226
|
-
txData: zod.z.instanceof(Buffer),
|
|
1225
|
+
txRid: zod.z.instanceof(buffer.Buffer),
|
|
1226
|
+
txHash: zod.z.instanceof(buffer.Buffer),
|
|
1227
|
+
txData: zod.z.instanceof(buffer.Buffer),
|
|
1227
1228
|
});
|
|
1228
1229
|
zod.z.object({
|
|
1229
|
-
txRid: zod.z.instanceof(Buffer),
|
|
1230
|
+
txRid: zod.z.instanceof(buffer.Buffer),
|
|
1230
1231
|
rejectReason: zod.z.string(),
|
|
1231
1232
|
rejectTimestamp: zod.z.number(),
|
|
1232
1233
|
});
|
|
@@ -1315,7 +1316,6 @@ const MerkleHashSchema = zod.z.object({
|
|
|
1315
1316
|
const validateMerkleHash = (data) => {
|
|
1316
1317
|
const result = MerkleHashSchema.safeParse(data);
|
|
1317
1318
|
if (!result.success) {
|
|
1318
|
-
console.warn("MERKLE_HASH_WARNING: version not found or endpoint unreachable");
|
|
1319
1319
|
return { merkle_hash_version: MERKLE_HASH_VERSIONS.ONE };
|
|
1320
1320
|
}
|
|
1321
1321
|
return result.data;
|
|
@@ -1381,7 +1381,7 @@ function post(path, endpoint, requestBody) {
|
|
|
1381
1381
|
return __awaiter$8(this, void 0, void 0, function* () {
|
|
1382
1382
|
debug(`POST URL ${new URL(path, endpoint).href}`);
|
|
1383
1383
|
debug(`POST body ${JSON.stringify(requestBody)}`);
|
|
1384
|
-
if (Buffer.isBuffer(requestBody)) {
|
|
1384
|
+
if (buffer.Buffer.isBuffer(requestBody)) {
|
|
1385
1385
|
try {
|
|
1386
1386
|
const requestOptions = {
|
|
1387
1387
|
method: "post",
|
|
@@ -1423,8 +1423,8 @@ function constructBufferResponseBody(response) {
|
|
|
1423
1423
|
const contentType = response.headers.get("content-type");
|
|
1424
1424
|
if (contentType === "application/octet-stream") {
|
|
1425
1425
|
const responseBuffer = yield response.arrayBuffer();
|
|
1426
|
-
const buffer = Buffer.from(responseBuffer);
|
|
1427
|
-
return decodeValue(buffer);
|
|
1426
|
+
const buffer$1 = buffer.Buffer.from(responseBuffer);
|
|
1427
|
+
return decodeValue(buffer$1);
|
|
1428
1428
|
}
|
|
1429
1429
|
if (contentType === "application/json") {
|
|
1430
1430
|
return yield response.json();
|
|
@@ -1858,13 +1858,13 @@ function convertToRellOperation(operations) {
|
|
|
1858
1858
|
}
|
|
1859
1859
|
function getSerializedGTX(gtx) {
|
|
1860
1860
|
const gtxBytes = encodeTransaction(gtx);
|
|
1861
|
-
if (!Buffer.isBuffer(gtxBytes)) {
|
|
1861
|
+
if (!buffer.Buffer.isBuffer(gtxBytes)) {
|
|
1862
1862
|
throw new SerializedTransactionFormatException();
|
|
1863
1863
|
}
|
|
1864
1864
|
return gtxBytes;
|
|
1865
1865
|
}
|
|
1866
1866
|
function getGTXFromBufferOrTransactionOrOperation(transaction, blockchainRid) {
|
|
1867
|
-
if (Buffer.isBuffer(transaction)) {
|
|
1867
|
+
if (buffer.Buffer.isBuffer(transaction)) {
|
|
1868
1868
|
return deserialize(transaction);
|
|
1869
1869
|
}
|
|
1870
1870
|
else if ("operations" in transaction) {
|
|
@@ -1966,8 +1966,8 @@ const isKeyPair = (keypair) => {
|
|
|
1966
1966
|
keypair !== null &&
|
|
1967
1967
|
"privKey" in keypair &&
|
|
1968
1968
|
"pubKey" in keypair &&
|
|
1969
|
-
keypair.privKey instanceof Buffer &&
|
|
1970
|
-
keypair.pubKey instanceof Buffer);
|
|
1969
|
+
keypair.privKey instanceof buffer.Buffer &&
|
|
1970
|
+
keypair.pubKey instanceof buffer.Buffer);
|
|
1971
1971
|
};
|
|
1972
1972
|
function getNodeUrlsFromSettings(settings) {
|
|
1973
1973
|
var _a;
|
|
@@ -2376,7 +2376,7 @@ function fetchAndVerifyTransaction(sourceClient, txToProveRID, proofHash, txToPr
|
|
|
2376
2376
|
const rawTx = yield sourceClient.getTransaction(txToProveRID);
|
|
2377
2377
|
const txGtv = decodeValue(rawTx);
|
|
2378
2378
|
const fetchedTxHash = gtvHash2(txGtv, sourceClient.config.merkleHashVersion);
|
|
2379
|
-
if (Buffer.compare(fetchedTxHash, proofHash)) {
|
|
2379
|
+
if (buffer.Buffer.compare(fetchedTxHash, proofHash)) {
|
|
2380
2380
|
// We received another hash for tx RID than what was included in proof
|
|
2381
2381
|
// Possibly rouge or faulty node(s). Anyway, we need to give up.
|
|
2382
2382
|
throw new MissingTransactionProof(proofHash, fetchedTxHash);
|
|
@@ -2386,7 +2386,7 @@ function fetchAndVerifyTransaction(sourceClient, txToProveRID, proofHash, txToPr
|
|
|
2386
2386
|
throw new DifferentNumberOfSignersException((_c = (_b = fetchedTx.signatures) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0, txToProveSigners.length);
|
|
2387
2387
|
}
|
|
2388
2388
|
const txRID = getDigestToSign(fetchedTx, sourceClient.config.merkleHashVersion);
|
|
2389
|
-
if (Buffer.compare(txRID, ensureBuffer(txToProveRID))) {
|
|
2389
|
+
if (buffer.Buffer.compare(txRID, ensureBuffer(txToProveRID))) {
|
|
2390
2390
|
throw new ProofRidException();
|
|
2391
2391
|
}
|
|
2392
2392
|
for (const signer of txToProveSigners) {
|
|
@@ -3610,7 +3610,7 @@ function dumpGtv(rawGtv) {
|
|
|
3610
3610
|
if (typeof value === "bigint") {
|
|
3611
3611
|
return `${value.toString()}L`;
|
|
3612
3612
|
}
|
|
3613
|
-
if (Buffer.isBuffer(value)) {
|
|
3613
|
+
if (buffer.Buffer.isBuffer(value)) {
|
|
3614
3614
|
return toString(value);
|
|
3615
3615
|
}
|
|
3616
3616
|
if (typeof value === "object" &&
|