@xyo-network/xl1-protocol-sdk 1.18.13 → 1.18.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/neutral/index.mjs
CHANGED
|
@@ -4731,9 +4731,6 @@ var MemoryPermissionsStore = class {
|
|
|
4731
4731
|
};
|
|
4732
4732
|
|
|
4733
4733
|
// src/simple/runner/SimpleXyoRunner.ts
|
|
4734
|
-
import {
|
|
4735
|
-
assertEx as assertEx36
|
|
4736
|
-
} from "@xylabs/sdk-js";
|
|
4737
4734
|
import { PayloadBuilder as PayloadBuilder19 } from "@xyo-network/payload-builder";
|
|
4738
4735
|
var SimpleXyoRunner = class extends AbstractCreatableProvider {
|
|
4739
4736
|
moniker = SimpleXyoRunner.defaultMoniker;
|
|
@@ -4741,19 +4738,7 @@ var SimpleXyoRunner = class extends AbstractCreatableProvider {
|
|
|
4741
4738
|
get mempool() {
|
|
4742
4739
|
return this._mempoolRunner;
|
|
4743
4740
|
}
|
|
4744
|
-
static async paramsHandler(params) {
|
|
4745
|
-
return {
|
|
4746
|
-
...await super.paramsHandler(params),
|
|
4747
|
-
pendingTransactionsArchivist: assertEx36(
|
|
4748
|
-
params?.pendingTransactionsArchivist,
|
|
4749
|
-
() => "A pendingTransactionsArchivist is required to create a SimpleXyoRunner"
|
|
4750
|
-
)
|
|
4751
|
-
};
|
|
4752
|
-
}
|
|
4753
4741
|
async broadcastTransaction(transaction) {
|
|
4754
|
-
const archivist = this.params.pendingTransactionsArchivist;
|
|
4755
|
-
const bundle3 = hydratedTransactionToPayloadBundle(transaction);
|
|
4756
|
-
await archivist.insert([bundle3]);
|
|
4757
4742
|
await this.mempool.submitTransactions([transaction]);
|
|
4758
4743
|
const hash = await PayloadBuilder19.hash(transaction[0]);
|
|
4759
4744
|
this.logger?.info(`Broadcasted transaction with hash ${hash}`);
|
|
@@ -4897,7 +4882,7 @@ SimpleStakeEventsViewer = __decorateClass([
|
|
|
4897
4882
|
// src/simple/timesync/SimpleTimeSyncViewer.ts
|
|
4898
4883
|
import {
|
|
4899
4884
|
asHash as asHash6,
|
|
4900
|
-
assertEx as
|
|
4885
|
+
assertEx as assertEx36,
|
|
4901
4886
|
isDefined as isDefined22
|
|
4902
4887
|
} from "@xylabs/sdk-js";
|
|
4903
4888
|
import {
|
|
@@ -4917,7 +4902,7 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
4917
4902
|
async convertTime(fromDomain, toDomain, from) {
|
|
4918
4903
|
switch (fromDomain) {
|
|
4919
4904
|
case "xl1": {
|
|
4920
|
-
const [block, payloads] =
|
|
4905
|
+
const [block, payloads] = assertEx36(await this.blockViewer.blockByNumber(asXL1BlockNumber9(from, true)), () => "Block not found");
|
|
4921
4906
|
const timeSchemaIndex = block.payload_schemas.indexOf(TimeSchema);
|
|
4922
4907
|
const hash = timeSchemaIndex === -1 ? void 0 : block.payload_hashes[timeSchemaIndex];
|
|
4923
4908
|
const timePayload = asTimePayload2(isDefined22(hash) ? payloads.find((p) => p._hash === hash) : void 0);
|
|
@@ -4972,10 +4957,10 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
4972
4957
|
return [Date.now(), null];
|
|
4973
4958
|
}
|
|
4974
4959
|
case "ethereum": {
|
|
4975
|
-
const provider =
|
|
4960
|
+
const provider = assertEx36(this.ethProvider, () => "Ethereum provider not configured");
|
|
4976
4961
|
const blockNumber = await provider.getBlockNumber() ?? 0;
|
|
4977
4962
|
const block = await provider.getBlock(blockNumber);
|
|
4978
|
-
const blockHash = asHash6(
|
|
4963
|
+
const blockHash = asHash6(assertEx36(block?.hash, () => "Block hash not found"), true);
|
|
4979
4964
|
return [blockNumber, blockHash];
|
|
4980
4965
|
}
|
|
4981
4966
|
default: {
|
|
@@ -4990,7 +4975,7 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
|
|
|
4990
4975
|
// this is for the previous block
|
|
4991
4976
|
xl1,
|
|
4992
4977
|
// this is for the previous block
|
|
4993
|
-
xl1Hash:
|
|
4978
|
+
xl1Hash: assertEx36(xl1Hash, () => "No xl1 hash available from time sync service"),
|
|
4994
4979
|
epoch: Date.now()
|
|
4995
4980
|
};
|
|
4996
4981
|
if (isDefined22(this.ethProvider)) {
|
|
@@ -5011,7 +4996,7 @@ SimpleTimeSyncViewer = __decorateClass([
|
|
|
5011
4996
|
|
|
5012
4997
|
// src/simple/windowedBlock/SimpleWindowedBlockViewer.ts
|
|
5013
4998
|
import {
|
|
5014
|
-
assertEx as
|
|
4999
|
+
assertEx as assertEx37,
|
|
5015
5000
|
exists as exists7,
|
|
5016
5001
|
isNull as isNull2
|
|
5017
5002
|
} from "@xylabs/sdk-js";
|
|
@@ -5078,7 +5063,7 @@ var SimpleWindowedBlockViewer = class extends AbstractCreatableProvider {
|
|
|
5078
5063
|
}
|
|
5079
5064
|
async createHandler() {
|
|
5080
5065
|
await super.createHandler();
|
|
5081
|
-
this._blockViewer =
|
|
5066
|
+
this._blockViewer = assertEx37(
|
|
5082
5067
|
this.params.blockViewer ?? await this.locator.getInstance(BlockViewerMoniker),
|
|
5083
5068
|
() => "BlockViewer instance is required"
|
|
5084
5069
|
);
|
|
@@ -5087,13 +5072,13 @@ var SimpleWindowedBlockViewer = class extends AbstractCreatableProvider {
|
|
|
5087
5072
|
this._transactionHashMap = new MemoryMap();
|
|
5088
5073
|
}
|
|
5089
5074
|
currentBlock() {
|
|
5090
|
-
return
|
|
5075
|
+
return assertEx37(this._chain.at(-1));
|
|
5091
5076
|
}
|
|
5092
5077
|
currentBlockHash() {
|
|
5093
|
-
return
|
|
5078
|
+
return assertEx37(this._chain.at(-1)?.[0]._hash);
|
|
5094
5079
|
}
|
|
5095
5080
|
currentBlockNumber() {
|
|
5096
|
-
return
|
|
5081
|
+
return assertEx37(this._chain.at(-1)?.[0].block);
|
|
5097
5082
|
}
|
|
5098
5083
|
async payloadByHash(hash) {
|
|
5099
5084
|
const payloads = await this.payloadsByHash([hash]);
|
|
@@ -5252,13 +5237,13 @@ var RuntimeStatusMonitor = class extends LoggerStatusReporter {
|
|
|
5252
5237
|
};
|
|
5253
5238
|
|
|
5254
5239
|
// src/time/primitives/xl1BlockNumberToEthBlockNumber.ts
|
|
5255
|
-
import { assertEx as
|
|
5240
|
+
import { assertEx as assertEx38 } from "@xylabs/sdk-js";
|
|
5256
5241
|
import { asTimePayload as asTimePayload3, TimeSchema as TimeSchema2 } from "@xyo-network/xl1-protocol";
|
|
5257
5242
|
async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
5258
5243
|
const blockHash = await hashFromBlockNumber(context, xl1BlockNumber);
|
|
5259
5244
|
const hydratedBlock = await hydrateBlock(context.store, blockHash);
|
|
5260
5245
|
const timePayload = asTimePayload3(hydratedBlock[1].find((p) => p.schema === TimeSchema2), { required: true });
|
|
5261
|
-
return
|
|
5246
|
+
return assertEx38(timePayload.ethereum, () => "No ethereum timestamp found on block");
|
|
5262
5247
|
}
|
|
5263
5248
|
|
|
5264
5249
|
// src/wallet/generateXyoBaseWalletFromPhrase.ts
|