@xyo-network/xl1-protocol 1.13.11 → 1.13.13
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/block/AllowedBlockPayload.d.ts.map +1 -1
- package/dist/neutral/index.mjs +147 -183
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/model/BlockNumber/BlockNumber.d.ts +2 -2
- package/dist/neutral/model/BlockNumber/BlockNumber.d.ts.map +1 -1
- package/dist/neutral/model/BlockNumber/EthBlockNumber.d.ts +2 -2
- package/dist/neutral/model/BlockNumber/EthBlockNumber.d.ts.map +1 -1
- package/dist/neutral/model/BlockNumber/XL1BlockNumber.d.ts +2 -2
- package/dist/neutral/model/BlockNumber/XL1BlockNumber.d.ts.map +1 -1
- package/dist/neutral/model/BlockRange/BlockRange.d.ts +3 -3
- package/dist/neutral/model/BlockRange/BlockRange.d.ts.map +1 -1
- package/dist/neutral/model/BlockRange/EthBlockRange.d.ts +3 -3
- package/dist/neutral/model/BlockRange/EthBlockRange.d.ts.map +1 -1
- package/dist/neutral/model/BlockRange/Range.d.ts +2 -2
- package/dist/neutral/model/BlockRange/Range.d.ts.map +1 -1
- package/dist/neutral/model/BlockRange/XL1BlockRange.d.ts +3 -3
- package/dist/neutral/model/BlockRange/XL1BlockRange.d.ts.map +1 -1
- package/dist/neutral/model/index.d.ts +0 -1
- package/dist/neutral/model/index.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/TransferPayload.d.ts +12 -19
- package/dist/neutral/payload/elevatable/TransferPayload.d.ts.map +1 -1
- package/package.json +23 -18
- package/src/block/AllowedBlockPayload.ts +1 -1
- package/src/model/BlockNumber/BlockNumber.ts +1 -1
- package/src/model/BlockNumber/EthBlockNumber.ts +1 -1
- package/src/model/BlockNumber/XL1BlockNumber.ts +1 -1
- package/src/model/BlockRange/BlockRange.ts +3 -3
- package/src/model/BlockRange/EthBlockRange.ts +3 -3
- package/src/model/BlockRange/Range.ts +2 -3
- package/src/model/BlockRange/XL1BlockRange.ts +3 -3
- package/src/model/index.ts +0 -1
- package/src/payload/elevatable/TransferPayload.ts +2 -13
- package/dist/neutral/amount/specs/Xl1Amount.spec.d.ts +0 -2
- package/dist/neutral/amount/specs/Xl1Amount.spec.d.ts.map +0 -1
- package/dist/neutral/model/zod/Config.d.ts +0 -6
- package/dist/neutral/model/zod/Config.d.ts.map +0 -1
- package/dist/neutral/model/zod/index.d.ts +0 -5
- package/dist/neutral/model/zod/index.d.ts.map +0 -1
- package/dist/neutral/model/zod/zodAsFactory.d.ts +0 -7
- package/dist/neutral/model/zod/zodAsFactory.d.ts.map +0 -1
- package/dist/neutral/model/zod/zodIsFactory.d.ts +0 -3
- package/dist/neutral/model/zod/zodIsFactory.d.ts.map +0 -1
- package/dist/neutral/model/zod/zodToFactory.d.ts +0 -6
- package/dist/neutral/model/zod/zodToFactory.d.ts.map +0 -1
- package/dist/neutral/payload/elevatable/Bridge/spec/Bridge.test.d.ts +0 -2
- package/dist/neutral/payload/elevatable/Bridge/spec/Bridge.test.d.ts.map +0 -1
- package/src/amount/specs/Xl1Amount.spec.ts +0 -181
- package/src/model/zod/Config.ts +0 -7
- package/src/model/zod/index.ts +0 -4
- package/src/model/zod/zodAsFactory.ts +0 -43
- package/src/model/zod/zodIsFactory.ts +0 -5
- package/src/model/zod/zodToFactory.ts +0 -7
- package/src/payload/elevatable/Bridge/spec/Bridge.test.ts +0 -128
- package/src/payload/elevatable/Bridge/spec/__snapshots__/Bridge.test.ts.snap +0 -71
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssertConfig } from '@xylabs/
|
|
1
|
+
import type { AssertConfig } from '@xylabs/error';
|
|
2
2
|
import { type Brand } from '@xylabs/typeof';
|
|
3
3
|
import z from 'zod';
|
|
4
4
|
import type { EthBlockNumber } from '../BlockNumber/index.ts';
|
|
@@ -8,11 +8,11 @@ export declare const EthBlockRangeZod: z.ZodTuple<[z.ZodPipe<z.ZodNumber, z.ZodT
|
|
|
8
8
|
export declare const NumberishEthBlockRangeZod: z.ZodTuple<[z.ZodPipe<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<import("../BlockNumber/BlockNumber.ts").BlockNumber, number>>, z.ZodTransform<EthBlockNumber, import("../BlockNumber/BlockNumber.ts").BlockNumber>>, z.ZodPipe<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<import("../BlockNumber/BlockNumber.ts").BlockNumber, number>>, z.ZodTransform<EthBlockNumber, import("../BlockNumber/BlockNumber.ts").BlockNumber>>], null>;
|
|
9
9
|
export declare const asEthBlockRange: {
|
|
10
10
|
(value: unknown): EthBlockRange | undefined;
|
|
11
|
-
(value: unknown, assert: import("
|
|
11
|
+
(value: unknown, assert: import("@xylabs/zod").ZodFactoryConfig): EthBlockRange;
|
|
12
12
|
};
|
|
13
13
|
export declare const toEthBlockRange: {
|
|
14
14
|
(value: unknown): EthBlockRange | undefined;
|
|
15
|
-
(value: unknown, assert: import("
|
|
15
|
+
(value: unknown, assert: import("@xylabs/zod").ZodFactoryConfig): EthBlockRange;
|
|
16
16
|
};
|
|
17
17
|
export type EthBlockRangeKey = Brand<string, {
|
|
18
18
|
readonly __ethBlockRangeKey: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthBlockRange.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/EthBlockRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"EthBlockRange.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/EthBlockRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,KAAK,KAAK,EAAa,MAAM,gBAAgB,CAAA;AAEtD,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAO7D,MAAM,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;AAC5D,MAAM,MAAM,sBAAsB,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;AAErE,eAAO,MAAM,gBAAgB,oJAAkD,CAAA;AAC/E,eAAO,MAAM,yBAAyB,0qBAAoE,CAAA;AAE1G,eAAO,MAAM,eAAe;;;CAAiE,CAAA;AAC7F,eAAO,MAAM,eAAe;;;CAA0E,CAAA;AAEtG,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"}
|
|
@@ -4,10 +4,10 @@ export type Range = z.infer<typeof RangeZod>;
|
|
|
4
4
|
export declare const isRange: (value: unknown) => value is [number, number];
|
|
5
5
|
export declare const asRange: {
|
|
6
6
|
(value: unknown): [number, number] | undefined;
|
|
7
|
-
(value: unknown, assert: import("
|
|
7
|
+
(value: unknown, assert: import("@xylabs/zod").ZodFactoryConfig): [number, number];
|
|
8
8
|
};
|
|
9
9
|
export declare const toRange: {
|
|
10
10
|
(value: unknown): [number, number] | undefined;
|
|
11
|
-
(value: unknown, assert: import("
|
|
11
|
+
(value: unknown, assert: import("@xylabs/zod").ZodFactoryConfig): [number, number];
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=Range.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/Range.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/Range.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,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;;;CAAyC,CAAA;AAC7D,eAAO,MAAM,OAAO;;;CAAyC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssertConfig } from '@xylabs/
|
|
1
|
+
import type { AssertConfig } from '@xylabs/error';
|
|
2
2
|
import { type Brand } from '@xylabs/typeof';
|
|
3
3
|
import z from 'zod';
|
|
4
4
|
import type { XL1BlockNumber } from '../BlockNumber/index.ts';
|
|
@@ -8,11 +8,11 @@ export declare const XL1BlockRangeZod: z.ZodTuple<[z.ZodPipe<z.ZodNumber, z.ZodT
|
|
|
8
8
|
export declare const NumberishXL1BlockRangeZod: z.ZodTuple<[z.ZodPipe<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<import("../BlockNumber/BlockNumber.ts").BlockNumber, number>>, z.ZodTransform<XL1BlockNumber, import("../BlockNumber/BlockNumber.ts").BlockNumber>>, z.ZodPipe<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<import("../BlockNumber/BlockNumber.ts").BlockNumber, number>>, z.ZodTransform<XL1BlockNumber, import("../BlockNumber/BlockNumber.ts").BlockNumber>>], null>;
|
|
9
9
|
export declare const asXL1BlockRange: {
|
|
10
10
|
(value: unknown): XL1BlockRange | undefined;
|
|
11
|
-
(value: unknown, assert: import("
|
|
11
|
+
(value: unknown, assert: import("@xylabs/zod").ZodFactoryConfig): XL1BlockRange;
|
|
12
12
|
};
|
|
13
13
|
export declare const toXL1BlockRange: {
|
|
14
14
|
(value: unknown): XL1BlockRange | undefined;
|
|
15
|
-
(value: unknown, assert: import("
|
|
15
|
+
(value: unknown, assert: import("@xylabs/zod").ZodFactoryConfig): XL1BlockRange;
|
|
16
16
|
};
|
|
17
17
|
export type XL1BlockRangeKey = Brand<string, {
|
|
18
18
|
readonly __xl1BlockRangeKey: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XL1BlockRange.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/XL1BlockRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"XL1BlockRange.d.ts","sourceRoot":"","sources":["../../../../src/model/BlockRange/XL1BlockRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,KAAK,KAAK,EAAa,MAAM,gBAAgB,CAAA;AAEtD,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAO7D,MAAM,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;AAC5D,MAAM,MAAM,sBAAsB,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;AAErE,eAAO,MAAM,gBAAgB,oJAAkD,CAAA;AAC/E,eAAO,MAAM,yBAAyB,0qBAAoE,CAAA;AAE1G,eAAO,MAAM,eAAe;;;CAAiE,CAAA;AAC7F,eAAO,MAAM,eAAe;;;CAA0E,CAAA;AAEtG,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,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,uBAAuB,CAAA;AACrC,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,19 +1,12 @@
|
|
|
1
|
-
import { type Address, type Hex } from '@xylabs/hex';
|
|
2
1
|
import z from 'zod';
|
|
3
|
-
import type { FromFields } from './Executable.ts';
|
|
4
2
|
export declare const TransferSchema: "network.xyo.transfer";
|
|
5
3
|
export type TransferSchema = typeof TransferSchema;
|
|
6
|
-
export interface TransferFields<TContext extends {} = {}> extends FromFields {
|
|
7
|
-
context?: TContext;
|
|
8
|
-
epoch: number;
|
|
9
|
-
transfers: Partial<Record<Address, Hex>>;
|
|
10
|
-
}
|
|
11
4
|
export declare const TransferFieldsZod: z.ZodObject<{
|
|
12
5
|
$opCodes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
-
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
6
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
14
7
|
epoch: z.ZodNumber;
|
|
15
|
-
from: z.ZodPipe<z.ZodString, z.ZodTransform<Address, string>>;
|
|
16
|
-
transfers: z.ZodRecord<z.ZodPipe<z.ZodString, z.ZodTransform<Address, string>>, z.ZodPipe<z.ZodString, z.ZodTransform<Hex, string>>>;
|
|
8
|
+
from: z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/hex").Address, string>>;
|
|
9
|
+
transfers: z.ZodRecord<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/hex").Address, string>>, z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/hex").Hex, string>>>;
|
|
17
10
|
}, z.z.core.$strip>;
|
|
18
11
|
export declare const PayloadZodOfSchema: <S extends string>(schema: S) => z.ZodObject<{
|
|
19
12
|
schema: z.ZodLiteral<S>;
|
|
@@ -21,26 +14,26 @@ export declare const PayloadZodOfSchema: <S extends string>(schema: S) => z.ZodO
|
|
|
21
14
|
export declare const TransferZod: z.ZodObject<{
|
|
22
15
|
schema: z.ZodLiteral<"network.xyo.transfer">;
|
|
23
16
|
$opCodes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
|
-
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
17
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
25
18
|
epoch: z.ZodNumber;
|
|
26
|
-
from: z.ZodPipe<z.ZodString, z.ZodTransform<Address, string>>;
|
|
27
|
-
transfers: z.ZodRecord<z.ZodPipe<z.ZodString, z.ZodTransform<Address, string>>, z.ZodPipe<z.ZodString, z.ZodTransform<Hex, string>>>;
|
|
19
|
+
from: z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/hex").Address, string>>;
|
|
20
|
+
transfers: z.ZodRecord<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/hex").Address, string>>, z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/hex").Hex, string>>>;
|
|
28
21
|
}, z.z.core.$strip>;
|
|
29
22
|
export type Transfer = z.infer<typeof TransferZod>;
|
|
30
23
|
export declare const isTransfer: (x?: unknown | null) => x is {
|
|
31
24
|
schema: "network.xyo.transfer";
|
|
32
25
|
epoch: number;
|
|
33
|
-
from: Address;
|
|
34
|
-
transfers: Record<Address, Hex>;
|
|
26
|
+
from: import("@xylabs/hex").Address;
|
|
27
|
+
transfers: Record<import("@xylabs/hex").Address, import("@xylabs/hex").Hex>;
|
|
35
28
|
$opCodes?: string[] | undefined;
|
|
36
|
-
context?: Record<string,
|
|
29
|
+
context?: Record<string, unknown> | undefined;
|
|
37
30
|
};
|
|
38
31
|
export declare const asTransfer: import("@xylabs/object").AsTypeFunction<{
|
|
39
32
|
schema: "network.xyo.transfer";
|
|
40
33
|
epoch: number;
|
|
41
|
-
from: Address;
|
|
42
|
-
transfers: Record<Address, Hex>;
|
|
34
|
+
from: import("@xylabs/hex").Address;
|
|
35
|
+
transfers: Record<import("@xylabs/hex").Address, import("@xylabs/hex").Hex>;
|
|
43
36
|
$opCodes?: string[] | undefined;
|
|
44
|
-
context?: Record<string,
|
|
37
|
+
context?: Record<string, unknown> | undefined;
|
|
45
38
|
}>;
|
|
46
39
|
//# sourceMappingURL=TransferPayload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransferPayload.d.ts","sourceRoot":"","sources":["../../../../src/payload/elevatable/TransferPayload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TransferPayload.d.ts","sourceRoot":"","sources":["../../../../src/payload/elevatable/TransferPayload.ts"],"names":[],"mappings":"AAMA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,eAAO,MAAM,cAAc,EAAG,sBAA+B,CAAA;AAC7D,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAA;AAElD,eAAO,MAAM,iBAAiB;;;;;;mBAM5B,CAAA;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,EAAE,QAAQ,CAAC;;mBAAqD,CAAA;AAEnH,eAAO,MAAM,WAAW;;;;;;;mBAAqE,CAAA;AAE7F,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAElD,eAAO,MAAM,UAAU;;;;;;;CAAkD,CAAA;AAEzE,eAAO,MAAM,UAAU;;;;;;;EAAqC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/xl1-protocol",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.13",
|
|
5
5
|
"description": "XYO Layer One Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -33,39 +33,44 @@
|
|
|
33
33
|
"types": "./dist/neutral/index.d.ts",
|
|
34
34
|
"files": [
|
|
35
35
|
"dist",
|
|
36
|
-
"src"
|
|
36
|
+
"src",
|
|
37
|
+
"!**/*.bench.*",
|
|
38
|
+
"!**/*.spec.*",
|
|
39
|
+
"!**/*.test.*"
|
|
37
40
|
],
|
|
38
41
|
"dependencies": {
|
|
39
42
|
"@opentelemetry/api": "~1.9.0",
|
|
40
|
-
"@xylabs/assert": "~5.0.
|
|
41
|
-
"@xylabs/
|
|
42
|
-
"@xylabs/
|
|
43
|
-
"@xylabs/
|
|
44
|
-
"@xylabs/
|
|
45
|
-
"@xylabs/
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@xyo-network/
|
|
49
|
-
"@xyo-network/
|
|
43
|
+
"@xylabs/assert": "~5.0.39",
|
|
44
|
+
"@xylabs/error": "~5.0.39",
|
|
45
|
+
"@xylabs/hex": "~5.0.39",
|
|
46
|
+
"@xylabs/logger": "~5.0.39",
|
|
47
|
+
"@xylabs/object": "~5.0.39",
|
|
48
|
+
"@xylabs/promise": "~5.0.39",
|
|
49
|
+
"@xylabs/typeof": "~5.0.39",
|
|
50
|
+
"@xylabs/zod": "~5.0.39",
|
|
51
|
+
"@xyo-network/archivist-model": "~5.1.24",
|
|
52
|
+
"@xyo-network/boundwitness-model": "~5.1.24",
|
|
53
|
+
"@xyo-network/payload-model": "~5.1.24",
|
|
54
|
+
"@xyo-network/schema-payload-plugin": "~5.1.24",
|
|
50
55
|
"zod": "~4.1.12"
|
|
51
56
|
},
|
|
52
57
|
"devDependencies": {
|
|
53
58
|
"@types/node": "~24.10.1",
|
|
54
|
-
"@typescript-eslint/types": "~8.
|
|
55
|
-
"@xylabs/creatable": "~5.0.
|
|
59
|
+
"@typescript-eslint/types": "~8.47.0",
|
|
60
|
+
"@xylabs/creatable": "~5.0.39",
|
|
56
61
|
"@xylabs/eslint-config-flat": "~7.2.8",
|
|
57
62
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
58
63
|
"@xylabs/tsconfig": "~7.2.8",
|
|
59
|
-
"@xyo-network/account-model": "~5.1.
|
|
60
|
-
"dependency-cruiser": "~17.
|
|
64
|
+
"@xyo-network/account-model": "~5.1.24",
|
|
65
|
+
"dependency-cruiser": "~17.3.1",
|
|
61
66
|
"dotenv": "~17.2.3",
|
|
62
67
|
"eslint": "~9.39.1",
|
|
63
68
|
"eslint-import-resolver-typescript": "~4.4.4",
|
|
64
|
-
"knip": "~5.
|
|
69
|
+
"knip": "~5.70.1",
|
|
65
70
|
"typescript": "~5.9.3",
|
|
66
71
|
"vite": "~7.2.2",
|
|
67
72
|
"vite-tsconfig-paths": "~5.1.4",
|
|
68
|
-
"vitest": "~4.0.
|
|
73
|
+
"vitest": "~4.0.10"
|
|
69
74
|
},
|
|
70
75
|
"packageManager": "yarn@4.10.3",
|
|
71
76
|
"engines": {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { zodIsFactory } from '@xylabs/zod'
|
|
1
2
|
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
2
3
|
import type { Schema, WithStorageMeta } from '@xyo-network/payload-model'
|
|
3
4
|
import { isHashMeta } from '@xyo-network/payload-model'
|
|
@@ -5,7 +6,6 @@ import type { SchemaPayload } from '@xyo-network/schema-payload-plugin'
|
|
|
5
6
|
import { isSchemaPayload, SchemaSchema } from '@xyo-network/schema-payload-plugin'
|
|
6
7
|
import z from 'zod'
|
|
7
8
|
|
|
8
|
-
import { zodIsFactory } from '../model/index.ts'
|
|
9
9
|
import type {
|
|
10
10
|
BridgeDestinationObservation, BridgeIntent, BridgeSourceObservation, ChainStakeIntent, HashPayload, StepComplete, TimePayload, Transfer,
|
|
11
11
|
} from '../payload/index.ts'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Brand } from '@xylabs/typeof'
|
|
2
|
+
import { zodAsFactory, zodToFactory } from '@xylabs/zod'
|
|
2
3
|
import z from 'zod'
|
|
3
4
|
|
|
4
|
-
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
5
5
|
import { NumberishZod } from './Numberish.ts'
|
|
6
6
|
|
|
7
7
|
export type BlockNumber = Brand<number, { readonly __blockNumber: true }>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Brand } from '@xylabs/typeof'
|
|
2
|
+
import { zodAsFactory, zodToFactory } from '@xylabs/zod'
|
|
2
3
|
import z from 'zod'
|
|
3
4
|
|
|
4
|
-
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
5
5
|
import type { BlockNumber } from './BlockNumber.ts'
|
|
6
6
|
import { NumberishBlockNumberZod } from './BlockNumber.ts'
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Brand } from '@xylabs/typeof'
|
|
2
|
+
import { zodAsFactory, zodToFactory } from '@xylabs/zod'
|
|
2
3
|
import z from 'zod'
|
|
3
4
|
|
|
4
|
-
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
5
5
|
import type { BlockNumber } from './BlockNumber.ts'
|
|
6
6
|
import { NumberishBlockNumberZod } from './BlockNumber.ts'
|
|
7
7
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { AssertConfig } from '@xylabs/
|
|
2
|
-
import { assertError } from '@xylabs/
|
|
1
|
+
import type { AssertConfig } from '@xylabs/error'
|
|
2
|
+
import { assertError } from '@xylabs/error'
|
|
3
3
|
import { type Brand, isDefined } from '@xylabs/typeof'
|
|
4
|
+
import { zodAsFactory, zodToFactory } from '@xylabs/zod'
|
|
4
5
|
import z from 'zod'
|
|
5
6
|
|
|
6
7
|
import {
|
|
7
8
|
asBlockNumber,
|
|
8
9
|
type BlockNumber, BlockNumberZod, NumberishBlockNumberZod,
|
|
9
10
|
} from '../BlockNumber/index.ts'
|
|
10
|
-
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
11
11
|
|
|
12
12
|
export type BlockRange = [BlockNumber, BlockNumber]
|
|
13
13
|
export type NumberishBlockRange = [BlockNumber, BlockNumber]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { AssertConfig } from '@xylabs/
|
|
2
|
-
import { assertError } from '@xylabs/
|
|
1
|
+
import type { AssertConfig } from '@xylabs/error'
|
|
2
|
+
import { assertError } from '@xylabs/error'
|
|
3
3
|
import { type Brand, isDefined } from '@xylabs/typeof'
|
|
4
|
+
import { zodAsFactory, zodToFactory } from '@xylabs/zod'
|
|
4
5
|
import z from 'zod'
|
|
5
6
|
|
|
6
7
|
import type { EthBlockNumber } from '../BlockNumber/index.ts'
|
|
@@ -9,7 +10,6 @@ import {
|
|
|
9
10
|
EthBlockNumberZod,
|
|
10
11
|
NumberishEthBlockNumberZod,
|
|
11
12
|
} from '../BlockNumber/index.ts'
|
|
12
|
-
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
13
13
|
|
|
14
14
|
export type EthBlockRange = [EthBlockNumber, EthBlockNumber]
|
|
15
15
|
export type NumberishEthBlockRange = [EthBlockNumber, EthBlockNumber]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { AssertConfig } from '@xylabs/
|
|
2
|
-
import { assertError } from '@xylabs/
|
|
1
|
+
import type { AssertConfig } from '@xylabs/error'
|
|
2
|
+
import { assertError } from '@xylabs/error'
|
|
3
3
|
import { type Brand, isDefined } from '@xylabs/typeof'
|
|
4
|
+
import { zodAsFactory, zodToFactory } from '@xylabs/zod'
|
|
4
5
|
import z from 'zod'
|
|
5
6
|
|
|
6
7
|
import type { XL1BlockNumber } from '../BlockNumber/index.ts'
|
|
@@ -9,7 +10,6 @@ import {
|
|
|
9
10
|
NumberishXL1BlockNumberZod,
|
|
10
11
|
XL1BlockNumberZod,
|
|
11
12
|
} from '../BlockNumber/index.ts'
|
|
12
|
-
import { zodAsFactory, zodToFactory } from '../zod/index.ts'
|
|
13
13
|
|
|
14
14
|
export type XL1BlockRange = [XL1BlockNumber, XL1BlockNumber]
|
|
15
15
|
export type NumberishXL1BlockRange = [XL1BlockNumber, XL1BlockNumber]
|
package/src/model/index.ts
CHANGED
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type Address,
|
|
3
2
|
AddressZod,
|
|
4
|
-
type Hex,
|
|
5
3
|
HexZod,
|
|
6
4
|
} from '@xylabs/hex'
|
|
7
|
-
import { AsObjectFactory } from '@xylabs/object'
|
|
5
|
+
import { AsObjectFactory, JsonObjectZod } from '@xylabs/object'
|
|
8
6
|
import { isPayloadOfSchemaType, PayloadZod } from '@xyo-network/payload-model'
|
|
9
7
|
import z from 'zod'
|
|
10
8
|
|
|
11
|
-
import type { FromFields } from './Executable.ts'
|
|
12
|
-
|
|
13
9
|
export const TransferSchema = 'network.xyo.transfer' as const
|
|
14
10
|
export type TransferSchema = typeof TransferSchema
|
|
15
11
|
|
|
16
|
-
export interface TransferFields<TContext extends {} = {}> extends FromFields {
|
|
17
|
-
context?: TContext
|
|
18
|
-
epoch: number
|
|
19
|
-
// the amount that is being sent to other addresses
|
|
20
|
-
transfers: Partial<Record<Address, Hex>>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
12
|
export const TransferFieldsZod = z.object({
|
|
24
13
|
$opCodes: z.array(z.string()).optional(),
|
|
25
|
-
context:
|
|
14
|
+
context: JsonObjectZod.optional(),
|
|
26
15
|
epoch: z.number(),
|
|
27
16
|
from: AddressZod,
|
|
28
17
|
transfers: z.record(AddressZod, HexZod),
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Xl1Amount.spec.d.ts","sourceRoot":"","sources":["../../../../src/amount/specs/Xl1Amount.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../../src/model/zod/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,sBAAsB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/model/zod/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type z from 'zod';
|
|
2
|
-
import type { ZodFactoryConfig } from './Config.ts';
|
|
3
|
-
export declare function zodAsFactory<T>(zod: z.ZodType<T>, name: string): {
|
|
4
|
-
(value: unknown): T | undefined;
|
|
5
|
-
(value: unknown, assert: ZodFactoryConfig): T;
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=zodAsFactory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zodAsFactory.d.ts","sourceRoot":"","sources":["../../../../src/model/zod/zodAsFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM;YACtC,OAAO,GAAG,CAAC,GAAG,SAAS;YACvB,OAAO,UAAU,gBAAgB,GAAG,CAAC;EAkC7D"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,IAAI,EAAE,MAAM;;;EAE9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Bridge.test.d.ts","sourceRoot":"","sources":["../../../../../../src/payload/elevatable/Bridge/spec/Bridge.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe, expect, it,
|
|
3
|
-
} from 'vitest'
|
|
4
|
-
|
|
5
|
-
import type {
|
|
6
|
-
AttoXL1, FemtoXL1, MicroXL1, MilliXL1, NanoXL1, PicoXL1,
|
|
7
|
-
} from '../../xl1/index.ts'
|
|
8
|
-
import { XL1Places } from '../../xl1/index.ts'
|
|
9
|
-
import { XL1Amount } from '../XL1Amount.ts'
|
|
10
|
-
|
|
11
|
-
describe('XL1Amount', () => {
|
|
12
|
-
describe('constructor', () => {
|
|
13
|
-
it('should create an instance with valid value', () => {
|
|
14
|
-
const amount = new XL1Amount(1000n)
|
|
15
|
-
expect(amount.value).toBe(1000n)
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('should clamp negative values to 0', () => {
|
|
19
|
-
const amount = new XL1Amount(-1000n)
|
|
20
|
-
expect(amount.value).toBe(0n)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
// it('should clamp values exceeding MAX_XL1_AMOUNT', () => {
|
|
24
|
-
// const maxValue = 2n ** 256n - 1n
|
|
25
|
-
// const amount = new XL1Amount(maxValue + 1n)
|
|
26
|
-
// expect(amount.value).toBe(maxValue)
|
|
27
|
-
// })
|
|
28
|
-
|
|
29
|
-
it('should accept custom locale', () => {
|
|
30
|
-
const amount = new XL1Amount(1000n, 'de-DE')
|
|
31
|
-
expect(amount.value).toBe(1000n)
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
describe('static from method', () => {
|
|
36
|
-
it('should create XL1Amount from value and places', () => {
|
|
37
|
-
const amount = XL1Amount.from(1n, XL1Places.milli)
|
|
38
|
-
expect(amount.value).toBe(1n * 10n ** XL1Places.milli)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
it('should default to atto places', () => {
|
|
42
|
-
const amount = XL1Amount.from(1000n)
|
|
43
|
-
expect(amount.value).toBe(1000n)
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
it('should throw error for invalid places', () => {
|
|
47
|
-
expect(() => XL1Amount.from(1000n, 99n)).toThrow('Invalid conversion places')
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
describe('static factory methods', () => {
|
|
52
|
-
it('should create from milli', () => {
|
|
53
|
-
const amount = XL1Amount.fromMilli(1n as MilliXL1)
|
|
54
|
-
expect(amount.value).toBe(1n * 10n ** XL1Places.milli)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('should create from micro', () => {
|
|
58
|
-
const amount = XL1Amount.fromMicro(1n as MicroXL1)
|
|
59
|
-
expect(amount.value).toBe(1n * 10n ** XL1Places.micro)
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
it('should create from nano', () => {
|
|
63
|
-
const amount = XL1Amount.fromNano(1n as NanoXL1)
|
|
64
|
-
expect(amount.value).toBe(1n * 10n ** XL1Places.nano)
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
it('should create from pico', () => {
|
|
68
|
-
const amount = XL1Amount.fromPico(1n as PicoXL1)
|
|
69
|
-
expect(amount.value).toBe(1n * 10n ** XL1Places.pico)
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
it('should create from femto', () => {
|
|
73
|
-
const amount = XL1Amount.fromFemto(1n as FemtoXL1)
|
|
74
|
-
expect(amount.value).toBe(1n * 10n ** XL1Places.femto)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
it('should create from atto', () => {
|
|
78
|
-
const amount = XL1Amount.fromAtto(1000n as AttoXL1)
|
|
79
|
-
expect(amount.value).toBe(1000n)
|
|
80
|
-
})
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
describe('to method', () => {
|
|
84
|
-
it('should convert to specified places', () => {
|
|
85
|
-
const amount = new XL1Amount(1_000_000_000_000_000_000n) // 1 * 10^18
|
|
86
|
-
expect(amount.to(XL1Places.milli)).toBe(1000n)
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('should default to atto places', () => {
|
|
90
|
-
const amount = new XL1Amount(1000n)
|
|
91
|
-
expect(amount.to()).toBe(1000n)
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
it('should handle bigint places', () => {
|
|
95
|
-
const amount = new XL1Amount(1_000_000_000_000_000_000n)
|
|
96
|
-
expect(amount.to(XL1Places.milli)).toBe(1000n)
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
describe('getters', () => {
|
|
101
|
-
const oneXl1 = 1n * 10n ** BigInt(XL1Places.xl1) // 1 * 10^18
|
|
102
|
-
const amount = new XL1Amount(oneXl1) // 1 * 10^18
|
|
103
|
-
|
|
104
|
-
it('should get milli value', () => {
|
|
105
|
-
expect(amount.milli).toBe(1000n)
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
it('should get micro value', () => {
|
|
109
|
-
expect(amount.micro).toBe(1_000_000n)
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
it('should get nano value', () => {
|
|
113
|
-
expect(amount.nano).toBe(1_000_000_000n)
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
it('should get pico value', () => {
|
|
117
|
-
expect(amount.pico).toBe(1_000_000_000_000n)
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
it('should get femto value', () => {
|
|
121
|
-
expect(amount.femto).toBe(1_000_000_000_000_000n)
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
it('should get atto value', () => {
|
|
125
|
-
expect(amount.atto).toBe(oneXl1)
|
|
126
|
-
})
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
describe('toString method', () => {
|
|
130
|
-
it('should convert to string with default places', () => {
|
|
131
|
-
const amount = new XL1Amount(1_000_000_000_000_000_000n)
|
|
132
|
-
const result = amount.toString()
|
|
133
|
-
expect(typeof result).toBe('string')
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
it('should convert to string with specified places', () => {
|
|
137
|
-
const amount = new XL1Amount(1_000_000_000_000_000_000n)
|
|
138
|
-
const result = amount.toString(Number(XL1Places.milli))
|
|
139
|
-
expect(typeof result).toBe('string')
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
it('should convert to string with specified maxDecimal', () => {
|
|
143
|
-
const reallySmallAmount = new XL1Amount(742n)
|
|
144
|
-
const reallySmallResult = reallySmallAmount.toString(Number(XL1Places.xl1), {
|
|
145
|
-
maxDecimal: 18, maxCharacters: 19, minDecimals: 0, locale: navigator.language,
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
expect(reallySmallResult).toBe('0.000000000000000742')
|
|
149
|
-
|
|
150
|
-
const tooSmallAmount = reallySmallAmount.toString(Number(XL1Places.xl1), {
|
|
151
|
-
maxDecimal: 15, maxCharacters: 19, minDecimals: 0, locale: navigator.language,
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
expect(tooSmallAmount).toBe('< 0.00000000000000001')
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
it('should accept custom config', () => {
|
|
158
|
-
const amount = new XL1Amount(1_000_000_000_000_000_000n)
|
|
159
|
-
const result = amount.toString(Number(XL1Places.milli), { minDecimals: 2 })
|
|
160
|
-
expect(typeof result).toBe('string')
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
it('should throw error for invalid places', () => {
|
|
164
|
-
const amount = new XL1Amount(1000n)
|
|
165
|
-
expect(() => amount.toString(99)).toThrow('Invalid conversion places')
|
|
166
|
-
})
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
describe('edge cases', () => {
|
|
170
|
-
it('should handle zero value', () => {
|
|
171
|
-
const amount = new XL1Amount(0n)
|
|
172
|
-
expect(amount.value).toBe(0n)
|
|
173
|
-
expect(amount.to(XL1Places.milli)).toBe(0n)
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
it('should handle division with remainder', () => {
|
|
177
|
-
const amount = new XL1Amount(1_500_000_000_000_000_000n)
|
|
178
|
-
expect(amount.to(XL1Places.milli)).toBe(1500n)
|
|
179
|
-
})
|
|
180
|
-
})
|
|
181
|
-
})
|