@layerzerolabs/common-chain-model 0.0.44 → 0.0.46
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/.turbo/turbo-build.log +26 -26
- package/dist/2J25PZ2O.cjs +40 -0
- package/dist/2J25PZ2O.cjs.map +1 -0
- package/dist/4K6BY5DZ.js +33 -0
- package/dist/4K6BY5DZ.js.map +1 -0
- package/dist/DOZD76P7.js +32 -0
- package/dist/DOZD76P7.js.map +1 -0
- package/dist/OBNNMNND.cjs +41 -0
- package/dist/OBNNMNND.cjs.map +1 -0
- package/dist/address.cjs +8 -24
- package/dist/address.d.ts +3 -9
- package/dist/address.d.ts.map +1 -1
- package/dist/address.js +1 -1
- package/dist/bigint.cjs +4 -8
- package/dist/bigint.d.ts +5 -2
- package/dist/bigint.d.ts.map +1 -1
- package/dist/bigint.js +1 -1
- package/dist/index.cjs +12 -32
- package/dist/index.js +2 -2
- package/package.json +4 -5
- package/src/address.ts +5 -23
- package/src/bigint.ts +31 -8
- package/dist/CIKWECQO.js +0 -39
- package/dist/CIKWECQO.js.map +0 -1
- package/dist/DTYQULT4.cjs +0 -24
- package/dist/DTYQULT4.cjs.map +0 -1
- package/dist/QYHNWZK7.cjs +0 -52
- package/dist/QYHNWZK7.cjs.map +0 -1
- package/dist/RINNGVQR.js +0 -16
- package/dist/RINNGVQR.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -10,37 +10,37 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mCJS[39m Build start
|
|
12
12
|
[34mESM[39m Build start
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
13
|
+
[32mCJS[39m [1mdist/address.cjs [22m[32m702.00 B[39m
|
|
14
|
+
[32mCJS[39m [1mdist/bigint.cjs [22m[32m441.00 B[39m
|
|
15
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m2.26 KB[39m
|
|
16
|
+
[32mCJS[39m [1mdist/OBNNMNND.cjs [22m[32m1.18 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/transaction.cjs [22m[32m1.38 KB[39m
|
|
18
|
+
[32mCJS[39m [1mdist/F6WBSSER.cjs [22m[32m2.53 KB[39m
|
|
19
|
+
[32mCJS[39m [1mdist/YJF4D23A.cjs [22m[32m245.00 B[39m
|
|
20
|
+
[32mCJS[39m [1mdist/2J25PZ2O.cjs [22m[32m1.31 KB[39m
|
|
21
|
+
[32mCJS[39m [1mdist/address.cjs.map [22m[32m72.00 B[39m
|
|
22
|
+
[32mCJS[39m [1mdist/bigint.cjs.map [22m[32m71.00 B[39m
|
|
23
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m70.00 B[39m
|
|
24
|
+
[32mCJS[39m [1mdist/OBNNMNND.cjs.map [22m[32m2.66 KB[39m
|
|
25
|
+
[32mCJS[39m [1mdist/YJF4D23A.cjs.map [22m[32m73.00 B[39m
|
|
26
|
+
[32mCJS[39m [1mdist/transaction.cjs.map [22m[32m76.00 B[39m
|
|
27
|
+
[32mCJS[39m [1mdist/2J25PZ2O.cjs.map [22m[32m2.47 KB[39m
|
|
28
|
+
[32mCJS[39m [1mdist/F6WBSSER.cjs.map [22m[32m4.41 KB[39m
|
|
29
|
+
[32mCJS[39m ⚡️ Build success in 128ms
|
|
30
|
+
[32mESM[39m [1mdist/address.js [22m[32m192.00 B[39m
|
|
31
|
+
[32mESM[39m [1mdist/bigint.js [22m[32m161.00 B[39m
|
|
32
|
+
[32mESM[39m [1mdist/DOZD76P7.js [22m[32m916.00 B[39m
|
|
33
|
+
[32mESM[39m [1mdist/index.js [22m[32m502.00 B[39m
|
|
34
|
+
[32mESM[39m [1mdist/4K6BY5DZ.js [22m[32m1.07 KB[39m
|
|
18
35
|
[32mESM[39m [1mdist/transaction.js [22m[32m349.00 B[39m
|
|
19
36
|
[32mESM[39m [1mdist/3YWFRX2K.js [22m[32m1.65 KB[39m
|
|
20
37
|
[32mESM[39m [1mdist/VUOMXK5T.js [22m[32m222.00 B[39m
|
|
21
38
|
[32mESM[39m [1mdist/address.js.map [22m[32m71.00 B[39m
|
|
22
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m69.00 B[39m
|
|
23
39
|
[32mESM[39m [1mdist/bigint.js.map [22m[32m70.00 B[39m
|
|
24
|
-
[32mESM[39m [1mdist/
|
|
25
|
-
[32mESM[39m [1mdist/
|
|
40
|
+
[32mESM[39m [1mdist/DOZD76P7.js.map [22m[32m2.66 KB[39m
|
|
41
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m69.00 B[39m
|
|
42
|
+
[32mESM[39m [1mdist/4K6BY5DZ.js.map [22m[32m2.46 KB[39m
|
|
26
43
|
[32mESM[39m [1mdist/transaction.js.map [22m[32m75.00 B[39m
|
|
27
44
|
[32mESM[39m [1mdist/3YWFRX2K.js.map [22m[32m4.38 KB[39m
|
|
28
45
|
[32mESM[39m [1mdist/VUOMXK5T.js.map [22m[32m72.00 B[39m
|
|
29
|
-
[32mESM[39m ⚡️ Build success in
|
|
30
|
-
[32mCJS[39m [1mdist/address.cjs [22m[32m1.26 KB[39m
|
|
31
|
-
[32mCJS[39m [1mdist/bigint.cjs [22m[32m606.00 B[39m
|
|
32
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m3.00 KB[39m
|
|
33
|
-
[32mCJS[39m [1mdist/QYHNWZK7.cjs [22m[32m1.91 KB[39m
|
|
34
|
-
[32mCJS[39m [1mdist/DTYQULT4.cjs [22m[32m871.00 B[39m
|
|
35
|
-
[32mCJS[39m [1mdist/YJF4D23A.cjs [22m[32m245.00 B[39m
|
|
36
|
-
[32mCJS[39m [1mdist/F6WBSSER.cjs [22m[32m2.53 KB[39m
|
|
37
|
-
[32mCJS[39m [1mdist/transaction.cjs [22m[32m1.38 KB[39m
|
|
38
|
-
[32mCJS[39m [1mdist/bigint.cjs.map [22m[32m71.00 B[39m
|
|
39
|
-
[32mCJS[39m [1mdist/address.cjs.map [22m[32m72.00 B[39m
|
|
40
|
-
[32mCJS[39m [1mdist/QYHNWZK7.cjs.map [22m[32m3.84 KB[39m
|
|
41
|
-
[32mCJS[39m [1mdist/DTYQULT4.cjs.map [22m[32m1.14 KB[39m
|
|
42
|
-
[32mCJS[39m [1mdist/YJF4D23A.cjs.map [22m[32m73.00 B[39m
|
|
43
|
-
[32mCJS[39m [1mdist/transaction.cjs.map [22m[32m76.00 B[39m
|
|
44
|
-
[32mCJS[39m [1mdist/F6WBSSER.cjs.map [22m[32m4.41 KB[39m
|
|
45
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m70.00 B[39m
|
|
46
|
-
[32mCJS[39m ⚡️ Build success in 194ms
|
|
46
|
+
[32mESM[39m ⚡️ Build success in 128ms
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var YJF4D23A_cjs = require('./YJF4D23A.cjs');
|
|
4
|
+
var z = require('zod/v4');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var z__default = /*#__PURE__*/_interopDefault(z);
|
|
9
|
+
|
|
10
|
+
var decimalStringSchema = z__default.default.string().refine((data) => {
|
|
11
|
+
return (
|
|
12
|
+
// must be string
|
|
13
|
+
typeof data === "string" && // must contain only digits, non-empty, can be negative
|
|
14
|
+
data.match(/^-?\d+$/) !== null && // must not start with 0 unless it's 0
|
|
15
|
+
!(data[0] === "0" && data.length > 1) && // allow -0, but still cant have multiple leading 0s
|
|
16
|
+
!(data.startsWith("-0") && data.length > 2)
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
var decimalString = {
|
|
20
|
+
parse: /* @__PURE__ */ YJF4D23A_cjs.__name((data) => {
|
|
21
|
+
if (typeof data === "bigint") {
|
|
22
|
+
return data.toString();
|
|
23
|
+
}
|
|
24
|
+
if (typeof data === "string") {
|
|
25
|
+
if (data.match(/^\d+$/) === null) {
|
|
26
|
+
throw new Error(`decimalString doesn't contain only digits: ${data}`);
|
|
27
|
+
}
|
|
28
|
+
return BigInt(data).toString();
|
|
29
|
+
}
|
|
30
|
+
throw new Error(`Invalid data: ${data}`);
|
|
31
|
+
}, "parse"),
|
|
32
|
+
toBigInt: /* @__PURE__ */ YJF4D23A_cjs.__name((data) => {
|
|
33
|
+
return BigInt(data);
|
|
34
|
+
}, "toBigInt")
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.decimalString = decimalString;
|
|
38
|
+
exports.decimalStringSchema = decimalStringSchema;
|
|
39
|
+
//# sourceMappingURL=2J25PZ2O.cjs.map
|
|
40
|
+
//# sourceMappingURL=2J25PZ2O.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bigint.ts"],"names":["decimalStringSchema","z","string","refine","data","match","length","startsWith","decimalString","parse","toString","Error","BigInt","toBigInt"],"mappings":";;;;;;;;;AAMO,IAAMA,sBAAsBC,kBAAAA,CAAEC,MAAAA,EAAM,CAAGC,MAAAA,CAAO,CAACC,IAAAA,KAAAA;AAClD,EAAA;;AAEI,IAAA,OAAOA,IAAAA,KAAS,QAAA;IAEhBA,IAAAA,CAAKC,KAAAA,CAAM,SAAA,CAAA,KAAe,IAAA;AAE1B,IAAA,EAAED,IAAAA,CAAK,CAAA,CAAA,KAAO,GAAA,IAAOA,KAAKE,MAAAA,GAAS,CAAA,CAAA;AAEnC,IAAA,EAAEF,IAAAA,CAAKG,UAAAA,CAAW,IAAA,CAAA,IAASH,KAAKE,MAAAA,GAAS,CAAA;;AAEjD,CAAA;AAEO,IAAME,aAAAA,GAAgB;AACzBC,EAAAA,KAAAA,uCAAQL,IAAAA,KAAAA;AACJ,IAAA,IAAI,OAAOA,SAAS,QAAA,EAAU;AAC1B,MAAA,OAAOA,KAAKM,QAAAA,EAAQ;AACxB,IAAA;AACA,IAAA,IAAI,OAAON,SAAS,QAAA,EAAU;AAC1B,MAAA,IAAIA,IAAAA,CAAKC,KAAAA,CAAM,OAAA,CAAA,KAAa,IAAA,EAAM;AAC9B,QAAA,MAAM,IAAIM,KAAAA,CAAM,CAAA,2CAAA,EAA8CP,IAAAA,CAAAA,CAAM,CAAA;AACxE,MAAA;AAEA,MAAA,OAAOQ,MAAAA,CAAOR,IAAAA,CAAAA,CAAMM,QAAAA,EAAQ;AAChC,IAAA;AACA,IAAA,MAAM,IAAIC,KAAAA,CAAM,CAAA,cAAA,EAAiBP,IAAAA,CAAAA,CAAM,CAAA;EAC3C,CAAA,EAZO,OAAA,CAAA;AAcPS,EAAAA,QAAAA,uCAAWT,IAAAA,KAAAA;AACP,IAAA,OAAOQ,OAAOR,IAAAA,CAAAA;EAClB,CAAA,EAFU,UAAA;AAGd","file":"2J25PZ2O.cjs","sourcesContent":["import z from 'zod/v4';\n\nimport { type DecimalString } from '@layerzerolabs/typescript-utils';\n\nexport type { DecimalString };\n\nexport const decimalStringSchema = z.string().refine((data) => {\n return (\n // must be string\n typeof data === 'string' &&\n // must contain only digits, non-empty, can be negative\n data.match(/^-?\\d+$/) !== null &&\n // must not start with 0 unless it's 0\n !(data[0] === '0' && data.length > 1) &&\n // allow -0, but still cant have multiple leading 0s\n !(data.startsWith('-0') && data.length > 2)\n );\n}) as any as z.ZodType<DecimalString>;\n\nexport const decimalString = {\n parse: (data: string | bigint) => {\n if (typeof data === 'bigint') {\n return data.toString() as any as DecimalString;\n }\n if (typeof data === 'string') {\n if (data.match(/^\\d+$/) === null) {\n throw new Error(`decimalString doesn't contain only digits: ${data}`);\n }\n // Normalize it as well to not have many surprises\n return BigInt(data).toString() as any as DecimalString;\n }\n throw new Error(`Invalid data: ${data}`);\n },\n\n toBigInt: (data: DecimalString) => {\n return BigInt(data as any as string);\n },\n};\n"]}
|
package/dist/4K6BY5DZ.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __name } from './VUOMXK5T.js';
|
|
2
|
+
import z from 'zod/v4';
|
|
3
|
+
|
|
4
|
+
var decimalStringSchema = z.string().refine((data) => {
|
|
5
|
+
return (
|
|
6
|
+
// must be string
|
|
7
|
+
typeof data === "string" && // must contain only digits, non-empty, can be negative
|
|
8
|
+
data.match(/^-?\d+$/) !== null && // must not start with 0 unless it's 0
|
|
9
|
+
!(data[0] === "0" && data.length > 1) && // allow -0, but still cant have multiple leading 0s
|
|
10
|
+
!(data.startsWith("-0") && data.length > 2)
|
|
11
|
+
);
|
|
12
|
+
});
|
|
13
|
+
var decimalString = {
|
|
14
|
+
parse: /* @__PURE__ */ __name((data) => {
|
|
15
|
+
if (typeof data === "bigint") {
|
|
16
|
+
return data.toString();
|
|
17
|
+
}
|
|
18
|
+
if (typeof data === "string") {
|
|
19
|
+
if (data.match(/^\d+$/) === null) {
|
|
20
|
+
throw new Error(`decimalString doesn't contain only digits: ${data}`);
|
|
21
|
+
}
|
|
22
|
+
return BigInt(data).toString();
|
|
23
|
+
}
|
|
24
|
+
throw new Error(`Invalid data: ${data}`);
|
|
25
|
+
}, "parse"),
|
|
26
|
+
toBigInt: /* @__PURE__ */ __name((data) => {
|
|
27
|
+
return BigInt(data);
|
|
28
|
+
}, "toBigInt")
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { decimalString, decimalStringSchema };
|
|
32
|
+
//# sourceMappingURL=4K6BY5DZ.js.map
|
|
33
|
+
//# sourceMappingURL=4K6BY5DZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bigint.ts"],"names":["decimalStringSchema","z","string","refine","data","match","length","startsWith","decimalString","parse","toString","Error","BigInt","toBigInt"],"mappings":";;;AAMO,IAAMA,sBAAsBC,CAAAA,CAAEC,MAAAA,EAAM,CAAGC,MAAAA,CAAO,CAACC,IAAAA,KAAAA;AAClD,EAAA;;AAEI,IAAA,OAAOA,IAAAA,KAAS,QAAA;IAEhBA,IAAAA,CAAKC,KAAAA,CAAM,SAAA,CAAA,KAAe,IAAA;AAE1B,IAAA,EAAED,IAAAA,CAAK,CAAA,CAAA,KAAO,GAAA,IAAOA,KAAKE,MAAAA,GAAS,CAAA,CAAA;AAEnC,IAAA,EAAEF,IAAAA,CAAKG,UAAAA,CAAW,IAAA,CAAA,IAASH,KAAKE,MAAAA,GAAS,CAAA;;AAEjD,CAAA;AAEO,IAAME,aAAAA,GAAgB;AACzBC,EAAAA,KAAAA,0BAAQL,IAAAA,KAAAA;AACJ,IAAA,IAAI,OAAOA,SAAS,QAAA,EAAU;AAC1B,MAAA,OAAOA,KAAKM,QAAAA,EAAQ;AACxB,IAAA;AACA,IAAA,IAAI,OAAON,SAAS,QAAA,EAAU;AAC1B,MAAA,IAAIA,IAAAA,CAAKC,KAAAA,CAAM,OAAA,CAAA,KAAa,IAAA,EAAM;AAC9B,QAAA,MAAM,IAAIM,KAAAA,CAAM,CAAA,2CAAA,EAA8CP,IAAAA,CAAAA,CAAM,CAAA;AACxE,MAAA;AAEA,MAAA,OAAOQ,MAAAA,CAAOR,IAAAA,CAAAA,CAAMM,QAAAA,EAAQ;AAChC,IAAA;AACA,IAAA,MAAM,IAAIC,KAAAA,CAAM,CAAA,cAAA,EAAiBP,IAAAA,CAAAA,CAAM,CAAA;EAC3C,CAAA,EAZO,OAAA,CAAA;AAcPS,EAAAA,QAAAA,0BAAWT,IAAAA,KAAAA;AACP,IAAA,OAAOQ,OAAOR,IAAAA,CAAAA;EAClB,CAAA,EAFU,UAAA;AAGd","file":"4K6BY5DZ.js","sourcesContent":["import z from 'zod/v4';\n\nimport { type DecimalString } from '@layerzerolabs/typescript-utils';\n\nexport type { DecimalString };\n\nexport const decimalStringSchema = z.string().refine((data) => {\n return (\n // must be string\n typeof data === 'string' &&\n // must contain only digits, non-empty, can be negative\n data.match(/^-?\\d+$/) !== null &&\n // must not start with 0 unless it's 0\n !(data[0] === '0' && data.length > 1) &&\n // allow -0, but still cant have multiple leading 0s\n !(data.startsWith('-0') && data.length > 2)\n );\n}) as any as z.ZodType<DecimalString>;\n\nexport const decimalString = {\n parse: (data: string | bigint) => {\n if (typeof data === 'bigint') {\n return data.toString() as any as DecimalString;\n }\n if (typeof data === 'string') {\n if (data.match(/^\\d+$/) === null) {\n throw new Error(`decimalString doesn't contain only digits: ${data}`);\n }\n // Normalize it as well to not have many surprises\n return BigInt(data).toString() as any as DecimalString;\n }\n throw new Error(`Invalid data: ${data}`);\n },\n\n toBigInt: (data: DecimalString) => {\n return BigInt(data as any as string);\n },\n};\n"]}
|
package/dist/DOZD76P7.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __name } from './VUOMXK5T.js';
|
|
2
|
+
import z from 'zod/v4';
|
|
3
|
+
|
|
4
|
+
var hexSchema = z.string().refine((data) => typeof data === "string" && data.startsWith("0x"));
|
|
5
|
+
var normalizedHexSchema = z.string().refine((data) => {
|
|
6
|
+
if (typeof data !== "string") {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (!data.startsWith("0x")) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if (data.length <= 2) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (data.length >= 4 && data[2] === "0") {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (data.toLowerCase() !== data) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
});
|
|
23
|
+
var normalizeHex = /* @__PURE__ */ __name((address) => {
|
|
24
|
+
const body = address.slice(2).replace(/^0+/, "");
|
|
25
|
+
const trimmed = "0x" + (body || "0");
|
|
26
|
+
return trimmed.toLowerCase();
|
|
27
|
+
}, "normalizeHex");
|
|
28
|
+
var zeroNormalizedHex = normalizeHex("0x0");
|
|
29
|
+
|
|
30
|
+
export { hexSchema, normalizeHex, normalizedHexSchema, zeroNormalizedHex };
|
|
31
|
+
//# sourceMappingURL=DOZD76P7.js.map
|
|
32
|
+
//# sourceMappingURL=DOZD76P7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/address.ts"],"names":["hexSchema","z","string","refine","data","startsWith","normalizedHexSchema","length","toLowerCase","normalizeHex","address","body","slice","replace","trimmed","zeroNormalizedHex"],"mappings":";;;AAMO,IAAMA,SAAAA,GAAYC,CAAAA,CACpBC,MAAAA,EAAM,CACNC,MAAAA,CAAO,CAACC,IAAAA,KAAS,OAAOA,IAAAA,KAAS,QAAA,IAAYA,IAAAA,CAAKC,UAAAA,CAAW,IAAA,CAAA;AAE3D,IAAMC,sBAAsBL,CAAAA,CAAEC,MAAAA,EAAM,CAAGC,MAAAA,CAAO,CAACC,IAAAA,KAAAA;AAElD,EAAA,IAAI,OAAOA,SAAS,QAAA,EAAU;AAC1B,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAI,CAACA,IAAAA,CAAKC,UAAAA,CAAW,IAAA,CAAA,EAAO;AACxB,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAID,IAAAA,CAAKG,UAAU,CAAA,EAAG;AAClB,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAIH,KAAKG,MAAAA,IAAU,CAAA,IAAKH,IAAAA,CAAK,CAAA,MAAO,GAAA,EAAK;AACrC,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAIA,IAAAA,CAAKI,WAAAA,EAAW,KAAOJ,IAAAA,EAAM;AAC7B,IAAA,OAAO,KAAA;AACX,EAAA;AACA,EAAA,OAAO,IAAA;AACX,CAAA;AAEO,IAAMK,YAAAA,2BAAgBC,OAAAA,KAAAA;AAEzB,EAAA,MAAMC,OAAOD,OAAAA,CAAQE,KAAAA,CAAM,CAAA,CAAA,CAAGC,OAAAA,CAAQ,OAAO,EAAA,CAAA;AAE7C,EAAA,MAAMC,OAAAA,GAAU,QAAQH,IAAAA,IAAQ,GAAA,CAAA;AAChC,EAAA,OAAOG,QAAQN,WAAAA,EAAW;AAC9B,CAAA,EAN4B,cAAA;AAQrB,IAAMO,iBAAAA,GAAoBN,aAAa,KAAA","file":"DOZD76P7.js","sourcesContent":["import z from 'zod/v4';\n\nimport type { HexString, NormalizedHexString } from '@layerzerolabs/typescript-utils';\n\nexport type { HexString, NormalizedHexString };\n\nexport const hexSchema = z\n .string()\n .refine((data) => typeof data === 'string' && data.startsWith('0x')) as z.ZodType<HexString>;\n\nexport const normalizedHexSchema = z.string().refine((data) => {\n // normalized hex strings are strings\n if (typeof data !== 'string') {\n return false;\n }\n // normalized hex strings start with 0x\n if (!data.startsWith('0x')) {\n return false;\n }\n // '0x' is not a valid normalized address (expect 0x0)\n if (data.length <= 2) {\n return false;\n }\n // normalized hex strings have no leading 0s (except for edge case (0x0)\n if (data.length >= 4 && data[2] === '0') {\n return false;\n }\n // normalized hex strings are always lowercase\n if (data.toLowerCase() !== data) {\n return false;\n }\n return true;\n}) as any as z.ZodType<NormalizedHexString>;\n\nexport const normalizeHex = (address: HexString): NormalizedHexString => {\n // take the bytes part, remove all 0s\n const body = address.slice(2).replace(/^0+/, '');\n // if the string was e.g., `0x000`, append one 0 so that we have `0x0\n const trimmed = '0x' + (body || '0');\n return trimmed.toLowerCase() as any as NormalizedHexString;\n};\n\nexport const zeroNormalizedHex = normalizeHex('0x0');\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var YJF4D23A_cjs = require('./YJF4D23A.cjs');
|
|
4
|
+
var z = require('zod/v4');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var z__default = /*#__PURE__*/_interopDefault(z);
|
|
9
|
+
|
|
10
|
+
var hexSchema = z__default.default.string().refine((data) => typeof data === "string" && data.startsWith("0x"));
|
|
11
|
+
var normalizedHexSchema = z__default.default.string().refine((data) => {
|
|
12
|
+
if (typeof data !== "string") {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (!data.startsWith("0x")) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (data.length <= 2) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (data.length >= 4 && data[2] === "0") {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (data.toLowerCase() !== data) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
});
|
|
29
|
+
var normalizeHex = /* @__PURE__ */ YJF4D23A_cjs.__name((address) => {
|
|
30
|
+
const body = address.slice(2).replace(/^0+/, "");
|
|
31
|
+
const trimmed = "0x" + (body || "0");
|
|
32
|
+
return trimmed.toLowerCase();
|
|
33
|
+
}, "normalizeHex");
|
|
34
|
+
var zeroNormalizedHex = normalizeHex("0x0");
|
|
35
|
+
|
|
36
|
+
exports.hexSchema = hexSchema;
|
|
37
|
+
exports.normalizeHex = normalizeHex;
|
|
38
|
+
exports.normalizedHexSchema = normalizedHexSchema;
|
|
39
|
+
exports.zeroNormalizedHex = zeroNormalizedHex;
|
|
40
|
+
//# sourceMappingURL=OBNNMNND.cjs.map
|
|
41
|
+
//# sourceMappingURL=OBNNMNND.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/address.ts"],"names":["hexSchema","z","string","refine","data","startsWith","normalizedHexSchema","length","toLowerCase","normalizeHex","address","body","slice","replace","trimmed","zeroNormalizedHex"],"mappings":";;;;;;;;;AAMO,IAAMA,SAAAA,GAAYC,kBAAAA,CACpBC,MAAAA,EAAM,CACNC,MAAAA,CAAO,CAACC,IAAAA,KAAS,OAAOA,IAAAA,KAAS,QAAA,IAAYA,IAAAA,CAAKC,UAAAA,CAAW,IAAA,CAAA;AAE3D,IAAMC,sBAAsBL,kBAAAA,CAAEC,MAAAA,EAAM,CAAGC,MAAAA,CAAO,CAACC,IAAAA,KAAAA;AAElD,EAAA,IAAI,OAAOA,SAAS,QAAA,EAAU;AAC1B,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAI,CAACA,IAAAA,CAAKC,UAAAA,CAAW,IAAA,CAAA,EAAO;AACxB,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAID,IAAAA,CAAKG,UAAU,CAAA,EAAG;AAClB,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAIH,KAAKG,MAAAA,IAAU,CAAA,IAAKH,IAAAA,CAAK,CAAA,MAAO,GAAA,EAAK;AACrC,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAIA,IAAAA,CAAKI,WAAAA,EAAW,KAAOJ,IAAAA,EAAM;AAC7B,IAAA,OAAO,KAAA;AACX,EAAA;AACA,EAAA,OAAO,IAAA;AACX,CAAA;AAEO,IAAMK,YAAAA,wCAAgBC,OAAAA,KAAAA;AAEzB,EAAA,MAAMC,OAAOD,OAAAA,CAAQE,KAAAA,CAAM,CAAA,CAAA,CAAGC,OAAAA,CAAQ,OAAO,EAAA,CAAA;AAE7C,EAAA,MAAMC,OAAAA,GAAU,QAAQH,IAAAA,IAAQ,GAAA,CAAA;AAChC,EAAA,OAAOG,QAAQN,WAAAA,EAAW;AAC9B,CAAA,EAN4B,cAAA;AAQrB,IAAMO,iBAAAA,GAAoBN,aAAa,KAAA","file":"OBNNMNND.cjs","sourcesContent":["import z from 'zod/v4';\n\nimport type { HexString, NormalizedHexString } from '@layerzerolabs/typescript-utils';\n\nexport type { HexString, NormalizedHexString };\n\nexport const hexSchema = z\n .string()\n .refine((data) => typeof data === 'string' && data.startsWith('0x')) as z.ZodType<HexString>;\n\nexport const normalizedHexSchema = z.string().refine((data) => {\n // normalized hex strings are strings\n if (typeof data !== 'string') {\n return false;\n }\n // normalized hex strings start with 0x\n if (!data.startsWith('0x')) {\n return false;\n }\n // '0x' is not a valid normalized address (expect 0x0)\n if (data.length <= 2) {\n return false;\n }\n // normalized hex strings have no leading 0s (except for edge case (0x0)\n if (data.length >= 4 && data[2] === '0') {\n return false;\n }\n // normalized hex strings are always lowercase\n if (data.toLowerCase() !== data) {\n return false;\n }\n return true;\n}) as any as z.ZodType<NormalizedHexString>;\n\nexport const normalizeHex = (address: HexString): NormalizedHexString => {\n // take the bytes part, remove all 0s\n const body = address.slice(2).replace(/^0+/, '');\n // if the string was e.g., `0x000`, append one 0 so that we have `0x0\n const trimmed = '0x' + (body || '0');\n return trimmed.toLowerCase() as any as NormalizedHexString;\n};\n\nexport const zeroNormalizedHex = normalizeHex('0x0');\n"]}
|
package/dist/address.cjs
CHANGED
|
@@ -1,41 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var OBNNMNND_cjs = require('./OBNNMNND.cjs');
|
|
4
4
|
require('./YJF4D23A.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
Object.defineProperty(exports, "base58AddressSchema", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return QYHNWZK7_cjs.base58AddressSchema; }
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "denormalizeHexAddress", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return QYHNWZK7_cjs.denormalizeHexAddress; }
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "hexAddressSchema", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return QYHNWZK7_cjs.hexAddressSchema; }
|
|
19
|
-
});
|
|
20
8
|
Object.defineProperty(exports, "hexSchema", {
|
|
21
9
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "lowercaseHex", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return QYHNWZK7_cjs.lowercaseHex; }
|
|
10
|
+
get: function () { return OBNNMNND_cjs.hexSchema; }
|
|
27
11
|
});
|
|
28
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "normalizeHex", {
|
|
29
13
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
14
|
+
get: function () { return OBNNMNND_cjs.normalizeHex; }
|
|
31
15
|
});
|
|
32
|
-
Object.defineProperty(exports, "
|
|
16
|
+
Object.defineProperty(exports, "normalizedHexSchema", {
|
|
33
17
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
18
|
+
get: function () { return OBNNMNND_cjs.normalizedHexSchema; }
|
|
35
19
|
});
|
|
36
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "zeroNormalizedHex", {
|
|
37
21
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
22
|
+
get: function () { return OBNNMNND_cjs.zeroNormalizedHex; }
|
|
39
23
|
});
|
|
40
24
|
//# sourceMappingURL=address.cjs.map
|
|
41
25
|
//# sourceMappingURL=address.cjs.map
|
package/dist/address.d.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import z from 'zod/v4';
|
|
2
2
|
import type { HexString, NormalizedHexString } from '@layerzerolabs/typescript-utils';
|
|
3
|
+
export type { HexString, NormalizedHexString };
|
|
3
4
|
export declare const hexSchema: z.ZodType<HexString>;
|
|
4
5
|
export declare const normalizedHexSchema: z.ZodType<NormalizedHexString>;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export type HexAddress = z.infer<typeof hexAddressSchema>;
|
|
8
|
-
export type NormalizedHexAddress = z.infer<typeof normalizedHexSchema>;
|
|
9
|
-
export declare const lowercaseHex: <T extends HexAddress | undefined>(address: T) => T;
|
|
10
|
-
export declare const normalizeHexAddress: (address: HexAddress) => NormalizedHexAddress;
|
|
11
|
-
export declare const denormalizeHexAddress: (address: NormalizedHexAddress, byteCount: number) => HexAddress;
|
|
12
|
-
export declare const base58AddressSchema: z.ZodString;
|
|
13
|
-
export type Base58AddressSchema = z.infer<typeof base58AddressSchema>;
|
|
6
|
+
export declare const normalizeHex: (address: HexString) => NormalizedHexString;
|
|
7
|
+
export declare const zeroNormalizedHex: NormalizedHexString;
|
|
14
8
|
//# sourceMappingURL=address.d.ts.map
|
package/dist/address.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../src/address.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../src/address.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtF,YAAY,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;AAE/C,eAAO,MAAM,SAAS,EAEsD,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAEjG,eAAO,MAAM,mBAAmB,EAsBnB,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAE5C,eAAO,MAAM,YAAY,GAAI,SAAS,SAAS,KAAG,mBAMjD,CAAC;AAEF,eAAO,MAAM,iBAAiB,qBAAsB,CAAC"}
|
package/dist/address.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { hexSchema, normalizeHex, normalizedHexSchema, zeroNormalizedHex } from './DOZD76P7.js';
|
|
2
2
|
import './VUOMXK5T.js';
|
|
3
3
|
//# sourceMappingURL=address.js.map
|
|
4
4
|
//# sourceMappingURL=address.js.map
|
package/dist/bigint.cjs
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _2J25PZ2O_cjs = require('./2J25PZ2O.cjs');
|
|
4
4
|
require('./YJF4D23A.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
Object.defineProperty(exports, "
|
|
8
|
+
Object.defineProperty(exports, "decimalString", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return _2J25PZ2O_cjs.decimalString; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "decimalStringSchema", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "decimalStringToBigInt", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return DTYQULT4_cjs.decimalStringToBigInt; }
|
|
14
|
+
get: function () { return _2J25PZ2O_cjs.decimalStringSchema; }
|
|
19
15
|
});
|
|
20
16
|
//# sourceMappingURL=bigint.cjs.map
|
|
21
17
|
//# sourceMappingURL=bigint.cjs.map
|
package/dist/bigint.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import z from 'zod/v4';
|
|
2
2
|
import { type DecimalString } from '@layerzerolabs/typescript-utils';
|
|
3
|
-
export
|
|
4
|
-
export declare const decimalStringToBigInt: (hex: DecimalString) => bigint;
|
|
3
|
+
export type { DecimalString };
|
|
5
4
|
export declare const decimalStringSchema: z.ZodType<DecimalString>;
|
|
5
|
+
export declare const decimalString: {
|
|
6
|
+
parse: (data: string | bigint) => DecimalString;
|
|
7
|
+
toBigInt: (data: DecimalString) => bigint;
|
|
8
|
+
};
|
|
6
9
|
//# sourceMappingURL=bigint.d.ts.map
|
package/dist/bigint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../src/bigint.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,
|
|
1
|
+
{"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../src/bigint.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,eAAO,MAAM,mBAAmB,EAWnB,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAEtC,eAAO,MAAM,aAAa;kBACR,MAAM,GAAG,MAAM;qBAcZ,aAAa;CAGjC,CAAC"}
|
package/dist/bigint.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,55 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var OBNNMNND_cjs = require('./OBNNMNND.cjs');
|
|
4
|
+
var _2J25PZ2O_cjs = require('./2J25PZ2O.cjs');
|
|
5
5
|
var F6WBSSER_cjs = require('./F6WBSSER.cjs');
|
|
6
6
|
require('./YJF4D23A.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, "base58AddressSchema", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () { return QYHNWZK7_cjs.base58AddressSchema; }
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "denormalizeHexAddress", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () { return QYHNWZK7_cjs.denormalizeHexAddress; }
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "hexAddressSchema", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () { return QYHNWZK7_cjs.hexAddressSchema; }
|
|
21
|
-
});
|
|
22
10
|
Object.defineProperty(exports, "hexSchema", {
|
|
23
11
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
12
|
+
get: function () { return OBNNMNND_cjs.hexSchema; }
|
|
25
13
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
14
|
+
Object.defineProperty(exports, "normalizeHex", {
|
|
27
15
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "normalizeHexAddress", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () { return QYHNWZK7_cjs.normalizeHexAddress; }
|
|
33
|
-
});
|
|
34
|
-
Object.defineProperty(exports, "normalizedHexAddressSchema", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function () { return QYHNWZK7_cjs.normalizedHexAddressSchema; }
|
|
16
|
+
get: function () { return OBNNMNND_cjs.normalizeHex; }
|
|
37
17
|
});
|
|
38
18
|
Object.defineProperty(exports, "normalizedHexSchema", {
|
|
39
19
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
20
|
+
get: function () { return OBNNMNND_cjs.normalizedHexSchema; }
|
|
41
21
|
});
|
|
42
|
-
Object.defineProperty(exports, "
|
|
22
|
+
Object.defineProperty(exports, "zeroNormalizedHex", {
|
|
43
23
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
24
|
+
get: function () { return OBNNMNND_cjs.zeroNormalizedHex; }
|
|
45
25
|
});
|
|
46
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "decimalString", {
|
|
47
27
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
28
|
+
get: function () { return _2J25PZ2O_cjs.decimalString; }
|
|
49
29
|
});
|
|
50
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "decimalStringSchema", {
|
|
51
31
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
32
|
+
get: function () { return _2J25PZ2O_cjs.decimalStringSchema; }
|
|
53
33
|
});
|
|
54
34
|
Object.defineProperty(exports, "assignedTransactionSchema", {
|
|
55
35
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { hexSchema, normalizeHex, normalizedHexSchema, zeroNormalizedHex } from './DOZD76P7.js';
|
|
2
|
+
export { decimalString, decimalStringSchema } from './4K6BY5DZ.js';
|
|
3
3
|
export { assignedTransactionSchema, buildTransactionWithResultSchema, minedTransactionSchema, signedTransactionSchema, transactionMetadataTimestamps, transactionResultSchema, transactionSchema, transactionWithResultSchema } from './3YWFRX2K.js';
|
|
4
4
|
import './VUOMXK5T.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/common-chain-model",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -15,14 +15,13 @@
|
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"zod": "^3.23.8",
|
|
18
|
-
"@layerzerolabs/
|
|
19
|
-
"@layerzerolabs/typescript-utils": "0.0.44"
|
|
18
|
+
"@layerzerolabs/typescript-utils": "0.0.46"
|
|
20
19
|
},
|
|
21
20
|
"devDependencies": {
|
|
22
21
|
"tsup": "^8.4.0",
|
|
23
22
|
"vitest": "^3.2.3",
|
|
24
|
-
"@layerzerolabs/
|
|
25
|
-
"@layerzerolabs/
|
|
23
|
+
"@layerzerolabs/tsup-configuration": "0.0.46",
|
|
24
|
+
"@layerzerolabs/typescript-configuration": "0.0.46"
|
|
26
25
|
},
|
|
27
26
|
"publishConfig": {
|
|
28
27
|
"access": "restricted",
|
package/src/address.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import z from 'zod/v4';
|
|
2
2
|
|
|
3
|
-
import { hexZeroPad, isBase58 } from '@layerzerolabs/common-utils';
|
|
4
3
|
import type { HexString, NormalizedHexString } from '@layerzerolabs/typescript-utils';
|
|
5
4
|
|
|
5
|
+
export type { HexString, NormalizedHexString };
|
|
6
|
+
|
|
6
7
|
export const hexSchema = z
|
|
7
8
|
.string()
|
|
8
9
|
.refine((data) => typeof data === 'string' && data.startsWith('0x')) as z.ZodType<HexString>;
|
|
@@ -31,31 +32,12 @@ export const normalizedHexSchema = z.string().refine((data) => {
|
|
|
31
32
|
return true;
|
|
32
33
|
}) as any as z.ZodType<NormalizedHexString>;
|
|
33
34
|
|
|
34
|
-
export const
|
|
35
|
-
export const normalizedHexAddressSchema = normalizedHexSchema;
|
|
36
|
-
|
|
37
|
-
export type HexAddress = z.infer<typeof hexAddressSchema>;
|
|
38
|
-
export type NormalizedHexAddress = z.infer<typeof normalizedHexSchema>;
|
|
39
|
-
|
|
40
|
-
export const lowercaseHex = <T extends HexAddress | undefined>(address: T): T =>
|
|
41
|
-
address && (address.toLowerCase() as T);
|
|
42
|
-
|
|
43
|
-
export const normalizeHexAddress = (address: HexAddress): NormalizedHexAddress => {
|
|
35
|
+
export const normalizeHex = (address: HexString): NormalizedHexString => {
|
|
44
36
|
// take the bytes part, remove all 0s
|
|
45
37
|
const body = address.slice(2).replace(/^0+/, '');
|
|
46
38
|
// if the string was e.g., `0x000`, append one 0 so that we have `0x0
|
|
47
39
|
const trimmed = '0x' + (body || '0');
|
|
48
|
-
return trimmed.toLowerCase() as any as
|
|
40
|
+
return trimmed.toLowerCase() as any as NormalizedHexString;
|
|
49
41
|
};
|
|
50
42
|
|
|
51
|
-
export const
|
|
52
|
-
address: NormalizedHexAddress,
|
|
53
|
-
byteCount: number,
|
|
54
|
-
): HexAddress => hexZeroPad(address as any as string, byteCount);
|
|
55
|
-
|
|
56
|
-
// Base58 schema for validation
|
|
57
|
-
export const base58AddressSchema = z.string().refine(isBase58, {
|
|
58
|
-
error: 'Invalid base58 address format',
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
export type Base58AddressSchema = z.infer<typeof base58AddressSchema>;
|
|
43
|
+
export const zeroNormalizedHex = normalizeHex('0x0');
|
package/src/bigint.ts
CHANGED
|
@@ -2,14 +2,37 @@ import z from 'zod/v4';
|
|
|
2
2
|
|
|
3
3
|
import { type DecimalString } from '@layerzerolabs/typescript-utils';
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
return bigInt.toString() as any as DecimalString;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const decimalStringToBigInt = (hex: DecimalString): bigint => {
|
|
10
|
-
return BigInt(hex as any as string);
|
|
11
|
-
};
|
|
5
|
+
export type { DecimalString };
|
|
12
6
|
|
|
13
7
|
export const decimalStringSchema = z.string().refine((data) => {
|
|
14
|
-
return
|
|
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 cant have multiple leading 0s
|
|
16
|
+
!(data.startsWith('-0') && data.length > 2)
|
|
17
|
+
);
|
|
15
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/dist/CIKWECQO.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { __name } from './VUOMXK5T.js';
|
|
2
|
-
import z from 'zod/v4';
|
|
3
|
-
import { isBase58, hexZeroPad } from '@layerzerolabs/common-utils';
|
|
4
|
-
|
|
5
|
-
var hexSchema = z.string().refine((data) => typeof data === "string" && data.startsWith("0x"));
|
|
6
|
-
var normalizedHexSchema = z.string().refine((data) => {
|
|
7
|
-
if (typeof data !== "string") {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
if (!data.startsWith("0x")) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
if (data.length <= 2) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
if (data.length >= 4 && data[2] === "0") {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (data.toLowerCase() !== data) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
return true;
|
|
23
|
-
});
|
|
24
|
-
var hexAddressSchema = hexSchema;
|
|
25
|
-
var normalizedHexAddressSchema = normalizedHexSchema;
|
|
26
|
-
var lowercaseHex = /* @__PURE__ */ __name((address) => address && address.toLowerCase(), "lowercaseHex");
|
|
27
|
-
var normalizeHexAddress = /* @__PURE__ */ __name((address) => {
|
|
28
|
-
const body = address.slice(2).replace(/^0+/, "");
|
|
29
|
-
const trimmed = "0x" + (body || "0");
|
|
30
|
-
return trimmed.toLowerCase();
|
|
31
|
-
}, "normalizeHexAddress");
|
|
32
|
-
var denormalizeHexAddress = /* @__PURE__ */ __name((address, byteCount) => hexZeroPad(address, byteCount), "denormalizeHexAddress");
|
|
33
|
-
var base58AddressSchema = z.string().refine(isBase58, {
|
|
34
|
-
error: "Invalid base58 address format"
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export { base58AddressSchema, denormalizeHexAddress, hexAddressSchema, hexSchema, lowercaseHex, normalizeHexAddress, normalizedHexAddressSchema, normalizedHexSchema };
|
|
38
|
-
//# sourceMappingURL=CIKWECQO.js.map
|
|
39
|
-
//# sourceMappingURL=CIKWECQO.js.map
|
package/dist/CIKWECQO.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/address.ts"],"names":["hexSchema","z","string","refine","data","startsWith","normalizedHexSchema","length","toLowerCase","hexAddressSchema","normalizedHexAddressSchema","lowercaseHex","address","normalizeHexAddress","body","slice","replace","trimmed","denormalizeHexAddress","byteCount","hexZeroPad","base58AddressSchema","isBase58","error"],"mappings":";;;;AAKO,IAAMA,SAAAA,GAAYC,CAAAA,CACpBC,MAAAA,EAAM,CACNC,MAAAA,CAAO,CAACC,IAAAA,KAAS,OAAOA,IAAAA,KAAS,QAAA,IAAYA,IAAAA,CAAKC,UAAAA,CAAW,IAAA,CAAA;AAE3D,IAAMC,sBAAsBL,CAAAA,CAAEC,MAAAA,EAAM,CAAGC,MAAAA,CAAO,CAACC,IAAAA,KAAAA;AAElD,EAAA,IAAI,OAAOA,SAAS,QAAA,EAAU;AAC1B,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAI,CAACA,IAAAA,CAAKC,UAAAA,CAAW,IAAA,CAAA,EAAO;AACxB,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAID,IAAAA,CAAKG,UAAU,CAAA,EAAG;AAClB,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAIH,KAAKG,MAAAA,IAAU,CAAA,IAAKH,IAAAA,CAAK,CAAA,MAAO,GAAA,EAAK;AACrC,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAIA,IAAAA,CAAKI,WAAAA,EAAW,KAAOJ,IAAAA,EAAM;AAC7B,IAAA,OAAO,KAAA;AACX,EAAA;AACA,EAAA,OAAO,IAAA;AACX,CAAA;AAEO,IAAMK,gBAAAA,GAAmBT;AACzB,IAAMU,0BAAAA,GAA6BJ;AAKnC,IAAMK,+BAAe,MAAA,CAAA,CAAmCC,OAAAA,KAC3DA,OAAAA,IAAYA,OAAAA,CAAQJ,aAAW,EADP,cAAA;AAGrB,IAAMK,mBAAAA,2BAAuBD,OAAAA,KAAAA;AAEhC,EAAA,MAAME,OAAOF,OAAAA,CAAQG,KAAAA,CAAM,CAAA,CAAA,CAAGC,OAAAA,CAAQ,OAAO,EAAA,CAAA;AAE7C,EAAA,MAAMC,OAAAA,GAAU,QAAQH,IAAAA,IAAQ,GAAA,CAAA;AAChC,EAAA,OAAOG,QAAQT,WAAAA,EAAW;AAC9B,CAAA,EANmC,qBAAA;AAQ5B,IAAMU,wCAAwB,MAAA,CAAA,CACjCN,OAAAA,EACAO,cACaC,UAAAA,CAAWR,OAAAA,EAA0BO,SAAAA,CAAAA,EAHjB,uBAAA;AAM9B,IAAME,mBAAAA,GAAsBpB,CAAAA,CAAEC,MAAAA,EAAM,CAAGC,OAAOmB,QAAAA,EAAU;EAC3DC,KAAAA,EAAO;AACX,CAAA","file":"CIKWECQO.js","sourcesContent":["import z from 'zod/v4';\n\nimport { hexZeroPad, isBase58 } from '@layerzerolabs/common-utils';\nimport type { HexString, NormalizedHexString } from '@layerzerolabs/typescript-utils';\n\nexport const hexSchema = z\n .string()\n .refine((data) => typeof data === 'string' && data.startsWith('0x')) as z.ZodType<HexString>;\n\nexport const normalizedHexSchema = z.string().refine((data) => {\n // normalized hex strings are strings\n if (typeof data !== 'string') {\n return false;\n }\n // normalized hex strings start with 0x\n if (!data.startsWith('0x')) {\n return false;\n }\n // '0x' is not a valid normalized address (expect 0x0)\n if (data.length <= 2) {\n return false;\n }\n // normalized hex strings have no leading 0s (except for edge case (0x0)\n if (data.length >= 4 && data[2] === '0') {\n return false;\n }\n // normalized hex strings are always lowercase\n if (data.toLowerCase() !== data) {\n return false;\n }\n return true;\n}) as any as z.ZodType<NormalizedHexString>;\n\nexport const hexAddressSchema = hexSchema;\nexport const normalizedHexAddressSchema = normalizedHexSchema;\n\nexport type HexAddress = z.infer<typeof hexAddressSchema>;\nexport type NormalizedHexAddress = z.infer<typeof normalizedHexSchema>;\n\nexport const lowercaseHex = <T extends HexAddress | undefined>(address: T): T =>\n address && (address.toLowerCase() as T);\n\nexport const normalizeHexAddress = (address: HexAddress): NormalizedHexAddress => {\n // take the bytes part, remove all 0s\n const body = address.slice(2).replace(/^0+/, '');\n // if the string was e.g., `0x000`, append one 0 so that we have `0x0\n const trimmed = '0x' + (body || '0');\n return trimmed.toLowerCase() as any as NormalizedHexAddress;\n};\n\nexport const denormalizeHexAddress = (\n address: NormalizedHexAddress,\n byteCount: number,\n): HexAddress => hexZeroPad(address as any as string, byteCount);\n\n// Base58 schema for validation\nexport const base58AddressSchema = z.string().refine(isBase58, {\n error: 'Invalid base58 address format',\n});\n\nexport type Base58AddressSchema = z.infer<typeof base58AddressSchema>;\n"]}
|
package/dist/DTYQULT4.cjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var YJF4D23A_cjs = require('./YJF4D23A.cjs');
|
|
4
|
-
var z = require('zod/v4');
|
|
5
|
-
|
|
6
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
-
|
|
8
|
-
var z__default = /*#__PURE__*/_interopDefault(z);
|
|
9
|
-
|
|
10
|
-
var decimalStringFromBigInt = /* @__PURE__ */ YJF4D23A_cjs.__name((bigInt) => {
|
|
11
|
-
return bigInt.toString();
|
|
12
|
-
}, "decimalStringFromBigInt");
|
|
13
|
-
var decimalStringToBigInt = /* @__PURE__ */ YJF4D23A_cjs.__name((hex) => {
|
|
14
|
-
return BigInt(hex);
|
|
15
|
-
}, "decimalStringToBigInt");
|
|
16
|
-
var decimalStringSchema = z__default.default.string().refine((data) => {
|
|
17
|
-
return typeof data === "string" && data.match(/^\d+$/) !== null;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
exports.decimalStringFromBigInt = decimalStringFromBigInt;
|
|
21
|
-
exports.decimalStringSchema = decimalStringSchema;
|
|
22
|
-
exports.decimalStringToBigInt = decimalStringToBigInt;
|
|
23
|
-
//# sourceMappingURL=DTYQULT4.cjs.map
|
|
24
|
-
//# sourceMappingURL=DTYQULT4.cjs.map
|
package/dist/DTYQULT4.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bigint.ts"],"names":["decimalStringFromBigInt","bigInt","toString","decimalStringToBigInt","hex","BigInt","decimalStringSchema","z","string","refine","data","match"],"mappings":";;;;;;;;;AAIO,IAAMA,uBAAAA,wCAA2BC,MAAAA,KAAAA;AACpC,EAAA,OAAOA,OAAOC,QAAAA,EAAQ;AAC1B,CAAA,EAFuC,yBAAA;AAIhC,IAAMC,qBAAAA,wCAAyBC,GAAAA,KAAAA;AAClC,EAAA,OAAOC,OAAOD,GAAAA,CAAAA;AAClB,CAAA,EAFqC,uBAAA;AAI9B,IAAME,sBAAsBC,kBAAAA,CAAEC,MAAAA,EAAM,CAAGC,MAAAA,CAAO,CAACC,IAAAA,KAAAA;AAClD,EAAA,OAAO,OAAOA,IAAAA,KAAS,QAAA,IAAYA,IAAAA,CAAKC,KAAAA,CAAM,OAAA,CAAA,KAAa,IAAA;AAC/D,CAAA","file":"DTYQULT4.cjs","sourcesContent":["import z from 'zod/v4';\n\nimport { type DecimalString } from '@layerzerolabs/typescript-utils';\n\nexport const decimalStringFromBigInt = (bigInt: bigint): DecimalString => {\n return bigInt.toString() as any as DecimalString;\n};\n\nexport const decimalStringToBigInt = (hex: DecimalString): bigint => {\n return BigInt(hex as any as string);\n};\n\nexport const decimalStringSchema = z.string().refine((data) => {\n return typeof data === 'string' && data.match(/^\\d+$/) !== null;\n}) as any as z.ZodType<DecimalString>;\n"]}
|
package/dist/QYHNWZK7.cjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var YJF4D23A_cjs = require('./YJF4D23A.cjs');
|
|
4
|
-
var z = require('zod/v4');
|
|
5
|
-
var commonUtils = require('@layerzerolabs/common-utils');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var z__default = /*#__PURE__*/_interopDefault(z);
|
|
10
|
-
|
|
11
|
-
var hexSchema = z__default.default.string().refine((data) => typeof data === "string" && data.startsWith("0x"));
|
|
12
|
-
var normalizedHexSchema = z__default.default.string().refine((data) => {
|
|
13
|
-
if (typeof data !== "string") {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
if (!data.startsWith("0x")) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (data.length <= 2) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
if (data.length >= 4 && data[2] === "0") {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
if (data.toLowerCase() !== data) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
});
|
|
30
|
-
var hexAddressSchema = hexSchema;
|
|
31
|
-
var normalizedHexAddressSchema = normalizedHexSchema;
|
|
32
|
-
var lowercaseHex = /* @__PURE__ */ YJF4D23A_cjs.__name((address) => address && address.toLowerCase(), "lowercaseHex");
|
|
33
|
-
var normalizeHexAddress = /* @__PURE__ */ YJF4D23A_cjs.__name((address) => {
|
|
34
|
-
const body = address.slice(2).replace(/^0+/, "");
|
|
35
|
-
const trimmed = "0x" + (body || "0");
|
|
36
|
-
return trimmed.toLowerCase();
|
|
37
|
-
}, "normalizeHexAddress");
|
|
38
|
-
var denormalizeHexAddress = /* @__PURE__ */ YJF4D23A_cjs.__name((address, byteCount) => commonUtils.hexZeroPad(address, byteCount), "denormalizeHexAddress");
|
|
39
|
-
var base58AddressSchema = z__default.default.string().refine(commonUtils.isBase58, {
|
|
40
|
-
error: "Invalid base58 address format"
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
exports.base58AddressSchema = base58AddressSchema;
|
|
44
|
-
exports.denormalizeHexAddress = denormalizeHexAddress;
|
|
45
|
-
exports.hexAddressSchema = hexAddressSchema;
|
|
46
|
-
exports.hexSchema = hexSchema;
|
|
47
|
-
exports.lowercaseHex = lowercaseHex;
|
|
48
|
-
exports.normalizeHexAddress = normalizeHexAddress;
|
|
49
|
-
exports.normalizedHexAddressSchema = normalizedHexAddressSchema;
|
|
50
|
-
exports.normalizedHexSchema = normalizedHexSchema;
|
|
51
|
-
//# sourceMappingURL=QYHNWZK7.cjs.map
|
|
52
|
-
//# sourceMappingURL=QYHNWZK7.cjs.map
|
package/dist/QYHNWZK7.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/address.ts"],"names":["hexSchema","z","string","refine","data","startsWith","normalizedHexSchema","length","toLowerCase","hexAddressSchema","normalizedHexAddressSchema","lowercaseHex","__name","address","normalizeHexAddress","body","slice","replace","trimmed","denormalizeHexAddress","byteCount","hexZeroPad","base58AddressSchema","isBase58","error"],"mappings":";;;;;;;;;;AAKO,IAAMA,SAAAA,GAAYC,kBAAAA,CACpBC,MAAAA,EAAM,CACNC,MAAAA,CAAO,CAACC,IAAAA,KAAS,OAAOA,IAAAA,KAAS,QAAA,IAAYA,IAAAA,CAAKC,UAAAA,CAAW,IAAA,CAAA;AAE3D,IAAMC,sBAAsBL,kBAAAA,CAAEC,MAAAA,EAAM,CAAGC,MAAAA,CAAO,CAACC,IAAAA,KAAAA;AAElD,EAAA,IAAI,OAAOA,SAAS,QAAA,EAAU;AAC1B,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAI,CAACA,IAAAA,CAAKC,UAAAA,CAAW,IAAA,CAAA,EAAO;AACxB,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAID,IAAAA,CAAKG,UAAU,CAAA,EAAG;AAClB,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAIH,KAAKG,MAAAA,IAAU,CAAA,IAAKH,IAAAA,CAAK,CAAA,MAAO,GAAA,EAAK;AACrC,IAAA,OAAO,KAAA;AACX,EAAA;AAEA,EAAA,IAAIA,IAAAA,CAAKI,WAAAA,EAAW,KAAOJ,IAAAA,EAAM;AAC7B,IAAA,OAAO,KAAA;AACX,EAAA;AACA,EAAA,OAAO,IAAA;AACX,CAAA;AAEO,IAAMK,gBAAAA,GAAmBT;AACzB,IAAMU,0BAAAA,GAA6BJ;AAKnC,IAAMK,+BAAeC,mBAAA,CAAA,CAAmCC,OAAAA,KAC3DA,OAAAA,IAAYA,OAAAA,CAAQL,aAAW,EADP,cAAA;AAGrB,IAAMM,mBAAAA,wCAAuBD,OAAAA,KAAAA;AAEhC,EAAA,MAAME,OAAOF,OAAAA,CAAQG,KAAAA,CAAM,CAAA,CAAA,CAAGC,OAAAA,CAAQ,OAAO,EAAA,CAAA;AAE7C,EAAA,MAAMC,OAAAA,GAAU,QAAQH,IAAAA,IAAQ,GAAA,CAAA;AAChC,EAAA,OAAOG,QAAQV,WAAAA,EAAW;AAC9B,CAAA,EANmC,qBAAA;AAQ5B,IAAMW,wCAAwBP,mBAAA,CAAA,CACjCC,OAAAA,EACAO,cACaC,sBAAAA,CAAWR,OAAAA,EAA0BO,SAAAA,CAAAA,EAHjB,uBAAA;AAM9B,IAAME,mBAAAA,GAAsBrB,kBAAAA,CAAEC,MAAAA,EAAM,CAAGC,OAAOoB,oBAAAA,EAAU;EAC3DC,KAAAA,EAAO;AACX,CAAA","file":"QYHNWZK7.cjs","sourcesContent":["import z from 'zod/v4';\n\nimport { hexZeroPad, isBase58 } from '@layerzerolabs/common-utils';\nimport type { HexString, NormalizedHexString } from '@layerzerolabs/typescript-utils';\n\nexport const hexSchema = z\n .string()\n .refine((data) => typeof data === 'string' && data.startsWith('0x')) as z.ZodType<HexString>;\n\nexport const normalizedHexSchema = z.string().refine((data) => {\n // normalized hex strings are strings\n if (typeof data !== 'string') {\n return false;\n }\n // normalized hex strings start with 0x\n if (!data.startsWith('0x')) {\n return false;\n }\n // '0x' is not a valid normalized address (expect 0x0)\n if (data.length <= 2) {\n return false;\n }\n // normalized hex strings have no leading 0s (except for edge case (0x0)\n if (data.length >= 4 && data[2] === '0') {\n return false;\n }\n // normalized hex strings are always lowercase\n if (data.toLowerCase() !== data) {\n return false;\n }\n return true;\n}) as any as z.ZodType<NormalizedHexString>;\n\nexport const hexAddressSchema = hexSchema;\nexport const normalizedHexAddressSchema = normalizedHexSchema;\n\nexport type HexAddress = z.infer<typeof hexAddressSchema>;\nexport type NormalizedHexAddress = z.infer<typeof normalizedHexSchema>;\n\nexport const lowercaseHex = <T extends HexAddress | undefined>(address: T): T =>\n address && (address.toLowerCase() as T);\n\nexport const normalizeHexAddress = (address: HexAddress): NormalizedHexAddress => {\n // take the bytes part, remove all 0s\n const body = address.slice(2).replace(/^0+/, '');\n // if the string was e.g., `0x000`, append one 0 so that we have `0x0\n const trimmed = '0x' + (body || '0');\n return trimmed.toLowerCase() as any as NormalizedHexAddress;\n};\n\nexport const denormalizeHexAddress = (\n address: NormalizedHexAddress,\n byteCount: number,\n): HexAddress => hexZeroPad(address as any as string, byteCount);\n\n// Base58 schema for validation\nexport const base58AddressSchema = z.string().refine(isBase58, {\n error: 'Invalid base58 address format',\n});\n\nexport type Base58AddressSchema = z.infer<typeof base58AddressSchema>;\n"]}
|
package/dist/RINNGVQR.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { __name } from './VUOMXK5T.js';
|
|
2
|
-
import z from 'zod/v4';
|
|
3
|
-
|
|
4
|
-
var decimalStringFromBigInt = /* @__PURE__ */ __name((bigInt) => {
|
|
5
|
-
return bigInt.toString();
|
|
6
|
-
}, "decimalStringFromBigInt");
|
|
7
|
-
var decimalStringToBigInt = /* @__PURE__ */ __name((hex) => {
|
|
8
|
-
return BigInt(hex);
|
|
9
|
-
}, "decimalStringToBigInt");
|
|
10
|
-
var decimalStringSchema = z.string().refine((data) => {
|
|
11
|
-
return typeof data === "string" && data.match(/^\d+$/) !== null;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export { decimalStringFromBigInt, decimalStringSchema, decimalStringToBigInt };
|
|
15
|
-
//# sourceMappingURL=RINNGVQR.js.map
|
|
16
|
-
//# sourceMappingURL=RINNGVQR.js.map
|
package/dist/RINNGVQR.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bigint.ts"],"names":["decimalStringFromBigInt","bigInt","toString","decimalStringToBigInt","hex","BigInt","decimalStringSchema","z","string","refine","data","match"],"mappings":";;;AAIO,IAAMA,uBAAAA,2BAA2BC,MAAAA,KAAAA;AACpC,EAAA,OAAOA,OAAOC,QAAAA,EAAQ;AAC1B,CAAA,EAFuC,yBAAA;AAIhC,IAAMC,qBAAAA,2BAAyBC,GAAAA,KAAAA;AAClC,EAAA,OAAOC,OAAOD,GAAAA,CAAAA;AAClB,CAAA,EAFqC,uBAAA;AAI9B,IAAME,sBAAsBC,CAAAA,CAAEC,MAAAA,EAAM,CAAGC,MAAAA,CAAO,CAACC,IAAAA,KAAAA;AAClD,EAAA,OAAO,OAAOA,IAAAA,KAAS,QAAA,IAAYA,IAAAA,CAAKC,KAAAA,CAAM,OAAA,CAAA,KAAa,IAAA;AAC/D,CAAA","file":"RINNGVQR.js","sourcesContent":["import z from 'zod/v4';\n\nimport { type DecimalString } from '@layerzerolabs/typescript-utils';\n\nexport const decimalStringFromBigInt = (bigInt: bigint): DecimalString => {\n return bigInt.toString() as any as DecimalString;\n};\n\nexport const decimalStringToBigInt = (hex: DecimalString): bigint => {\n return BigInt(hex as any as string);\n};\n\nexport const decimalStringSchema = z.string().refine((data) => {\n return typeof data === 'string' && data.match(/^\\d+$/) !== null;\n}) as any as z.ZodType<DecimalString>;\n"]}
|