@xyo-network/xl1-protocol-sdk 1.26.17 → 1.26.19
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HydratedBlock,
|
|
1
|
+
import type { HydratedBlock, TransactionBoundWitnessWithHashMeta } from '@xyo-network/xl1-protocol-lib';
|
|
2
2
|
/** transactionsFromHydratedBlock constant. */
|
|
3
|
-
export declare const transactionsFromHydratedBlock: (block: HydratedBlock) =>
|
|
3
|
+
export declare const transactionsFromHydratedBlock: (block: HydratedBlock) => TransactionBoundWitnessWithHashMeta[];
|
|
4
4
|
//# sourceMappingURL=transactionsFromHydratedBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactionsFromHydratedBlock.d.ts","sourceRoot":"","sources":["../../../../src/block/hydrate/transactionsFromHydratedBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"transactionsFromHydratedBlock.d.ts","sourceRoot":"","sources":["../../../../src/block/hydrate/transactionsFromHydratedBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAA;AAGvG,8CAA8C;AAC9C,eAAO,MAAM,6BAA6B,GAAI,OAAO,aAAa,KAAG,mCAAmC,EAEvG,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -379,14 +379,14 @@ var hydrateBlock = async (context, hash, maxDepth = 1, minDepth = maxDepth) => {
|
|
|
379
379
|
};
|
|
380
380
|
|
|
381
381
|
// src/block/hydrate/transactionsFromHydratedBlock.ts
|
|
382
|
-
import {
|
|
382
|
+
import { isTransactionBoundWitnessWithHashMeta } from "@xyo-network/xl1-protocol-lib";
|
|
383
383
|
var transactionsFromHydratedBlock = (block) => {
|
|
384
|
-
return block[1].filter(
|
|
384
|
+
return block[1].filter(isTransactionBoundWitnessWithHashMeta);
|
|
385
385
|
};
|
|
386
386
|
|
|
387
387
|
// src/block/hydrate/tryHydrateBlock.ts
|
|
388
388
|
import { assertEx as assertEx5 } from "@xylabs/sdk-js";
|
|
389
|
-
import { isBlockBoundWitnessWithStorageMeta, isTransactionBoundWitnessWithStorageMeta as
|
|
389
|
+
import { isBlockBoundWitnessWithStorageMeta, isTransactionBoundWitnessWithStorageMeta as isTransactionBoundWitnessWithStorageMeta2 } from "@xyo-network/xl1-protocol-lib";
|
|
390
390
|
var tryHydrateBlock = async (archivist, hash, maxDepth = 1) => {
|
|
391
391
|
assertEx5(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
|
|
392
392
|
const bw = (await archivist.get([hash])).find(isBlockBoundWitnessWithStorageMeta);
|
|
@@ -394,7 +394,7 @@ var tryHydrateBlock = async (archivist, hash, maxDepth = 1) => {
|
|
|
394
394
|
if (maxDepth === 0) return [bw, []];
|
|
395
395
|
const blkPayloads = await archivist.get(bw.payload_hashes);
|
|
396
396
|
if (maxDepth === 1) return [bw, blkPayloads];
|
|
397
|
-
const transactions = blkPayloads.filter(
|
|
397
|
+
const transactions = blkPayloads.filter(isTransactionBoundWitnessWithStorageMeta2);
|
|
398
398
|
const transactionsPayloadHashes = transactions.flatMap((tx) => tx.payload_hashes);
|
|
399
399
|
const transactionsPayloads = await archivist.get(transactionsPayloadHashes);
|
|
400
400
|
const allPayloadsHashes = new Set([...blkPayloads, ...transactionsPayloads].flatMap((p) => p._hash));
|
|
@@ -1628,7 +1628,7 @@ var hydratedTransactionToPayloadBundle = (transaction) => {
|
|
|
1628
1628
|
return bundle2(root, transaction);
|
|
1629
1629
|
};
|
|
1630
1630
|
var bundle2 = (root, transaction) => {
|
|
1631
|
-
const payloads = flattenHydratedTransaction(transaction)
|
|
1631
|
+
const payloads = flattenHydratedTransaction(transaction);
|
|
1632
1632
|
return new PayloadBuilder11({ schema: PayloadBundleSchema2 }).fields({ payloads, root }).build();
|
|
1633
1633
|
};
|
|
1634
1634
|
|
|
@@ -4053,8 +4053,7 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
4053
4053
|
const windowedUncleChain = await this.updateWindowedChainCache();
|
|
4054
4054
|
const uncles = findUncles(this.context, windowedUncleChain, blocks);
|
|
4055
4055
|
if (uncles.length !== 1) {
|
|
4056
|
-
this.logger?.warn(JSON.stringify({ uncles, blocks }, null, 2));
|
|
4057
|
-
this.logger?.warn(JSON.stringify(windowedUncleChain, null, 2));
|
|
4056
|
+
this.logger?.warn(JSON.stringify({ uncles, blocks: blocks.length }, null, 2));
|
|
4058
4057
|
throw new Error(`No uncles or greater than one uncle found in block validation, which is not supported [${uncles.length}, ${blocks.length}]`);
|
|
4059
4058
|
}
|
|
4060
4059
|
return await Promise.all(uncles[0].map(async (block) => {
|
|
@@ -4830,7 +4829,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
|
|
|
4830
4829
|
if (!validationPassed) {
|
|
4831
4830
|
this.logger?.info(`Pruning block bundle ${bundle3._hash} during simpleValidationCheck`);
|
|
4832
4831
|
this.logger?.info(` - chainId match: ${chainIdPassed}`);
|
|
4833
|
-
this.logger?.info(` - blockNumber check: ${blockNumberPassed}`);
|
|
4832
|
+
this.logger?.info(` - blockNumber check: ${blockNumberPassed} [${headNumber}|${block?.[0].block}]`);
|
|
4834
4833
|
this.logger?.info(` - typeCheck: ${typeCheckPassed}`);
|
|
4835
4834
|
this.logger?.info(` - bundle hash: ${bundle3._hash}`);
|
|
4836
4835
|
}
|
|
@@ -5843,7 +5842,7 @@ import {
|
|
|
5843
5842
|
asSignedHydratedTransactionWithHashMeta,
|
|
5844
5843
|
asSignedTransactionBoundWitness,
|
|
5845
5844
|
BlockViewerMoniker as BlockViewerMoniker6,
|
|
5846
|
-
isTransactionBoundWitnessWithHashMeta,
|
|
5845
|
+
isTransactionBoundWitnessWithHashMeta as isTransactionBoundWitnessWithHashMeta2,
|
|
5847
5846
|
TransactionViewerMoniker
|
|
5848
5847
|
} from "@xyo-network/xl1-protocol-lib";
|
|
5849
5848
|
var SimpleTransactionViewer = class extends AbstractCreatableProvider {
|
|
@@ -5861,7 +5860,7 @@ var SimpleTransactionViewer = class extends AbstractCreatableProvider {
|
|
|
5861
5860
|
const blockBoundWitnessIndexes = block[0].payload_schemas.map((schema, index) => schema === BoundWitnessSchema ? index : void 0).filter(exists10);
|
|
5862
5861
|
const blockBoundWitnessHashes = new Set(blockBoundWitnessIndexes.map((index) => block[0].payload_hashes[index]));
|
|
5863
5862
|
const blockBoundWitnesses = block[1].filter((payload) => blockBoundWitnessHashes.has(payload._hash) || blockBoundWitnessHashes.has(payload._dataHash));
|
|
5864
|
-
const blockTransactionBoundWitnesses = blockBoundWitnesses.filter(
|
|
5863
|
+
const blockTransactionBoundWitnesses = blockBoundWitnesses.filter(isTransactionBoundWitnessWithHashMeta2);
|
|
5865
5864
|
const transaction = blockTransactionBoundWitnesses.at(transactionIndex);
|
|
5866
5865
|
if (!transaction) return null;
|
|
5867
5866
|
return await this.byHash(transaction._hash);
|