@xyo-network/xl1-protocol-sdk 1.24.2 → 1.24.3
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/Actor.d.ts +854 -0
- package/dist/neutral/config/Actor.d.ts.map +1 -0
- package/dist/neutral/config/Config.d.ts +18 -8
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/HostActor.d.ts +878 -0
- package/dist/neutral/config/HostActor.d.ts.map +1 -0
- package/dist/neutral/config/getFileConfig.d.ts +133 -0
- package/dist/neutral/config/getFileConfig.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/index.mjs +486 -349
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/model/PayloadBundle/bundledPayloadToHydratedBlock.d.ts.map +1 -1
- package/dist/neutral/model/PayloadBundle/bundledPayloadToHydratedTransaction.d.ts.map +1 -1
- package/dist/neutral/model/PayloadBundle/hydratedBlockToPayloadBundle.d.ts.map +1 -1
- package/dist/neutral/model/PayloadBundle/hydratedTransactionToPayloadBundle.d.ts.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGateway.d.ts +3 -1
- package/dist/neutral/simple/gateway/SimpleXyoGateway.d.ts.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts +2 -1
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts.map +1 -1
- package/dist/neutral/simple/mempool/SimpleMempoolRunner.d.ts +2 -2
- package/dist/neutral/simple/mempool/SimpleMempoolRunner.d.ts.map +1 -1
- package/dist/neutral/simple/signer/SimpleXyoSigner.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/balances/balancesStepSummaryFromRange.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/schemas/schemasStepSummaryFromRange.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/transfers/transfersStepSummaryFromRange.d.ts.map +1 -1
- package/dist/neutral/test/buildBlock.d.ts.map +1 -1
- package/dist/neutral/test/buildRandomChain.d.ts +1 -1
- package/dist/neutral/test/buildRandomChain.d.ts.map +1 -1
- package/dist/neutral/test/buildRandomGenesisBlock.d.ts.map +1 -1
- package/dist/neutral/test/createProducerChainStakeIntentTransaction.d.ts +1 -1
- package/dist/neutral/test/createProducerChainStakeIntentTransaction.d.ts.map +1 -1
- package/dist/neutral/test/getSimpleBlockViewerLocator.d.ts.map +1 -1
- package/dist/neutral/test/index.mjs +118 -61
- package/dist/neutral/test/index.mjs.map +1 -1
- package/dist/neutral/transaction/TransactionBuilder.d.ts +1 -1
- package/dist/neutral/transaction/TransactionBuilder.d.ts.map +1 -1
- package/dist/neutral/transaction/buildRandomTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/buildTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/buildUnsignedTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/signTransaction.d.ts +1 -1
- package/package.json +5 -8
- package/src/config/Actor.ts +36 -0
- package/src/config/Config.ts +8 -7
- package/src/config/HostActor.ts +36 -0
- package/src/config/getFileConfig.ts +36 -0
- package/src/config/index.ts +3 -0
- package/src/createDeclarationPayload.ts +1 -1
- package/src/createTransferPayload.ts +1 -1
- package/src/eip-712/sign.ts +1 -1
- package/src/eip-712/verify.ts +1 -1
- package/src/model/PayloadBundle/bundledPayloadToHydratedBlock.ts +1 -1
- package/src/model/PayloadBundle/bundledPayloadToHydratedTransaction.ts +1 -1
- package/src/model/PayloadBundle/hydratedBlockToPayloadBundle.ts +1 -1
- package/src/model/PayloadBundle/hydratedTransactionToPayloadBundle.ts +1 -1
- package/src/simple/blockInvalidation/SimpleBlockInvalidationViewer.ts +1 -1
- package/src/simple/blockValidation/SimpleBlockValidationViewer.ts +1 -1
- package/src/simple/datalake/RestDataLakeRunner.ts +1 -1
- package/src/simple/gateway/SimpleXyoGateway.ts +24 -0
- package/src/simple/gateway/SimpleXyoGatewayRunner.ts +24 -3
- package/src/simple/mempool/SimpleMempoolRunner.ts +1 -1
- package/src/simple/runner/SimpleXyoRunner.ts +1 -1
- package/src/simple/signer/SimpleXyoSigner.ts +1 -2
- package/src/simple/transactionInvalidation/SimpleTransactionInvalidationViewer.ts +1 -1
- package/src/simple/transactionValidation/SimpleTransactionValidationViewer.ts +1 -1
- package/src/summary/primitives/balances/balancesStepSummaryFromRange.ts +1 -1
- package/src/summary/primitives/schemas/schemasStepSummaryFromRange.ts +1 -1
- package/src/summary/primitives/transfers/transfersStepSummaryFromRange.ts +1 -1
- package/src/test/buildBlock.ts +1 -2
- package/src/test/buildRandomChain.ts +1 -2
- package/src/test/buildRandomGenesisBlock.ts +1 -2
- package/src/test/createGenesisBlock.ts +1 -1
- package/src/test/createProducerChainStakeIntentTransaction.ts +1 -1
- package/src/test/getSimpleBlockViewerLocator.ts +1 -1
- package/src/transaction/TransactionBuilder.ts +1 -1
- package/src/transaction/buildRandomTransaction.ts +1 -1
- package/src/transaction/buildTransaction.ts +1 -2
- package/src/transaction/buildUnsignedTransaction.ts +1 -2
- package/src/transaction/primitives/transactionBlockByteCount.ts +1 -1
- package/src/transaction/signTransaction.ts +1 -1
package/dist/neutral/index.mjs
CHANGED
|
@@ -1274,7 +1274,7 @@ async function withContextCacheResponse(context, name, key, func, { max = 1e4 }
|
|
|
1274
1274
|
}
|
|
1275
1275
|
|
|
1276
1276
|
// src/model/PayloadBundle/bundledPayloadToHydratedBlock.ts
|
|
1277
|
-
import { PayloadBuilder } from "@xyo-network/
|
|
1277
|
+
import { PayloadBuilder } from "@xyo-network/sdk-js";
|
|
1278
1278
|
import { asSignedBlockBoundWitnessWithHashMeta } from "@xyo-network/xl1-protocol";
|
|
1279
1279
|
var bundledPayloadToHydratedBlock = async (payload) => {
|
|
1280
1280
|
const withHashMeta = await PayloadBuilder.addHashMeta(payload.payloads);
|
|
@@ -1285,7 +1285,7 @@ var bundledPayloadToHydratedBlock = async (payload) => {
|
|
|
1285
1285
|
};
|
|
1286
1286
|
|
|
1287
1287
|
// src/model/PayloadBundle/bundledPayloadToHydratedTransaction.ts
|
|
1288
|
-
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/
|
|
1288
|
+
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/sdk-js";
|
|
1289
1289
|
import { asSignedTransactionBoundWitnessWithHashMeta } from "@xyo-network/xl1-protocol";
|
|
1290
1290
|
var bundledPayloadToHydratedTransaction = async (payload) => {
|
|
1291
1291
|
const withHashMeta = await PayloadBuilder2.addHashMeta(payload.payloads);
|
|
@@ -1296,8 +1296,8 @@ var bundledPayloadToHydratedTransaction = async (payload) => {
|
|
|
1296
1296
|
};
|
|
1297
1297
|
|
|
1298
1298
|
// src/model/PayloadBundle/hydratedBlockToPayloadBundle.ts
|
|
1299
|
-
import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/payload-builder";
|
|
1300
1299
|
import { PayloadBundleSchema } from "@xyo-network/payload-model";
|
|
1300
|
+
import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/sdk-js";
|
|
1301
1301
|
var hydratedBlockToPayloadBundle = (transaction) => {
|
|
1302
1302
|
const root = transaction[0]._hash;
|
|
1303
1303
|
return bundle(root, transaction);
|
|
@@ -1308,16 +1308,16 @@ var bundle = (root, transaction) => {
|
|
|
1308
1308
|
};
|
|
1309
1309
|
|
|
1310
1310
|
// src/model/PayloadBundle/hydratedTransactionToPayloadBundle.ts
|
|
1311
|
-
import { PayloadBuilder as PayloadBuilder10 } from "@xyo-network/payload-builder";
|
|
1312
1311
|
import { PayloadBundleSchema as PayloadBundleSchema2 } from "@xyo-network/payload-model";
|
|
1312
|
+
import { PayloadBuilder as PayloadBuilder10 } from "@xyo-network/sdk-js";
|
|
1313
1313
|
|
|
1314
1314
|
// src/transaction/buildRandomTransaction.ts
|
|
1315
|
-
import { Account } from "@xyo-network/
|
|
1315
|
+
import { Account } from "@xyo-network/sdk-js";
|
|
1316
1316
|
import { asXL1BlockNumber as asXL1BlockNumber3, isAllowedBlockPayload as isAllowedBlockPayload2 } from "@xyo-network/xl1-protocol";
|
|
1317
1317
|
|
|
1318
1318
|
// src/createTransferPayload.ts
|
|
1319
1319
|
import { toHex } from "@xylabs/sdk-js";
|
|
1320
|
-
import { PayloadBuilder as PayloadBuilder4 } from "@xyo-network/
|
|
1320
|
+
import { PayloadBuilder as PayloadBuilder4 } from "@xyo-network/sdk-js";
|
|
1321
1321
|
import { TransferSchema } from "@xyo-network/xl1-protocol";
|
|
1322
1322
|
function createTransferPayload(from, transfers, context) {
|
|
1323
1323
|
return new PayloadBuilder4({ schema: TransferSchema }).fields({
|
|
@@ -1330,8 +1330,7 @@ function createTransferPayload(from, transfers, context) {
|
|
|
1330
1330
|
|
|
1331
1331
|
// src/transaction/buildTransaction.ts
|
|
1332
1332
|
import { assertEx as assertEx16, toHex as toHex2 } from "@xylabs/sdk-js";
|
|
1333
|
-
import { BoundWitnessBuilder } from "@xyo-network/
|
|
1334
|
-
import { PayloadBuilder as PayloadBuilder5 } from "@xyo-network/payload-builder";
|
|
1333
|
+
import { BoundWitnessBuilder, PayloadBuilder as PayloadBuilder5 } from "@xyo-network/sdk-js";
|
|
1335
1334
|
import { defaultTransactionFees } from "@xyo-network/xl1-protocol";
|
|
1336
1335
|
async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer, nbf, exp, from, fees = defaultTransactionFees) {
|
|
1337
1336
|
if (from === void 0 && Array.isArray(signer)) {
|
|
@@ -1380,8 +1379,7 @@ var buildRandomTransaction = async (chain, payloads, account, nbf = asXL1BlockNu
|
|
|
1380
1379
|
|
|
1381
1380
|
// src/transaction/buildUnsignedTransaction.ts
|
|
1382
1381
|
import { toHex as toHex3 } from "@xylabs/sdk-js";
|
|
1383
|
-
import { BoundWitnessBuilder as BoundWitnessBuilder2 } from "@xyo-network/
|
|
1384
|
-
import { PayloadBuilder as PayloadBuilder6 } from "@xyo-network/payload-builder";
|
|
1382
|
+
import { BoundWitnessBuilder as BoundWitnessBuilder2, PayloadBuilder as PayloadBuilder6 } from "@xyo-network/sdk-js";
|
|
1385
1383
|
import { defaultTransactionFees as defaultTransactionFees2 } from "@xyo-network/xl1-protocol";
|
|
1386
1384
|
async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads, nbf, exp, from, fees = defaultTransactionFees2) {
|
|
1387
1385
|
const txBoundWitnessFields = {
|
|
@@ -1511,7 +1509,7 @@ var hydrateElevatedTransaction = async (context, hash) => {
|
|
|
1511
1509
|
};
|
|
1512
1510
|
|
|
1513
1511
|
// src/transaction/primitives/transactionBlockByteCount.ts
|
|
1514
|
-
import { PayloadBuilder as PayloadBuilder7 } from "@xyo-network/
|
|
1512
|
+
import { PayloadBuilder as PayloadBuilder7 } from "@xyo-network/sdk-js";
|
|
1515
1513
|
function transactionBlockByteCount([transaction, payloads]) {
|
|
1516
1514
|
const cleanTransaction = PayloadBuilder7.omitStorageMeta(transaction);
|
|
1517
1515
|
const transactionBytes = JSON.stringify(cleanTransaction).length;
|
|
@@ -1593,7 +1591,7 @@ import {
|
|
|
1593
1591
|
hexFromArrayBuffer,
|
|
1594
1592
|
toArrayBuffer
|
|
1595
1593
|
} from "@xylabs/sdk-js";
|
|
1596
|
-
import { PayloadBuilder as PayloadBuilder8 } from "@xyo-network/
|
|
1594
|
+
import { PayloadBuilder as PayloadBuilder8 } from "@xyo-network/sdk-js";
|
|
1597
1595
|
async function signTransaction(tx, account) {
|
|
1598
1596
|
assertEx19(tx.from === account.address, () => "Signer address does not match transaction from address");
|
|
1599
1597
|
const unsignedTx = structuredClone(tx);
|
|
@@ -1611,7 +1609,7 @@ async function signTransaction(tx, account) {
|
|
|
1611
1609
|
|
|
1612
1610
|
// src/transaction/TransactionBuilder.ts
|
|
1613
1611
|
import { assertEx as assertEx20, Base } from "@xylabs/sdk-js";
|
|
1614
|
-
import { PayloadBuilder as PayloadBuilder9 } from "@xyo-network/
|
|
1612
|
+
import { PayloadBuilder as PayloadBuilder9 } from "@xyo-network/sdk-js";
|
|
1615
1613
|
import {
|
|
1616
1614
|
asXL1BlockNumber as asXL1BlockNumber4,
|
|
1617
1615
|
defaultTransactionFees as defaultTransactionFees3,
|
|
@@ -1872,254 +1870,13 @@ function toStepIdentityString({ block, step }) {
|
|
|
1872
1870
|
return `${block}|${step}`;
|
|
1873
1871
|
}
|
|
1874
1872
|
|
|
1875
|
-
// src/config/
|
|
1876
|
-
import {
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
id: HexZod.optional().register(globalRegistry, {
|
|
1883
|
-
description: "The unique identifier for the chain. Should be the staking contract address for contract-backed chains.",
|
|
1884
|
-
title: "chain.id",
|
|
1885
|
-
type: "string"
|
|
1886
|
-
}),
|
|
1887
|
-
genesisRewardAddress: AddressZod.optional().register(globalRegistry, {
|
|
1888
|
-
description: "Address to send the initial genesis rewards to, if a new chain is being created.",
|
|
1889
|
-
title: "chain.genesisRewardAddress",
|
|
1890
|
-
type: "Address"
|
|
1891
|
-
})
|
|
1892
|
-
});
|
|
1893
|
-
|
|
1894
|
-
// src/config/Evm.ts
|
|
1895
|
-
import { globalRegistry as globalRegistry2, z as z3 } from "zod";
|
|
1896
|
-
var EvmInfuraConfigZod = z3.object({
|
|
1897
|
-
projectId: z3.string().optional().register(globalRegistry2, {
|
|
1898
|
-
description: "Infura project ID",
|
|
1899
|
-
title: "evm.infura.projectId",
|
|
1900
|
-
type: "string"
|
|
1901
|
-
}),
|
|
1902
|
-
projectSecret: z3.string().optional().register(globalRegistry2, {
|
|
1903
|
-
description: "Infura project secret",
|
|
1904
|
-
title: "evm.infura.projectSecret",
|
|
1905
|
-
type: "string"
|
|
1906
|
-
})
|
|
1907
|
-
});
|
|
1908
|
-
var EvmJsonRpcConfigZod = z3.object({
|
|
1909
|
-
url: z3.url().optional().register(globalRegistry2, {
|
|
1910
|
-
description: "JSON-RPC URL",
|
|
1911
|
-
title: "evm.jsonRpc.url",
|
|
1912
|
-
type: "string"
|
|
1913
|
-
})
|
|
1914
|
-
});
|
|
1915
|
-
var EvmConfigZod = z3.object({
|
|
1916
|
-
chainId: z3.string().optional().register(globalRegistry2, {
|
|
1917
|
-
description: "EVM chain ID",
|
|
1918
|
-
title: "evm.chainId",
|
|
1919
|
-
type: "string"
|
|
1920
|
-
}),
|
|
1921
|
-
infura: EvmInfuraConfigZod.optional().describe("Infura Provider configuration"),
|
|
1922
|
-
jsonRpc: EvmJsonRpcConfigZod.optional().describe("JSON-RPC Provider configuration")
|
|
1923
|
-
});
|
|
1924
|
-
|
|
1925
|
-
// src/config/Log.ts
|
|
1926
|
-
import { LogLevel } from "@xylabs/sdk-js";
|
|
1927
|
-
import { globalRegistry as globalRegistry3, z as z4 } from "zod";
|
|
1928
|
-
var LogLevelNames = Object.keys(LogLevel);
|
|
1929
|
-
var LogConfigZod = z4.object({
|
|
1930
|
-
logLevel: z4.enum(LogLevelNames).default("info").register(globalRegistry3, {
|
|
1931
|
-
choices: LogLevelNames,
|
|
1932
|
-
default: "info",
|
|
1933
|
-
description: "Desired process verbosity",
|
|
1934
|
-
title: "logLevel",
|
|
1935
|
-
type: "string"
|
|
1936
|
-
}),
|
|
1937
|
-
silent: z4.boolean().default(false).register(globalRegistry3, {
|
|
1938
|
-
default: false,
|
|
1939
|
-
description: "Whether to run in silent mode",
|
|
1940
|
-
title: "silent",
|
|
1941
|
-
type: "boolean"
|
|
1942
|
-
})
|
|
1943
|
-
});
|
|
1944
|
-
|
|
1945
|
-
// src/config/Remote.ts
|
|
1946
|
-
import { globalRegistry as globalRegistry4, z as z5 } from "zod";
|
|
1947
|
-
var RemoteConfigZod = z5.object({
|
|
1948
|
-
rpc: z5.object({
|
|
1949
|
-
url: z5.string().register(globalRegistry4, {
|
|
1950
|
-
description: "URL for the Chain RPC API",
|
|
1951
|
-
type: "string"
|
|
1952
|
-
})
|
|
1953
|
-
}).describe("Configuration for the remote RPC service").optional()
|
|
1954
|
-
});
|
|
1955
|
-
|
|
1956
|
-
// src/config/storage/driver/Mongo.ts
|
|
1957
|
-
import { isDefined as isDefined15, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
|
|
1958
|
-
import { globalRegistry as globalRegistry5, z as z6 } from "zod";
|
|
1959
|
-
var hasMongoConfig = (config) => {
|
|
1960
|
-
if (isUndefined3(config)) return false;
|
|
1961
|
-
return isDefined15(config.connectionString) && isDefined15(config.database) && isDefined15(config.domain) && isDefined15(config.password) && isDefined15(config.username);
|
|
1962
|
-
};
|
|
1963
|
-
var MongoConfigZod = z6.object({
|
|
1964
|
-
// TODO: Create from other arguments
|
|
1965
|
-
connectionString: z6.string().nonempty().optional().register(globalRegistry5, {
|
|
1966
|
-
description: "MongoDB connection string",
|
|
1967
|
-
title: "storage.mongo.connectionString",
|
|
1968
|
-
type: "string"
|
|
1969
|
-
}),
|
|
1970
|
-
database: z6.string().nonempty().optional().register(globalRegistry5, {
|
|
1971
|
-
description: "MongoDB database name",
|
|
1972
|
-
title: "storage.mongo.database",
|
|
1973
|
-
type: "string"
|
|
1974
|
-
}),
|
|
1975
|
-
domain: z6.string().nonempty().optional().register(globalRegistry5, {
|
|
1976
|
-
description: "MongoDB domain",
|
|
1977
|
-
title: "storage.mongo.domain",
|
|
1978
|
-
type: "string"
|
|
1979
|
-
}),
|
|
1980
|
-
password: z6.string().nonempty().optional().register(globalRegistry5, {
|
|
1981
|
-
description: "MongoDB password",
|
|
1982
|
-
title: "storage.mongo.password",
|
|
1983
|
-
type: "string"
|
|
1984
|
-
}),
|
|
1985
|
-
username: z6.string().nonempty().optional().register(globalRegistry5, {
|
|
1986
|
-
description: "MongoDB username",
|
|
1987
|
-
title: "storage.mongo.username",
|
|
1988
|
-
type: "string"
|
|
1989
|
-
})
|
|
1990
|
-
});
|
|
1991
|
-
|
|
1992
|
-
// src/config/storage/Storage.ts
|
|
1993
|
-
import { globalRegistry as globalRegistry6, z as z7 } from "zod";
|
|
1994
|
-
var StorageConfigZod = z7.object({
|
|
1995
|
-
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
1996
|
-
root: z7.string().optional().register(globalRegistry6, {
|
|
1997
|
-
description: "Root directory for local storage",
|
|
1998
|
-
title: "storage.root",
|
|
1999
|
-
type: "string"
|
|
2000
|
-
})
|
|
2001
|
-
}).describe("Storage configuration options");
|
|
2002
|
-
|
|
2003
|
-
// src/config/Telemetry.ts
|
|
2004
|
-
import { globalRegistry as globalRegistry7, z as z8 } from "zod";
|
|
2005
|
-
var DefaultMetricsScrapePorts = {
|
|
2006
|
-
api: 9465,
|
|
2007
|
-
bridge: 9468,
|
|
2008
|
-
mempool: 9466,
|
|
2009
|
-
producer: 9464,
|
|
2010
|
-
rewardRedemptionApi: 9467
|
|
2011
|
-
};
|
|
2012
|
-
var MetricsScrapeConfigZod = z8.object({
|
|
2013
|
-
path: z8.string().default("/metrics").register(globalRegistry7, {
|
|
2014
|
-
default: "/metrics",
|
|
2015
|
-
description: "Path for the metrics scrape endpoint",
|
|
2016
|
-
title: "telemetry.metrics.scrape.path",
|
|
2017
|
-
type: "string"
|
|
2018
|
-
}),
|
|
2019
|
-
port: z8.coerce.number().int().positive().optional().register(globalRegistry7, {
|
|
2020
|
-
description: "Port for the metrics scrape endpoint",
|
|
2021
|
-
title: "telemetry.metrics.scrape.port",
|
|
2022
|
-
type: "number"
|
|
2023
|
-
})
|
|
2024
|
-
}).describe("Metrics scrape configuration");
|
|
2025
|
-
var MetricsConfigZod = z8.object({ scrape: MetricsScrapeConfigZod }).describe("Metrics configuration options");
|
|
2026
|
-
var OpenTelemetryConfigZod = z8.object({
|
|
2027
|
-
// OpenTelemetry options
|
|
2028
|
-
otlpEndpoint: z8.url().optional().register(globalRegistry7, {
|
|
2029
|
-
description: "OTLP endpoint for exporting telemetry data",
|
|
2030
|
-
title: "telemetry.otel.otlpEndpoint",
|
|
2031
|
-
type: "string"
|
|
2032
|
-
})
|
|
2033
|
-
});
|
|
2034
|
-
var TelemetryConfigZod = z8.object({
|
|
2035
|
-
// Metrics configuration
|
|
2036
|
-
metrics: MetricsConfigZod.optional().describe("Metrics configuration"),
|
|
2037
|
-
// OpenTelemetry configuration
|
|
2038
|
-
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
2039
|
-
}).describe("Telemetry configuration options");
|
|
2040
|
-
|
|
2041
|
-
// src/config/Validation.ts
|
|
2042
|
-
import { AddressZod as AddressZod2, asAddress } from "@xylabs/sdk-js";
|
|
2043
|
-
import { globalRegistry as globalRegistry8, z as z9 } from "zod";
|
|
2044
|
-
var ValidationConfigZod = z9.object({
|
|
2045
|
-
allowedRewardRedeemers: z9.preprocess((val) => {
|
|
2046
|
-
if (typeof val === "string") {
|
|
2047
|
-
return val.split(",").map((s) => asAddress(s.trim()));
|
|
2048
|
-
}
|
|
2049
|
-
return val;
|
|
2050
|
-
}, z9.array(AddressZod2).optional().register(globalRegistry8, {
|
|
2051
|
-
description: "List of allowed reward redeemer addresses, if undefined anyone can participate",
|
|
2052
|
-
title: "allowedRewardRedeemers",
|
|
2053
|
-
type: "array"
|
|
2054
|
-
})),
|
|
2055
|
-
allowedRewardEscrowAccountSigners: z9.preprocess((val) => {
|
|
2056
|
-
if (typeof val === "string") {
|
|
2057
|
-
return val.split(",").map((s) => asAddress(s.trim()));
|
|
2058
|
-
}
|
|
2059
|
-
return val;
|
|
2060
|
-
}, z9.array(AddressZod2).optional().register(globalRegistry8, {
|
|
2061
|
-
description: "List of allowed reward escrow account signer addresses, if undefined anyone can participate",
|
|
2062
|
-
title: "allowedRewardEscrowAccountSigners",
|
|
2063
|
-
type: "array"
|
|
2064
|
-
}))
|
|
2065
|
-
});
|
|
2066
|
-
|
|
2067
|
-
// src/config/Base.ts
|
|
2068
|
-
var BaseConfigZod = z10.object({
|
|
2069
|
-
chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe("Configuration for the chain"),
|
|
2070
|
-
evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe("Configuration for EVM-backed services"),
|
|
2071
|
-
log: LogConfigZod.default(LogConfigZod.parse({})).describe("Configuration for logging"),
|
|
2072
|
-
remote: RemoteConfigZod.default(RemoteConfigZod.parse({})).describe("Configuration for remote services"),
|
|
2073
|
-
storage: StorageConfigZod.default(StorageConfigZod.parse({})).describe("Configuration for the storage"),
|
|
2074
|
-
telemetry: TelemetryConfigZod.default(TelemetryConfigZod.parse({})).describe("Configuration for telemetry"),
|
|
2075
|
-
validation: ValidationConfigZod.default(ValidationConfigZod.parse({})).describe("Configuration for validation")
|
|
2076
|
-
});
|
|
2077
|
-
|
|
2078
|
-
// src/config/Config.ts
|
|
2079
|
-
import { deepMerge } from "@xylabs/sdk-js";
|
|
2080
|
-
import z11 from "zod";
|
|
2081
|
-
var ActorsConfigZod = z11.array(BaseConfigZod.loose()).describe("Actor-specific configurations that override the base configuration when the actor is running").default([]);
|
|
2082
|
-
var ConfigZod = BaseConfigZod.extend(z11.object({ actors: ActorsConfigZod }).describe("Actor-specific configurations that override the base configuration when the actor is running").shape);
|
|
2083
|
-
function resolveConfig(config) {
|
|
2084
|
-
const parsedConfig = ConfigZod.parse(config);
|
|
2085
|
-
const { actors, ...rootConfig } = parsedConfig;
|
|
2086
|
-
parsedConfig.actors = actors.map((actorConfig) => {
|
|
2087
|
-
return BaseConfigZod.loose().parse(deepMerge(rootConfig, actorConfig));
|
|
2088
|
-
});
|
|
2089
|
-
return parsedConfig;
|
|
2090
|
-
}
|
|
2091
|
-
var getDefaultConfig = () => ConfigZod.parse({});
|
|
2092
|
-
|
|
2093
|
-
// src/config/UsageMeta.ts
|
|
2094
|
-
import { z as z12 } from "zod";
|
|
2095
|
-
var DescriptionSchema = z12.string();
|
|
2096
|
-
var TitleSchema = z12.string();
|
|
2097
|
-
var JSONSchemaMetaSchema = z12.object({
|
|
2098
|
-
id: z12.string().optional(),
|
|
2099
|
-
title: TitleSchema.optional(),
|
|
2100
|
-
description: DescriptionSchema.optional(),
|
|
2101
|
-
deprecated: z12.boolean().optional()
|
|
2102
|
-
}).catchall(z12.unknown());
|
|
2103
|
-
var GlobalMetaSchema = JSONSchemaMetaSchema.extend({});
|
|
2104
|
-
var ChoicesSchema = z12.array(z12.union([z12.string(), z12.number(), z12.literal(true), z12.undefined()])).readonly();
|
|
2105
|
-
var UsageMetaSchema = GlobalMetaSchema.extend({
|
|
2106
|
-
choices: ChoicesSchema.optional(),
|
|
2107
|
-
default: z12.unknown().optional(),
|
|
2108
|
-
description: DescriptionSchema,
|
|
2109
|
-
group: z12.string().optional(),
|
|
2110
|
-
hidden: z12.boolean().optional(),
|
|
2111
|
-
title: TitleSchema,
|
|
2112
|
-
type: z12.union([
|
|
2113
|
-
z12.literal("array"),
|
|
2114
|
-
z12.literal("count"),
|
|
2115
|
-
z12.literal("boolean"),
|
|
2116
|
-
z12.literal("number"),
|
|
2117
|
-
z12.literal("string")
|
|
2118
|
-
])
|
|
2119
|
-
});
|
|
2120
|
-
function isUsageMeta(v) {
|
|
2121
|
-
return UsageMetaSchema.safeParse(v).success;
|
|
2122
|
-
}
|
|
1873
|
+
// src/config/Actor.ts
|
|
1874
|
+
import {
|
|
1875
|
+
zodAsFactory as zodAsFactory2,
|
|
1876
|
+
zodIsFactory as zodIsFactory2,
|
|
1877
|
+
zodToFactory as zodToFactory2
|
|
1878
|
+
} from "@xylabs/zod";
|
|
1879
|
+
import { globalRegistry as globalRegistry9, z as z13 } from "zod";
|
|
2123
1880
|
|
|
2124
1881
|
// src/CreatableProvider/AbstractCreatableProvider.ts
|
|
2125
1882
|
import { AbstractCreatable as AbstractCreatable2, assertEx as assertEx22 } from "@xylabs/sdk-js";
|
|
@@ -2281,12 +2038,12 @@ import {
|
|
|
2281
2038
|
zodToFactory
|
|
2282
2039
|
} from "@xylabs/zod";
|
|
2283
2040
|
import { CachingContextZod } from "@xyo-network/xl1-protocol";
|
|
2284
|
-
import { z as
|
|
2285
|
-
var RuntimeStatusMonitorZod =
|
|
2286
|
-
var ProviderFactoryLocatorZod =
|
|
2041
|
+
import { z as z2 } from "zod";
|
|
2042
|
+
var RuntimeStatusMonitorZod = z2.custom((val) => val && typeof val === "object");
|
|
2043
|
+
var ProviderFactoryLocatorZod = z2.lazy(() => z2.custom((val) => val && typeof val === "object" && "context" in val && "registry" in val));
|
|
2287
2044
|
var BaseConfigContextZod = CachingContextZod.extend({ config: BaseConfigZod.loose() });
|
|
2288
|
-
var CreatableProviderContextZod =
|
|
2289
|
-
_id:
|
|
2045
|
+
var CreatableProviderContextZod = z2.lazy(() => BaseConfigContextZod.extend({
|
|
2046
|
+
_id: z2.string().optional(),
|
|
2290
2047
|
locator: ProviderFactoryLocatorZod,
|
|
2291
2048
|
statusReporter: RuntimeStatusMonitorZod.optional()
|
|
2292
2049
|
}));
|
|
@@ -2469,6 +2226,348 @@ var ProviderFactoryLocator = class _ProviderFactoryLocator {
|
|
|
2469
2226
|
}
|
|
2470
2227
|
};
|
|
2471
2228
|
|
|
2229
|
+
// src/validation/lib/isLocalhost.ts
|
|
2230
|
+
var isLocalhost = (hostname) => {
|
|
2231
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost");
|
|
2232
|
+
};
|
|
2233
|
+
|
|
2234
|
+
// src/validation/lib/getUrl.ts
|
|
2235
|
+
var getUrl = (host, port) => {
|
|
2236
|
+
const scheme = isLocalhost(host) ? "http" : "https";
|
|
2237
|
+
return `${scheme}://${host}:${port}`;
|
|
2238
|
+
};
|
|
2239
|
+
|
|
2240
|
+
// src/validation/schema/Address.ts
|
|
2241
|
+
var TODO = true;
|
|
2242
|
+
|
|
2243
|
+
// src/validation/schema/Mnemonic.ts
|
|
2244
|
+
import { z as z3 } from "zod";
|
|
2245
|
+
var MnemonicStringZod = z3.string().transform((s) => s.trim().replaceAll(/\s+/g, " ")).refine(
|
|
2246
|
+
(s) => [12, 15, 18, 21, 24].includes(s.split(" ").length),
|
|
2247
|
+
{ message: "Mnemonic must contain 12, 15, 18, 21, or 24 words." }
|
|
2248
|
+
).describe("BIP-39 mnemonic string");
|
|
2249
|
+
|
|
2250
|
+
// src/config/Base.ts
|
|
2251
|
+
import { z as z12 } from "zod";
|
|
2252
|
+
|
|
2253
|
+
// src/config/Chain.ts
|
|
2254
|
+
import { AddressZod, HexZod } from "@xylabs/sdk-js";
|
|
2255
|
+
import { globalRegistry, z as z4 } from "zod";
|
|
2256
|
+
var ChainConfigZod = z4.object({
|
|
2257
|
+
id: HexZod.optional().register(globalRegistry, {
|
|
2258
|
+
description: "The unique identifier for the chain. Should be the staking contract address for contract-backed chains.",
|
|
2259
|
+
title: "chain.id",
|
|
2260
|
+
type: "string"
|
|
2261
|
+
}),
|
|
2262
|
+
genesisRewardAddress: AddressZod.optional().register(globalRegistry, {
|
|
2263
|
+
description: "Address to send the initial genesis rewards to, if a new chain is being created.",
|
|
2264
|
+
title: "chain.genesisRewardAddress",
|
|
2265
|
+
type: "Address"
|
|
2266
|
+
})
|
|
2267
|
+
});
|
|
2268
|
+
|
|
2269
|
+
// src/config/Evm.ts
|
|
2270
|
+
import { globalRegistry as globalRegistry2, z as z5 } from "zod";
|
|
2271
|
+
var EvmInfuraConfigZod = z5.object({
|
|
2272
|
+
projectId: z5.string().optional().register(globalRegistry2, {
|
|
2273
|
+
description: "Infura project ID",
|
|
2274
|
+
title: "evm.infura.projectId",
|
|
2275
|
+
type: "string"
|
|
2276
|
+
}),
|
|
2277
|
+
projectSecret: z5.string().optional().register(globalRegistry2, {
|
|
2278
|
+
description: "Infura project secret",
|
|
2279
|
+
title: "evm.infura.projectSecret",
|
|
2280
|
+
type: "string"
|
|
2281
|
+
})
|
|
2282
|
+
});
|
|
2283
|
+
var EvmJsonRpcConfigZod = z5.object({
|
|
2284
|
+
url: z5.url().optional().register(globalRegistry2, {
|
|
2285
|
+
description: "JSON-RPC URL",
|
|
2286
|
+
title: "evm.jsonRpc.url",
|
|
2287
|
+
type: "string"
|
|
2288
|
+
})
|
|
2289
|
+
});
|
|
2290
|
+
var EvmConfigZod = z5.object({
|
|
2291
|
+
chainId: z5.string().optional().register(globalRegistry2, {
|
|
2292
|
+
description: "EVM chain ID",
|
|
2293
|
+
title: "evm.chainId",
|
|
2294
|
+
type: "string"
|
|
2295
|
+
}),
|
|
2296
|
+
infura: EvmInfuraConfigZod.optional().describe("Infura Provider configuration"),
|
|
2297
|
+
jsonRpc: EvmJsonRpcConfigZod.optional().describe("JSON-RPC Provider configuration")
|
|
2298
|
+
});
|
|
2299
|
+
|
|
2300
|
+
// src/config/Log.ts
|
|
2301
|
+
import { LogLevel } from "@xylabs/sdk-js";
|
|
2302
|
+
import { globalRegistry as globalRegistry3, z as z6 } from "zod";
|
|
2303
|
+
var LogLevelNames = Object.keys(LogLevel);
|
|
2304
|
+
var LogConfigZod = z6.object({
|
|
2305
|
+
logLevel: z6.enum(LogLevelNames).default("info").register(globalRegistry3, {
|
|
2306
|
+
choices: LogLevelNames,
|
|
2307
|
+
default: "info",
|
|
2308
|
+
description: "Desired process verbosity",
|
|
2309
|
+
title: "logLevel",
|
|
2310
|
+
type: "string"
|
|
2311
|
+
}),
|
|
2312
|
+
silent: z6.boolean().default(false).register(globalRegistry3, {
|
|
2313
|
+
default: false,
|
|
2314
|
+
description: "Whether to run in silent mode",
|
|
2315
|
+
title: "silent",
|
|
2316
|
+
type: "boolean"
|
|
2317
|
+
})
|
|
2318
|
+
});
|
|
2319
|
+
|
|
2320
|
+
// src/config/Remote.ts
|
|
2321
|
+
import { globalRegistry as globalRegistry4, z as z7 } from "zod";
|
|
2322
|
+
var RemoteConfigZod = z7.object({
|
|
2323
|
+
rpc: z7.object({
|
|
2324
|
+
url: z7.string().register(globalRegistry4, {
|
|
2325
|
+
description: "URL for the Chain RPC API",
|
|
2326
|
+
type: "string"
|
|
2327
|
+
})
|
|
2328
|
+
}).describe("Configuration for the remote RPC service").optional()
|
|
2329
|
+
});
|
|
2330
|
+
|
|
2331
|
+
// src/config/storage/driver/Mongo.ts
|
|
2332
|
+
import { isDefined as isDefined15, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
|
|
2333
|
+
import { globalRegistry as globalRegistry5, z as z8 } from "zod";
|
|
2334
|
+
var hasMongoConfig = (config) => {
|
|
2335
|
+
if (isUndefined3(config)) return false;
|
|
2336
|
+
return isDefined15(config.connectionString) && isDefined15(config.database) && isDefined15(config.domain) && isDefined15(config.password) && isDefined15(config.username);
|
|
2337
|
+
};
|
|
2338
|
+
var MongoConfigZod = z8.object({
|
|
2339
|
+
// TODO: Create from other arguments
|
|
2340
|
+
connectionString: z8.string().nonempty().optional().register(globalRegistry5, {
|
|
2341
|
+
description: "MongoDB connection string",
|
|
2342
|
+
title: "storage.mongo.connectionString",
|
|
2343
|
+
type: "string"
|
|
2344
|
+
}),
|
|
2345
|
+
database: z8.string().nonempty().optional().register(globalRegistry5, {
|
|
2346
|
+
description: "MongoDB database name",
|
|
2347
|
+
title: "storage.mongo.database",
|
|
2348
|
+
type: "string"
|
|
2349
|
+
}),
|
|
2350
|
+
domain: z8.string().nonempty().optional().register(globalRegistry5, {
|
|
2351
|
+
description: "MongoDB domain",
|
|
2352
|
+
title: "storage.mongo.domain",
|
|
2353
|
+
type: "string"
|
|
2354
|
+
}),
|
|
2355
|
+
password: z8.string().nonempty().optional().register(globalRegistry5, {
|
|
2356
|
+
description: "MongoDB password",
|
|
2357
|
+
title: "storage.mongo.password",
|
|
2358
|
+
type: "string"
|
|
2359
|
+
}),
|
|
2360
|
+
username: z8.string().nonempty().optional().register(globalRegistry5, {
|
|
2361
|
+
description: "MongoDB username",
|
|
2362
|
+
title: "storage.mongo.username",
|
|
2363
|
+
type: "string"
|
|
2364
|
+
})
|
|
2365
|
+
});
|
|
2366
|
+
|
|
2367
|
+
// src/config/storage/Storage.ts
|
|
2368
|
+
import { globalRegistry as globalRegistry6, z as z9 } from "zod";
|
|
2369
|
+
var StorageConfigZod = z9.object({
|
|
2370
|
+
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
2371
|
+
root: z9.string().optional().register(globalRegistry6, {
|
|
2372
|
+
description: "Root directory for local storage",
|
|
2373
|
+
title: "storage.root",
|
|
2374
|
+
type: "string"
|
|
2375
|
+
})
|
|
2376
|
+
}).describe("Storage configuration options");
|
|
2377
|
+
|
|
2378
|
+
// src/config/Telemetry.ts
|
|
2379
|
+
import { globalRegistry as globalRegistry7, z as z10 } from "zod";
|
|
2380
|
+
var DefaultMetricsScrapePorts = {
|
|
2381
|
+
api: 9465,
|
|
2382
|
+
bridge: 9468,
|
|
2383
|
+
mempool: 9466,
|
|
2384
|
+
producer: 9464,
|
|
2385
|
+
rewardRedemptionApi: 9467
|
|
2386
|
+
};
|
|
2387
|
+
var MetricsScrapeConfigZod = z10.object({
|
|
2388
|
+
path: z10.string().default("/metrics").register(globalRegistry7, {
|
|
2389
|
+
default: "/metrics",
|
|
2390
|
+
description: "Path for the metrics scrape endpoint",
|
|
2391
|
+
title: "telemetry.metrics.scrape.path",
|
|
2392
|
+
type: "string"
|
|
2393
|
+
}),
|
|
2394
|
+
port: z10.coerce.number().int().positive().optional().register(globalRegistry7, {
|
|
2395
|
+
description: "Port for the metrics scrape endpoint",
|
|
2396
|
+
title: "telemetry.metrics.scrape.port",
|
|
2397
|
+
type: "number"
|
|
2398
|
+
})
|
|
2399
|
+
}).describe("Metrics scrape configuration");
|
|
2400
|
+
var MetricsConfigZod = z10.object({ scrape: MetricsScrapeConfigZod }).describe("Metrics configuration options");
|
|
2401
|
+
var OpenTelemetryConfigZod = z10.object({
|
|
2402
|
+
// OpenTelemetry options
|
|
2403
|
+
otlpEndpoint: z10.url().optional().register(globalRegistry7, {
|
|
2404
|
+
description: "OTLP endpoint for exporting telemetry data",
|
|
2405
|
+
title: "telemetry.otel.otlpEndpoint",
|
|
2406
|
+
type: "string"
|
|
2407
|
+
})
|
|
2408
|
+
});
|
|
2409
|
+
var TelemetryConfigZod = z10.object({
|
|
2410
|
+
// Metrics configuration
|
|
2411
|
+
metrics: MetricsConfigZod.optional().describe("Metrics configuration"),
|
|
2412
|
+
// OpenTelemetry configuration
|
|
2413
|
+
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
2414
|
+
}).describe("Telemetry configuration options");
|
|
2415
|
+
|
|
2416
|
+
// src/config/Validation.ts
|
|
2417
|
+
import { AddressZod as AddressZod2, asAddress } from "@xylabs/sdk-js";
|
|
2418
|
+
import { globalRegistry as globalRegistry8, z as z11 } from "zod";
|
|
2419
|
+
var ValidationConfigZod = z11.object({
|
|
2420
|
+
allowedRewardRedeemers: z11.preprocess((val) => {
|
|
2421
|
+
if (typeof val === "string") {
|
|
2422
|
+
return val.split(",").map((s) => asAddress(s.trim()));
|
|
2423
|
+
}
|
|
2424
|
+
return val;
|
|
2425
|
+
}, z11.array(AddressZod2).optional().register(globalRegistry8, {
|
|
2426
|
+
description: "List of allowed reward redeemer addresses, if undefined anyone can participate",
|
|
2427
|
+
title: "allowedRewardRedeemers",
|
|
2428
|
+
type: "array"
|
|
2429
|
+
})),
|
|
2430
|
+
allowedRewardEscrowAccountSigners: z11.preprocess((val) => {
|
|
2431
|
+
if (typeof val === "string") {
|
|
2432
|
+
return val.split(",").map((s) => asAddress(s.trim()));
|
|
2433
|
+
}
|
|
2434
|
+
return val;
|
|
2435
|
+
}, z11.array(AddressZod2).optional().register(globalRegistry8, {
|
|
2436
|
+
description: "List of allowed reward escrow account signer addresses, if undefined anyone can participate",
|
|
2437
|
+
title: "allowedRewardEscrowAccountSigners",
|
|
2438
|
+
type: "array"
|
|
2439
|
+
}))
|
|
2440
|
+
});
|
|
2441
|
+
|
|
2442
|
+
// src/config/Base.ts
|
|
2443
|
+
var BaseConfigZod = z12.object({
|
|
2444
|
+
chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe("Configuration for the chain"),
|
|
2445
|
+
evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe("Configuration for EVM-backed services"),
|
|
2446
|
+
log: LogConfigZod.default(LogConfigZod.parse({})).describe("Configuration for logging"),
|
|
2447
|
+
remote: RemoteConfigZod.default(RemoteConfigZod.parse({})).describe("Configuration for remote services"),
|
|
2448
|
+
storage: StorageConfigZod.default(StorageConfigZod.parse({})).describe("Configuration for the storage"),
|
|
2449
|
+
telemetry: TelemetryConfigZod.default(TelemetryConfigZod.parse({})).describe("Configuration for telemetry"),
|
|
2450
|
+
validation: ValidationConfigZod.default(ValidationConfigZod.parse({})).describe("Configuration for validation")
|
|
2451
|
+
});
|
|
2452
|
+
|
|
2453
|
+
// src/config/Actor.ts
|
|
2454
|
+
var ActorConfigZod = BaseConfigZod.extend({
|
|
2455
|
+
name: z13.string(),
|
|
2456
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry9, {
|
|
2457
|
+
description: "Mnemonic for the Actor wallet",
|
|
2458
|
+
title: "mnemonic",
|
|
2459
|
+
type: "string"
|
|
2460
|
+
}),
|
|
2461
|
+
healthCheckPort: z13.coerce.number().optional().register(globalRegistry9, {
|
|
2462
|
+
description: "Port for the Producer health checks",
|
|
2463
|
+
title: "producer.healthCheckPort",
|
|
2464
|
+
type: "number"
|
|
2465
|
+
})
|
|
2466
|
+
});
|
|
2467
|
+
var isActorConfig = zodIsFactory2(ActorConfigZod);
|
|
2468
|
+
var asActorConfig = zodAsFactory2(ActorConfigZod, "asActorConfig");
|
|
2469
|
+
var toActorConfig = zodToFactory2(ActorConfigZod, "toActorConfig");
|
|
2470
|
+
var ActorConfigContext = BaseConfigContextZod.extend({ config: ActorConfigZod });
|
|
2471
|
+
var isActorConfigContext = zodIsFactory2(ActorConfigContext);
|
|
2472
|
+
var asActorConfigContext = zodAsFactory2(ActorConfigContext, "asActorConfigContext");
|
|
2473
|
+
var toActorConfigContext = zodToFactory2(ActorConfigContext, "toActorConfigContext");
|
|
2474
|
+
|
|
2475
|
+
// src/config/Config.ts
|
|
2476
|
+
import z14 from "zod";
|
|
2477
|
+
var ActorsConfigZod = z14.array(ActorConfigZod.loose()).describe("Actor-specific configurations that override the base configuration when the actor is running").default([]);
|
|
2478
|
+
var ConfigZod = BaseConfigZod.extend(z14.object({ actors: ActorsConfigZod }).describe("Actor-specific configurations that override the base configuration when the actor is running").shape);
|
|
2479
|
+
function resolveConfig(config) {
|
|
2480
|
+
const parsedConfig = ConfigZod.parse(config);
|
|
2481
|
+
const { actors, ...rootConfig } = parsedConfig;
|
|
2482
|
+
parsedConfig.actors = actors.map((actorConfig) => {
|
|
2483
|
+
return ActorConfigZod.loose().parse({ ...rootConfig, ...actorConfig });
|
|
2484
|
+
});
|
|
2485
|
+
return parsedConfig;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
// src/config/getFileConfig.ts
|
|
2489
|
+
import { isDefined as isDefined16, isNull as isNull2 } from "@xylabs/sdk-js";
|
|
2490
|
+
import { cosmiconfig } from "cosmiconfig";
|
|
2491
|
+
var configName = "xyo";
|
|
2492
|
+
var configSection = "xl1";
|
|
2493
|
+
async function getFileConfig(searchPlaces) {
|
|
2494
|
+
const explorer = cosmiconfig(
|
|
2495
|
+
configName,
|
|
2496
|
+
{
|
|
2497
|
+
cache: true,
|
|
2498
|
+
searchPlaces
|
|
2499
|
+
}
|
|
2500
|
+
);
|
|
2501
|
+
const result = (await explorer.search())?.config;
|
|
2502
|
+
if (!isNull2(result)) {
|
|
2503
|
+
const section = result[configSection];
|
|
2504
|
+
if (isDefined16(section) && typeof section === "object") {
|
|
2505
|
+
return ConfigZod.loose().parse(section);
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
return ConfigZod.parse({});
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
// src/config/HostActor.ts
|
|
2512
|
+
import {
|
|
2513
|
+
zodAsFactory as zodAsFactory3,
|
|
2514
|
+
zodIsFactory as zodIsFactory3,
|
|
2515
|
+
zodToFactory as zodToFactory3
|
|
2516
|
+
} from "@xylabs/zod";
|
|
2517
|
+
import { globalRegistry as globalRegistry10, z as z15 } from "zod";
|
|
2518
|
+
var HostActorConfigZod = ActorConfigZod.extend({
|
|
2519
|
+
host: z15.string().default("localhost").register(globalRegistry10, {
|
|
2520
|
+
default: "localhost",
|
|
2521
|
+
description: "Host for the Actor",
|
|
2522
|
+
title: "host",
|
|
2523
|
+
type: "string"
|
|
2524
|
+
}),
|
|
2525
|
+
port: z15.coerce.number().default(8080).register(globalRegistry10, {
|
|
2526
|
+
default: 8080,
|
|
2527
|
+
description: "Port for the Actor",
|
|
2528
|
+
title: "port",
|
|
2529
|
+
type: "number"
|
|
2530
|
+
})
|
|
2531
|
+
});
|
|
2532
|
+
var isHostActorConfig = zodIsFactory3(HostActorConfigZod);
|
|
2533
|
+
var asHostActorConfig = zodAsFactory3(HostActorConfigZod, "asHostActorConfig");
|
|
2534
|
+
var toHostActorConfig = zodToFactory3(HostActorConfigZod, "toHostActorConfig");
|
|
2535
|
+
var HostActorConfigContext = BaseConfigContextZod.extend({ config: HostActorConfigZod });
|
|
2536
|
+
var isHostActorConfigContext = zodIsFactory3(HostActorConfigContext);
|
|
2537
|
+
var asHostActorConfigContext = zodAsFactory3(HostActorConfigContext, "asHostActorConfigContext");
|
|
2538
|
+
var toHostActorConfigContext = zodToFactory3(HostActorConfigContext, "toHostActorConfigContext");
|
|
2539
|
+
|
|
2540
|
+
// src/config/UsageMeta.ts
|
|
2541
|
+
import { z as z16 } from "zod";
|
|
2542
|
+
var DescriptionSchema = z16.string();
|
|
2543
|
+
var TitleSchema = z16.string();
|
|
2544
|
+
var JSONSchemaMetaSchema = z16.object({
|
|
2545
|
+
id: z16.string().optional(),
|
|
2546
|
+
title: TitleSchema.optional(),
|
|
2547
|
+
description: DescriptionSchema.optional(),
|
|
2548
|
+
deprecated: z16.boolean().optional()
|
|
2549
|
+
}).catchall(z16.unknown());
|
|
2550
|
+
var GlobalMetaSchema = JSONSchemaMetaSchema.extend({});
|
|
2551
|
+
var ChoicesSchema = z16.array(z16.union([z16.string(), z16.number(), z16.literal(true), z16.undefined()])).readonly();
|
|
2552
|
+
var UsageMetaSchema = GlobalMetaSchema.extend({
|
|
2553
|
+
choices: ChoicesSchema.optional(),
|
|
2554
|
+
default: z16.unknown().optional(),
|
|
2555
|
+
description: DescriptionSchema,
|
|
2556
|
+
group: z16.string().optional(),
|
|
2557
|
+
hidden: z16.boolean().optional(),
|
|
2558
|
+
title: TitleSchema,
|
|
2559
|
+
type: z16.union([
|
|
2560
|
+
z16.literal("array"),
|
|
2561
|
+
z16.literal("count"),
|
|
2562
|
+
z16.literal("boolean"),
|
|
2563
|
+
z16.literal("number"),
|
|
2564
|
+
z16.literal("string")
|
|
2565
|
+
])
|
|
2566
|
+
});
|
|
2567
|
+
function isUsageMeta(v) {
|
|
2568
|
+
return UsageMetaSchema.safeParse(v).success;
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2472
2571
|
// src/context/getEmptyProviderContext.ts
|
|
2473
2572
|
function getEmptyProviderContext(config) {
|
|
2474
2573
|
const singletons = {};
|
|
@@ -2486,13 +2585,13 @@ function getEmptyContext(config) {
|
|
|
2486
2585
|
}
|
|
2487
2586
|
|
|
2488
2587
|
// src/createDeclarationPayload.ts
|
|
2489
|
-
import { isDefined as
|
|
2490
|
-
import { PayloadBuilder as PayloadBuilder11 } from "@xyo-network/
|
|
2588
|
+
import { isDefined as isDefined17 } from "@xylabs/sdk-js";
|
|
2589
|
+
import { PayloadBuilder as PayloadBuilder11 } from "@xyo-network/sdk-js";
|
|
2491
2590
|
import {
|
|
2492
2591
|
ChainStakeIntentSchema
|
|
2493
2592
|
} from "@xyo-network/xl1-protocol";
|
|
2494
2593
|
var createDeclarationIntent = (address, intent, nbf, exp) => {
|
|
2495
|
-
const expiration =
|
|
2594
|
+
const expiration = isDefined17(exp) ? exp : nbf + 1e4;
|
|
2496
2595
|
const redeclarationIntent = new PayloadBuilder11({ schema: ChainStakeIntentSchema }).fields({
|
|
2497
2596
|
from: address,
|
|
2498
2597
|
intent,
|
|
@@ -2508,26 +2607,26 @@ import {
|
|
|
2508
2607
|
asSchema as asSchema2,
|
|
2509
2608
|
isPayloadOfZodType
|
|
2510
2609
|
} from "@xyo-network/payload-model";
|
|
2511
|
-
import { z as
|
|
2610
|
+
import { z as z18 } from "zod";
|
|
2512
2611
|
|
|
2513
2612
|
// src/eip-712/Types.ts
|
|
2514
|
-
import { z as
|
|
2515
|
-
var TypedDataDomainZod =
|
|
2516
|
-
name:
|
|
2517
|
-
version:
|
|
2518
|
-
chainId:
|
|
2519
|
-
verifyingContract:
|
|
2520
|
-
salt:
|
|
2613
|
+
import { z as z17 } from "zod";
|
|
2614
|
+
var TypedDataDomainZod = z17.object({
|
|
2615
|
+
name: z17.string().nullable().optional(),
|
|
2616
|
+
version: z17.string().nullable().optional(),
|
|
2617
|
+
chainId: z17.union([z17.string(), z17.number(), z17.bigint()]).nullable().optional(),
|
|
2618
|
+
verifyingContract: z17.string().nullable().optional(),
|
|
2619
|
+
salt: z17.union([z17.string(), z17.instanceof(Uint8Array)]).nullable().optional()
|
|
2521
2620
|
});
|
|
2522
|
-
var TypedDataFieldZod =
|
|
2523
|
-
name:
|
|
2524
|
-
type:
|
|
2621
|
+
var TypedDataFieldZod = z17.object({
|
|
2622
|
+
name: z17.string(),
|
|
2623
|
+
type: z17.string()
|
|
2525
2624
|
});
|
|
2526
|
-
var TypedDataTypesZod =
|
|
2527
|
-
var TypedDataValueZod =
|
|
2625
|
+
var TypedDataTypesZod = z17.record(z17.string(), z17.array(TypedDataFieldZod));
|
|
2626
|
+
var TypedDataValueZod = z17.record(z17.string(), z17.any());
|
|
2528
2627
|
|
|
2529
2628
|
// src/eip-712/Payloads/EIP712Data.ts
|
|
2530
|
-
var EIP712DataPayloadFieldsZod =
|
|
2629
|
+
var EIP712DataPayloadFieldsZod = z18.object({
|
|
2531
2630
|
domain: TypedDataDomainZod,
|
|
2532
2631
|
types: TypedDataTypesZod,
|
|
2533
2632
|
values: TypedDataValueZod
|
|
@@ -2545,11 +2644,11 @@ import {
|
|
|
2545
2644
|
asSchema as asSchema3,
|
|
2546
2645
|
isPayloadOfZodType as isPayloadOfZodType2
|
|
2547
2646
|
} from "@xyo-network/payload-model";
|
|
2548
|
-
import { z as
|
|
2549
|
-
var EIP712SignaturePayloadFieldsZod =
|
|
2550
|
-
address:
|
|
2647
|
+
import { z as z19 } from "zod";
|
|
2648
|
+
var EIP712SignaturePayloadFieldsZod = z19.object({
|
|
2649
|
+
address: z19.string(),
|
|
2551
2650
|
hash: HashZod,
|
|
2552
|
-
signature:
|
|
2651
|
+
signature: z19.string()
|
|
2553
2652
|
});
|
|
2554
2653
|
var EIP712SignaturePayloadSchema = asSchema3("network.xyo.chains.ethereum.eip712.signature", true);
|
|
2555
2654
|
var isEIP712SignaturePayload = isPayloadOfZodType2(
|
|
@@ -2559,7 +2658,7 @@ var isEIP712SignaturePayload = isPayloadOfZodType2(
|
|
|
2559
2658
|
var asEIP712SignaturePayload = AsObjectFactory3.create(isEIP712SignaturePayload);
|
|
2560
2659
|
|
|
2561
2660
|
// src/eip-712/sign.ts
|
|
2562
|
-
import { PayloadBuilder as PayloadBuilder12 } from "@xyo-network/
|
|
2661
|
+
import { PayloadBuilder as PayloadBuilder12 } from "@xyo-network/sdk-js";
|
|
2563
2662
|
var signEIP712Message = async (signer, data) => {
|
|
2564
2663
|
const {
|
|
2565
2664
|
domain,
|
|
@@ -2579,7 +2678,7 @@ var signEIP712Message = async (signer, data) => {
|
|
|
2579
2678
|
|
|
2580
2679
|
// src/eip-712/verify.ts
|
|
2581
2680
|
import { asHash as asHash4, isUndefined as isUndefined4 } from "@xylabs/sdk-js";
|
|
2582
|
-
import { PayloadBuilder as PayloadBuilder13 } from "@xyo-network/
|
|
2681
|
+
import { PayloadBuilder as PayloadBuilder13 } from "@xyo-network/sdk-js";
|
|
2583
2682
|
import { verifyTypedData } from "ethers";
|
|
2584
2683
|
var verifyEIP712Message = async (data, sig) => {
|
|
2585
2684
|
const {
|
|
@@ -2660,7 +2759,7 @@ import {
|
|
|
2660
2759
|
asHash as asHash5,
|
|
2661
2760
|
assertEx as assertEx30,
|
|
2662
2761
|
exists as exists3,
|
|
2663
|
-
isDefined as
|
|
2762
|
+
isDefined as isDefined18,
|
|
2664
2763
|
ZERO_ADDRESS
|
|
2665
2764
|
} from "@xylabs/sdk-js";
|
|
2666
2765
|
import {
|
|
@@ -2731,8 +2830,8 @@ var asTransfersStepSummaryWithStorageMeta = AsObjectFactory7.create(isTransfersS
|
|
|
2731
2830
|
// src/summary/primitives/balances/balancesStepSummaryFromRange.ts
|
|
2732
2831
|
import { spanRootAsync as spanRootAsync2 } from "@xylabs/sdk-js";
|
|
2733
2832
|
import { assertEx as assertEx24 } from "@xylabs/sdk-js";
|
|
2734
|
-
import { PayloadBuilder as PayloadBuilder14 } from "@xyo-network/payload-builder";
|
|
2735
2833
|
import { isAnyPayload } from "@xyo-network/payload-model";
|
|
2834
|
+
import { PayloadBuilder as PayloadBuilder14 } from "@xyo-network/sdk-js";
|
|
2736
2835
|
import { asXL1BlockNumber as asXL1BlockNumber6, StepSizes as StepSizes9 } from "@xyo-network/xl1-protocol";
|
|
2737
2836
|
async function balancesStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
|
|
2738
2837
|
const cacheKey = `${range[0]}|${range[1]}`;
|
|
@@ -2835,8 +2934,8 @@ async function balancesSummary(context, semaphores, blockViewer, summaryMap, con
|
|
|
2835
2934
|
// src/summary/primitives/schemas/schemasStepSummaryFromRange.ts
|
|
2836
2935
|
import { assertEx as assertEx26 } from "@xylabs/sdk-js";
|
|
2837
2936
|
import { isBoundWitness } from "@xyo-network/boundwitness-model";
|
|
2838
|
-
import { PayloadBuilder as PayloadBuilder15 } from "@xyo-network/payload-builder";
|
|
2839
2937
|
import { isAnyPayload as isAnyPayload2, isHashMeta } from "@xyo-network/payload-model";
|
|
2938
|
+
import { PayloadBuilder as PayloadBuilder15 } from "@xyo-network/sdk-js";
|
|
2840
2939
|
import { StepSizes as StepSizes10 } from "@xyo-network/xl1-protocol";
|
|
2841
2940
|
async function schemasStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
|
|
2842
2941
|
const [frameHead] = assertEx26(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
|
|
@@ -2930,8 +3029,8 @@ async function schemasSummary(context, semaphores, blockViewer, summaryMap, conf
|
|
|
2930
3029
|
|
|
2931
3030
|
// src/summary/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
2932
3031
|
import { assertEx as assertEx29 } from "@xylabs/sdk-js";
|
|
2933
|
-
import { PayloadBuilder as PayloadBuilder16 } from "@xyo-network/payload-builder";
|
|
2934
3032
|
import { isAnyPayload as isAnyPayload3 } from "@xyo-network/payload-model";
|
|
3033
|
+
import { PayloadBuilder as PayloadBuilder16 } from "@xyo-network/sdk-js";
|
|
2935
3034
|
import { StepSizes as StepSizes11 } from "@xyo-network/xl1-protocol";
|
|
2936
3035
|
|
|
2937
3036
|
// src/summary/primitives/transfers/transfersSummary.ts
|
|
@@ -3089,7 +3188,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
3089
3188
|
block[1].find((p) => p._hash === hash),
|
|
3090
3189
|
() => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`
|
|
3091
3190
|
);
|
|
3092
|
-
}).filter(exists3).filter((t) => t.from === address ||
|
|
3191
|
+
}).filter(exists3).filter((t) => t.from === address || isDefined18(t.transfers[address]));
|
|
3093
3192
|
if (transfers.length === 0) {
|
|
3094
3193
|
continue;
|
|
3095
3194
|
}
|
|
@@ -3208,7 +3307,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
3208
3307
|
return await this.spanAsync("qualifiedAccountBalanceHistory", async () => {
|
|
3209
3308
|
const range = asRange(headOrRange);
|
|
3210
3309
|
const headHash = asHash5(headOrRange);
|
|
3211
|
-
const [head] = assertEx30(
|
|
3310
|
+
const [head] = assertEx30(isDefined18(headHash) ? await this.blockViewer.blockByHash(headHash) : await this.blockViewer.currentBlock(), () => "Could not resolve head block");
|
|
3212
3311
|
const startingRange = asXL1BlockRange10(range ?? [0, head.block], true);
|
|
3213
3312
|
const blockNumbers = await this.distillTransferHistory(address, startingRange);
|
|
3214
3313
|
const blocks = (await Promise.all(blockNumbers.map(async (bn) => await this.blockViewer.blockByNumber(bn)))).filter(exists3);
|
|
@@ -3221,7 +3320,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
3221
3320
|
block[1].find((p) => p._hash === hash),
|
|
3222
3321
|
() => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`
|
|
3223
3322
|
);
|
|
3224
|
-
}).filter(exists3).filter((t) => t.from === address ||
|
|
3323
|
+
}).filter(exists3).filter((t) => t.from === address || isDefined18(t.transfers[address]));
|
|
3225
3324
|
if (transfers.length === 0) {
|
|
3226
3325
|
continue;
|
|
3227
3326
|
}
|
|
@@ -3249,7 +3348,7 @@ SimpleAccountBalanceViewer = __decorateClass([
|
|
|
3249
3348
|
import {
|
|
3250
3349
|
assertEx as assertEx31,
|
|
3251
3350
|
exists as exists4,
|
|
3252
|
-
isDefined as
|
|
3351
|
+
isDefined as isDefined19,
|
|
3253
3352
|
isUndefined as isUndefined5
|
|
3254
3353
|
} from "@xylabs/sdk-js";
|
|
3255
3354
|
import {
|
|
@@ -3285,12 +3384,12 @@ var HydratedCache = class {
|
|
|
3285
3384
|
};
|
|
3286
3385
|
|
|
3287
3386
|
// src/utils/isZodError.ts
|
|
3288
|
-
import { z as
|
|
3387
|
+
import { z as z20 } from "zod";
|
|
3289
3388
|
var isZodError = (error) => {
|
|
3290
|
-
return error instanceof
|
|
3389
|
+
return error instanceof z20.ZodError;
|
|
3291
3390
|
};
|
|
3292
3391
|
var prettifyZodError = (error) => {
|
|
3293
|
-
return
|
|
3392
|
+
return z20.prettifyError(error);
|
|
3294
3393
|
};
|
|
3295
3394
|
|
|
3296
3395
|
// src/simple/block/SimpleBlockViewer.ts
|
|
@@ -3401,7 +3500,7 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
3401
3500
|
return cachedPayload;
|
|
3402
3501
|
} else {
|
|
3403
3502
|
const [result] = await this.finalizedArchivist.get([hash]);
|
|
3404
|
-
if (
|
|
3503
|
+
if (isDefined19(result)) {
|
|
3405
3504
|
await this.payloadCache.set(hash, result);
|
|
3406
3505
|
}
|
|
3407
3506
|
return result ?? null;
|
|
@@ -3465,7 +3564,7 @@ SimpleBlockRewardViewer = __decorateClass([
|
|
|
3465
3564
|
|
|
3466
3565
|
// src/simple/blockValidation/SimpleBlockValidationViewer.ts
|
|
3467
3566
|
import { assertEx as assertEx32 } from "@xylabs/sdk-js";
|
|
3468
|
-
import { PayloadBuilder as PayloadBuilder17 } from "@xyo-network/
|
|
3567
|
+
import { PayloadBuilder as PayloadBuilder17 } from "@xyo-network/sdk-js";
|
|
3469
3568
|
import {
|
|
3470
3569
|
AccountBalanceViewerMoniker as AccountBalanceViewerMoniker2,
|
|
3471
3570
|
asXL1BlockRange as asXL1BlockRange11,
|
|
@@ -3664,8 +3763,8 @@ import {
|
|
|
3664
3763
|
assertEx as assertEx34,
|
|
3665
3764
|
exists as exists6
|
|
3666
3765
|
} from "@xylabs/sdk-js";
|
|
3667
|
-
import { PayloadBuilder as PayloadBuilder18 } from "@xyo-network/payload-builder";
|
|
3668
3766
|
import { isAnyPayload as isAnyPayload5 } from "@xyo-network/payload-model";
|
|
3767
|
+
import { PayloadBuilder as PayloadBuilder18 } from "@xyo-network/sdk-js";
|
|
3669
3768
|
import {
|
|
3670
3769
|
DataLakeRunnerMoniker
|
|
3671
3770
|
} from "@xyo-network/xl1-protocol";
|
|
@@ -3985,6 +4084,10 @@ SimpleFinalizationViewer = __decorateClass([
|
|
|
3985
4084
|
], SimpleFinalizationViewer);
|
|
3986
4085
|
|
|
3987
4086
|
// src/simple/gateway/SimpleXyoGateway.ts
|
|
4087
|
+
import {
|
|
4088
|
+
isAnyPayload as isAnyPayload7,
|
|
4089
|
+
isHashMeta as isHashMeta2
|
|
4090
|
+
} from "@xyo-network/payload-model";
|
|
3988
4091
|
import {
|
|
3989
4092
|
XyoConnectionMoniker,
|
|
3990
4093
|
XyoGatewayMoniker,
|
|
@@ -4003,6 +4106,24 @@ var SimpleXyoGateway = class _SimpleXyoGateway extends AbstractCreatableProvider
|
|
|
4003
4106
|
get dataLakes() {
|
|
4004
4107
|
return this._dataLakes;
|
|
4005
4108
|
}
|
|
4109
|
+
async blockByHash(hash) {
|
|
4110
|
+
const [block, payloads] = await this.connection.viewer?.block.blockByHash(hash) ?? [null, []];
|
|
4111
|
+
if (block !== null) {
|
|
4112
|
+
const missingHashes = block.payload_hashes.filter((h) => !payloads.some((p) => p._hash === h));
|
|
4113
|
+
const foundPayloads = {};
|
|
4114
|
+
const dataLakes = this.dataLakes ? this.dataLakes.dataLakes : [];
|
|
4115
|
+
for (const dataLake of dataLakes) {
|
|
4116
|
+
const found = (await dataLake.getMany(missingHashes)).filter((p) => isAnyPayload7(p) && isHashMeta2(p) && missingHashes.includes(p._hash));
|
|
4117
|
+
for (const payload of found) {
|
|
4118
|
+
foundPayloads[payload._hash] = payload;
|
|
4119
|
+
}
|
|
4120
|
+
}
|
|
4121
|
+
for (const [, payload] of Object.entries(foundPayloads)) {
|
|
4122
|
+
payloads.push(payload);
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
return block ? [block, payloads] : null;
|
|
4126
|
+
}
|
|
4006
4127
|
async createHandler() {
|
|
4007
4128
|
await super.createHandler();
|
|
4008
4129
|
this._connection = await this.locator.getInstance(XyoConnectionMoniker);
|
|
@@ -4013,9 +4134,13 @@ var SimpleXyoGateway = class _SimpleXyoGateway extends AbstractCreatableProvider
|
|
|
4013
4134
|
import {
|
|
4014
4135
|
assertEx as assertEx36,
|
|
4015
4136
|
BigIntToJsonZod,
|
|
4016
|
-
isDefined as
|
|
4137
|
+
isDefined as isDefined20
|
|
4017
4138
|
} from "@xylabs/sdk-js";
|
|
4018
|
-
import {
|
|
4139
|
+
import {
|
|
4140
|
+
isAnyPayload as isAnyPayload8,
|
|
4141
|
+
isHashMeta as isHashMeta3
|
|
4142
|
+
} from "@xyo-network/payload-model";
|
|
4143
|
+
import { PayloadBuilder as PayloadBuilder19 } from "@xyo-network/sdk-js";
|
|
4019
4144
|
import {
|
|
4020
4145
|
asXL1BlockNumber as asXL1BlockNumber9,
|
|
4021
4146
|
isSignedHydratedTransaction,
|
|
@@ -4050,9 +4175,9 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
4050
4175
|
chain,
|
|
4051
4176
|
fees
|
|
4052
4177
|
} = options ?? {};
|
|
4053
|
-
const resolvedChainId =
|
|
4054
|
-
const resolvedNbf = asXL1BlockNumber9(
|
|
4055
|
-
const resolvedExp = asXL1BlockNumber9(
|
|
4178
|
+
const resolvedChainId = isDefined20(chain) ? chain : await viewer.chainId();
|
|
4179
|
+
const resolvedNbf = asXL1BlockNumber9(isDefined20(nbf) ? nbf : await viewer.currentBlockNumber(), true);
|
|
4180
|
+
const resolvedExp = asXL1BlockNumber9(isDefined20(exp) ? exp : resolvedNbf + 10, true);
|
|
4056
4181
|
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await this.signer.address(), fees);
|
|
4057
4182
|
return await this.addTransactionToChain(tx, await PayloadBuilder19.addHashMeta(offChain));
|
|
4058
4183
|
}
|
|
@@ -4072,6 +4197,24 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
|
|
|
4072
4197
|
await this.addPayloadsToDataLakes([...signedTx[1], ...offChain ?? [], signedTx[0]]);
|
|
4073
4198
|
return [await runner.broadcastTransaction([signedTx[0], signedTx[1]]), signedTx];
|
|
4074
4199
|
}
|
|
4200
|
+
async blockByHash(hash) {
|
|
4201
|
+
const [block, payloads] = await this.connection.viewer?.block.blockByHash(hash) ?? [null, []];
|
|
4202
|
+
if (block !== null) {
|
|
4203
|
+
const missingHashes = block.payload_hashes.filter((h) => !payloads.some((p) => p._hash === h));
|
|
4204
|
+
const foundPayloads = {};
|
|
4205
|
+
const dataLakes = this.dataLakes ? this.dataLakes.dataLakes : [];
|
|
4206
|
+
for (const dataLake of dataLakes) {
|
|
4207
|
+
const found = (await dataLake.getMany(missingHashes)).filter((p) => isAnyPayload8(p) && isHashMeta3(p) && missingHashes.includes(p._hash));
|
|
4208
|
+
for (const payload of found) {
|
|
4209
|
+
foundPayloads[payload._hash] = payload;
|
|
4210
|
+
}
|
|
4211
|
+
}
|
|
4212
|
+
for (const [, payload] of Object.entries(foundPayloads)) {
|
|
4213
|
+
payloads.push(payload);
|
|
4214
|
+
}
|
|
4215
|
+
}
|
|
4216
|
+
return block ? [block, payloads] : null;
|
|
4217
|
+
}
|
|
4075
4218
|
async confirmSubmittedTransaction(txHash, options) {
|
|
4076
4219
|
return await confirmSubmittedTransaction(
|
|
4077
4220
|
assertEx36(this.connection.viewer, () => "Connection viewer is undefined"),
|
|
@@ -4118,10 +4261,10 @@ import {
|
|
|
4118
4261
|
assertEx as assertEx37,
|
|
4119
4262
|
exists as exists7
|
|
4120
4263
|
} from "@xylabs/sdk-js";
|
|
4121
|
-
import { PayloadBuilder as PayloadBuilder20 } from "@xyo-network/payload-builder";
|
|
4122
4264
|
import {
|
|
4123
4265
|
isPayloadBundle
|
|
4124
4266
|
} from "@xyo-network/payload-model";
|
|
4267
|
+
import { PayloadBuilder as PayloadBuilder20 } from "@xyo-network/sdk-js";
|
|
4125
4268
|
import {
|
|
4126
4269
|
BlockValidationViewerMoniker as BlockValidationViewerMoniker2,
|
|
4127
4270
|
ChainContractViewerMoniker as ChainContractViewerMoniker5,
|
|
@@ -4277,11 +4420,11 @@ SimpleMempoolRunner = __decorateClass([
|
|
|
4277
4420
|
// src/simple/mempool/SimpleMempoolViewer.ts
|
|
4278
4421
|
import {
|
|
4279
4422
|
exists as exists8,
|
|
4280
|
-
isDefined as
|
|
4423
|
+
isDefined as isDefined21,
|
|
4281
4424
|
isHash
|
|
4282
4425
|
} from "@xylabs/sdk-js";
|
|
4283
4426
|
import {
|
|
4284
|
-
isHashMeta as
|
|
4427
|
+
isHashMeta as isHashMeta4,
|
|
4285
4428
|
isPayloadBundle as isPayloadBundle2
|
|
4286
4429
|
} from "@xyo-network/payload-model";
|
|
4287
4430
|
import {
|
|
@@ -4308,7 +4451,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
4308
4451
|
let cursor = void 0;
|
|
4309
4452
|
if (isHash(providedCursor)) {
|
|
4310
4453
|
const [p] = await this.pendingBlocksArchivist.get([providedCursor]);
|
|
4311
|
-
if (
|
|
4454
|
+
if (isDefined21(p)) {
|
|
4312
4455
|
cursor = p._sequence;
|
|
4313
4456
|
}
|
|
4314
4457
|
}
|
|
@@ -4317,14 +4460,14 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
4317
4460
|
limit: 100,
|
|
4318
4461
|
cursor
|
|
4319
4462
|
});
|
|
4320
|
-
const filteredBundles = bundles.filter(isPayloadBundle2).filter(
|
|
4463
|
+
const filteredBundles = bundles.filter(isPayloadBundle2).filter(isHashMeta4);
|
|
4321
4464
|
return (await Promise.all(filteredBundles.map(async (bundle3) => await bundledPayloadToHydratedBlock(bundle3)))).filter(exists8);
|
|
4322
4465
|
}
|
|
4323
4466
|
async pendingTransactions({ cursor: providedCursor, limit = 100 } = {}) {
|
|
4324
4467
|
let cursor = void 0;
|
|
4325
4468
|
if (isHash(providedCursor)) {
|
|
4326
4469
|
const [p] = await this.pendingTransactionsArchivist.get([providedCursor]);
|
|
4327
|
-
if (
|
|
4470
|
+
if (isDefined21(p)) {
|
|
4328
4471
|
cursor = p._sequence;
|
|
4329
4472
|
}
|
|
4330
4473
|
}
|
|
@@ -4335,11 +4478,11 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
|
|
|
4335
4478
|
cursor
|
|
4336
4479
|
});
|
|
4337
4480
|
this.logger?.info(`Fetched pending transactions: ${bundles.length} bundles`);
|
|
4338
|
-
const filteredBundles = bundles.filter(isPayloadBundle2).filter(
|
|
4481
|
+
const filteredBundles = bundles.filter(isPayloadBundle2).filter(isHashMeta4);
|
|
4339
4482
|
const hydratedWithBundle = (await Promise.all(
|
|
4340
4483
|
filteredBundles.map(async (bundle3) => {
|
|
4341
4484
|
const tx = await bundledPayloadToHydratedTransaction(bundle3);
|
|
4342
|
-
return
|
|
4485
|
+
return isDefined21(tx) ? { bundle: bundle3, tx } : void 0;
|
|
4343
4486
|
})
|
|
4344
4487
|
)).filter(exists8);
|
|
4345
4488
|
const currentBlock = await this.windowedBlockViewer.currentBlock();
|
|
@@ -4561,7 +4704,7 @@ var MemoryPermissionsStore = class {
|
|
|
4561
4704
|
};
|
|
4562
4705
|
|
|
4563
4706
|
// src/simple/runner/SimpleXyoRunner.ts
|
|
4564
|
-
import { PayloadBuilder as PayloadBuilder21 } from "@xyo-network/
|
|
4707
|
+
import { PayloadBuilder as PayloadBuilder21 } from "@xyo-network/sdk-js";
|
|
4565
4708
|
import {
|
|
4566
4709
|
MempoolRunnerMoniker as MempoolRunnerMoniker2,
|
|
4567
4710
|
XyoRunnerMoniker
|
|
@@ -4591,8 +4734,7 @@ SimpleXyoRunner = __decorateClass([
|
|
|
4591
4734
|
], SimpleXyoRunner);
|
|
4592
4735
|
|
|
4593
4736
|
// src/simple/signer/SimpleXyoSigner.ts
|
|
4594
|
-
import { Account as Account2 } from "@xyo-network/
|
|
4595
|
-
import { PayloadBuilder as PayloadBuilder22 } from "@xyo-network/payload-builder";
|
|
4737
|
+
import { Account as Account2, PayloadBuilder as PayloadBuilder22 } from "@xyo-network/sdk-js";
|
|
4596
4738
|
import {
|
|
4597
4739
|
SignedHydratedTransactionWithHashMetaZod,
|
|
4598
4740
|
XyoSignerMoniker as XyoSignerMoniker3
|
|
@@ -4640,7 +4782,7 @@ var SimpleXyoSigner = class _SimpleXyoSigner extends AbstractCreatableProvider {
|
|
|
4640
4782
|
};
|
|
4641
4783
|
|
|
4642
4784
|
// src/simple/StakeEventsViewer/SimpleStakeEventsViewer.ts
|
|
4643
|
-
import { isDefined as
|
|
4785
|
+
import { isDefined as isDefined22 } from "@xylabs/sdk-js";
|
|
4644
4786
|
import {
|
|
4645
4787
|
StakeEventsViewerMoniker
|
|
4646
4788
|
} from "@xyo-network/xl1-protocol";
|
|
@@ -4655,7 +4797,7 @@ var SimpleStakeEventsViewer = class extends AbstractCreatableProvider {
|
|
|
4655
4797
|
stakeEvents(range, { name } = {}) {
|
|
4656
4798
|
const positions = this.positionsFromRange(range);
|
|
4657
4799
|
const events = this.eventsFromPositions(positions);
|
|
4658
|
-
if (
|
|
4800
|
+
if (isDefined22(name)) {
|
|
4659
4801
|
return events.filter((event) => event.name === name);
|
|
4660
4802
|
}
|
|
4661
4803
|
return events;
|
|
@@ -4957,7 +5099,7 @@ SimpleStakeViewer = __decorateClass([
|
|
|
4957
5099
|
import {
|
|
4958
5100
|
asHash as asHash6,
|
|
4959
5101
|
assertEx as assertEx42,
|
|
4960
|
-
isDefined as
|
|
5102
|
+
isDefined as isDefined23
|
|
4961
5103
|
} from "@xylabs/sdk-js";
|
|
4962
5104
|
import {
|
|
4963
5105
|
asTimePayload as asTimePayload2,
|
|
@@ -4981,7 +5123,7 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
4981
5123
|
const [block, payloads] = assertEx42(await this.blockViewer.blockByNumber(asXL1BlockNumber10(from, true)), () => "Block not found");
|
|
4982
5124
|
const timeSchemaIndex = block.payload_schemas.indexOf(TimeSchema);
|
|
4983
5125
|
const hash = timeSchemaIndex === -1 ? void 0 : block.payload_hashes[timeSchemaIndex];
|
|
4984
|
-
const timePayload = asTimePayload2(
|
|
5126
|
+
const timePayload = asTimePayload2(isDefined23(hash) ? payloads.find((p) => p._hash === hash) : void 0);
|
|
4985
5127
|
if (timePayload === void 0) return 0;
|
|
4986
5128
|
switch (toDomain) {
|
|
4987
5129
|
case "xl1": {
|
|
@@ -5054,7 +5196,7 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
5054
5196
|
xl1Hash: assertEx42(xl1Hash, () => "No xl1 hash available from time sync service"),
|
|
5055
5197
|
epoch: Date.now()
|
|
5056
5198
|
};
|
|
5057
|
-
if (
|
|
5199
|
+
if (isDefined23(this.ethProvider)) {
|
|
5058
5200
|
const [ethereum, ethHashOrNull] = await this.currentTimeAndHash("ethereum");
|
|
5059
5201
|
const ethereumHash = asHash6(ethHashOrNull, () => "No ethereum hash available from time sync service");
|
|
5060
5202
|
timePayload.ethereum = ethereum;
|
|
@@ -5074,7 +5216,7 @@ SimpleTimeSyncViewer = __decorateClass([
|
|
|
5074
5216
|
import {
|
|
5075
5217
|
assertEx as assertEx43,
|
|
5076
5218
|
exists as exists9,
|
|
5077
|
-
isNull as
|
|
5219
|
+
isNull as isNull3
|
|
5078
5220
|
} from "@xylabs/sdk-js";
|
|
5079
5221
|
import {
|
|
5080
5222
|
asXL1BlockNumber as asXL1BlockNumber11,
|
|
@@ -5214,10 +5356,10 @@ var SimpleWindowedBlockViewer = class extends AbstractCreatableProvider {
|
|
|
5214
5356
|
let cursor = await this._blockViewer.currentBlock();
|
|
5215
5357
|
const previousHead = this._chain.length > 0 ? await this.currentBlockHash() : null;
|
|
5216
5358
|
const newBlocks = [];
|
|
5217
|
-
while (!
|
|
5359
|
+
while (!isNull3(cursor) && cursor[0]._hash !== previousHead && newBlocks.length < this.maxWindowSize) {
|
|
5218
5360
|
newBlocks.unshift(cursor);
|
|
5219
5361
|
const previousHash = newBlocks[0][0].previous;
|
|
5220
|
-
cursor =
|
|
5362
|
+
cursor = isNull3(previousHash) ? null : await this._blockViewer.blockByHash(previousHash);
|
|
5221
5363
|
}
|
|
5222
5364
|
for (const block of newBlocks) {
|
|
5223
5365
|
this.addBlock(block);
|
|
@@ -5326,27 +5468,6 @@ async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
|
5326
5468
|
return assertEx44(timePayload.ethereum, () => "No ethereum timestamp found on block");
|
|
5327
5469
|
}
|
|
5328
5470
|
|
|
5329
|
-
// src/validation/lib/isLocalhost.ts
|
|
5330
|
-
var isLocalhost = (hostname) => {
|
|
5331
|
-
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost");
|
|
5332
|
-
};
|
|
5333
|
-
|
|
5334
|
-
// src/validation/lib/getUrl.ts
|
|
5335
|
-
var getUrl = (host, port) => {
|
|
5336
|
-
const scheme = isLocalhost(host) ? "http" : "https";
|
|
5337
|
-
return `${scheme}://${host}:${port}`;
|
|
5338
|
-
};
|
|
5339
|
-
|
|
5340
|
-
// src/validation/schema/Address.ts
|
|
5341
|
-
var TODO = true;
|
|
5342
|
-
|
|
5343
|
-
// src/validation/schema/Mnemonic.ts
|
|
5344
|
-
import { z as z18 } from "zod";
|
|
5345
|
-
var MnemonicStringZod = z18.string().transform((s) => s.trim().replaceAll(/\s+/g, " ")).refine(
|
|
5346
|
-
(s) => [12, 15, 18, 21, 24].includes(s.split(" ").length),
|
|
5347
|
-
{ message: "Mnemonic must contain 12, 15, 18, 21, or 24 words." }
|
|
5348
|
-
).describe("BIP-39 mnemonic string");
|
|
5349
|
-
|
|
5350
5471
|
// src/wallet/generateXyoBaseWalletFromPhrase.ts
|
|
5351
5472
|
import { HDWallet } from "@xyo-network/wallet";
|
|
5352
5473
|
|
|
@@ -5368,6 +5489,8 @@ export {
|
|
|
5368
5489
|
ADDRESS_INDEX,
|
|
5369
5490
|
AbstractCreatableProvider,
|
|
5370
5491
|
Actor,
|
|
5492
|
+
ActorConfigContext,
|
|
5493
|
+
ActorConfigZod,
|
|
5371
5494
|
ActorParamsV3Zod,
|
|
5372
5495
|
ActorV3,
|
|
5373
5496
|
ActorsConfigZod,
|
|
@@ -5389,6 +5512,8 @@ export {
|
|
|
5389
5512
|
EIP712SignaturePayloadFieldsZod,
|
|
5390
5513
|
EIP712SignaturePayloadSchema,
|
|
5391
5514
|
GlobalMetaSchema,
|
|
5515
|
+
HostActorConfigContext,
|
|
5516
|
+
HostActorConfigZod,
|
|
5392
5517
|
HydratedCache,
|
|
5393
5518
|
JSONSchemaMetaSchema,
|
|
5394
5519
|
LoggerStatusReporter,
|
|
@@ -5448,6 +5573,8 @@ export {
|
|
|
5448
5573
|
allHashesPresent,
|
|
5449
5574
|
allStakersForRange,
|
|
5450
5575
|
allStakersForStep,
|
|
5576
|
+
asActorConfig,
|
|
5577
|
+
asActorConfigContext,
|
|
5451
5578
|
asAddressPairPayload,
|
|
5452
5579
|
asBalancesStepSummary,
|
|
5453
5580
|
asBalancesStepSummaryWithStorageMeta,
|
|
@@ -5457,6 +5584,8 @@ export {
|
|
|
5457
5584
|
asCreatableProviderContext,
|
|
5458
5585
|
asEIP712DataPayload,
|
|
5459
5586
|
asEIP712SignaturePayload,
|
|
5587
|
+
asHostActorConfig,
|
|
5588
|
+
asHostActorConfigContext,
|
|
5460
5589
|
asOptionalAddressPairPayload,
|
|
5461
5590
|
asSchemasStepSummary,
|
|
5462
5591
|
asSchemasStepSummaryWithStorageMeta,
|
|
@@ -5503,9 +5632,9 @@ export {
|
|
|
5503
5632
|
flattenHydratedTransactions,
|
|
5504
5633
|
generateXyoBaseWalletFromPhrase,
|
|
5505
5634
|
getBlockRateBlocks,
|
|
5506
|
-
getDefaultConfig,
|
|
5507
5635
|
getEmptyContext,
|
|
5508
5636
|
getEmptyProviderContext,
|
|
5637
|
+
getFileConfig,
|
|
5509
5638
|
getTimeConfigInMilliseconds,
|
|
5510
5639
|
getUrl,
|
|
5511
5640
|
getWindowedChain,
|
|
@@ -5518,6 +5647,8 @@ export {
|
|
|
5518
5647
|
hydratedBlockByNumber,
|
|
5519
5648
|
hydratedBlockToPayloadBundle,
|
|
5520
5649
|
hydratedTransactionToPayloadBundle,
|
|
5650
|
+
isActorConfig,
|
|
5651
|
+
isActorConfigContext,
|
|
5521
5652
|
isAddressPairPayload,
|
|
5522
5653
|
isBalancesStepSummary,
|
|
5523
5654
|
isBalancesStepSummaryWithStorageMeta,
|
|
@@ -5527,6 +5658,8 @@ export {
|
|
|
5527
5658
|
isCreatableProviderContext,
|
|
5528
5659
|
isEIP712DataPayload,
|
|
5529
5660
|
isEIP712SignaturePayload,
|
|
5661
|
+
isHostActorConfig,
|
|
5662
|
+
isHostActorConfigContext,
|
|
5530
5663
|
isLocalhost,
|
|
5531
5664
|
isNegativeBigInt,
|
|
5532
5665
|
isPositiveBigInt,
|
|
@@ -5573,8 +5706,12 @@ export {
|
|
|
5573
5706
|
stepsRewardTotalRange,
|
|
5574
5707
|
timeBudget,
|
|
5575
5708
|
timeDurations,
|
|
5709
|
+
toActorConfig,
|
|
5710
|
+
toActorConfigContext,
|
|
5576
5711
|
toBaseConfigContext,
|
|
5577
5712
|
toCreatableProviderContext,
|
|
5713
|
+
toHostActorConfig,
|
|
5714
|
+
toHostActorConfigContext,
|
|
5578
5715
|
toPositiveBigInt,
|
|
5579
5716
|
toSignedBigInt,
|
|
5580
5717
|
toStepIdentityString,
|