@xyo-network/xl1-protocol-sdk 1.25.10 → 1.25.11
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/neutral/index.mjs +15 -14
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/simple/TransactionViewer/SimpleTransactionViewer.d.ts +1 -4
- package/dist/neutral/simple/TransactionViewer/SimpleTransactionViewer.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/simple/TransactionViewer/SimpleTransactionViewer.ts +17 -18
package/dist/neutral/index.mjs
CHANGED
|
@@ -5353,6 +5353,8 @@ import {
|
|
|
5353
5353
|
} from "@xylabs/sdk-js";
|
|
5354
5354
|
import { BoundWitnessSchema } from "@xyo-network/sdk-js";
|
|
5355
5355
|
import {
|
|
5356
|
+
asSignedHydratedTransactionWithHashMeta,
|
|
5357
|
+
asSignedTransactionBoundWitness,
|
|
5356
5358
|
BlockViewerMoniker as BlockViewerMoniker5,
|
|
5357
5359
|
isTransactionBoundWitnessWithStorageMeta as isTransactionBoundWitnessWithStorageMeta4,
|
|
5358
5360
|
TransactionViewerMoniker
|
|
@@ -5360,13 +5362,11 @@ import {
|
|
|
5360
5362
|
var SimpleTransactionViewer = class extends AbstractCreatableProvider {
|
|
5361
5363
|
moniker = SimpleTransactionViewer.defaultMoniker;
|
|
5362
5364
|
_blockViewer;
|
|
5363
|
-
_finalizedPayloadMap;
|
|
5364
|
-
_signedHydratedTransactionCache;
|
|
5365
5365
|
get blockViewer() {
|
|
5366
5366
|
return this._blockViewer;
|
|
5367
5367
|
}
|
|
5368
5368
|
async byBlockHashAndIndex(blockHash, transactionIndex) {
|
|
5369
|
-
return await this.spanAsync("
|
|
5369
|
+
return await this.spanAsync("byBlockHashAndIndex", async () => {
|
|
5370
5370
|
assertEx44(transactionIndex >= 0, () => "transactionIndex must be greater than or equal to 0");
|
|
5371
5371
|
try {
|
|
5372
5372
|
const block = await this.blockViewer.blockByHash(blockHash);
|
|
@@ -5384,7 +5384,7 @@ var SimpleTransactionViewer = class extends AbstractCreatableProvider {
|
|
|
5384
5384
|
}, this.context);
|
|
5385
5385
|
}
|
|
5386
5386
|
async byBlockNumberAndIndex(blockNumber, transactionIndex) {
|
|
5387
|
-
return await this.spanAsync("
|
|
5387
|
+
return await this.spanAsync("byBlockNumberAndIndex", async () => {
|
|
5388
5388
|
try {
|
|
5389
5389
|
const block = await this.blockViewer.blockByNumber(blockNumber);
|
|
5390
5390
|
if (!block) return null;
|
|
@@ -5395,16 +5395,23 @@ var SimpleTransactionViewer = class extends AbstractCreatableProvider {
|
|
|
5395
5395
|
}, this.context);
|
|
5396
5396
|
}
|
|
5397
5397
|
async byHash(transactionHash) {
|
|
5398
|
-
return await this.spanAsync("
|
|
5398
|
+
return await this.spanAsync("byHash", async () => {
|
|
5399
5399
|
try {
|
|
5400
|
-
const
|
|
5401
|
-
|
|
5402
|
-
|
|
5400
|
+
const transaction = asSignedTransactionBoundWitness(await this.blockViewer.payloadByHash(transactionHash));
|
|
5401
|
+
if (transaction) {
|
|
5402
|
+
const payloads = await this.blockViewer.payloadsByHash(transaction.payload_hashes);
|
|
5403
|
+
return asSignedHydratedTransactionWithHashMeta([transaction, payloads]) ?? null;
|
|
5404
|
+
}
|
|
5405
|
+
return null;
|
|
5403
5406
|
} catch {
|
|
5404
5407
|
return null;
|
|
5405
5408
|
}
|
|
5406
5409
|
}, this.context);
|
|
5407
5410
|
}
|
|
5411
|
+
async createHandler() {
|
|
5412
|
+
await super.createHandler();
|
|
5413
|
+
this._blockViewer = await this.locator.getInstance(BlockViewerMoniker5);
|
|
5414
|
+
}
|
|
5408
5415
|
async transactionByBlockHashAndIndex(blockHash, transactionIndex = 0) {
|
|
5409
5416
|
return await this.byBlockHashAndIndex(blockHash, transactionIndex);
|
|
5410
5417
|
}
|
|
@@ -5414,12 +5421,6 @@ var SimpleTransactionViewer = class extends AbstractCreatableProvider {
|
|
|
5414
5421
|
async transactionByHash(transactionHash) {
|
|
5415
5422
|
return await this.byHash(transactionHash);
|
|
5416
5423
|
}
|
|
5417
|
-
getHydratedTransactionCache() {
|
|
5418
|
-
if (this._signedHydratedTransactionCache) return this._signedHydratedTransactionCache;
|
|
5419
|
-
const chainMap = this._finalizedPayloadMap;
|
|
5420
|
-
this._signedHydratedTransactionCache = new HydratedCache({ ...this.context, chainMap }, tryHydrateTransaction, 200);
|
|
5421
|
-
return this._signedHydratedTransactionCache;
|
|
5422
|
-
}
|
|
5423
5424
|
};
|
|
5424
5425
|
__publicField(SimpleTransactionViewer, "defaultMoniker", TransactionViewerMoniker);
|
|
5425
5426
|
__publicField(SimpleTransactionViewer, "dependencies", [BlockViewerMoniker5]);
|