@xyo-network/xl1-protocol-sdk 2.1.9 → 2.2.0
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/CreatableProvider/AbstractCreatableProvider.d.ts +36 -3
- package/dist/neutral/CreatableProvider/AbstractCreatableProvider.d.ts.map +1 -1
- package/dist/neutral/capabilities/resolveProviders.d.ts +6 -0
- package/dist/neutral/capabilities/resolveProviders.d.ts.map +1 -1
- package/dist/neutral/config/Actor.d.ts +216 -18
- package/dist/neutral/config/Actor.d.ts.map +1 -1
- package/dist/neutral/config/Actors.d.ts +36 -3
- package/dist/neutral/config/Actors.d.ts.map +1 -1
- package/dist/neutral/config/Base.d.ts +36 -3
- package/dist/neutral/config/Base.d.ts.map +1 -1
- package/dist/neutral/config/Chain.d.ts +1 -1
- package/dist/neutral/config/Config.d.ts +144 -12
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/HostActor.d.ts +216 -18
- package/dist/neutral/config/HostActor.d.ts.map +1 -1
- package/dist/neutral/config/ProviderBinding.d.ts +18 -0
- package/dist/neutral/config/ProviderBinding.d.ts.map +1 -0
- package/dist/neutral/config/Validation.d.ts +2 -2
- package/dist/neutral/config/adaptLegacyConfig.d.ts +9 -0
- package/dist/neutral/config/adaptLegacyConfig.d.ts.map +1 -0
- package/dist/neutral/config/index.d.ts +3 -0
- package/dist/neutral/config/index.d.ts.map +1 -1
- package/dist/neutral/config/transports/Transport.d.ts +111 -0
- package/dist/neutral/config/transports/Transport.d.ts.map +1 -0
- package/dist/neutral/config/transports/index.d.ts +2 -0
- package/dist/neutral/config/transports/index.d.ts.map +1 -0
- package/dist/neutral/context/Actor.d.ts +216 -18
- package/dist/neutral/context/Actor.d.ts.map +1 -1
- package/dist/neutral/context/HostActor.d.ts +216 -18
- package/dist/neutral/context/HostActor.d.ts.map +1 -1
- package/dist/neutral/createDeclarationPayload.d.ts +1 -1
- package/dist/neutral/createDeclarationPayload.d.ts.map +1 -1
- package/dist/neutral/createTransferPayload.d.ts +1 -1
- package/dist/neutral/createTransferPayload.d.ts.map +1 -1
- package/dist/neutral/getFileConfig.d.ts +72 -6
- package/dist/neutral/getFileConfig.d.ts.map +1 -1
- package/dist/neutral/getFileConfig.mjs +149 -80
- package/dist/neutral/getFileConfig.mjs.map +4 -4
- package/dist/neutral/index.mjs +387 -173
- package/dist/neutral/index.mjs.map +4 -4
- package/dist/neutral/instances/Address.d.ts +1 -1
- package/dist/neutral/instances/Address.d.ts.map +1 -1
- package/dist/neutral/instances/Signature.d.ts +1 -1
- package/dist/neutral/instances/Signature.d.ts.map +1 -1
- package/dist/neutral/model/CreatableProviderContext.zod.d.ts +216 -18
- package/dist/neutral/model/CreatableProviderContext.zod.d.ts.map +1 -1
- package/dist/neutral/payloads/AddressPairPayload.d.ts +1 -2
- package/dist/neutral/payloads/AddressPairPayload.d.ts.map +1 -1
- package/dist/neutral/payloads/netBalancesForPayloads.d.ts +2 -2
- package/dist/neutral/payloads/netBalancesForPayloads.d.ts.map +1 -1
- package/dist/neutral/payloads/netSchemasForPayloads.d.ts +2 -2
- package/dist/neutral/payloads/netSchemasForPayloads.d.ts.map +1 -1
- package/dist/neutral/payloads/netTransfersForPayloads.d.ts +1 -2
- package/dist/neutral/payloads/netTransfersForPayloads.d.ts.map +1 -1
- package/dist/neutral/primitives/chain/step/chainStepRewardAddress.d.ts +1 -1
- package/dist/neutral/primitives/chain/step/chainStepRewardAddress.d.ts.map +1 -1
- package/dist/neutral/primitives/payload/mergeTransfers.d.ts +1 -1
- package/dist/neutral/primitives/payload/mergeTransfers.d.ts.map +1 -1
- package/dist/neutral/primitives/stake/activeStakeAtTimeByAddress.d.ts +1 -1
- package/dist/neutral/primitives/stake/activeStakeAtTimeByAddress.d.ts.map +1 -1
- package/dist/neutral/primitives/stake/allStakersForRange.d.ts +1 -1
- package/dist/neutral/primitives/stake/allStakersForRange.d.ts.map +1 -1
- package/dist/neutral/primitives/stake/allStakersForStep.d.ts +1 -1
- package/dist/neutral/primitives/stake/allStakersForStep.d.ts.map +1 -1
- package/dist/neutral/primitives/stake/mergedAddRemoveStakeEventsByStaker.d.ts +1 -1
- package/dist/neutral/primitives/stake/mergedAddRemoveStakeEventsByStaker.d.ts.map +1 -1
- package/dist/neutral/primitives/stake/weightedStakeForRangeByPosition.d.ts +1 -1
- package/dist/neutral/primitives/stake/weightedStakeForRangeByPosition.d.ts.map +1 -1
- package/dist/neutral/primitives/uncle/findUncles.d.ts +2 -2
- package/dist/neutral/services/AccountTransfersService.d.ts +1 -1
- package/dist/neutral/services/AccountTransfersService.d.ts.map +1 -1
- package/dist/neutral/services/Election.d.ts +1 -2
- package/dist/neutral/services/Election.d.ts.map +1 -1
- package/dist/neutral/services/StakeIntentService/StakeIntentService.d.ts +1 -1
- package/dist/neutral/services/StakeIntentService/StakeIntentService.d.ts.map +1 -1
- package/dist/neutral/simple/StakeTotalsViewer/SimpleStakeTotalsViewer.d.ts +1 -1
- package/dist/neutral/simple/StakeTotalsViewer/SimpleStakeTotalsViewer.d.ts.map +1 -1
- package/dist/neutral/simple/StakeViewer/SimpleStakeViewer.d.ts +1 -1
- package/dist/neutral/simple/StakeViewer/SimpleStakeViewer.d.ts.map +1 -1
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts +9 -10
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts.map +1 -1
- package/dist/neutral/simple/blockInvalidation/SimpleBlockInvalidationViewer.d.ts +1 -1
- package/dist/neutral/simple/blockValidation/SimpleBlockValidationViewer.d.ts +1 -1
- package/dist/neutral/simple/chainContractViewer/SimpleChainContractViewer.d.ts +3 -3
- package/dist/neutral/simple/chainContractViewer/SimpleChainContractViewer.d.ts.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts +1 -2
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts.map +1 -1
- package/dist/neutral/simple/mempool/SimpleMempoolRunner.d.ts +1 -1
- package/dist/neutral/simple/signer/SimpleXyoSigner.d.ts +1 -2
- package/dist/neutral/simple/signer/SimpleXyoSigner.d.ts.map +1 -1
- package/dist/neutral/simple/timeSync2/SimpleTimeSyncViewer.d.ts +1 -1
- package/dist/neutral/simple/timeSync2/SimpleTimeSyncViewer.d.ts.map +1 -1
- package/dist/neutral/simple/transactionInvalidation/SimpleTransactionInvalidationViewer.d.ts +1 -1
- package/dist/neutral/simple/transactionValidation/SimpleTransactionValidationViewer.d.ts +1 -1
- package/dist/neutral/summary/model/BalancesStepSummary.d.ts +1 -2
- package/dist/neutral/summary/model/BalancesStepSummary.d.ts.map +1 -1
- package/dist/neutral/summary/model/TransfersSummary.d.ts +1 -2
- package/dist/neutral/summary/model/TransfersSummary.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/balances/balancesSummary.d.ts +1 -1
- package/dist/neutral/summary/primitives/balances/balancesSummary.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/transfers/transfersSummary.d.ts +1 -1
- package/dist/neutral/summary/primitives/transfers/transfersSummary.d.ts.map +1 -1
- package/dist/neutral/test/BuildBlockOptions.d.ts +1 -2
- package/dist/neutral/test/BuildBlockOptions.d.ts.map +1 -1
- package/dist/neutral/test/buildNextBlock.d.ts +1 -2
- package/dist/neutral/test/buildNextBlock.d.ts.map +1 -1
- package/dist/neutral/test/buildRandomChain.d.ts +1 -2
- package/dist/neutral/test/buildRandomChain.d.ts.map +1 -1
- package/dist/neutral/test/buildRandomTransaction.d.ts +1 -2
- package/dist/neutral/test/buildRandomTransaction.d.ts.map +1 -1
- package/dist/neutral/test/createGenesisBlock.d.ts +1 -2
- package/dist/neutral/test/createGenesisBlock.d.ts.map +1 -1
- package/dist/neutral/test/createProducerChainStakeIntentTransaction.d.ts +1 -2
- package/dist/neutral/test/createProducerChainStakeIntentTransaction.d.ts.map +1 -1
- package/dist/neutral/test/getSimpleBlockViewerLocator.d.ts +1 -2
- package/dist/neutral/test/getSimpleBlockViewerLocator.d.ts.map +1 -1
- package/dist/neutral/test/index.mjs +147 -78
- package/dist/neutral/test/index.mjs.map +4 -4
- package/dist/neutral/transaction/buildTransaction.d.ts +1 -2
- package/dist/neutral/transaction/buildTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/buildUnsignedTransaction.d.ts +1 -2
- package/dist/neutral/transaction/buildUnsignedTransaction.d.ts.map +1 -1
- package/package.json +6 -8
package/dist/neutral/index.mjs
CHANGED
|
@@ -1023,7 +1023,7 @@ function resolveProviders(needs, candidates, ctx, options = {}) {
|
|
|
1023
1023
|
const { surviving, rejected: preconditionRejected } = filterByPreconditions(backingFiltered, ctx);
|
|
1024
1024
|
const rejected = [...backingRejected, ...preconditionRejected];
|
|
1025
1025
|
const byCapability = groupByCapability(surviving, wanted);
|
|
1026
|
-
const { bindings, selectedById } = pickWinners(wanted, byCapability, rejected, candidates);
|
|
1026
|
+
const { bindings, selectedById } = pickWinners(wanted, byCapability, rejected, candidates, options);
|
|
1027
1027
|
const selected = topoSort([...selectedById.values()], ctx);
|
|
1028
1028
|
return {
|
|
1029
1029
|
bindings,
|
|
@@ -1095,11 +1095,19 @@ function groupByCapability(surviving, wanted) {
|
|
|
1095
1095
|
}
|
|
1096
1096
|
return byCapability;
|
|
1097
1097
|
}
|
|
1098
|
-
function pickWinners(wanted, byCapability, rejected, allCandidates) {
|
|
1098
|
+
function pickWinners(wanted, byCapability, rejected, allCandidates, options) {
|
|
1099
1099
|
const bindings = {};
|
|
1100
1100
|
const selectedById = /* @__PURE__ */ new Map();
|
|
1101
1101
|
for (const moniker of wanted) {
|
|
1102
|
-
|
|
1102
|
+
let group = byCapability.get(moniker);
|
|
1103
|
+
const pinned = options.implementations?.[moniker];
|
|
1104
|
+
if (pinned) {
|
|
1105
|
+
const pinnedGroup = group?.filter((descriptor) => descriptor.id === pinned);
|
|
1106
|
+
if (!pinnedGroup || pinnedGroup.length === 0) {
|
|
1107
|
+
throw new MissingCapabilityError(moniker, [`requested implementation '${pinned}' not available`]);
|
|
1108
|
+
}
|
|
1109
|
+
group = pinnedGroup;
|
|
1110
|
+
}
|
|
1103
1111
|
if (!group || group.length === 0) {
|
|
1104
1112
|
throw new MissingCapabilityError(moniker, reasonsFor(moniker, rejected, allCandidates));
|
|
1105
1113
|
}
|
|
@@ -1162,14 +1170,14 @@ import {
|
|
|
1162
1170
|
zodIsFactory as zodIsFactory2,
|
|
1163
1171
|
zodToFactory as zodToFactory2
|
|
1164
1172
|
} from "@xylabs/sdk-js";
|
|
1165
|
-
import { globalRegistry as
|
|
1173
|
+
import { globalRegistry as globalRegistry14, z as z20 } from "zod/mini";
|
|
1166
1174
|
|
|
1167
1175
|
// src/config/Base.ts
|
|
1168
|
-
import { z as
|
|
1176
|
+
import { z as z19 } from "zod/mini";
|
|
1169
1177
|
|
|
1170
1178
|
// src/config/Chain.ts
|
|
1171
1179
|
import { HexZod } from "@xylabs/sdk-js";
|
|
1172
|
-
import { XyoAddressZod } from "@xyo-network/
|
|
1180
|
+
import { XyoAddressZod } from "@xyo-network/sdk-js";
|
|
1173
1181
|
import { globalRegistry, z as z2 } from "zod/mini";
|
|
1174
1182
|
var ChainConfigZod = z2.object({
|
|
1175
1183
|
id: z2.optional(HexZod).register(globalRegistry, {
|
|
@@ -1278,8 +1286,24 @@ var LogConfigZod = z8.object({
|
|
|
1278
1286
|
})
|
|
1279
1287
|
});
|
|
1280
1288
|
|
|
1289
|
+
// src/config/ProviderBinding.ts
|
|
1290
|
+
import { globalRegistry as globalRegistry7, z as z9 } from "zod";
|
|
1291
|
+
var ProviderBindingConfigZod = z9.object({
|
|
1292
|
+
implementation: z9.string().optional().register(globalRegistry7, {
|
|
1293
|
+
description: "Installed provider implementation id (descriptor id)",
|
|
1294
|
+
title: "providerBindings.implementation",
|
|
1295
|
+
type: "string"
|
|
1296
|
+
}),
|
|
1297
|
+
transport: z9.string().optional().register(globalRegistry7, {
|
|
1298
|
+
description: "Named transport from the top-level transports map",
|
|
1299
|
+
title: "providerBindings.transport",
|
|
1300
|
+
type: "string"
|
|
1301
|
+
})
|
|
1302
|
+
}).describe("Provider implementation and transport binding");
|
|
1303
|
+
var ProviderBindingsConfigZod = z9.record(z9.string(), ProviderBindingConfigZod).default({});
|
|
1304
|
+
|
|
1281
1305
|
// src/config/Providers.ts
|
|
1282
|
-
import
|
|
1306
|
+
import z11 from "zod";
|
|
1283
1307
|
|
|
1284
1308
|
// src/config/Provider.ts
|
|
1285
1309
|
import {
|
|
@@ -1287,83 +1311,83 @@ import {
|
|
|
1287
1311
|
zodIsFactory,
|
|
1288
1312
|
zodToFactory
|
|
1289
1313
|
} from "@xylabs/sdk-js";
|
|
1290
|
-
import { z as
|
|
1291
|
-
var ProviderConfigZod =
|
|
1292
|
-
moniker:
|
|
1293
|
-
labels:
|
|
1314
|
+
import { z as z10 } from "zod";
|
|
1315
|
+
var ProviderConfigZod = z10.object({
|
|
1316
|
+
moniker: z10.string(),
|
|
1317
|
+
labels: z10.array(z10.string()).optional()
|
|
1294
1318
|
}).describe("Configuration for a Provider");
|
|
1295
1319
|
var isProviderConfig = zodIsFactory(ProviderConfigZod);
|
|
1296
1320
|
var asProviderConfig = zodAsFactory2(ProviderConfigZod, "asProviderConfig");
|
|
1297
1321
|
var toProviderConfig = zodToFactory(ProviderConfigZod, "toProviderConfig");
|
|
1298
1322
|
|
|
1299
1323
|
// src/config/Providers.ts
|
|
1300
|
-
var ProvidersConfigZod =
|
|
1324
|
+
var ProvidersConfigZod = z11.array(ProviderConfigZod.loose()).describe("Configuration for providers").default([]);
|
|
1301
1325
|
|
|
1302
1326
|
// src/config/Remote.ts
|
|
1303
|
-
import { globalRegistry as
|
|
1304
|
-
var RpcRemoteConfigBaseZod =
|
|
1305
|
-
protocol:
|
|
1327
|
+
import { globalRegistry as globalRegistry8, z as z12 } from "zod";
|
|
1328
|
+
var RpcRemoteConfigBaseZod = z12.object({
|
|
1329
|
+
protocol: z12.string("http").register(globalRegistry8, {
|
|
1306
1330
|
description: "Protocol for the RPC connection",
|
|
1307
1331
|
type: "string"
|
|
1308
1332
|
})
|
|
1309
1333
|
}).describe("Base configuration for the remote RPC");
|
|
1310
1334
|
var HttpRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({
|
|
1311
|
-
protocol:
|
|
1335
|
+
protocol: z12.string("http").register(globalRegistry8, {
|
|
1312
1336
|
description: "Protocol for the RPC connection",
|
|
1313
1337
|
type: "string"
|
|
1314
1338
|
}).default("http"),
|
|
1315
|
-
url:
|
|
1339
|
+
url: z12.string().register(globalRegistry8, {
|
|
1316
1340
|
description: "URL for the Chain RPC API",
|
|
1317
1341
|
type: "string"
|
|
1318
1342
|
})
|
|
1319
1343
|
}).describe("Configuration for the remote RPC using Http");
|
|
1320
1344
|
var PostMessageRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({
|
|
1321
|
-
protocol:
|
|
1345
|
+
protocol: z12.string().register(globalRegistry8, {
|
|
1322
1346
|
description: "Protocol for the RPC connection",
|
|
1323
1347
|
type: "string"
|
|
1324
1348
|
}).default("postMessage"),
|
|
1325
|
-
networkId:
|
|
1349
|
+
networkId: z12.string().register(globalRegistry8, {
|
|
1326
1350
|
description: "Network ID to use for the postMessage RPC connection",
|
|
1327
1351
|
type: "string"
|
|
1328
1352
|
}),
|
|
1329
|
-
sessionId:
|
|
1353
|
+
sessionId: z12.string().register(globalRegistry8, {
|
|
1330
1354
|
description: "Session ID to use for the postMessage RPC connection",
|
|
1331
1355
|
type: "string"
|
|
1332
1356
|
})
|
|
1333
1357
|
}).describe("Configuration for the remote RPC using postMessage");
|
|
1334
|
-
var RpcRemoteConfigZod =
|
|
1335
|
-
var RemoteConfigZod =
|
|
1358
|
+
var RpcRemoteConfigZod = z12.union([HttpRpcRemoteConfigZod, PostMessageRpcRemoteConfigZod]).describe("Configuration for a remote RPC connection, either Http or postMessage");
|
|
1359
|
+
var RemoteConfigZod = z12.object({ rpc: RpcRemoteConfigZod.optional() }).describe("Configuration for remote connections, including RPC");
|
|
1336
1360
|
|
|
1337
1361
|
// src/config/storage/driver/Mongo.ts
|
|
1338
1362
|
import { isDefined as isDefined4, isUndefined as isUndefined5 } from "@xylabs/sdk-js";
|
|
1339
|
-
import { globalRegistry as
|
|
1363
|
+
import { globalRegistry as globalRegistry9, z as z13 } from "zod";
|
|
1340
1364
|
var hasMongoConfig = (config) => {
|
|
1341
1365
|
if (isUndefined5(config)) return false;
|
|
1342
1366
|
return isDefined4(config.connectionString) && isDefined4(config.database) && isDefined4(config.domain);
|
|
1343
1367
|
};
|
|
1344
|
-
var MongoConfigZod =
|
|
1368
|
+
var MongoConfigZod = z13.object({
|
|
1345
1369
|
// TODO: Create from other arguments
|
|
1346
|
-
connectionString:
|
|
1370
|
+
connectionString: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1347
1371
|
description: "MongoDB connection string",
|
|
1348
1372
|
title: "storage.mongo.connectionString",
|
|
1349
1373
|
type: "string"
|
|
1350
1374
|
}),
|
|
1351
|
-
database:
|
|
1375
|
+
database: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1352
1376
|
description: "MongoDB database name",
|
|
1353
1377
|
title: "storage.mongo.database",
|
|
1354
1378
|
type: "string"
|
|
1355
1379
|
}),
|
|
1356
|
-
domain:
|
|
1380
|
+
domain: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1357
1381
|
description: "MongoDB domain",
|
|
1358
1382
|
title: "storage.mongo.domain",
|
|
1359
1383
|
type: "string"
|
|
1360
1384
|
}),
|
|
1361
|
-
password:
|
|
1385
|
+
password: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1362
1386
|
description: "MongoDB password",
|
|
1363
1387
|
title: "storage.mongo.password",
|
|
1364
1388
|
type: "string"
|
|
1365
1389
|
}),
|
|
1366
|
-
username:
|
|
1390
|
+
username: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1367
1391
|
description: "MongoDB username",
|
|
1368
1392
|
title: "storage.mongo.username",
|
|
1369
1393
|
type: "string"
|
|
@@ -1372,23 +1396,23 @@ var MongoConfigZod = z12.object({
|
|
|
1372
1396
|
|
|
1373
1397
|
// src/config/storage/driver/S3.ts
|
|
1374
1398
|
import { isDefined as isDefined5 } from "@xylabs/sdk-js";
|
|
1375
|
-
import { z as
|
|
1376
|
-
var S3BucketConfigZod =
|
|
1377
|
-
accessKeyId:
|
|
1378
|
-
accountId:
|
|
1379
|
-
bucket:
|
|
1380
|
-
prefix:
|
|
1381
|
-
readUrl:
|
|
1382
|
-
secretAccessKey:
|
|
1399
|
+
import { z as z14 } from "zod";
|
|
1400
|
+
var S3BucketConfigZod = z14.object({
|
|
1401
|
+
accessKeyId: z14.string().nonempty().optional().describe("S3-compatible access key id for this bucket (overrides the shared default)"),
|
|
1402
|
+
accountId: z14.string().nonempty().optional().describe("Account id for this bucket; on Cloudflare R2 it forms the endpoint (overrides the shared default)"),
|
|
1403
|
+
bucket: z14.string().nonempty().optional().describe("S3-compatible bucket name"),
|
|
1404
|
+
prefix: z14.string().nonempty().optional().describe("Optional key prefix within the bucket"),
|
|
1405
|
+
readUrl: z14.string().nonempty().optional().describe("Public HTTP/CDN base URL for anonymous reads of this bucket"),
|
|
1406
|
+
secretAccessKey: z14.string().nonempty().optional().describe("S3-compatible secret access key for this bucket (overrides the shared default)")
|
|
1383
1407
|
});
|
|
1384
|
-
var S3ConfigZod =
|
|
1385
|
-
accessKeyId:
|
|
1386
|
-
accountId:
|
|
1408
|
+
var S3ConfigZod = z14.object({
|
|
1409
|
+
accessKeyId: z14.string().nonempty().optional().describe("Shared S3-compatible access key id (default for all buckets)"),
|
|
1410
|
+
accountId: z14.string().nonempty().optional().describe("Shared account id (default for all buckets; on Cloudflare R2 it forms the endpoint)"),
|
|
1387
1411
|
chainState: S3BucketConfigZod.optional().describe("Bucket for the mutable chain state (the head pointer)"),
|
|
1388
1412
|
finalized: S3BucketConfigZod.optional().describe("Bucket for the finalized files (blocks, payloads, manifest)"),
|
|
1389
1413
|
index: S3BucketConfigZod.optional().describe("Bucket for the chain index (the step-summary families)"),
|
|
1390
|
-
prefix:
|
|
1391
|
-
secretAccessKey:
|
|
1414
|
+
prefix: z14.string().nonempty().optional().describe("Shared key prefix (default for all buckets)"),
|
|
1415
|
+
secretAccessKey: z14.string().nonempty().optional().describe("Shared S3-compatible secret access key (default for all buckets)")
|
|
1392
1416
|
});
|
|
1393
1417
|
function resolveS3Bucket(config, which) {
|
|
1394
1418
|
if (config === void 0) return void 0;
|
|
@@ -1412,10 +1436,10 @@ function hasS3Config(config, which = "finalized") {
|
|
|
1412
1436
|
}
|
|
1413
1437
|
|
|
1414
1438
|
// src/config/storage/Storage.ts
|
|
1415
|
-
import { globalRegistry as
|
|
1416
|
-
var StorageConfigZod =
|
|
1439
|
+
import { globalRegistry as globalRegistry10, z as z15 } from "zod";
|
|
1440
|
+
var StorageConfigZod = z15.object({
|
|
1417
1441
|
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
1418
|
-
root:
|
|
1442
|
+
root: z15.string().optional().register(globalRegistry10, {
|
|
1419
1443
|
description: "Root directory for local storage",
|
|
1420
1444
|
title: "storage.root",
|
|
1421
1445
|
type: "string"
|
|
@@ -1424,7 +1448,7 @@ var StorageConfigZod = z14.object({
|
|
|
1424
1448
|
}).describe("Storage configuration options");
|
|
1425
1449
|
|
|
1426
1450
|
// src/config/Telemetry.ts
|
|
1427
|
-
import { globalRegistry as
|
|
1451
|
+
import { globalRegistry as globalRegistry11, z as z16 } from "zod";
|
|
1428
1452
|
var DefaultMetricsScrapePorts = {
|
|
1429
1453
|
api: 9465,
|
|
1430
1454
|
bridge: 9468,
|
|
@@ -1432,38 +1456,89 @@ var DefaultMetricsScrapePorts = {
|
|
|
1432
1456
|
producer: 9464,
|
|
1433
1457
|
rewardRedemptionApi: 9467
|
|
1434
1458
|
};
|
|
1435
|
-
var MetricsScrapeConfigZod =
|
|
1436
|
-
path:
|
|
1459
|
+
var MetricsScrapeConfigZod = z16.object({
|
|
1460
|
+
path: z16.string().default("/metrics").register(globalRegistry11, {
|
|
1437
1461
|
default: "/metrics",
|
|
1438
1462
|
description: "Path for the metrics scrape endpoint",
|
|
1439
1463
|
title: "telemetry.metrics.scrape.path",
|
|
1440
1464
|
type: "string"
|
|
1441
1465
|
}),
|
|
1442
|
-
port:
|
|
1466
|
+
port: z16.coerce.number().int().positive().optional().register(globalRegistry11, {
|
|
1443
1467
|
description: "Port for the metrics scrape endpoint",
|
|
1444
1468
|
title: "telemetry.metrics.scrape.port",
|
|
1445
1469
|
type: "number"
|
|
1446
1470
|
})
|
|
1447
1471
|
}).describe("Metrics scrape configuration");
|
|
1448
|
-
var MetricsConfigZod =
|
|
1449
|
-
var OpenTelemetryConfigZod =
|
|
1472
|
+
var MetricsConfigZod = z16.object({ scrape: MetricsScrapeConfigZod }).describe("Metrics configuration options");
|
|
1473
|
+
var OpenTelemetryConfigZod = z16.object({
|
|
1450
1474
|
// OpenTelemetry options
|
|
1451
|
-
otlpEndpoint:
|
|
1475
|
+
otlpEndpoint: z16.url().optional().register(globalRegistry11, {
|
|
1452
1476
|
description: "OTLP endpoint for exporting telemetry data",
|
|
1453
1477
|
title: "telemetry.otel.otlpEndpoint",
|
|
1454
1478
|
type: "string"
|
|
1455
1479
|
})
|
|
1456
1480
|
});
|
|
1457
|
-
var TelemetryConfigZod =
|
|
1481
|
+
var TelemetryConfigZod = z16.object({
|
|
1458
1482
|
// Metrics configuration
|
|
1459
1483
|
metrics: MetricsConfigZod.optional().describe("Metrics configuration"),
|
|
1460
1484
|
// OpenTelemetry configuration
|
|
1461
1485
|
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
1462
1486
|
}).describe("Telemetry configuration options");
|
|
1463
1487
|
|
|
1488
|
+
// src/config/transports/Transport.ts
|
|
1489
|
+
import { globalRegistry as globalRegistry12, z as z17 } from "zod";
|
|
1490
|
+
var LmdbTransportConfigZod = z17.object({
|
|
1491
|
+
type: z17.literal("lmdb"),
|
|
1492
|
+
root: z17.string().register(globalRegistry12, {
|
|
1493
|
+
description: "Root directory for local LMDB storage",
|
|
1494
|
+
title: "transports.lmdb.root",
|
|
1495
|
+
type: "string"
|
|
1496
|
+
})
|
|
1497
|
+
}).describe("LMDB local storage transport");
|
|
1498
|
+
var MongoTransportConfigZod = z17.object({
|
|
1499
|
+
type: z17.literal("mongo"),
|
|
1500
|
+
connectionString: MongoConfigZod.shape.connectionString,
|
|
1501
|
+
database: MongoConfigZod.shape.database,
|
|
1502
|
+
domain: MongoConfigZod.shape.domain,
|
|
1503
|
+
password: MongoConfigZod.shape.password,
|
|
1504
|
+
username: MongoConfigZod.shape.username
|
|
1505
|
+
}).describe("MongoDB storage transport");
|
|
1506
|
+
var RpcTransportConfigZod = HttpRpcRemoteConfigZod.extend({ type: z17.literal("rpc") }).describe("XL1 JSON-RPC transport");
|
|
1507
|
+
var RestTransportConfigZod = z17.object({
|
|
1508
|
+
type: z17.literal("rest"),
|
|
1509
|
+
baseUrl: z17.string().register(globalRegistry12, {
|
|
1510
|
+
description: "HTTP base URL for REST reads",
|
|
1511
|
+
title: "transports.rest.baseUrl",
|
|
1512
|
+
type: "string"
|
|
1513
|
+
})
|
|
1514
|
+
}).describe("HTTP REST read transport");
|
|
1515
|
+
var S3TransportConfigZod = S3BucketConfigZod.extend({
|
|
1516
|
+
type: z17.literal("s3"),
|
|
1517
|
+
accessKeyId: z17.string().optional(),
|
|
1518
|
+
accountId: z17.string().optional(),
|
|
1519
|
+
secretAccessKey: z17.string().optional()
|
|
1520
|
+
}).describe("S3-compatible object storage transport");
|
|
1521
|
+
var EvmRpcTransportConfigZod = z17.object({
|
|
1522
|
+
type: z17.literal("evm-rpc"),
|
|
1523
|
+
url: z17.string().register(globalRegistry12, {
|
|
1524
|
+
description: "EVM JSON-RPC URL",
|
|
1525
|
+
title: "transports.evm-rpc.url",
|
|
1526
|
+
type: "string"
|
|
1527
|
+
})
|
|
1528
|
+
}).describe("EVM JSON-RPC transport");
|
|
1529
|
+
var TransportConfigZod = z17.discriminatedUnion("type", [
|
|
1530
|
+
LmdbTransportConfigZod,
|
|
1531
|
+
MongoTransportConfigZod,
|
|
1532
|
+
RpcTransportConfigZod,
|
|
1533
|
+
RestTransportConfigZod,
|
|
1534
|
+
S3TransportConfigZod,
|
|
1535
|
+
EvmRpcTransportConfigZod
|
|
1536
|
+
]);
|
|
1537
|
+
var TransportsConfigZod = z17.record(z17.string(), TransportConfigZod).default({});
|
|
1538
|
+
|
|
1464
1539
|
// src/config/Validation.ts
|
|
1465
|
-
import { XyoAddressZod as XyoAddressZod2 } from "@xyo-network/
|
|
1466
|
-
import { globalRegistry as
|
|
1540
|
+
import { XyoAddressZod as XyoAddressZod2 } from "@xyo-network/sdk-js";
|
|
1541
|
+
import { globalRegistry as globalRegistry13, z as z18 } from "zod";
|
|
1467
1542
|
|
|
1468
1543
|
// src/primitives/block/range/blockRangeSteps.ts
|
|
1469
1544
|
import { asXL1BlockNumber as asXL1BlockNumber2, StepSizes as StepSizes3 } from "@xyo-network/xl1-protocol-lib";
|
|
@@ -1709,7 +1784,7 @@ async function getWindowedChain(context, blockViewer, maxWindowSize, previousCha
|
|
|
1709
1784
|
|
|
1710
1785
|
// src/primitives/chain/step/chainStepRewardAddress.ts
|
|
1711
1786
|
import { assertEx as assertEx14, exists } from "@xylabs/sdk-js";
|
|
1712
|
-
import { toXyoAddress as toXyoAddress2 } from "@xyo-network/
|
|
1787
|
+
import { toXyoAddress as toXyoAddress2 } from "@xyo-network/sdk-js";
|
|
1713
1788
|
import {
|
|
1714
1789
|
asTransfer,
|
|
1715
1790
|
isTransfer,
|
|
@@ -1718,7 +1793,7 @@ import {
|
|
|
1718
1793
|
|
|
1719
1794
|
// src/primitives/payload/mergeTransfers.ts
|
|
1720
1795
|
import { hexToBigInt } from "@xylabs/sdk-js";
|
|
1721
|
-
import { toXyoAddress } from "@xyo-network/
|
|
1796
|
+
import { toXyoAddress } from "@xyo-network/sdk-js";
|
|
1722
1797
|
function mergeTransfers(transfers) {
|
|
1723
1798
|
const result = {};
|
|
1724
1799
|
for (const transfer of transfers) {
|
|
@@ -1804,7 +1879,9 @@ var asOptionalAddressPairPayload = AsObjectFactory.createOptional(isAddressPairP
|
|
|
1804
1879
|
// src/payloads/netBalancesForPayloads.ts
|
|
1805
1880
|
import { hexToBigInt as hexToBigInt2 } from "@xylabs/sdk-js";
|
|
1806
1881
|
import { span } from "@xylabs/sdk-js";
|
|
1807
|
-
import {
|
|
1882
|
+
import {
|
|
1883
|
+
toXyoAddress as toXyoAddress3
|
|
1884
|
+
} from "@xyo-network/sdk-js";
|
|
1808
1885
|
import { isTransfer as isTransfer2 } from "@xyo-network/xl1-protocol-lib";
|
|
1809
1886
|
var netBalancesForPayloads = (context, payloads) => {
|
|
1810
1887
|
return span("netBalancesForPayloads", () => {
|
|
@@ -1825,7 +1902,9 @@ var netBalancesForPayloads = (context, payloads) => {
|
|
|
1825
1902
|
// src/payloads/netSchemasForPayloads.ts
|
|
1826
1903
|
import { hexToBigInt as hexToBigInt3 } from "@xylabs/sdk-js";
|
|
1827
1904
|
import { span as span2 } from "@xylabs/sdk-js";
|
|
1828
|
-
import {
|
|
1905
|
+
import {
|
|
1906
|
+
toXyoAddress as toXyoAddress4
|
|
1907
|
+
} from "@xyo-network/sdk-js";
|
|
1829
1908
|
import { isTransfer as isTransfer3 } from "@xyo-network/xl1-protocol-lib";
|
|
1830
1909
|
var netSchemasForPayloads = (context, payloads) => {
|
|
1831
1910
|
return span2("netSchemasForPayloads", () => {
|
|
@@ -2127,7 +2206,7 @@ async function activeStakeAtTimeByPosition(chainStakeEvents, externalTime, posit
|
|
|
2127
2206
|
}
|
|
2128
2207
|
|
|
2129
2208
|
// src/primitives/stake/allStakersForRange.ts
|
|
2130
|
-
import { toXyoAddress as toXyoAddress5 } from "@xyo-network/
|
|
2209
|
+
import { toXyoAddress as toXyoAddress5 } from "@xyo-network/sdk-js";
|
|
2131
2210
|
async function allStakersForRange(chain, externalRange, staked) {
|
|
2132
2211
|
const mergedEvents = await mergedAddRemoveStakeEventsByStaker(chain, [0, externalRange[1]], staked);
|
|
2133
2212
|
const resultWithZeros = {};
|
|
@@ -2362,24 +2441,24 @@ function findUncles(context, finalizedWindowedChain, blocks) {
|
|
|
2362
2441
|
}
|
|
2363
2442
|
|
|
2364
2443
|
// src/config/Validation.ts
|
|
2365
|
-
var ValidationConfigZod =
|
|
2366
|
-
allowedRewardRedeemers:
|
|
2444
|
+
var ValidationConfigZod = z18.object({
|
|
2445
|
+
allowedRewardRedeemers: z18.array(XyoAddressZod2).optional().register(globalRegistry13, {
|
|
2367
2446
|
description: "List of allowed reward redeemer addresses, if undefined anyone can participate",
|
|
2368
2447
|
title: "allowedRewardRedeemers",
|
|
2369
2448
|
type: "array"
|
|
2370
2449
|
}),
|
|
2371
|
-
allowedRewardEscrowAccountSigners:
|
|
2450
|
+
allowedRewardEscrowAccountSigners: z18.array(XyoAddressZod2).optional().register(globalRegistry13, {
|
|
2372
2451
|
description: "List of allowed reward escrow account signer addresses, if undefined anyone can participate",
|
|
2373
2452
|
title: "allowedRewardEscrowAccountSigners",
|
|
2374
2453
|
type: "array"
|
|
2375
2454
|
}),
|
|
2376
|
-
minCandidates:
|
|
2455
|
+
minCandidates: z18.coerce.number().default(DEFAULT_MIN_CANDIDATES).register(globalRegistry13, {
|
|
2377
2456
|
default: DEFAULT_MIN_CANDIDATES,
|
|
2378
2457
|
description: "Minimum number of uncle candidates before selecting the best uncle",
|
|
2379
2458
|
title: "validation.minCandidates",
|
|
2380
2459
|
type: "number"
|
|
2381
2460
|
}),
|
|
2382
|
-
backoffMs:
|
|
2461
|
+
backoffMs: z18.coerce.number().default(DEFAULT_BACKOFF_MS).register(globalRegistry13, {
|
|
2383
2462
|
default: DEFAULT_BACKOFF_MS,
|
|
2384
2463
|
description: "Back-off timeout in ms. If head age exceeds this, minCandidates is ignored",
|
|
2385
2464
|
title: "validation.backoffMs",
|
|
@@ -2388,26 +2467,28 @@ var ValidationConfigZod = z16.object({
|
|
|
2388
2467
|
});
|
|
2389
2468
|
|
|
2390
2469
|
// src/config/Base.ts
|
|
2391
|
-
var BaseConfigZod =
|
|
2392
|
-
chain:
|
|
2393
|
-
dataLake:
|
|
2394
|
-
evm:
|
|
2395
|
-
log:
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2470
|
+
var BaseConfigZod = z19.object({
|
|
2471
|
+
chain: z19._default(ChainConfigZod, ChainConfigZod.parse({})).check(z19.describe("Configuration for the chain")),
|
|
2472
|
+
dataLake: z19.optional(DataLakeConfigZod).check(z19.describe("Configuration for data lakes")),
|
|
2473
|
+
evm: z19._default(EvmConfigZod, EvmConfigZod.parse({})).check(z19.describe("Configuration for EVM-backed services")),
|
|
2474
|
+
log: z19._default(LogConfigZod, LogConfigZod.parse({})).check(z19.describe("Configuration for logging")),
|
|
2475
|
+
providerBindings: z19._default(ProviderBindingsConfigZod, ProviderBindingsConfigZod.parse({})).check(z19.describe("Per-moniker provider implementation and transport bindings")),
|
|
2476
|
+
providers: z19._default(ProvidersConfigZod, ProvidersConfigZod.parse([])).check(z19.describe("Configuration for providers")),
|
|
2477
|
+
remote: z19._default(RemoteConfigZod, RemoteConfigZod.parse({})).check(z19.describe("Configuration for remote services")),
|
|
2478
|
+
transports: z19._default(TransportsConfigZod, TransportsConfigZod.parse({})).check(z19.describe("Named connection profiles (rpc, rest, s3, lmdb, mongo, evm-rpc)")),
|
|
2479
|
+
storage: z19._default(StorageConfigZod, StorageConfigZod.parse({})).check(z19.describe("Configuration for the storage")),
|
|
2480
|
+
telemetry: z19._default(TelemetryConfigZod, TelemetryConfigZod.parse({})).check(z19.describe("Configuration for telemetry")),
|
|
2481
|
+
validation: z19._default(ValidationConfigZod, ValidationConfigZod.parse({})).check(z19.describe("Configuration for validation"))
|
|
2401
2482
|
});
|
|
2402
2483
|
|
|
2403
2484
|
// src/config/Actor.ts
|
|
2404
|
-
var AccountPathZod =
|
|
2485
|
+
var AccountPathZod = z20.string().check(z20.regex(
|
|
2405
2486
|
/^(m(\/\d+'?)+|\d+'?(\/\d+'?)*)$/,
|
|
2406
2487
|
`Invalid BIP-32 derivation path. Use either an absolute path like "m/44'/60'/0'/0/0" or a relative path like "0", "0/1", or "44'/60'/0'/0/0".`
|
|
2407
2488
|
));
|
|
2408
|
-
var ActorConfigZod =
|
|
2409
|
-
name:
|
|
2410
|
-
accountPath:
|
|
2489
|
+
var ActorConfigZod = z20.extend(BaseConfigZod, {
|
|
2490
|
+
name: z20.string(),
|
|
2491
|
+
accountPath: z20.optional(AccountPathZod).register(globalRegistry14, {
|
|
2411
2492
|
description: 'BIP-32 derivation path for the actor wallet. Absolute when it starts with "m/"; otherwise relative to the root wallet base path. Each actor must derive to a distinct path.',
|
|
2412
2493
|
title: "accountPath",
|
|
2413
2494
|
type: "string"
|
|
@@ -2418,22 +2499,25 @@ var asActorConfig = zodAsFactory3(ActorConfigZod, "asActorConfig");
|
|
|
2418
2499
|
var toActorConfig = zodToFactory2(ActorConfigZod, "toActorConfig");
|
|
2419
2500
|
|
|
2420
2501
|
// src/config/Actors.ts
|
|
2421
|
-
import { z as
|
|
2422
|
-
var ActorsConfigZod =
|
|
2423
|
-
|
|
2502
|
+
import { z as z21 } from "zod/mini";
|
|
2503
|
+
var ActorsConfigZod = z21._default(
|
|
2504
|
+
z21.array(z21.looseObject(ActorConfigZod.shape)).check(z21.describe("Actor-specific configurations that override the base configuration when the actor is running")),
|
|
2424
2505
|
[]
|
|
2425
2506
|
);
|
|
2426
2507
|
|
|
2508
|
+
// src/config/adaptLegacyConfig.ts
|
|
2509
|
+
import { isDefined as isDefined15 } from "@xylabs/sdk-js";
|
|
2510
|
+
|
|
2427
2511
|
// src/config/Config.ts
|
|
2428
|
-
import { globalRegistry as
|
|
2429
|
-
var ConfigZod =
|
|
2512
|
+
import { globalRegistry as globalRegistry15, z as z22 } from "zod/mini";
|
|
2513
|
+
var ConfigZod = z22.extend(BaseConfigZod, {
|
|
2430
2514
|
actors: ActorsConfigZod,
|
|
2431
|
-
healthCheckPort:
|
|
2515
|
+
healthCheckPort: z22.optional(z22.coerce.number()).register(globalRegistry15, {
|
|
2432
2516
|
description: "Port for the system-wide health, readiness, and liveness endpoints (/healthz, /livez, /readyz). Set to 0 to disable.",
|
|
2433
2517
|
title: "healthCheckPort",
|
|
2434
2518
|
type: "number"
|
|
2435
2519
|
})
|
|
2436
|
-
}).check(
|
|
2520
|
+
}).check(z22.describe("The complete configuration for the protocol, including global settings and actor-specific overrides"));
|
|
2437
2521
|
function resolveConfig(config) {
|
|
2438
2522
|
const parsedConfig = ConfigZod.parse(config);
|
|
2439
2523
|
const {
|
|
@@ -2442,26 +2526,145 @@ function resolveConfig(config) {
|
|
|
2442
2526
|
...rootConfig
|
|
2443
2527
|
} = parsedConfig;
|
|
2444
2528
|
parsedConfig.actors = actors.map((actorConfig) => {
|
|
2445
|
-
return
|
|
2529
|
+
return z22.looseObject(ActorConfigZod.shape).parse({ ...rootConfig, ...actorConfig });
|
|
2446
2530
|
});
|
|
2447
2531
|
return parsedConfig;
|
|
2448
2532
|
}
|
|
2449
2533
|
|
|
2534
|
+
// src/config/adaptLegacyConfig.ts
|
|
2535
|
+
var DEFAULT_LMDB_TRANSPORT = "local-store";
|
|
2536
|
+
var DEFAULT_RPC_TRANSPORT = "default-rpc";
|
|
2537
|
+
var DEFAULT_EVM_RPC_TRANSPORT = "default-evm-rpc";
|
|
2538
|
+
var S3_FINALIZED_TRANSPORT = "s3-finalized";
|
|
2539
|
+
var S3_CHAIN_STATE_TRANSPORT = "s3-chain-state";
|
|
2540
|
+
var S3_INDEX_TRANSPORT = "s3-index";
|
|
2541
|
+
function rpcTransportFromRemote(rpc) {
|
|
2542
|
+
if (rpc.protocol === "http" && "url" in rpc) {
|
|
2543
|
+
const http = rpc;
|
|
2544
|
+
return {
|
|
2545
|
+
type: "rpc",
|
|
2546
|
+
protocol: "http",
|
|
2547
|
+
url: http.url
|
|
2548
|
+
};
|
|
2549
|
+
}
|
|
2550
|
+
return {
|
|
2551
|
+
type: "rpc",
|
|
2552
|
+
protocol: rpc.protocol,
|
|
2553
|
+
url: "url" in rpc ? String(rpc.url) : ""
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
function s3TransportFromBucket(shared, entry, fallbackBucket) {
|
|
2557
|
+
if (!isDefined15(entry?.bucket) && !isDefined15(entry?.readUrl)) {
|
|
2558
|
+
return void 0;
|
|
2559
|
+
}
|
|
2560
|
+
return {
|
|
2561
|
+
type: "s3",
|
|
2562
|
+
accessKeyId: entry?.accessKeyId ?? shared.accessKeyId,
|
|
2563
|
+
accountId: entry?.accountId ?? shared.accountId,
|
|
2564
|
+
bucket: entry?.bucket ?? fallbackBucket,
|
|
2565
|
+
prefix: entry?.prefix ?? shared.prefix,
|
|
2566
|
+
readUrl: entry?.readUrl,
|
|
2567
|
+
secretAccessKey: entry?.secretAccessKey ?? shared.secretAccessKey
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2570
|
+
function synthesizeS3Transports(s3) {
|
|
2571
|
+
const shared = {
|
|
2572
|
+
accessKeyId: s3.accessKeyId,
|
|
2573
|
+
accountId: s3.accountId,
|
|
2574
|
+
prefix: s3.prefix,
|
|
2575
|
+
secretAccessKey: s3.secretAccessKey
|
|
2576
|
+
};
|
|
2577
|
+
const transports = {};
|
|
2578
|
+
const finalized = s3TransportFromBucket(shared, s3.finalized);
|
|
2579
|
+
const fallbackBucket = s3.finalized?.bucket;
|
|
2580
|
+
if (finalized) {
|
|
2581
|
+
transports[S3_FINALIZED_TRANSPORT] = finalized;
|
|
2582
|
+
}
|
|
2583
|
+
const chainState = s3TransportFromBucket(shared, s3.chainState, fallbackBucket);
|
|
2584
|
+
if (chainState) {
|
|
2585
|
+
transports[S3_CHAIN_STATE_TRANSPORT] = chainState;
|
|
2586
|
+
}
|
|
2587
|
+
const index = s3TransportFromBucket(shared, s3.index, fallbackBucket);
|
|
2588
|
+
if (index) {
|
|
2589
|
+
transports[S3_INDEX_TRANSPORT] = index;
|
|
2590
|
+
}
|
|
2591
|
+
return transports;
|
|
2592
|
+
}
|
|
2593
|
+
function synthesizeProviderBindings(transports) {
|
|
2594
|
+
const bindings = {};
|
|
2595
|
+
if (transports[DEFAULT_RPC_TRANSPORT]) {
|
|
2596
|
+
bindings.BlockViewer = { transport: DEFAULT_RPC_TRANSPORT };
|
|
2597
|
+
bindings.MempoolViewer = { transport: DEFAULT_RPC_TRANSPORT };
|
|
2598
|
+
bindings.FinalizationViewer = { transport: DEFAULT_RPC_TRANSPORT };
|
|
2599
|
+
bindings.TransactionViewer = { transport: DEFAULT_RPC_TRANSPORT };
|
|
2600
|
+
bindings.AccountBalanceViewer = { transport: DEFAULT_RPC_TRANSPORT };
|
|
2601
|
+
}
|
|
2602
|
+
if (transports[S3_FINALIZED_TRANSPORT]) {
|
|
2603
|
+
bindings.BlockPublishRunner = { transport: S3_FINALIZED_TRANSPORT };
|
|
2604
|
+
}
|
|
2605
|
+
if (transports[S3_CHAIN_STATE_TRANSPORT]) {
|
|
2606
|
+
bindings.ChainStateViewer = { transport: S3_CHAIN_STATE_TRANSPORT };
|
|
2607
|
+
bindings.ChainStatePublishRunner = { transport: S3_CHAIN_STATE_TRANSPORT };
|
|
2608
|
+
}
|
|
2609
|
+
if (transports[S3_INDEX_TRANSPORT]) {
|
|
2610
|
+
bindings.IndexPublishRunner = { transport: S3_INDEX_TRANSPORT };
|
|
2611
|
+
}
|
|
2612
|
+
return bindings;
|
|
2613
|
+
}
|
|
2614
|
+
function adaptLegacyConfig(config) {
|
|
2615
|
+
const parsed = ConfigZod.parse(config);
|
|
2616
|
+
if (Object.keys(parsed.transports).length > 0) {
|
|
2617
|
+
return parsed;
|
|
2618
|
+
}
|
|
2619
|
+
const transports = { ...parsed.transports };
|
|
2620
|
+
if (isDefined15(parsed.storage?.root) && parsed.storage.root !== "") {
|
|
2621
|
+
transports[DEFAULT_LMDB_TRANSPORT] = { type: "lmdb", root: parsed.storage.root };
|
|
2622
|
+
}
|
|
2623
|
+
if (hasMongoConfig(parsed.storage?.mongo)) {
|
|
2624
|
+
transports["chain-mongo"] = {
|
|
2625
|
+
type: "mongo",
|
|
2626
|
+
connectionString: parsed.storage.mongo.connectionString,
|
|
2627
|
+
database: parsed.storage.mongo.database,
|
|
2628
|
+
domain: parsed.storage.mongo.domain,
|
|
2629
|
+
password: parsed.storage.mongo.password,
|
|
2630
|
+
username: parsed.storage.mongo.username
|
|
2631
|
+
};
|
|
2632
|
+
}
|
|
2633
|
+
if (isDefined15(parsed.remote?.rpc)) {
|
|
2634
|
+
transports[DEFAULT_RPC_TRANSPORT] = rpcTransportFromRemote(parsed.remote.rpc);
|
|
2635
|
+
}
|
|
2636
|
+
if (isDefined15(parsed.evm?.jsonRpc?.url)) {
|
|
2637
|
+
transports[DEFAULT_EVM_RPC_TRANSPORT] = { type: "evm-rpc", url: parsed.evm.jsonRpc.url };
|
|
2638
|
+
}
|
|
2639
|
+
if (isDefined15(parsed.storage?.s3)) {
|
|
2640
|
+
Object.assign(transports, synthesizeS3Transports(parsed.storage.s3));
|
|
2641
|
+
}
|
|
2642
|
+
const providerBindings = {
|
|
2643
|
+
...synthesizeProviderBindings(transports),
|
|
2644
|
+
...parsed.providerBindings
|
|
2645
|
+
};
|
|
2646
|
+
return ConfigZod.parse({
|
|
2647
|
+
...parsed,
|
|
2648
|
+
providerBindings,
|
|
2649
|
+
transports
|
|
2650
|
+
});
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2450
2653
|
// src/config/HostActor.ts
|
|
2451
2654
|
import {
|
|
2452
2655
|
zodAsFactory as zodAsFactory4,
|
|
2453
2656
|
zodIsFactory as zodIsFactory3,
|
|
2454
2657
|
zodToFactory as zodToFactory3
|
|
2455
2658
|
} from "@xylabs/sdk-js";
|
|
2456
|
-
import { globalRegistry as
|
|
2457
|
-
var HostActorConfigZod =
|
|
2458
|
-
host:
|
|
2659
|
+
import { globalRegistry as globalRegistry16, z as z23 } from "zod/mini";
|
|
2660
|
+
var HostActorConfigZod = z23.extend(ActorConfigZod, {
|
|
2661
|
+
host: z23._default(z23.string(), "localhost").register(globalRegistry16, {
|
|
2459
2662
|
default: "localhost",
|
|
2460
2663
|
description: "Host for the Actor",
|
|
2461
2664
|
title: "host",
|
|
2462
2665
|
type: "string"
|
|
2463
2666
|
}),
|
|
2464
|
-
port:
|
|
2667
|
+
port: z23._default(z23.coerce.number(), 8080).register(globalRegistry16, {
|
|
2465
2668
|
default: 8080,
|
|
2466
2669
|
description: "Port for the Actor",
|
|
2467
2670
|
title: "port",
|
|
@@ -2473,30 +2676,30 @@ var asHostActorConfig = zodAsFactory4(HostActorConfigZod, "asHostActorConfig");
|
|
|
2473
2676
|
var toHostActorConfig = zodToFactory3(HostActorConfigZod, "toHostActorConfig");
|
|
2474
2677
|
|
|
2475
2678
|
// src/config/UsageMeta.ts
|
|
2476
|
-
import { z as
|
|
2477
|
-
var DescriptionSchema =
|
|
2478
|
-
var TitleSchema =
|
|
2479
|
-
var JSONSchemaMetaSchema =
|
|
2480
|
-
id:
|
|
2679
|
+
import { z as z24 } from "zod";
|
|
2680
|
+
var DescriptionSchema = z24.string();
|
|
2681
|
+
var TitleSchema = z24.string();
|
|
2682
|
+
var JSONSchemaMetaSchema = z24.object({
|
|
2683
|
+
id: z24.string().optional(),
|
|
2481
2684
|
title: TitleSchema.optional(),
|
|
2482
2685
|
description: DescriptionSchema.optional(),
|
|
2483
|
-
deprecated:
|
|
2484
|
-
}).catchall(
|
|
2686
|
+
deprecated: z24.boolean().optional()
|
|
2687
|
+
}).catchall(z24.unknown());
|
|
2485
2688
|
var GlobalMetaSchema = JSONSchemaMetaSchema.extend({});
|
|
2486
|
-
var ChoicesSchema =
|
|
2689
|
+
var ChoicesSchema = z24.array(z24.union([z24.string(), z24.number(), z24.literal(true), z24.undefined()])).readonly();
|
|
2487
2690
|
var UsageMetaSchema = GlobalMetaSchema.extend({
|
|
2488
2691
|
choices: ChoicesSchema.optional(),
|
|
2489
|
-
default:
|
|
2692
|
+
default: z24.unknown().optional(),
|
|
2490
2693
|
description: DescriptionSchema,
|
|
2491
|
-
group:
|
|
2492
|
-
hidden:
|
|
2694
|
+
group: z24.string().optional(),
|
|
2695
|
+
hidden: z24.boolean().optional(),
|
|
2493
2696
|
title: TitleSchema,
|
|
2494
|
-
type:
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2697
|
+
type: z24.union([
|
|
2698
|
+
z24.literal("array"),
|
|
2699
|
+
z24.literal("count"),
|
|
2700
|
+
z24.literal("boolean"),
|
|
2701
|
+
z24.literal("number"),
|
|
2702
|
+
z24.literal("string")
|
|
2500
2703
|
])
|
|
2501
2704
|
});
|
|
2502
2705
|
function isUsageMeta(v) {
|
|
@@ -2509,7 +2712,7 @@ import {
|
|
|
2509
2712
|
zodIsFactory as zodIsFactory5,
|
|
2510
2713
|
zodToFactory as zodToFactory5
|
|
2511
2714
|
} from "@xylabs/sdk-js";
|
|
2512
|
-
import { z as
|
|
2715
|
+
import { z as z26 } from "zod/mini";
|
|
2513
2716
|
|
|
2514
2717
|
// src/model/CreatableProviderContext.zod.ts
|
|
2515
2718
|
import {
|
|
@@ -2518,17 +2721,17 @@ import {
|
|
|
2518
2721
|
zodToFactory as zodToFactory4
|
|
2519
2722
|
} from "@xylabs/sdk-js";
|
|
2520
2723
|
import { CachingContextZod } from "@xyo-network/xl1-protocol-lib";
|
|
2521
|
-
import { z as
|
|
2522
|
-
var RuntimeStatusMonitorZod =
|
|
2523
|
-
var ProviderFactoryLocatorZod =
|
|
2524
|
-
var BaseConfigContextZod =
|
|
2525
|
-
config:
|
|
2526
|
-
locator:
|
|
2724
|
+
import { z as z25 } from "zod/mini";
|
|
2725
|
+
var RuntimeStatusMonitorZod = z25.custom((val) => val && typeof val === "object");
|
|
2726
|
+
var ProviderFactoryLocatorZod = z25.lazy(() => z25.custom((val) => val && typeof val === "object" && "context" in val && "registry" in val));
|
|
2727
|
+
var BaseConfigContextZod = z25.extend(CachingContextZod, {
|
|
2728
|
+
config: z25.looseObject(BaseConfigZod.shape),
|
|
2729
|
+
locator: z25.optional(ProviderFactoryLocatorZod)
|
|
2527
2730
|
});
|
|
2528
|
-
var CreatableProviderContextZod =
|
|
2529
|
-
_id:
|
|
2731
|
+
var CreatableProviderContextZod = z25.lazy(() => z25.extend(BaseConfigContextZod, {
|
|
2732
|
+
_id: z25.optional(z25.string()),
|
|
2530
2733
|
locator: ProviderFactoryLocatorZod,
|
|
2531
|
-
statusReporter:
|
|
2734
|
+
statusReporter: z25.optional(RuntimeStatusMonitorZod)
|
|
2532
2735
|
}));
|
|
2533
2736
|
var isBaseConfigContext = zodIsFactory4(BaseConfigContextZod);
|
|
2534
2737
|
var asBaseConfigContext = zodAsFactory5(BaseConfigContextZod, "asBaseConfigContext");
|
|
@@ -2649,7 +2852,7 @@ async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads
|
|
|
2649
2852
|
// src/transaction/confirmSubmittedTransaction.ts
|
|
2650
2853
|
import {
|
|
2651
2854
|
delay,
|
|
2652
|
-
isDefined as
|
|
2855
|
+
isDefined as isDefined16,
|
|
2653
2856
|
isNumber
|
|
2654
2857
|
} from "@xylabs/sdk-js";
|
|
2655
2858
|
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
@@ -2671,7 +2874,7 @@ var confirmSubmittedTransaction = async (viewer, txHash, options) => {
|
|
|
2671
2874
|
let attempts = 0;
|
|
2672
2875
|
while (true) {
|
|
2673
2876
|
const tx = await viewer.transaction.byHash(txHash) ?? void 0;
|
|
2674
|
-
if (
|
|
2877
|
+
if (isDefined16(tx)) {
|
|
2675
2878
|
options?.logger?.debug("Transaction confirmed", txHash);
|
|
2676
2879
|
return tx;
|
|
2677
2880
|
} else {
|
|
@@ -2986,7 +3189,7 @@ var bundle2 = (root, transaction) => {
|
|
|
2986
3189
|
};
|
|
2987
3190
|
|
|
2988
3191
|
// src/context/Actor.ts
|
|
2989
|
-
var ActorConfigContext =
|
|
3192
|
+
var ActorConfigContext = z26.extend(BaseConfigContextZod, { config: ActorConfigZod });
|
|
2990
3193
|
var isActorConfigContext = zodIsFactory5(ActorConfigContext);
|
|
2991
3194
|
var asActorConfigContext = zodAsFactory6(ActorConfigContext, "asActorConfigContext");
|
|
2992
3195
|
var toActorConfigContext = zodToFactory5(ActorConfigContext, "toActorConfigContext");
|
|
@@ -3376,20 +3579,20 @@ import {
|
|
|
3376
3579
|
zodIsFactory as zodIsFactory6,
|
|
3377
3580
|
zodToFactory as zodToFactory6
|
|
3378
3581
|
} from "@xylabs/sdk-js";
|
|
3379
|
-
import { z as
|
|
3380
|
-
var HostActorConfigContext =
|
|
3582
|
+
import { z as z27 } from "zod/mini";
|
|
3583
|
+
var HostActorConfigContext = z27.extend(BaseConfigContextZod, { config: HostActorConfigZod });
|
|
3381
3584
|
var isHostActorConfigContext = zodIsFactory6(HostActorConfigContext);
|
|
3382
3585
|
var asHostActorConfigContext = zodAsFactory7(HostActorConfigContext, "asHostActorConfigContext");
|
|
3383
3586
|
var toHostActorConfigContext = zodToFactory6(HostActorConfigContext, "toHostActorConfigContext");
|
|
3384
3587
|
|
|
3385
3588
|
// src/createDeclarationPayload.ts
|
|
3386
|
-
import { isDefined as
|
|
3589
|
+
import { isDefined as isDefined17 } from "@xylabs/sdk-js";
|
|
3387
3590
|
import { PayloadBuilder as PayloadBuilder13 } from "@xyo-network/sdk-js";
|
|
3388
3591
|
import {
|
|
3389
3592
|
ChainStakeIntentSchema
|
|
3390
3593
|
} from "@xyo-network/xl1-protocol-lib";
|
|
3391
3594
|
var createDeclarationIntent = (address, intent, nbf, exp) => {
|
|
3392
|
-
const expiration =
|
|
3595
|
+
const expiration = isDefined17(exp) ? exp : nbf + 1e4;
|
|
3393
3596
|
const redeclarationIntent = new PayloadBuilder13({ schema: ChainStakeIntentSchema }).fields({
|
|
3394
3597
|
from: address,
|
|
3395
3598
|
intent,
|
|
@@ -3418,26 +3621,26 @@ import {
|
|
|
3418
3621
|
asSchema as asSchema2,
|
|
3419
3622
|
isPayloadOfZodType
|
|
3420
3623
|
} from "@xyo-network/sdk-js";
|
|
3421
|
-
import { z as
|
|
3624
|
+
import { z as z29 } from "zod";
|
|
3422
3625
|
|
|
3423
3626
|
// src/eip-712/Types.ts
|
|
3424
|
-
import { z as
|
|
3425
|
-
var TypedDataDomainZod =
|
|
3426
|
-
name:
|
|
3427
|
-
version:
|
|
3428
|
-
chainId:
|
|
3429
|
-
verifyingContract:
|
|
3430
|
-
salt:
|
|
3627
|
+
import { z as z28 } from "zod";
|
|
3628
|
+
var TypedDataDomainZod = z28.object({
|
|
3629
|
+
name: z28.string().nullable().optional(),
|
|
3630
|
+
version: z28.string().nullable().optional(),
|
|
3631
|
+
chainId: z28.union([z28.string(), z28.number(), z28.bigint()]).nullable().optional(),
|
|
3632
|
+
verifyingContract: z28.string().nullable().optional(),
|
|
3633
|
+
salt: z28.union([z28.string(), z28.instanceof(Uint8Array)]).nullable().optional()
|
|
3431
3634
|
});
|
|
3432
|
-
var TypedDataFieldZod =
|
|
3433
|
-
name:
|
|
3434
|
-
type:
|
|
3635
|
+
var TypedDataFieldZod = z28.object({
|
|
3636
|
+
name: z28.string(),
|
|
3637
|
+
type: z28.string()
|
|
3435
3638
|
});
|
|
3436
|
-
var TypedDataTypesZod =
|
|
3437
|
-
var TypedDataValueZod =
|
|
3639
|
+
var TypedDataTypesZod = z28.record(z28.string(), z28.array(TypedDataFieldZod));
|
|
3640
|
+
var TypedDataValueZod = z28.record(z28.string(), z28.any());
|
|
3438
3641
|
|
|
3439
3642
|
// src/eip-712/Payloads/EIP712Data.ts
|
|
3440
|
-
var EIP712DataPayloadFieldsZod =
|
|
3643
|
+
var EIP712DataPayloadFieldsZod = z29.object({
|
|
3441
3644
|
domain: TypedDataDomainZod,
|
|
3442
3645
|
types: TypedDataTypesZod,
|
|
3443
3646
|
values: TypedDataValueZod
|
|
@@ -3455,11 +3658,11 @@ import {
|
|
|
3455
3658
|
asSchema as asSchema3,
|
|
3456
3659
|
isPayloadOfZodType as isPayloadOfZodType2
|
|
3457
3660
|
} from "@xyo-network/sdk-js";
|
|
3458
|
-
import { z as
|
|
3459
|
-
var EIP712SignaturePayloadFieldsZod =
|
|
3460
|
-
address:
|
|
3661
|
+
import { z as z30 } from "zod";
|
|
3662
|
+
var EIP712SignaturePayloadFieldsZod = z30.object({
|
|
3663
|
+
address: z30.string(),
|
|
3461
3664
|
hash: HashZod,
|
|
3462
|
-
signature:
|
|
3665
|
+
signature: z30.string()
|
|
3463
3666
|
});
|
|
3464
3667
|
var EIP712SignaturePayloadSchema = asSchema3("network.xyo.chains.ethereum.eip712.signature", true);
|
|
3465
3668
|
var isEIP712SignaturePayload = isPayloadOfZodType2(
|
|
@@ -3570,7 +3773,7 @@ import {
|
|
|
3570
3773
|
asHash as asHash4,
|
|
3571
3774
|
assertEx as assertEx33,
|
|
3572
3775
|
exists as exists3,
|
|
3573
|
-
isDefined as
|
|
3776
|
+
isDefined as isDefined18,
|
|
3574
3777
|
ZERO_ADDRESS
|
|
3575
3778
|
} from "@xylabs/sdk-js";
|
|
3576
3779
|
import {
|
|
@@ -3705,7 +3908,7 @@ async function balancesStepSummaryFromRange(context, semaphores, blockViewer, su
|
|
|
3705
3908
|
|
|
3706
3909
|
// src/summary/primitives/balances/balancesSummary.ts
|
|
3707
3910
|
import { assertEx as assertEx27, spanRootAsync as spanRootAsync3 } from "@xylabs/sdk-js";
|
|
3708
|
-
import { asXyoAddress } from "@xyo-network/
|
|
3911
|
+
import { asXyoAddress } from "@xyo-network/sdk-js";
|
|
3709
3912
|
import {
|
|
3710
3913
|
asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta3,
|
|
3711
3914
|
asXL1BlockRange as asXL1BlockRange7,
|
|
@@ -3991,7 +4194,7 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
|
|
|
3991
4194
|
|
|
3992
4195
|
// src/summary/primitives/transfers/transfersSummary.ts
|
|
3993
4196
|
import { assertEx as assertEx32, spanRootAsync as spanRootAsync7 } from "@xylabs/sdk-js";
|
|
3994
|
-
import { asXyoAddress as asXyoAddress2 } from "@xyo-network/
|
|
4197
|
+
import { asXyoAddress as asXyoAddress2 } from "@xyo-network/sdk-js";
|
|
3995
4198
|
import {
|
|
3996
4199
|
asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta5,
|
|
3997
4200
|
asXL1BlockRange as asXL1BlockRange9,
|
|
@@ -4068,7 +4271,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4068
4271
|
block[1].find((p) => p._hash === hash),
|
|
4069
4272
|
() => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`
|
|
4070
4273
|
);
|
|
4071
|
-
}).filter(exists3).filter((t) => t.from === address ||
|
|
4274
|
+
}).filter(exists3).filter((t) => t.from === address || isDefined18(t.transfers[address]));
|
|
4072
4275
|
if (transfers.length === 0) {
|
|
4073
4276
|
continue;
|
|
4074
4277
|
}
|
|
@@ -4187,7 +4390,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4187
4390
|
return await this.spanAsync("qualifiedAccountBalanceHistory", async () => {
|
|
4188
4391
|
const range = asRange(headOrRange);
|
|
4189
4392
|
const headHash = asHash4(headOrRange);
|
|
4190
|
-
const [head] = assertEx33(
|
|
4393
|
+
const [head] = assertEx33(isDefined18(headHash) ? await this.blockViewer.blockByHash(headHash) : await this.blockViewer.currentBlock(), () => "Could not resolve head block");
|
|
4191
4394
|
const startingRange = asXL1BlockRange10(range ?? [0, head.block], true);
|
|
4192
4395
|
const blockNumbers = await this.distillTransferHistory(address, startingRange);
|
|
4193
4396
|
const blocks = (await Promise.all(blockNumbers.map(async (bn) => await this.blockViewer.blockByNumber(bn)))).filter(exists3);
|
|
@@ -4200,7 +4403,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4200
4403
|
block[1].find((p) => p._hash === hash),
|
|
4201
4404
|
() => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`
|
|
4202
4405
|
);
|
|
4203
|
-
}).filter(exists3).filter((t) => t.from === address ||
|
|
4406
|
+
}).filter(exists3).filter((t) => t.from === address || isDefined18(t.transfers[address]));
|
|
4204
4407
|
if (transfers.length === 0) {
|
|
4205
4408
|
continue;
|
|
4206
4409
|
}
|
|
@@ -4267,12 +4470,12 @@ var HydratedCache = class {
|
|
|
4267
4470
|
};
|
|
4268
4471
|
|
|
4269
4472
|
// src/utils/isZodError.ts
|
|
4270
|
-
import { z as
|
|
4473
|
+
import { z as z31 } from "zod";
|
|
4271
4474
|
var isZodError = (error) => {
|
|
4272
|
-
return error instanceof
|
|
4475
|
+
return error instanceof z31.ZodError;
|
|
4273
4476
|
};
|
|
4274
4477
|
var prettifyZodError = (error) => {
|
|
4275
|
-
return
|
|
4478
|
+
return z31.prettifyError(error);
|
|
4276
4479
|
};
|
|
4277
4480
|
|
|
4278
4481
|
// src/simple/block/SimpleBlockViewer.ts
|
|
@@ -4742,7 +4945,7 @@ var SimpleXyoClient = class {
|
|
|
4742
4945
|
import { assertEx as assertEx37, exists as exists6 } from "@xylabs/sdk-js";
|
|
4743
4946
|
import { isAnyPayload as isAnyPayload8, PayloadZodLoose } from "@xyo-network/sdk-js";
|
|
4744
4947
|
import { DataLakeRunnerMoniker } from "@xyo-network/xl1-protocol-lib";
|
|
4745
|
-
import { z as
|
|
4948
|
+
import { z as z32 } from "zod/mini";
|
|
4746
4949
|
|
|
4747
4950
|
// src/simple/datalake/AbstractRestDataLake.ts
|
|
4748
4951
|
import { FetchClientError, FetchJsonClient } from "@xylabs/sdk-js";
|
|
@@ -4815,7 +5018,7 @@ var RestDataLakeRunner = class extends AbstractRestDataLake {
|
|
|
4815
5018
|
}).filter(exists6);
|
|
4816
5019
|
if (allowedItems.length > 0) {
|
|
4817
5020
|
const result = await this.client.post(`${this.params.endpoint}/insert`, allowedItems);
|
|
4818
|
-
return
|
|
5021
|
+
return z32.array(PayloadZodLoose).parse(result.data);
|
|
4819
5022
|
} else {
|
|
4820
5023
|
return [];
|
|
4821
5024
|
}
|
|
@@ -5058,7 +5261,7 @@ var SimpleXyoGateway = class _SimpleXyoGateway extends AbstractCreatableProvider
|
|
|
5058
5261
|
import {
|
|
5059
5262
|
assertEx as assertEx39,
|
|
5060
5263
|
BigIntToJsonZod,
|
|
5061
|
-
isDefined as
|
|
5264
|
+
isDefined as isDefined19
|
|
5062
5265
|
} from "@xylabs/sdk-js";
|
|
5063
5266
|
import { PayloadBuilder as PayloadBuilder20 } from "@xyo-network/sdk-js";
|
|
5064
5267
|
import {
|
|
@@ -5096,9 +5299,9 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
5096
5299
|
chain,
|
|
5097
5300
|
fees
|
|
5098
5301
|
} = options ?? {};
|
|
5099
|
-
const resolvedChainId =
|
|
5100
|
-
const resolvedNbf = asXL1BlockNumber10(
|
|
5101
|
-
const resolvedExp = asXL1BlockNumber10(
|
|
5302
|
+
const resolvedChainId = isDefined19(chain) ? chain : await viewer.chainId();
|
|
5303
|
+
const resolvedNbf = asXL1BlockNumber10(isDefined19(nbf) ? nbf : await viewer.currentBlockNumber(), true);
|
|
5304
|
+
const resolvedExp = asXL1BlockNumber10(isDefined19(exp) ? exp : resolvedNbf + 10, true);
|
|
5102
5305
|
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await this.signer.address(), fees);
|
|
5103
5306
|
return await this.addTransactionToChain(tx, await PayloadBuilder20.addHashMeta(offChain));
|
|
5104
5307
|
}
|
|
@@ -5586,7 +5789,7 @@ SimpleMempoolRunner = __decorateClass([
|
|
|
5586
5789
|
// src/simple/mempool/SimpleMempoolViewer.ts
|
|
5587
5790
|
import {
|
|
5588
5791
|
exists as exists9,
|
|
5589
|
-
isDefined as
|
|
5792
|
+
isDefined as isDefined20,
|
|
5590
5793
|
isHash as isHash2
|
|
5591
5794
|
} from "@xylabs/sdk-js";
|
|
5592
5795
|
import { isHashMeta as isHashMeta2, isPayloadBundle as isPayloadBundle2 } from "@xyo-network/sdk-js";
|
|
@@ -5647,7 +5850,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
5647
5850
|
let cursor = void 0;
|
|
5648
5851
|
if (isHash2(providedCursor)) {
|
|
5649
5852
|
const [p] = await this.pendingBlocksArchivist.get([providedCursor]);
|
|
5650
|
-
if (
|
|
5853
|
+
if (isDefined20(p)) {
|
|
5651
5854
|
cursor = p._sequence;
|
|
5652
5855
|
}
|
|
5653
5856
|
}
|
|
@@ -5666,7 +5869,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
5666
5869
|
let cursor = void 0;
|
|
5667
5870
|
if (isHash2(providedCursor)) {
|
|
5668
5871
|
const [p] = await this.pendingTransactionsArchivist.get([providedCursor]);
|
|
5669
|
-
if (
|
|
5872
|
+
if (isDefined20(p)) {
|
|
5670
5873
|
cursor = p._sequence;
|
|
5671
5874
|
}
|
|
5672
5875
|
}
|
|
@@ -5681,7 +5884,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
5681
5884
|
const hydratedWithBundle = (await Promise.all(
|
|
5682
5885
|
filteredBundles.map(async (bundle3) => {
|
|
5683
5886
|
const tx = await bundledPayloadToHydratedTransaction(bundle3);
|
|
5684
|
-
return
|
|
5887
|
+
return isDefined20(tx) ? { bundle: bundle3, tx } : void 0;
|
|
5685
5888
|
})
|
|
5686
5889
|
)).filter(exists9);
|
|
5687
5890
|
const currentBlock = await this.windowedBlockViewer.currentBlock();
|
|
@@ -6032,7 +6235,7 @@ var SimpleXyoSigner = class _SimpleXyoSigner extends AbstractCreatableProvider {
|
|
|
6032
6235
|
};
|
|
6033
6236
|
|
|
6034
6237
|
// src/simple/StakeEventsViewer/SimpleStakeEventsViewer.ts
|
|
6035
|
-
import { isDefined as
|
|
6238
|
+
import { isDefined as isDefined21 } from "@xylabs/sdk-js";
|
|
6036
6239
|
import { StakeEventsViewerMoniker } from "@xyo-network/xl1-protocol-lib";
|
|
6037
6240
|
var SimpleStakeEventsViewer = class extends AbstractCreatableProvider {
|
|
6038
6241
|
moniker = SimpleStakeEventsViewer.defaultMoniker;
|
|
@@ -6045,7 +6248,7 @@ var SimpleStakeEventsViewer = class extends AbstractCreatableProvider {
|
|
|
6045
6248
|
stakeEvents(range, { name } = {}) {
|
|
6046
6249
|
const positions = this.positionsFromRange(range);
|
|
6047
6250
|
const events = this.eventsFromPositions(positions);
|
|
6048
|
-
if (
|
|
6251
|
+
if (isDefined21(name)) {
|
|
6049
6252
|
return events.filter((event) => event.name === name);
|
|
6050
6253
|
}
|
|
6051
6254
|
return events;
|
|
@@ -6111,7 +6314,7 @@ SimpleStakeEventsViewer = __decorateClass([
|
|
|
6111
6314
|
|
|
6112
6315
|
// src/simple/StakeTotalsViewer/SimpleStakeTotalsViewer.ts
|
|
6113
6316
|
import { assertEx as assertEx43 } from "@xylabs/sdk-js";
|
|
6114
|
-
import { asXyoAddress as asXyoAddress3 } from "@xyo-network/
|
|
6317
|
+
import { asXyoAddress as asXyoAddress3 } from "@xyo-network/sdk-js";
|
|
6115
6318
|
import {
|
|
6116
6319
|
StakeTotalsViewerMoniker,
|
|
6117
6320
|
StakeViewerMoniker
|
|
@@ -6209,7 +6412,7 @@ SimpleStakeTotalsViewer = __decorateClass([
|
|
|
6209
6412
|
|
|
6210
6413
|
// src/simple/StakeViewer/SimpleStakeViewer.ts
|
|
6211
6414
|
import { assertEx as assertEx44, toAddress } from "@xylabs/sdk-js";
|
|
6212
|
-
import { asXyoAddress as asXyoAddress4 } from "@xyo-network/
|
|
6415
|
+
import { asXyoAddress as asXyoAddress4 } from "@xyo-network/sdk-js";
|
|
6213
6416
|
import { StakeEventsViewerMoniker as StakeEventsViewerMoniker2, StakeViewerMoniker as StakeViewerMoniker2 } from "@xyo-network/xl1-protocol-lib";
|
|
6214
6417
|
var SimpleStakeViewer = class extends AbstractCreatableProvider {
|
|
6215
6418
|
moniker = SimpleStakeViewer.defaultMoniker;
|
|
@@ -6393,7 +6596,7 @@ RestSyncViewer = __decorateClass([
|
|
|
6393
6596
|
import {
|
|
6394
6597
|
asHash as asHash5,
|
|
6395
6598
|
assertEx as assertEx45,
|
|
6396
|
-
isDefined as
|
|
6599
|
+
isDefined as isDefined22
|
|
6397
6600
|
} from "@xylabs/sdk-js";
|
|
6398
6601
|
import {
|
|
6399
6602
|
asTimePayload as asTimePayload2,
|
|
@@ -6417,7 +6620,7 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
6417
6620
|
const [block, payloads] = assertEx45(await this.blockViewer.blockByNumber(asXL1BlockNumber11(from, true)), () => "Block not found");
|
|
6418
6621
|
const timeSchemaIndex = block.payload_schemas.indexOf(TimeSchema);
|
|
6419
6622
|
const hash = timeSchemaIndex === -1 ? void 0 : block.payload_hashes[timeSchemaIndex];
|
|
6420
|
-
const timePayload = asTimePayload2(
|
|
6623
|
+
const timePayload = asTimePayload2(isDefined22(hash) ? payloads.find((p) => p._hash === hash) : void 0);
|
|
6421
6624
|
if (timePayload === void 0) return 0;
|
|
6422
6625
|
switch (toDomain) {
|
|
6423
6626
|
case "xl1": {
|
|
@@ -6490,7 +6693,7 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
6490
6693
|
xl1Hash: assertEx45(xl1Hash, () => "No xl1 hash available from time sync service"),
|
|
6491
6694
|
epoch: Date.now()
|
|
6492
6695
|
};
|
|
6493
|
-
if (
|
|
6696
|
+
if (isDefined22(this.ethProvider)) {
|
|
6494
6697
|
const [ethereum, ethHashOrNull] = await this.currentTimeAndHash("ethereum");
|
|
6495
6698
|
const ethereumHash = asHash5(ethHashOrNull, () => "No ethereum hash available from time sync service");
|
|
6496
6699
|
timePayload.ethereum = ethereum;
|
|
@@ -6980,7 +7183,7 @@ import {
|
|
|
6980
7183
|
} from "@xyo-network/xl1-protocol-lib";
|
|
6981
7184
|
|
|
6982
7185
|
// src/test/buildBlock.ts
|
|
6983
|
-
import { assertEx as assertEx49, isDefined as
|
|
7186
|
+
import { assertEx as assertEx49, isDefined as isDefined23 } from "@xylabs/sdk-js";
|
|
6984
7187
|
import {
|
|
6985
7188
|
asAnyPayload as asAnyPayload5,
|
|
6986
7189
|
BoundWitnessBuilder as BoundWitnessBuilder3,
|
|
@@ -7086,7 +7289,7 @@ async function buildBlock(options) {
|
|
|
7086
7289
|
}
|
|
7087
7290
|
step_hashes.push(assertEx49(previousBlockHash, () => `Previous block hash is required for step ${step} at block ${blockNumber}`));
|
|
7088
7291
|
} else {
|
|
7089
|
-
if (
|
|
7292
|
+
if (isDefined23(inStepHashes.at(i))) {
|
|
7090
7293
|
step_hashes.push(inStepHashes[i]);
|
|
7091
7294
|
}
|
|
7092
7295
|
}
|
|
@@ -7346,8 +7549,8 @@ var getUrl = (host, port) => {
|
|
|
7346
7549
|
var TODO = true;
|
|
7347
7550
|
|
|
7348
7551
|
// src/validation/schema/Mnemonic.ts
|
|
7349
|
-
import { z as
|
|
7350
|
-
var MnemonicStringZod =
|
|
7552
|
+
import { z as z33 } from "zod";
|
|
7553
|
+
var MnemonicStringZod = z33.string().transform((s) => s.trim().replaceAll(/\s+/g, " ")).refine(
|
|
7351
7554
|
(s) => [12, 15, 18, 21, 24].includes(s.split(" ").length),
|
|
7352
7555
|
{ message: "Mnemonic must contain 12, 15, 18, 21, or 24 words." }
|
|
7353
7556
|
).describe("BIP-39 mnemonic string");
|
|
@@ -7402,6 +7605,7 @@ export {
|
|
|
7402
7605
|
EIP712DataPayloadSchema,
|
|
7403
7606
|
EIP712SignaturePayloadFieldsZod,
|
|
7404
7607
|
EIP712SignaturePayloadSchema,
|
|
7608
|
+
EvmRpcTransportConfigZod,
|
|
7405
7609
|
GlobalMetaSchema,
|
|
7406
7610
|
HostActorConfigContext,
|
|
7407
7611
|
HostActorConfigZod,
|
|
@@ -7409,13 +7613,17 @@ export {
|
|
|
7409
7613
|
HydratedBoundWitnessWithStorageMetaZod,
|
|
7410
7614
|
HydratedCache,
|
|
7411
7615
|
JSONSchemaMetaSchema,
|
|
7616
|
+
LmdbTransportConfigZod,
|
|
7412
7617
|
LoggerStatusReporter,
|
|
7413
7618
|
MemoryPermissionsStore,
|
|
7414
7619
|
MissingCapabilityError,
|
|
7415
7620
|
MnemonicStringZod,
|
|
7621
|
+
MongoTransportConfigZod,
|
|
7416
7622
|
PRODUCER_DIVERSITY_BONUS,
|
|
7417
7623
|
PayloadLocator,
|
|
7418
7624
|
PostMessageRpcRemoteConfigZod,
|
|
7625
|
+
ProviderBindingConfigZod,
|
|
7626
|
+
ProviderBindingsConfigZod,
|
|
7419
7627
|
ProviderConfigZod,
|
|
7420
7628
|
ProviderFactory,
|
|
7421
7629
|
ProviderFactoryLocator,
|
|
@@ -7426,12 +7634,15 @@ export {
|
|
|
7426
7634
|
RestDataLakeRunner,
|
|
7427
7635
|
RestDataLakeViewer,
|
|
7428
7636
|
RestSyncViewer,
|
|
7637
|
+
RestTransportConfigZod,
|
|
7429
7638
|
RewardMultipliers,
|
|
7430
7639
|
RouterDataLakeConfigZod,
|
|
7431
7640
|
RpcRemoteConfigBaseZod,
|
|
7432
7641
|
RpcRemoteConfigZod,
|
|
7642
|
+
RpcTransportConfigZod,
|
|
7433
7643
|
RuntimeStatusMonitor,
|
|
7434
7644
|
RuntimeStatusMonitorZod,
|
|
7645
|
+
S3TransportConfigZod,
|
|
7435
7646
|
SchemasStepSummarySchema,
|
|
7436
7647
|
ShiftedBigInt,
|
|
7437
7648
|
SimpleAccountBalanceViewer,
|
|
@@ -7463,6 +7674,8 @@ export {
|
|
|
7463
7674
|
TestGenesisBlockRewardAddress,
|
|
7464
7675
|
TransactionBuilder,
|
|
7465
7676
|
TransfersStepSummarySchema,
|
|
7677
|
+
TransportConfigZod,
|
|
7678
|
+
TransportsConfigZod,
|
|
7466
7679
|
TypedDataDomainZod,
|
|
7467
7680
|
TypedDataFieldZod,
|
|
7468
7681
|
TypedDataTypesZod,
|
|
@@ -7478,6 +7691,7 @@ export {
|
|
|
7478
7691
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_REWARDS,
|
|
7479
7692
|
activeStakeAtTimeByAddress,
|
|
7480
7693
|
activeStakeAtTimeByPosition,
|
|
7694
|
+
adaptLegacyConfig,
|
|
7481
7695
|
addDataLakePayloads,
|
|
7482
7696
|
addDataLakePayloadsToPayloads,
|
|
7483
7697
|
allHashesPresent,
|