@xyo-network/xl1-cli 1.16.23 → 1.16.25
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/cli-min.mjs +1180 -942
- package/package.json +15 -15
package/dist/cli-min.mjs
CHANGED
|
@@ -33858,6 +33858,21 @@ var hexFrom = (value, config) => {
|
|
|
33858
33858
|
}
|
|
33859
33859
|
}
|
|
33860
33860
|
};
|
|
33861
|
+
|
|
33862
|
+
// src/hex/as.ts
|
|
33863
|
+
function asHex(value, assert) {
|
|
33864
|
+
let stringValue = void 0;
|
|
33865
|
+
switch (typeof value) {
|
|
33866
|
+
case "string": {
|
|
33867
|
+
stringValue = hexFromHexString(value);
|
|
33868
|
+
break;
|
|
33869
|
+
}
|
|
33870
|
+
default: {
|
|
33871
|
+
return assertError(value, assert, `Unsupported type [${typeof value}]`);
|
|
33872
|
+
}
|
|
33873
|
+
}
|
|
33874
|
+
return isHex(stringValue) ? stringValue : assertError(value, assert, `Value is not Hex [${value}]`);
|
|
33875
|
+
}
|
|
33861
33876
|
var UntypedHexZod = z.string().regex(HexRegEx, { message: "Invalid hex format" });
|
|
33862
33877
|
var HexZod = UntypedHexZod.transform((val) => val);
|
|
33863
33878
|
|
|
@@ -39263,7 +39278,7 @@ function defineProperties(target, values, types) {
|
|
|
39263
39278
|
*
|
|
39264
39279
|
* @_section: api/utils/errors:Errors [about-errors]
|
|
39265
39280
|
*/
|
|
39266
|
-
function stringify$
|
|
39281
|
+
function stringify$2(value, seen) {
|
|
39267
39282
|
if (value == null) {
|
|
39268
39283
|
return "null";
|
|
39269
39284
|
}
|
|
@@ -39277,7 +39292,7 @@ function stringify$1(value, seen) {
|
|
|
39277
39292
|
seen.add(value);
|
|
39278
39293
|
}
|
|
39279
39294
|
if (Array.isArray(value)) {
|
|
39280
|
-
return "[ " + (value.map((v) => stringify$
|
|
39295
|
+
return "[ " + (value.map((v) => stringify$2(v, seen))).join(", ") + " ]";
|
|
39281
39296
|
}
|
|
39282
39297
|
if (value instanceof Uint8Array) {
|
|
39283
39298
|
const HEX = "0123456789abcdef";
|
|
@@ -39289,7 +39304,7 @@ function stringify$1(value, seen) {
|
|
|
39289
39304
|
return result;
|
|
39290
39305
|
}
|
|
39291
39306
|
if (typeof (value) === "object" && typeof (value.toJSON) === "function") {
|
|
39292
|
-
return stringify$
|
|
39307
|
+
return stringify$2(value.toJSON(), seen);
|
|
39293
39308
|
}
|
|
39294
39309
|
switch (typeof (value)) {
|
|
39295
39310
|
case "boolean":
|
|
@@ -39303,7 +39318,7 @@ function stringify$1(value, seen) {
|
|
|
39303
39318
|
case "object": {
|
|
39304
39319
|
const keys = Object.keys(value);
|
|
39305
39320
|
keys.sort();
|
|
39306
|
-
return "{ " + keys.map((k) => `${stringify$
|
|
39321
|
+
return "{ " + keys.map((k) => `${stringify$2(k, seen)}: ${stringify$2(value[k], seen)}`).join(", ") + " }";
|
|
39307
39322
|
}
|
|
39308
39323
|
}
|
|
39309
39324
|
return `[ COULD NOT SERIALIZE ]`;
|
|
@@ -39352,7 +39367,7 @@ function makeError(message, code, info) {
|
|
|
39352
39367
|
const details = [];
|
|
39353
39368
|
if (info) {
|
|
39354
39369
|
if ("message" in info || "code" in info || "name" in info) {
|
|
39355
|
-
throw new Error(`value will overwrite populated values: ${stringify$
|
|
39370
|
+
throw new Error(`value will overwrite populated values: ${stringify$2(info)}`);
|
|
39356
39371
|
}
|
|
39357
39372
|
for (const key in info) {
|
|
39358
39373
|
if (key === "shortMessage") {
|
|
@@ -39360,7 +39375,7 @@ function makeError(message, code, info) {
|
|
|
39360
39375
|
}
|
|
39361
39376
|
const value = (info[key]);
|
|
39362
39377
|
// try {
|
|
39363
|
-
details.push(key + "=" + stringify$
|
|
39378
|
+
details.push(key + "=" + stringify$2(value));
|
|
39364
39379
|
// } catch (error: any) {
|
|
39365
39380
|
// console.log("MMM", error.message);
|
|
39366
39381
|
// details.push(key + "=[could not serialize object]");
|
|
@@ -71109,9 +71124,6 @@ var asAnyPayload = AsObjectFactory.create(isAnyPayload);
|
|
|
71109
71124
|
function isPayloadOfSchemaType(schema) {
|
|
71110
71125
|
return (x) => isAnyPayload(x) && x?.schema === schema;
|
|
71111
71126
|
}
|
|
71112
|
-
var notPayloadOfSchemaType = (schema) => {
|
|
71113
|
-
return (x) => !isAnyPayload(x) || x?.schema !== schema;
|
|
71114
|
-
};
|
|
71115
71127
|
|
|
71116
71128
|
// src/Error.ts
|
|
71117
71129
|
var ModuleErrorSchema = "network.xyo.error.module";
|
|
@@ -71123,25 +71135,12 @@ function isPayloadOfZodType(zodSchema, schema) {
|
|
|
71123
71135
|
return zodSchema.safeParse(data).success;
|
|
71124
71136
|
};
|
|
71125
71137
|
}
|
|
71126
|
-
var PayloadBundleSchema = "network.xyo.payload.bundle";
|
|
71127
71138
|
var SchemaRegEx = /^(?:[a-z0-9]+\.)*[a-z0-9]+$/;
|
|
71128
|
-
var
|
|
71129
|
-
var SchemaZodV2 = z.string().regex(SchemaRegEx).transform((x) => x);
|
|
71130
|
-
var SchemaZod = z.union([SchemaZodV1, SchemaZodV2]);
|
|
71139
|
+
var SchemaZod = z.string().regex(SchemaRegEx);
|
|
71131
71140
|
var PayloadSchema = "network.xyo.payload";
|
|
71132
71141
|
z.literal(PayloadSchema);
|
|
71133
|
-
var isSchema = (
|
|
71134
|
-
|
|
71135
|
-
};
|
|
71136
|
-
var isDataHashMeta = (value) => {
|
|
71137
|
-
return isHash(value?._dataHash);
|
|
71138
|
-
};
|
|
71139
|
-
var isHashMeta = (value) => {
|
|
71140
|
-
return isDataHashMeta(value) && isHash(value?._hash);
|
|
71141
|
-
};
|
|
71142
|
-
var isSequenceStorageMeta = (value) => {
|
|
71143
|
-
return value?._sequence != void 0;
|
|
71144
|
-
};
|
|
71142
|
+
var isSchema = zodIsFactory(SchemaZod);
|
|
71143
|
+
var asSchema = zodAsFactory(SchemaZod, "asSchema");
|
|
71145
71144
|
var isLocalSequence = (value) => {
|
|
71146
71145
|
return isHex(value) && value.length === SequenceConstants.localSequenceBytes * 2;
|
|
71147
71146
|
};
|
|
@@ -71294,24 +71293,23 @@ var QualifiedSequenceToStringZod$1 = z.string().regex(QualifiedSequenceRegex$1);
|
|
|
71294
71293
|
var QualifiedSequenceFromStringZod$1 = z.string().regex(QualifiedSequenceRegex$1).transform((v) => toHex(v));
|
|
71295
71294
|
z.union([LocalSequenceToStringZod$1, QualifiedSequenceToStringZod$1]);
|
|
71296
71295
|
var SequenceFromStringZod = z.union([LocalSequenceFromStringZod$1, QualifiedSequenceFromStringZod$1]);
|
|
71297
|
-
var isStorageMeta = (value) => {
|
|
71298
|
-
return isSequenceStorageMeta(value) && isHashMeta(value);
|
|
71299
|
-
};
|
|
71300
71296
|
|
|
71301
71297
|
// src/PayloadZod.ts
|
|
71302
71298
|
var HashMetaZod = z.object({
|
|
71303
71299
|
_hash: HashZod,
|
|
71304
71300
|
_dataHash: HashZod
|
|
71305
71301
|
});
|
|
71302
|
+
var isHashMeta = zodIsFactory(HashMetaZod);
|
|
71306
71303
|
z.object({ _sequence: SequenceFromStringZod });
|
|
71307
71304
|
var StorageMetaZod = z.object({
|
|
71308
71305
|
_hash: HashZod,
|
|
71309
71306
|
_dataHash: HashZod,
|
|
71310
71307
|
_sequence: SequenceFromStringZod
|
|
71311
71308
|
});
|
|
71309
|
+
var isStorageMeta = zodIsFactory(StorageMetaZod);
|
|
71312
71310
|
var PayloadZod = z.object({ schema: SchemaZod });
|
|
71313
71311
|
PayloadZod.extend(StorageMetaZod.shape);
|
|
71314
|
-
var AnyPayloadZod = PayloadZod.
|
|
71312
|
+
var AnyPayloadZod = PayloadZod.loose();
|
|
71315
71313
|
AnyPayloadZod.extend(StorageMetaZod.shape);
|
|
71316
71314
|
function WithStorageMetaZod(valueZod) {
|
|
71317
71315
|
return valueZod.extend(StorageMetaZod.shape);
|
|
@@ -71321,9 +71319,18 @@ function WithHashMetaZod(valueZod) {
|
|
|
71321
71319
|
}
|
|
71322
71320
|
var PayloadZodStrict = z.strictObject({ schema: SchemaZod });
|
|
71323
71321
|
var PayloadZodLoose = z.looseObject({ schema: SchemaZod });
|
|
71322
|
+
var PayloadZodOfSchema$1 = (schema) => PayloadZod.extend({ schema: z.literal(schema) });
|
|
71324
71323
|
var PayloadZodStrictOfSchema = (schema) => PayloadZodStrict.extend({ schema: z.literal(schema) });
|
|
71325
71324
|
var PayloadZodLooseOfSchema = (schema) => PayloadZodLoose.extend({ schema: z.literal(schema) });
|
|
71326
71325
|
|
|
71326
|
+
// src/PayloadBundle.ts
|
|
71327
|
+
var PayloadBundleSchema = "network.xyo.payload.bundle";
|
|
71328
|
+
var PayloadBundleFieldsZod = z.object({
|
|
71329
|
+
payloads: PayloadZodLoose.array(),
|
|
71330
|
+
root: HashZod
|
|
71331
|
+
});
|
|
71332
|
+
PayloadZodOfSchema$1(PayloadBundleSchema).extend(PayloadBundleFieldsZod.shape);
|
|
71333
|
+
|
|
71327
71334
|
// src/Builder.ts
|
|
71328
71335
|
var omitSchema = (payload) => {
|
|
71329
71336
|
const result = structuredClone(payload);
|
|
@@ -71525,18 +71532,36 @@ var PayloadBuilder = class _PayloadBuilder {
|
|
|
71525
71532
|
};
|
|
71526
71533
|
|
|
71527
71534
|
// src/BoundWitness/BoundWitness.ts
|
|
71528
|
-
var asBlock = (bw) => bw;
|
|
71529
71535
|
|
|
71530
71536
|
// src/BoundWitness/BoundWitnessSchema.ts
|
|
71531
71537
|
var BoundWitnessSchema = "network.xyo.boundwitness";
|
|
71532
|
-
var
|
|
71533
|
-
var
|
|
71534
|
-
var
|
|
71535
|
-
|
|
71536
|
-
|
|
71537
|
-
|
|
71538
|
-
|
|
71539
|
-
|
|
71538
|
+
var SignaturesMetaZod = z.object({ $signatures: z.array(z.union([HexZod, z.null()])) });
|
|
71539
|
+
var UnsignedSignaturesMetaZod = z.object({ $signatures: z.array(z.null()) });
|
|
71540
|
+
var SignedSignaturesMetaZod = z.object({ $signatures: z.array(HexZod) });
|
|
71541
|
+
|
|
71542
|
+
// src/BoundWitness/BoundWitness.ts
|
|
71543
|
+
var BoundWitnessRequiredFieldsZod = z.object({
|
|
71544
|
+
addresses: z.array(AddressZod),
|
|
71545
|
+
payload_hashes: z.array(HashZod),
|
|
71546
|
+
payload_schemas: z.array(SchemaZod),
|
|
71547
|
+
previous_hashes: z.array(HashZod.nullable())
|
|
71548
|
+
});
|
|
71549
|
+
var BoundWitnessMetaZod = z.object({
|
|
71550
|
+
$destination: AddressZod.optional(),
|
|
71551
|
+
$sourceQuery: HashZod.optional()
|
|
71552
|
+
}).extend(SignaturesMetaZod.shape);
|
|
71553
|
+
var BoundWitnessZod = PayloadZod.safeExtend({ schema: z.literal(BoundWitnessSchema) }).safeExtend(BoundWitnessRequiredFieldsZod.shape).safeExtend(BoundWitnessMetaZod.shape);
|
|
71554
|
+
var isBoundWitness = zodIsFactory(BoundWitnessZod);
|
|
71555
|
+
var asBoundWitness = zodAsFactory(BoundWitnessZod, "asBoundWitness");
|
|
71556
|
+
BoundWitnessZod.loose();
|
|
71557
|
+
|
|
71558
|
+
// src/BoundWitness/SignedBoundWitness.ts
|
|
71559
|
+
var SignedBoundWitnessZod = BoundWitnessZod.extend(SignedSignaturesMetaZod.shape);
|
|
71560
|
+
SignedBoundWitnessZod.loose();
|
|
71561
|
+
|
|
71562
|
+
// src/BoundWitness/UnsignedBoundWitness.ts
|
|
71563
|
+
var UnsignedBoundWitnessZod = BoundWitnessZod.extend(UnsignedSignaturesMetaZod.shape);
|
|
71564
|
+
UnsignedBoundWitnessZod.loose();
|
|
71540
71565
|
var isQueryBoundWitness = (x) => isBoundWitness(x) && x?.query !== void 0;
|
|
71541
71566
|
|
|
71542
71567
|
// base64 encode/decode derived from: https://github.com/niklasvh/base64-arraybuffer
|
|
@@ -73133,10 +73158,10 @@ var BoundWitnessBuilder = class _BoundWitnessBuilder extends PayloadBuilder {
|
|
|
73133
73158
|
assertEx(!fields.payload_hashes.includes(null), () => "nulls found in hashes");
|
|
73134
73159
|
assertEx(!fields.payload_schemas.includes(null), () => "nulls found in schemas");
|
|
73135
73160
|
}
|
|
73136
|
-
async build() {
|
|
73161
|
+
async build(sign = true) {
|
|
73137
73162
|
return await _BoundWitnessBuilder._buildMutex.runExclusive(async () => {
|
|
73138
73163
|
const dataHashableFields = await this.dataHashableFields();
|
|
73139
|
-
const $signatures = await this.sign();
|
|
73164
|
+
const $signatures = sign ? await this.sign() : this.addresses.map(() => null);
|
|
73140
73165
|
const ret = {
|
|
73141
73166
|
...this._meta,
|
|
73142
73167
|
...dataHashableFields,
|
|
@@ -73658,25 +73683,25 @@ var NumberishZod = z.union([z.number(), z.string(), z.bigint()]).transform((v) =
|
|
|
73658
73683
|
|
|
73659
73684
|
// src/model/BlockNumber/BlockNumber.ts
|
|
73660
73685
|
var BlockNumberZod = z.number().transform((v) => v);
|
|
73661
|
-
var
|
|
73686
|
+
var BlockNumberishZod = NumberishZod.transform((v) => v);
|
|
73662
73687
|
var asBlockNumber = zodAsFactory(BlockNumberZod, "asBlockNumber");
|
|
73663
73688
|
asBlockNumber(0);
|
|
73664
73689
|
var EthBlockNumberZod = z.number().transform((v) => v);
|
|
73665
|
-
var
|
|
73690
|
+
var EthBlockNumberishZod = BlockNumberishZod.transform((v) => v);
|
|
73666
73691
|
var asEthBlockNumber = zodAsFactory(EthBlockNumberZod, "asEthBlockNumber");
|
|
73667
73692
|
asEthBlockNumber(0);
|
|
73668
73693
|
var XL1BlockNumberZod = z.number().transform((v) => v);
|
|
73669
|
-
var
|
|
73694
|
+
var XL1BlockNumberishZod = BlockNumberishZod.transform((v) => v);
|
|
73670
73695
|
var asXL1BlockNumber = zodAsFactory(XL1BlockNumberZod, "asXL1BlockNumber");
|
|
73671
73696
|
asXL1BlockNumber(0);
|
|
73672
73697
|
var BlockRangeZod = z.tuple([BlockNumberZod, BlockNumberZod]);
|
|
73673
|
-
z.tuple([
|
|
73698
|
+
z.tuple([BlockNumberishZod, BlockNumberishZod]);
|
|
73674
73699
|
z.tuple([EthBlockNumberZod, EthBlockNumberZod]);
|
|
73675
|
-
z.tuple([
|
|
73700
|
+
z.tuple([EthBlockNumberishZod, EthBlockNumberishZod]);
|
|
73676
73701
|
var RangeZod = z.tuple([z.number(), z.number()]);
|
|
73677
73702
|
var asRange = zodAsFactory(RangeZod, "Range");
|
|
73678
73703
|
var XL1BlockRangeZod = z.tuple([XL1BlockNumberZod, XL1BlockNumberZod]);
|
|
73679
|
-
z.tuple([
|
|
73704
|
+
z.tuple([XL1BlockNumberishZod, XL1BlockNumberishZod]);
|
|
73680
73705
|
var asXL1BlockRange = zodAsFactory(XL1BlockRangeZod, "XL1BlockRange");
|
|
73681
73706
|
var StepIdentityZod = object$3({
|
|
73682
73707
|
block: XL1BlockNumberZod.describe("The block number at which the step occurs"),
|
|
@@ -73686,36 +73711,257 @@ var StepIdentityZod = object$3({
|
|
|
73686
73711
|
// src/payload/StepIdentityPayload.ts
|
|
73687
73712
|
var StepIdentitySchema = "network.xyo.chain.step.identity";
|
|
73688
73713
|
var isStepIdentityPayload = isPayloadOfZodType(StepIdentityZod, StepIdentitySchema);
|
|
73689
|
-
|
|
73690
|
-
|
|
73691
|
-
|
|
73692
|
-
|
|
73693
|
-
|
|
73694
|
-
|
|
73695
|
-
|
|
73714
|
+
function base64Encode(u8) {
|
|
73715
|
+
if (typeof Buffer !== "undefined" && typeof Buffer.from === "function") {
|
|
73716
|
+
return Buffer.from(u8).toString("base64");
|
|
73717
|
+
}
|
|
73718
|
+
let binary = "";
|
|
73719
|
+
const chunk = 32768;
|
|
73720
|
+
for (let i = 0; i < u8.length; i += chunk) {
|
|
73721
|
+
binary += String.fromCharCode(...u8.subarray(i, i + chunk));
|
|
73722
|
+
}
|
|
73723
|
+
return btoa(binary);
|
|
73724
|
+
}
|
|
73725
|
+
function base64Decode(b64) {
|
|
73726
|
+
if (typeof Buffer !== "undefined" && typeof Buffer.from === "function") {
|
|
73727
|
+
return new Uint8Array(Buffer.from(b64, "base64"));
|
|
73728
|
+
}
|
|
73729
|
+
const binary = atob(b64);
|
|
73730
|
+
const u8 = new Uint8Array(binary.length);
|
|
73731
|
+
for (let i = 0; i < binary.length; i++) u8[i] = binary.charCodeAt(i);
|
|
73732
|
+
return u8;
|
|
73733
|
+
}
|
|
73734
|
+
var ArrayBufferToJsonZod = _instanceof(ArrayBuffer).transform((x) => {
|
|
73735
|
+
const u8 = new Uint8Array(x);
|
|
73736
|
+
return base64Encode(u8);
|
|
73737
|
+
});
|
|
73738
|
+
var JsonToArrayBufferZod = string$2().transform((x) => {
|
|
73739
|
+
const u8 = base64Decode(x);
|
|
73740
|
+
return u8.buffer;
|
|
73741
|
+
});
|
|
73742
|
+
var ChainZod = string$2().toLowerCase().regex(AddressRegEx).transform((v) => toAddress(v));
|
|
73696
73743
|
|
|
73697
|
-
// src/
|
|
73698
|
-
var
|
|
73699
|
-
|
|
73700
|
-
|
|
73701
|
-
|
|
73702
|
-
|
|
73703
|
-
|
|
73704
|
-
|
|
73705
|
-
|
|
73744
|
+
// src/zod/BlockBoundWitness.ts
|
|
73745
|
+
var BlockBoundWitnessFieldsZod = object$3({
|
|
73746
|
+
block: XL1BlockNumberZod,
|
|
73747
|
+
chain: ChainZod,
|
|
73748
|
+
previous: HashZod.nullable(),
|
|
73749
|
+
protocol: number$3().optional(),
|
|
73750
|
+
step_hashes: array$1(HashZod).optional()
|
|
73751
|
+
});
|
|
73752
|
+
var BlockBoundWitnessMetaZod = object$3({ $epoch: number$3() });
|
|
73753
|
+
var BlockBoundWitnessZod = BoundWitnessZod.safeExtend(BlockBoundWitnessFieldsZod.shape).safeExtend(BlockBoundWitnessMetaZod.shape);
|
|
73754
|
+
var isBlockBoundWitness = zodIsFactory(BlockBoundWitnessZod);
|
|
73755
|
+
var asBlockBoundWitness = zodAsFactory(BlockBoundWitnessZod, "asBlockBoundWitness");
|
|
73756
|
+
var BlockBoundWitnessWithHashMetaZod = BlockBoundWitnessZod.safeExtend(HashMetaZod.shape);
|
|
73757
|
+
var isBlockBoundWitnessWithHashMeta = zodIsFactory(BlockBoundWitnessWithHashMetaZod);
|
|
73758
|
+
var asBlockBoundWitnessWithHashMeta = zodAsFactory(BlockBoundWitnessWithHashMetaZod, "asBlockBoundWitnessWithHashMeta");
|
|
73759
|
+
var BlockBoundWitnessWithStorageMetaZod = BlockBoundWitnessZod.safeExtend(StorageMetaZod.shape);
|
|
73760
|
+
var asBlockBoundWitnessWithStorageMeta = zodAsFactory(BlockBoundWitnessWithStorageMetaZod, "asBlockBoundWitnessWithStorageMeta");
|
|
73761
|
+
var UnsignedBlockBoundWitnessZod = UnsignedBoundWitnessZod.safeExtend(BlockBoundWitnessFieldsZod.shape).safeExtend(BlockBoundWitnessMetaZod.shape);
|
|
73762
|
+
UnsignedBlockBoundWitnessZod.safeExtend(HashMetaZod.shape);
|
|
73763
|
+
UnsignedBlockBoundWitnessZod.safeExtend(StorageMetaZod.shape);
|
|
73764
|
+
var SignedBlockBoundWitnessZod = SignedBoundWitnessZod.safeExtend(BlockBoundWitnessFieldsZod.shape).safeExtend(BlockBoundWitnessMetaZod.shape);
|
|
73765
|
+
var asSignedBlockBoundWitness = zodAsFactory(SignedBlockBoundWitnessZod, "asSignedBlockBoundWitness");
|
|
73766
|
+
var SignedBlockBoundWitnessWithHashMetaZod = SignedBlockBoundWitnessZod.safeExtend(HashMetaZod.shape);
|
|
73767
|
+
var isSignedBlockBoundWitnessWithHashMeta = zodIsFactory(SignedBlockBoundWitnessWithHashMetaZod);
|
|
73768
|
+
var SignedBlockBoundWitnessWithStorageMetaZod = SignedBlockBoundWitnessZod.safeExtend(StorageMetaZod.shape);
|
|
73769
|
+
var isSignedBlockBoundWitnessWithStorageMeta = zodIsFactory(SignedBlockBoundWitnessWithStorageMetaZod);
|
|
73770
|
+
var asSignedBlockBoundWitnessWithStorageMeta = zodAsFactory(
|
|
73771
|
+
SignedBlockBoundWitnessWithStorageMetaZod,
|
|
73772
|
+
"asSignedBlockBoundWitnessWithStorageMeta"
|
|
73706
73773
|
);
|
|
73707
|
-
|
|
73708
|
-
|
|
73709
|
-
|
|
73710
|
-
|
|
73711
|
-
|
|
73774
|
+
tuple([
|
|
73775
|
+
BlockBoundWitnessZod,
|
|
73776
|
+
array$1(PayloadZodLoose)
|
|
73777
|
+
]);
|
|
73778
|
+
tuple([
|
|
73779
|
+
WithHashMetaZod(BlockBoundWitnessZod),
|
|
73780
|
+
array$1(WithHashMetaZod(PayloadZodLoose))
|
|
73781
|
+
]);
|
|
73782
|
+
tuple([
|
|
73783
|
+
WithStorageMetaZod(BlockBoundWitnessZod),
|
|
73784
|
+
array$1(WithStorageMetaZod(PayloadZodLoose))
|
|
73785
|
+
]);
|
|
73786
|
+
var SignedHydratedBlockZod = tuple([
|
|
73787
|
+
SignedBlockBoundWitnessZod,
|
|
73788
|
+
array$1(PayloadZodLoose)
|
|
73789
|
+
]);
|
|
73790
|
+
tuple([
|
|
73791
|
+
SignedBlockBoundWitnessZod,
|
|
73792
|
+
array$1(PayloadZodLoose)
|
|
73793
|
+
]);
|
|
73794
|
+
var SignedHydratedBlockWithHashMetaZod = tuple([
|
|
73795
|
+
WithHashMetaZod(SignedBlockBoundWitnessZod),
|
|
73796
|
+
array$1(WithHashMetaZod(PayloadZodLoose))
|
|
73797
|
+
]);
|
|
73798
|
+
var asSignedHydratedBlockWithHashMeta = zodAsFactory(SignedHydratedBlockWithHashMetaZod, "asSignedHydratedBlockWithHashMeta");
|
|
73799
|
+
tuple([
|
|
73800
|
+
WithStorageMetaZod(SignedBlockBoundWitnessZod),
|
|
73801
|
+
array$1(WithStorageMetaZod(PayloadZodLoose))
|
|
73802
|
+
]);
|
|
73803
|
+
var AttoZod = bigint$1();
|
|
73804
|
+
var JsonToAttoZod = JsonToBigIntZod.transform((v) => asAttoXL1(v));
|
|
73805
|
+
var AttoToJsonZod = BigIntToJsonZod;
|
|
73806
|
+
var TransactionFeesHexZod = object$3({
|
|
73807
|
+
base: HexZod,
|
|
73808
|
+
gasLimit: HexZod,
|
|
73809
|
+
gasPrice: HexZod,
|
|
73810
|
+
priority: HexZod
|
|
73811
|
+
});
|
|
73812
|
+
var TransactionFeesBigIntZod = object$3({
|
|
73813
|
+
base: AttoZod,
|
|
73814
|
+
gasLimit: AttoZod,
|
|
73815
|
+
gasPrice: AttoZod,
|
|
73816
|
+
priority: AttoZod
|
|
73817
|
+
});
|
|
73818
|
+
TransactionFeesHexZod.transform((val) => ({
|
|
73819
|
+
base: JsonToBigIntZod.parse(val.base),
|
|
73820
|
+
gasLimit: JsonToBigIntZod.parse(val.gasLimit),
|
|
73821
|
+
gasPrice: JsonToBigIntZod.parse(val.gasPrice),
|
|
73822
|
+
priority: JsonToBigIntZod.parse(val.priority)
|
|
73823
|
+
}));
|
|
73824
|
+
TransactionFeesBigIntZod.transform((val) => ({
|
|
73825
|
+
base: BigIntToJsonZod.parse(val.base),
|
|
73826
|
+
gasLimit: BigIntToJsonZod.parse(val.gasLimit),
|
|
73827
|
+
gasPrice: BigIntToJsonZod.parse(val.gasPrice),
|
|
73828
|
+
priority: BigIntToJsonZod.parse(val.priority)
|
|
73829
|
+
}));
|
|
73830
|
+
|
|
73831
|
+
// src/zod/TransactionBoundWitness.ts
|
|
73832
|
+
object$3({ nbf: XL1BlockNumberZod });
|
|
73833
|
+
object$3({ exp: XL1BlockNumberZod });
|
|
73834
|
+
var BlockDurationZod = object$3({ nbf: XL1BlockNumberZod, exp: XL1BlockNumberZod });
|
|
73835
|
+
var BlockScriptsZod = object$3({ script: array$1(string$2()).optional() });
|
|
73836
|
+
var TransactionFeesZod = object$3({ fees: TransactionFeesHexZod });
|
|
73837
|
+
var TransactionBoundWitnessIdentityFields = object$3({ chain: ChainZod, from: AddressZod });
|
|
73838
|
+
var TransactionBoundWitnessFieldsZod = object$3().safeExtend(BlockDurationZod.shape).safeExtend(TransactionFeesZod.shape).safeExtend(TransactionBoundWitnessIdentityFields.shape).safeExtend(BlockScriptsZod.shape);
|
|
73839
|
+
var TransactionBoundWitnessZod = BoundWitnessZod.safeExtend(TransactionBoundWitnessFieldsZod.shape);
|
|
73840
|
+
var isTransactionBoundWitness = zodIsFactory(TransactionBoundWitnessZod);
|
|
73841
|
+
TransactionBoundWitnessZod.safeExtend(HashMetaZod.shape);
|
|
73842
|
+
var TransactionBoundWitnessWithStorageMetaZod = TransactionBoundWitnessZod.safeExtend(StorageMetaZod.shape);
|
|
73843
|
+
var isTransactionBoundWitnessWithStorageMeta = zodIsFactory(TransactionBoundWitnessWithStorageMetaZod);
|
|
73844
|
+
var UnsignedTransactionBoundWitnessZod = UnsignedBoundWitnessZod.safeExtend(TransactionBoundWitnessFieldsZod.shape);
|
|
73845
|
+
UnsignedTransactionBoundWitnessZod.safeExtend(HashMetaZod.shape);
|
|
73846
|
+
UnsignedTransactionBoundWitnessZod.safeExtend(StorageMetaZod.shape);
|
|
73847
|
+
var SignedTransactionBoundWitnessZod = SignedBoundWitnessZod.safeExtend(TransactionBoundWitnessFieldsZod.shape);
|
|
73848
|
+
var SignedTransactionBoundWitnessWithHashMetaZod = SignedTransactionBoundWitnessZod.safeExtend(HashMetaZod.shape);
|
|
73849
|
+
var asSignedTransactionBoundWitnessWithHashMeta = zodAsFactory(
|
|
73850
|
+
SignedTransactionBoundWitnessWithHashMetaZod,
|
|
73851
|
+
"asSignedTransactionBoundWitnessWithHashMeta"
|
|
73712
73852
|
);
|
|
73713
|
-
var
|
|
73714
|
-
|
|
73715
|
-
|
|
73716
|
-
|
|
73717
|
-
|
|
73718
|
-
|
|
73853
|
+
var SignedTransactionBoundWitnessWithStorageMetaZod = SignedTransactionBoundWitnessZod.safeExtend(StorageMetaZod.shape);
|
|
73854
|
+
var isSignedTransactionBoundWitnessWithStorageMeta = zodIsFactory(SignedTransactionBoundWitnessWithStorageMetaZod);
|
|
73855
|
+
|
|
73856
|
+
// src/zod/HydratedTransaction.ts
|
|
73857
|
+
tuple([
|
|
73858
|
+
TransactionBoundWitnessZod,
|
|
73859
|
+
array$1(PayloadZodLoose)
|
|
73860
|
+
]);
|
|
73861
|
+
tuple([
|
|
73862
|
+
WithHashMetaZod(TransactionBoundWitnessZod),
|
|
73863
|
+
array$1(WithHashMetaZod(PayloadZodLoose))
|
|
73864
|
+
]);
|
|
73865
|
+
tuple([
|
|
73866
|
+
WithStorageMetaZod(TransactionBoundWitnessZod),
|
|
73867
|
+
array$1(WithStorageMetaZod(PayloadZodLoose))
|
|
73868
|
+
]);
|
|
73869
|
+
var UnsignedHydratedTransactionZod = tuple([
|
|
73870
|
+
UnsignedTransactionBoundWitnessZod,
|
|
73871
|
+
array$1(PayloadZodLoose)
|
|
73872
|
+
]);
|
|
73873
|
+
tuple([
|
|
73874
|
+
WithHashMetaZod(TransactionBoundWitnessZod),
|
|
73875
|
+
array$1(WithHashMetaZod(PayloadZodLoose))
|
|
73876
|
+
]);
|
|
73877
|
+
tuple([
|
|
73878
|
+
WithStorageMetaZod(TransactionBoundWitnessZod),
|
|
73879
|
+
array$1(WithStorageMetaZod(PayloadZodLoose))
|
|
73880
|
+
]);
|
|
73881
|
+
var SignedHydratedTransactionZod = tuple([
|
|
73882
|
+
SignedTransactionBoundWitnessZod,
|
|
73883
|
+
array$1(PayloadZodLoose)
|
|
73884
|
+
]);
|
|
73885
|
+
var SignedHydratedTransactionWithHashMetaZod = tuple([
|
|
73886
|
+
WithHashMetaZod(SignedTransactionBoundWitnessZod),
|
|
73887
|
+
array$1(WithHashMetaZod(PayloadZodLoose))
|
|
73888
|
+
]);
|
|
73889
|
+
tuple([
|
|
73890
|
+
WithStorageMetaZod(SignedTransactionBoundWitnessZod),
|
|
73891
|
+
array$1(WithStorageMetaZod(PayloadZodLoose))
|
|
73892
|
+
]);
|
|
73893
|
+
var CaveatTypesZod = _enum$1(["chain", "expiration", "filteredResponse", "rateLimit", "restrictReturnedAccounts"]);
|
|
73894
|
+
var CaveatsZod = object$3({
|
|
73895
|
+
type: CaveatTypesZod,
|
|
73896
|
+
value: json$3()
|
|
73897
|
+
});
|
|
73898
|
+
var PermissionZod = object$3({
|
|
73899
|
+
parentCapability: string$2(),
|
|
73900
|
+
caveats: CaveatsZod.array().optional(),
|
|
73901
|
+
invoker: string$2()
|
|
73902
|
+
});
|
|
73903
|
+
var InvokerPermissionZod = PermissionZod.safeExtend({ date: number$3().optional() });
|
|
73904
|
+
var PermissionRequestZod = record$1(string$2(), record$1(string$2(), any$1()));
|
|
73905
|
+
var RequestedPermissionZod = object$3({
|
|
73906
|
+
parentCapability: string$2(),
|
|
73907
|
+
date: number$3().optional()
|
|
73908
|
+
});
|
|
73909
|
+
var RewardsRangeOptionsZod = object$3({
|
|
73910
|
+
positions: array$1(number$3()).optional(),
|
|
73911
|
+
range: BlockRangeZod.optional(),
|
|
73912
|
+
steps: array$1(StepIdentityZod).optional(),
|
|
73913
|
+
stakers: array$1(AddressZod).optional()
|
|
73914
|
+
});
|
|
73915
|
+
var LocalSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.localSequenceBytes, SequenceConstants.localSequenceBytes));
|
|
73916
|
+
var LocalSequenceToStringZod = string$2().regex(LocalSequenceRegex);
|
|
73917
|
+
var LocalSequenceFromStringZod = string$2().regex(LocalSequenceRegex).transform((v) => toHex(v));
|
|
73918
|
+
var QualifiedSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.qualifiedSequenceBytes, SequenceConstants.qualifiedSequenceBytes));
|
|
73919
|
+
var QualifiedSequenceToStringZod = string$2().regex(QualifiedSequenceRegex);
|
|
73920
|
+
var QualifiedSequenceFromStringZod = string$2().regex(QualifiedSequenceRegex).transform((v) => toHex(v));
|
|
73921
|
+
union$1([LocalSequenceToStringZod, QualifiedSequenceToStringZod]);
|
|
73922
|
+
union$1([LocalSequenceFromStringZod, QualifiedSequenceFromStringZod]);
|
|
73923
|
+
var StakeZod = object$3({
|
|
73924
|
+
amount: AttoZod,
|
|
73925
|
+
// the block number when the stake was added
|
|
73926
|
+
addBlock: number$3(),
|
|
73927
|
+
// the unique id for the stake item
|
|
73928
|
+
id: number$3(),
|
|
73929
|
+
// the block number when the stake was removed (set to 0 if not removed)
|
|
73930
|
+
removeBlock: number$3(),
|
|
73931
|
+
// the address that is being staked
|
|
73932
|
+
staked: AddressZod,
|
|
73933
|
+
// the address that owns the stake
|
|
73934
|
+
staker: AddressZod,
|
|
73935
|
+
// the block number when the stake was withdrawn (set to 0 if not withdrawn)
|
|
73936
|
+
withdrawBlock: number$3()
|
|
73937
|
+
});
|
|
73938
|
+
var StakeToJsonZod = StakeZod.transform((val) => ({
|
|
73939
|
+
addBlock: val.addBlock,
|
|
73940
|
+
amount: AttoToJsonZod.parse(val.amount),
|
|
73941
|
+
id: val.id,
|
|
73942
|
+
removeBlock: val.removeBlock,
|
|
73943
|
+
staked: AddressZod.parse(val.staked),
|
|
73944
|
+
staker: AddressZod.parse(val.staker),
|
|
73945
|
+
withdrawBlock: val.withdrawBlock
|
|
73946
|
+
}));
|
|
73947
|
+
var JsonToStakeZod = StakeZod.extend({ amount: HexZod }).transform((val) => ({
|
|
73948
|
+
addBlock: val.addBlock,
|
|
73949
|
+
amount: JsonToAttoZod.parse(val.amount),
|
|
73950
|
+
id: val.id,
|
|
73951
|
+
removeBlock: val.removeBlock,
|
|
73952
|
+
staked: val.staked,
|
|
73953
|
+
staker: val.staker,
|
|
73954
|
+
withdrawBlock: val.withdrawBlock
|
|
73955
|
+
}));
|
|
73956
|
+
var TimeDomainZod = union$1([
|
|
73957
|
+
literal$2("xl1"),
|
|
73958
|
+
literal$2("epoch"),
|
|
73959
|
+
literal$2("ethereum")
|
|
73960
|
+
]);
|
|
73961
|
+
var TransferPairZod = z.tuple([
|
|
73962
|
+
AddressZod,
|
|
73963
|
+
AddressZod
|
|
73964
|
+
]);
|
|
73719
73965
|
|
|
73720
73966
|
// src/block/AllowedBlockPayload.ts
|
|
73721
73967
|
var AllowedBlockPayloadSchemas = [
|
|
@@ -73738,25 +73984,6 @@ var isAllowedBlockPayload = (value) => {
|
|
|
73738
73984
|
var isAllowedBlockPayloadWithHashMeta = (value) => {
|
|
73739
73985
|
return isAllowedBlockPayload(value) && isHashMeta(value);
|
|
73740
73986
|
};
|
|
73741
|
-
var isBlockBoundWitness = (value) => {
|
|
73742
|
-
const typedObj = value;
|
|
73743
|
-
return isBoundWitness(value) && Number.isInteger(typedObj.block) && isHex(typedObj.chain);
|
|
73744
|
-
};
|
|
73745
|
-
var isBlockBoundWitnessWithStorageMeta = (value) => {
|
|
73746
|
-
return isBlockBoundWitness(value) && isStorageMeta(value);
|
|
73747
|
-
};
|
|
73748
|
-
var isBlockBoundWitnessWithHashMeta = (value) => {
|
|
73749
|
-
return isBlockBoundWitness(value) && isHashMeta(value);
|
|
73750
|
-
};
|
|
73751
|
-
var asBlockBoundWitness = AsObjectFactory.create(isBlockBoundWitness);
|
|
73752
|
-
var asBlockBoundWitnessWithStorageMeta = AsObjectFactory.create(isBlockBoundWitnessWithStorageMeta);
|
|
73753
|
-
var asBlockBoundWitnessWithHashMeta = AsObjectFactory.create(isBlockBoundWitnessWithHashMeta);
|
|
73754
|
-
var isHydratedBlock = (value) => {
|
|
73755
|
-
return isHydratedBoundWitness(value) && isBlockBoundWitnessWithStorageMeta(value[0]);
|
|
73756
|
-
};
|
|
73757
|
-
var asHydratedBlock = AsObjectFactory.create(
|
|
73758
|
-
isHydratedBlock
|
|
73759
|
-
);
|
|
73760
73987
|
|
|
73761
73988
|
// src/constants/addresses.ts
|
|
73762
73989
|
var XYO_ZERO_ADDRESS = "0000000000000000000000000000000000000000";
|
|
@@ -76034,12 +76261,12 @@ var asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivist
|
|
|
76034
76261
|
|
|
76035
76262
|
// src/Config.ts
|
|
76036
76263
|
var ArchivistConfigSchema = "network.xyo.archivist.config";
|
|
76037
|
-
var
|
|
76264
|
+
var tryGetTypedBoundWitnessWithStorageMeta = async (archivist, hash, identity) => {
|
|
76038
76265
|
const payload = (await archivist.get([hash])).at(0);
|
|
76039
76266
|
return identity(payload) ? payload : void 0;
|
|
76040
76267
|
};
|
|
76041
76268
|
var tryHydrateTypedBoundWitness = async (archivist, hashOrBw, identity) => {
|
|
76042
|
-
const bw = isHash(hashOrBw) ? await
|
|
76269
|
+
const bw = isHash(hashOrBw) ? await tryGetTypedBoundWitnessWithStorageMeta(archivist, hashOrBw, identity) : hashOrBw;
|
|
76043
76270
|
return bw ? [bw, (await archivist.get(bw?.payload_hashes)).filter(exists$1)] : void 0;
|
|
76044
76271
|
};
|
|
76045
76272
|
|
|
@@ -76123,7 +76350,7 @@ var BoundWitnessValidator = class _BoundWitnessValidator extends PayloadValidato
|
|
|
76123
76350
|
this.obj.addresses?.map(async (address, index) => _BoundWitnessValidator.validateSignature(
|
|
76124
76351
|
toArrayBuffer(await PayloadBuilder.dataHash(this.payload)),
|
|
76125
76352
|
toArrayBuffer(asAddress(address, true)),
|
|
76126
|
-
toArrayBuffer(this.obj.$signatures?.[index])
|
|
76353
|
+
toArrayBuffer(this.obj.$signatures?.[index] ?? void 0)
|
|
76127
76354
|
)) ?? []
|
|
76128
76355
|
)).flat()
|
|
76129
76356
|
];
|
|
@@ -81322,7 +81549,7 @@ var hydrateBlock = /* @__PURE__ */ __name$k(async ({ chainMap }, hash, maxDepth
|
|
|
81322
81549
|
];
|
|
81323
81550
|
}, "hydrateBlock");
|
|
81324
81551
|
var transactionsFromHydratedBlock = /* @__PURE__ */ __name$k((block) => {
|
|
81325
|
-
return
|
|
81552
|
+
return block[1].filter(isTransactionBoundWitnessWithStorageMeta);
|
|
81326
81553
|
}, "transactionsFromHydratedBlock");
|
|
81327
81554
|
var LruCacheMap = class {
|
|
81328
81555
|
static {
|
|
@@ -81593,9 +81820,7 @@ async function balancesSummary(context) {
|
|
|
81593
81820
|
return await spanRootAsync("balancesSummary", async () => {
|
|
81594
81821
|
const [headHash] = await context.head();
|
|
81595
81822
|
const headResult = await context.store.chainMap.get(headHash);
|
|
81596
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${headHash}
|
|
81597
|
-
required: true
|
|
81598
|
-
});
|
|
81823
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${headHash}`);
|
|
81599
81824
|
const rangeStart = asXL1BlockNumber(isDefined(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0);
|
|
81600
81825
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange([
|
|
81601
81826
|
rangeStart,
|
|
@@ -81625,7 +81850,7 @@ async function schemasStepSummaryFromRange(context, range) {
|
|
|
81625
81850
|
const [block, payloads] = await hydrateBlock(context.store, hash);
|
|
81626
81851
|
const boundWitnesses = [
|
|
81627
81852
|
block,
|
|
81628
|
-
...payloads.filter(
|
|
81853
|
+
...payloads.filter((x) => isBoundWitness(x) && isHashMeta(x))
|
|
81629
81854
|
];
|
|
81630
81855
|
const schemas = {};
|
|
81631
81856
|
for (const bw of boundWitnesses) {
|
|
@@ -81670,17 +81895,14 @@ async function schemasStepSummaryFromRange(context, range) {
|
|
|
81670
81895
|
}
|
|
81671
81896
|
}
|
|
81672
81897
|
}
|
|
81673
|
-
|
|
81674
|
-
return finalResult;
|
|
81898
|
+
return await PayloadBuilder.addHashMeta(result);
|
|
81675
81899
|
}
|
|
81676
81900
|
__name$k(schemasStepSummaryFromRange, "schemasStepSummaryFromRange");
|
|
81677
81901
|
async function schemasSummary(context) {
|
|
81678
81902
|
return await spanRootAsync("schemasSummary", async () => {
|
|
81679
81903
|
const [headHash] = await context.head();
|
|
81680
81904
|
const headResult = await context.store.chainMap.get(headHash);
|
|
81681
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${headHash}
|
|
81682
|
-
required: true
|
|
81683
|
-
});
|
|
81905
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${headHash}`);
|
|
81684
81906
|
const rangeStart = asXL1BlockNumber(isDefined(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0);
|
|
81685
81907
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange([
|
|
81686
81908
|
rangeStart,
|
|
@@ -81703,9 +81925,7 @@ async function transfersSummary(transferContext) {
|
|
|
81703
81925
|
return await spanRootAsync("transferSummary", async () => {
|
|
81704
81926
|
const [headHash] = await transferContext.head();
|
|
81705
81927
|
const headResult = await transferContext.store.chainMap.get(headHash);
|
|
81706
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${transferContext.head}
|
|
81707
|
-
required: true
|
|
81708
|
-
});
|
|
81928
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${transferContext.head}`);
|
|
81709
81929
|
const rangeStart = asXL1BlockNumber(isDefined(transferContext.windowSize) ? Math.max(headBoundWitness.block - transferContext.windowSize + 1, 0) : 0);
|
|
81710
81930
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange([
|
|
81711
81931
|
rangeStart,
|
|
@@ -81866,6 +82086,215 @@ async function withContextCacheResponse(context, name, key, func, { max = 1e4, t
|
|
|
81866
82086
|
return result;
|
|
81867
82087
|
}
|
|
81868
82088
|
__name$k(withContextCacheResponse, "withContextCacheResponse");
|
|
82089
|
+
async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer, nbf, exp, from, fees = defaultTransactionFees) {
|
|
82090
|
+
if (from === void 0 && Array.isArray(signer)) {
|
|
82091
|
+
throw new Error("from is required when signer is an array");
|
|
82092
|
+
}
|
|
82093
|
+
const txBoundWitnessFields = {
|
|
82094
|
+
chain,
|
|
82095
|
+
fees: {
|
|
82096
|
+
base: toHex(fees.base),
|
|
82097
|
+
gasLimit: toHex(fees.gasLimit),
|
|
82098
|
+
gasPrice: toHex(fees.gasPrice),
|
|
82099
|
+
priority: toHex(fees.priority)
|
|
82100
|
+
},
|
|
82101
|
+
nbf,
|
|
82102
|
+
exp
|
|
82103
|
+
};
|
|
82104
|
+
const elevatedHashes = await PayloadBuilder.hashes(onChainPayloads);
|
|
82105
|
+
const script = [];
|
|
82106
|
+
for (const elevatedHash of elevatedHashes) {
|
|
82107
|
+
script.push(`elevate|${elevatedHash}`);
|
|
82108
|
+
}
|
|
82109
|
+
const fields = {
|
|
82110
|
+
...txBoundWitnessFields,
|
|
82111
|
+
from: from ?? (Array.isArray(signer) ? assertEx(signer.at(0)?.address) : signer.address)
|
|
82112
|
+
};
|
|
82113
|
+
if (script.length > 0) {
|
|
82114
|
+
fields.script = script;
|
|
82115
|
+
}
|
|
82116
|
+
const [tx, txPayloads] = await new BoundWitnessBuilder().fields(fields).meta({
|
|
82117
|
+
$signatures: []
|
|
82118
|
+
}).payloads([
|
|
82119
|
+
...onChainPayloads,
|
|
82120
|
+
...offChainPayloads
|
|
82121
|
+
]).signers(Array.isArray(signer) ? signer : [
|
|
82122
|
+
signer
|
|
82123
|
+
]).build();
|
|
82124
|
+
return [
|
|
82125
|
+
await PayloadBuilder.addHashMeta(tx),
|
|
82126
|
+
await PayloadBuilder.addHashMeta(txPayloads)
|
|
82127
|
+
];
|
|
82128
|
+
}
|
|
82129
|
+
__name$k(buildTransaction, "buildTransaction");
|
|
82130
|
+
async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads, nbf, exp, from, fees = defaultTransactionFees) {
|
|
82131
|
+
const txBoundWitnessFields = {
|
|
82132
|
+
chain,
|
|
82133
|
+
fees: {
|
|
82134
|
+
base: toHex(fees.base),
|
|
82135
|
+
gasLimit: toHex(fees.gasLimit),
|
|
82136
|
+
gasPrice: toHex(fees.gasPrice),
|
|
82137
|
+
priority: toHex(fees.priority)
|
|
82138
|
+
},
|
|
82139
|
+
nbf,
|
|
82140
|
+
exp
|
|
82141
|
+
};
|
|
82142
|
+
const elevatedHashes = await PayloadBuilder.hashes(onChainPayloads);
|
|
82143
|
+
const script = [];
|
|
82144
|
+
for (const elevatedHash of elevatedHashes) {
|
|
82145
|
+
script.push(`elevate|${elevatedHash}`);
|
|
82146
|
+
}
|
|
82147
|
+
const fields = {
|
|
82148
|
+
...txBoundWitnessFields,
|
|
82149
|
+
from
|
|
82150
|
+
};
|
|
82151
|
+
if (script.length > 0) {
|
|
82152
|
+
fields.script = script;
|
|
82153
|
+
}
|
|
82154
|
+
const [tx, txPayloads] = await new BoundWitnessBuilder().fields(fields).meta({
|
|
82155
|
+
$signatures: []
|
|
82156
|
+
}).payloads([
|
|
82157
|
+
...onChainPayloads,
|
|
82158
|
+
...offChainPayloads
|
|
82159
|
+
]).build(false);
|
|
82160
|
+
return [
|
|
82161
|
+
tx,
|
|
82162
|
+
txPayloads
|
|
82163
|
+
];
|
|
82164
|
+
}
|
|
82165
|
+
__name$k(buildUnsignedTransaction, "buildUnsignedTransaction");
|
|
82166
|
+
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
82167
|
+
var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
|
|
82168
|
+
var confirmSubmittedTransaction = /* @__PURE__ */ __name$k(async (viewer, txHash, options) => {
|
|
82169
|
+
const { attempts: maxAttempts = DEFAULT_CONFIRMATION_ATTEMPTS, delay: attemptDelay = DEFAULT_DELAY_BETWEEN_ATTEMPTS } = options ?? {};
|
|
82170
|
+
options?.logger?.log("\u{1F680} confirming transaction:", txHash, "\n");
|
|
82171
|
+
let attempts = 0;
|
|
82172
|
+
while (true) {
|
|
82173
|
+
const tx = await viewer.transactionByHash(txHash) ?? void 0;
|
|
82174
|
+
if (isDefined(tx)) {
|
|
82175
|
+
options?.logger?.log("\u2705 Transaction confirmed:", txHash, "\n");
|
|
82176
|
+
return tx;
|
|
82177
|
+
} else {
|
|
82178
|
+
attempts++;
|
|
82179
|
+
if (attempts > maxAttempts) {
|
|
82180
|
+
options?.logger?.error(`\u26A0\uFE0F Transaction not confirmed after ${maxAttempts} attempts`);
|
|
82181
|
+
throw new Error(`Transaction ${txHash} not confirmed after ${maxAttempts} attempts`);
|
|
82182
|
+
} else {
|
|
82183
|
+
options?.logger?.log(`\u{1F504} Transaction not confirmed yet, attempt ${attempts}. Retrying...`, "\n");
|
|
82184
|
+
await delay$1(attemptDelay);
|
|
82185
|
+
}
|
|
82186
|
+
}
|
|
82187
|
+
}
|
|
82188
|
+
}, "confirmSubmittedTransaction");
|
|
82189
|
+
var tryHydrateTransaction = /* @__PURE__ */ __name$k(async ({ chainMap }, hash) => {
|
|
82190
|
+
return await tryHydrateTypedBoundWitness({
|
|
82191
|
+
get(hashes) {
|
|
82192
|
+
return chainMap.getMany(hashes);
|
|
82193
|
+
},
|
|
82194
|
+
next() {
|
|
82195
|
+
throw new Error("Not implemented");
|
|
82196
|
+
}
|
|
82197
|
+
}, hash, isSignedTransactionBoundWitnessWithStorageMeta);
|
|
82198
|
+
}, "tryHydrateTransaction");
|
|
82199
|
+
var flattenHydratedTransaction = /* @__PURE__ */ __name$k((hydratedTransaction) => {
|
|
82200
|
+
const [tx, txPayloads] = hydratedTransaction;
|
|
82201
|
+
return [
|
|
82202
|
+
...txPayloads,
|
|
82203
|
+
tx
|
|
82204
|
+
];
|
|
82205
|
+
}, "flattenHydratedTransaction");
|
|
82206
|
+
var flattenHydratedTransactions = /* @__PURE__ */ __name$k((hydratedTransactions) => hydratedTransactions.flatMap((tx) => flattenHydratedTransaction(tx)), "flattenHydratedTransactions");
|
|
82207
|
+
function transactionBlockByteCount([transaction, payloads]) {
|
|
82208
|
+
const cleanTransaction = PayloadBuilder.omitStorageMeta(transaction);
|
|
82209
|
+
const transactionBytes = JSON.stringify(cleanTransaction).length;
|
|
82210
|
+
const cleanPayloads = PayloadBuilder.omitStorageMeta(payloads);
|
|
82211
|
+
return cleanPayloads.reduce((acc, payload) => acc + JSON.stringify(payload).length, 0) + transactionBytes;
|
|
82212
|
+
}
|
|
82213
|
+
__name$k(transactionBlockByteCount, "transactionBlockByteCount");
|
|
82214
|
+
|
|
82215
|
+
// src/transaction/primitives/transactionOperations.ts
|
|
82216
|
+
function crackOperation(operation) {
|
|
82217
|
+
const parts = operation.split("|");
|
|
82218
|
+
if (parts.length < 2) {
|
|
82219
|
+
throw new Error(`Invalid operation format: ${operation}`);
|
|
82220
|
+
}
|
|
82221
|
+
return [
|
|
82222
|
+
parts[0],
|
|
82223
|
+
parts.slice(1)
|
|
82224
|
+
];
|
|
82225
|
+
}
|
|
82226
|
+
__name$k(crackOperation, "crackOperation");
|
|
82227
|
+
function crackOperations(operations) {
|
|
82228
|
+
return operations.map((op) => crackOperation(op));
|
|
82229
|
+
}
|
|
82230
|
+
__name$k(crackOperations, "crackOperations");
|
|
82231
|
+
|
|
82232
|
+
// src/transaction/primitives/transactionElevatedPayloads.ts
|
|
82233
|
+
function transactionElevatedPayloadHashes(transaction) {
|
|
82234
|
+
const elevateOperations = crackOperations(transaction.script ?? []).filter((op) => op[0] === "elevate");
|
|
82235
|
+
return elevateOperations.map((op) => asHash(op[1][0], true));
|
|
82236
|
+
}
|
|
82237
|
+
__name$k(transactionElevatedPayloadHashes, "transactionElevatedPayloadHashes");
|
|
82238
|
+
function transactionElevatedPayloads([transaction, payloads]) {
|
|
82239
|
+
const hashes = transactionElevatedPayloadHashes(transaction);
|
|
82240
|
+
const elevatedPayloads2 = payloads.filter((payload) => hashes.includes(payload._hash));
|
|
82241
|
+
return elevatedPayloads2;
|
|
82242
|
+
}
|
|
82243
|
+
__name$k(transactionElevatedPayloads, "transactionElevatedPayloads");
|
|
82244
|
+
function transactionBytesRequiredGas([transaction, payloads]) {
|
|
82245
|
+
const transactionBlockBytes = transactionBlockByteCount([
|
|
82246
|
+
transaction,
|
|
82247
|
+
payloads
|
|
82248
|
+
]);
|
|
82249
|
+
return AttoXL1(TransactionGasCosts.characterStorage * BigInt(transactionBlockBytes));
|
|
82250
|
+
}
|
|
82251
|
+
__name$k(transactionBytesRequiredGas, "transactionBytesRequiredGas");
|
|
82252
|
+
function transactionRequiredGas(hydratedTransaction) {
|
|
82253
|
+
const elevatedPayloads2 = transactionElevatedPayloads(hydratedTransaction);
|
|
82254
|
+
const hashes = elevatedPayloads2.length + 1;
|
|
82255
|
+
const signatures = hydratedTransaction[0].addresses.length;
|
|
82256
|
+
return AttoXL1(transactionBytesRequiredGas(hydratedTransaction) + TransactionGasCosts.hashValidation * BigInt(hashes) + TransactionGasCosts.signatureValidation * BigInt(signatures) + TransactionGasCosts.payloadValidation * BigInt(elevatedPayloads2.length));
|
|
82257
|
+
}
|
|
82258
|
+
__name$k(transactionRequiredGas, "transactionRequiredGas");
|
|
82259
|
+
var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name$k((strings) => {
|
|
82260
|
+
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
82261
|
+
return filterAs(hashes, (h) => asHash(h));
|
|
82262
|
+
}, "tryExtractElevatedHashesFromScript");
|
|
82263
|
+
var tryExtractElevatedHashes = /* @__PURE__ */ __name$k((tx) => {
|
|
82264
|
+
const [bw, payloads] = tx;
|
|
82265
|
+
const { script } = bw;
|
|
82266
|
+
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
82267
|
+
return payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
82268
|
+
}, "tryExtractElevatedHashes");
|
|
82269
|
+
var extractElevatedHashes = /* @__PURE__ */ __name$k((tx) => {
|
|
82270
|
+
const [bw, payloads] = tx;
|
|
82271
|
+
const { script } = bw;
|
|
82272
|
+
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
82273
|
+
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
82274
|
+
assertEx(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
82275
|
+
return filtered;
|
|
82276
|
+
}, "extractElevatedHashes");
|
|
82277
|
+
async function signTransaction(tx, account) {
|
|
82278
|
+
assertEx(tx.from === account.address, () => "Signer address does not match transaction from address");
|
|
82279
|
+
const unsignedTx = structuredClone(tx);
|
|
82280
|
+
unsignedTx.addresses = [
|
|
82281
|
+
account.address
|
|
82282
|
+
];
|
|
82283
|
+
unsignedTx.previous_hashes = [
|
|
82284
|
+
account.previousHash ?? null
|
|
82285
|
+
];
|
|
82286
|
+
const hash = await PayloadBuilder.dataHash(unsignedTx);
|
|
82287
|
+
const hashBytes = toArrayBuffer(hash);
|
|
82288
|
+
const [signature] = await account.sign(hashBytes);
|
|
82289
|
+
const result = {
|
|
82290
|
+
...unsignedTx,
|
|
82291
|
+
$signatures: [
|
|
82292
|
+
hexFromArrayBuffer(signature)
|
|
82293
|
+
]
|
|
82294
|
+
};
|
|
82295
|
+
return result;
|
|
82296
|
+
}
|
|
82297
|
+
__name$k(signTransaction, "signTransaction");
|
|
81869
82298
|
|
|
81870
82299
|
// src/block/primitives/blockFromBlockNumber.ts
|
|
81871
82300
|
async function blockFromBlockNumber(context, blockNumber) {
|
|
@@ -81873,9 +82302,10 @@ async function blockFromBlockNumber(context, blockNumber) {
|
|
|
81873
82302
|
return await withContextCacheResponse(context, "blockFromBlockNumber", cacheKey, async () => {
|
|
81874
82303
|
const [headHash] = await context.head();
|
|
81875
82304
|
const result = await context.store.chainMap.get(headHash);
|
|
81876
|
-
|
|
81877
|
-
|
|
81878
|
-
}
|
|
82305
|
+
if (!isDefined(result)) {
|
|
82306
|
+
throw new Error(`Head block not found for hash: ${headHash}`);
|
|
82307
|
+
}
|
|
82308
|
+
let currentBlock = asSignedBlockBoundWitnessWithStorageMeta(result, () => `Found Payload is not a Signed<BlockBoundWitness>: ${JSON.stringify(result, null, 2)}`);
|
|
81879
82309
|
if (currentBlock.block < blockNumber) {
|
|
81880
82310
|
throw new Error(`Block number ${blockNumber} is greater than head ${currentBlock.block}.`);
|
|
81881
82311
|
}
|
|
@@ -81886,12 +82316,16 @@ async function blockFromBlockNumber(context, blockNumber) {
|
|
|
81886
82316
|
const possibleJumpBlockNumber = currentBlock.block - currentBlock.block % stepSize2 - 1;
|
|
81887
82317
|
if (possibleJumpBlockNumber >= blockNumber && possibleJumpBlockNumber <= jumpBlockNumber) {
|
|
81888
82318
|
jumpBlockNumber = possibleJumpBlockNumber;
|
|
81889
|
-
jumpHash = asHash(currentBlock.step_hashes
|
|
82319
|
+
jumpHash = asHash(currentBlock.step_hashes?.at(step), () => `Step hash not found for step ${step} in block ${currentBlock.block}`);
|
|
81890
82320
|
}
|
|
81891
82321
|
}
|
|
81892
82322
|
const newBlock = await context.store.chainMap.get(asHash(jumpHash, () => `Jump hash not found for block number [${blockNumber}]: ${jumpBlockNumber} ${toSafeJsonString$1(currentBlock, 10)}`));
|
|
81893
|
-
|
|
81894
|
-
|
|
82323
|
+
if (!isDefined(newBlock)) {
|
|
82324
|
+
throw new Error(`Block not found for jump hash: ${jumpHash}`);
|
|
82325
|
+
}
|
|
82326
|
+
currentBlock = asSignedBlockBoundWitnessWithStorageMeta(newBlock, () => {
|
|
82327
|
+
const result2 = SignedBlockBoundWitnessWithHashMetaZod.safeParse(newBlock);
|
|
82328
|
+
return `Found Payload [jump hash] is not a Signed<BlockBoundWitness>: ${result2.error}`;
|
|
81895
82329
|
});
|
|
81896
82330
|
if (currentBlock.block === blockNumber) {
|
|
81897
82331
|
break;
|
|
@@ -82061,14 +82495,6 @@ var ApiConfigZod = object$3({
|
|
|
82061
82495
|
type: "number"
|
|
82062
82496
|
})
|
|
82063
82497
|
});
|
|
82064
|
-
var AppConfigZod = object$3({
|
|
82065
|
-
port: number$2().default(3e3).register(globalRegistry, {
|
|
82066
|
-
default: 3e3,
|
|
82067
|
-
description: "Port for the application",
|
|
82068
|
-
title: "app.port",
|
|
82069
|
-
type: "number"
|
|
82070
|
-
})
|
|
82071
|
-
});
|
|
82072
82498
|
var BridgeConfigZod = object$3({
|
|
82073
82499
|
host: string$2().default("localhost").register(globalRegistry, {
|
|
82074
82500
|
default: "localhost",
|
|
@@ -82200,11 +82626,6 @@ var ProducerConfigZod = object$3({
|
|
|
82200
82626
|
title: "allowlist",
|
|
82201
82627
|
type: "array"
|
|
82202
82628
|
})),
|
|
82203
|
-
apiEndpoint: string$2().optional().register(globalRegistry, {
|
|
82204
|
-
description: "Endpoint of the API to use for chain data",
|
|
82205
|
-
title: "producer.apiEndpoint",
|
|
82206
|
-
type: "string"
|
|
82207
|
-
}),
|
|
82208
82629
|
disableIntentRedeclaration: boolean$1().optional().register(globalRegistry, {
|
|
82209
82630
|
description: "Should the producer skip redeclaring their intent to continue producing blocks",
|
|
82210
82631
|
title: "producer.disableIntentRedeclaration",
|
|
@@ -82271,6 +82692,18 @@ var RewardRedemptionApiConfigZod = object$3({
|
|
|
82271
82692
|
type: "number"
|
|
82272
82693
|
})
|
|
82273
82694
|
});
|
|
82695
|
+
var ServicesConfigZod = object$3({
|
|
82696
|
+
accountBalanceViewerEndpoint: string$2().optional().register(globalRegistry, {
|
|
82697
|
+
description: "Endpoint of the API to use for instantiating an external AccountBalanceViewer",
|
|
82698
|
+
title: "services.accountBalanceViewerEndpoint",
|
|
82699
|
+
type: "string"
|
|
82700
|
+
}),
|
|
82701
|
+
apiEndpoint: string$2().optional().register(globalRegistry, {
|
|
82702
|
+
description: "Endpoint of the API to use for instantiating an external Viewers",
|
|
82703
|
+
title: "services.apiEndpoint",
|
|
82704
|
+
type: "string"
|
|
82705
|
+
})
|
|
82706
|
+
});
|
|
82274
82707
|
var hasMongoConfig = /* @__PURE__ */ __name$k((config) => {
|
|
82275
82708
|
if (isUndefined$1(config)) return false;
|
|
82276
82709
|
return isDefined(config.connectionString) && isDefined(config.database) && isDefined(config.domain) && isDefined(config.password) && isDefined(config.username);
|
|
@@ -82311,6 +82744,23 @@ var StorageConfigZod = object$3({
|
|
|
82311
82744
|
type: "string"
|
|
82312
82745
|
})
|
|
82313
82746
|
}).describe("Storage configuration options");
|
|
82747
|
+
var MetricsScrapeConfigZod = object$3({
|
|
82748
|
+
path: string$2().default("/metrics").register(globalRegistry, {
|
|
82749
|
+
default: "/metrics",
|
|
82750
|
+
description: "Path for the metrics scrape endpoint",
|
|
82751
|
+
title: "telemetry.metrics.scrape.path",
|
|
82752
|
+
type: "string"
|
|
82753
|
+
}),
|
|
82754
|
+
port: number$2().default(9464).register(globalRegistry, {
|
|
82755
|
+
default: 9464,
|
|
82756
|
+
description: "Port for the metrics scrape endpoint",
|
|
82757
|
+
title: "telemetry.metrics.scrape.port",
|
|
82758
|
+
type: "number"
|
|
82759
|
+
})
|
|
82760
|
+
}).describe("Metrics scrape configuration");
|
|
82761
|
+
var MetricsConfigZod = object$3({
|
|
82762
|
+
scrape: MetricsScrapeConfigZod
|
|
82763
|
+
}).describe("Metrics configuration options");
|
|
82314
82764
|
var OpenTelemetryConfigZod = object$3({
|
|
82315
82765
|
// OpenTelemetry options
|
|
82316
82766
|
otlpEndpoint: url().optional().register(globalRegistry, {
|
|
@@ -82320,6 +82770,8 @@ var OpenTelemetryConfigZod = object$3({
|
|
|
82320
82770
|
})
|
|
82321
82771
|
});
|
|
82322
82772
|
var TelemetryConfigZod = object$3({
|
|
82773
|
+
// Metrics configuration
|
|
82774
|
+
metrics: MetricsConfigZod.optional().describe("Metrics configuration"),
|
|
82323
82775
|
// OpenTelemetry configuration
|
|
82324
82776
|
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
82325
82777
|
}).describe("Telemetry configuration options");
|
|
@@ -82353,13 +82805,13 @@ var Xl1CommonConfigSchema = object$3({
|
|
|
82353
82805
|
var ConfigZod = object$3({
|
|
82354
82806
|
...Xl1CommonConfigSchema.shape,
|
|
82355
82807
|
api: ApiConfigZod.default(ApiConfigZod.parse({})).describe("Configuration for the API node"),
|
|
82356
|
-
app: AppConfigZod.default(AppConfigZod.parse({})).describe("Configuration for the application"),
|
|
82357
82808
|
bridge: BridgeConfigZod.default(BridgeConfigZod.parse({})).describe("Configuration for the Bridge node"),
|
|
82358
82809
|
chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe("Configuration for the chain"),
|
|
82359
82810
|
evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe("Configuration for EVM-backed services"),
|
|
82360
82811
|
mempool: MempoolConfigZod.default(MempoolConfigZod.parse({})).describe("Configuration for the mempool"),
|
|
82361
82812
|
producer: ProducerConfigZod.default(ProducerConfigZod.parse({})).describe("Configuration for the producer"),
|
|
82362
82813
|
rewardRedemptionApi: RewardRedemptionApiConfigZod.default(RewardRedemptionApiConfigZod.parse({})).describe("Configuration for the rewards redemption API"),
|
|
82814
|
+
services: ServicesConfigZod.default(ServicesConfigZod.parse({})).describe("Configuration for the global services"),
|
|
82363
82815
|
storage: StorageConfigZod.default(StorageConfigZod.parse({})).describe("Configuration for the storage"),
|
|
82364
82816
|
telemetry: TelemetryConfigZod.default(TelemetryConfigZod.parse({})).describe("Configuration for telemetry"),
|
|
82365
82817
|
validation: ValidationConfigZod.default(ValidationConfigZod.parse({})).describe("Configuration for validation")
|
|
@@ -82457,17 +82909,26 @@ var isChainIndexingServiceState = /* @__PURE__ */ __name$k((payload) => {
|
|
|
82457
82909
|
}, "isChainIndexingServiceState");
|
|
82458
82910
|
var isChainIndexingServiceStateWithStorageMeta = /* @__PURE__ */ __name$k((value) => isChainIndexingServiceState(value) && isStorageMeta(value), "isChainIndexingServiceStateWithStorageMeta");
|
|
82459
82911
|
var asChainIndexingServiceStateWithStorageMeta = AsObjectFactory$1.create(isChainIndexingServiceStateWithStorageMeta);
|
|
82460
|
-
var SimpleAccountBalanceViewer = class {
|
|
82912
|
+
var SimpleAccountBalanceViewer = class extends AbstractCreatable {
|
|
82461
82913
|
static {
|
|
82462
82914
|
__name$k(this, "SimpleAccountBalanceViewer");
|
|
82463
82915
|
}
|
|
82464
|
-
blockViewer
|
|
82465
|
-
|
|
82466
|
-
|
|
82467
|
-
|
|
82468
|
-
this.context
|
|
82469
|
-
|
|
82470
|
-
|
|
82916
|
+
get blockViewer() {
|
|
82917
|
+
return this.params.blockViewer;
|
|
82918
|
+
}
|
|
82919
|
+
get context() {
|
|
82920
|
+
return this.params.context;
|
|
82921
|
+
}
|
|
82922
|
+
get transferContext() {
|
|
82923
|
+
return this.params.transferContext;
|
|
82924
|
+
}
|
|
82925
|
+
static async paramsHandler(params) {
|
|
82926
|
+
assertEx(params.blockViewer, () => "blockViewer is required");
|
|
82927
|
+
assertEx(params.context, () => "context is required");
|
|
82928
|
+
assertEx(params.transferContext, () => "transferContext is required");
|
|
82929
|
+
return {
|
|
82930
|
+
...await super.paramsHandler(params)
|
|
82931
|
+
};
|
|
82471
82932
|
}
|
|
82472
82933
|
async accountBalance(address, headOrRange) {
|
|
82473
82934
|
const balances = await this.accountsBalances([
|
|
@@ -82889,214 +83350,6 @@ var SimpleDataLakeViewer = class {
|
|
|
82889
83350
|
return this._signer;
|
|
82890
83351
|
}
|
|
82891
83352
|
});
|
|
82892
|
-
async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer, nbf, exp, from, fees = defaultTransactionFees) {
|
|
82893
|
-
if (from === void 0 && Array.isArray(signer)) {
|
|
82894
|
-
throw new Error("from is required when signer is an array");
|
|
82895
|
-
}
|
|
82896
|
-
const txBoundWitnessFields = {
|
|
82897
|
-
chain,
|
|
82898
|
-
fees: {
|
|
82899
|
-
base: toHex(fees.base),
|
|
82900
|
-
gasLimit: toHex(fees.gasLimit),
|
|
82901
|
-
gasPrice: toHex(fees.gasPrice),
|
|
82902
|
-
priority: toHex(fees.priority)
|
|
82903
|
-
},
|
|
82904
|
-
nbf,
|
|
82905
|
-
exp
|
|
82906
|
-
};
|
|
82907
|
-
const elevatedHashes = await PayloadBuilder.hashes(onChainPayloads);
|
|
82908
|
-
const script = [];
|
|
82909
|
-
for (const elevatedHash of elevatedHashes) {
|
|
82910
|
-
script.push(`elevate|${elevatedHash}`);
|
|
82911
|
-
}
|
|
82912
|
-
const fields = {
|
|
82913
|
-
...txBoundWitnessFields,
|
|
82914
|
-
from: from ?? (Array.isArray(signer) ? assertEx(signer.at(0)?.address) : signer.address)
|
|
82915
|
-
};
|
|
82916
|
-
if (script.length > 0) {
|
|
82917
|
-
fields.script = script;
|
|
82918
|
-
}
|
|
82919
|
-
const [tx, txPayloads] = await new BoundWitnessBuilder().fields(fields).meta({
|
|
82920
|
-
$signatures: []
|
|
82921
|
-
}).payloads([
|
|
82922
|
-
...onChainPayloads,
|
|
82923
|
-
...offChainPayloads
|
|
82924
|
-
]).signers(Array.isArray(signer) ? signer : [
|
|
82925
|
-
signer
|
|
82926
|
-
]).build();
|
|
82927
|
-
return [
|
|
82928
|
-
await PayloadBuilder.addStorageMeta(tx),
|
|
82929
|
-
await PayloadBuilder.addStorageMeta(txPayloads)
|
|
82930
|
-
];
|
|
82931
|
-
}
|
|
82932
|
-
__name$k(buildTransaction, "buildTransaction");
|
|
82933
|
-
async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads, nbf, exp, from, fees = defaultTransactionFees) {
|
|
82934
|
-
const txBoundWitnessFields = {
|
|
82935
|
-
chain,
|
|
82936
|
-
fees: {
|
|
82937
|
-
base: toHex(fees.base),
|
|
82938
|
-
gasLimit: toHex(fees.gasLimit),
|
|
82939
|
-
gasPrice: toHex(fees.gasPrice),
|
|
82940
|
-
priority: toHex(fees.priority)
|
|
82941
|
-
},
|
|
82942
|
-
nbf,
|
|
82943
|
-
exp
|
|
82944
|
-
};
|
|
82945
|
-
const elevatedHashes = await PayloadBuilder.hashes(onChainPayloads);
|
|
82946
|
-
const script = [];
|
|
82947
|
-
for (const elevatedHash of elevatedHashes) {
|
|
82948
|
-
script.push(`elevate|${elevatedHash}`);
|
|
82949
|
-
}
|
|
82950
|
-
const fields = {
|
|
82951
|
-
...txBoundWitnessFields,
|
|
82952
|
-
from
|
|
82953
|
-
};
|
|
82954
|
-
if (script.length > 0) {
|
|
82955
|
-
fields.script = script;
|
|
82956
|
-
}
|
|
82957
|
-
const [tx, txPayloads] = await new BoundWitnessBuilder().fields(fields).meta({
|
|
82958
|
-
$signatures: []
|
|
82959
|
-
}).payloads([
|
|
82960
|
-
...onChainPayloads,
|
|
82961
|
-
...offChainPayloads
|
|
82962
|
-
]).build();
|
|
82963
|
-
return [
|
|
82964
|
-
tx,
|
|
82965
|
-
txPayloads
|
|
82966
|
-
];
|
|
82967
|
-
}
|
|
82968
|
-
__name$k(buildUnsignedTransaction, "buildUnsignedTransaction");
|
|
82969
|
-
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
82970
|
-
var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
|
|
82971
|
-
var confirmSubmittedTransaction = /* @__PURE__ */ __name$k(async (viewer, txHash, options) => {
|
|
82972
|
-
const { attempts: maxAttempts = DEFAULT_CONFIRMATION_ATTEMPTS, delay: attemptDelay = DEFAULT_DELAY_BETWEEN_ATTEMPTS } = options ?? {};
|
|
82973
|
-
options?.logger?.log("\u{1F680} confirming transaction:", txHash, "\n");
|
|
82974
|
-
let attempts = 0;
|
|
82975
|
-
while (true) {
|
|
82976
|
-
const tx = await viewer.transactionByHash(txHash) ?? void 0;
|
|
82977
|
-
if (isDefined(tx)) {
|
|
82978
|
-
options?.logger?.log("\u2705 Transaction confirmed:", txHash, "\n");
|
|
82979
|
-
return tx;
|
|
82980
|
-
} else {
|
|
82981
|
-
attempts++;
|
|
82982
|
-
if (attempts > maxAttempts) {
|
|
82983
|
-
options?.logger?.error(`\u26A0\uFE0F Transaction not confirmed after ${maxAttempts} attempts`);
|
|
82984
|
-
throw new Error(`Transaction ${txHash} not confirmed after ${maxAttempts} attempts`);
|
|
82985
|
-
} else {
|
|
82986
|
-
options?.logger?.log(`\u{1F504} Transaction not confirmed yet, attempt ${attempts}. Retrying...`, "\n");
|
|
82987
|
-
await delay$1(attemptDelay);
|
|
82988
|
-
}
|
|
82989
|
-
}
|
|
82990
|
-
}
|
|
82991
|
-
}, "confirmSubmittedTransaction");
|
|
82992
|
-
var tryHydrateTransaction = /* @__PURE__ */ __name$k(async ({ chainMap }, hash) => {
|
|
82993
|
-
return await tryHydrateTypedBoundWitness({
|
|
82994
|
-
get(hashes) {
|
|
82995
|
-
return chainMap.getMany(hashes);
|
|
82996
|
-
},
|
|
82997
|
-
next() {
|
|
82998
|
-
throw new Error("Not implemented");
|
|
82999
|
-
}
|
|
83000
|
-
}, hash, isSignedTransactionBoundWitnessWithStorageMeta);
|
|
83001
|
-
}, "tryHydrateTransaction");
|
|
83002
|
-
var flattenHydratedTransaction = /* @__PURE__ */ __name$k((hydratedTransaction) => {
|
|
83003
|
-
const [tx, txPayloads] = hydratedTransaction;
|
|
83004
|
-
return [
|
|
83005
|
-
...txPayloads,
|
|
83006
|
-
tx
|
|
83007
|
-
];
|
|
83008
|
-
}, "flattenHydratedTransaction");
|
|
83009
|
-
var flattenHydratedTransactions = /* @__PURE__ */ __name$k((hydratedTransactions) => hydratedTransactions.flatMap((tx) => flattenHydratedTransaction(tx)), "flattenHydratedTransactions");
|
|
83010
|
-
function transactionBlockByteCount([transaction, payloads]) {
|
|
83011
|
-
const cleanTransaction = PayloadBuilder.omitStorageMeta(transaction);
|
|
83012
|
-
const transactionBytes = JSON.stringify(cleanTransaction).length;
|
|
83013
|
-
const cleanPayloads = PayloadBuilder.omitStorageMeta(payloads);
|
|
83014
|
-
return cleanPayloads.reduce((acc, payload) => acc + JSON.stringify(payload).length, 0) + transactionBytes;
|
|
83015
|
-
}
|
|
83016
|
-
__name$k(transactionBlockByteCount, "transactionBlockByteCount");
|
|
83017
|
-
|
|
83018
|
-
// src/transaction/primitives/transactionOperations.ts
|
|
83019
|
-
function crackOperation(operation) {
|
|
83020
|
-
const parts = operation.split("|");
|
|
83021
|
-
if (parts.length < 2) {
|
|
83022
|
-
throw new Error(`Invalid operation format: ${operation}`);
|
|
83023
|
-
}
|
|
83024
|
-
return [
|
|
83025
|
-
parts[0],
|
|
83026
|
-
parts.slice(1)
|
|
83027
|
-
];
|
|
83028
|
-
}
|
|
83029
|
-
__name$k(crackOperation, "crackOperation");
|
|
83030
|
-
function crackOperations(operations) {
|
|
83031
|
-
return operations.map((op) => crackOperation(op));
|
|
83032
|
-
}
|
|
83033
|
-
__name$k(crackOperations, "crackOperations");
|
|
83034
|
-
|
|
83035
|
-
// src/transaction/primitives/transactionElevatedPayloads.ts
|
|
83036
|
-
function transactionElevatedPayloadHashes(transaction) {
|
|
83037
|
-
const elevateOperations = crackOperations(transaction.script ?? []).filter((op) => op[0] === "elevate");
|
|
83038
|
-
return elevateOperations.map((op) => asHash(op[1][0], true));
|
|
83039
|
-
}
|
|
83040
|
-
__name$k(transactionElevatedPayloadHashes, "transactionElevatedPayloadHashes");
|
|
83041
|
-
function transactionElevatedPayloads([transaction, payloads]) {
|
|
83042
|
-
const hashes = transactionElevatedPayloadHashes(transaction);
|
|
83043
|
-
const elevatedPayloads2 = payloads.filter((payload) => hashes.includes(payload._hash));
|
|
83044
|
-
return elevatedPayloads2;
|
|
83045
|
-
}
|
|
83046
|
-
__name$k(transactionElevatedPayloads, "transactionElevatedPayloads");
|
|
83047
|
-
function transactionBytesRequiredGas([transaction, payloads]) {
|
|
83048
|
-
const transactionBlockBytes = transactionBlockByteCount([
|
|
83049
|
-
transaction,
|
|
83050
|
-
payloads
|
|
83051
|
-
]);
|
|
83052
|
-
return AttoXL1(TransactionGasCosts.characterStorage * BigInt(transactionBlockBytes));
|
|
83053
|
-
}
|
|
83054
|
-
__name$k(transactionBytesRequiredGas, "transactionBytesRequiredGas");
|
|
83055
|
-
function transactionRequiredGas(hydratedTransaction) {
|
|
83056
|
-
const elevatedPayloads2 = transactionElevatedPayloads(hydratedTransaction);
|
|
83057
|
-
const hashes = elevatedPayloads2.length + 1;
|
|
83058
|
-
const signatures = hydratedTransaction[0].addresses.length;
|
|
83059
|
-
return AttoXL1(transactionBytesRequiredGas(hydratedTransaction) + TransactionGasCosts.hashValidation * BigInt(hashes) + TransactionGasCosts.signatureValidation * BigInt(signatures) + TransactionGasCosts.payloadValidation * BigInt(elevatedPayloads2.length));
|
|
83060
|
-
}
|
|
83061
|
-
__name$k(transactionRequiredGas, "transactionRequiredGas");
|
|
83062
|
-
var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name$k((strings) => {
|
|
83063
|
-
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
83064
|
-
return filterAs(hashes, (h) => asHash(h));
|
|
83065
|
-
}, "tryExtractElevatedHashesFromScript");
|
|
83066
|
-
var tryExtractElevatedHashes = /* @__PURE__ */ __name$k((tx) => {
|
|
83067
|
-
const [bw, payloads] = tx;
|
|
83068
|
-
const { script } = bw;
|
|
83069
|
-
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
83070
|
-
return payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
83071
|
-
}, "tryExtractElevatedHashes");
|
|
83072
|
-
var extractElevatedHashes = /* @__PURE__ */ __name$k((tx) => {
|
|
83073
|
-
const [bw, payloads] = tx;
|
|
83074
|
-
const { script } = bw;
|
|
83075
|
-
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
83076
|
-
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
83077
|
-
assertEx(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
83078
|
-
return filtered;
|
|
83079
|
-
}, "extractElevatedHashes");
|
|
83080
|
-
async function signTransaction(tx, account) {
|
|
83081
|
-
assertEx(tx.from === account.address, () => "Signer address does not match transaction from address");
|
|
83082
|
-
const signedTx = structuredClone(tx);
|
|
83083
|
-
signedTx.addresses = [
|
|
83084
|
-
account.address
|
|
83085
|
-
];
|
|
83086
|
-
signedTx.previous_hashes = [
|
|
83087
|
-
account.previousHash ?? null
|
|
83088
|
-
];
|
|
83089
|
-
const hash = await PayloadBuilder.dataHash(signedTx);
|
|
83090
|
-
const hashBytes = toArrayBuffer(hash);
|
|
83091
|
-
const [signature] = await account.sign(hashBytes);
|
|
83092
|
-
signedTx.$signatures = [
|
|
83093
|
-
hexFromArrayBuffer(signature)
|
|
83094
|
-
];
|
|
83095
|
-
return signedTx;
|
|
83096
|
-
}
|
|
83097
|
-
__name$k(signTransaction, "signTransaction");
|
|
83098
|
-
|
|
83099
|
-
// src/simple/gateway/SimpleXyoGatewayRunner.ts
|
|
83100
83353
|
var SimpleXyoGatewayRunner = class {
|
|
83101
83354
|
static {
|
|
83102
83355
|
__name$k(this, "SimpleXyoGatewayRunner");
|
|
@@ -83128,8 +83381,8 @@ var SimpleXyoGatewayRunner = class {
|
|
|
83128
83381
|
const viewer = assertEx(this.connectionInstance.viewer, () => "No viewer available on connection");
|
|
83129
83382
|
const { nbf, exp, chain, fees } = options ?? {};
|
|
83130
83383
|
const resolvedChainId = isDefined(chain) ? chain : await viewer.chainId();
|
|
83131
|
-
const resolvedNbf = isDefined(nbf) ? nbf : await viewer
|
|
83132
|
-
const resolvedExp = isDefined(exp) ? exp : resolvedNbf + 10;
|
|
83384
|
+
const resolvedNbf = asXL1BlockNumber(isDefined(nbf) ? nbf : await viewer.currentBlockNumber(), true);
|
|
83385
|
+
const resolvedExp = asXL1BlockNumber(isDefined(exp) ? exp : resolvedNbf + 10, true);
|
|
83133
83386
|
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await (await this.signer()).address(), fees);
|
|
83134
83387
|
return await this.addTransactionToChain(tx);
|
|
83135
83388
|
}
|
|
@@ -83384,10 +83637,10 @@ var SimpleXyoSigner = class {
|
|
|
83384
83637
|
}
|
|
83385
83638
|
async signTransaction(tx) {
|
|
83386
83639
|
const txBW = await signTransaction(tx[0], this._account);
|
|
83387
|
-
return [
|
|
83640
|
+
return SignedHydratedTransactionWithHashMetaZod.parse([
|
|
83388
83641
|
await PayloadBuilder.addStorageMeta(txBW),
|
|
83389
83642
|
await PayloadBuilder.addStorageMeta(tx[1])
|
|
83390
|
-
];
|
|
83643
|
+
]);
|
|
83391
83644
|
}
|
|
83392
83645
|
};
|
|
83393
83646
|
var SimpleTimeSyncViewer = class {
|
|
@@ -83496,269 +83749,16 @@ async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
|
83496
83749
|
return assertEx(timePayload.ethereum, () => "No ethereum timestamp found on block");
|
|
83497
83750
|
}
|
|
83498
83751
|
__name$k(xl1BlockNumberToEthBlockNumber, "xl1BlockNumberToEthBlockNumber");
|
|
83499
|
-
function base64Encode(u8) {
|
|
83500
|
-
if (typeof Buffer !== "undefined" && typeof Buffer.from === "function") {
|
|
83501
|
-
return Buffer.from(u8).toString("base64");
|
|
83502
|
-
}
|
|
83503
|
-
let binary = "";
|
|
83504
|
-
const chunk = 32768;
|
|
83505
|
-
for (let i = 0; i < u8.length; i += chunk) {
|
|
83506
|
-
binary += String.fromCharCode(...u8.subarray(i, i + chunk));
|
|
83507
|
-
}
|
|
83508
|
-
return btoa(binary);
|
|
83509
|
-
}
|
|
83510
|
-
__name$k(base64Encode, "base64Encode");
|
|
83511
|
-
function base64Decode(b64) {
|
|
83512
|
-
if (typeof Buffer !== "undefined" && typeof Buffer.from === "function") {
|
|
83513
|
-
return new Uint8Array(Buffer.from(b64, "base64"));
|
|
83514
|
-
}
|
|
83515
|
-
const binary = atob(b64);
|
|
83516
|
-
const u8 = new Uint8Array(binary.length);
|
|
83517
|
-
for (let i = 0; i < binary.length; i++) u8[i] = binary.charCodeAt(i);
|
|
83518
|
-
return u8;
|
|
83519
|
-
}
|
|
83520
|
-
__name$k(base64Decode, "base64Decode");
|
|
83521
|
-
var ArrayBufferToJsonZod = _instanceof(ArrayBuffer).transform((x) => {
|
|
83522
|
-
const u8 = new Uint8Array(x);
|
|
83523
|
-
return base64Encode(u8);
|
|
83524
|
-
});
|
|
83525
|
-
var JsonToArrayBufferZod = string$2().transform((x) => {
|
|
83526
|
-
const u8 = base64Decode(x);
|
|
83527
|
-
return u8.buffer;
|
|
83528
|
-
});
|
|
83529
|
-
var BoundWitnessRequiredFieldsZod = object$3({
|
|
83530
|
-
addresses: array$1(AddressZod),
|
|
83531
|
-
payload_hashes: array$1(HashZod),
|
|
83532
|
-
payload_schemas: array$1(SchemaZod),
|
|
83533
|
-
previous_hashes: array$1(HashZod.nullable())
|
|
83534
|
-
});
|
|
83535
|
-
var BoundWitnessMetaZod = object$3({
|
|
83536
|
-
$destination: AddressZod.optional(),
|
|
83537
|
-
$sourceQuery: HashZod.optional(),
|
|
83538
|
-
$signatures: array$1(union$1([
|
|
83539
|
-
HexZod,
|
|
83540
|
-
_null$1()
|
|
83541
|
-
]))
|
|
83542
|
-
});
|
|
83543
|
-
var BoundWitnessZod = PayloadZod.extend({
|
|
83544
|
-
schema: literal$2(BoundWitnessSchema)
|
|
83545
|
-
}).extend(BoundWitnessRequiredFieldsZod.shape).extend(BoundWitnessMetaZod.shape).refine((data) => data.$signatures.length === data.addresses.length, {
|
|
83546
|
-
message: "$signatures length must equal addresses length"
|
|
83547
|
-
});
|
|
83548
|
-
BoundWitnessZod.catchall(any$1());
|
|
83549
|
-
var UnsignedBoundWitnessZod = BoundWitnessZod.refine((data) => data.$signatures.includes(null), {
|
|
83550
|
-
message: "all $signatures must be null"
|
|
83551
|
-
});
|
|
83552
|
-
UnsignedBoundWitnessZod.catchall(any$1());
|
|
83553
|
-
var UnsignedBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessZod.safeExtend(BoundWitnessRequiredFieldsZod.shape).safeExtend(BoundWitnessMetaZod.shape).safeExtend(StorageMetaZod.shape);
|
|
83554
|
-
var SignedBoundWitnessZod = BoundWitnessZod.refine((data) => !data.$signatures.includes(null), {
|
|
83555
|
-
message: "all $signatures must not be null"
|
|
83556
|
-
});
|
|
83557
|
-
UnsignedBoundWitnessZod.catchall(any$1());
|
|
83558
|
-
UnsignedBoundWitnessWithStorageMetaZod.catchall(any$1());
|
|
83559
|
-
var ChainZod = string$2().toLowerCase().regex(AddressRegEx).transform((v) => toAddress(v));
|
|
83560
|
-
|
|
83561
|
-
// src/zod/BlockBoundWitness.ts
|
|
83562
|
-
var BlockBoundWitnessFieldsZod = object$3({
|
|
83563
|
-
block: XL1BlockNumberZod,
|
|
83564
|
-
chain: ChainZod,
|
|
83565
|
-
previous: HashZod.nullable(),
|
|
83566
|
-
protocol: number$3(),
|
|
83567
|
-
step_hashes: array$1(HashZod).optional()
|
|
83568
|
-
});
|
|
83569
|
-
var BlockBoundWitnessMetaZod = object$3({
|
|
83570
|
-
$epoch: number$3()
|
|
83571
|
-
});
|
|
83572
|
-
var BlockBoundWitnessZod = UnsignedBoundWitnessZod.merge(StorageMetaZod.partial()).merge(BlockBoundWitnessFieldsZod).merge(BlockBoundWitnessMetaZod);
|
|
83573
|
-
var SignedBlockBoundWitnessZod = SignedBoundWitnessZod.merge(StorageMetaZod.partial()).merge(BlockBoundWitnessFieldsZod).merge(BlockBoundWitnessMetaZod);
|
|
83574
|
-
tuple([
|
|
83575
|
-
BlockBoundWitnessZod,
|
|
83576
|
-
array$1(PayloadZodLoose)
|
|
83577
|
-
]);
|
|
83578
|
-
tuple([
|
|
83579
|
-
WithStorageMetaZod(BlockBoundWitnessZod),
|
|
83580
|
-
array$1(WithStorageMetaZod(PayloadZodLoose))
|
|
83581
|
-
]);
|
|
83582
|
-
var SignedHydratedBlockZod = tuple([
|
|
83583
|
-
SignedBlockBoundWitnessZod,
|
|
83584
|
-
array$1(PayloadZodLoose)
|
|
83585
|
-
]);
|
|
83586
|
-
tuple([
|
|
83587
|
-
SignedBlockBoundWitnessZod,
|
|
83588
|
-
array$1(PayloadZodLoose)
|
|
83589
|
-
]);
|
|
83590
|
-
tuple([
|
|
83591
|
-
WithStorageMetaZod(SignedBlockBoundWitnessZod),
|
|
83592
|
-
array$1(WithStorageMetaZod(PayloadZodLoose))
|
|
83593
|
-
]);
|
|
83594
|
-
var AttoZod = bigint$1();
|
|
83595
|
-
var JsonToAttoZod = JsonToBigIntZod.transform((v) => asAttoXL1(v));
|
|
83596
|
-
var AttoToJsonZod = BigIntToJsonZod;
|
|
83597
|
-
var TransactionFeesHexZod = object$3({
|
|
83598
|
-
base: HexZod,
|
|
83599
|
-
gasLimit: HexZod,
|
|
83600
|
-
gasPrice: HexZod,
|
|
83601
|
-
priority: HexZod
|
|
83602
|
-
});
|
|
83603
|
-
var TransactionFeesBigIntZod = object$3({
|
|
83604
|
-
base: AttoZod,
|
|
83605
|
-
gasLimit: AttoZod,
|
|
83606
|
-
gasPrice: AttoZod,
|
|
83607
|
-
priority: AttoZod
|
|
83608
|
-
});
|
|
83609
|
-
TransactionFeesHexZod.transform((val) => ({
|
|
83610
|
-
base: JsonToBigIntZod.parse(val.base),
|
|
83611
|
-
gasLimit: JsonToBigIntZod.parse(val.gasLimit),
|
|
83612
|
-
gasPrice: JsonToBigIntZod.parse(val.gasPrice),
|
|
83613
|
-
priority: JsonToBigIntZod.parse(val.priority)
|
|
83614
|
-
}));
|
|
83615
|
-
TransactionFeesBigIntZod.transform((val) => ({
|
|
83616
|
-
base: BigIntToJsonZod.parse(val.base),
|
|
83617
|
-
gasLimit: BigIntToJsonZod.parse(val.gasLimit),
|
|
83618
|
-
gasPrice: BigIntToJsonZod.parse(val.gasPrice),
|
|
83619
|
-
priority: BigIntToJsonZod.parse(val.priority)
|
|
83620
|
-
}));
|
|
83621
|
-
|
|
83622
|
-
// src/zod/TransactionBoundWitness.ts
|
|
83623
|
-
object$3({
|
|
83624
|
-
nbf: BlockNumberZod
|
|
83625
|
-
});
|
|
83626
|
-
object$3({
|
|
83627
|
-
exp: BlockNumberZod
|
|
83628
|
-
});
|
|
83629
|
-
var BlockDurationZod = object$3({
|
|
83630
|
-
nbf: BlockNumberZod,
|
|
83631
|
-
exp: BlockNumberZod
|
|
83632
|
-
});
|
|
83633
|
-
var BlockScriptsZod = object$3({
|
|
83634
|
-
script: array$1(string$2()).optional()
|
|
83635
|
-
});
|
|
83636
|
-
var WithTransactionFeesZod = object$3({
|
|
83637
|
-
fees: TransactionFeesHexZod
|
|
83638
|
-
});
|
|
83639
|
-
var TransactionBoundWitnessFields = object$3({
|
|
83640
|
-
chain: ChainZod,
|
|
83641
|
-
from: ChainZod
|
|
83642
|
-
});
|
|
83643
|
-
var TransactionBoundWitnessZod = UnsignedBoundWitnessZod.merge(StorageMetaZod.partial()).merge(BlockDurationZod).merge(WithTransactionFeesZod).merge(TransactionBoundWitnessFields).merge(BlockScriptsZod);
|
|
83644
|
-
var SignedTransactionBoundWitnessZod = SignedBoundWitnessZod.merge(StorageMetaZod.partial()).merge(BlockDurationZod).merge(WithTransactionFeesZod).merge(TransactionBoundWitnessFields).merge(BlockScriptsZod.partial());
|
|
83645
|
-
|
|
83646
|
-
// src/zod/HydratedTransaction.ts
|
|
83647
|
-
tuple([
|
|
83648
|
-
TransactionBoundWitnessZod,
|
|
83649
|
-
array$1(PayloadZodLoose)
|
|
83650
|
-
]);
|
|
83651
|
-
var UnsignedHydratedTransactionZod = tuple([
|
|
83652
|
-
TransactionBoundWitnessZod,
|
|
83653
|
-
array$1(PayloadZodLoose)
|
|
83654
|
-
]);
|
|
83655
|
-
var SignedHydratedTransactionZod = tuple([
|
|
83656
|
-
SignedTransactionBoundWitnessZod,
|
|
83657
|
-
array$1(PayloadZodLoose)
|
|
83658
|
-
]);
|
|
83659
|
-
SignedHydratedTransactionZod.transform(([tx, payloads]) => asSignedHydratedTransaction([
|
|
83660
|
-
tx,
|
|
83661
|
-
payloads.map((payload) => payload)
|
|
83662
|
-
]));
|
|
83663
|
-
SignedHydratedTransactionZod.transform(([tx, payloads]) => [
|
|
83664
|
-
asSignedHydratedTransaction(tx),
|
|
83665
|
-
payloads.map((p) => asAnyPayload(p))
|
|
83666
|
-
]);
|
|
83667
|
-
var CaveatTypesZod = _enum$1([
|
|
83668
|
-
"chain",
|
|
83669
|
-
"expiration",
|
|
83670
|
-
"filteredResponse",
|
|
83671
|
-
"rateLimit",
|
|
83672
|
-
"restrictReturnedAccounts"
|
|
83673
|
-
]);
|
|
83674
|
-
var CaveatsZod = object$3({
|
|
83675
|
-
type: CaveatTypesZod,
|
|
83676
|
-
value: json$3()
|
|
83677
|
-
});
|
|
83678
|
-
var PermissionZod = object$3({
|
|
83679
|
-
parentCapability: string$2(),
|
|
83680
|
-
caveats: CaveatsZod.array().optional(),
|
|
83681
|
-
invoker: string$2()
|
|
83682
|
-
});
|
|
83683
|
-
var InvokerPermissionZod = PermissionZod.extend({
|
|
83684
|
-
date: number$3().optional()
|
|
83685
|
-
});
|
|
83686
|
-
var PermissionRequestZod = record$1(string$2(), record$1(string$2(), any$1()));
|
|
83687
|
-
var RequestedPermissionZod = object$3({
|
|
83688
|
-
parentCapability: string$2(),
|
|
83689
|
-
date: number$3().optional()
|
|
83690
|
-
});
|
|
83691
|
-
var RewardsRangeOptionsZod = object$3({
|
|
83692
|
-
positions: array$1(number$3()).optional(),
|
|
83693
|
-
range: BlockRangeZod.optional(),
|
|
83694
|
-
steps: array$1(StepIdentityZod).optional(),
|
|
83695
|
-
stakers: array$1(AddressZod).optional()
|
|
83696
|
-
});
|
|
83697
|
-
var LocalSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.localSequenceBytes, SequenceConstants.localSequenceBytes));
|
|
83698
|
-
var LocalSequenceToStringZod = string$2().regex(LocalSequenceRegex);
|
|
83699
|
-
var LocalSequenceFromStringZod = string$2().regex(LocalSequenceRegex).transform((v) => toHex(v));
|
|
83700
|
-
var QualifiedSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.qualifiedSequenceBytes, SequenceConstants.qualifiedSequenceBytes));
|
|
83701
|
-
var QualifiedSequenceToStringZod = string$2().regex(QualifiedSequenceRegex);
|
|
83702
|
-
var QualifiedSequenceFromStringZod = string$2().regex(QualifiedSequenceRegex).transform((v) => toHex(v));
|
|
83703
|
-
union$1([
|
|
83704
|
-
LocalSequenceToStringZod,
|
|
83705
|
-
QualifiedSequenceToStringZod
|
|
83706
|
-
]);
|
|
83707
|
-
union$1([
|
|
83708
|
-
LocalSequenceFromStringZod,
|
|
83709
|
-
QualifiedSequenceFromStringZod
|
|
83710
|
-
]);
|
|
83711
|
-
var StakeZod = object$3({
|
|
83712
|
-
amount: AttoZod,
|
|
83713
|
-
// the block number when the stake was added
|
|
83714
|
-
addBlock: number$3(),
|
|
83715
|
-
// the unique id for the stake item
|
|
83716
|
-
id: number$3(),
|
|
83717
|
-
// the block number when the stake was removed (set to 0 if not removed)
|
|
83718
|
-
removeBlock: number$3(),
|
|
83719
|
-
// the address that is being staked
|
|
83720
|
-
staked: AddressZod,
|
|
83721
|
-
// the address that owns the stake
|
|
83722
|
-
staker: AddressZod,
|
|
83723
|
-
// the block number when the stake was withdrawn (set to 0 if not withdrawn)
|
|
83724
|
-
withdrawBlock: number$3()
|
|
83725
|
-
});
|
|
83726
|
-
var StakeToJsonZod = StakeZod.transform((val) => ({
|
|
83727
|
-
addBlock: val.addBlock,
|
|
83728
|
-
amount: AttoToJsonZod.parse(val.amount),
|
|
83729
|
-
id: val.id,
|
|
83730
|
-
removeBlock: val.removeBlock,
|
|
83731
|
-
staked: AddressZod.parse(val.staked),
|
|
83732
|
-
staker: AddressZod.parse(val.staker),
|
|
83733
|
-
withdrawBlock: val.withdrawBlock
|
|
83734
|
-
}));
|
|
83735
|
-
var JsonToStakeZod = StakeZod.extend({
|
|
83736
|
-
amount: HexZod
|
|
83737
|
-
}).transform((val) => ({
|
|
83738
|
-
addBlock: val.addBlock,
|
|
83739
|
-
amount: JsonToAttoZod.parse(val.amount),
|
|
83740
|
-
id: val.id,
|
|
83741
|
-
removeBlock: val.removeBlock,
|
|
83742
|
-
staked: val.staked,
|
|
83743
|
-
staker: val.staker,
|
|
83744
|
-
withdrawBlock: val.withdrawBlock
|
|
83745
|
-
}));
|
|
83746
|
-
var TimeDomainZod = union$1([
|
|
83747
|
-
literal$2("xl1"),
|
|
83748
|
-
literal$2("epoch"),
|
|
83749
|
-
literal$2("ethereum")
|
|
83750
|
-
]);
|
|
83751
|
-
var TransferPairZod = z.tuple([
|
|
83752
|
-
AddressZod,
|
|
83753
|
-
AddressZod
|
|
83754
|
-
]);
|
|
83755
|
-
|
|
83756
|
-
// src/viewers/AccountBalance.ts
|
|
83757
83752
|
var AccountBalanceHistoryItemZod = z.tuple([
|
|
83758
83753
|
WithHashMetaZod(BlockBoundWitnessZod),
|
|
83759
83754
|
WithHashMetaZod(TransactionBoundWitnessZod).nullable(),
|
|
83760
83755
|
WithHashMetaZod(TransferZod)
|
|
83761
83756
|
]);
|
|
83757
|
+
var PendingTransactionsOptionsZod = z.object({
|
|
83758
|
+
cursor: HashZod.optional(),
|
|
83759
|
+
limit: z.number().int().positive().optional(),
|
|
83760
|
+
window: XL1BlockRangeZod.optional()
|
|
83761
|
+
});
|
|
83762
83762
|
|
|
83763
83763
|
// src/wallet/paths.ts
|
|
83764
83764
|
var WALLET_COMPLIANCE = "44'";
|
|
@@ -84265,7 +84265,7 @@ async function buildNextBlock(previousBlock, txs, blockPayloads, signers, chainS
|
|
|
84265
84265
|
return await buildBlock({
|
|
84266
84266
|
chainId: previousBlock.chain,
|
|
84267
84267
|
previousBlockNumber: previousBlock.block,
|
|
84268
|
-
previousStepHashes: previousBlock.step_hashes,
|
|
84268
|
+
previousStepHashes: previousBlock.step_hashes ?? [],
|
|
84269
84269
|
previousBlockHash: previousBlock._hash,
|
|
84270
84270
|
txs,
|
|
84271
84271
|
blockPayloads,
|
|
@@ -84293,14 +84293,14 @@ __name$j(buildNextBlock, "buildNextBlock");
|
|
|
84293
84293
|
const chain = assertEx(this._chain, () => "Chain must be set before building the transaction");
|
|
84294
84294
|
const fees = assertEx(this._fees, () => "Fees must be set before building the transaction");
|
|
84295
84295
|
const blockRange = assertEx(this._blockRange, () => "Block range must be set before building the transaction");
|
|
84296
|
-
return await buildTransaction(chain, this._elevatedPayloads, this._payloads, this._signers, blockRange[0], blockRange[1], this._signers[0]?.address, fees);
|
|
84296
|
+
return await buildTransaction(chain, this._elevatedPayloads, this._payloads, this._signers, asXL1BlockNumber(blockRange[0], true), asXL1BlockNumber(blockRange[1], true), this._signers[0]?.address, fees);
|
|
84297
84297
|
}
|
|
84298
84298
|
chain(chain) {
|
|
84299
84299
|
this._chain = chain;
|
|
84300
84300
|
return this;
|
|
84301
84301
|
}
|
|
84302
84302
|
async dryRun() {
|
|
84303
|
-
return await buildTransaction(XYO_ZERO_ADDRESS, this._elevatedPayloads, this._payloads, this._signers, 0, 1e3, this._signers[0]?.address, defaultTransactionFees);
|
|
84303
|
+
return await buildTransaction(XYO_ZERO_ADDRESS, this._elevatedPayloads, this._payloads, this._signers, asXL1BlockNumber(0, true), asXL1BlockNumber(1e3, true), this._signers[0]?.address, defaultTransactionFees);
|
|
84304
84304
|
}
|
|
84305
84305
|
elevatedPayload(payload) {
|
|
84306
84306
|
const allowedPayload = isAllowedBlockPayload(payload) ? payload : void 0;
|
|
@@ -84384,19 +84384,19 @@ __name$j(buildNextBlock, "buildNextBlock");
|
|
|
84384
84384
|
}
|
|
84385
84385
|
});
|
|
84386
84386
|
assertEx(asAddress("c5fe2e6F6841Cbab12d8C0618Be2DF8C6156cC44"));
|
|
84387
|
-
function createProducerChainStakeIntent(from, exp, nbf = 0) {
|
|
84388
|
-
return new PayloadBuilder({
|
|
84387
|
+
async function createProducerChainStakeIntent(from, exp, nbf = 0) {
|
|
84388
|
+
return await PayloadBuilder.addHashMeta(new PayloadBuilder({
|
|
84389
84389
|
schema: ChainStakeIntentSchema
|
|
84390
84390
|
}).fields({
|
|
84391
84391
|
from,
|
|
84392
84392
|
exp,
|
|
84393
84393
|
nbf,
|
|
84394
84394
|
intent: "producer"
|
|
84395
|
-
}).build();
|
|
84395
|
+
}).build());
|
|
84396
84396
|
}
|
|
84397
84397
|
__name$j(createProducerChainStakeIntent, "createProducerChainStakeIntent");
|
|
84398
|
-
async function createProducerChainStakeIntentTransaction(chain, signers = [], producer, exp, nbf = 0, fees = defaultTransactionFees) {
|
|
84399
|
-
const intent = createProducerChainStakeIntent(producer, exp, nbf);
|
|
84398
|
+
async function createProducerChainStakeIntentTransaction(chain, signers = [], producer, exp, nbf = asXL1BlockNumber(0, true), fees = defaultTransactionFees) {
|
|
84399
|
+
const intent = await createProducerChainStakeIntent(producer, exp, nbf);
|
|
84400
84400
|
const tx = await buildTransaction(chain, [
|
|
84401
84401
|
intent
|
|
84402
84402
|
], [], signers, nbf, exp, signers[0].address, fees);
|
|
@@ -84406,7 +84406,7 @@ __name$j(createProducerChainStakeIntentTransaction, "createProducerChainStakeInt
|
|
|
84406
84406
|
|
|
84407
84407
|
// src/block/createGenesisBlock.ts
|
|
84408
84408
|
var createGenesisBlock = /* @__PURE__ */ __name$j(async (initialBlockProducer, nextContractAddress, genesisBlockRewardAmount, genesisBlockRewardAddress) => {
|
|
84409
|
-
const blockPayloads = [
|
|
84409
|
+
const blockPayloads = await PayloadBuilder.addHashMeta([
|
|
84410
84410
|
TransferPayloadJsonSchemaPayload,
|
|
84411
84411
|
BlockBoundWitnessSchemaPayload,
|
|
84412
84412
|
BlockBoundWitnessWithStorageMetaSchemaPayload,
|
|
@@ -84414,13 +84414,13 @@ var createGenesisBlock = /* @__PURE__ */ __name$j(async (initialBlockProducer, n
|
|
|
84414
84414
|
TransactionBoundWitnessWithStorageMetaSchemaPayload,
|
|
84415
84415
|
ChainStakeIntentPayloadJsonSchemaPayload,
|
|
84416
84416
|
HashPayloadJsonSchemaPayload
|
|
84417
|
-
];
|
|
84418
|
-
const intentPayload = createProducerChainStakeIntent(initialBlockProducer.address, 1, 0);
|
|
84417
|
+
]);
|
|
84418
|
+
const intentPayload = await createProducerChainStakeIntent(initialBlockProducer.address, 1, 0);
|
|
84419
84419
|
blockPayloads.push(intentPayload);
|
|
84420
84420
|
if (genesisBlockRewardAmount > 0n) {
|
|
84421
|
-
blockPayloads.push(createTransferPayload(nextContractAddress, {
|
|
84421
|
+
blockPayloads.push(await PayloadBuilder.addHashMeta(createTransferPayload(nextContractAddress, {
|
|
84422
84422
|
[genesisBlockRewardAddress]: genesisBlockRewardAmount
|
|
84423
|
-
}));
|
|
84423
|
+
})));
|
|
84424
84424
|
}
|
|
84425
84425
|
return await buildGenesisBlock(nextContractAddress, [], blockPayloads, [
|
|
84426
84426
|
initialBlockProducer
|
|
@@ -84657,12 +84657,12 @@ async function frameList(block, archivist) {
|
|
|
84657
84657
|
let blockToCheck = block;
|
|
84658
84658
|
const stepHashes = [];
|
|
84659
84659
|
while (blockToCheck) {
|
|
84660
|
-
let stepHash = blockToCheck.step_hashes
|
|
84660
|
+
let stepHash = blockToCheck.step_hashes?.at(stepIndex);
|
|
84661
84661
|
if (stepHash === void 0) {
|
|
84662
84662
|
break;
|
|
84663
84663
|
} else {
|
|
84664
84664
|
for (const [i, brk] of breaks.entries()) {
|
|
84665
|
-
if (brk === blockToCheck.step_hashes
|
|
84665
|
+
if (brk === blockToCheck.step_hashes?.at(i)) {
|
|
84666
84666
|
break;
|
|
84667
84667
|
}
|
|
84668
84668
|
}
|
|
@@ -84744,7 +84744,7 @@ var findMostRecentBlock = /* @__PURE__ */ __name$j(async (chainArchivist, nextOp
|
|
|
84744
84744
|
order: "desc",
|
|
84745
84745
|
cursor
|
|
84746
84746
|
});
|
|
84747
|
-
const blocks = batch.filter(
|
|
84747
|
+
const blocks = batch.filter(isSignedBlockBoundWitnessWithStorageMeta);
|
|
84748
84748
|
const last = blocks?.at(0);
|
|
84749
84749
|
if (last) {
|
|
84750
84750
|
mostRecentBlock = last;
|
|
@@ -85162,7 +85162,7 @@ var analyzeChain = /* @__PURE__ */ __name$i(async (store, handlers, head, previo
|
|
|
85162
85162
|
let maxDepthLimit = maxDepth === -1n ? BigInt(Number.MAX_SAFE_INTEGER) : maxDepth;
|
|
85163
85163
|
let cursor = typeof head === "string" ? await hydrateBlock(store, head) : head;
|
|
85164
85164
|
logger?.log("analyzeChain.cursor", cursor?.[0].block);
|
|
85165
|
-
if (previousHead !== null && cursor[0]._hash === previousHead) return [];
|
|
85165
|
+
if (previousHead !== null && cursor?.[0]._hash === previousHead) return [];
|
|
85166
85166
|
while (cursor && maxDepthLimit > 0n) {
|
|
85167
85167
|
maxDepthLimit -= 1n;
|
|
85168
85168
|
await analyzeBlock(cursor, handlers);
|
|
@@ -85187,7 +85187,6 @@ var analyzeChain = /* @__PURE__ */ __name$i(async (store, handlers, head, previo
|
|
|
85187
85187
|
}, tracer), () => "analyzeChain failed");
|
|
85188
85188
|
}, "analyzeChain");
|
|
85189
85189
|
var ChainSummaryBalancesSchema = "network.xyo.chain.summary.balances";
|
|
85190
|
-
var isChainSummaryBalances = isPayloadOfSchemaType(ChainSummaryBalancesSchema);
|
|
85191
85190
|
|
|
85192
85191
|
// src/BalanceAnalyzer/BalanceAnalyzer.ts
|
|
85193
85192
|
var bigintBalances = /* @__PURE__ */ __name$i((balances) => {
|
|
@@ -85271,7 +85270,7 @@ var ChainFinalizer = class extends Base {
|
|
|
85271
85270
|
}
|
|
85272
85271
|
async finalizeBlock(hash) {
|
|
85273
85272
|
return await spanRootAsync("finalizeBlock", async () => {
|
|
85274
|
-
const blockToFinalize = assertEx(
|
|
85273
|
+
const blockToFinalize = assertEx(asSignedBlockBoundWitnessWithStorageMeta((await this.chainArchivist.get([
|
|
85275
85274
|
hash
|
|
85276
85275
|
]))[0], () => `Block not found [${hash}]`));
|
|
85277
85276
|
const blockNumberToFinalize = blockToFinalize.block;
|
|
@@ -85292,7 +85291,7 @@ var ChainFinalizer = class extends Base {
|
|
|
85292
85291
|
this.finalizedBlockNumber = blockNumberToFinalize;
|
|
85293
85292
|
return;
|
|
85294
85293
|
} else {
|
|
85295
|
-
blockToCheck = assertEx(
|
|
85294
|
+
blockToCheck = assertEx(asSignedBlockBoundWitnessWithStorageMeta((await this.chainArchivist.get([
|
|
85296
85295
|
blockToCheck.previous
|
|
85297
85296
|
]))[0], () => `Block not found [${hash}]`));
|
|
85298
85297
|
const newBlockNumber = blockToCheck.block;
|
|
@@ -85408,7 +85407,7 @@ var ChainHeadSelector = class extends ChainFinalizer {
|
|
|
85408
85407
|
open: true
|
|
85409
85408
|
});
|
|
85410
85409
|
while (results.length > 0) {
|
|
85411
|
-
const blocks = results.filter(
|
|
85410
|
+
const blocks = results.filter(isSignedBlockBoundWitnessWithStorageMeta);
|
|
85412
85411
|
newBlocks.push(...blocks);
|
|
85413
85412
|
const lastResult = assertEx(results.at(-1));
|
|
85414
85413
|
results = await this.chainArchivist.next({
|
|
@@ -93063,7 +93062,7 @@ var BoundWitnessSignaturesValidator = /* @__PURE__ */ __name$h(async (bw) => {
|
|
|
93063
93062
|
const results = await Promise.all(bw.addresses.map(async (address, index) => {
|
|
93064
93063
|
return [
|
|
93065
93064
|
address,
|
|
93066
|
-
await BoundWitnessValidator.validateSignature(toArrayBuffer(dataHash), toArrayBuffer(address), toArrayBuffer(bw.$signatures[index]))
|
|
93065
|
+
await BoundWitnessValidator.validateSignature(toArrayBuffer(dataHash), toArrayBuffer(address), toArrayBuffer(bw.$signatures[index] ?? void 0))
|
|
93067
93066
|
];
|
|
93068
93067
|
}));
|
|
93069
93068
|
for (const [, bwErrors] of results) {
|
|
@@ -94217,7 +94216,7 @@ var BlockValidationDiviner = class extends AbstractDiviner {
|
|
|
94217
94216
|
async divineHandler(payloads) {
|
|
94218
94217
|
const inArchivist = await this.resolveInArchivist();
|
|
94219
94218
|
const inMap = readPayloadMapFromStore(inArchivist);
|
|
94220
|
-
const blocks = (payloads ?? []).map(asBlockBoundWitness).filter(exists$1);
|
|
94219
|
+
const blocks = (payloads ?? []).map((b) => asBlockBoundWitness(b)).filter(exists$1);
|
|
94221
94220
|
const results = (await Promise.all(blocks.map(async (block) => {
|
|
94222
94221
|
const blockHash = await PayloadBuilder.hash(block);
|
|
94223
94222
|
const hydratedBlock = await hydrateBlock({
|
|
@@ -94256,6 +94255,7 @@ var HeadValidationDiviner = class extends AbstractDiviner {
|
|
|
94256
94255
|
HeadValidationDivinerConfigSchema
|
|
94257
94256
|
];
|
|
94258
94257
|
static targetSchema = HeadValidationDivinerConfigSchema;
|
|
94258
|
+
_headValidationDivinerHeadUpdateTotal;
|
|
94259
94259
|
_headSelector;
|
|
94260
94260
|
_inArchivist;
|
|
94261
94261
|
_outArchivist;
|
|
@@ -94270,6 +94270,12 @@ var HeadValidationDiviner = class extends AbstractDiviner {
|
|
|
94270
94270
|
get headSelector() {
|
|
94271
94271
|
return assertEx(this._headSelector, () => "Missing head selector");
|
|
94272
94272
|
}
|
|
94273
|
+
async createHandler() {
|
|
94274
|
+
await super.createHandler();
|
|
94275
|
+
this._headValidationDivinerHeadUpdateTotal = this.meter?.createCounter("head_validation_diviner_head_update_total", {
|
|
94276
|
+
description: "Count of head updates performed by the diviner during head validation"
|
|
94277
|
+
});
|
|
94278
|
+
}
|
|
94273
94279
|
async initializeHeadSelector() {
|
|
94274
94280
|
return await spanRootAsync("initializeHeadSelector", async () => {
|
|
94275
94281
|
if (!this._headSelector) {
|
|
@@ -94280,7 +94286,7 @@ var HeadValidationDiviner = class extends AbstractDiviner {
|
|
|
94280
94286
|
const payload = await outArchivist.get([
|
|
94281
94287
|
this.config.finalizedBlock
|
|
94282
94288
|
]);
|
|
94283
|
-
const blocks =
|
|
94289
|
+
const blocks = payload.filter(isSignedBlockBoundWitnessWithStorageMeta);
|
|
94284
94290
|
const block = blocks.at(0);
|
|
94285
94291
|
if (block) finalizedBlock = block;
|
|
94286
94292
|
} else {
|
|
@@ -94301,9 +94307,9 @@ var HeadValidationDiviner = class extends AbstractDiviner {
|
|
|
94301
94307
|
}
|
|
94302
94308
|
}
|
|
94303
94309
|
if (isDefined(finalizedBlock)) {
|
|
94304
|
-
this._startingHead =
|
|
94310
|
+
this._startingHead = (await inArchivist.get([
|
|
94305
94311
|
finalizedBlock._hash
|
|
94306
|
-
])
|
|
94312
|
+
])).find(isSignedBlockBoundWitnessWithStorageMeta);
|
|
94307
94313
|
if (isDefined(this._startingHead)) {
|
|
94308
94314
|
this._headSelector = new ChainHeadSelector({
|
|
94309
94315
|
allowedProducers: this.allowedProducers,
|
|
@@ -94344,6 +94350,7 @@ var HeadValidationDiviner = class extends AbstractDiviner {
|
|
|
94344
94350
|
const inMap = readPayloadMapFromStore(inArchivist);
|
|
94345
94351
|
let currentBlockHash = headBlock._hash;
|
|
94346
94352
|
let payloadsToFinalize = [];
|
|
94353
|
+
let finalizedBlocksAttributes = [];
|
|
94347
94354
|
this.logger?.debug("Validating new HeadBlock head from (block) ", headBlock.block, "to", this._startingHead?.block);
|
|
94348
94355
|
this.logger?.debug("Validating new HeadBlock head from (hash) ", headBlock._hash, "to", this._startingHead?._hash);
|
|
94349
94356
|
const start = Date.now();
|
|
@@ -94367,6 +94374,12 @@ var HeadValidationDiviner = class extends AbstractDiviner {
|
|
|
94367
94374
|
...flattenHydratedBlock(hydratedBlock),
|
|
94368
94375
|
...payloadsToFinalize
|
|
94369
94376
|
];
|
|
94377
|
+
finalizedBlocksAttributes = [
|
|
94378
|
+
{
|
|
94379
|
+
producer: hydratedBlock[0].addresses[0]
|
|
94380
|
+
},
|
|
94381
|
+
...finalizedBlocksAttributes
|
|
94382
|
+
];
|
|
94370
94383
|
currentBlockHash = hydratedBlock[0].previous;
|
|
94371
94384
|
}
|
|
94372
94385
|
if (headBlock._hash !== this._startingHead?._hash) {
|
|
@@ -94374,14 +94387,18 @@ var HeadValidationDiviner = class extends AbstractDiviner {
|
|
|
94374
94387
|
this.logger?.info("Validated new HeadBlock head from (hash) in", `${Date.now() - start}ms`, headBlock._hash, "to", this._startingHead?._hash);
|
|
94375
94388
|
}
|
|
94376
94389
|
await spanRootAsync("HeadValidationDiviner:commitToOutArchivist", async () => {
|
|
94377
|
-
if (payloadsToFinalize.length > 0)
|
|
94390
|
+
if (payloadsToFinalize.length > 0) {
|
|
94391
|
+
await outArchivist.insert(payloadsToFinalize);
|
|
94392
|
+
for (const finalizedBlockAttributes of finalizedBlocksAttributes) {
|
|
94393
|
+
this._headValidationDivinerHeadUpdateTotal?.add(1, finalizedBlockAttributes);
|
|
94394
|
+
}
|
|
94395
|
+
}
|
|
94378
94396
|
}, this.tracer);
|
|
94379
94397
|
this.headSelector.unsafeFinalizeBlock(headBlock);
|
|
94380
94398
|
this._startingHead = headBlock;
|
|
94381
94399
|
return payloadsToFinalize;
|
|
94382
94400
|
} else {
|
|
94383
94401
|
this.logger?.info("No head found to validate", this._startingHead?._hash);
|
|
94384
|
-
return [];
|
|
94385
94402
|
}
|
|
94386
94403
|
} catch (ex) {
|
|
94387
94404
|
this.logger?.error("Error in divineHandler", ex);
|
|
@@ -94567,7 +94584,7 @@ var createSignatureWrappers = /* @__PURE__ */ __name$e(async (bw) => {
|
|
|
94567
94584
|
const signatures = [];
|
|
94568
94585
|
const hash = await PayloadBuilder.dataHash(bw);
|
|
94569
94586
|
for (let i = 0; i < bw.$signatures.length; i++) {
|
|
94570
|
-
signatures.push(new SignatureWrapper(bw.$signatures[i], bw.addresses[i], hash));
|
|
94587
|
+
signatures.push(new SignatureWrapper(asHex(bw.$signatures[i], true), bw.addresses[i], hash));
|
|
94571
94588
|
}
|
|
94572
94589
|
return signatures;
|
|
94573
94590
|
}, "createSignatureWrappers");
|
|
@@ -116876,62 +116893,6 @@ function creatableService() {
|
|
|
116876
116893
|
};
|
|
116877
116894
|
}
|
|
116878
116895
|
__name$b(creatableService, "creatableService");
|
|
116879
|
-
function blockViewerFromChainIteratorAndArchivist(chainIterator, chainArchivist) {
|
|
116880
|
-
const result = {
|
|
116881
|
-
blockByHash: /* @__PURE__ */ __name$b(async function(hash) {
|
|
116882
|
-
const [payload] = await chainArchivist.get([
|
|
116883
|
-
hash
|
|
116884
|
-
]);
|
|
116885
|
-
const block = asBlockBoundWitnessWithStorageMeta(payload);
|
|
116886
|
-
if (isDefined(block)) {
|
|
116887
|
-
const payloads = await chainArchivist.get(block.payload_hashes);
|
|
116888
|
-
return [
|
|
116889
|
-
block,
|
|
116890
|
-
payloads
|
|
116891
|
-
];
|
|
116892
|
-
}
|
|
116893
|
-
return null;
|
|
116894
|
-
}, "blockByHash"),
|
|
116895
|
-
blockByNumber: /* @__PURE__ */ __name$b(async function(blockNumber) {
|
|
116896
|
-
const payload = await chainIterator.get(blockNumber);
|
|
116897
|
-
const block = payload ? await PayloadBuilder.addStorageMeta(payload) : void 0;
|
|
116898
|
-
if (isDefined(block)) {
|
|
116899
|
-
const payloads = await chainArchivist.get(block.payload_hashes);
|
|
116900
|
-
return [
|
|
116901
|
-
block,
|
|
116902
|
-
payloads
|
|
116903
|
-
];
|
|
116904
|
-
}
|
|
116905
|
-
return null;
|
|
116906
|
-
}, "blockByNumber"),
|
|
116907
|
-
blocksByHash: /* @__PURE__ */ __name$b(async function(hash, limit = 10) {
|
|
116908
|
-
const results = [];
|
|
116909
|
-
for (let i = 0; i < limit; i++) {
|
|
116910
|
-
const block = await this.blockByHash(hash);
|
|
116911
|
-
if (block) {
|
|
116912
|
-
results.push(block);
|
|
116913
|
-
} else {
|
|
116914
|
-
break;
|
|
116915
|
-
}
|
|
116916
|
-
}
|
|
116917
|
-
return results;
|
|
116918
|
-
}, "blocksByHash"),
|
|
116919
|
-
currentBlock: /* @__PURE__ */ __name$b(async function() {
|
|
116920
|
-
const head = await chainIterator.head();
|
|
116921
|
-
return this.blockByHash(head._hash);
|
|
116922
|
-
}, "currentBlock"),
|
|
116923
|
-
currentBlockHash: /* @__PURE__ */ __name$b(async function() {
|
|
116924
|
-
const head = await chainIterator.head();
|
|
116925
|
-
return head._hash;
|
|
116926
|
-
}, "currentBlockHash"),
|
|
116927
|
-
currentBlockNumber: /* @__PURE__ */ __name$b(async function() {
|
|
116928
|
-
const head = await chainIterator.head();
|
|
116929
|
-
return head.block;
|
|
116930
|
-
}, "currentBlockNumber")
|
|
116931
|
-
};
|
|
116932
|
-
return result;
|
|
116933
|
-
}
|
|
116934
|
-
__name$b(blockViewerFromChainIteratorAndArchivist, "blockViewerFromChainIteratorAndArchivist");
|
|
116935
116896
|
|
|
116936
116897
|
// src/AccountBalance/BaseAccountBalanceService.ts
|
|
116937
116898
|
function _ts_decorate2$1(decorators, target, key, desc) {
|
|
@@ -116941,24 +116902,48 @@ function _ts_decorate2$1(decorators, target, key, desc) {
|
|
|
116941
116902
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
116942
116903
|
}
|
|
116943
116904
|
__name$b(_ts_decorate2$1, "_ts_decorate");
|
|
116905
|
+
var BaseAccountBalanceServiceParamsZod = z.object({
|
|
116906
|
+
blockViewer: z.object().loose(),
|
|
116907
|
+
chainArchivist: z.object().loose(),
|
|
116908
|
+
chainIterator: z.object().loose(),
|
|
116909
|
+
context: z.object().loose(),
|
|
116910
|
+
transferContext: z.object().loose()
|
|
116911
|
+
});
|
|
116944
116912
|
var BaseAccountBalanceService = class extends BaseService {
|
|
116945
116913
|
static {
|
|
116946
116914
|
__name$b(this, "BaseAccountBalanceService");
|
|
116947
116915
|
}
|
|
116948
116916
|
accountBalanceViewer;
|
|
116949
|
-
blockViewer
|
|
116917
|
+
get blockViewer() {
|
|
116918
|
+
return assertEx(this.params.blockViewer, () => "BlockViewer has not been initialized yet");
|
|
116919
|
+
}
|
|
116920
|
+
static async paramsHandler(params) {
|
|
116921
|
+
BaseAccountBalanceServiceParamsZod.parse(params);
|
|
116922
|
+
assertEx(params?.context?.head, () => "BalanceStepSummaryContext is required in BaseAccountBalanceServiceParams");
|
|
116923
|
+
return {
|
|
116924
|
+
...await super.paramsHandler(params),
|
|
116925
|
+
...params
|
|
116926
|
+
};
|
|
116927
|
+
}
|
|
116950
116928
|
async accountBalance(address, headOrRange) {
|
|
116951
|
-
const balances = await this.
|
|
116929
|
+
const balances = await this.accountsBalances([
|
|
116952
116930
|
address
|
|
116953
116931
|
], headOrRange);
|
|
116954
116932
|
return balances[address] ?? AttoXL1(0n);
|
|
116955
116933
|
}
|
|
116956
|
-
|
|
116957
|
-
|
|
116934
|
+
accountBalanceHistory(_address, _headOrRange) {
|
|
116935
|
+
throw new Error("Method not implemented.");
|
|
116958
116936
|
}
|
|
116959
|
-
async
|
|
116937
|
+
async accountsBalances(address, _headOrRange) {
|
|
116960
116938
|
return await spanRootAsync("balances", async () => {
|
|
116961
|
-
const
|
|
116939
|
+
const context = {
|
|
116940
|
+
head: this.params.context.head,
|
|
116941
|
+
stepSemaphores: this.params.context.stepSemaphores,
|
|
116942
|
+
store: this.params.context.store,
|
|
116943
|
+
chainId: this.params.context.chainId,
|
|
116944
|
+
summaryMap: this.params.context.summaryMap
|
|
116945
|
+
};
|
|
116946
|
+
const summary = await balancesSummary(context);
|
|
116962
116947
|
const result = {};
|
|
116963
116948
|
for (const addr of address) {
|
|
116964
116949
|
const summaryBalance = summary[addr] ?? 0n;
|
|
@@ -116967,15 +116952,15 @@ var BaseAccountBalanceService = class extends BaseService {
|
|
|
116967
116952
|
return result;
|
|
116968
116953
|
});
|
|
116969
116954
|
}
|
|
116970
|
-
|
|
116955
|
+
accountsBalancesHistory(_addresses, _headOrRange) {
|
|
116971
116956
|
throw new Error("Method not implemented.");
|
|
116972
116957
|
}
|
|
116973
|
-
async
|
|
116974
|
-
|
|
116975
|
-
|
|
116976
|
-
|
|
116977
|
-
|
|
116978
|
-
|
|
116958
|
+
async createHandler() {
|
|
116959
|
+
this.accountBalanceViewer = await SimpleAccountBalanceViewer.create({
|
|
116960
|
+
context: this.params.context,
|
|
116961
|
+
transferContext: this.params.transferContext,
|
|
116962
|
+
blockViewer: this.blockViewer
|
|
116963
|
+
});
|
|
116979
116964
|
}
|
|
116980
116965
|
};
|
|
116981
116966
|
BaseAccountBalanceService = _ts_decorate2$1([
|
|
@@ -117060,6 +117045,13 @@ __name$b(_ts_decorate4, "_ts_decorate");
|
|
|
117060
117045
|
var DEFAULT_BLOCK_SIZE = 10;
|
|
117061
117046
|
var XYO_PRODUCER_REDECLARATION_DURATION = 1e4;
|
|
117062
117047
|
var XYO_PRODUCER_REDECLARATION_WINDOW = 500;
|
|
117048
|
+
var BaseBlockProducerServiceParamsZod = z.object({
|
|
117049
|
+
balanceService: z.object().loose(),
|
|
117050
|
+
pendingTransactionsService: z.object().loose(),
|
|
117051
|
+
rejectedTransactionsArchivist: z.object().loose(),
|
|
117052
|
+
rewardAddress: AddressZod,
|
|
117053
|
+
time: z.object().loose()
|
|
117054
|
+
});
|
|
117063
117055
|
var BaseBlockProducerService = class _BaseBlockProducerService extends BaseService {
|
|
117064
117056
|
static {
|
|
117065
117057
|
__name$b(this, "BaseBlockProducerService");
|
|
@@ -117124,6 +117116,13 @@ var BaseBlockProducerService = class _BaseBlockProducerService extends BaseServi
|
|
|
117124
117116
|
get validateHydratedBlockState() {
|
|
117125
117117
|
return assertEx(this.params.validateHydratedBlockState, () => "validateHydratedBlockState is required");
|
|
117126
117118
|
}
|
|
117119
|
+
static async paramsHandler(params) {
|
|
117120
|
+
BaseBlockProducerServiceParamsZod.parse(params);
|
|
117121
|
+
return {
|
|
117122
|
+
...await super.paramsHandler(params),
|
|
117123
|
+
...params
|
|
117124
|
+
};
|
|
117125
|
+
}
|
|
117127
117126
|
async next(head) {
|
|
117128
117127
|
if (head.chain !== this.chainId) return;
|
|
117129
117128
|
const leadersStart = Date.now();
|
|
@@ -117386,6 +117385,62 @@ var MemoryBlockRewardService = class extends BaseBlockRewardService {
|
|
|
117386
117385
|
MemoryBlockRewardService = _ts_decorate7([
|
|
117387
117386
|
creatable()
|
|
117388
117387
|
], MemoryBlockRewardService);
|
|
117388
|
+
function blockViewerFromChainIteratorAndArchivist(chainIterator, chainArchivist) {
|
|
117389
|
+
const result = {
|
|
117390
|
+
blockByHash: /* @__PURE__ */ __name$b(async function(hash) {
|
|
117391
|
+
const [payload] = await chainArchivist.get([
|
|
117392
|
+
hash
|
|
117393
|
+
]);
|
|
117394
|
+
const block = asSignedBlockBoundWitnessWithStorageMeta(payload);
|
|
117395
|
+
if (isDefined(block)) {
|
|
117396
|
+
const payloads = await chainArchivist.get(block.payload_hashes);
|
|
117397
|
+
return [
|
|
117398
|
+
block,
|
|
117399
|
+
payloads
|
|
117400
|
+
];
|
|
117401
|
+
}
|
|
117402
|
+
return null;
|
|
117403
|
+
}, "blockByHash"),
|
|
117404
|
+
blockByNumber: /* @__PURE__ */ __name$b(async function(blockNumber) {
|
|
117405
|
+
const payload = asSignedBlockBoundWitness(await chainIterator.get(blockNumber));
|
|
117406
|
+
const block = payload ? await PayloadBuilder.addHashMeta(payload) : void 0;
|
|
117407
|
+
if (isDefined(block)) {
|
|
117408
|
+
const payloads = await chainArchivist.get(block.payload_hashes);
|
|
117409
|
+
return [
|
|
117410
|
+
block,
|
|
117411
|
+
payloads
|
|
117412
|
+
];
|
|
117413
|
+
}
|
|
117414
|
+
return null;
|
|
117415
|
+
}, "blockByNumber"),
|
|
117416
|
+
blocksByHash: /* @__PURE__ */ __name$b(async function(hash, limit = 10) {
|
|
117417
|
+
const results = [];
|
|
117418
|
+
for (let i = 0; i < limit; i++) {
|
|
117419
|
+
const block = await this.blockByHash(hash);
|
|
117420
|
+
if (block) {
|
|
117421
|
+
results.push(block);
|
|
117422
|
+
} else {
|
|
117423
|
+
break;
|
|
117424
|
+
}
|
|
117425
|
+
}
|
|
117426
|
+
return results;
|
|
117427
|
+
}, "blocksByHash"),
|
|
117428
|
+
currentBlock: /* @__PURE__ */ __name$b(async function() {
|
|
117429
|
+
const head = await chainIterator.head();
|
|
117430
|
+
return this.blockByHash(head._hash);
|
|
117431
|
+
}, "currentBlock"),
|
|
117432
|
+
currentBlockHash: /* @__PURE__ */ __name$b(async function() {
|
|
117433
|
+
const head = await chainIterator.head();
|
|
117434
|
+
return head._hash;
|
|
117435
|
+
}, "currentBlockHash"),
|
|
117436
|
+
currentBlockNumber: /* @__PURE__ */ __name$b(async function() {
|
|
117437
|
+
const head = await chainIterator.head();
|
|
117438
|
+
return head.block;
|
|
117439
|
+
}, "currentBlockNumber")
|
|
117440
|
+
};
|
|
117441
|
+
return result;
|
|
117442
|
+
}
|
|
117443
|
+
__name$b(blockViewerFromChainIteratorAndArchivist, "blockViewerFromChainIteratorAndArchivist");
|
|
117389
117444
|
var ChainBlockNumberIterationService = class extends BaseService {
|
|
117390
117445
|
static {
|
|
117391
117446
|
__name$b(this, "ChainBlockNumberIterationService");
|
|
@@ -117764,12 +117819,12 @@ BaseNetworkStakeStepRewardService = _ts_decorate10([
|
|
|
117764
117819
|
creatable()
|
|
117765
117820
|
], BaseNetworkStakeStepRewardService);
|
|
117766
117821
|
var bundledPayloadToHydratedTransaction = /* @__PURE__ */ __name$b(async (payload) => {
|
|
117767
|
-
const
|
|
117768
|
-
const tx =
|
|
117822
|
+
const withHashMeta = await PayloadBuilder.addHashMeta(payload.payloads);
|
|
117823
|
+
const tx = asSignedTransactionBoundWitnessWithHashMeta(withHashMeta.find((p) => p._hash === payload.root));
|
|
117769
117824
|
if (tx) {
|
|
117770
117825
|
return [
|
|
117771
117826
|
tx,
|
|
117772
|
-
|
|
117827
|
+
withHashMeta.filter((p) => p._hash !== payload.root)
|
|
117773
117828
|
];
|
|
117774
117829
|
}
|
|
117775
117830
|
}, "bundledPayloadToHydratedTransaction");
|
|
@@ -117890,7 +117945,7 @@ var BasePendingTransactionsService = class _BasePendingTransactionsService exten
|
|
|
117890
117945
|
return await this._updateCuratedPendingTransactionsArchivistMutex.runExclusive(async () => {
|
|
117891
117946
|
let [lastHead] = filterAs(await this.chainArchivist.get([
|
|
117892
117947
|
head
|
|
117893
|
-
]), asBlockBoundWitnessWithHashMeta);
|
|
117948
|
+
]), (x) => asBlockBoundWitnessWithHashMeta(x));
|
|
117894
117949
|
if (isUndefined$1(lastHead)) return [];
|
|
117895
117950
|
await this.pruneCuratedPendingTransactionsArchivist(lastHead._hash);
|
|
117896
117951
|
const foundPendingTransactions = [];
|
|
@@ -117905,7 +117960,7 @@ var BasePendingTransactionsService = class _BasePendingTransactionsService exten
|
|
|
117905
117960
|
cursor = pendingBundledTransactions.at(-1)?._sequence;
|
|
117906
117961
|
const undeletedTransactionBundles = pendingBundledTransactions.filter((tx) => !this._removablePendingTransactionHashes.has(tx.root));
|
|
117907
117962
|
const transactions = (await Promise.all(undeletedTransactionBundles.map((p) => bundledPayloadToHydratedTransaction(p)))).filter(exists$1);
|
|
117908
|
-
const activeTransactions = transactions.filter(isTransactionActive(lastHead.block + 1));
|
|
117963
|
+
const activeTransactions = transactions.filter(isTransactionActive(asXL1BlockNumber(lastHead.block + 1, true)));
|
|
117909
117964
|
const txValidationResults = await Promise.all(activeTransactions.map(async (tx) => [
|
|
117910
117965
|
tx,
|
|
117911
117966
|
await validateTransaction(tx, {
|
|
@@ -117996,7 +118051,7 @@ var BasePendingTransactionsService = class _BasePendingTransactionsService exten
|
|
|
117996
118051
|
let cursor;
|
|
117997
118052
|
let [lastHead] = filterAs(await this.chainArchivist.get([
|
|
117998
118053
|
head
|
|
117999
|
-
]), asBlockBoundWitnessWithHashMeta);
|
|
118054
|
+
]), (x) => asBlockBoundWitnessWithHashMeta(x));
|
|
118000
118055
|
while (isDefined(lastHead)) {
|
|
118001
118056
|
const pendingBundledTransactions = await this.pendingBundledTransactionsLocalArchivist.next({
|
|
118002
118057
|
limit: 100,
|
|
@@ -118011,7 +118066,7 @@ var BasePendingTransactionsService = class _BasePendingTransactionsService exten
|
|
|
118011
118066
|
foundPendingTransactionsToDeleteHashes.push(...deletedTransactionBundles.map((tx) => tx._hash).filter(exists$1));
|
|
118012
118067
|
const undeletedTransactionBundles = pendingBundledTransactions.filter((tx) => !this._removablePendingTransactionHashes.has(tx.root));
|
|
118013
118068
|
const transactions = (await Promise.all(undeletedTransactionBundles.map((p) => bundledPayloadToHydratedTransaction(p)))).filter(exists$1);
|
|
118014
|
-
const expiredTransactions = transactions.filter(isTransactionExpired(lastHead.block + 1));
|
|
118069
|
+
const expiredTransactions = transactions.filter(isTransactionExpired(asXL1BlockNumber(lastHead.block + 1, true)));
|
|
118015
118070
|
const expiredBundleHashes = expiredTransactions.map((expiredHydratedTx) => (
|
|
118016
118071
|
// Find the corresponding payload bundle hash for the expired transaction
|
|
118017
118072
|
pendingBundledTransactions.find((bundledTx) => bundledTx.root === expiredHydratedTx[0]._hash)?._hash
|
|
@@ -118863,7 +118918,7 @@ var AbstractSentinel = class _AbstractSentinel extends AbstractModuleInstance {
|
|
|
118863
118918
|
}
|
|
118864
118919
|
async emitReportEnd(inPayloads, payloads) {
|
|
118865
118920
|
const boundwitnesses = payloads?.filter(isBoundWitness) ?? [];
|
|
118866
|
-
const outPayloads = payloads?.filter(
|
|
118921
|
+
const outPayloads = payloads?.filter((payload) => !isBoundWitness(payload)) ?? [];
|
|
118867
118922
|
const boundwitness = boundwitnesses.find((bw) => bw.addresses.includes(this.address));
|
|
118868
118923
|
await this.emit("reportEnd", {
|
|
118869
118924
|
boundwitness,
|
|
@@ -121105,6 +121160,11 @@ var NodeXyoViewer = class extends AbstractCreatable {
|
|
|
121105
121160
|
_signedHydratedBlockCache;
|
|
121106
121161
|
_signedHydratedTransactionCache;
|
|
121107
121162
|
_transferBalanceDiviner;
|
|
121163
|
+
get account() {
|
|
121164
|
+
return {
|
|
121165
|
+
balance: this.params.accountBalanceViewer
|
|
121166
|
+
};
|
|
121167
|
+
}
|
|
121108
121168
|
get context() {
|
|
121109
121169
|
return assertEx(this.params.context, () => "NodeXyoViewer requires a context");
|
|
121110
121170
|
}
|
|
@@ -121126,64 +121186,24 @@ var NodeXyoViewer = class extends AbstractCreatable {
|
|
|
121126
121186
|
...this.context
|
|
121127
121187
|
};
|
|
121128
121188
|
}
|
|
121129
|
-
async
|
|
121130
|
-
|
|
121131
|
-
|
|
121132
|
-
|
|
121133
|
-
|
|
121134
|
-
|
|
121135
|
-
|
|
121136
|
-
|
|
121137
|
-
|
|
121138
|
-
query
|
|
121139
|
-
]);
|
|
121140
|
-
const chainSummary = assertEx(result.find(isChainSummaryBalances), () => "Failed to divine chain summary balances");
|
|
121141
|
-
const balances = chainSummary.balances;
|
|
121142
|
-
const signedBalance = balances[address] === void 0 ? 0n : parseSignedBigInt(balances[address]);
|
|
121143
|
-
return asAttoXL1(signedBalance > 0n ? signedBalance : 0n);
|
|
121144
|
-
}, this.tracer);
|
|
121189
|
+
static async paramsHandler(params) {
|
|
121190
|
+
assertEx(params.accountBalanceViewer, () => "NodeXyoViewer requires an AccountBalanceViewer");
|
|
121191
|
+
return {
|
|
121192
|
+
...await super.paramsHandler(params),
|
|
121193
|
+
...params
|
|
121194
|
+
};
|
|
121195
|
+
}
|
|
121196
|
+
async accountBalance(address, rangeOrHash) {
|
|
121197
|
+
return await this.account.balance.accountBalance(address, rangeOrHash);
|
|
121145
121198
|
}
|
|
121146
121199
|
async accountBalanceHistory(address, rangeOrHash) {
|
|
121147
|
-
return await
|
|
121148
|
-
const range = asRange(rangeOrHash);
|
|
121149
|
-
const startingRange = asXL1BlockRange(range ?? [
|
|
121150
|
-
0,
|
|
121151
|
-
await this.currentBlockNumber()
|
|
121152
|
-
], {
|
|
121153
|
-
name: "accountBalanceHistory"
|
|
121154
|
-
});
|
|
121155
|
-
const blockNumbers = await this.distillTransferHistory(address, startingRange);
|
|
121156
|
-
const blocks = (await Promise.all(blockNumbers.map(async (bn) => await this.blockByNumber(bn)))).filter(exists$1);
|
|
121157
|
-
const result = [];
|
|
121158
|
-
for (const block of blocks) {
|
|
121159
|
-
const transferIndexes = block[0].payload_schemas.map((schema, index) => schema === TransferSchema ? index : void 0).filter(exists$1);
|
|
121160
|
-
const transfers = transferIndexes.map((index) => {
|
|
121161
|
-
const hash = block[0].payload_hashes[index];
|
|
121162
|
-
return assertEx(block[1].find((p) => p._hash === hash), () => `Could not find Transfer with hash ${hash} in block ${block[0]._hash}`);
|
|
121163
|
-
}).filter(exists$1).filter((t) => t.from === address || isDefined(t.transfers[address]));
|
|
121164
|
-
if (transfers.length === 0) {
|
|
121165
|
-
continue;
|
|
121166
|
-
}
|
|
121167
|
-
const pairs = transfers.map((transfer) => {
|
|
121168
|
-
return [
|
|
121169
|
-
block[0],
|
|
121170
|
-
transfer
|
|
121171
|
-
];
|
|
121172
|
-
});
|
|
121173
|
-
result.push(...pairs.map(([block2, transfer]) => [
|
|
121174
|
-
block2,
|
|
121175
|
-
null,
|
|
121176
|
-
transfer
|
|
121177
|
-
]));
|
|
121178
|
-
}
|
|
121179
|
-
return result;
|
|
121180
|
-
}, this.tracer);
|
|
121200
|
+
return await this.account.balance.accountBalanceHistory(address, rangeOrHash);
|
|
121181
121201
|
}
|
|
121182
|
-
accountsBalances(
|
|
121183
|
-
|
|
121202
|
+
async accountsBalances(addresses, headOrRange) {
|
|
121203
|
+
return await this.account.balance.accountsBalances(addresses, headOrRange);
|
|
121184
121204
|
}
|
|
121185
|
-
accountsBalancesHistory(
|
|
121186
|
-
|
|
121205
|
+
async accountsBalancesHistory(addresses, headOrRange) {
|
|
121206
|
+
return await this.account.balance.accountsBalancesHistory(addresses, headOrRange);
|
|
121187
121207
|
}
|
|
121188
121208
|
async blockByHash(hash) {
|
|
121189
121209
|
return await spanRootAsync("blockByHash", async () => {
|
|
@@ -121193,7 +121213,7 @@ var NodeXyoViewer = class extends AbstractCreatable {
|
|
|
121193
121213
|
}
|
|
121194
121214
|
async blockByNumber(blockNumber) {
|
|
121195
121215
|
return await spanRootAsync("blockByNumber", async () => {
|
|
121196
|
-
return await hydratedBlockByNumber(this.context, blockNumber);
|
|
121216
|
+
return asSignedHydratedBlockWithHashMeta(await hydratedBlockByNumber(this.context, blockNumber)) ?? null;
|
|
121197
121217
|
}, this.tracer);
|
|
121198
121218
|
}
|
|
121199
121219
|
async blocksByHash(hash, limit = 10) {
|
|
@@ -121208,7 +121228,7 @@ var NodeXyoViewer = class extends AbstractCreatable {
|
|
|
121208
121228
|
if (previousHash === null) break;
|
|
121209
121229
|
current = await this.blockByHash(previousHash);
|
|
121210
121230
|
}
|
|
121211
|
-
return blocks;
|
|
121231
|
+
return blocks.map((b) => asSignedHydratedBlockWithHashMeta(b, true));
|
|
121212
121232
|
}, this.tracer);
|
|
121213
121233
|
}
|
|
121214
121234
|
async chainId() {
|
|
@@ -121547,7 +121567,12 @@ var NodeXyoViewer = class extends AbstractCreatable {
|
|
|
121547
121567
|
async getHydratedBlockCache() {
|
|
121548
121568
|
if (this._signedHydratedBlockCache) return this._signedHydratedBlockCache;
|
|
121549
121569
|
const chainMap = await this.getFinalizedPayloadMap();
|
|
121550
|
-
this._signedHydratedBlockCache = new HydratedCache(chainMap,
|
|
121570
|
+
this._signedHydratedBlockCache = new HydratedCache(chainMap, async ({ chainMap: chainMap2 }, hash, maxDepth, minDepth) => {
|
|
121571
|
+
const result = await hydrateBlock({
|
|
121572
|
+
chainMap: chainMap2
|
|
121573
|
+
}, hash, maxDepth, minDepth);
|
|
121574
|
+
return asSignedHydratedBlockWithHashMeta(result, true);
|
|
121575
|
+
}, 200);
|
|
121551
121576
|
return this._signedHydratedBlockCache;
|
|
121552
121577
|
}
|
|
121553
121578
|
async getHydratedTransactionCache() {
|
|
@@ -268159,7 +268184,7 @@ var BoundWitnessDivinerSchema = "network.xyo.diviner.boundwitness";
|
|
|
268159
268184
|
|
|
268160
268185
|
// src/Config.ts
|
|
268161
268186
|
var BoundWitnessDivinerConfigSchema = `${BoundWitnessDivinerSchema}.config`;
|
|
268162
|
-
var BoundWitnessDivinerQuerySchema = `${BoundWitnessDivinerSchema}.query
|
|
268187
|
+
var BoundWitnessDivinerQuerySchema = asSchema(`${BoundWitnessDivinerSchema}.query`, true);
|
|
268163
268188
|
var isBoundWitnessDivinerQueryPayload = isPayloadOfSchemaType(BoundWitnessDivinerQuerySchema);
|
|
268164
268189
|
|
|
268165
268190
|
// src/Diviner.ts
|
|
@@ -268173,7 +268198,6 @@ var applyBoundWitnessDivinerQueryPayload = (filter, payloads = []) => {
|
|
|
268173
268198
|
if (!filter) return [];
|
|
268174
268199
|
const {
|
|
268175
268200
|
addresses,
|
|
268176
|
-
block,
|
|
268177
268201
|
cursor,
|
|
268178
268202
|
destination,
|
|
268179
268203
|
limit,
|
|
@@ -268187,7 +268211,7 @@ var applyBoundWitnessDivinerQueryPayload = (filter, payloads = []) => {
|
|
|
268187
268211
|
const parsedOffset = order === "desc" ? sortedPayloads.findIndex((bw) => bw._sequence < parsedCursor) : sortedPayloads.findIndex((bw) => bw._sequence > parsedCursor);
|
|
268188
268212
|
if (parsedOffset === -1) return [];
|
|
268189
268213
|
const payloadSubset = sortedPayloads.slice(parsedOffset);
|
|
268190
|
-
let bws =
|
|
268214
|
+
let bws = payloadSubset.filter(isBoundWitness);
|
|
268191
268215
|
const allAddresses = addresses?.map((address) => hexFromHexString(address)).filter(exists$1);
|
|
268192
268216
|
if (allAddresses?.length) bws = bws.filter((bw) => containsAll(bw.addresses, allAddresses));
|
|
268193
268217
|
if (payload_hashes?.length) bws = bws.filter((bw) => containsAll(bw.payload_hashes, payload_hashes));
|
|
@@ -268200,9 +268224,6 @@ var applyBoundWitnessDivinerQueryPayload = (filter, payloads = []) => {
|
|
|
268200
268224
|
return targetDestinationField !== void 0 && Array.isArray(targetDestinationField) && targetDestinationField.length > 0 ? containsAll(targetFilter, targetDestinationField ?? []) : false;
|
|
268201
268225
|
});
|
|
268202
268226
|
}
|
|
268203
|
-
if (block !== void 0) {
|
|
268204
|
-
bws = order === "desc" ? filterAs(bws, asBlock).filter((bw) => bw.block <= block) : filterAs(bws, asBlock).filter((bw) => bw.block >= block);
|
|
268205
|
-
}
|
|
268206
268227
|
const parsedLimit = limit ?? bws.length;
|
|
268207
268228
|
return bws.slice(0, parsedLimit);
|
|
268208
268229
|
};
|
|
@@ -268211,7 +268232,7 @@ var MemoryBoundWitnessDiviner = class extends BoundWitnessDiviner {
|
|
|
268211
268232
|
const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => "Missing query payload");
|
|
268212
268233
|
if (!filter) return [];
|
|
268213
268234
|
const archivist = assertEx(await this.archivistInstance(), () => "Unable to resolve archivist");
|
|
268214
|
-
let bws = (await archivist?.next({ limit: 1e4 }) ?? []).filter(
|
|
268235
|
+
let bws = (await archivist?.next({ limit: 1e4 }) ?? []).filter((x) => isBoundWitness(x) && isStorageMeta(x));
|
|
268215
268236
|
return applyBoundWitnessDivinerQueryPayload(filter, bws);
|
|
268216
268237
|
}
|
|
268217
268238
|
};
|
|
@@ -269399,6 +269420,7 @@ async function initSeedPhrase({ config, logger, bios }) {
|
|
|
269399
269420
|
__name$6(initSeedPhrase, "initSeedPhrase");
|
|
269400
269421
|
var getLocator$2 = /* @__PURE__ */ __name$6(async ({ config, logger, balanceSummaryMap, transferSummaryMap }) => {
|
|
269401
269422
|
const { otlpEndpoint } = config.telemetry?.otel ?? {};
|
|
269423
|
+
const { path: endpoint = "/metrics", port = 9465 } = config.telemetry?.metrics?.scrape ?? {};
|
|
269402
269424
|
const { traceProvider, meterProvider } = await initTelemetry({
|
|
269403
269425
|
attributes: {
|
|
269404
269426
|
serviceName: "xl1-api",
|
|
@@ -269406,8 +269428,8 @@ var getLocator$2 = /* @__PURE__ */ __name$6(async ({ config, logger, balanceSumm
|
|
|
269406
269428
|
},
|
|
269407
269429
|
otlpEndpoint,
|
|
269408
269430
|
metricsConfig: {
|
|
269409
|
-
endpoint
|
|
269410
|
-
port
|
|
269431
|
+
endpoint,
|
|
269432
|
+
port
|
|
269411
269433
|
}
|
|
269412
269434
|
});
|
|
269413
269435
|
if (isDefined(logger)) AbstractModule.defaultLogger = logger;
|
|
@@ -269946,6 +269968,30 @@ async function initTransferSummaryMap$1({ config, logger }) {
|
|
|
269946
269968
|
}
|
|
269947
269969
|
}
|
|
269948
269970
|
__name$6(initTransferSummaryMap$1, "initTransferSummaryMap");
|
|
269971
|
+
var chainIteratorServiceSingleton;
|
|
269972
|
+
var stakeIntentServiceSingleton;
|
|
269973
|
+
var electionServiceSingleton;
|
|
269974
|
+
var initChainIterator = /* @__PURE__ */ __name$6((params) => {
|
|
269975
|
+
if (chainIteratorServiceSingleton) return chainIteratorServiceSingleton;
|
|
269976
|
+
return timeBudget("initChainIterator", params.logger, () => {
|
|
269977
|
+
chainIteratorServiceSingleton = ChainBlockNumberIterationService.create(params);
|
|
269978
|
+
return chainIteratorServiceSingleton;
|
|
269979
|
+
}, 2e3, true);
|
|
269980
|
+
}, "initChainIterator");
|
|
269981
|
+
var initStakeIntentService = /* @__PURE__ */ __name$6((params) => {
|
|
269982
|
+
if (stakeIntentServiceSingleton) return stakeIntentServiceSingleton;
|
|
269983
|
+
return timeBudget("initStakeIntentService", params.logger, () => {
|
|
269984
|
+
stakeIntentServiceSingleton = XyoStakeIntentService.create(params);
|
|
269985
|
+
return stakeIntentServiceSingleton;
|
|
269986
|
+
}, 2e3, true);
|
|
269987
|
+
}, "initStakeIntentService");
|
|
269988
|
+
var initElectionService = /* @__PURE__ */ __name$6((params) => {
|
|
269989
|
+
if (electionServiceSingleton) return electionServiceSingleton;
|
|
269990
|
+
return timeBudget("initElectionService", params.logger, () => {
|
|
269991
|
+
electionServiceSingleton = BaseElectionService.create(params);
|
|
269992
|
+
return electionServiceSingleton;
|
|
269993
|
+
}, 2e3, true);
|
|
269994
|
+
}, "initElectionService");
|
|
269949
269995
|
|
|
269950
269996
|
var __defProp$6 = Object.defineProperty;
|
|
269951
269997
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -293289,12 +293335,12 @@ function requireTruncation () {
|
|
|
293289
293335
|
return truncation;
|
|
293290
293336
|
}
|
|
293291
293337
|
|
|
293292
|
-
var stringify = {exports: {}};
|
|
293338
|
+
var stringify$1 = {exports: {}};
|
|
293293
293339
|
|
|
293294
293340
|
var hasRequiredStringify$1;
|
|
293295
293341
|
|
|
293296
293342
|
function requireStringify$1 () {
|
|
293297
|
-
if (hasRequiredStringify$1) return stringify.exports;
|
|
293343
|
+
if (hasRequiredStringify$1) return stringify$1.exports;
|
|
293298
293344
|
hasRequiredStringify$1 = 1;
|
|
293299
293345
|
(function (module, exports$1) {
|
|
293300
293346
|
exports$1 = module.exports = stringify;
|
|
@@ -293324,8 +293370,8 @@ function requireStringify$1 () {
|
|
|
293324
293370
|
return replacer == null ? value : replacer.call(this, key, value)
|
|
293325
293371
|
}
|
|
293326
293372
|
}
|
|
293327
|
-
} (stringify, stringify.exports));
|
|
293328
|
-
return stringify.exports;
|
|
293373
|
+
} (stringify$1, stringify$1.exports));
|
|
293374
|
+
return stringify$1.exports;
|
|
293329
293375
|
}
|
|
293330
293376
|
|
|
293331
293377
|
var transport;
|
|
@@ -361331,72 +361377,6 @@ function requireExpress () {
|
|
|
361331
361377
|
var expressExports = requireExpress();
|
|
361332
361378
|
var express2 = /*@__PURE__*/getDefaultExportFromCjs(expressExports);
|
|
361333
361379
|
|
|
361334
|
-
/**
|
|
361335
|
-
* JsonRpcEngine only accepts callback-based middleware directly.
|
|
361336
|
-
* createAsyncMiddleware exists to enable consumers to pass in async middleware
|
|
361337
|
-
* functions.
|
|
361338
|
-
*
|
|
361339
|
-
* Async middleware have no "end" function. Instead, they "end" if they return
|
|
361340
|
-
* without calling "next". Rather than passing in explicit return handlers,
|
|
361341
|
-
* async middleware can simply await "next", and perform operations on the
|
|
361342
|
-
* response object when execution resumes.
|
|
361343
|
-
*
|
|
361344
|
-
* To accomplish this, createAsyncMiddleware passes the async middleware a
|
|
361345
|
-
* wrapped "next" function. That function calls the internal JsonRpcEngine
|
|
361346
|
-
* "next" function with a return handler that resolves a promise when called.
|
|
361347
|
-
*
|
|
361348
|
-
* The return handler will always be called. Its resolution of the promise
|
|
361349
|
-
* enables the control flow described above.
|
|
361350
|
-
*
|
|
361351
|
-
* @param asyncMiddleware - The asynchronous middleware function to wrap.
|
|
361352
|
-
* @returns The wrapped asynchronous middleware function, ready to be consumed
|
|
361353
|
-
* by JsonRpcEngine.
|
|
361354
|
-
*/
|
|
361355
|
-
function createAsyncMiddleware(asyncMiddleware) {
|
|
361356
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
361357
|
-
return async (request, response, next, end) => {
|
|
361358
|
-
// nextPromise is the key to the implementation
|
|
361359
|
-
// it is resolved by the return handler passed to the
|
|
361360
|
-
// "next" function
|
|
361361
|
-
let resolveNextPromise;
|
|
361362
|
-
const nextPromise = new Promise((resolve) => {
|
|
361363
|
-
resolveNextPromise = resolve;
|
|
361364
|
-
});
|
|
361365
|
-
let returnHandlerCallback = null;
|
|
361366
|
-
let nextWasCalled = false;
|
|
361367
|
-
// This will be called by the consumer's async middleware.
|
|
361368
|
-
const asyncNext = async () => {
|
|
361369
|
-
nextWasCalled = true;
|
|
361370
|
-
// We pass a return handler to next(). When it is called by the engine,
|
|
361371
|
-
// the consumer's async middleware will resume executing.
|
|
361372
|
-
next((runReturnHandlersCallback) => {
|
|
361373
|
-
// This callback comes from JsonRpcEngine._runReturnHandlers
|
|
361374
|
-
returnHandlerCallback = runReturnHandlersCallback;
|
|
361375
|
-
resolveNextPromise();
|
|
361376
|
-
});
|
|
361377
|
-
return nextPromise;
|
|
361378
|
-
};
|
|
361379
|
-
try {
|
|
361380
|
-
await asyncMiddleware(request, response, asyncNext);
|
|
361381
|
-
if (nextWasCalled) {
|
|
361382
|
-
await nextPromise; // we must wait until the return handler is called
|
|
361383
|
-
returnHandlerCallback(null);
|
|
361384
|
-
}
|
|
361385
|
-
else {
|
|
361386
|
-
end(null);
|
|
361387
|
-
}
|
|
361388
|
-
}
|
|
361389
|
-
catch (error) {
|
|
361390
|
-
if (returnHandlerCallback) {
|
|
361391
|
-
returnHandlerCallback(error);
|
|
361392
|
-
}
|
|
361393
|
-
else {
|
|
361394
|
-
end(error);
|
|
361395
|
-
}
|
|
361396
|
-
}
|
|
361397
|
-
};
|
|
361398
|
-
}
|
|
361399
|
-
|
|
361400
361380
|
/**
|
|
361401
361381
|
* A `StructFailure` represents a single specific failure in validation.
|
|
361402
361382
|
*/
|
|
@@ -363041,6 +363021,16 @@ class SafeEventEmitter extends EventEmitter {
|
|
|
363041
363021
|
}
|
|
363042
363022
|
}
|
|
363043
363023
|
|
|
363024
|
+
/**
|
|
363025
|
+
* JSON-stringifies a value.
|
|
363026
|
+
*
|
|
363027
|
+
* @param value - The value to stringify.
|
|
363028
|
+
* @returns The stringified value.
|
|
363029
|
+
*/
|
|
363030
|
+
function stringify(value) {
|
|
363031
|
+
return JSON.stringify(value, null, 2);
|
|
363032
|
+
}
|
|
363033
|
+
|
|
363044
363034
|
var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
363045
363035
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
363046
363036
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -363056,7 +363046,10 @@ var _JsonRpcEngine_instances, _a, _JsonRpcEngine_isDestroyed, _JsonRpcEngine_mid
|
|
|
363056
363046
|
const DESTROYED_ERROR_MESSAGE = 'This engine is destroyed and can no longer be used.';
|
|
363057
363047
|
/**
|
|
363058
363048
|
* A JSON-RPC request and response processor.
|
|
363049
|
+
*
|
|
363059
363050
|
* Give it a stack of middleware, pass it requests, and get back responses.
|
|
363051
|
+
*
|
|
363052
|
+
* @deprecated Use `JsonRpcEngineV2` instead.
|
|
363060
363053
|
*/
|
|
363061
363054
|
class JsonRpcEngine extends SafeEventEmitter {
|
|
363062
363055
|
/**
|
|
@@ -363169,13 +363162,14 @@ class JsonRpcEngine extends SafeEventEmitter {
|
|
|
363169
363162
|
*/
|
|
363170
363163
|
// This function is used in tests, so we cannot easily change it to use the
|
|
363171
363164
|
// hash syntax.
|
|
363172
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
363173
363165
|
async _promiseHandle(request) {
|
|
363174
363166
|
return new Promise((resolve, reject) => {
|
|
363175
363167
|
__classPrivateFieldGet(this, _JsonRpcEngine_instances, "m", _JsonRpcEngine_handle).call(this, request, (error, res) => {
|
|
363176
363168
|
// For notifications, the response will be `undefined`, and any caught
|
|
363177
363169
|
// errors are unexpected and should be surfaced to the caller.
|
|
363178
363170
|
if (error && res === undefined) {
|
|
363171
|
+
// We are not going to change this behavior.
|
|
363172
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
363179
363173
|
reject(error);
|
|
363180
363174
|
}
|
|
363181
363175
|
else {
|
|
@@ -363347,7 +363341,7 @@ async function _JsonRpcEngine_handle(callerReq, callback) {
|
|
|
363347
363341
|
if (returnHandler) {
|
|
363348
363342
|
if (typeof returnHandler !== 'function') {
|
|
363349
363343
|
end(new JsonRpcError(errorCodes.rpc.internal, `JsonRpcEngine: "next" return handlers must be functions. ` +
|
|
363350
|
-
`Received "${typeof returnHandler}" for request:\n${
|
|
363344
|
+
`Received "${typeof returnHandler}" for request:\n${stringify(request)}`, { request }));
|
|
363351
363345
|
}
|
|
363352
363346
|
returnHandlers.push(returnHandler);
|
|
363353
363347
|
}
|
|
@@ -363365,25 +363359,85 @@ async function _JsonRpcEngine_handle(callerReq, callback) {
|
|
|
363365
363359
|
}, _JsonRpcEngine_runReturnHandlers = async function _JsonRpcEngine_runReturnHandlers(handlers) {
|
|
363366
363360
|
for (const handler of handlers) {
|
|
363367
363361
|
await new Promise((resolve, reject) => {
|
|
363362
|
+
// We are not going to change this behavior.
|
|
363363
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
363368
363364
|
handler((error) => (error ? reject(error) : resolve()));
|
|
363369
363365
|
});
|
|
363370
363366
|
}
|
|
363371
363367
|
}, _JsonRpcEngine_checkForCompletion = function _JsonRpcEngine_checkForCompletion(request, response, isComplete) {
|
|
363372
363368
|
if (!hasProperty(response, 'result') && !hasProperty(response, 'error')) {
|
|
363373
|
-
throw new JsonRpcError(errorCodes.rpc.internal, `JsonRpcEngine: Response has no error or result for request:\n${
|
|
363369
|
+
throw new JsonRpcError(errorCodes.rpc.internal, `JsonRpcEngine: Response has no error or result for request:\n${stringify(request)}`, { request });
|
|
363374
363370
|
}
|
|
363375
363371
|
if (!isComplete) {
|
|
363376
|
-
throw new JsonRpcError(errorCodes.rpc.internal, `JsonRpcEngine: Nothing ended request:\n${
|
|
363372
|
+
throw new JsonRpcError(errorCodes.rpc.internal, `JsonRpcEngine: Nothing ended request:\n${stringify(request)}`, { request });
|
|
363377
363373
|
}
|
|
363378
363374
|
};
|
|
363375
|
+
|
|
363379
363376
|
/**
|
|
363380
|
-
*
|
|
363377
|
+
* JsonRpcEngine only accepts callback-based middleware directly.
|
|
363378
|
+
* createAsyncMiddleware exists to enable consumers to pass in async middleware
|
|
363379
|
+
* functions.
|
|
363380
|
+
*
|
|
363381
|
+
* Async middleware have no "end" function. Instead, they "end" if they return
|
|
363382
|
+
* without calling "next". Rather than passing in explicit return handlers,
|
|
363383
|
+
* async middleware can simply await "next", and perform operations on the
|
|
363384
|
+
* response object when execution resumes.
|
|
363381
363385
|
*
|
|
363382
|
-
*
|
|
363383
|
-
*
|
|
363386
|
+
* To accomplish this, createAsyncMiddleware passes the async middleware a
|
|
363387
|
+
* wrapped "next" function. That function calls the internal JsonRpcEngine
|
|
363388
|
+
* "next" function with a return handler that resolves a promise when called.
|
|
363389
|
+
*
|
|
363390
|
+
* The return handler will always be called. Its resolution of the promise
|
|
363391
|
+
* enables the control flow described above.
|
|
363392
|
+
*
|
|
363393
|
+
* @deprecated Use `JsonRpcEngineV2` and its corresponding types instead.
|
|
363394
|
+
* @param asyncMiddleware - The asynchronous middleware function to wrap.
|
|
363395
|
+
* @returns The wrapped asynchronous middleware function, ready to be consumed
|
|
363396
|
+
* by JsonRpcEngine.
|
|
363384
363397
|
*/
|
|
363385
|
-
function
|
|
363386
|
-
|
|
363398
|
+
function createAsyncMiddleware(asyncMiddleware) {
|
|
363399
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
363400
|
+
return async (request, response, next, end) => {
|
|
363401
|
+
// nextPromise is the key to the implementation
|
|
363402
|
+
// it is resolved by the return handler passed to the
|
|
363403
|
+
// "next" function
|
|
363404
|
+
let resolveNextPromise;
|
|
363405
|
+
const nextPromise = new Promise((resolve) => {
|
|
363406
|
+
resolveNextPromise = resolve;
|
|
363407
|
+
});
|
|
363408
|
+
let returnHandlerCallback = null;
|
|
363409
|
+
let nextWasCalled = false;
|
|
363410
|
+
// This will be called by the consumer's async middleware.
|
|
363411
|
+
const asyncNext = async () => {
|
|
363412
|
+
nextWasCalled = true;
|
|
363413
|
+
// We pass a return handler to next(). When it is called by the engine,
|
|
363414
|
+
// the consumer's async middleware will resume executing.
|
|
363415
|
+
next((runReturnHandlersCallback) => {
|
|
363416
|
+
// This callback comes from JsonRpcEngine._runReturnHandlers
|
|
363417
|
+
returnHandlerCallback = runReturnHandlersCallback;
|
|
363418
|
+
resolveNextPromise();
|
|
363419
|
+
});
|
|
363420
|
+
return nextPromise;
|
|
363421
|
+
};
|
|
363422
|
+
try {
|
|
363423
|
+
await asyncMiddleware(request, response, asyncNext);
|
|
363424
|
+
if (nextWasCalled) {
|
|
363425
|
+
await nextPromise; // we must wait until the return handler is called
|
|
363426
|
+
returnHandlerCallback(null);
|
|
363427
|
+
}
|
|
363428
|
+
else {
|
|
363429
|
+
end(null);
|
|
363430
|
+
}
|
|
363431
|
+
}
|
|
363432
|
+
catch (error) {
|
|
363433
|
+
if (returnHandlerCallback) {
|
|
363434
|
+
returnHandlerCallback(error);
|
|
363435
|
+
}
|
|
363436
|
+
else {
|
|
363437
|
+
end(error);
|
|
363438
|
+
}
|
|
363439
|
+
}
|
|
363440
|
+
};
|
|
363387
363441
|
}
|
|
363388
363442
|
|
|
363389
363443
|
const byteToHex = [];
|
|
@@ -363448,6 +363502,14 @@ var __name$5 = (target, value) => __defProp$5(target, "name", { value, configura
|
|
|
363448
363502
|
// src/engine/requestSchemas.ts
|
|
363449
363503
|
var requestSchemas = {};
|
|
363450
363504
|
|
|
363505
|
+
// src/engine/rpcMethodHandlersFromAccountBalanceViewer.ts
|
|
363506
|
+
var rpcMethodHandlersFromAccountBalanceViewer = /* @__PURE__ */ __name$5((viewer) => {
|
|
363507
|
+
return {
|
|
363508
|
+
accountBalanceViewer_accountsBalances: /* @__PURE__ */ __name$5((params) => viewer.accountsBalances(params[0], params[1]), "accountBalanceViewer_accountsBalances"),
|
|
363509
|
+
accountBalanceViewer_accountsBalancesHistory: /* @__PURE__ */ __name$5((params) => viewer.accountsBalancesHistory(params[0], params[1]), "accountBalanceViewer_accountsBalancesHistory")
|
|
363510
|
+
};
|
|
363511
|
+
}, "rpcMethodHandlersFromAccountBalanceViewer");
|
|
363512
|
+
|
|
363451
363513
|
// src/engine/rpcMethodHandlersFromNetworkStakingStepRewardsByPositionViewer.ts
|
|
363452
363514
|
var rpcMethodHandlersFromNetworkStakingStepRewardsByPositionViewer = /* @__PURE__ */ __name$5((viewer) => {
|
|
363453
363515
|
return {
|
|
@@ -363532,6 +363594,13 @@ var rpcMethodHandlersFromConnection = /* @__PURE__ */ __name$5((connection, netw
|
|
|
363532
363594
|
...rpcMethodHandlersFromNetworkStakingStepRewardsByPositionViewer(networkStakeViewer.stepRewards.position)
|
|
363533
363595
|
};
|
|
363534
363596
|
}
|
|
363597
|
+
const accountBalanceViewer = viewer?.account?.balance;
|
|
363598
|
+
if (accountBalanceViewer) {
|
|
363599
|
+
result = {
|
|
363600
|
+
...result,
|
|
363601
|
+
...rpcMethodHandlersFromAccountBalanceViewer(accountBalanceViewer)
|
|
363602
|
+
};
|
|
363603
|
+
}
|
|
363535
363604
|
return result;
|
|
363536
363605
|
}, "rpcMethodHandlersFromConnection");
|
|
363537
363606
|
|
|
@@ -363561,6 +363630,72 @@ var JsonRpcErrorCodes = {
|
|
|
363561
363630
|
|
|
363562
363631
|
// src/types/JsonRpc.ts
|
|
363563
363632
|
var jsonrpc = "2.0";
|
|
363633
|
+
var AccountBalanceViewerRpcSchemas = {
|
|
363634
|
+
accountBalanceViewer_accountsBalances: {
|
|
363635
|
+
params: {
|
|
363636
|
+
to: union$1([
|
|
363637
|
+
tuple([
|
|
363638
|
+
array$1(AddressZod)
|
|
363639
|
+
]),
|
|
363640
|
+
tuple([
|
|
363641
|
+
array$1(AddressZod),
|
|
363642
|
+
union$1([
|
|
363643
|
+
XL1BlockRangeZod,
|
|
363644
|
+
HashZod
|
|
363645
|
+
])
|
|
363646
|
+
])
|
|
363647
|
+
]),
|
|
363648
|
+
from: union$1([
|
|
363649
|
+
tuple([
|
|
363650
|
+
array$1(AddressZod)
|
|
363651
|
+
]),
|
|
363652
|
+
tuple([
|
|
363653
|
+
array$1(AddressZod),
|
|
363654
|
+
union$1([
|
|
363655
|
+
XL1BlockRangeZod,
|
|
363656
|
+
HashZod
|
|
363657
|
+
])
|
|
363658
|
+
])
|
|
363659
|
+
])
|
|
363660
|
+
},
|
|
363661
|
+
result: {
|
|
363662
|
+
to: record$1(AddressZod, BigIntToJsonZod),
|
|
363663
|
+
from: record$1(AddressZod, JsonToBigIntZod)
|
|
363664
|
+
}
|
|
363665
|
+
},
|
|
363666
|
+
accountBalanceViewer_accountsBalancesHistory: {
|
|
363667
|
+
params: {
|
|
363668
|
+
to: union$1([
|
|
363669
|
+
tuple([
|
|
363670
|
+
array$1(AddressZod)
|
|
363671
|
+
]),
|
|
363672
|
+
tuple([
|
|
363673
|
+
array$1(AddressZod),
|
|
363674
|
+
union$1([
|
|
363675
|
+
XL1BlockRangeZod,
|
|
363676
|
+
HashZod
|
|
363677
|
+
])
|
|
363678
|
+
])
|
|
363679
|
+
]),
|
|
363680
|
+
from: union$1([
|
|
363681
|
+
tuple([
|
|
363682
|
+
array$1(AddressZod)
|
|
363683
|
+
]),
|
|
363684
|
+
tuple([
|
|
363685
|
+
array$1(AddressZod),
|
|
363686
|
+
union$1([
|
|
363687
|
+
XL1BlockRangeZod,
|
|
363688
|
+
HashZod
|
|
363689
|
+
])
|
|
363690
|
+
])
|
|
363691
|
+
])
|
|
363692
|
+
},
|
|
363693
|
+
result: {
|
|
363694
|
+
to: record$1(AddressZod, array$1(AccountBalanceHistoryItemZod)),
|
|
363695
|
+
from: record$1(AddressZod, array$1(AccountBalanceHistoryItemZod))
|
|
363696
|
+
}
|
|
363697
|
+
}
|
|
363698
|
+
};
|
|
363564
363699
|
var NetworkStakeViewerRpcSchemas = {
|
|
363565
363700
|
networkStakeViewer_active: {
|
|
363566
363701
|
params: {
|
|
@@ -363660,10 +363795,8 @@ var XyoSignerRpcSchemas = {
|
|
|
363660
363795
|
])
|
|
363661
363796
|
},
|
|
363662
363797
|
result: {
|
|
363663
|
-
to:
|
|
363664
|
-
from:
|
|
363665
|
-
required: true
|
|
363666
|
-
}))
|
|
363798
|
+
to: SignedHydratedTransactionWithHashMetaZod,
|
|
363799
|
+
from: SignedHydratedTransactionWithHashMetaZod
|
|
363667
363800
|
}
|
|
363668
363801
|
}
|
|
363669
363802
|
};
|
|
@@ -364388,6 +364521,7 @@ var XyoViewerRpcSchemas = {
|
|
|
364388
364521
|
|
|
364389
364522
|
// src/types/schema/AllRpcSchemas.ts
|
|
364390
364523
|
var AllRpcSchemas = {
|
|
364524
|
+
...AccountBalanceViewerRpcSchemas,
|
|
364391
364525
|
...XyoRunnerRpcSchemas,
|
|
364392
364526
|
...XyoSignerRpcSchemas,
|
|
364393
364527
|
...XyoViewerRpcSchemas,
|
|
@@ -364467,6 +364601,22 @@ var createResponseSchema = /* @__PURE__ */ __name$5((resultSchema = _undefined()
|
|
|
364467
364601
|
}
|
|
364468
364602
|
}
|
|
364469
364603
|
});
|
|
364604
|
+
({
|
|
364605
|
+
mempoolViewer_pendingTransactions: {
|
|
364606
|
+
params: {
|
|
364607
|
+
to: tuple([
|
|
364608
|
+
PendingTransactionsOptionsZod.optional()
|
|
364609
|
+
]),
|
|
364610
|
+
from: tuple([
|
|
364611
|
+
PendingTransactionsOptionsZod.optional()
|
|
364612
|
+
])
|
|
364613
|
+
},
|
|
364614
|
+
result: {
|
|
364615
|
+
to: array$1(SignedHydratedTransactionWithHashMetaZod),
|
|
364616
|
+
from: array$1(SignedHydratedTransactionWithHashMetaZod)
|
|
364617
|
+
}
|
|
364618
|
+
}
|
|
364619
|
+
});
|
|
364470
364620
|
({
|
|
364471
364621
|
networkStakingStepRewardsByPositionViewer_bonus: {
|
|
364472
364622
|
params: {
|
|
@@ -364854,11 +365004,13 @@ var HttpRpcTransport = class {
|
|
|
364854
365004
|
static {
|
|
364855
365005
|
__name$5(this, "HttpRpcTransport");
|
|
364856
365006
|
}
|
|
365007
|
+
_passThrough;
|
|
364857
365008
|
_rpcUrl;
|
|
364858
365009
|
_schemas;
|
|
364859
|
-
constructor(rpcUrl, schemas) {
|
|
365010
|
+
constructor(rpcUrl, schemas, passThrough = false) {
|
|
364860
365011
|
this._rpcUrl = rpcUrl;
|
|
364861
365012
|
this._schemas = schemas;
|
|
365013
|
+
this._passThrough = passThrough;
|
|
364862
365014
|
}
|
|
364863
365015
|
async sendRequest(method, params) {
|
|
364864
365016
|
return await this.callRpc(this._rpcUrl, this._schemas, method, params);
|
|
@@ -364871,15 +365023,19 @@ var HttpRpcTransport = class {
|
|
|
364871
365023
|
id,
|
|
364872
365024
|
method
|
|
364873
365025
|
};
|
|
365026
|
+
const schema = schemas[method];
|
|
364874
365027
|
if (params) {
|
|
364875
|
-
body.params =
|
|
365028
|
+
body.params = isDefined(schema) ? schema.params.to.parse(params) : this._passThrough ? json$3().parse(params) : void 0;
|
|
365029
|
+
if (!isDefined(body.params)) {
|
|
365030
|
+
throw new Error(`RPC method ${String(method)} missing schema`);
|
|
365031
|
+
}
|
|
364876
365032
|
}
|
|
364877
365033
|
const res = await new Axios(axiosJsonConfig()).post(url, body);
|
|
364878
|
-
const
|
|
364879
|
-
if (isUndefinedOrNull(
|
|
364880
|
-
throw new Error(
|
|
365034
|
+
const json2 = res.data;
|
|
365035
|
+
if (isUndefinedOrNull(json2) || json2.error) {
|
|
365036
|
+
throw new Error(json2.error.message);
|
|
364881
365037
|
}
|
|
364882
|
-
return schemas[method].result.from.parse(
|
|
365038
|
+
return schemas[method].result.from.parse(json2.result);
|
|
364883
365039
|
} catch (ex) {
|
|
364884
365040
|
let message = isError$1(ex) ? ex.message : String(ex);
|
|
364885
365041
|
if (isAxiosError(ex)) {
|
|
@@ -364977,6 +365133,53 @@ var NodeXyoRunner = class {
|
|
|
364977
365133
|
}, "getPendingArchivist");
|
|
364978
365134
|
};
|
|
364979
365135
|
|
|
365136
|
+
// src/provider/viewer/JsonRpcAccountBalanceViewer/JsonRpcAccountBalanceViewerMethods.ts
|
|
365137
|
+
var JsonRpcAccountBalanceViewerMethods = class {
|
|
365138
|
+
static {
|
|
365139
|
+
__name$5(this, "JsonRpcAccountBalanceViewerMethods");
|
|
365140
|
+
}
|
|
365141
|
+
transport;
|
|
365142
|
+
constructor(transport) {
|
|
365143
|
+
this.transport = transport;
|
|
365144
|
+
}
|
|
365145
|
+
async accountsBalances(address, headOrRange) {
|
|
365146
|
+
return await this.transport.sendRequest("accountBalanceViewer_accountsBalances", headOrRange ? [
|
|
365147
|
+
address,
|
|
365148
|
+
headOrRange
|
|
365149
|
+
] : [
|
|
365150
|
+
address
|
|
365151
|
+
]);
|
|
365152
|
+
}
|
|
365153
|
+
async accountsBalancesHistory(address, headOrRange) {
|
|
365154
|
+
return await this.transport.sendRequest("accountBalanceViewer_accountsBalancesHistory", headOrRange ? [
|
|
365155
|
+
address,
|
|
365156
|
+
headOrRange
|
|
365157
|
+
] : [
|
|
365158
|
+
address
|
|
365159
|
+
]);
|
|
365160
|
+
}
|
|
365161
|
+
};
|
|
365162
|
+
|
|
365163
|
+
// src/provider/viewer/JsonRpcAccountBalanceViewer/JsonRpcAccountBalanceViewer.ts
|
|
365164
|
+
(class extends JsonRpcAccountBalanceViewerMethods {
|
|
365165
|
+
static {
|
|
365166
|
+
__name$5(this, "JsonRpcAccountBalanceViewer");
|
|
365167
|
+
}
|
|
365168
|
+
constructor(transport) {
|
|
365169
|
+
super(transport);
|
|
365170
|
+
}
|
|
365171
|
+
async accountBalance(address, headOrRange) {
|
|
365172
|
+
return (await this.accountsBalances([
|
|
365173
|
+
address
|
|
365174
|
+
], headOrRange))[address] ?? asAttoXL1(0);
|
|
365175
|
+
}
|
|
365176
|
+
async accountBalanceHistory(address, headOrRange) {
|
|
365177
|
+
return (await this.accountsBalancesHistory([
|
|
365178
|
+
address
|
|
365179
|
+
], headOrRange))[address] ?? [];
|
|
365180
|
+
}
|
|
365181
|
+
});
|
|
365182
|
+
|
|
364980
365183
|
// src/provider/viewer/JsonRpcViewer.ts
|
|
364981
365184
|
var JsonRpcViewer = class {
|
|
364982
365185
|
static {
|
|
@@ -365140,12 +365343,12 @@ var JsonRpcXyoViewer = class {
|
|
|
365140
365343
|
throw new Error("Method not implemented.");
|
|
365141
365344
|
}
|
|
365142
365345
|
async blockByHash(hash) {
|
|
365143
|
-
return
|
|
365346
|
+
return asSignedHydratedBlockWithHashMeta(await this.transport.sendRequest("xyoViewer_blockByHash", [
|
|
365144
365347
|
hash
|
|
365145
365348
|
])) ?? null;
|
|
365146
365349
|
}
|
|
365147
365350
|
async blockByNumber(blockNumber) {
|
|
365148
|
-
return
|
|
365351
|
+
return asSignedHydratedBlockWithHashMeta(await this.transport.sendRequest("xyoViewer_blockByNumber", [
|
|
365149
365352
|
blockNumber
|
|
365150
365353
|
])) ?? null;
|
|
365151
365354
|
}
|
|
@@ -365153,9 +365356,7 @@ var JsonRpcXyoViewer = class {
|
|
|
365153
365356
|
return (await this.transport.sendRequest("xyoViewer_blocksByHash", [
|
|
365154
365357
|
hash,
|
|
365155
365358
|
limit
|
|
365156
|
-
])).map((b) =>
|
|
365157
|
-
required: true
|
|
365158
|
-
}));
|
|
365359
|
+
])).map((b) => asSignedHydratedBlockWithHashMeta(b, true));
|
|
365159
365360
|
}
|
|
365160
365361
|
async chainId() {
|
|
365161
365362
|
return await this.transport.sendRequest("xyoViewer_chainId");
|
|
@@ -365166,9 +365367,7 @@ var JsonRpcXyoViewer = class {
|
|
|
365166
365367
|
]);
|
|
365167
365368
|
}
|
|
365168
365369
|
async currentBlock() {
|
|
365169
|
-
return
|
|
365170
|
-
required: true
|
|
365171
|
-
});
|
|
365370
|
+
return asSignedHydratedBlockWithHashMeta(await this.transport.sendRequest("xyoViewer_currentBlock"), true);
|
|
365172
365371
|
}
|
|
365173
365372
|
async currentBlockHash() {
|
|
365174
365373
|
return await this.transport.sendRequest("xyoViewer_currentBlockHash");
|
|
@@ -365451,10 +365650,9 @@ var JsonRpcDataLakeViewerMethods = class extends JsonRpcViewer {
|
|
|
365451
365650
|
return await this.transport.sendRequest("xyoSigner_address");
|
|
365452
365651
|
}
|
|
365453
365652
|
async signTransaction(tx) {
|
|
365454
|
-
|
|
365653
|
+
return await this.transport.sendRequest("xyoSigner_signTransaction", [
|
|
365455
365654
|
tx
|
|
365456
365655
|
]);
|
|
365457
|
-
return ret;
|
|
365458
365656
|
}
|
|
365459
365657
|
});
|
|
365460
365658
|
|
|
@@ -365675,7 +365873,7 @@ var addDataLakeRoutes$2 = /* @__PURE__ */ __name$4((app) => {
|
|
|
365675
365873
|
archivistModuleIdentifier
|
|
365676
365874
|
}));
|
|
365677
365875
|
}, "addDataLakeRoutes");
|
|
365678
|
-
var addRpcRoutes = /* @__PURE__ */ __name$4(async (app, transferSummaryMap, stakedChainContext, initRewardsCache) => {
|
|
365876
|
+
var addRpcRoutes = /* @__PURE__ */ __name$4(async (app, transferSummaryMap, stakedChainContext, accountBalanceViewer, initRewardsCache) => {
|
|
365679
365877
|
const { node } = app;
|
|
365680
365878
|
const runner = new NodeXyoRunner(node);
|
|
365681
365879
|
const networkStakeViewer = await SimpleNetworkStakeViewer.create({
|
|
@@ -365688,6 +365886,7 @@ var addRpcRoutes = /* @__PURE__ */ __name$4(async (app, transferSummaryMap, stak
|
|
|
365688
365886
|
node,
|
|
365689
365887
|
rewardMultipliers: RewardMultipliers,
|
|
365690
365888
|
initRewardsCache,
|
|
365889
|
+
accountBalanceViewer,
|
|
365691
365890
|
context: stakedChainContext,
|
|
365692
365891
|
transfersSummaryContext: {
|
|
365693
365892
|
...stakedChainContext,
|
|
@@ -365719,14 +365918,14 @@ var addRpcRoutes = /* @__PURE__ */ __name$4(async (app, transferSummaryMap, stak
|
|
|
365719
365918
|
}, "addRpcRoutes");
|
|
365720
365919
|
|
|
365721
365920
|
// src/server/routes/addRoutes.ts
|
|
365722
|
-
var addRoutes$3 = /* @__PURE__ */ __name$4(async (app, transferSummaryMap, stakedChainContext, initRewardsCache) => {
|
|
365723
|
-
await addRpcRoutes(app, transferSummaryMap, stakedChainContext, initRewardsCache);
|
|
365921
|
+
var addRoutes$3 = /* @__PURE__ */ __name$4(async (app, transferSummaryMap, stakedChainContext, accountBalanceViewer, initRewardsCache) => {
|
|
365922
|
+
await addRpcRoutes(app, transferSummaryMap, stakedChainContext, accountBalanceViewer, initRewardsCache);
|
|
365724
365923
|
addDataLakeRoutes$2(app);
|
|
365725
365924
|
addNodeRoutes$1(app);
|
|
365726
365925
|
}, "addRoutes");
|
|
365727
365926
|
|
|
365728
365927
|
// src/server/app.ts
|
|
365729
|
-
var getApp$3 = /* @__PURE__ */ __name$4(async (node, transferSummaryMap, stakedChainContext, initRewardsCache) => {
|
|
365928
|
+
var getApp$3 = /* @__PURE__ */ __name$4(async (node, transferSummaryMap, stakedChainContext, accountBalanceViewer, initRewardsCache) => {
|
|
365730
365929
|
addInstrumentation$3();
|
|
365731
365930
|
const app = express2();
|
|
365732
365931
|
app.set("etag", false);
|
|
@@ -365741,7 +365940,7 @@ var getApp$3 = /* @__PURE__ */ __name$4(async (node, transferSummaryMap, stakedC
|
|
|
365741
365940
|
app.use(customPoweredByHeader);
|
|
365742
365941
|
disableCaseSensitiveRouting(app);
|
|
365743
365942
|
app.node = node;
|
|
365744
|
-
await addRoutes$3(app, transferSummaryMap, stakedChainContext, initRewardsCache);
|
|
365943
|
+
await addRoutes$3(app, transferSummaryMap, stakedChainContext, accountBalanceViewer, initRewardsCache);
|
|
365745
365944
|
app.use(standardErrors);
|
|
365746
365945
|
return app;
|
|
365747
365946
|
}, "getApp");
|
|
@@ -365814,7 +366013,32 @@ async function getServer$3(context) {
|
|
|
365814
366013
|
await Promise.all(mods.map((mod) => {
|
|
365815
366014
|
return mod.start?.() ?? (() => true);
|
|
365816
366015
|
}));
|
|
365817
|
-
const
|
|
366016
|
+
const chainIterator = await initChainIterator({
|
|
366017
|
+
config,
|
|
366018
|
+
logger,
|
|
366019
|
+
chainMap,
|
|
366020
|
+
head: assertEx(await findMostRecentBlock(chainArchivist), () => "No head found in chainArchivist")
|
|
366021
|
+
});
|
|
366022
|
+
const blockViewer = blockViewerFromChainIteratorAndArchivist(chainIterator, chainArchivist);
|
|
366023
|
+
const accountBalanceViewer = await SimpleAccountBalanceViewer.create({
|
|
366024
|
+
context: {
|
|
366025
|
+
chainId: stakedChainContext.chainId,
|
|
366026
|
+
store: stakedChainContext.store,
|
|
366027
|
+
head: stakedChainContext.head,
|
|
366028
|
+
stepSemaphores: StepSizes.map(() => new Semaphore(20)),
|
|
366029
|
+
summaryMap: balanceSummaryMap
|
|
366030
|
+
},
|
|
366031
|
+
transferContext: {
|
|
366032
|
+
chainId: stakedChainContext.chainId,
|
|
366033
|
+
store: stakedChainContext.store,
|
|
366034
|
+
head: stakedChainContext.head,
|
|
366035
|
+
stepSemaphores: StepSizes.map(() => new Semaphore(20)),
|
|
366036
|
+
summaryMap: transferSummaryMap
|
|
366037
|
+
},
|
|
366038
|
+
blockViewer
|
|
366039
|
+
});
|
|
366040
|
+
assertEx(await accountBalanceViewer.start(), () => "Failed to start SimpleAccountBalanceViewer");
|
|
366041
|
+
const app = await getApp$3(node, transferSummaryMap, stakedChainContext, accountBalanceViewer, config.api.initRewardsCache);
|
|
365818
366042
|
const server = app.listen(port, hostname$3, () => logger?.log(`[API] Server listening at http://${hostname$3}:${port}`));
|
|
365819
366043
|
server.setTimeout(2e4);
|
|
365820
366044
|
return server;
|
|
@@ -366324,15 +366548,16 @@ var getApp$1 = /* @__PURE__ */ __name$2((node) => {
|
|
|
366324
366548
|
var getLocator$1 = /* @__PURE__ */ __name$2(async (context) => {
|
|
366325
366549
|
const { config, logger } = context;
|
|
366326
366550
|
const { otlpEndpoint } = config.telemetry?.otel ?? {};
|
|
366551
|
+
const { path: endpoint = "/metrics", port = 9466 } = config.telemetry?.metrics?.scrape ?? {};
|
|
366327
366552
|
const { traceProvider, meterProvider } = await initTelemetry({
|
|
366328
366553
|
attributes: {
|
|
366329
|
-
serviceName: "xl1-
|
|
366554
|
+
serviceName: "xl1-mempool",
|
|
366330
366555
|
serviceVersion: "1.0.0"
|
|
366331
366556
|
},
|
|
366332
366557
|
otlpEndpoint,
|
|
366333
366558
|
metricsConfig: {
|
|
366334
|
-
endpoint
|
|
366335
|
-
port
|
|
366559
|
+
endpoint,
|
|
366560
|
+
port
|
|
366336
366561
|
}
|
|
366337
366562
|
});
|
|
366338
366563
|
if (isDefined(logger)) AbstractModule.defaultLogger = logger;
|
|
@@ -367010,7 +367235,7 @@ var ChainStepRewardsClaimSentinel = class extends AbstractSentinel {
|
|
|
367010
367235
|
transferPayload
|
|
367011
367236
|
], [], {
|
|
367012
367237
|
nbf: currentBlockNumber,
|
|
367013
|
-
exp: currentBlockNumber + 10
|
|
367238
|
+
exp: asXL1BlockNumber(currentBlockNumber + 10)
|
|
367014
367239
|
});
|
|
367015
367240
|
if (isDefined(result)) return result[1];
|
|
367016
367241
|
}
|
|
@@ -367022,8 +367247,8 @@ var ConfirmedClaimValuesZod = z.object({
|
|
|
367022
367247
|
"To XL1 Address": AddressZod,
|
|
367023
367248
|
"XL1 Amount": z.string(),
|
|
367024
367249
|
"XL1 Amount (Hex)": HexZod,
|
|
367025
|
-
"XL1 Not after block":
|
|
367026
|
-
"XL1 Not before block":
|
|
367250
|
+
"XL1 Not after block": XL1BlockNumberZod,
|
|
367251
|
+
"XL1 Not before block": XL1BlockNumberZod
|
|
367027
367252
|
});
|
|
367028
367253
|
var parseConfirmedClaimValues = /* @__PURE__ */ __name$1((values) => {
|
|
367029
367254
|
return {
|
|
@@ -367121,15 +367346,16 @@ var DerivedAddressWalletTransferSentinel = class extends AbstractSentinel {
|
|
|
367121
367346
|
var getLocator = /* @__PURE__ */ __name$1(async (context) => {
|
|
367122
367347
|
const { config, logger } = context;
|
|
367123
367348
|
const { otlpEndpoint } = config.telemetry?.otel ?? {};
|
|
367349
|
+
const { path: endpoint = "/metrics", port = 9467 } = config.telemetry?.metrics?.scrape ?? {};
|
|
367124
367350
|
const { traceProvider, meterProvider } = await initTelemetry({
|
|
367125
367351
|
attributes: {
|
|
367126
|
-
serviceName: "xl1-
|
|
367352
|
+
serviceName: "xl1-reward-redemption",
|
|
367127
367353
|
serviceVersion: "1.0.0"
|
|
367128
367354
|
},
|
|
367129
367355
|
otlpEndpoint,
|
|
367130
367356
|
metricsConfig: {
|
|
367131
|
-
endpoint
|
|
367132
|
-
port
|
|
367357
|
+
endpoint,
|
|
367358
|
+
port
|
|
367133
367359
|
}
|
|
367134
367360
|
});
|
|
367135
367361
|
if (isDefined(logger)) AbstractModule.defaultLogger = logger;
|
|
@@ -374449,7 +374675,7 @@ var ChainHeadUpdateActor = class _ChainHeadUpdateActor extends Actor {
|
|
|
374449
374675
|
);
|
|
374450
374676
|
}
|
|
374451
374677
|
async checkInsertedForNewHead(data) {
|
|
374452
|
-
const candidateBlock = sortBlocks(
|
|
374678
|
+
const candidateBlock = sortBlocks(data.payloads.filter(isBlockBoundWitness)).at(-1);
|
|
374453
374679
|
await this.updateHeadIfNewer(candidateBlock);
|
|
374454
374680
|
}
|
|
374455
374681
|
async pollForNewHead() {
|
|
@@ -374482,9 +374708,29 @@ var ProducerActor = class _ProducerActor extends Actor {
|
|
|
374482
374708
|
}
|
|
374483
374709
|
_lastProducedBlock;
|
|
374484
374710
|
_lastRedeclarationIntent;
|
|
374711
|
+
_metricAttributes;
|
|
374712
|
+
_producerActorBlockProductionAttempts;
|
|
374713
|
+
_producerActorBlockProductionChecks;
|
|
374714
|
+
_producerActorBlocksProduced;
|
|
374715
|
+
_producerActorBlocksPublished;
|
|
374485
374716
|
_produceBlockMutex = new Mutex$1();
|
|
374486
374717
|
constructor(params) {
|
|
374487
374718
|
super(params.producer.address, "Producer", params);
|
|
374719
|
+
this._metricAttributes = {
|
|
374720
|
+
address: this.account.address.toString()
|
|
374721
|
+
};
|
|
374722
|
+
this._producerActorBlockProductionChecks = this.meter?.createCounter("producer_actor_block_production_checks", {
|
|
374723
|
+
description: "Number of block production checks"
|
|
374724
|
+
});
|
|
374725
|
+
this._producerActorBlockProductionAttempts = this.meter?.createCounter("producer_actor_block_production_attempts", {
|
|
374726
|
+
description: "Number of block production attempts"
|
|
374727
|
+
});
|
|
374728
|
+
this._producerActorBlocksProduced = this.meter?.createCounter("producer_actor_blocks_produced", {
|
|
374729
|
+
description: "Number of blocks produced"
|
|
374730
|
+
});
|
|
374731
|
+
this._producerActorBlocksPublished = this.meter?.createCounter("producer_actor_blocks_published", {
|
|
374732
|
+
description: "Number of blocks published"
|
|
374733
|
+
});
|
|
374488
374734
|
}
|
|
374489
374735
|
get account() {
|
|
374490
374736
|
return assertEx(this.params.account, () => "account not set");
|
|
@@ -374541,6 +374787,7 @@ var ProducerActor = class _ProducerActor extends Actor {
|
|
|
374541
374787
|
return timeToProducerExpiration;
|
|
374542
374788
|
}
|
|
374543
374789
|
async produceBlock() {
|
|
374790
|
+
this._producerActorBlockProductionChecks?.add(1, this._metricAttributes);
|
|
374544
374791
|
await this.spanAsync("produceBlock", async () => {
|
|
374545
374792
|
if (this._produceBlockMutex.isLocked()) {
|
|
374546
374793
|
this.logger?.log("Skipping block production, previous production still in progress");
|
|
@@ -374550,24 +374797,23 @@ var ProducerActor = class _ProducerActor extends Actor {
|
|
|
374550
374797
|
const headStart = Date.now();
|
|
374551
374798
|
const head = await this.chainIterator.head();
|
|
374552
374799
|
const headDuration = Date.now() - headStart;
|
|
374553
|
-
if (headDuration > 500) {
|
|
374554
|
-
this.logger?.warn(`[Slow] Fetched head in ${headDuration}ms: 0x${toHex(head._hash)}`);
|
|
374555
|
-
}
|
|
374800
|
+
if (headDuration > 500) this.logger?.warn(`[Slow] Fetched head in ${headDuration}ms: 0x${toHex(head._hash)}`);
|
|
374556
374801
|
const headHash = head._hash;
|
|
374557
374802
|
if (this._lastProducedBlock && this._lastProducedBlock[0].previous === headHash) {
|
|
374558
374803
|
this.logger?.log("Block already produced:", `0x${toHex(this._lastProducedBlock[0].block)}`, this._lastProducedBlock[0].block);
|
|
374559
374804
|
} else {
|
|
374805
|
+
this._producerActorBlockProductionAttempts?.add(1, this._metricAttributes);
|
|
374560
374806
|
const nextStart = Date.now();
|
|
374561
374807
|
const nextBlock = await this.producer.next(head);
|
|
374562
374808
|
const nextDuration = Date.now() - nextStart;
|
|
374563
|
-
if (nextDuration > 1e3) {
|
|
374564
|
-
this.logger?.warn(`[Slow] Generated next block in ${nextDuration}ms, block: ${nextBlock?.[0]._hash}`);
|
|
374565
|
-
}
|
|
374809
|
+
if (nextDuration > 1e3) this.logger?.warn(`[Slow] Generated next block in ${nextDuration}ms, block: ${nextBlock?.[0]._hash}`);
|
|
374566
374810
|
if (nextBlock) {
|
|
374567
374811
|
const displayBlockNumber = `0x${toHex(nextBlock[0].block)}`;
|
|
374568
374812
|
this.logger?.log("Produced block:", displayBlockNumber);
|
|
374813
|
+
this._producerActorBlocksProduced?.add(1, this._metricAttributes);
|
|
374569
374814
|
await this.chainSubmissionsArchivistWrite.insert(flattenHydratedBlock(nextBlock));
|
|
374570
374815
|
this.logger?.log("Published block:", displayBlockNumber, nextBlock[0].block);
|
|
374816
|
+
this._producerActorBlocksPublished?.add(1, this._metricAttributes);
|
|
374571
374817
|
this._lastProducedBlock = nextBlock;
|
|
374572
374818
|
}
|
|
374573
374819
|
}
|
|
@@ -374607,7 +374853,7 @@ var ProducerActor = class _ProducerActor extends Actor {
|
|
|
374607
374853
|
this.logger?.log("Submitting redeclaration intent for producer:", this.account.address);
|
|
374608
374854
|
const tx = await buildTransaction(this.chainIterator.chainId, [
|
|
374609
374855
|
redeclarationIntent
|
|
374610
|
-
], [], this.account, currentBlock, currentBlock + 1e3);
|
|
374856
|
+
], [], this.account, currentBlock, asXL1BlockNumber(currentBlock + 1e3, true));
|
|
374611
374857
|
const payloads = flattenHydratedTransaction(tx);
|
|
374612
374858
|
const root = tx[0]._hash;
|
|
374613
374859
|
const payloadBundle = new PayloadBuilder({
|
|
@@ -375040,13 +375286,15 @@ async function initTransferSummaryMap(params) {
|
|
|
375040
375286
|
}
|
|
375041
375287
|
__name(initTransferSummaryMap, "initTransferSummaryMap");
|
|
375042
375288
|
var balanceServiceSingleton;
|
|
375043
|
-
var
|
|
375289
|
+
var initAccountBalanceService = /* @__PURE__ */ __name(async (params) => {
|
|
375290
|
+
const { config: config2, logger } = params;
|
|
375044
375291
|
if (balanceServiceSingleton) return balanceServiceSingleton;
|
|
375045
|
-
return await timeBudget("
|
|
375046
|
-
|
|
375292
|
+
return await timeBudget("initAccountBalanceService", params.logger, async () => {
|
|
375293
|
+
config2.services?.accountBalanceViewerEndpoint ?? config2.services?.apiEndpoint;
|
|
375294
|
+
balanceServiceSingleton = await BaseAccountBalanceService.create(params.params);
|
|
375047
375295
|
return balanceServiceSingleton;
|
|
375048
375296
|
}, 2e3, true);
|
|
375049
|
-
}, "
|
|
375297
|
+
}, "initAccountBalanceService");
|
|
375050
375298
|
var canUseChainId = /* @__PURE__ */ __name((config2) => {
|
|
375051
375299
|
return isDefined(config2.evm.chainId);
|
|
375052
375300
|
}, "canUseChainId");
|
|
@@ -375280,7 +375528,7 @@ var getBridgeSourceObservation = /* @__PURE__ */ __name(async (previousBlock, ac
|
|
|
375280
375528
|
]);
|
|
375281
375529
|
}, "getBridgeSourceObservation");
|
|
375282
375530
|
var getFirstBlockForNewChain = /* @__PURE__ */ __name(async (forkBlock, account, chainService) => {
|
|
375283
|
-
const { _hash: previousBlockHash, block: previousBlockNumber, step_hashes: previousStepHashes, protocol } = forkBlock;
|
|
375531
|
+
const { _hash: previousBlockHash, block: previousBlockNumber, step_hashes: previousStepHashes = [], protocol } = forkBlock;
|
|
375284
375532
|
const chainId = chainService.chainId;
|
|
375285
375533
|
const options = {
|
|
375286
375534
|
blockPayloads: [],
|
|
@@ -375323,7 +375571,7 @@ var getForkFromBlock = /* @__PURE__ */ __name(async (head, chainService, chainAr
|
|
|
375323
375571
|
]);
|
|
375324
375572
|
const forkedChainId = await chainService.forkedChainId();
|
|
375325
375573
|
const forkedAtBlockNumber = Number(await chainService.forkedAtBlockNumber());
|
|
375326
|
-
if (
|
|
375574
|
+
if (isSignedBlockBoundWitnessWithHashMeta(forkedAtBlock) && forkedAtBlock.chain === forkedChainId && forkedAtBlock.block === forkedAtBlockNumber) {
|
|
375327
375575
|
return forkedAtBlock;
|
|
375328
375576
|
}
|
|
375329
375577
|
}
|
|
@@ -375366,30 +375614,6 @@ var initHead = /* @__PURE__ */ __name(async (params) => {
|
|
|
375366
375614
|
headSingleton = head;
|
|
375367
375615
|
return headSingleton;
|
|
375368
375616
|
}, "initHead");
|
|
375369
|
-
var chainIteratorServiceSingleton;
|
|
375370
|
-
var stakeIntentServiceSingleton;
|
|
375371
|
-
var electionServiceSingleton;
|
|
375372
|
-
var initChainIterator = /* @__PURE__ */ __name((params) => {
|
|
375373
|
-
if (chainIteratorServiceSingleton) return chainIteratorServiceSingleton;
|
|
375374
|
-
return timeBudget("initChainIterator", params.logger, () => {
|
|
375375
|
-
chainIteratorServiceSingleton = ChainBlockNumberIterationService.create(params);
|
|
375376
|
-
return chainIteratorServiceSingleton;
|
|
375377
|
-
}, 2e3, true);
|
|
375378
|
-
}, "initChainIterator");
|
|
375379
|
-
var initStakeIntentService = /* @__PURE__ */ __name((params) => {
|
|
375380
|
-
if (stakeIntentServiceSingleton) return stakeIntentServiceSingleton;
|
|
375381
|
-
return timeBudget("initStakeIntentService", params.logger, () => {
|
|
375382
|
-
stakeIntentServiceSingleton = XyoStakeIntentService.create(params);
|
|
375383
|
-
return stakeIntentServiceSingleton;
|
|
375384
|
-
}, 2e3, true);
|
|
375385
|
-
}, "initStakeIntentService");
|
|
375386
|
-
var initElectionService = /* @__PURE__ */ __name((params) => {
|
|
375387
|
-
if (electionServiceSingleton) return electionServiceSingleton;
|
|
375388
|
-
return timeBudget("initElectionService", params.logger, () => {
|
|
375389
|
-
electionServiceSingleton = BaseElectionService.create(params);
|
|
375390
|
-
return electionServiceSingleton;
|
|
375391
|
-
}, 2e3, true);
|
|
375392
|
-
}, "initElectionService");
|
|
375393
375617
|
var serviceSingleton;
|
|
375394
375618
|
var initPendingTransactions = /* @__PURE__ */ __name(async (params) => {
|
|
375395
375619
|
if (serviceSingleton) return serviceSingleton;
|
|
@@ -375585,6 +375809,7 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
375585
375809
|
statusReporter
|
|
375586
375810
|
}));
|
|
375587
375811
|
const { otlpEndpoint } = config2.telemetry?.otel ?? {};
|
|
375812
|
+
const { path: endpoint = "/metrics", port = 9464 } = config2.telemetry?.metrics?.scrape ?? {};
|
|
375588
375813
|
const telemetryConfig = {
|
|
375589
375814
|
attributes: {
|
|
375590
375815
|
serviceName: "xl1-producer",
|
|
@@ -375592,8 +375817,8 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
375592
375817
|
},
|
|
375593
375818
|
otlpEndpoint,
|
|
375594
375819
|
metricsConfig: {
|
|
375595
|
-
endpoint
|
|
375596
|
-
port
|
|
375820
|
+
endpoint,
|
|
375821
|
+
port
|
|
375597
375822
|
}
|
|
375598
375823
|
};
|
|
375599
375824
|
const [{ traceProvider, meterProvider }, account] = await Promise.all([
|
|
@@ -375602,6 +375827,11 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
375602
375827
|
]);
|
|
375603
375828
|
const allowedRewardRedeemers = config2.validation?.allowedRewardRedeemers ?? [];
|
|
375604
375829
|
const allowedRewardEscrowAccountSigners = config2.validation?.allowedRewardEscrowAccountSigners ?? [];
|
|
375830
|
+
const baseParamsFields = {
|
|
375831
|
+
logger,
|
|
375832
|
+
meterProvider,
|
|
375833
|
+
traceProvider
|
|
375834
|
+
};
|
|
375605
375835
|
const initParams = {
|
|
375606
375836
|
config: config2,
|
|
375607
375837
|
logger,
|
|
@@ -375665,6 +375895,7 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
375665
375895
|
...initParams
|
|
375666
375896
|
}))
|
|
375667
375897
|
]);
|
|
375898
|
+
const blockViewer = blockViewerFromChainIteratorAndArchivist(chainIterator, chainArchivist);
|
|
375668
375899
|
const balanceContext = {
|
|
375669
375900
|
stepSemaphores: StepSizes.map(() => new Semaphore(20)),
|
|
375670
375901
|
store: {
|
|
@@ -375696,12 +375927,16 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
375696
375927
|
summaryMap: transferSummaryMap
|
|
375697
375928
|
};
|
|
375698
375929
|
const [balanceService] = await Promise.all([
|
|
375699
|
-
startupSpanAsync("BalanceService", () =>
|
|
375700
|
-
|
|
375701
|
-
|
|
375702
|
-
|
|
375703
|
-
|
|
375704
|
-
|
|
375930
|
+
startupSpanAsync("BalanceService", () => initAccountBalanceService({
|
|
375931
|
+
params: {
|
|
375932
|
+
name: "BalanceService",
|
|
375933
|
+
config: {},
|
|
375934
|
+
context: balanceContext,
|
|
375935
|
+
blockViewer,
|
|
375936
|
+
chainArchivist,
|
|
375937
|
+
chainIterator,
|
|
375938
|
+
transferContext
|
|
375939
|
+
},
|
|
375705
375940
|
...initParams
|
|
375706
375941
|
})),
|
|
375707
375942
|
startupSpanAsync("TransferService", () => initTransferService({
|
|
@@ -375759,7 +375994,7 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
375759
375994
|
...initParams
|
|
375760
375995
|
};
|
|
375761
375996
|
const producer = await startupSpanAsync("Producer", () => initBlockProducer(producerParams));
|
|
375762
|
-
const
|
|
375997
|
+
const services = {
|
|
375763
375998
|
account,
|
|
375764
375999
|
balance: balanceService,
|
|
375765
376000
|
chainArchivist,
|
|
@@ -375778,11 +376013,14 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
375778
376013
|
logger?.log("All services created. Starting...");
|
|
375779
376014
|
const startableServices = [
|
|
375780
376015
|
balanceSummaryMap,
|
|
375781
|
-
...Object.values(
|
|
376016
|
+
...Object.values(services)
|
|
375782
376017
|
].filter(isStartable);
|
|
375783
376018
|
assertEx((await Promise.all(startableServices.map((service) => service.start()))).every(Boolean), () => "One or more services failed to start");
|
|
375784
376019
|
logger?.log("All services started successfully.");
|
|
375785
|
-
return
|
|
376020
|
+
return {
|
|
376021
|
+
...services,
|
|
376022
|
+
...baseParamsFields
|
|
376023
|
+
};
|
|
375786
376024
|
}, "initServices");
|
|
375787
376025
|
function runApi(context) {
|
|
375788
376026
|
void getServer$3(context);
|
|
@@ -375915,7 +376153,7 @@ var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
|
|
|
375915
376153
|
|
|
375916
376154
|
// src/runCLI.ts
|
|
375917
376155
|
var configuration;
|
|
375918
|
-
var version = isDefined("1.16.
|
|
376156
|
+
var version = isDefined("1.16.24") ? "1.16.24" : "unknown";
|
|
375919
376157
|
var getContextFromConfig = /* @__PURE__ */ __name((configuration2) => {
|
|
375920
376158
|
const logger = initLogger(configuration2);
|
|
375921
376159
|
const orchestrator = new Orchestrator(logger);
|