@layerzerolabs/common-chain-model 0.2.68 → 0.2.69

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layerzerolabs/common-chain-model",
3
- "version": "0.2.68",
3
+ "version": "0.2.69",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,16 +13,19 @@
13
13
  "main": "./dist/index.cjs",
14
14
  "module": "./dist/index.js",
15
15
  "types": "./dist/index.d.ts",
16
+ "files": [
17
+ "dist/**/*"
18
+ ],
16
19
  "dependencies": {
17
20
  "zod": "4.3.5",
18
- "@layerzerolabs/typescript-utils": "0.2.68",
19
- "@layerzerolabs/zod-utils": "0.2.68"
21
+ "@layerzerolabs/typescript-utils": "0.2.69",
22
+ "@layerzerolabs/zod-utils": "0.2.69"
20
23
  },
21
24
  "devDependencies": {
22
25
  "tsup": "^8.4.0",
23
26
  "vitest": "^3.2.3",
24
- "@layerzerolabs/tsup-configuration": "0.2.68",
25
- "@layerzerolabs/typescript-configuration": "0.2.68"
27
+ "@layerzerolabs/tsup-configuration": "0.2.69",
28
+ "@layerzerolabs/typescript-configuration": "0.2.69"
26
29
  },
27
30
  "publishConfig": {
28
31
  "access": "public",
@@ -30,7 +33,8 @@
30
33
  },
31
34
  "externalRepoConfig": {
32
35
  "targets": [
33
- "audit-external"
36
+ "audit-external",
37
+ "onesig-client"
34
38
  ]
35
39
  },
36
40
  "scripts": {
@@ -1,55 +0,0 @@
1
-  WARN  Issue while reading "/home/runner/work/monorepo-internal/monorepo-internal/.npmrc". Failed to replace env in config: ${NPM_TOKEN}
2
-
3
- > @layerzerolabs/common-chain-model@0.0.0 build /home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-chain-model
4
- > tsup
5
-
6
- CLI Building entry: src/address.ts, src/bigint.ts, src/index.ts, src/multiSigTransaction.ts, src/transaction.ts
7
- CLI Using tsconfig: tsconfig.json
8
- CLI tsup v8.5.1
9
- CLI Using tsup config: /home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-chain-model/tsup.config.ts
10
- CLI Target: ES2023
11
- CLI Cleaning output folder
12
- CJS Build start
13
- ESM Build start
14
- ESM dist/bigint.js 161.00 B
15
- ESM dist/address.js 232.00 B
16
- ESM dist/index.js 866.00 B
17
- ESM dist/multiSigTransaction.js 491.00 B
18
- ESM dist/SVC6NU65.js 1.07 KB
19
- ESM dist/transaction.js 349.00 B
20
- ESM dist/DO5A6U6O.js 1.60 KB
21
- ESM dist/HOKY7HMK.js 1.42 KB
22
- ESM dist/SJ7BJ7T6.js 1.83 KB
23
- ESM dist/VUOMXK5T.js 222.00 B
24
- ESM dist/address.js.map 71.00 B
25
- ESM dist/bigint.js.map 70.00 B
26
- ESM dist/index.js.map 69.00 B
27
- ESM dist/SVC6NU65.js.map 2.46 KB
28
- ESM dist/multiSigTransaction.js.map 83.00 B
29
- ESM dist/transaction.js.map 75.00 B
30
- ESM dist/DO5A6U6O.js.map 3.76 KB
31
- ESM dist/VUOMXK5T.js.map 72.00 B
32
- ESM dist/SJ7BJ7T6.js.map 4.80 KB
33
- ESM dist/HOKY7HMK.js.map 3.85 KB
34
- ESM ⚡️ Build success in 222ms
35
- CJS dist/bigint.cjs 438.00 B
36
- CJS dist/address.cjs 986.00 B
37
- CJS dist/XYRRR3JU.cjs 1.31 KB
38
- CJS dist/G2M2NELT.cjs 1.79 KB
39
- CJS dist/G4WTW3I2.cjs 2.24 KB
40
- CJS dist/CYLJP4J3.cjs 2.75 KB
41
- CJS dist/YJF4D23A.cjs 245.00 B
42
- CJS dist/transaction.cjs 1.38 KB
43
- CJS dist/multiSigTransaction.cjs 1.60 KB
44
- CJS dist/index.cjs 3.95 KB
45
- CJS dist/bigint.cjs.map 71.00 B
46
- CJS dist/address.cjs.map 72.00 B
47
- CJS dist/XYRRR3JU.cjs.map 2.47 KB
48
- CJS dist/G2M2NELT.cjs.map 3.88 KB
49
- CJS dist/YJF4D23A.cjs.map 73.00 B
50
- CJS dist/CYLJP4J3.cjs.map 4.84 KB
51
- CJS dist/G4WTW3I2.cjs.map 3.77 KB
52
- CJS dist/transaction.cjs.map 76.00 B
53
- CJS dist/multiSigTransaction.cjs.map 84.00 B
54
- CJS dist/index.cjs.map 70.00 B
55
- CJS ⚡️ Build success in 224ms
@@ -1,8 +0,0 @@
1
-
2
- > @layerzerolabs/common-chain-model@0.0.0 lint /home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-chain-model
3
- > eslint . --max-warnings 0 || (eslint . --fix --max-warnings 0 && false)
4
-
5
- (node:66837) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/runner/work/monorepo-internal/monorepo-internal/eslint.config.js?mtime=1775770562286 is not specified and it doesn't parse as CommonJS.
6
- Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
7
- To eliminate this warning, add "type": "module" to /home/runner/work/monorepo-internal/monorepo-internal/package.json.
8
- (Use `node --trace-warnings ...` to show where the warning was created)
@@ -1,16 +0,0 @@
1
-
2
- > @layerzerolabs/common-chain-model@0.0.0 test /home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-chain-model
3
- > vitest --run --pass-with-no-tests --typecheck
4
-
5
- Testing types with tsc and vue-tsc is an experimental feature.
6
- Breaking changes might not follow SemVer, please pin Vitest's version when using it.
7
-
8
-  RUN  v3.2.4 /home/runner/work/monorepo-internal/monorepo-internal/packages/common/common-chain-model
9
-
10
- No test files found, exiting with code 0
11
-
12
- include: **/*.{test,spec}.?(c|m)[jt]s?(x)
13
- exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*
14
- typecheck include: **/*.{test,spec}-d.?(c|m)[jt]s?(x)
15
- typecheck exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*
16
-
package/src/address.ts DELETED
@@ -1,57 +0,0 @@
1
- import z from 'zod';
2
-
3
- import type { HexString, NormalizedHexString } from '@layerzerolabs/typescript-utils';
4
- import { brandSchema } from '@layerzerolabs/zod-utils';
5
-
6
- export type { HexString, NormalizedHexString };
7
-
8
- export const hexSchema = z
9
- .string()
10
- .refine((data) => typeof data === 'string' && data.startsWith('0x')) as z.ZodType<HexString>;
11
-
12
- const _rawNormalizedHexSchema = z.string().refine((data) => {
13
- // normalized hex strings are strings
14
- if (typeof data !== 'string') {
15
- return false;
16
- }
17
- // normalized hex strings start with 0x
18
- if (!data.startsWith('0x')) {
19
- return false;
20
- }
21
- // '0x' is not a valid normalized address (expect 0x0)
22
- if (data.length <= 2) {
23
- return false;
24
- }
25
- // normalized hex strings have no leading 0s (except for edge case (0x0)
26
- if (data.length >= 4 && data[2] === '0') {
27
- return false;
28
- }
29
- // normalized hex strings are always lowercase
30
- if (data.toLowerCase() !== data) {
31
- return false;
32
- }
33
- // normalized hex strings only contain hexadecimal characters
34
- const hexPart = data.slice(2);
35
- if (!/^[0-9a-f]+$/.test(hexPart)) {
36
- return false;
37
- }
38
- return true;
39
- }) as any as z.ZodType<NormalizedHexString>;
40
-
41
- export const normalizedHexSchema = brandSchema(_rawNormalizedHexSchema, 'NormalizedHexSchema');
42
-
43
- export const normalizeHex = (address: HexString): NormalizedHexString => {
44
- // take the bytes part, remove all 0s
45
- const body = address.slice(2).replace(/^0+/, '');
46
- // if the string was e.g., `0x000`, append one 0 so that we have `0x0
47
- const trimmed = '0x' + (body || '0');
48
- return trimmed.toLowerCase() as any as NormalizedHexString;
49
- };
50
-
51
- export const normalizedHexSort = (a: NormalizedHexString, b: NormalizedHexString) =>
52
- BigInt(a.toString()) - BigInt(b.toString()) > 0 ? 1 : -1;
53
-
54
- export const sortNormalizedHex = (hexStrings?: NormalizedHexString[]) =>
55
- hexStrings?.sort(normalizedHexSort);
56
-
57
- export const NORMALIZED_HEX_ZERO = normalizeHex('0x0');
package/src/bigint.ts DELETED
@@ -1,38 +0,0 @@
1
- import z from 'zod';
2
-
3
- import { type DecimalString } from '@layerzerolabs/typescript-utils';
4
-
5
- export type { DecimalString };
6
-
7
- export const decimalStringSchema = z.string().refine((data) => {
8
- return (
9
- // must be string
10
- typeof data === 'string' &&
11
- // must contain only digits, non-empty, can be negative
12
- data.match(/^-?\d+$/) !== null &&
13
- // must not start with 0 unless it's 0
14
- !(data[0] === '0' && data.length > 1) &&
15
- // allow -0, but still can't have multiple leading 0s
16
- !(data.startsWith('-0') && data.length > 2)
17
- );
18
- }) as any as z.ZodType<DecimalString>;
19
-
20
- export const decimalString = {
21
- parse: (data: string | bigint) => {
22
- if (typeof data === 'bigint') {
23
- return data.toString() as any as DecimalString;
24
- }
25
- if (typeof data === 'string') {
26
- if (data.match(/^\d+$/) === null) {
27
- throw new Error(`decimalString doesn't contain only digits: ${data}`);
28
- }
29
- // Normalize it as well to not have many surprises
30
- return BigInt(data).toString() as any as DecimalString;
31
- }
32
- throw new Error(`Invalid data: ${data}`);
33
- },
34
-
35
- toBigInt: (data: DecimalString) => {
36
- return BigInt(data as any as string);
37
- },
38
- };
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './address';
2
- export * from './bigint';
3
- export * from './multiSigTransaction';
4
- export * from './transaction';
@@ -1,61 +0,0 @@
1
- import z from 'zod';
2
-
3
- import { normalizedHexSchema } from './address';
4
- import { transactionResultSchema, transactionSchema } from './transaction';
5
-
6
- // Used by both onchain and offchain multisig
7
- export const baseMultiSigDetailsSchema = z.object({
8
- proposerSenderEntityName: z.string(),
9
- multiSigAddress: normalizedHexSchema,
10
- });
11
-
12
- export const baseMultiSigTransactionToProposeSchema = transactionSchema.extend(
13
- baseMultiSigDetailsSchema.shape,
14
- );
15
-
16
- // Details that are used on onchain multisig and exist on signer entity
17
- export const onchainMultiSigDetailsSchema = baseMultiSigDetailsSchema;
18
-
19
- export const onchainMultiSigTransactionToProposeSchema = transactionSchema.extend({
20
- ...onchainMultiSigDetailsSchema.shape,
21
- nonce: z.number().optional(),
22
- });
23
-
24
- export const offChainMultiSigDetailsSchema = baseMultiSigDetailsSchema.extend({
25
- // TODO: support per-chain custom URLs with placeholders
26
- multiSigUrl: z.string(),
27
- // TODO: support sourcing API key from environment variable
28
- multiSigApiKey: z.string().optional(),
29
- });
30
-
31
- export const multiSigTransactionToProposeSchema = baseMultiSigTransactionToProposeSchema.extend({
32
- nonce: z.number(),
33
- ...offChainMultiSigDetailsSchema.shape,
34
- });
35
-
36
- export const multiSigSignedTransactionToProposeSchema = z.object({
37
- ...multiSigTransactionToProposeSchema.shape,
38
- });
39
-
40
- export const multiSigExecutedProposedTransactionSchema = z.object({
41
- ...multiSigTransactionToProposeSchema.shape,
42
- result: transactionResultSchema,
43
- });
44
-
45
- export type BaseMultiSigDetails = z.infer<typeof baseMultiSigDetailsSchema>;
46
-
47
- export type OnchainMultiSigDetails = z.infer<typeof onchainMultiSigDetailsSchema>;
48
- export type OnChainMultiSigTransactionToPropose = z.infer<
49
- typeof onchainMultiSigTransactionToProposeSchema
50
- >;
51
- export type OffchainMultiSigDetails = z.infer<typeof offChainMultiSigDetailsSchema>;
52
- export type OnchainMultiSigTransactionToPropose = z.infer<
53
- typeof onchainMultiSigTransactionToProposeSchema
54
- >;
55
- export type MultiSigTransactionToPropose = z.infer<typeof multiSigTransactionToProposeSchema>;
56
- export type MultiSigSignedTransactionToPropose = z.infer<
57
- typeof multiSigSignedTransactionToProposeSchema
58
- >;
59
- export type MultiSigExecutedProposedTransaction = z.infer<
60
- typeof multiSigExecutedProposedTransactionSchema
61
- >;
@@ -1,73 +0,0 @@
1
- import z from 'zod';
2
-
3
- export const transactionMetadataTimestamps = z.object({
4
- created: z.number(),
5
- nonceAcquired: z.number().optional(),
6
- signed: z.number().optional(),
7
- sent: z.number().optional(),
8
- confirmed: z.number().optional(),
9
- });
10
-
11
- export const transactionSchema = z.object({
12
- properties: z.record(z.string(), z.any()).optional(),
13
- chainName: z.string(), //this is string because it's at a lower dependency level than lz-definitions
14
- timestamps: transactionMetadataTimestamps,
15
- type: z.string().optional(),
16
- parallelizingKey: z.string().optional(),
17
- });
18
-
19
- export const assignedTransactionSchema = transactionSchema.extend({
20
- senderEntityName: z.string(),
21
- nonce: z.number(),
22
- });
23
-
24
- export const transactionResultSchema = z.discriminatedUnion('type', [
25
- // transaction was submitted successfully
26
- z.object({
27
- type: z.literal('success'),
28
- minedTxHash: z.string(),
29
- }),
30
- // transaction was unable to be submitted
31
- z.object({
32
- type: z.literal('error'),
33
- error: z.string(),
34
- }),
35
- // we cannot know whether the transaction was submitted
36
- z.object({
37
- type: z.literal('indeterminate'),
38
- meta: z.any(),
39
- }),
40
- ]);
41
-
42
- export const signedTransactionSchema = z.object({
43
- ...assignedTransactionSchema.shape,
44
- });
45
-
46
- export const minedTransactionSchema = z.object({
47
- ...assignedTransactionSchema.shape,
48
- result: transactionResultSchema,
49
- });
50
-
51
- export const transactionWithResultSchema = z.object({
52
- ...transactionSchema.shape,
53
- result: transactionResultSchema,
54
- });
55
-
56
- export const buildTransactionWithResultSchema = <T extends typeof transactionSchema>(
57
- txSchema: T,
58
- ) => {
59
- return z.object({
60
- ...txSchema.shape,
61
- result: transactionResultSchema,
62
- }) as z.ZodObject<T['shape'] & { result: typeof transactionResultSchema }, z.core.$strip>;
63
- };
64
-
65
- export interface Transaction extends z.infer<typeof transactionSchema> {}
66
- export interface AssignedTransaction extends z.infer<typeof assignedTransactionSchema> {}
67
- export interface SignedTransaction extends z.infer<typeof signedTransactionSchema> {}
68
- export type TransactionResult = z.infer<typeof transactionResultSchema>;
69
- export interface MinedTransaction extends z.infer<typeof minedTransactionSchema> {}
70
- export interface TransactionWithResult extends z.infer<typeof transactionWithResultSchema> {}
71
- export type TransactionWithResultFor<T extends Transaction> = T & {
72
- result: TransactionResult;
73
- };
package/tsconfig.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "extends": "@layerzerolabs/typescript-configuration/tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDir": "./src",
5
- "outDir": "./dist",
6
- "strictPropertyInitialization": false,
7
- "noUnusedLocals": false,
8
- "noUnusedParameters": false,
9
- "jsx": "react-jsx"
10
- },
11
- "exclude": [
12
- "node_modules",
13
- "**/__mocks__/*",
14
- "**/__tests__/*",
15
- "**/*.spec.ts",
16
- "**/*.test.ts",
17
- "dist"
18
- ],
19
- "include": ["src/**/*"]
20
- }
package/tsup.config.ts DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
-
3
- import { createPackageTsupConfig } from '@layerzerolabs/tsup-configuration';
4
-
5
- export default defineConfig(({ watch }) => ({
6
- ...createPackageTsupConfig(),
7
- clean: !watch,
8
- }));