@xyo-network/xl1-protocol-sdk 1.25.17 → 1.25.18
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
CHANGED
|
@@ -1193,7 +1193,8 @@ function transactionRequiredGas(hydratedTransaction) {
|
|
|
1193
1193
|
// src/transaction/script.ts
|
|
1194
1194
|
import { asHash as asHash3 } from "@xylabs/sdk-js";
|
|
1195
1195
|
import { assertEx as assertEx8, filterAs } from "@xylabs/sdk-js";
|
|
1196
|
-
import {
|
|
1196
|
+
import { isHashMeta } from "@xyo-network/sdk-js";
|
|
1197
|
+
import { isAllowedBlockPayload as isAllowedBlockPayload3 } from "@xyo-network/xl1-protocol";
|
|
1197
1198
|
var tryExtractElevatedHashesFromScript = (strings) => {
|
|
1198
1199
|
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
1199
1200
|
return filterAs(hashes, (h) => asHash3(h));
|
|
@@ -1208,13 +1209,13 @@ var tryExtractElevatedHashes = (tx) => {
|
|
|
1208
1209
|
const [bw, payloads] = tx;
|
|
1209
1210
|
const { script } = bw;
|
|
1210
1211
|
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
1211
|
-
return payloads.filter((p) => hashes.includes(p._hash)).filter(
|
|
1212
|
+
return payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayload3).filter(isHashMeta);
|
|
1212
1213
|
};
|
|
1213
1214
|
var extractElevatedHashes = (tx) => {
|
|
1214
1215
|
const [bw, payloads] = tx;
|
|
1215
1216
|
const { script } = bw;
|
|
1216
1217
|
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
1217
|
-
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(
|
|
1218
|
+
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayload3).filter(isHashMeta);
|
|
1218
1219
|
assertEx8(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
1219
1220
|
return filtered;
|
|
1220
1221
|
};
|
|
@@ -1247,7 +1248,7 @@ import { PayloadBuilder as PayloadBuilder10 } from "@xyo-network/sdk-js";
|
|
|
1247
1248
|
import {
|
|
1248
1249
|
asXL1BlockNumber as asXL1BlockNumber3,
|
|
1249
1250
|
defaultTransactionFees as defaultTransactionFees3,
|
|
1250
|
-
isAllowedBlockPayload as
|
|
1251
|
+
isAllowedBlockPayload as isAllowedBlockPayload4,
|
|
1251
1252
|
minTransactionFees,
|
|
1252
1253
|
XYO_ZERO_ADDRESS
|
|
1253
1254
|
} from "@xyo-network/xl1-protocol";
|
|
@@ -1293,7 +1294,7 @@ var TransactionBuilder = class extends Base {
|
|
|
1293
1294
|
);
|
|
1294
1295
|
}
|
|
1295
1296
|
elevatedPayload(payload) {
|
|
1296
|
-
const allowedPayload =
|
|
1297
|
+
const allowedPayload = isAllowedBlockPayload4(payload) ? payload : void 0;
|
|
1297
1298
|
const allowPayloadExists = assertEx10(allowedPayload, () => "Payload must be an AllowedBlockPayload");
|
|
1298
1299
|
this._elevatedPayloads.push(allowPayloadExists);
|
|
1299
1300
|
return this;
|
|
@@ -2723,7 +2724,7 @@ async function hydratedBlockByNumber(context, blockNumber) {
|
|
|
2723
2724
|
}
|
|
2724
2725
|
|
|
2725
2726
|
// src/primitives/transaction/elevatedPayloads.ts
|
|
2726
|
-
import { isAllowedBlockPayload as
|
|
2727
|
+
import { isAllowedBlockPayload as isAllowedBlockPayload5 } from "@xyo-network/xl1-protocol";
|
|
2727
2728
|
var ELEVATE_OPCODE = "elevate";
|
|
2728
2729
|
function elevatedPayloads([tx, payloads]) {
|
|
2729
2730
|
const opCodes = (tx.script ?? []).filter((operation) => operation.startsWith(`${ELEVATE_OPCODE}|`));
|
|
@@ -2732,7 +2733,7 @@ function elevatedPayloads([tx, payloads]) {
|
|
|
2732
2733
|
const [code, hash] = opCode.split("|");
|
|
2733
2734
|
if (code === ELEVATE_OPCODE) {
|
|
2734
2735
|
const elevatedPayload = payloads.find((payload) => payload._hash === hash);
|
|
2735
|
-
if (
|
|
2736
|
+
if (isAllowedBlockPayload5(elevatedPayload)) {
|
|
2736
2737
|
elevatedPayloads2.push(elevatedPayload);
|
|
2737
2738
|
}
|
|
2738
2739
|
}
|
|
@@ -3046,7 +3047,7 @@ import { assertEx as assertEx27 } from "@xylabs/sdk-js";
|
|
|
3046
3047
|
import {
|
|
3047
3048
|
isAnyPayload as isAnyPayload3,
|
|
3048
3049
|
isBoundWitness,
|
|
3049
|
-
isHashMeta,
|
|
3050
|
+
isHashMeta as isHashMeta2,
|
|
3050
3051
|
PayloadBuilder as PayloadBuilder16
|
|
3051
3052
|
} from "@xyo-network/sdk-js";
|
|
3052
3053
|
import { StepSizes as StepSizes10 } from "@xyo-network/xl1-protocol";
|
|
@@ -3056,7 +3057,7 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
|
|
|
3056
3057
|
let result = void 0;
|
|
3057
3058
|
if (frameSize === 1) {
|
|
3058
3059
|
const [block, payloads] = assertEx27(await blockViewer.blockByNumber(range[0]), () => `Block not found for number: ${range[0]}`);
|
|
3059
|
-
const boundWitnesses = [block, ...payloads.filter((x) => isBoundWitness(x) &&
|
|
3060
|
+
const boundWitnesses = [block, ...payloads.filter((x) => isBoundWitness(x) && isHashMeta2(x))];
|
|
3060
3061
|
const schemas = {};
|
|
3061
3062
|
for (const bw of boundWitnesses) {
|
|
3062
3063
|
schemas[bw.schema] = (schemas[bw.schema] ?? 0) + 1;
|
|
@@ -4558,7 +4559,7 @@ import {
|
|
|
4558
4559
|
isDefined as isDefined19,
|
|
4559
4560
|
isHash as isHash2
|
|
4560
4561
|
} from "@xylabs/sdk-js";
|
|
4561
|
-
import { isHashMeta as
|
|
4562
|
+
import { isHashMeta as isHashMeta3, isPayloadBundle as isPayloadBundle2 } from "@xyo-network/sdk-js";
|
|
4562
4563
|
import {
|
|
4563
4564
|
MempoolViewerMoniker,
|
|
4564
4565
|
WindowedBlockViewerMoniker
|
|
@@ -4592,7 +4593,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
4592
4593
|
limit: 100,
|
|
4593
4594
|
cursor
|
|
4594
4595
|
});
|
|
4595
|
-
const filteredBundles = bundles.filter(isPayloadBundle2).filter(
|
|
4596
|
+
const filteredBundles = bundles.filter(isPayloadBundle2).filter(isHashMeta3);
|
|
4596
4597
|
return (await Promise.all(filteredBundles.map(async (bundle3) => await bundledPayloadToHydratedBlock(bundle3)))).filter(exists9);
|
|
4597
4598
|
}
|
|
4598
4599
|
async pendingTransactions({
|
|
@@ -4613,7 +4614,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
4613
4614
|
cursor
|
|
4614
4615
|
});
|
|
4615
4616
|
this.logger?.info(`Fetched pending transactions: ${bundles.length} bundles`);
|
|
4616
|
-
const filteredBundles = bundles.filter(isPayloadBundle2).filter(
|
|
4617
|
+
const filteredBundles = bundles.filter(isPayloadBundle2).filter(isHashMeta3);
|
|
4617
4618
|
const hydratedWithBundle = (await Promise.all(
|
|
4618
4619
|
filteredBundles.map(async (bundle3) => {
|
|
4619
4620
|
const tx = await bundledPayloadToHydratedTransaction(bundle3);
|