@xyo-network/xl1-protocol-sdk 4.0.7 → 4.0.8
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/config/index.d.ts +2 -0
- package/dist/neutral/config/index.d.ts.map +1 -1
- package/dist/neutral/config/restConnectionFromS3Bucket.d.ts +5 -0
- package/dist/neutral/config/restConnectionFromS3Bucket.d.ts.map +1 -0
- package/dist/neutral/config/synthesizeMemoryViewerBindings.d.ts +8 -0
- package/dist/neutral/config/synthesizeMemoryViewerBindings.d.ts.map +1 -0
- package/dist/neutral/index.mjs +191 -150
- package/dist/neutral/index.mjs.map +4 -4
- package/dist/node/config/index.d.ts +2 -0
- package/dist/node/config/index.d.ts.map +1 -1
- package/dist/node/config/restConnectionFromS3Bucket.d.ts +5 -0
- package/dist/node/config/restConnectionFromS3Bucket.d.ts.map +1 -0
- package/dist/node/config/synthesizeMemoryViewerBindings.d.ts +8 -0
- package/dist/node/config/synthesizeMemoryViewerBindings.d.ts.map +1 -0
- package/dist/node/index-node.mjs +209 -168
- package/dist/node/index-node.mjs.map +4 -4
- package/package.json +7 -7
package/dist/node/index-node.mjs
CHANGED
|
@@ -12,7 +12,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
12
12
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
13
13
|
|
|
14
14
|
// src/getFileConfig.ts
|
|
15
|
-
import { isDefined as
|
|
15
|
+
import { isDefined as isDefined15, isNull as isNull2 } from "@ariestools/sdk";
|
|
16
16
|
import { cosmiconfig } from "cosmiconfig";
|
|
17
17
|
import { z as z19 } from "zod/mini";
|
|
18
18
|
|
|
@@ -2151,6 +2151,45 @@ function resolveRestConnectionEndpoint(config, moniker) {
|
|
|
2151
2151
|
return baseUrl;
|
|
2152
2152
|
}
|
|
2153
2153
|
|
|
2154
|
+
// src/config/restConnectionFromS3Bucket.ts
|
|
2155
|
+
import { assertEx as assertEx19, isDefined as isDefined14 } from "@ariestools/sdk";
|
|
2156
|
+
function restConnectionFromS3Bucket(bucket) {
|
|
2157
|
+
const baseUrl = assertEx19(
|
|
2158
|
+
isDefined14(bucket.readUrl) && bucket.readUrl !== "" ? bucket.readUrl : void 0,
|
|
2159
|
+
() => "S3 bucket config has no readUrl \u2014 a public read URL is required to derive a REST connection"
|
|
2160
|
+
);
|
|
2161
|
+
return { type: "rest", baseUrl };
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
// src/config/synthesizeMemoryViewerBindings.ts
|
|
2165
|
+
var MEMORY_CONNECTION = "memory";
|
|
2166
|
+
var MEMORY_MONIKERS = [
|
|
2167
|
+
"AccountBalanceViewer",
|
|
2168
|
+
"BlockRewardViewer",
|
|
2169
|
+
"MempoolViewer",
|
|
2170
|
+
"NetworkStakeViewer",
|
|
2171
|
+
"NetworkStakeStepRewardsByPositionViewer",
|
|
2172
|
+
"NetworkStakeStepRewardsByStakerViewer",
|
|
2173
|
+
"NetworkStakeStepRewardsByStepViewer",
|
|
2174
|
+
"NetworkStakeStepRewardsTotalViewer",
|
|
2175
|
+
"NetworkStakeStepRewardsViewer",
|
|
2176
|
+
"StakeEventsViewer",
|
|
2177
|
+
"StakeTotalsViewer",
|
|
2178
|
+
"StakeViewer",
|
|
2179
|
+
"StepViewer",
|
|
2180
|
+
"TimeSyncViewer",
|
|
2181
|
+
"TransactionViewer",
|
|
2182
|
+
"WindowedBlockViewer",
|
|
2183
|
+
"XyoViewer"
|
|
2184
|
+
];
|
|
2185
|
+
function synthesizeMemoryViewerBindings() {
|
|
2186
|
+
const bindings = {};
|
|
2187
|
+
for (const moniker of MEMORY_MONIKERS) {
|
|
2188
|
+
bindings[moniker] = { connection: MEMORY_CONNECTION };
|
|
2189
|
+
}
|
|
2190
|
+
return bindings;
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2154
2193
|
// src/config/synthesizeRpcConnectionBindings.ts
|
|
2155
2194
|
var DEFAULT_RPC_CONNECTION = "default-rpc";
|
|
2156
2195
|
var RPC_MONIKERS = [
|
|
@@ -2228,7 +2267,7 @@ async function getFileConfig(searchPlaces) {
|
|
|
2228
2267
|
const result = searchResult?.config;
|
|
2229
2268
|
if (!isNull2(result)) {
|
|
2230
2269
|
const section = result[configSection];
|
|
2231
|
-
if (
|
|
2270
|
+
if (isDefined15(section) && typeof section === "object") {
|
|
2232
2271
|
return z19.looseObject(ConfigZod.shape).parse(section);
|
|
2233
2272
|
}
|
|
2234
2273
|
}
|
|
@@ -2325,7 +2364,7 @@ var ShiftedBigInt = class _ShiftedBigInt {
|
|
|
2325
2364
|
};
|
|
2326
2365
|
|
|
2327
2366
|
// src/amount/xl1Amount.ts
|
|
2328
|
-
import { assertEx as
|
|
2367
|
+
import { assertEx as assertEx20 } from "@ariestools/sdk";
|
|
2329
2368
|
import {
|
|
2330
2369
|
AttoXL1,
|
|
2331
2370
|
FemtoXL1,
|
|
@@ -2346,7 +2385,7 @@ var XL1Amount = class _XL1Amount {
|
|
|
2346
2385
|
this.value = AttoXL1(value > MAX_XL1_AMOUNT ? MAX_XL1_AMOUNT : value < 0n ? 0n : value);
|
|
2347
2386
|
}
|
|
2348
2387
|
static from(value, places = XL1Places.atto) {
|
|
2349
|
-
|
|
2388
|
+
assertEx20(allowedPlaces.includes(places), () => `Invalid conversion places (${places} not in ${allowedPlaces.join(", ")})`);
|
|
2350
2389
|
return new _XL1Amount(value * 10n ** BigInt(places));
|
|
2351
2390
|
}
|
|
2352
2391
|
static fromMilli(value) {
|
|
@@ -2395,7 +2434,7 @@ var XL1Amount = class _XL1Amount {
|
|
|
2395
2434
|
return XL1(this.to(XL1Places.xl1));
|
|
2396
2435
|
}
|
|
2397
2436
|
toString(places = Number(XL1Places.atto), config = {}) {
|
|
2398
|
-
|
|
2437
|
+
assertEx20(allowedPlaces.includes(BigInt(places)), () => `Invalid conversion places (${places} not in ${allowedPlaces.join(", ")})`);
|
|
2399
2438
|
const shifted = new ShiftedBigInt(
|
|
2400
2439
|
this.value,
|
|
2401
2440
|
{
|
|
@@ -2633,13 +2672,13 @@ function factoryBackingsCompatible(declared, available) {
|
|
|
2633
2672
|
|
|
2634
2673
|
// src/CreatableProvider/ProviderFactoryLocator.ts
|
|
2635
2674
|
import { hasAllLabels } from "@ariestools/sdk";
|
|
2636
|
-
import { assertEx as
|
|
2675
|
+
import { assertEx as assertEx22 } from "@ariestools/sdk";
|
|
2637
2676
|
|
|
2638
2677
|
// src/CreatableProvider/CreatableProviderRegistry.ts
|
|
2639
2678
|
import { isTruthy } from "@ariestools/sdk";
|
|
2640
2679
|
|
|
2641
2680
|
// src/CreatableProvider/ProviderFactory.ts
|
|
2642
|
-
import { assertEx as
|
|
2681
|
+
import { assertEx as assertEx21 } from "@ariestools/sdk";
|
|
2643
2682
|
function providerFactoryDescription(factory, labels) {
|
|
2644
2683
|
return `${factory.providerName}:${factory.defaultMoniker}:${JSON.stringify(labels ?? factory.labels ?? {})}`;
|
|
2645
2684
|
}
|
|
@@ -2660,7 +2699,7 @@ var ProviderFactory = class _ProviderFactory {
|
|
|
2660
2699
|
this.dependencies = dependencies;
|
|
2661
2700
|
this.monikers = creatableProvider2.monikers;
|
|
2662
2701
|
this.scope = scope;
|
|
2663
|
-
|
|
2702
|
+
assertEx21(this.monikers.includes(this.defaultMoniker), () => "defaultMoniker must be in monikers");
|
|
2664
2703
|
this.labels = Object.assign({}, creatableProvider2.labels ?? {}, labels ?? {});
|
|
2665
2704
|
this.providerName = creatableProvider2.name;
|
|
2666
2705
|
this._uniqueId = Symbol(providerFactoryDescription(this));
|
|
@@ -2687,7 +2726,7 @@ var ProviderFactory = class _ProviderFactory {
|
|
|
2687
2726
|
break;
|
|
2688
2727
|
}
|
|
2689
2728
|
case "context": {
|
|
2690
|
-
const context =
|
|
2729
|
+
const context = assertEx21(
|
|
2691
2730
|
params?.context,
|
|
2692
2731
|
() => "Context is required for context-scoped providers"
|
|
2693
2732
|
);
|
|
@@ -2708,7 +2747,7 @@ var ProviderFactory = class _ProviderFactory {
|
|
|
2708
2747
|
scopeObject[this.resolvedMoniker] = resultPromise;
|
|
2709
2748
|
const result = await resultPromise;
|
|
2710
2749
|
if (start) {
|
|
2711
|
-
|
|
2750
|
+
assertEx21(await result.start(), () => `Failed to start provider instance [${this.resolvedMoniker}]`);
|
|
2712
2751
|
}
|
|
2713
2752
|
return result;
|
|
2714
2753
|
}
|
|
@@ -2829,7 +2868,7 @@ var ProviderFactoryLocator = class {
|
|
|
2829
2868
|
this._frozen = true;
|
|
2830
2869
|
}
|
|
2831
2870
|
async getInstance(moniker, { start = true, labels } = {}) {
|
|
2832
|
-
return
|
|
2871
|
+
return assertEx22(
|
|
2833
2872
|
await this.tryGetInstance(moniker, { start, labels }),
|
|
2834
2873
|
() => `No provider instance for the supplied config moniker [${moniker}]${labels ? ` & labels [${JSON.stringify(labels)}]` : ""} could be created`
|
|
2835
2874
|
);
|
|
@@ -2844,7 +2883,7 @@ var ProviderFactoryLocator = class {
|
|
|
2844
2883
|
* @returns A provider factory that matches the supplied moniker and labels or throws if one is not found
|
|
2845
2884
|
*/
|
|
2846
2885
|
locate(moniker, labels) {
|
|
2847
|
-
return
|
|
2886
|
+
return assertEx22(
|
|
2848
2887
|
this.tryLocate(moniker, labels),
|
|
2849
2888
|
() => `No module factory for the supplied config moniker [${moniker}]${labels ? ` & labels [${JSON.stringify(labels)}]` : ""} registered`
|
|
2850
2889
|
);
|
|
@@ -2855,10 +2894,10 @@ var ProviderFactoryLocator = class {
|
|
|
2855
2894
|
* @param labels The labels for the module factory
|
|
2856
2895
|
*/
|
|
2857
2896
|
register(factory, labels, primary = false) {
|
|
2858
|
-
|
|
2897
|
+
assertEx22(!this._frozen, () => "Cannot register a module factory after the locator has been frozen");
|
|
2859
2898
|
if (this.validateDepsOnRegister) {
|
|
2860
2899
|
const missingDeps = factory.dependencies.filter((dep) => !this.registered(dep));
|
|
2861
|
-
|
|
2900
|
+
assertEx22(missingDeps.length === 0, () => `Cannot register module factory [${factory.uniqueId.description}] due to missing dependencies: ${missingDeps.join(", ")}`);
|
|
2862
2901
|
}
|
|
2863
2902
|
registerCreatableProviderFactory(this._registry, factory, labels, primary);
|
|
2864
2903
|
return this;
|
|
@@ -2906,14 +2945,14 @@ var ProviderFactoryLocator = class {
|
|
|
2906
2945
|
for (const moniker in this.registry) {
|
|
2907
2946
|
for (const factory of this.registry[moniker] ?? []) {
|
|
2908
2947
|
const missingDeps = factory.dependencies.filter((dep) => !this.registered(dep));
|
|
2909
|
-
|
|
2948
|
+
assertEx22(missingDeps.length === 0, () => `Module factory [${factory.uniqueId.description}] is missing dependencies: ${missingDeps.join(", ")}`);
|
|
2910
2949
|
}
|
|
2911
2950
|
}
|
|
2912
2951
|
}
|
|
2913
2952
|
};
|
|
2914
2953
|
|
|
2915
2954
|
// src/capabilities/resolveProviders.ts
|
|
2916
|
-
import { isDefined as
|
|
2955
|
+
import { isDefined as isDefined16 } from "@ariestools/sdk";
|
|
2917
2956
|
var MissingCapabilityError = class extends Error {
|
|
2918
2957
|
moniker;
|
|
2919
2958
|
reasons;
|
|
@@ -3020,7 +3059,7 @@ function bindsNoConnection(group) {
|
|
|
3020
3059
|
function selectByConnection(moniker, group, rejected, allCandidates, options) {
|
|
3021
3060
|
const connectionName = connectionNameForMoniker(moniker, options);
|
|
3022
3061
|
const connection = options.connections?.[connectionName];
|
|
3023
|
-
if (!
|
|
3062
|
+
if (!isDefined16(connection)) {
|
|
3024
3063
|
throw new UnknownConnectionError(moniker, connectionName);
|
|
3025
3064
|
}
|
|
3026
3065
|
const { filtered, rejected: connectionRejected } = filterByConnection(
|
|
@@ -3040,7 +3079,7 @@ function selectByConnection(moniker, group, rejected, allCandidates, options) {
|
|
|
3040
3079
|
function connectionNameForMoniker(moniker, options) {
|
|
3041
3080
|
const binding = options.providerBindings?.[moniker];
|
|
3042
3081
|
const connectionName = binding?.connection;
|
|
3043
|
-
if (!
|
|
3082
|
+
if (!isDefined16(connectionName) || connectionName === "") {
|
|
3044
3083
|
throw new UnboundProviderError(moniker);
|
|
3045
3084
|
}
|
|
3046
3085
|
return connectionName;
|
|
@@ -3251,7 +3290,7 @@ import { PayloadBundleSchema as PayloadBundleSchema2 } from "@xyo-network/sdk-js
|
|
|
3251
3290
|
import { PayloadBuilder as PayloadBuilder12 } from "@xyo-network/sdk-js";
|
|
3252
3291
|
|
|
3253
3292
|
// src/transaction/buildTransaction.ts
|
|
3254
|
-
import { assertEx as
|
|
3293
|
+
import { assertEx as assertEx23, toHex } from "@ariestools/sdk";
|
|
3255
3294
|
import {
|
|
3256
3295
|
asAnyPayload as asAnyPayload2,
|
|
3257
3296
|
BoundWitnessBuilder as BoundWitnessBuilder2,
|
|
@@ -3277,7 +3316,7 @@ async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer
|
|
|
3277
3316
|
const script = Array.from(elevatedHashes, (elevatedHash) => `elevate|${elevatedHash}`);
|
|
3278
3317
|
const fields = {
|
|
3279
3318
|
...txBoundWitnessFields,
|
|
3280
|
-
from: from ?? (Array.isArray(signer) ?
|
|
3319
|
+
from: from ?? (Array.isArray(signer) ? assertEx23(signer.at(0)?.address) : signer.address)
|
|
3281
3320
|
};
|
|
3282
3321
|
if (script.length > 0) {
|
|
3283
3322
|
fields.script = script;
|
|
@@ -3322,7 +3361,7 @@ async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads
|
|
|
3322
3361
|
// src/transaction/confirmSubmittedTransaction.ts
|
|
3323
3362
|
import {
|
|
3324
3363
|
delay,
|
|
3325
|
-
isDefined as
|
|
3364
|
+
isDefined as isDefined17,
|
|
3326
3365
|
isNumber
|
|
3327
3366
|
} from "@ariestools/sdk";
|
|
3328
3367
|
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
@@ -3344,7 +3383,7 @@ var confirmSubmittedTransaction = async (viewer, txHash, options) => {
|
|
|
3344
3383
|
let attempts = 0;
|
|
3345
3384
|
while (true) {
|
|
3346
3385
|
const tx = await viewer.transaction.byHash(txHash) ?? void 0;
|
|
3347
|
-
if (
|
|
3386
|
+
if (isDefined17(tx)) {
|
|
3348
3387
|
options?.logger?.debug("Transaction confirmed", txHash);
|
|
3349
3388
|
return tx;
|
|
3350
3389
|
}
|
|
@@ -3362,7 +3401,7 @@ var confirmSubmittedTransaction = async (viewer, txHash, options) => {
|
|
|
3362
3401
|
};
|
|
3363
3402
|
|
|
3364
3403
|
// src/transaction/hydrateTransaction.ts
|
|
3365
|
-
import { assertEx as
|
|
3404
|
+
import { assertEx as assertEx24 } from "@ariestools/sdk";
|
|
3366
3405
|
import {
|
|
3367
3406
|
asAnyPayload as asAnyPayload3,
|
|
3368
3407
|
hydrateTypedBoundWitness,
|
|
@@ -3433,7 +3472,7 @@ var tryHydrateElevatedTransaction = async ({ chainMap }, hash) => {
|
|
|
3433
3472
|
return void 0;
|
|
3434
3473
|
};
|
|
3435
3474
|
var hydrateElevatedTransaction = async (context, hash) => {
|
|
3436
|
-
return
|
|
3475
|
+
return assertEx24(await tryHydrateElevatedTransaction(context, hash), () => "Hydration failed");
|
|
3437
3476
|
};
|
|
3438
3477
|
|
|
3439
3478
|
// src/transaction/primitives/transactionBlockByteCount.ts
|
|
@@ -3486,7 +3525,7 @@ function transactionRequiredGas(hydratedTransaction) {
|
|
|
3486
3525
|
|
|
3487
3526
|
// src/transaction/signTransaction.ts
|
|
3488
3527
|
import {
|
|
3489
|
-
assertEx as
|
|
3528
|
+
assertEx as assertEx25,
|
|
3490
3529
|
hexFromArrayBuffer,
|
|
3491
3530
|
toArrayBuffer
|
|
3492
3531
|
} from "@ariestools/sdk";
|
|
@@ -3503,12 +3542,12 @@ async function signBoundWitness(bw, account) {
|
|
|
3503
3542
|
};
|
|
3504
3543
|
}
|
|
3505
3544
|
async function signTransaction(tx, account) {
|
|
3506
|
-
|
|
3545
|
+
assertEx25(tx.from === account.address, () => "Signer address does not match transaction from address");
|
|
3507
3546
|
return await signBoundWitness(tx, account);
|
|
3508
3547
|
}
|
|
3509
3548
|
|
|
3510
3549
|
// src/transaction/TransactionBuilder.ts
|
|
3511
|
-
import { assertEx as
|
|
3550
|
+
import { assertEx as assertEx26, Base } from "@ariestools/sdk";
|
|
3512
3551
|
import { PayloadBuilder as PayloadBuilder11 } from "@xyo-network/sdk-js";
|
|
3513
3552
|
import {
|
|
3514
3553
|
asXL1BlockNumber as asXL1BlockNumber4,
|
|
@@ -3528,9 +3567,9 @@ var TransactionBuilder = class extends Base {
|
|
|
3528
3567
|
super(options);
|
|
3529
3568
|
}
|
|
3530
3569
|
async build() {
|
|
3531
|
-
const chain =
|
|
3532
|
-
const fees =
|
|
3533
|
-
const blockRange =
|
|
3570
|
+
const chain = assertEx26(this._chain, () => "Chain must be set before building the transaction");
|
|
3571
|
+
const fees = assertEx26(this._fees, () => "Fees must be set before building the transaction");
|
|
3572
|
+
const blockRange = assertEx26(this._blockRange, () => "Block range must be set before building the transaction");
|
|
3534
3573
|
return await buildTransaction(
|
|
3535
3574
|
chain,
|
|
3536
3575
|
this._elevatedPayloads,
|
|
@@ -3560,7 +3599,7 @@ var TransactionBuilder = class extends Base {
|
|
|
3560
3599
|
}
|
|
3561
3600
|
elevatedPayload(payload) {
|
|
3562
3601
|
const allowedPayload = isAllowedBlockPayload2(payload) ? payload : void 0;
|
|
3563
|
-
const allowPayloadExists =
|
|
3602
|
+
const allowPayloadExists = assertEx26(allowedPayload, () => "Payload must be an AllowedBlockPayload");
|
|
3564
3603
|
this._elevatedPayloads.push(allowPayloadExists);
|
|
3565
3604
|
return this;
|
|
3566
3605
|
}
|
|
@@ -3676,7 +3715,7 @@ var toHostActorConfigContext = zodToFactory6(HostActorConfigContext, "toHostActo
|
|
|
3676
3715
|
// src/CreatableProvider/AbstractCreatableProvider.ts
|
|
3677
3716
|
import {
|
|
3678
3717
|
AbstractCreatable,
|
|
3679
|
-
assertEx as
|
|
3718
|
+
assertEx as assertEx27,
|
|
3680
3719
|
IdLogger
|
|
3681
3720
|
} from "@ariestools/sdk";
|
|
3682
3721
|
var AbstractCreatableProvider = class extends AbstractCreatable {
|
|
@@ -3710,9 +3749,9 @@ var AbstractCreatableProvider = class extends AbstractCreatable {
|
|
|
3710
3749
|
return factory;
|
|
3711
3750
|
}
|
|
3712
3751
|
static async paramsHandler(params = {}) {
|
|
3713
|
-
const context =
|
|
3714
|
-
const config =
|
|
3715
|
-
const locator =
|
|
3752
|
+
const context = assertEx27(params.context, () => new Error("Context is required"));
|
|
3753
|
+
const config = assertEx27(context.config, () => new Error("Context config is required"));
|
|
3754
|
+
const locator = assertEx27(context.locator, () => new Error("Context locator is required"));
|
|
3716
3755
|
return await super.paramsHandler({
|
|
3717
3756
|
...params,
|
|
3718
3757
|
statusReporter: params.statusReporter ?? context.statusReporter,
|
|
@@ -3755,13 +3794,13 @@ function labeledCreatableProvider() {
|
|
|
3755
3794
|
}
|
|
3756
3795
|
|
|
3757
3796
|
// src/createDeclarationPayload.ts
|
|
3758
|
-
import { isDefined as
|
|
3797
|
+
import { isDefined as isDefined18 } from "@ariestools/sdk";
|
|
3759
3798
|
import { PayloadBuilder as PayloadBuilder13 } from "@xyo-network/sdk-js";
|
|
3760
3799
|
import {
|
|
3761
3800
|
ChainStakeIntentSchema
|
|
3762
3801
|
} from "@xyo-network/xl1-protocol-lib";
|
|
3763
3802
|
var createDeclarationIntent = (address, intent, nbf, exp) => {
|
|
3764
|
-
const expiration =
|
|
3803
|
+
const expiration = isDefined18(exp) ? exp : nbf + 1e4;
|
|
3765
3804
|
const payloadBuilder = new PayloadBuilder13({ schema: ChainStakeIntentSchema });
|
|
3766
3805
|
const builder = payloadBuilder.fields({
|
|
3767
3806
|
from: address,
|
|
@@ -3943,9 +3982,9 @@ var toPositiveBigInt = (value) => {
|
|
|
3943
3982
|
// src/simple/accountBalance/SimpleAccountBalanceViewer.ts
|
|
3944
3983
|
import {
|
|
3945
3984
|
asHash as asHash4,
|
|
3946
|
-
assertEx as
|
|
3985
|
+
assertEx as assertEx35,
|
|
3947
3986
|
exists as exists3,
|
|
3948
|
-
isDefined as
|
|
3987
|
+
isDefined as isDefined19,
|
|
3949
3988
|
ZERO_ADDRESS
|
|
3950
3989
|
} from "@ariestools/sdk";
|
|
3951
3990
|
import {
|
|
@@ -4011,18 +4050,18 @@ var asTransfersStepSummaryWithStorageMeta = AsObjectFactory7.create(isTransfersS
|
|
|
4011
4050
|
var balancesMaxStep = 5;
|
|
4012
4051
|
|
|
4013
4052
|
// src/summary/primitives/balances/balancesStepSummaryFromRange.ts
|
|
4014
|
-
import { assertEx as
|
|
4053
|
+
import { assertEx as assertEx28, spanRootAsync as spanRootAsync2 } from "@ariestools/sdk";
|
|
4015
4054
|
import { isAnyPayload as isAnyPayload3 } from "@xyo-network/sdk-js";
|
|
4016
4055
|
import { asXL1BlockNumber as asXL1BlockNumber5, StepSizes as StepSizes8 } from "@xyo-network/xl1-protocol-lib";
|
|
4017
4056
|
async function balancesStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
|
|
4018
4057
|
const cacheKey = `${range[0]}|${range[1]}`;
|
|
4019
4058
|
return await withContextCacheResponse(context, "balancesStepSummaryFromRange", cacheKey, async () => {
|
|
4020
4059
|
return await spanRootAsync2("balancesStepSummaryFromRange", async () => {
|
|
4021
|
-
const [frameHead] =
|
|
4060
|
+
const [frameHead] = assertEx28(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
|
|
4022
4061
|
const frameSize = range[1] - range[0] + 1;
|
|
4023
4062
|
const key = `${frameHead._hash}|${frameSize}`;
|
|
4024
4063
|
return frameSize === 1 ? await spanRootAsync2(`balancesStepSummaryFromRange.frameSize=1[${key}]`, async () => {
|
|
4025
|
-
const [, payloads] =
|
|
4064
|
+
const [, payloads] = assertEx28(await blockViewer.blockByNumber(range[0]), () => `Block not found for number: ${range[0]}`);
|
|
4026
4065
|
const balances = {};
|
|
4027
4066
|
for (const [address, balance] of Object.entries(netBalancesForPayloads(context, payloads))) {
|
|
4028
4067
|
balances[address] = toSignedBigInt(balance);
|
|
@@ -4035,7 +4074,7 @@ async function balancesStepSummaryFromRange(context, semaphores, blockViewer, su
|
|
|
4035
4074
|
};
|
|
4036
4075
|
}, { ...context, timeBudgetLimit: 500 }) : await spanRootAsync2(`balancesStepSummaryFromRange.frameSize>1[${key}]`, async () => {
|
|
4037
4076
|
const step = StepSizes8.indexOf(asXL1BlockNumber5(frameSize, true));
|
|
4038
|
-
|
|
4077
|
+
assertEx28(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes8.join(", ")}`);
|
|
4039
4078
|
const summaryResult = await summaryMap.get(`${frameHead._hash}|${frameSize}`);
|
|
4040
4079
|
if (isAnyPayload3(summaryResult)) {
|
|
4041
4080
|
return summaryResult;
|
|
@@ -4078,7 +4117,7 @@ async function balancesStepSummaryFromRange(context, semaphores, blockViewer, su
|
|
|
4078
4117
|
}
|
|
4079
4118
|
|
|
4080
4119
|
// src/summary/primitives/balances/balancesSummary.ts
|
|
4081
|
-
import { assertEx as
|
|
4120
|
+
import { assertEx as assertEx29, spanRootAsync as spanRootAsync3 } from "@ariestools/sdk";
|
|
4082
4121
|
import { asXyoAddress } from "@xyo-network/sdk-js";
|
|
4083
4122
|
import {
|
|
4084
4123
|
asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta3,
|
|
@@ -4089,7 +4128,7 @@ import {
|
|
|
4089
4128
|
async function balancesSummary(context, semaphores, blockViewer, summaryMap, config) {
|
|
4090
4129
|
return await spanRootAsync3("balancesSummary", async () => {
|
|
4091
4130
|
const headHash = isChainQualifiedHeadConfig(config) ? config.head : await blockViewer.currentBlockHash();
|
|
4092
|
-
const [head] =
|
|
4131
|
+
const [head] = assertEx29(await blockViewer.blockByHash(headHash), () => `Block not found for hash: ${headHash}`);
|
|
4093
4132
|
const headBoundWitness = asBlockBoundWitnessWithStorageMeta3(head, () => `Found Block not a BlockWithHashMeta: ${headHash}`);
|
|
4094
4133
|
const range = isChainQualifiedRangeConfig(config) ? config.range : asXL1BlockRange7([0, headBoundWitness.block], true);
|
|
4095
4134
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange7(
|
|
@@ -4112,7 +4151,7 @@ async function balancesSummary(context, semaphores, blockViewer, summaryMap, con
|
|
|
4112
4151
|
var blocksMaxStep = 3;
|
|
4113
4152
|
|
|
4114
4153
|
// src/summary/primitives/blocks/blocksStepSummaryFromRange.ts
|
|
4115
|
-
import { assertEx as
|
|
4154
|
+
import { assertEx as assertEx30, spanRootAsync as spanRootAsync4 } from "@ariestools/sdk";
|
|
4116
4155
|
import { isAnyPayload as isAnyPayload4 } from "@xyo-network/sdk-js";
|
|
4117
4156
|
import {
|
|
4118
4157
|
asBlocksStepSummary,
|
|
@@ -4127,7 +4166,7 @@ async function blocksStepSummaryFromRange(context, semaphores, blockViewer, summ
|
|
|
4127
4166
|
const cacheKey = `${range[0]}|${range[1]}`;
|
|
4128
4167
|
return await withContextCacheResponse(context, "blocksStepSummaryFromRange", cacheKey, async () => {
|
|
4129
4168
|
return await spanRootAsync4("blocksStepSummaryFromRange", async () => {
|
|
4130
|
-
const frameHead =
|
|
4169
|
+
const frameHead = assertEx30(
|
|
4131
4170
|
await blockViewer.blockByNumber(range[1]),
|
|
4132
4171
|
() => `Block not found for number: ${range[1]}`
|
|
4133
4172
|
);
|
|
@@ -4143,7 +4182,7 @@ async function blocksStepSummaryFromRange(context, semaphores, blockViewer, summ
|
|
|
4143
4182
|
};
|
|
4144
4183
|
} else {
|
|
4145
4184
|
const step = StepSizes9.indexOf(asXL1BlockNumber6(frameSize, true));
|
|
4146
|
-
|
|
4185
|
+
assertEx30(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes9.join(", ")}`);
|
|
4147
4186
|
const key = blocksStepSummaryKey(frameHeadHash, frameSize);
|
|
4148
4187
|
const summaryResult = await summaryMap.get(key);
|
|
4149
4188
|
if (isAnyPayload4(summaryResult)) {
|
|
@@ -4181,7 +4220,7 @@ async function blocksStepSummaryFromRange(context, semaphores, blockViewer, summ
|
|
|
4181
4220
|
var schemasMaxStep = 5;
|
|
4182
4221
|
|
|
4183
4222
|
// src/summary/primitives/schemas/schemasStepSummaryFromRange.ts
|
|
4184
|
-
import { assertEx as
|
|
4223
|
+
import { assertEx as assertEx31 } from "@ariestools/sdk";
|
|
4185
4224
|
import {
|
|
4186
4225
|
isAnyPayload as isAnyPayload5,
|
|
4187
4226
|
isBoundWitness as isBoundWitness2,
|
|
@@ -4190,11 +4229,11 @@ import {
|
|
|
4190
4229
|
} from "@xyo-network/sdk-js";
|
|
4191
4230
|
import { StepSizes as StepSizes10 } from "@xyo-network/xl1-protocol-lib";
|
|
4192
4231
|
async function schemasStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
|
|
4193
|
-
const [frameHead] =
|
|
4232
|
+
const [frameHead] = assertEx31(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
|
|
4194
4233
|
const frameSize = range[1] - range[0] + 1;
|
|
4195
4234
|
let result;
|
|
4196
4235
|
if (frameSize === 1) {
|
|
4197
|
-
const [block, payloads] =
|
|
4236
|
+
const [block, payloads] = assertEx31(await blockViewer.blockByNumber(range[0]), () => `Block not found for number: ${range[0]}`);
|
|
4198
4237
|
const boundWitnesses = [block, ...payloads.filter((x) => isBoundWitness2(x) && isHashMeta(x))];
|
|
4199
4238
|
const schemas = {};
|
|
4200
4239
|
for (const bw of boundWitnesses) {
|
|
@@ -4211,7 +4250,7 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
|
|
|
4211
4250
|
});
|
|
4212
4251
|
} else {
|
|
4213
4252
|
const step = StepSizes10.indexOf(frameSize);
|
|
4214
|
-
|
|
4253
|
+
assertEx31(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes10.join(", ")}`);
|
|
4215
4254
|
const summaryResult = await summaryMap.get(`${frameHead._hash}|${frameSize}`);
|
|
4216
4255
|
if (isAnyPayload5(summaryResult)) {
|
|
4217
4256
|
result = summaryResult;
|
|
@@ -4250,7 +4289,7 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
|
|
|
4250
4289
|
}
|
|
4251
4290
|
|
|
4252
4291
|
// src/summary/primitives/schemas/schemasSummary.ts
|
|
4253
|
-
import { assertEx as
|
|
4292
|
+
import { assertEx as assertEx32, spanRootAsync as spanRootAsync5 } from "@ariestools/sdk";
|
|
4254
4293
|
import {
|
|
4255
4294
|
asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta4,
|
|
4256
4295
|
asXL1BlockRange as asXL1BlockRange8,
|
|
@@ -4260,7 +4299,7 @@ import {
|
|
|
4260
4299
|
async function schemasSummary(context, semaphores, blockViewer, summaryMap, config) {
|
|
4261
4300
|
return await spanRootAsync5("schemasSummary", async () => {
|
|
4262
4301
|
const headHash = isChainQualifiedHeadConfig2(config) ? config.head : await blockViewer.currentBlockHash();
|
|
4263
|
-
const [head] =
|
|
4302
|
+
const [head] = assertEx32(await blockViewer.blockByHash(headHash), () => `Block not found for hash: ${headHash}`);
|
|
4264
4303
|
const headBoundWitness = asBlockBoundWitnessWithStorageMeta4(head, () => `Found Block not a BlockWithHashMeta: ${headHash}`);
|
|
4265
4304
|
const range = isChainQualifiedRangeConfig2(config) ? config.range : asXL1BlockRange8([0, headBoundWitness.block], true);
|
|
4266
4305
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange8(
|
|
@@ -4283,7 +4322,7 @@ async function schemasSummary(context, semaphores, blockViewer, summaryMap, conf
|
|
|
4283
4322
|
var transfersMaxStep = 4;
|
|
4284
4323
|
|
|
4285
4324
|
// src/summary/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
4286
|
-
import { assertEx as
|
|
4325
|
+
import { assertEx as assertEx33, spanRootAsync as spanRootAsync6 } from "@ariestools/sdk";
|
|
4287
4326
|
import { isAnyPayload as isAnyPayload6 } from "@xyo-network/sdk-js";
|
|
4288
4327
|
import { asXL1BlockNumber as asXL1BlockNumber7, StepSizes as StepSizes11 } from "@xyo-network/xl1-protocol-lib";
|
|
4289
4328
|
function transfersSummaryKey(frameHeadHash, frameSize) {
|
|
@@ -4293,11 +4332,11 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
|
|
|
4293
4332
|
const cacheKey = `${range[0]}|${range[1]}`;
|
|
4294
4333
|
return await withContextCacheResponse(context, "transfersStepSummaryFromRange", cacheKey, async () => {
|
|
4295
4334
|
return await spanRootAsync6("transfersStepSummaryFromRange", async () => {
|
|
4296
|
-
const [frameHead] =
|
|
4335
|
+
const [frameHead] = assertEx33(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
|
|
4297
4336
|
const frameSize = range[1] - range[0] + 1;
|
|
4298
4337
|
let result;
|
|
4299
4338
|
if (frameSize === 1) {
|
|
4300
|
-
const [, payloads] =
|
|
4339
|
+
const [, payloads] = assertEx33(await blockViewer.blockByNumber(range[0]), () => `Block not found for number: ${range[0]}`);
|
|
4301
4340
|
const transfers = {};
|
|
4302
4341
|
for (const [from, toMap] of Object.entries(netTransfersForPayloads(context, payloads))) {
|
|
4303
4342
|
transfers[from] = transfers[from] ?? {};
|
|
@@ -4313,7 +4352,7 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
|
|
|
4313
4352
|
};
|
|
4314
4353
|
} else {
|
|
4315
4354
|
const step = StepSizes11.indexOf(asXL1BlockNumber7(frameSize, true));
|
|
4316
|
-
|
|
4355
|
+
assertEx33(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes11.join(", ")}`);
|
|
4317
4356
|
const key = transfersSummaryKey(frameHead._hash, frameSize);
|
|
4318
4357
|
const summaryResult = await summaryMap.get(key);
|
|
4319
4358
|
if (isAnyPayload6(summaryResult)) {
|
|
@@ -4364,7 +4403,7 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
|
|
|
4364
4403
|
}
|
|
4365
4404
|
|
|
4366
4405
|
// src/summary/primitives/transfers/transfersSummary.ts
|
|
4367
|
-
import { assertEx as
|
|
4406
|
+
import { assertEx as assertEx34, spanRootAsync as spanRootAsync7 } from "@ariestools/sdk";
|
|
4368
4407
|
import { asXyoAddress as asXyoAddress2 } from "@xyo-network/sdk-js";
|
|
4369
4408
|
import {
|
|
4370
4409
|
asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta5,
|
|
@@ -4375,7 +4414,7 @@ import {
|
|
|
4375
4414
|
async function transfersSummary(context, semaphores, blockViewer, summaryMap, config) {
|
|
4376
4415
|
return await spanRootAsync7("transferSummary", async () => {
|
|
4377
4416
|
const headHash = isChainQualifiedHeadConfig3(config) ? config.head : await blockViewer.currentBlockHash();
|
|
4378
|
-
const [head] =
|
|
4417
|
+
const [head] = assertEx34(await blockViewer.blockByHash(headHash), () => `Block not found for hash: ${headHash}`);
|
|
4379
4418
|
const headBoundWitness = asBlockBoundWitnessWithStorageMeta5(head, () => `Found Block not a BlockWithHashMeta: ${headHash}`);
|
|
4380
4419
|
const range = isChainQualifiedRangeConfig3(config) ? config.range : asXL1BlockRange9([0, headBoundWitness.block], true);
|
|
4381
4420
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange9(
|
|
@@ -4416,8 +4455,8 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4416
4455
|
static async paramsHandler(params = {}) {
|
|
4417
4456
|
return {
|
|
4418
4457
|
...await super.paramsHandler(params),
|
|
4419
|
-
balancesSummaryMap:
|
|
4420
|
-
transfersSummaryMap:
|
|
4458
|
+
balancesSummaryMap: assertEx35(params.balancesSummaryMap, () => "balancesSummaryMap is required"),
|
|
4459
|
+
transfersSummaryMap: assertEx35(params.transfersSummaryMap, () => "transfersSummaryMap is required")
|
|
4421
4460
|
};
|
|
4422
4461
|
}
|
|
4423
4462
|
async accountBalance(address, config) {
|
|
@@ -4440,11 +4479,11 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4440
4479
|
const transferIndexes = block[0].payload_schemas.map((schema, index) => schema === TransferSchema2 ? index : void 0).filter(exists3);
|
|
4441
4480
|
const transfers = transferIndexes.map((index) => {
|
|
4442
4481
|
const hash = block[0].payload_hashes[index];
|
|
4443
|
-
return
|
|
4482
|
+
return assertEx35(
|
|
4444
4483
|
block[1].find((p) => p._hash === hash),
|
|
4445
4484
|
() => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`
|
|
4446
4485
|
);
|
|
4447
|
-
}).filter(exists3).filter((t) => t.from === address ||
|
|
4486
|
+
}).filter(exists3).filter((t) => t.from === address || isDefined19(t.transfers[address]));
|
|
4448
4487
|
if (transfers.length === 0) {
|
|
4449
4488
|
continue;
|
|
4450
4489
|
}
|
|
@@ -4473,7 +4512,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4473
4512
|
const head = isChainQualifiedHeadConfig4(config) ? config.head : await this.blockViewer.currentBlockHash();
|
|
4474
4513
|
const range = isChainQualifiedRangeConfig4(config) ? config.range : asXL1BlockRange10([
|
|
4475
4514
|
0,
|
|
4476
|
-
|
|
4515
|
+
assertEx35(
|
|
4477
4516
|
await this.blockViewer.blockByHash(head),
|
|
4478
4517
|
() => `Error: Could not find block with hash ${head}`
|
|
4479
4518
|
)[0].block
|
|
@@ -4488,11 +4527,11 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4488
4527
|
const qualifiedRange = qualifiedEntries[0][1][1].range;
|
|
4489
4528
|
const qualifiedHeadHash = qualifiedEntries[0][1][1].head;
|
|
4490
4529
|
for (const [_, [__, { range: range2, head: head2 }]] of qualifiedEntries) {
|
|
4491
|
-
|
|
4530
|
+
assertEx35(
|
|
4492
4531
|
range2[0] === qualifiedRange[0] && range2[1] === qualifiedRange[1],
|
|
4493
4532
|
() => "Inconsistent ranges in qualifiedAccountBalanceHistories"
|
|
4494
4533
|
);
|
|
4495
|
-
|
|
4534
|
+
assertEx35(
|
|
4496
4535
|
head2 === qualifiedHeadHash,
|
|
4497
4536
|
() => "Inconsistent head hashes in qualifiedAccountBalanceHistories"
|
|
4498
4537
|
);
|
|
@@ -4563,7 +4602,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4563
4602
|
return await this.spanAsync("qualifiedAccountBalanceHistory", async () => {
|
|
4564
4603
|
const range = asRange(headOrRange);
|
|
4565
4604
|
const headHash = asHash4(headOrRange);
|
|
4566
|
-
const [head] =
|
|
4605
|
+
const [head] = assertEx35(isDefined19(headHash) ? await this.blockViewer.blockByHash(headHash) : await this.blockViewer.currentBlock(), () => "Could not resolve head block");
|
|
4567
4606
|
const startingRange = asXL1BlockRange10(range ?? [0, head.block], true);
|
|
4568
4607
|
const blockNumbers = await this.distillTransferHistory(address, startingRange);
|
|
4569
4608
|
const blockResults = await Promise.all(blockNumbers.map(async (bn) => await this.blockViewer.blockByNumber(bn)));
|
|
@@ -4573,11 +4612,11 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4573
4612
|
const transferIndexes = block[0].payload_schemas.map((schema, index) => schema === TransferSchema2 ? index : void 0).filter(exists3);
|
|
4574
4613
|
const transfers = transferIndexes.map((index) => {
|
|
4575
4614
|
const hash = block[0].payload_hashes[index];
|
|
4576
|
-
return
|
|
4615
|
+
return assertEx35(
|
|
4577
4616
|
block[1].find((p) => p._hash === hash),
|
|
4578
4617
|
() => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`
|
|
4579
4618
|
);
|
|
4580
|
-
}).filter(exists3).filter((t) => t.from === address ||
|
|
4619
|
+
}).filter(exists3).filter((t) => t.from === address || isDefined19(t.transfers[address]));
|
|
4581
4620
|
if (transfers.length === 0) {
|
|
4582
4621
|
continue;
|
|
4583
4622
|
}
|
|
@@ -4605,7 +4644,7 @@ SimpleAccountBalanceViewer = __decorateClass([
|
|
|
4605
4644
|
|
|
4606
4645
|
// src/simple/block/SimpleBlockViewer.ts
|
|
4607
4646
|
import {
|
|
4608
|
-
assertEx as
|
|
4647
|
+
assertEx as assertEx36,
|
|
4609
4648
|
exists as exists4,
|
|
4610
4649
|
isUndefined as isUndefined7
|
|
4611
4650
|
} from "@ariestools/sdk";
|
|
@@ -4669,7 +4708,7 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
4669
4708
|
_headPollTimer = null;
|
|
4670
4709
|
_signedHydratedBlockCache;
|
|
4671
4710
|
get finalizedArchivist() {
|
|
4672
|
-
return
|
|
4711
|
+
return assertEx36(this.params.finalizedArchivist, () => "finalizedArchivist is required \u2014 inject it or bind a connection");
|
|
4673
4712
|
}
|
|
4674
4713
|
get blocksSummaryMap() {
|
|
4675
4714
|
this._blocksSummaryMap ??= this.params.blocksSummaryMap ?? new LruCacheMap2({ max: 32 });
|
|
@@ -4693,14 +4732,14 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
4693
4732
|
static async paramsHandler(params) {
|
|
4694
4733
|
const headPollIntervalMs = params.headPollIntervalMs;
|
|
4695
4734
|
if (headPollIntervalMs !== void 0) {
|
|
4696
|
-
|
|
4735
|
+
assertEx36(headPollIntervalMs >= MIN_HEAD_POLL_INTERVAL_MS, () => `headPollIntervalMs must be at least ${MIN_HEAD_POLL_INTERVAL_MS}ms`);
|
|
4697
4736
|
}
|
|
4698
4737
|
const connection = params.connection;
|
|
4699
4738
|
const finalizedArchivist = params.finalizedArchivist ?? (connection ? await connectArchivist(connection, { name: CHAIN_ARCHIVIST_ROLE }) : void 0);
|
|
4700
4739
|
return {
|
|
4701
4740
|
...await super.paramsHandler(params),
|
|
4702
4741
|
blocksSummaryMap: params.blocksSummaryMap,
|
|
4703
|
-
finalizedArchivist:
|
|
4742
|
+
finalizedArchivist: assertEx36(finalizedArchivist, () => "finalizedArchivist is required \u2014 inject it or bind a connection"),
|
|
4704
4743
|
headPollIntervalMs
|
|
4705
4744
|
};
|
|
4706
4745
|
}
|
|
@@ -4729,8 +4768,8 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
4729
4768
|
}
|
|
4730
4769
|
async blocksByHash(hash, limit = 50) {
|
|
4731
4770
|
return await this.spanAsync("blocksByHash", async () => {
|
|
4732
|
-
|
|
4733
|
-
|
|
4771
|
+
assertEx36(limit > 0, () => "limit must be greater than 0");
|
|
4772
|
+
assertEx36(limit <= 100, () => "limit must be less than 100");
|
|
4734
4773
|
const blocks = [];
|
|
4735
4774
|
let current = await this.blockByHash(hash);
|
|
4736
4775
|
while (current && blocks.length < limit) {
|
|
@@ -4744,8 +4783,8 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
4744
4783
|
}
|
|
4745
4784
|
async blocksByNumber(blockNumber, limit = 50) {
|
|
4746
4785
|
return await this.spanAsync("blocksByNumber", async () => {
|
|
4747
|
-
|
|
4748
|
-
|
|
4786
|
+
assertEx36(limit > 0, () => "limit must be greater than 0");
|
|
4787
|
+
assertEx36(limit <= 100, () => "limit must be less than 100");
|
|
4749
4788
|
const chainContext = await this.getChainContextRead();
|
|
4750
4789
|
if (isUndefined7(chainContext.head)) {
|
|
4751
4790
|
return [];
|
|
@@ -4763,9 +4802,9 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
4763
4802
|
}
|
|
4764
4803
|
async blocksByStep(stepLevel, stepIndex) {
|
|
4765
4804
|
return await this.spanAsync("blocksByStep", async () => {
|
|
4766
|
-
|
|
4805
|
+
assertEx36(Number.isSafeInteger(stepIndex) && stepIndex >= 0, () => "stepIndex must be a non-negative integer");
|
|
4767
4806
|
const size = stepSize2(stepLevel);
|
|
4768
|
-
|
|
4807
|
+
assertEx36(
|
|
4769
4808
|
stepLevel <= blocksMaxStep,
|
|
4770
4809
|
() => `blocksByStep does not support step levels above ${blocksMaxStep} (requested ${stepLevel})`
|
|
4771
4810
|
);
|
|
@@ -4791,7 +4830,7 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
4791
4830
|
const headBlock = await this.finalizationViewer.headBlock();
|
|
4792
4831
|
return headBlock.chain;
|
|
4793
4832
|
}
|
|
4794
|
-
const block =
|
|
4833
|
+
const block = assertEx36(await this.blockByNumber(blockNumber), () => `Block not found [${blockNumber}]`);
|
|
4795
4834
|
return block[0].chain;
|
|
4796
4835
|
}, this.context);
|
|
4797
4836
|
}
|
|
@@ -4927,7 +4966,7 @@ SimpleBlockRewardViewer = __decorateClass([
|
|
|
4927
4966
|
], SimpleBlockRewardViewer);
|
|
4928
4967
|
|
|
4929
4968
|
// src/simple/blockValidation/SimpleBlockValidationViewer.ts
|
|
4930
|
-
import { assertEx as
|
|
4969
|
+
import { assertEx as assertEx37 } from "@ariestools/sdk";
|
|
4931
4970
|
import { PayloadBuilder as PayloadBuilder18 } from "@xyo-network/sdk-js";
|
|
4932
4971
|
import {
|
|
4933
4972
|
AccountBalanceViewerMoniker as AccountBalanceViewerMoniker2,
|
|
@@ -4983,7 +5022,7 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
|
|
|
4983
5022
|
let head;
|
|
4984
5023
|
if (isChainQualifiedHeadConfig5(config)) {
|
|
4985
5024
|
const headBlockResult = await this.blockViewer.blockByHash(config.head);
|
|
4986
|
-
head = headBlockResult == null ?
|
|
5025
|
+
head = headBlockResult == null ? assertEx37(
|
|
4987
5026
|
void 0,
|
|
4988
5027
|
() => `Specified a head that is not in the chain [${config.head}]`
|
|
4989
5028
|
) : headBlockResult[0];
|
|
@@ -5071,7 +5110,7 @@ SimpleBlockValidationViewer = __decorateClass([
|
|
|
5071
5110
|
], SimpleBlockValidationViewer);
|
|
5072
5111
|
|
|
5073
5112
|
// src/simple/chainContractViewer/SimpleChainContractViewer.ts
|
|
5074
|
-
import { assertEx as
|
|
5113
|
+
import { assertEx as assertEx38 } from "@ariestools/sdk";
|
|
5075
5114
|
import { ChainContractViewerMoniker as ChainContractViewerMoniker2, FinalizationViewerMoniker as FinalizationViewerMoniker2 } from "@xyo-network/xl1-protocol-lib";
|
|
5076
5115
|
var SimpleChainContractViewer = class extends AbstractCreatableProvider {
|
|
5077
5116
|
moniker = SimpleChainContractViewer.defaultMoniker;
|
|
@@ -5088,7 +5127,7 @@ var SimpleChainContractViewer = class extends AbstractCreatableProvider {
|
|
|
5088
5127
|
let contractViewer = this;
|
|
5089
5128
|
let forkedAtBlockNumber = await contractViewer.forkedAtBlockNumber();
|
|
5090
5129
|
while (forkedAtBlockNumber !== null && blockNumber <= forkedAtBlockNumber) {
|
|
5091
|
-
contractViewer =
|
|
5130
|
+
contractViewer = assertEx38(await contractViewer.forkedChainContractViewer());
|
|
5092
5131
|
forkedAtBlockNumber = await contractViewer.forkedAtBlockNumber();
|
|
5093
5132
|
chainId = await contractViewer.chainId();
|
|
5094
5133
|
}
|
|
@@ -5143,7 +5182,7 @@ var SimpleXyoClient = class {
|
|
|
5143
5182
|
};
|
|
5144
5183
|
|
|
5145
5184
|
// src/simple/datalake/RestDataLakeRunner.ts
|
|
5146
|
-
import { assertEx as
|
|
5185
|
+
import { assertEx as assertEx40, exists as exists6 } from "@ariestools/sdk";
|
|
5147
5186
|
import { isAnyPayload as isAnyPayload8, PayloadZodLoose } from "@xyo-network/sdk-js";
|
|
5148
5187
|
import { DataLakeRunnerMoniker } from "@xyo-network/xl1-protocol-lib";
|
|
5149
5188
|
import { z as z27 } from "zod/mini";
|
|
@@ -5151,9 +5190,9 @@ import { z as z27 } from "zod/mini";
|
|
|
5151
5190
|
// src/simple/datalake/AbstractRestDataLake.ts
|
|
5152
5191
|
import { FetchClientError, FetchJsonClient } from "@ariestools/sdk";
|
|
5153
5192
|
import {
|
|
5154
|
-
assertEx as
|
|
5193
|
+
assertEx as assertEx39,
|
|
5155
5194
|
exists as exists5,
|
|
5156
|
-
isDefined as
|
|
5195
|
+
isDefined as isDefined20
|
|
5157
5196
|
} from "@ariestools/sdk";
|
|
5158
5197
|
import { asAnyPayload as asAnyPayload4, isAnyPayload as isAnyPayload7 } from "@xyo-network/sdk-js";
|
|
5159
5198
|
var AbstractRestDataLake = class extends AbstractCreatableProvider {
|
|
@@ -5171,8 +5210,8 @@ var AbstractRestDataLake = class extends AbstractCreatableProvider {
|
|
|
5171
5210
|
}
|
|
5172
5211
|
static async paramsHandler(params = {}) {
|
|
5173
5212
|
const moniker = this.defaultMoniker;
|
|
5174
|
-
const endpoint =
|
|
5175
|
-
|
|
5213
|
+
const endpoint = isDefined20(params.endpoint) && params.endpoint !== "" ? params.endpoint : resolveRestConnectionEndpoint(
|
|
5214
|
+
assertEx39(params.context?.config, () => "Context config is required to resolve REST data lake endpoint"),
|
|
5176
5215
|
moniker
|
|
5177
5216
|
);
|
|
5178
5217
|
return {
|
|
@@ -5227,7 +5266,7 @@ var RestDataLakeRunner = class extends AbstractRestDataLake {
|
|
|
5227
5266
|
async insert(items) {
|
|
5228
5267
|
const allowedItems = items.map((item) => {
|
|
5229
5268
|
if (isAnyPayload8(item) && this.isAllowed(item)) {
|
|
5230
|
-
|
|
5269
|
+
assertEx40(typeof item === "object" && item !== null, () => "Data must be an object");
|
|
5231
5270
|
return item;
|
|
5232
5271
|
}
|
|
5233
5272
|
return null;
|
|
@@ -5350,13 +5389,13 @@ SimpleDataLakeViewer = __decorateClass([
|
|
|
5350
5389
|
], SimpleDataLakeViewer);
|
|
5351
5390
|
|
|
5352
5391
|
// src/simple/finalization/SimpleFinalizationRunner.ts
|
|
5353
|
-
import { assertEx as
|
|
5392
|
+
import { assertEx as assertEx41 } from "@ariestools/sdk";
|
|
5354
5393
|
import { FinalizationRunnerMoniker } from "@xyo-network/xl1-protocol-lib";
|
|
5355
5394
|
var SimpleFinalizationRunner = class extends AbstractCreatableProvider {
|
|
5356
5395
|
moniker = SimpleFinalizationRunner.defaultMoniker;
|
|
5357
5396
|
_store;
|
|
5358
5397
|
get finalizedArchivist() {
|
|
5359
|
-
return
|
|
5398
|
+
return assertEx41(this.params.finalizedArchivist, () => "finalizedArchivist is required \u2014 inject it or bind a connection");
|
|
5360
5399
|
}
|
|
5361
5400
|
get store() {
|
|
5362
5401
|
return this._store;
|
|
@@ -5366,7 +5405,7 @@ var SimpleFinalizationRunner = class extends AbstractCreatableProvider {
|
|
|
5366
5405
|
const finalizedArchivist = params?.finalizedArchivist ?? (connection ? await connectArchivist(connection, { name: CHAIN_ARCHIVIST_ROLE }) : void 0);
|
|
5367
5406
|
return {
|
|
5368
5407
|
...await super.paramsHandler(params),
|
|
5369
|
-
finalizedArchivist:
|
|
5408
|
+
finalizedArchivist: assertEx41(finalizedArchivist, () => "finalizedArchivist is required \u2014 inject it or bind a connection")
|
|
5370
5409
|
};
|
|
5371
5410
|
}
|
|
5372
5411
|
async createHandler() {
|
|
@@ -5394,7 +5433,7 @@ SimpleFinalizationRunner = __decorateClass([
|
|
|
5394
5433
|
], SimpleFinalizationRunner);
|
|
5395
5434
|
|
|
5396
5435
|
// src/simple/finalization/SimpleFinalizationViewer.ts
|
|
5397
|
-
import { assertEx as
|
|
5436
|
+
import { assertEx as assertEx42 } from "@ariestools/sdk";
|
|
5398
5437
|
import {
|
|
5399
5438
|
asSignedHydratedBlockWithStorageMeta as asSignedHydratedBlockWithStorageMeta2,
|
|
5400
5439
|
ChainContractViewerMoniker as ChainContractViewerMoniker3,
|
|
@@ -5406,7 +5445,7 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
|
5406
5445
|
_store;
|
|
5407
5446
|
_signedHydratedBlockCache;
|
|
5408
5447
|
get finalizedArchivist() {
|
|
5409
|
-
return
|
|
5448
|
+
return assertEx42(this.params.finalizedArchivist, () => "finalizedArchivist is required \u2014 inject it or bind a connection");
|
|
5410
5449
|
}
|
|
5411
5450
|
get hydratedBlockCache() {
|
|
5412
5451
|
if (this._signedHydratedBlockCache) return this._signedHydratedBlockCache;
|
|
@@ -5425,7 +5464,7 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
|
5425
5464
|
const finalizedArchivist = params.finalizedArchivist ?? (connection ? await connectArchivist(connection, { name: CHAIN_ARCHIVIST_ROLE }) : void 0);
|
|
5426
5465
|
return {
|
|
5427
5466
|
...await super.paramsHandler(params),
|
|
5428
|
-
finalizedArchivist:
|
|
5467
|
+
finalizedArchivist: assertEx42(finalizedArchivist, () => "finalizedArchivist is required \u2014 inject it or bind a connection")
|
|
5429
5468
|
};
|
|
5430
5469
|
}
|
|
5431
5470
|
chainId() {
|
|
@@ -5435,18 +5474,18 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
|
5435
5474
|
await super.createHandler();
|
|
5436
5475
|
const finalizedArchivist = this.finalizedArchivist;
|
|
5437
5476
|
const mostRecentBlock = await findMostRecentBlock(finalizedArchivist);
|
|
5438
|
-
this._chainId =
|
|
5477
|
+
this._chainId = assertEx42(this.config.chain.id ?? mostRecentBlock?.chain, () => "chain.id is required if empty archivist");
|
|
5439
5478
|
this._store = { chainMap: finalizedArchivist };
|
|
5440
5479
|
}
|
|
5441
5480
|
async head() {
|
|
5442
5481
|
return await this.spanAsync("head", async () => {
|
|
5443
|
-
const currentHead =
|
|
5482
|
+
const currentHead = assertEx42(await this.getCurrentHead(), () => "Could not find most recent block [currentBlock]");
|
|
5444
5483
|
const cache = this.hydratedBlockCache;
|
|
5445
5484
|
const block = await cache.get(currentHead._hash);
|
|
5446
5485
|
if (!block) {
|
|
5447
5486
|
this.logger?.error(`Could not find current block with hash ${currentHead._hash}`);
|
|
5448
5487
|
}
|
|
5449
|
-
return
|
|
5488
|
+
return assertEx42(block, () => "Could not find current block");
|
|
5450
5489
|
}, this.context);
|
|
5451
5490
|
}
|
|
5452
5491
|
async headBlock() {
|
|
@@ -5476,8 +5515,8 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
|
5476
5515
|
}
|
|
5477
5516
|
async getCurrentHead() {
|
|
5478
5517
|
const chainArchivist = this.finalizedArchivist;
|
|
5479
|
-
const result =
|
|
5480
|
-
|
|
5518
|
+
const result = assertEx42(await findMostRecentBlock(chainArchivist), () => "Could not find most recent block [getCurrentHead]");
|
|
5519
|
+
assertEx42(result?.chain === this._chainId, () => "Chain ID does not match head block chain ID");
|
|
5481
5520
|
return result;
|
|
5482
5521
|
}
|
|
5483
5522
|
};
|
|
@@ -5509,9 +5548,9 @@ var SimpleXyoGateway = class _SimpleXyoGateway extends AbstractCreatableProvider
|
|
|
5509
5548
|
|
|
5510
5549
|
// src/simple/gateway/SimpleXyoGatewayRunner.ts
|
|
5511
5550
|
import {
|
|
5512
|
-
assertEx as
|
|
5551
|
+
assertEx as assertEx43,
|
|
5513
5552
|
BigIntToJsonZod,
|
|
5514
|
-
isDefined as
|
|
5553
|
+
isDefined as isDefined21
|
|
5515
5554
|
} from "@ariestools/sdk";
|
|
5516
5555
|
import { PayloadBuilder as PayloadBuilder20 } from "@xyo-network/sdk-js";
|
|
5517
5556
|
import {
|
|
@@ -5542,23 +5581,23 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
5542
5581
|
return this._signer;
|
|
5543
5582
|
}
|
|
5544
5583
|
async addPayloadsToChain(onChain, offChain, options) {
|
|
5545
|
-
const viewer =
|
|
5584
|
+
const viewer = assertEx43(this.connection.viewer, () => "No viewer available on connection");
|
|
5546
5585
|
const {
|
|
5547
5586
|
nbf,
|
|
5548
5587
|
exp,
|
|
5549
5588
|
chain,
|
|
5550
5589
|
fees
|
|
5551
5590
|
} = options ?? {};
|
|
5552
|
-
const resolvedChainId =
|
|
5553
|
-
const resolvedNbf = asXL1BlockNumber10(
|
|
5554
|
-
const resolvedExp = asXL1BlockNumber10(
|
|
5591
|
+
const resolvedChainId = isDefined21(chain) ? chain : await viewer.chainId();
|
|
5592
|
+
const resolvedNbf = asXL1BlockNumber10(isDefined21(nbf) ? nbf : await viewer.currentBlockNumber(), true);
|
|
5593
|
+
const resolvedExp = asXL1BlockNumber10(isDefined21(exp) ? exp : resolvedNbf + 10, true);
|
|
5555
5594
|
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await this.signer.address(), fees);
|
|
5556
5595
|
return await this.addTransactionToChain(tx, await PayloadBuilder20.addHashMeta(offChain));
|
|
5557
5596
|
}
|
|
5558
5597
|
async addTransactionToChain(tx, offChain = []) {
|
|
5559
5598
|
const connection = this.connection;
|
|
5560
5599
|
const signer = this.signer;
|
|
5561
|
-
const runner =
|
|
5600
|
+
const runner = assertEx43(connection.runner, () => "No runner available on connection");
|
|
5562
5601
|
let signedTx;
|
|
5563
5602
|
if (isSignedHydratedTransaction(tx)) {
|
|
5564
5603
|
const [bw, payloads] = tx;
|
|
@@ -5573,7 +5612,7 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
5573
5612
|
}
|
|
5574
5613
|
async confirmSubmittedTransaction(txHash, options) {
|
|
5575
5614
|
return await confirmSubmittedTransaction(
|
|
5576
|
-
|
|
5615
|
+
assertEx43(this.connection.viewer, () => "Connection viewer is undefined"),
|
|
5577
5616
|
txHash,
|
|
5578
5617
|
options
|
|
5579
5618
|
);
|
|
@@ -5612,7 +5651,7 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
5612
5651
|
|
|
5613
5652
|
// src/simple/mempool/SimpleMempoolRunner.ts
|
|
5614
5653
|
import {
|
|
5615
|
-
assertEx as
|
|
5654
|
+
assertEx as assertEx44,
|
|
5616
5655
|
exists as exists8
|
|
5617
5656
|
} from "@ariestools/sdk";
|
|
5618
5657
|
import { isPayloadBundle, PayloadBuilder as PayloadBuilder21 } from "@xyo-network/sdk-js";
|
|
@@ -5668,10 +5707,10 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
|
|
|
5668
5707
|
return this.params.maxPendingTransactions ?? 0;
|
|
5669
5708
|
}
|
|
5670
5709
|
get pendingBlocksArchivist() {
|
|
5671
|
-
return
|
|
5710
|
+
return assertEx44(this.params.pendingBlocksArchivist, () => "pendingBlocksArchivist is required \u2014 inject it or bind a connection");
|
|
5672
5711
|
}
|
|
5673
5712
|
get pendingTransactionsArchivist() {
|
|
5674
|
-
return
|
|
5713
|
+
return assertEx44(this.params.pendingTransactionsArchivist, () => "pendingTransactionsArchivist is required \u2014 inject it or bind a connection");
|
|
5675
5714
|
}
|
|
5676
5715
|
get syncInterval() {
|
|
5677
5716
|
return this.params.syncInterval ?? DEFAULT_SYNC_INTERVAL;
|
|
@@ -5691,8 +5730,8 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
|
|
|
5691
5730
|
const pendingTransactionsArchivist = params?.pendingTransactionsArchivist ?? (connection ? await connectArchivist(connection, { name: PENDING_TRANSACTIONS_ARCHIVIST_ROLE }) : void 0);
|
|
5692
5731
|
return {
|
|
5693
5732
|
...await super.paramsHandler(params),
|
|
5694
|
-
pendingBlocksArchivist:
|
|
5695
|
-
pendingTransactionsArchivist:
|
|
5733
|
+
pendingBlocksArchivist: assertEx44(pendingBlocksArchivist, () => "pendingBlocksArchivist is required \u2014 inject it or bind a connection"),
|
|
5734
|
+
pendingTransactionsArchivist: assertEx44(pendingTransactionsArchivist, () => "pendingTransactionsArchivist is required \u2014 inject it or bind a connection")
|
|
5696
5735
|
};
|
|
5697
5736
|
}
|
|
5698
5737
|
async createHandler() {
|
|
@@ -5731,7 +5770,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
|
|
|
5731
5770
|
remainingBlockMap.push(i);
|
|
5732
5771
|
return b;
|
|
5733
5772
|
}).filter(exists8);
|
|
5734
|
-
|
|
5773
|
+
assertEx44(
|
|
5735
5774
|
remainingBlockMap.length === remainingBlocks.length,
|
|
5736
5775
|
() => `remainingBlockMap length should match remainingBlocks length [${remainingBlockMap.length}/${remainingBlocks.length}]`
|
|
5737
5776
|
);
|
|
@@ -5794,7 +5833,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
|
|
|
5794
5833
|
remainingTransactionMap.push(i);
|
|
5795
5834
|
return t;
|
|
5796
5835
|
}).filter(exists8);
|
|
5797
|
-
|
|
5836
|
+
assertEx44(
|
|
5798
5837
|
remainingTransactionMap.length === remainingTransactions.length,
|
|
5799
5838
|
() => `remainingTransactionMap length should match remainingTransactions length [${remainingTransactionMap.length}/${remainingTransactions.length}]`
|
|
5800
5839
|
);
|
|
@@ -6047,9 +6086,9 @@ SimpleMempoolRunner = __decorateClass([
|
|
|
6047
6086
|
|
|
6048
6087
|
// src/simple/mempool/SimpleMempoolViewer.ts
|
|
6049
6088
|
import {
|
|
6050
|
-
assertEx as
|
|
6089
|
+
assertEx as assertEx45,
|
|
6051
6090
|
exists as exists9,
|
|
6052
|
-
isDefined as
|
|
6091
|
+
isDefined as isDefined22,
|
|
6053
6092
|
isHash as isHash2
|
|
6054
6093
|
} from "@ariestools/sdk";
|
|
6055
6094
|
import { isHashMeta as isHashMeta2, isPayloadBundle as isPayloadBundle2 } from "@xyo-network/sdk-js";
|
|
@@ -6068,10 +6107,10 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
6068
6107
|
return this.params.handoutStatsTtlBlocks ?? DEFAULT_HANDOUT_STATS_TTL_BLOCKS;
|
|
6069
6108
|
}
|
|
6070
6109
|
get pendingBlocksArchivist() {
|
|
6071
|
-
return
|
|
6110
|
+
return assertEx45(this.params.pendingBlocksArchivist, () => "pendingBlocksArchivist is required \u2014 inject it or bind a connection");
|
|
6072
6111
|
}
|
|
6073
6112
|
get pendingTransactionsArchivist() {
|
|
6074
|
-
return
|
|
6113
|
+
return assertEx45(this.params.pendingTransactionsArchivist, () => "pendingTransactionsArchivist is required \u2014 inject it or bind a connection");
|
|
6075
6114
|
}
|
|
6076
6115
|
get windowedBlockViewer() {
|
|
6077
6116
|
return this._windowedBlockViewer;
|
|
@@ -6120,7 +6159,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
6120
6159
|
let cursor;
|
|
6121
6160
|
if (isHash2(providedCursor)) {
|
|
6122
6161
|
const [p] = await this.pendingBlocksArchivist.get([providedCursor]);
|
|
6123
|
-
if (
|
|
6162
|
+
if (isDefined22(p)) {
|
|
6124
6163
|
cursor = p._sequence;
|
|
6125
6164
|
}
|
|
6126
6165
|
}
|
|
@@ -6140,7 +6179,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
6140
6179
|
let cursor;
|
|
6141
6180
|
if (isHash2(providedCursor)) {
|
|
6142
6181
|
const [p] = await this.pendingTransactionsArchivist.get([providedCursor]);
|
|
6143
|
-
if (
|
|
6182
|
+
if (isDefined22(p)) {
|
|
6144
6183
|
cursor = p._sequence;
|
|
6145
6184
|
}
|
|
6146
6185
|
}
|
|
@@ -6213,7 +6252,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
6213
6252
|
const hydratedResults = await Promise.all(
|
|
6214
6253
|
filteredBundles.map(async (bundle3) => {
|
|
6215
6254
|
const tx = await bundledPayloadToHydratedTransaction(bundle3);
|
|
6216
|
-
return
|
|
6255
|
+
return isDefined22(tx) ? { bundle: bundle3, tx } : void 0;
|
|
6217
6256
|
})
|
|
6218
6257
|
);
|
|
6219
6258
|
return hydratedResults.filter(exists9);
|
|
@@ -6357,7 +6396,7 @@ var SimpleXyoNetwork = class {
|
|
|
6357
6396
|
};
|
|
6358
6397
|
|
|
6359
6398
|
// src/simple/permissions/SimpleXyoPermissions.ts
|
|
6360
|
-
import { assertEx as
|
|
6399
|
+
import { assertEx as assertEx46 } from "@ariestools/sdk";
|
|
6361
6400
|
var SimpleXyoPermissions = class {
|
|
6362
6401
|
invoker;
|
|
6363
6402
|
_store;
|
|
@@ -6366,7 +6405,7 @@ var SimpleXyoPermissions = class {
|
|
|
6366
6405
|
this.invoker = store.invoker;
|
|
6367
6406
|
}
|
|
6368
6407
|
get store() {
|
|
6369
|
-
return
|
|
6408
|
+
return assertEx46(this._store, () => "Store must be defined to get permissions");
|
|
6370
6409
|
}
|
|
6371
6410
|
async getPermissions() {
|
|
6372
6411
|
return await this.store.getPermissions();
|
|
@@ -6419,7 +6458,7 @@ var SimpleXyoPermissions = class {
|
|
|
6419
6458
|
};
|
|
6420
6459
|
|
|
6421
6460
|
// src/simple/permissions/store/MemoryPermissions.ts
|
|
6422
|
-
import { assertEx as
|
|
6461
|
+
import { assertEx as assertEx47 } from "@ariestools/sdk";
|
|
6423
6462
|
var MemoryPermissionsStore = class {
|
|
6424
6463
|
_invoker;
|
|
6425
6464
|
permissions = [];
|
|
@@ -6427,7 +6466,7 @@ var MemoryPermissionsStore = class {
|
|
|
6427
6466
|
this._invoker = invoker;
|
|
6428
6467
|
}
|
|
6429
6468
|
get invoker() {
|
|
6430
|
-
return
|
|
6469
|
+
return assertEx47(this._invoker, () => "Invoker must be defined to get permissions");
|
|
6431
6470
|
}
|
|
6432
6471
|
async getPermissions() {
|
|
6433
6472
|
await Promise.resolve();
|
|
@@ -6469,7 +6508,7 @@ SimpleXyoRunner = __decorateClass([
|
|
|
6469
6508
|
], SimpleXyoRunner);
|
|
6470
6509
|
|
|
6471
6510
|
// src/simple/signer/SimpleXyoSigner.ts
|
|
6472
|
-
import { assertEx as
|
|
6511
|
+
import { assertEx as assertEx48 } from "@ariestools/sdk";
|
|
6473
6512
|
import { Account, PayloadBuilder as PayloadBuilder23 } from "@xyo-network/sdk-js";
|
|
6474
6513
|
import { asSignedHydratedTransactionWithHashMeta, XyoSignerMoniker as XyoSignerMoniker2 } from "@xyo-network/xl1-protocol-lib";
|
|
6475
6514
|
var SimpleXyoSigner = class _SimpleXyoSigner extends AbstractCreatableProvider {
|
|
@@ -6503,13 +6542,13 @@ var SimpleXyoSigner = class _SimpleXyoSigner extends AbstractCreatableProvider {
|
|
|
6503
6542
|
];
|
|
6504
6543
|
}
|
|
6505
6544
|
async signTransaction(tx) {
|
|
6506
|
-
|
|
6545
|
+
assertEx48(tx[0].from === this.params.account.address, () => "Signer address does not match transaction from address");
|
|
6507
6546
|
return asSignedHydratedTransactionWithHashMeta(await this.sign(tx), true);
|
|
6508
6547
|
}
|
|
6509
6548
|
};
|
|
6510
6549
|
|
|
6511
6550
|
// src/simple/StakeEventsViewer/SimpleStakeEventsViewer.ts
|
|
6512
|
-
import { isDefined as
|
|
6551
|
+
import { isDefined as isDefined23 } from "@ariestools/sdk";
|
|
6513
6552
|
import { StakeEventsViewerMoniker } from "@xyo-network/xl1-protocol-lib";
|
|
6514
6553
|
var SimpleStakeEventsViewer = class extends AbstractCreatableProvider {
|
|
6515
6554
|
moniker = SimpleStakeEventsViewer.defaultMoniker;
|
|
@@ -6522,7 +6561,7 @@ var SimpleStakeEventsViewer = class extends AbstractCreatableProvider {
|
|
|
6522
6561
|
stakeEvents(range, { name } = {}) {
|
|
6523
6562
|
const positions = this.positionsFromRange(range);
|
|
6524
6563
|
const events = this.eventsFromPositions(positions);
|
|
6525
|
-
if (
|
|
6564
|
+
if (isDefined23(name)) {
|
|
6526
6565
|
return events.filter((event) => event.name === name);
|
|
6527
6566
|
}
|
|
6528
6567
|
return events;
|
|
@@ -6589,7 +6628,7 @@ SimpleStakeEventsViewer = __decorateClass([
|
|
|
6589
6628
|
], SimpleStakeEventsViewer);
|
|
6590
6629
|
|
|
6591
6630
|
// src/simple/StakeTotalsViewer/SimpleStakeTotalsViewer.ts
|
|
6592
|
-
import { assertEx as
|
|
6631
|
+
import { assertEx as assertEx49 } from "@ariestools/sdk";
|
|
6593
6632
|
import { asXyoAddress as asXyoAddress3 } from "@xyo-network/sdk-js";
|
|
6594
6633
|
import {
|
|
6595
6634
|
StakeTotalsViewerMoniker,
|
|
@@ -6633,7 +6672,7 @@ var SimpleStakeTotalsViewer = class extends AbstractCreatableProvider {
|
|
|
6633
6672
|
}
|
|
6634
6673
|
async createHandler() {
|
|
6635
6674
|
await super.createHandler();
|
|
6636
|
-
this._stakeViewer =
|
|
6675
|
+
this._stakeViewer = assertEx49(
|
|
6637
6676
|
await this.locateAndCreate(StakeViewerMoniker),
|
|
6638
6677
|
() => "Failed to create StakeViewer"
|
|
6639
6678
|
);
|
|
@@ -6689,14 +6728,14 @@ SimpleStakeTotalsViewer = __decorateClass([
|
|
|
6689
6728
|
], SimpleStakeTotalsViewer);
|
|
6690
6729
|
|
|
6691
6730
|
// src/simple/StakeViewer/SimpleStakeViewer.ts
|
|
6692
|
-
import { assertEx as
|
|
6731
|
+
import { assertEx as assertEx50, toAddress } from "@ariestools/sdk";
|
|
6693
6732
|
import { asXyoAddress as asXyoAddress4 } from "@xyo-network/sdk-js";
|
|
6694
6733
|
import { StakeEventsViewerMoniker as StakeEventsViewerMoniker2, StakeViewerMoniker as StakeViewerMoniker2 } from "@xyo-network/xl1-protocol-lib";
|
|
6695
6734
|
var SimpleStakeViewer = class extends AbstractCreatableProvider {
|
|
6696
6735
|
moniker = SimpleStakeViewer.defaultMoniker;
|
|
6697
6736
|
_chainStakeEventsViewer;
|
|
6698
6737
|
get stakeEvents() {
|
|
6699
|
-
return
|
|
6738
|
+
return assertEx50(this._chainStakeEventsViewer, () => "Stake events viewer not set");
|
|
6700
6739
|
}
|
|
6701
6740
|
get positions() {
|
|
6702
6741
|
return this.params.positions;
|
|
@@ -6736,7 +6775,7 @@ var SimpleStakeViewer = class extends AbstractCreatableProvider {
|
|
|
6736
6775
|
}
|
|
6737
6776
|
async createHandler() {
|
|
6738
6777
|
await super.createHandler();
|
|
6739
|
-
this._chainStakeEventsViewer =
|
|
6778
|
+
this._chainStakeEventsViewer = assertEx50(
|
|
6740
6779
|
await this.locateAndCreate(StakeEventsViewerMoniker2),
|
|
6741
6780
|
() => "Failed to create StakeEventsViewer"
|
|
6742
6781
|
);
|
|
@@ -6771,7 +6810,7 @@ var SimpleStakeViewer = class extends AbstractCreatableProvider {
|
|
|
6771
6810
|
return toAddress(toAddress(1n));
|
|
6772
6811
|
}
|
|
6773
6812
|
stakeById(id) {
|
|
6774
|
-
return
|
|
6813
|
+
return assertEx50(this.positions[id], () => new Error(`Stake with id ${id} not found`));
|
|
6775
6814
|
}
|
|
6776
6815
|
stakeByStaker(staker, slot) {
|
|
6777
6816
|
return this.positions.filter((s) => asXyoAddress4(s.staker) === asXyoAddress4(staker))[slot];
|
|
@@ -6873,12 +6912,12 @@ RestSyncViewer = __decorateClass([
|
|
|
6873
6912
|
], RestSyncViewer);
|
|
6874
6913
|
|
|
6875
6914
|
// src/simple/systemStatus/SimpleSystemStatusViewer.ts
|
|
6876
|
-
import { assertEx as
|
|
6915
|
+
import { assertEx as assertEx51 } from "@ariestools/sdk";
|
|
6877
6916
|
import { SystemStatusViewerMoniker } from "@xyo-network/xl1-protocol-lib";
|
|
6878
6917
|
var SimpleSystemStatusViewer = class extends AbstractCreatableProvider {
|
|
6879
6918
|
moniker = SimpleSystemStatusViewer.defaultMoniker;
|
|
6880
6919
|
get runner() {
|
|
6881
|
-
return
|
|
6920
|
+
return assertEx51(this.context.statusReporter, () => "SystemStatusViewer requires a SystemStatusRunner (context.statusReporter)");
|
|
6882
6921
|
}
|
|
6883
6922
|
getGlobalStatus() {
|
|
6884
6923
|
return this.runner.getGlobalStatus();
|
|
@@ -6908,8 +6947,8 @@ SimpleSystemStatusViewer = __decorateClass([
|
|
|
6908
6947
|
// src/simple/timeSync2/SimpleTimeSyncViewer.ts
|
|
6909
6948
|
import {
|
|
6910
6949
|
asHash as asHash5,
|
|
6911
|
-
assertEx as
|
|
6912
|
-
isDefined as
|
|
6950
|
+
assertEx as assertEx52,
|
|
6951
|
+
isDefined as isDefined24
|
|
6913
6952
|
} from "@ariestools/sdk";
|
|
6914
6953
|
import {
|
|
6915
6954
|
asTimePayload as asTimePayload2,
|
|
@@ -6930,10 +6969,10 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
6930
6969
|
async convertTime(fromDomain, toDomain, from) {
|
|
6931
6970
|
switch (fromDomain) {
|
|
6932
6971
|
case "xl1": {
|
|
6933
|
-
const [block, payloads] =
|
|
6972
|
+
const [block, payloads] = assertEx52(await this.blockViewer.blockByNumber(asXL1BlockNumber11(from, true)), () => "Block not found");
|
|
6934
6973
|
const timeSchemaIndex = block.payload_schemas.indexOf(TimeSchema);
|
|
6935
6974
|
const hash = timeSchemaIndex === -1 ? void 0 : block.payload_hashes[timeSchemaIndex];
|
|
6936
|
-
const timePayload = asTimePayload2(
|
|
6975
|
+
const timePayload = asTimePayload2(isDefined24(hash) ? payloads.find((p) => p._hash === hash) : void 0);
|
|
6937
6976
|
if (timePayload === void 0) return 0;
|
|
6938
6977
|
switch (toDomain) {
|
|
6939
6978
|
case "xl1": {
|
|
@@ -6986,10 +7025,10 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
6986
7025
|
return [Date.now(), null];
|
|
6987
7026
|
}
|
|
6988
7027
|
case "ethereum": {
|
|
6989
|
-
const provider =
|
|
7028
|
+
const provider = assertEx52(this.ethProvider, () => "Ethereum provider not configured");
|
|
6990
7029
|
const blockNumber = await provider.getBlockNumber() ?? 0;
|
|
6991
7030
|
const block = await provider.getBlock(blockNumber);
|
|
6992
|
-
const blockHash = asHash5(
|
|
7031
|
+
const blockHash = asHash5(assertEx52(block?.hash, () => "Block hash not found"), true);
|
|
6993
7032
|
return [blockNumber, blockHash];
|
|
6994
7033
|
}
|
|
6995
7034
|
default: {
|
|
@@ -7004,10 +7043,10 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
7004
7043
|
// this is for the previous block
|
|
7005
7044
|
xl1,
|
|
7006
7045
|
// this is for the previous block
|
|
7007
|
-
xl1Hash:
|
|
7046
|
+
xl1Hash: assertEx52(xl1Hash, () => "No xl1 hash available from time sync service"),
|
|
7008
7047
|
epoch: Date.now()
|
|
7009
7048
|
};
|
|
7010
|
-
if (
|
|
7049
|
+
if (isDefined24(this.ethProvider)) {
|
|
7011
7050
|
const [ethereum, ethHashOrNull] = await this.currentTimeAndHash("ethereum");
|
|
7012
7051
|
const ethereumHash = asHash5(ethHashOrNull, () => "No ethereum hash available from time sync service");
|
|
7013
7052
|
timePayload.ethereum = ethereum;
|
|
@@ -7026,7 +7065,7 @@ SimpleTimeSyncViewer = __decorateClass([
|
|
|
7026
7065
|
], SimpleTimeSyncViewer);
|
|
7027
7066
|
|
|
7028
7067
|
// src/simple/transactionValidation/SimpleTransactionValidationViewer.ts
|
|
7029
|
-
import { assertEx as
|
|
7068
|
+
import { assertEx as assertEx53 } from "@ariestools/sdk";
|
|
7030
7069
|
import { PayloadBuilder as PayloadBuilder24 } from "@xyo-network/sdk-js";
|
|
7031
7070
|
import {
|
|
7032
7071
|
AccountBalanceViewerMoniker as AccountBalanceViewerMoniker3,
|
|
@@ -7080,7 +7119,7 @@ var SimpleTransactionValidationViewer = class extends AbstractCreatableProvider
|
|
|
7080
7119
|
let head;
|
|
7081
7120
|
if (isChainQualifiedHeadConfig6(config)) {
|
|
7082
7121
|
const headBlockResult = await this.blockViewer.blockByHash(config.head);
|
|
7083
|
-
head = headBlockResult == null ?
|
|
7122
|
+
head = headBlockResult == null ? assertEx53(
|
|
7084
7123
|
void 0,
|
|
7085
7124
|
() => `Specified a head that is not in the chain [${config.head}]`
|
|
7086
7125
|
) : headBlockResult[0];
|
|
@@ -7152,7 +7191,7 @@ SimpleTransactionValidationViewer = __decorateClass([
|
|
|
7152
7191
|
], SimpleTransactionValidationViewer);
|
|
7153
7192
|
|
|
7154
7193
|
// src/simple/TransactionViewer/SimpleTransactionViewer.ts
|
|
7155
|
-
import { assertEx as
|
|
7194
|
+
import { assertEx as assertEx54, exists as exists10 } from "@ariestools/sdk";
|
|
7156
7195
|
import { BoundWitnessSchema } from "@xyo-network/sdk-js";
|
|
7157
7196
|
import {
|
|
7158
7197
|
asSignedHydratedTransactionWithHashMeta as asSignedHydratedTransactionWithHashMeta2,
|
|
@@ -7169,7 +7208,7 @@ var SimpleTransactionViewer = class extends AbstractCreatableProvider {
|
|
|
7169
7208
|
}
|
|
7170
7209
|
async byBlockHashAndIndex(blockHash, transactionIndex) {
|
|
7171
7210
|
return await this.spanAsync("byBlockHashAndIndex", async () => {
|
|
7172
|
-
|
|
7211
|
+
assertEx54(transactionIndex >= 0, () => "transactionIndex must be greater than or equal to 0");
|
|
7173
7212
|
try {
|
|
7174
7213
|
const block = await this.blockViewer.blockByHash(blockHash);
|
|
7175
7214
|
if (!block) return null;
|
|
@@ -7234,7 +7273,7 @@ SimpleTransactionViewer = __decorateClass([
|
|
|
7234
7273
|
|
|
7235
7274
|
// src/simple/windowedBlock/SimpleWindowedBlockViewer.ts
|
|
7236
7275
|
import {
|
|
7237
|
-
assertEx as
|
|
7276
|
+
assertEx as assertEx55,
|
|
7238
7277
|
exists as exists11,
|
|
7239
7278
|
isNull as isNull3
|
|
7240
7279
|
} from "@ariestools/sdk";
|
|
@@ -7316,7 +7355,7 @@ var SimpleWindowedBlockViewer = class extends AbstractCreatableProvider {
|
|
|
7316
7355
|
}
|
|
7317
7356
|
async createHandler() {
|
|
7318
7357
|
await super.createHandler();
|
|
7319
|
-
this._blockViewer =
|
|
7358
|
+
this._blockViewer = assertEx55(
|
|
7320
7359
|
this.params.blockViewer ?? await this.locator.getInstance(BlockViewerMoniker7),
|
|
7321
7360
|
() => "BlockViewer instance is required"
|
|
7322
7361
|
);
|
|
@@ -7325,13 +7364,13 @@ var SimpleWindowedBlockViewer = class extends AbstractCreatableProvider {
|
|
|
7325
7364
|
this._transactionHashMap = new MemoryMap2();
|
|
7326
7365
|
}
|
|
7327
7366
|
currentBlock() {
|
|
7328
|
-
return
|
|
7367
|
+
return assertEx55(this._chain.at(-1));
|
|
7329
7368
|
}
|
|
7330
7369
|
currentBlockHash() {
|
|
7331
|
-
return
|
|
7370
|
+
return assertEx55(this._chain.at(-1)?.[0]._hash);
|
|
7332
7371
|
}
|
|
7333
7372
|
currentBlockNumber() {
|
|
7334
|
-
return
|
|
7373
|
+
return assertEx55(this._chain.at(-1)?.[0].block);
|
|
7335
7374
|
}
|
|
7336
7375
|
async payloadByHash(hash) {
|
|
7337
7376
|
const payloads = await this.payloadsByHash([hash]);
|
|
@@ -7548,7 +7587,7 @@ var SimpleSystemStatusRunner = class extends LoggerStatusReporter {
|
|
|
7548
7587
|
};
|
|
7549
7588
|
|
|
7550
7589
|
// src/test/buildRandomChain.ts
|
|
7551
|
-
import { asAddress as asAddress2, assertEx as
|
|
7590
|
+
import { asAddress as asAddress2, assertEx as assertEx58 } from "@ariestools/sdk";
|
|
7552
7591
|
import {
|
|
7553
7592
|
Account as Account4,
|
|
7554
7593
|
asSchema as asSchema9,
|
|
@@ -7567,7 +7606,7 @@ import {
|
|
|
7567
7606
|
} from "@xyo-network/xl1-protocol-lib";
|
|
7568
7607
|
|
|
7569
7608
|
// src/test/buildBlock.ts
|
|
7570
|
-
import { assertEx as
|
|
7609
|
+
import { assertEx as assertEx56, isDefined as isDefined25 } from "@ariestools/sdk";
|
|
7571
7610
|
import {
|
|
7572
7611
|
asAnyPayload as asAnyPayload5,
|
|
7573
7612
|
BoundWitnessBuilder as BoundWitnessBuilder4,
|
|
@@ -7650,8 +7689,8 @@ function buildStepHashes(blockNumber, inStepHashes, previousBlockHash, chainStep
|
|
|
7650
7689
|
const completedStepReward = calculateCompletedStepReward(i, stepRewardPoolBalance);
|
|
7651
7690
|
completedStepRewardTransfers.push(createTransferPayload(chainStepRewardAddress2, { [completedStepRewardHolderAddress]: completedStepReward }));
|
|
7652
7691
|
}
|
|
7653
|
-
step_hashes.push(
|
|
7654
|
-
} else if (
|
|
7692
|
+
step_hashes.push(assertEx56(previousBlockHash, () => `Previous block hash is required for step ${step} at block ${blockNumber}`));
|
|
7693
|
+
} else if (isDefined25(inStepHashes.at(i))) {
|
|
7655
7694
|
step_hashes.push(inStepHashes[i]);
|
|
7656
7695
|
}
|
|
7657
7696
|
}
|
|
@@ -7704,7 +7743,7 @@ async function buildBlock(options) {
|
|
|
7704
7743
|
protocol
|
|
7705
7744
|
}).meta({ $epoch: Date.now(), $signatures: [] }).signers(signers).payloads(await PayloadBuilder25.addStorageMeta(payloads));
|
|
7706
7745
|
const [bw, txPayloads] = await builder.build();
|
|
7707
|
-
|
|
7746
|
+
assertEx56(isBlockBoundWitness(bw), () => "Build of BlockBoundWitness failed");
|
|
7708
7747
|
return [await PayloadBuilder25.addStorageMeta(bw), txPayloads.map((p) => asAnyPayload5(p, true))];
|
|
7709
7748
|
}
|
|
7710
7749
|
|
|
@@ -7725,7 +7764,7 @@ async function buildNextBlock(previousBlock, txs, blockPayloads, signers, chainS
|
|
|
7725
7764
|
}
|
|
7726
7765
|
|
|
7727
7766
|
// src/test/buildRandomGenesisBlock.ts
|
|
7728
|
-
import { asAddress, assertEx as
|
|
7767
|
+
import { asAddress, assertEx as assertEx57 } from "@ariestools/sdk";
|
|
7729
7768
|
import {
|
|
7730
7769
|
Account as Account3,
|
|
7731
7770
|
asAnyPayload as asAnyPayload6,
|
|
@@ -7769,7 +7808,7 @@ var buildRandomTransaction = async (chain, payloads, account, nbf = asXL1BlockNu
|
|
|
7769
7808
|
};
|
|
7770
7809
|
|
|
7771
7810
|
// src/test/buildRandomGenesisBlock.ts
|
|
7772
|
-
var TestChainId =
|
|
7811
|
+
var TestChainId = assertEx57(asAddress("c5fe2e6F6841Cbab12d8C0618Be2DF8C6156cC44"));
|
|
7773
7812
|
|
|
7774
7813
|
// src/test/createGenesisBlock.ts
|
|
7775
7814
|
import { PayloadBuilder as PayloadBuilder28 } from "@xyo-network/sdk-js";
|
|
@@ -7824,7 +7863,7 @@ var createGenesisBlock = async (initialBlockProducer, nextContractAddress, genes
|
|
|
7824
7863
|
};
|
|
7825
7864
|
|
|
7826
7865
|
// src/test/buildRandomChain.ts
|
|
7827
|
-
var TestGenesisBlockRewardAddress =
|
|
7866
|
+
var TestGenesisBlockRewardAddress = assertEx58(asAddress2("fa7f0bb865a4bfff3d5e2c726d3e063297014da9"));
|
|
7828
7867
|
var buildRandomChain = async (blockProducer, count = 10, previousBlock, chainId, transactionAccount, receiverAddresses) => {
|
|
7829
7868
|
const chainIdToUse = chainId ?? TestChainId;
|
|
7830
7869
|
const blocks = [];
|
|
@@ -7868,7 +7907,7 @@ var buildRandomChain = async (blockProducer, count = 10, previousBlock, chainId,
|
|
|
7868
7907
|
receiverAddress
|
|
7869
7908
|
));
|
|
7870
7909
|
}
|
|
7871
|
-
const previousBlock2 =
|
|
7910
|
+
const previousBlock2 = assertEx58(lastBlock?.[0], () => new Error("No last block"));
|
|
7872
7911
|
const block = await buildNextBlock(previousBlock2, txs, [], [blockProducer], transactionAccountToUse.address);
|
|
7873
7912
|
blocks.push(block);
|
|
7874
7913
|
remaining = remaining - 1;
|
|
@@ -7929,13 +7968,13 @@ function getTestProviderContext2(config) {
|
|
|
7929
7968
|
}
|
|
7930
7969
|
|
|
7931
7970
|
// src/time/primitives/xl1BlockNumberToEthBlockNumber.ts
|
|
7932
|
-
import { assertEx as
|
|
7971
|
+
import { assertEx as assertEx59 } from "@ariestools/sdk";
|
|
7933
7972
|
import { asTimePayload as asTimePayload3, TimeSchema as TimeSchema2 } from "@xyo-network/xl1-protocol-lib";
|
|
7934
7973
|
async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
7935
7974
|
const blockHash = await hashFromBlockNumber(context, xl1BlockNumber);
|
|
7936
7975
|
const hydratedBlock = await hydrateBlock(context, blockHash);
|
|
7937
7976
|
const timePayload = asTimePayload3(hydratedBlock[1].find((p) => p.schema === TimeSchema2), { required: true });
|
|
7938
|
-
return
|
|
7977
|
+
return assertEx59(timePayload.ethereum, () => "No ethereum timestamp found on block");
|
|
7939
7978
|
}
|
|
7940
7979
|
|
|
7941
7980
|
// src/validation/lib/isLocalhost.ts
|
|
@@ -8259,6 +8298,7 @@ export {
|
|
|
8259
8298
|
resolveProviders,
|
|
8260
8299
|
resolveProvidersFromConfig,
|
|
8261
8300
|
resolveRestConnectionEndpoint,
|
|
8301
|
+
restConnectionFromS3Bucket,
|
|
8262
8302
|
rewardFromBlockNumber,
|
|
8263
8303
|
schemasMaxStep,
|
|
8264
8304
|
schemasStepSummaryFromRange,
|
|
@@ -8278,6 +8318,7 @@ export {
|
|
|
8278
8318
|
stepsRewardTotalGenesisPeriod,
|
|
8279
8319
|
stepsRewardTotalRange,
|
|
8280
8320
|
surfaceForBranch,
|
|
8321
|
+
synthesizeMemoryViewerBindings,
|
|
8281
8322
|
synthesizeRpcConnectionBindings,
|
|
8282
8323
|
timeDurations,
|
|
8283
8324
|
toActorConfig,
|