@xyo-network/xl1-protocol 1.13.0 → 1.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/index.mjs +128 -99
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/model/BlockNumber/BlockNumber.d.ts +12 -9
- package/dist/neutral/model/BlockNumber/BlockNumber.d.ts.map +1 -1
- package/dist/neutral/model/BlockNumber/EthBlockNumber.d.ts +13 -10
- package/dist/neutral/model/BlockNumber/EthBlockNumber.d.ts.map +1 -1
- package/dist/neutral/model/BlockNumber/Numberish.d.ts +3 -0
- package/dist/neutral/model/BlockNumber/Numberish.d.ts.map +1 -0
- package/dist/neutral/model/BlockNumber/XL1BlockNumber.d.ts +12 -9
- package/dist/neutral/model/BlockNumber/XL1BlockNumber.d.ts.map +1 -1
- package/dist/neutral/model/BlockNumber/index.d.ts +1 -0
- package/dist/neutral/model/BlockNumber/index.d.ts.map +1 -1
- package/dist/neutral/model/BlockRange/BlockRange.d.ts +23 -0
- package/dist/neutral/model/BlockRange/BlockRange.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/EthBlockRange.d.ts +23 -0
- package/dist/neutral/model/BlockRange/EthBlockRange.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/Numberish.d.ts +3 -0
- package/dist/neutral/model/BlockRange/Numberish.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/Range.d.ts +13 -0
- package/dist/neutral/model/BlockRange/Range.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/XL1BlockRange.d.ts +23 -0
- package/dist/neutral/model/BlockRange/XL1BlockRange.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/index.d.ts +5 -0
- package/dist/neutral/model/BlockRange/index.d.ts.map +1 -0
- package/dist/neutral/model/RangeMultipliers.d.ts +1 -1
- package/dist/neutral/model/RangeMultipliers.d.ts.map +1 -1
- package/dist/neutral/model/index.d.ts +1 -0
- package/dist/neutral/model/index.d.ts.map +1 -1
- package/dist/neutral/model/zod/index.d.ts +4 -0
- package/dist/neutral/model/zod/index.d.ts.map +1 -0
- package/dist/neutral/model/zod/zodAsFactory.d.ts +7 -0
- package/dist/neutral/model/zod/zodAsFactory.d.ts.map +1 -0
- package/dist/neutral/model/zod/zodIsFactory.d.ts +3 -0
- package/dist/neutral/model/zod/zodIsFactory.d.ts.map +1 -0
- package/dist/neutral/model/zod/zodToFactory.d.ts +6 -0
- package/dist/neutral/model/zod/zodToFactory.d.ts.map +1 -0
- package/dist/neutral/transaction/HydratedTransactionWithHashMeta.d.ts +7 -0
- package/dist/neutral/transaction/HydratedTransactionWithHashMeta.d.ts.map +1 -0
- package/dist/neutral/transaction/SignedHydratedTransactionWithHashMeta.d.ts +7 -0
- package/dist/neutral/transaction/SignedHydratedTransactionWithHashMeta.d.ts.map +1 -0
- package/dist/neutral/transaction/SignedHydratedTransactionWithStorageMeta.d.ts +1 -1
- package/dist/neutral/transaction/SignedHydratedTransactionWithStorageMeta.d.ts.map +1 -1
- package/dist/neutral/transaction/index.d.ts +2 -0
- package/dist/neutral/transaction/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants/StepSizes.ts +9 -9
- package/src/model/BlockNumber/BlockNumber.ts +9 -23
- package/src/model/BlockNumber/EthBlockNumber.ts +8 -17
- package/src/model/BlockNumber/Numberish.ts +5 -0
- package/src/model/BlockNumber/XL1BlockNumber.ts +7 -16
- package/src/model/BlockNumber/index.ts +1 -0
- package/src/model/BlockRange/BlockRange.ts +30 -0
- package/src/model/BlockRange/EthBlockRange.ts +30 -0
- package/src/model/BlockRange/Numberish.ts +5 -0
- package/src/model/BlockRange/Range.ts +13 -0
- package/src/model/BlockRange/XL1BlockRange.ts +30 -0
- package/src/model/BlockRange/index.ts +4 -0
- package/src/model/RangeMultipliers.ts +1 -1
- package/src/model/StepIdentity.ts +4 -4
- package/src/model/index.ts +1 -0
- package/src/model/zod/index.ts +3 -0
- package/src/model/zod/zodAsFactory.ts +17 -0
- package/src/model/zod/zodIsFactory.ts +5 -0
- package/src/model/zod/zodToFactory.ts +7 -0
- package/src/transaction/HydratedTransactionWithHashMeta.ts +23 -0
- package/src/transaction/SignedHydratedTransactionWithHashMeta.ts +25 -0
- package/src/transaction/SignedHydratedTransactionWithStorageMeta.ts +4 -2
- package/src/transaction/index.ts +2 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AssertConfig } from '@xylabs/hex';
|
|
2
|
+
import { type Brand } from '@xylabs/typeof';
|
|
3
|
+
import z from 'zod';
|
|
4
|
+
import { type BlockNumber } from '../BlockNumber/index.ts';
|
|
5
|
+
export type EthBlockRange = [BlockNumber, BlockNumber];
|
|
6
|
+
export type NumberishEthBlockRange = [BlockNumber, BlockNumber];
|
|
7
|
+
export declare const EthBlockRangeZod: z.ZodTuple<[z.ZodPipe<z.ZodNumber, z.ZodTransform<BlockNumber, number>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<BlockNumber, number>>], null>;
|
|
8
|
+
export declare const NumberishEthBlockRangeZod: z.ZodTuple<[z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>, z.ZodNumber>, z.ZodTransform<BlockNumber, number>>, z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>, z.ZodNumber>, z.ZodTransform<BlockNumber, number>>], null>;
|
|
9
|
+
export declare const asEthBlockRange: {
|
|
10
|
+
(value: unknown): EthBlockRange | undefined;
|
|
11
|
+
(value: unknown, assert: AssertConfig): EthBlockRange;
|
|
12
|
+
};
|
|
13
|
+
export declare const toEthBlockRange: {
|
|
14
|
+
(value: unknown): EthBlockRange | undefined;
|
|
15
|
+
(value: unknown, assert: AssertConfig): EthBlockRange;
|
|
16
|
+
};
|
|
17
|
+
export type EthBlockRangeKey = Brand<string, {
|
|
18
|
+
readonly __xl1BlockRangeKey: true;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const toEthBlockNumberKey: (range: EthBlockRange) => EthBlockRangeKey;
|
|
21
|
+
export declare function fromEthBlockNumberKey(key: EthBlockRangeKey): EthBlockRange | undefined;
|
|
22
|
+
export declare function fromEthBlockNumberKey(key: EthBlockRangeKey, assert: AssertConfig): EthBlockRange;
|
|
23
|
+
//# sourceMappingURL=EthBlockRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthBlockRange.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/EthBlockRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EAAE,KAAK,KAAK,EAAa,MAAM,gBAAgB,CAAA;AACtD,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAA;AAGhC,MAAM,MAAM,aAAa,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;AACtD,MAAM,MAAM,sBAAsB,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;AAE/D,eAAO,MAAM,gBAAgB,8IAA4C,CAAA;AACzE,eAAO,MAAM,yBAAyB,0ZAA8D,CAAA;AAEpG,eAAO,MAAM,eAAe;;;CAAgD,CAAA;AAC5E,eAAO,MAAM,eAAe;;;CAAyD,CAAA;AAErF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAA;CAAE,CAAC,CAAA;AACnF,eAAO,MAAM,mBAAmB,GAAI,OAAO,aAAa,KAAkC,gBAAgB,CAAA;AAE1G,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,GAAG,SAAS,CAAA;AACvF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const NumberishRangeZod: z.ZodTuple<[z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>, z.ZodNumber>, z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>, z.ZodNumber>], null>;
|
|
3
|
+
//# sourceMappingURL=Numberish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Numberish.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/Numberish.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAInB,eAAO,MAAM,iBAAiB,0TAAwC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const RangeZod: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
3
|
+
export type Range = z.infer<typeof RangeZod>;
|
|
4
|
+
export declare const isRange: (value: unknown) => value is [number, number];
|
|
5
|
+
export declare const asRange: {
|
|
6
|
+
(value: unknown): [number, number] | undefined;
|
|
7
|
+
(value: unknown, assert: import("@xylabs/hex").AssertConfig): [number, number];
|
|
8
|
+
};
|
|
9
|
+
export declare const toRange: {
|
|
10
|
+
(value: unknown): [number, number] | undefined;
|
|
11
|
+
(value: unknown, assert: import("@xylabs/hex").AssertConfig): [number, number];
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=Range.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/Range.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAMnB,eAAO,MAAM,QAAQ,8CAAoC,CAAA;AAEzD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAA;AAE5C,eAAO,MAAM,OAAO,+CAAgC,CAAA;AACpD,eAAO,MAAM,OAAO;;;CAAgC,CAAA;AACpD,eAAO,MAAM,OAAO;;;CAAgC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AssertConfig } from '@xylabs/hex';
|
|
2
|
+
import { type Brand } from '@xylabs/typeof';
|
|
3
|
+
import z from 'zod';
|
|
4
|
+
import { type BlockNumber } from '../BlockNumber/index.ts';
|
|
5
|
+
export type XL1BlockRange = [BlockNumber, BlockNumber];
|
|
6
|
+
export type NumberishXL1BlockRange = [BlockNumber, BlockNumber];
|
|
7
|
+
export declare const XL1BlockRangeZod: z.ZodTuple<[z.ZodPipe<z.ZodNumber, z.ZodTransform<BlockNumber, number>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<BlockNumber, number>>], null>;
|
|
8
|
+
export declare const NumberishXL1BlockRangeZod: z.ZodTuple<[z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>, z.ZodNumber>, z.ZodTransform<BlockNumber, number>>, z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>, z.ZodNumber>, z.ZodTransform<BlockNumber, number>>], null>;
|
|
9
|
+
export declare const asXL1BlockRange: {
|
|
10
|
+
(value: unknown): XL1BlockRange | undefined;
|
|
11
|
+
(value: unknown, assert: AssertConfig): XL1BlockRange;
|
|
12
|
+
};
|
|
13
|
+
export declare const toXL1BlockRange: {
|
|
14
|
+
(value: unknown): XL1BlockRange | undefined;
|
|
15
|
+
(value: unknown, assert: AssertConfig): XL1BlockRange;
|
|
16
|
+
};
|
|
17
|
+
export type XL1BlockRangeKey = Brand<string, {
|
|
18
|
+
readonly __xl1BlockRangeKey: true;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const toXL1BlockNumberKey: (range: XL1BlockRange) => XL1BlockRangeKey;
|
|
21
|
+
export declare function fromXL1BlockNumberKey(key: XL1BlockRangeKey): XL1BlockRange | undefined;
|
|
22
|
+
export declare function fromXL1BlockNumberKey(key: XL1BlockRangeKey, assert: AssertConfig): XL1BlockRange;
|
|
23
|
+
//# sourceMappingURL=XL1BlockRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XL1BlockRange.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/XL1BlockRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EAAE,KAAK,KAAK,EAAa,MAAM,gBAAgB,CAAA;AACtD,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAA;AAGhC,MAAM,MAAM,aAAa,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;AACtD,MAAM,MAAM,sBAAsB,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;AAE/D,eAAO,MAAM,gBAAgB,8IAA4C,CAAA;AACzE,eAAO,MAAM,yBAAyB,0ZAA8D,CAAA;AAEpG,eAAO,MAAM,eAAe;;;CAAgD,CAAA;AAC5E,eAAO,MAAM,eAAe;;;CAAyD,CAAA;AAErF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAA;CAAE,CAAC,CAAA;AACnF,eAAO,MAAM,mBAAmB,GAAI,OAAO,aAAa,KAAkC,gBAAgB,CAAA;AAE1G,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,GAAG,SAAS,CAAA;AACvF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BlockRangeKey, EthBlockRangeKey, XL1BlockRangeKey } from './
|
|
1
|
+
import type { BlockRangeKey, EthBlockRangeKey, XL1BlockRangeKey } from './BlockRange/index.ts';
|
|
2
2
|
export type BigFraction = [bigint, bigint];
|
|
3
3
|
export type RangeMultipliers = Record<BlockRangeKey, BigFraction>;
|
|
4
4
|
export type EthRangeMultipliers = Record<EthBlockRangeKey, BigFraction>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeMultipliers.d.ts","sourceRoot":"","sources":["../../../src/model/RangeMultipliers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAClD,MAAM,
|
|
1
|
+
{"version":3,"file":"RangeMultipliers.d.ts","sourceRoot":"","sources":["../../../src/model/RangeMultipliers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAClD,MAAM,uBAAuB,CAAA;AAE9B,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE1C,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;AACjE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAA;AACvE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/model/zod/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AssertConfig } from '@xylabs/hex';
|
|
2
|
+
import type z from 'zod';
|
|
3
|
+
export declare function zodAsFactory<T>(zod: z.ZodType<T>): {
|
|
4
|
+
(value: unknown): T | undefined;
|
|
5
|
+
(value: unknown, assert: AssertConfig): T;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=zodAsFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zodAsFactory.d.ts","sourceRoot":"","sources":["../../../../src/model/zod/zodAsFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACxB,OAAO,GAAG,CAAC,GAAG,SAAS;YACvB,OAAO,UAAU,YAAY,GAAG,CAAC;EAUzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zodIsFactory.d.ts","sourceRoot":"","sources":["../../../../src/model/zod/zodIsFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IACvC,OAAO,OAAO,KAAG,KAAK,IAAI,CAAC,CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zodToFactory.d.ts","sourceRoot":"","sources":["../../../../src/model/zod/zodToFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAIxB,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;;;EAEhD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Signed } from '@xyo-network/boundwitness-model';
|
|
2
|
+
import { type Payload, type WithHashMeta } from '@xyo-network/payload-model';
|
|
3
|
+
import { type TransactionBoundWitness } from './TransactionBoundWitness.ts';
|
|
4
|
+
export type HydratedTransactionWithHashMeta<T extends TransactionBoundWitness = TransactionBoundWitness, P extends Payload = Payload> = [WithHashMeta<Signed<T>>, WithHashMeta<P>[]];
|
|
5
|
+
export declare const isHydratedTransactionWithHashMeta: (value: unknown) => value is HydratedTransactionWithHashMeta;
|
|
6
|
+
export declare const asHydratedTransactionWithHashMeta: import("@xylabs/object").AsTypeFunction<HydratedTransactionWithHashMeta<TransactionBoundWitness, Payload>>;
|
|
7
|
+
//# sourceMappingURL=HydratedTransactionWithHashMeta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HydratedTransactionWithHashMeta.d.ts","sourceRoot":"","sources":["../../../src/transaction/HydratedTransactionWithHashMeta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EACU,KAAK,OAAO,EAAE,KAAK,YAAY,EAC/C,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAE3E,MAAM,MAAM,+BAA+B,CAAC,CAAC,SAAS,uBAAuB,GAAG,uBAAuB,EACrG,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAE7E,eAAO,MAAM,iCAAiC,GAC5C,OAAO,OAAO,KACb,KAAK,IAAI,+BAIX,CAAA;AAED,eAAO,MAAM,iCAAiC,4GAE7C,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Signed } from '@xyo-network/boundwitness-model';
|
|
2
|
+
import type { Payload, WithHashMeta } from '@xyo-network/payload-model';
|
|
3
|
+
import { type TransactionBoundWitness } from './TransactionBoundWitness.ts';
|
|
4
|
+
export type SignedHydratedTransactionWithHashMeta<T extends TransactionBoundWitness = TransactionBoundWitness, P extends Payload = Payload> = [WithHashMeta<Signed<T>>, WithHashMeta<P>[]];
|
|
5
|
+
export declare const isSignedHydratedTransactionWithHashMeta: (value: unknown) => value is SignedHydratedTransactionWithHashMeta;
|
|
6
|
+
export declare const asSignedHydratedTransactionWithHashMeta: import("@xylabs/object").AsTypeFunction<SignedHydratedTransactionWithHashMeta<TransactionBoundWitness, Payload>>;
|
|
7
|
+
//# sourceMappingURL=SignedHydratedTransactionWithHashMeta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignedHydratedTransactionWithHashMeta.d.ts","sourceRoot":"","sources":["../../../src/transaction/SignedHydratedTransactionWithHashMeta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EACb,MAAM,4BAA4B,CAAA;AAInC,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAE3E,MAAM,MAAM,qCAAqC,CAAC,CAAC,SAAS,uBAAuB,GAAG,uBAAuB,EAC3G,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAE7E,eAAO,MAAM,uCAAuC,GAClD,OAAO,OAAO,KACb,KAAK,IAAI,qCAIX,CAAA;AAED,eAAO,MAAM,uCAAuC,kHAEnD,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Signed } from '@xyo-network/boundwitness-model';
|
|
2
|
-
import {
|
|
2
|
+
import type { Payload, WithStorageMeta } from '@xyo-network/payload-model';
|
|
3
3
|
import { type TransactionBoundWitness } from './TransactionBoundWitness.ts';
|
|
4
4
|
export type SignedHydratedTransactionWithStorageMeta<T extends TransactionBoundWitness = TransactionBoundWitness, P extends Payload = Payload> = [WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]];
|
|
5
5
|
export declare const isSignedHydratedTransactionWithStorageMeta: (value: unknown) => value is SignedHydratedTransactionWithStorageMeta;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignedHydratedTransactionWithStorageMeta.d.ts","sourceRoot":"","sources":["../../../src/transaction/SignedHydratedTransactionWithStorageMeta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"SignedHydratedTransactionWithStorageMeta.d.ts","sourceRoot":"","sources":["../../../src/transaction/SignedHydratedTransactionWithStorageMeta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EAChB,MAAM,4BAA4B,CAAA;AAInC,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAE3E,MAAM,MAAM,wCAAwC,CAAC,CAAC,SAAS,uBAAuB,GAAG,uBAAuB,EAC9G,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAEnF,eAAO,MAAM,0CAA0C,GACrD,OAAO,OAAO,KACb,KAAK,IAAI,wCAIX,CAAA;AAED,eAAO,MAAM,0CAA0C,qHAEtD,CAAA"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './AnyHydratedTransaction.ts';
|
|
2
2
|
export * from './HydratedTransaction.ts';
|
|
3
|
+
export * from './HydratedTransactionWithHashMeta.ts';
|
|
3
4
|
export * from './HydratedTransactionWithStorageMeta.ts';
|
|
4
5
|
export * from './SignedHydratedTransaction.ts';
|
|
6
|
+
export * from './SignedHydratedTransactionWithHashMeta.ts';
|
|
5
7
|
export * from './SignedHydratedTransactionWithStorageMeta.ts';
|
|
6
8
|
export * from './TransactionBoundWitness.ts';
|
|
7
9
|
export * from './TransactionBoundWitnessDeprecated.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AACxC,cAAc,yCAAyC,CAAA;AACvD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+CAA+C,CAAA;AAC7D,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wCAAwC,CAAA;AACtD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kCAAkC,CAAA;AAChD,cAAc,8CAA8C,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sCAAsC,CAAA;AACpD,cAAc,yCAAyC,CAAA;AACvD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,4CAA4C,CAAA;AAC1D,cAAc,+CAA+C,CAAA;AAC7D,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wCAAwC,CAAA;AACtD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kCAAkC,CAAA;AAChD,cAAc,8CAA8C,CAAA"}
|
package/package.json
CHANGED
|
@@ -6,15 +6,15 @@ import { asXL1BlockNumber, type XL1BlockNumber } from '../model/index.ts'
|
|
|
6
6
|
// primorial(n+2) = 2 → 2×3=6 → 6×5=30 → 30×7=210 → 210×11=2310
|
|
7
7
|
|
|
8
8
|
export const StepSizes: XL1BlockNumber[] = [
|
|
9
|
-
asXL1BlockNumber(7),
|
|
10
|
-
asXL1BlockNumber(31),
|
|
11
|
-
asXL1BlockNumber(211),
|
|
12
|
-
asXL1BlockNumber(2311),
|
|
13
|
-
asXL1BlockNumber(30_031),
|
|
14
|
-
asXL1BlockNumber(510_511),
|
|
15
|
-
asXL1BlockNumber(9_699_691),
|
|
16
|
-
asXL1BlockNumber(223_092_871),
|
|
17
|
-
asXL1BlockNumber(6_469_693_231),
|
|
9
|
+
asXL1BlockNumber(7, true),
|
|
10
|
+
asXL1BlockNumber(31, true),
|
|
11
|
+
asXL1BlockNumber(211, true),
|
|
12
|
+
asXL1BlockNumber(2311, true),
|
|
13
|
+
asXL1BlockNumber(30_031, true),
|
|
14
|
+
asXL1BlockNumber(510_511, true),
|
|
15
|
+
asXL1BlockNumber(9_699_691, true),
|
|
16
|
+
asXL1BlockNumber(223_092_871, true),
|
|
17
|
+
asXL1BlockNumber(6_469_693_231, true),
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
export function isValidStep(step: unknown): step is number {
|
|
@@ -1,29 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
type Brand, isArray, isNumber,
|
|
4
|
-
} from '@xylabs/typeof'
|
|
1
|
+
import { type Brand } from '@xylabs/typeof'
|
|
2
|
+
import z from 'zod'
|
|
5
3
|
|
|
6
|
-
|
|
4
|
+
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
5
|
+
import { NumberishZod } from './Numberish.ts'
|
|
7
6
|
|
|
8
|
-
export type
|
|
7
|
+
export type BlockNumber = Brand<number, { readonly __blockNumber: true }>
|
|
9
8
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
return value as BlockNumber
|
|
13
|
-
}
|
|
9
|
+
export const BlockNumberZod = z.number().transform(v => v as BlockNumber)
|
|
10
|
+
export const NumberishBlockNumberZod = NumberishZod.transform(v => v as BlockNumber)
|
|
14
11
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
return value as BlockRange
|
|
18
|
-
}
|
|
19
|
-
throw new Error('Not a valid BlockNumberRange')
|
|
20
|
-
}
|
|
12
|
+
export const asBlockNumber = zodAsFactory<BlockNumber>(BlockNumberZod)
|
|
13
|
+
export const toBlockNumber = zodToFactory<BlockNumber>(NumberishBlockNumberZod)
|
|
21
14
|
|
|
22
15
|
export const BLOCK_NUMBER_ZERO = asBlockNumber(0)
|
|
23
|
-
|
|
24
|
-
export type BlockRangeKey = Brand<string, { readonly __blockRangeKey: true }>
|
|
25
|
-
export const toBlockNumberKey = (range: BlockRange) => `${range[0]}|${range[1]}` as BlockRangeKey
|
|
26
|
-
export const fromBlockNumberKey = (key: BlockRangeKey): BlockRange => {
|
|
27
|
-
const [start, end] = key.split('|').map(v => asBlockNumber(Number(v)))
|
|
28
|
-
return [start, end]
|
|
29
|
-
}
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import { type Brand } from '@xylabs/typeof'
|
|
2
|
+
import z from 'zod'
|
|
2
3
|
|
|
4
|
+
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
3
5
|
import type { BlockNumber } from './BlockNumber.ts'
|
|
4
|
-
import {
|
|
6
|
+
import { NumberishBlockNumberZod } from './BlockNumber.ts'
|
|
5
7
|
|
|
6
|
-
export type EthBlockNumber = Brand<BlockNumber, { __ethBlockNumber: true }>
|
|
8
|
+
export type EthBlockNumber = Brand<BlockNumber, { readonly __ethBlockNumber: true }>
|
|
7
9
|
|
|
8
|
-
export
|
|
10
|
+
export const EthBlockNumberZod = z.number().transform(v => v as EthBlockNumber)
|
|
11
|
+
export const NumberishEthBlockNumberZod = NumberishBlockNumberZod.transform(v => v as EthBlockNumber)
|
|
9
12
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function asEthBlockRange(value: unknown) {
|
|
15
|
-
return asBlockRange(value) as EthBlockRange
|
|
16
|
-
}
|
|
13
|
+
export const asEthBlockNumber = zodAsFactory<EthBlockNumber>(EthBlockNumberZod)
|
|
14
|
+
export const toEthBlockNumber = zodToFactory<EthBlockNumber>(NumberishEthBlockNumberZod)
|
|
17
15
|
|
|
18
16
|
export const ETH_BLOCK_NUMBER_ZERO = asEthBlockNumber(0)
|
|
19
|
-
|
|
20
|
-
export type EthBlockRangeKey = Brand<string, { readonly __blockRangeKey: true }>
|
|
21
|
-
export const toEthBlockRangeKey = (range: EthBlockRange) => `${range[0]}|${range[1]}` as EthBlockRangeKey
|
|
22
|
-
export const fromEthBlockNumberKey = (key: EthBlockRangeKey): EthBlockRange => {
|
|
23
|
-
const [start, end] = key.split('|').map(v => asEthBlockNumber(Number(v)))
|
|
24
|
-
return [start, end]
|
|
25
|
-
}
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import { type Brand } from '@xylabs/typeof'
|
|
2
|
+
import z from 'zod'
|
|
2
3
|
|
|
4
|
+
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
3
5
|
import type { BlockNumber } from './BlockNumber.ts'
|
|
4
|
-
import {
|
|
6
|
+
import { NumberishBlockNumberZod } from './BlockNumber.ts'
|
|
5
7
|
|
|
6
8
|
export type XL1BlockNumber = Brand<BlockNumber, { readonly __xl1BlockNumber: true }>
|
|
7
9
|
|
|
8
|
-
export
|
|
10
|
+
export const XL1BlockNumberZod = z.number().transform(v => v as XL1BlockNumber)
|
|
11
|
+
export const NumberishXL1BlockNumberZod = NumberishBlockNumberZod.transform(v => v as XL1BlockNumber)
|
|
9
12
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function asXL1BlockRange(value: unknown) {
|
|
15
|
-
return asBlockRange(value) as XL1BlockRange
|
|
16
|
-
}
|
|
13
|
+
export const asXL1BlockNumber = zodAsFactory<XL1BlockNumber>(XL1BlockNumberZod)
|
|
14
|
+
export const toXL1BlockNumber = zodToFactory<XL1BlockNumber>(NumberishXL1BlockNumberZod)
|
|
17
15
|
|
|
18
16
|
export const XL1_BLOCK_NUMBER_ZERO = asXL1BlockNumber(0)
|
|
19
|
-
|
|
20
|
-
export type XL1BlockRangeKey = Brand<string, { readonly __blockRangeKey: true }>
|
|
21
|
-
export const toXL1BlockRangeKey = (range: XL1BlockRange) => `${range[0]}|${range[1]}` as XL1BlockRangeKey
|
|
22
|
-
export const fromXL1BlockNumberKey = (key: XL1BlockRangeKey): XL1BlockRange => {
|
|
23
|
-
const [start, end] = key.split('|').map(v => asXL1BlockNumber(Number(v)))
|
|
24
|
-
return [start, end]
|
|
25
|
-
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AssertConfig } from '@xylabs/hex'
|
|
2
|
+
import { assertError } from '@xylabs/hex'
|
|
3
|
+
import { type Brand, isDefined } from '@xylabs/typeof'
|
|
4
|
+
import z from 'zod'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
asBlockNumber,
|
|
8
|
+
type BlockNumber, BlockNumberZod, NumberishBlockNumberZod,
|
|
9
|
+
} from '../BlockNumber/index.ts'
|
|
10
|
+
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
11
|
+
|
|
12
|
+
export type BlockRange = [BlockNumber, BlockNumber]
|
|
13
|
+
export type NumberishBlockRange = [BlockNumber, BlockNumber]
|
|
14
|
+
|
|
15
|
+
export const BlockRangeZod = z.tuple([BlockNumberZod, BlockNumberZod])
|
|
16
|
+
export const NumberishBlockRangeZod = z.tuple([NumberishBlockNumberZod, NumberishBlockNumberZod])
|
|
17
|
+
|
|
18
|
+
export const asBlockRange = zodAsFactory<BlockRange>(BlockRangeZod)
|
|
19
|
+
export const toBlockRange = zodToFactory<BlockRange>(NumberishBlockRangeZod)
|
|
20
|
+
|
|
21
|
+
export type BlockRangeKey = Brand<string, { readonly __blockRangeKey: true }>
|
|
22
|
+
export const toBlockNumberKey = (range: BlockRange) => `${range[0]}|${range[1]}` as BlockRangeKey
|
|
23
|
+
|
|
24
|
+
export function fromBlockNumberKey(key: BlockRangeKey): BlockRange | undefined
|
|
25
|
+
export function fromBlockNumberKey(key: BlockRangeKey, assert: AssertConfig): BlockRange
|
|
26
|
+
export function fromBlockNumberKey(key: BlockRangeKey, assert?: AssertConfig): BlockRange | undefined {
|
|
27
|
+
const [start, end] = key.split('|').map(v => asBlockNumber(Number(v)))
|
|
28
|
+
const result = (isDefined(start) && isDefined(end)) ? [start, end] : undefined
|
|
29
|
+
return assertError(result, assert, `Invalid BlockRangeKey: ${key}`)
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AssertConfig } from '@xylabs/hex'
|
|
2
|
+
import { assertError } from '@xylabs/hex'
|
|
3
|
+
import { type Brand, isDefined } from '@xylabs/typeof'
|
|
4
|
+
import z from 'zod'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
asEthBlockNumber,
|
|
8
|
+
type BlockNumber, BlockNumberZod, NumberishBlockNumberZod,
|
|
9
|
+
} from '../BlockNumber/index.ts'
|
|
10
|
+
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
11
|
+
|
|
12
|
+
export type EthBlockRange = [BlockNumber, BlockNumber]
|
|
13
|
+
export type NumberishEthBlockRange = [BlockNumber, BlockNumber]
|
|
14
|
+
|
|
15
|
+
export const EthBlockRangeZod = z.tuple([BlockNumberZod, BlockNumberZod])
|
|
16
|
+
export const NumberishEthBlockRangeZod = z.tuple([NumberishBlockNumberZod, NumberishBlockNumberZod])
|
|
17
|
+
|
|
18
|
+
export const asEthBlockRange = zodAsFactory<EthBlockRange>(EthBlockRangeZod)
|
|
19
|
+
export const toEthBlockRange = zodToFactory<EthBlockRange>(NumberishEthBlockRangeZod)
|
|
20
|
+
|
|
21
|
+
export type EthBlockRangeKey = Brand<string, { readonly __xl1BlockRangeKey: true }>
|
|
22
|
+
export const toEthBlockNumberKey = (range: EthBlockRange) => `${range[0]}|${range[1]}` as EthBlockRangeKey
|
|
23
|
+
|
|
24
|
+
export function fromEthBlockNumberKey(key: EthBlockRangeKey): EthBlockRange | undefined
|
|
25
|
+
export function fromEthBlockNumberKey(key: EthBlockRangeKey, assert: AssertConfig): EthBlockRange
|
|
26
|
+
export function fromEthBlockNumberKey(key: EthBlockRangeKey, assert?: AssertConfig): EthBlockRange | undefined {
|
|
27
|
+
const [start, end] = key.split('|').map(v => asEthBlockNumber(Number(v)))
|
|
28
|
+
const result = (isDefined(start) && isDefined(end)) ? [start, end] : undefined
|
|
29
|
+
return assertError(result, assert, `Invalid EthBlockRangeKey: ${key}`)
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
5
|
+
} from '../zod/index.ts'
|
|
6
|
+
|
|
7
|
+
export const RangeZod = z.tuple([z.number(), z.number()])
|
|
8
|
+
|
|
9
|
+
export type Range = z.infer<typeof RangeZod>
|
|
10
|
+
|
|
11
|
+
export const isRange = zodIsFactory<Range>(RangeZod)
|
|
12
|
+
export const asRange = zodAsFactory<Range>(RangeZod)
|
|
13
|
+
export const toRange = zodToFactory<Range>(RangeZod)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AssertConfig } from '@xylabs/hex'
|
|
2
|
+
import { assertError } from '@xylabs/hex'
|
|
3
|
+
import { type Brand, isDefined } from '@xylabs/typeof'
|
|
4
|
+
import z from 'zod'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
asXL1BlockNumber,
|
|
8
|
+
type BlockNumber, BlockNumberZod, NumberishBlockNumberZod,
|
|
9
|
+
} from '../BlockNumber/index.ts'
|
|
10
|
+
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
11
|
+
|
|
12
|
+
export type XL1BlockRange = [BlockNumber, BlockNumber]
|
|
13
|
+
export type NumberishXL1BlockRange = [BlockNumber, BlockNumber]
|
|
14
|
+
|
|
15
|
+
export const XL1BlockRangeZod = z.tuple([BlockNumberZod, BlockNumberZod])
|
|
16
|
+
export const NumberishXL1BlockRangeZod = z.tuple([NumberishBlockNumberZod, NumberishBlockNumberZod])
|
|
17
|
+
|
|
18
|
+
export const asXL1BlockRange = zodAsFactory<XL1BlockRange>(XL1BlockRangeZod)
|
|
19
|
+
export const toXL1BlockRange = zodToFactory<XL1BlockRange>(NumberishXL1BlockRangeZod)
|
|
20
|
+
|
|
21
|
+
export type XL1BlockRangeKey = Brand<string, { readonly __xl1BlockRangeKey: true }>
|
|
22
|
+
export const toXL1BlockNumberKey = (range: XL1BlockRange) => `${range[0]}|${range[1]}` as XL1BlockRangeKey
|
|
23
|
+
|
|
24
|
+
export function fromXL1BlockNumberKey(key: XL1BlockRangeKey): XL1BlockRange | undefined
|
|
25
|
+
export function fromXL1BlockNumberKey(key: XL1BlockRangeKey, assert: AssertConfig): XL1BlockRange
|
|
26
|
+
export function fromXL1BlockNumberKey(key: XL1BlockRangeKey, assert?: AssertConfig): XL1BlockRange | undefined {
|
|
27
|
+
const [start, end] = key.split('|').map(v => asXL1BlockNumber(Number(v)))
|
|
28
|
+
const result = (isDefined(start) && isDefined(end)) ? [start, end] : undefined
|
|
29
|
+
return assertError(result, assert, `Invalid XL1BlockRangeKey: ${key}`)
|
|
30
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Brand, isUndefined } from '@xylabs/typeof'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { toXL1BlockNumber, type XL1BlockNumber } from './BlockNumber/index.ts'
|
|
4
4
|
|
|
5
5
|
export interface StepIdentity {
|
|
6
6
|
block: XL1BlockNumber
|
|
@@ -30,11 +30,11 @@ export const asStepIdentity = (stepIdentityString: string): StepIdentity | undef
|
|
|
30
30
|
return undefined
|
|
31
31
|
}
|
|
32
32
|
const step = tryParseInt(stepString)
|
|
33
|
-
const
|
|
34
|
-
if (isUndefined(
|
|
33
|
+
const block = toXL1BlockNumber(blockNumberString)
|
|
34
|
+
if (isUndefined(block) || isUndefined(step)) {
|
|
35
35
|
return undefined
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
return { block, step }
|
|
39
39
|
} catch {
|
|
40
40
|
return undefined
|
package/src/model/index.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AssertConfig } from '@xylabs/hex'
|
|
2
|
+
import { assertError } from '@xylabs/hex'
|
|
3
|
+
import type z from 'zod'
|
|
4
|
+
|
|
5
|
+
export function zodAsFactory<T>(zod: z.ZodType<T>) {
|
|
6
|
+
function asFunc(value: unknown): T | undefined
|
|
7
|
+
function asFunc(value: unknown, assert: AssertConfig): T
|
|
8
|
+
function asFunc(value: unknown, assert?: AssertConfig): T | undefined {
|
|
9
|
+
const result = zod.safeParse(value)
|
|
10
|
+
if (result.success) {
|
|
11
|
+
return result.data
|
|
12
|
+
}
|
|
13
|
+
return assertError(value, assert, result.error.message)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return asFunc
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AsObjectFactory } from '@xylabs/object'
|
|
2
|
+
import { type Signed } from '@xyo-network/boundwitness-model'
|
|
3
|
+
import {
|
|
4
|
+
isStorageMeta, type Payload, type WithHashMeta,
|
|
5
|
+
} from '@xyo-network/payload-model'
|
|
6
|
+
|
|
7
|
+
import { isAnyHydratedTransaction } from './AnyHydratedTransaction.ts'
|
|
8
|
+
import { type TransactionBoundWitness } from './TransactionBoundWitness.ts'
|
|
9
|
+
|
|
10
|
+
export type HydratedTransactionWithHashMeta<T extends TransactionBoundWitness = TransactionBoundWitness,
|
|
11
|
+
P extends Payload = Payload> = [WithHashMeta<Signed<T>>, WithHashMeta<P>[]]
|
|
12
|
+
|
|
13
|
+
export const isHydratedTransactionWithHashMeta = (
|
|
14
|
+
value: unknown,
|
|
15
|
+
): value is HydratedTransactionWithHashMeta => {
|
|
16
|
+
return (
|
|
17
|
+
isAnyHydratedTransaction(value) && isStorageMeta(value[0]) && !value[1].some(v => !isStorageMeta(v))
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const asHydratedTransactionWithHashMeta = AsObjectFactory.create<HydratedTransactionWithHashMeta>(
|
|
22
|
+
isHydratedTransactionWithHashMeta,
|
|
23
|
+
)
|