@cfxjs/sirius-next-common 0.3.6 → 0.3.7
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/chunk-7IYCCOGO.js +20 -0
- package/dist/chunk-7IYCCOGO.js.map +1 -0
- package/dist/{chunk-FINM6TKG.js → chunk-CPJW35V5.js} +2 -2
- package/dist/{chunk-Z3GOXWTO.js → chunk-HGPMFUNY.js} +2 -2
- package/dist/{chunk-FG544Z6M.js → chunk-JXWR65HE.js} +4 -4
- package/dist/{chunk-7UH332LS.js → chunk-NLT6ODDI.js} +2 -2
- package/dist/{chunk-NSSVN52T.js → chunk-NX5DRDEV.js} +2 -2
- package/dist/components/AAFailedReason/index.js +2 -2
- package/dist/components/OutputData/ErrorDecode.js +3 -3
- package/dist/components/OutputData/index.js +4 -4
- package/dist/components/TransactionTrace/TraceDetail.js +6 -6
- package/dist/components/TransactionTrace/TreeTraceTable.js +7 -7
- package/dist/components/TransactionTrace/index.js +7 -7
- package/dist/utils/addressLabel.d.ts +16 -0
- package/dist/utils/addressLabel.js +42 -0
- package/dist/utils/addressLabel.js.map +1 -0
- package/dist/utils/hooks/useDecodeFunctionError.js +2 -2
- package/dist/utils/privateText.d.ts +9 -0
- package/dist/utils/privateText.js +12 -0
- package/dist/utils/privateText.js.map +1 -0
- package/dist/utils/txNote.d.ts +12 -0
- package/dist/utils/txNote.js +41 -0
- package/dist/utils/txNote.js.map +1 -0
- package/package.json +3 -3
- /package/dist/{chunk-FINM6TKG.js.map → chunk-CPJW35V5.js.map} +0 -0
- /package/dist/{chunk-Z3GOXWTO.js.map → chunk-HGPMFUNY.js.map} +0 -0
- /package/dist/{chunk-FG544Z6M.js.map → chunk-JXWR65HE.js.map} +0 -0
- /package/dist/{chunk-7UH332LS.js.map → chunk-NLT6ODDI.js.map} +0 -0
- /package/dist/{chunk-NSSVN52T.js.map → chunk-NX5DRDEV.js.map} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/utils/privateText.ts
|
|
2
|
+
var DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT = 20;
|
|
3
|
+
var HTML_TAG_CHARACTER_PATTERN = /[<>]/;
|
|
4
|
+
var URL_LIKE_PREFIX_PATTERN = /^(?:[a-z][a-z\d+.-]*:|\/\/|www\.)/i;
|
|
5
|
+
var hasControlCharacter = (value) => Array.from(value).some((character) => {
|
|
6
|
+
const codePoint = character.codePointAt(0) || 0;
|
|
7
|
+
return codePoint >= 0 && codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
8
|
+
});
|
|
9
|
+
var normalizePrivateText = (value) => typeof value === "string" ? value.trim() : "";
|
|
10
|
+
var isValidPrivateText = (value, lengthLimit = DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT) => {
|
|
11
|
+
const text = normalizePrivateText(value);
|
|
12
|
+
return typeof value === "string" && text.length > 0 && text.length <= lengthLimit && !hasControlCharacter(text) && !HTML_TAG_CHARACTER_PATTERN.test(text) && !URL_LIKE_PREFIX_PATTERN.test(text);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT,
|
|
17
|
+
normalizePrivateText,
|
|
18
|
+
isValidPrivateText
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=chunk-7IYCCOGO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/privateText.ts"],"sourcesContent":["export const DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT = 20;\n\nconst HTML_TAG_CHARACTER_PATTERN = /[<>]/;\nconst URL_LIKE_PREFIX_PATTERN = /^(?:[a-z][a-z\\d+.-]*:|\\/\\/|www\\.)/i;\n\nconst hasControlCharacter = (value: string): boolean =>\n Array.from(value).some(character => {\n const codePoint = character.codePointAt(0) || 0;\n return (\n (codePoint >= 0 && codePoint <= 0x1f) ||\n (codePoint >= 0x7f && codePoint <= 0x9f)\n );\n });\n\nexport const normalizePrivateText = (value: unknown): string =>\n typeof value === 'string' ? value.trim() : '';\n\n/**\n * Private profile fields are rendered as text. Keep persisted and imported\n * values within the same plain-text policy used by form validation.\n */\nexport const isValidPrivateText = (\n value: unknown,\n lengthLimit = DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT,\n): value is string => {\n const text = normalizePrivateText(value);\n\n return (\n typeof value === 'string' &&\n text.length > 0 &&\n text.length <= lengthLimit &&\n !hasControlCharacter(text) &&\n !HTML_TAG_CHARACTER_PATTERN.test(text) &&\n !URL_LIKE_PREFIX_PATTERN.test(text)\n );\n};\n"],"mappings":";AAAO,IAAM,oCAAoC;AAEjD,IAAM,6BAA6B;AACnC,IAAM,0BAA0B;AAEhC,IAAM,sBAAsB,CAAC,UAC3B,MAAM,KAAK,KAAK,EAAE,KAAK,eAAa;AAClC,QAAM,YAAY,UAAU,YAAY,CAAC,KAAK;AAC9C,SACG,aAAa,KAAK,aAAa,MAC/B,aAAa,OAAQ,aAAa;AAEvC,CAAC;AAEI,IAAM,uBAAuB,CAAC,UACnC,OAAO,UAAU,WAAW,MAAM,KAAK,IAAI;AAMtC,IAAM,qBAAqB,CAChC,OACA,cAAc,sCACM;AACpB,QAAM,OAAO,qBAAqB,KAAK;AAEvC,SACE,OAAO,UAAU,YACjB,KAAK,SAAS,KACd,KAAK,UAAU,eACf,CAAC,oBAAoB,IAAI,KACzB,CAAC,2BAA2B,KAAK,IAAI,KACrC,CAAC,wBAAwB,KAAK,IAAI;AAEtC;","names":[]}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-OBQKDJXW.js";
|
|
10
10
|
import {
|
|
11
11
|
OutputData
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HGPMFUNY.js";
|
|
13
13
|
import {
|
|
14
14
|
InputData
|
|
15
15
|
} from "./chunk-3TLAXDXL.js";
|
|
@@ -189,4 +189,4 @@ var TraceDetail = (props) => {
|
|
|
189
189
|
export {
|
|
190
190
|
TraceDetail
|
|
191
191
|
};
|
|
192
|
-
//# sourceMappingURL=chunk-
|
|
192
|
+
//# sourceMappingURL=chunk-CPJW35V5.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ErrorDecode
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NX5DRDEV.js";
|
|
4
4
|
import {
|
|
5
5
|
Original
|
|
6
6
|
} from "./chunk-BXD6FXE7.js";
|
|
@@ -69,4 +69,4 @@ var OutputData = ({
|
|
|
69
69
|
export {
|
|
70
70
|
OutputData
|
|
71
71
|
};
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
72
|
+
//# sourceMappingURL=chunk-HGPMFUNY.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeErrorResult
|
|
3
3
|
} from "./chunk-XHSYE74K.js";
|
|
4
|
-
import {
|
|
5
|
-
useAbiItemById
|
|
6
|
-
} from "./chunk-OH6PXF7K.js";
|
|
7
4
|
import {
|
|
8
5
|
useContractDetail
|
|
9
6
|
} from "./chunk-3ICCM4IY.js";
|
|
7
|
+
import {
|
|
8
|
+
useAbiItemById
|
|
9
|
+
} from "./chunk-OH6PXF7K.js";
|
|
10
10
|
import {
|
|
11
11
|
CommonError_default
|
|
12
12
|
} from "./chunk-5TGK2EA2.js";
|
|
@@ -198,4 +198,4 @@ var useDecodeFunctionError = ({
|
|
|
198
198
|
export {
|
|
199
199
|
useDecodeFunctionError
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
201
|
+
//# sourceMappingURL=chunk-JXWR65HE.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TraceDetail
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CPJW35V5.js";
|
|
4
4
|
import {
|
|
5
5
|
Table
|
|
6
6
|
} from "./chunk-4WLXG7ZY.js";
|
|
@@ -81,4 +81,4 @@ var TreeTraceTable = ({
|
|
|
81
81
|
export {
|
|
82
82
|
TreeTraceTable
|
|
83
83
|
};
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
84
|
+
//# sourceMappingURL=chunk-NLT6ODDI.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-GZMSESHY.js";
|
|
13
13
|
import {
|
|
14
14
|
useDecodeFunctionError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JXWR65HE.js";
|
|
16
16
|
import {
|
|
17
17
|
cn
|
|
18
18
|
} from "./chunk-72GJNVP4.js";
|
|
@@ -91,4 +91,4 @@ var ErrorDecode = ({
|
|
|
91
91
|
export {
|
|
92
92
|
ErrorDecode
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-NX5DRDEV.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDecodeFunctionError
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-JXWR65HE.js";
|
|
4
4
|
import "../../chunk-XHSYE74K.js";
|
|
5
|
-
import "../../chunk-OH6PXF7K.js";
|
|
6
5
|
import "../../chunk-3ICCM4IY.js";
|
|
6
|
+
import "../../chunk-OH6PXF7K.js";
|
|
7
7
|
import "../../chunk-6ZBEHPM3.js";
|
|
8
8
|
import "../../chunk-CGDNDBBP.js";
|
|
9
9
|
import "../../chunk-S6O6Q2GQ.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ErrorDecode
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-NX5DRDEV.js";
|
|
4
4
|
import "../../chunk-BXD6FXE7.js";
|
|
5
5
|
import "../../chunk-NF7GYQG6.js";
|
|
6
6
|
import "../../chunk-UNFMF6PD.js";
|
|
@@ -12,10 +12,10 @@ import "../../chunk-GZMSESHY.js";
|
|
|
12
12
|
import "../../chunk-XI5WO2NW.js";
|
|
13
13
|
import "../../chunk-2Y57U43P.js";
|
|
14
14
|
import "../../chunk-TGK5LP2H.js";
|
|
15
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-JXWR65HE.js";
|
|
16
16
|
import "../../chunk-XHSYE74K.js";
|
|
17
|
-
import "../../chunk-OH6PXF7K.js";
|
|
18
17
|
import "../../chunk-3ICCM4IY.js";
|
|
18
|
+
import "../../chunk-OH6PXF7K.js";
|
|
19
19
|
import "../../chunk-6ZBEHPM3.js";
|
|
20
20
|
import "../../chunk-CGDNDBBP.js";
|
|
21
21
|
import "../../chunk-S6O6Q2GQ.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OutputData
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-HGPMFUNY.js";
|
|
4
|
+
import "../../chunk-NX5DRDEV.js";
|
|
5
5
|
import "../../chunk-BXD6FXE7.js";
|
|
6
6
|
import "../../chunk-ZNYSNETG.js";
|
|
7
7
|
import "../../chunk-NF7GYQG6.js";
|
|
@@ -15,10 +15,10 @@ import "../../chunk-GZMSESHY.js";
|
|
|
15
15
|
import "../../chunk-XI5WO2NW.js";
|
|
16
16
|
import "../../chunk-2Y57U43P.js";
|
|
17
17
|
import "../../chunk-TGK5LP2H.js";
|
|
18
|
-
import "../../chunk-
|
|
18
|
+
import "../../chunk-JXWR65HE.js";
|
|
19
19
|
import "../../chunk-XHSYE74K.js";
|
|
20
|
-
import "../../chunk-OH6PXF7K.js";
|
|
21
20
|
import "../../chunk-3ICCM4IY.js";
|
|
21
|
+
import "../../chunk-OH6PXF7K.js";
|
|
22
22
|
import "../../chunk-6ZBEHPM3.js";
|
|
23
23
|
import "../../chunk-CGDNDBBP.js";
|
|
24
24
|
import "../../chunk-S6O6Q2GQ.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TraceDetail
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-CPJW35V5.js";
|
|
4
4
|
import "../../chunk-G24GHQO6.js";
|
|
5
|
-
import "../../chunk-UM5J477V.js";
|
|
6
5
|
import "../../chunk-TAA65LM3.js";
|
|
6
|
+
import "../../chunk-UM5J477V.js";
|
|
7
7
|
import "../../chunk-OBQKDJXW.js";
|
|
8
8
|
import "../../chunk-3MT7JGRQ.js";
|
|
9
9
|
import "../../chunk-NWVSTRCG.js";
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-HGPMFUNY.js";
|
|
11
|
+
import "../../chunk-NX5DRDEV.js";
|
|
12
12
|
import "../../chunk-3TLAXDXL.js";
|
|
13
13
|
import "../../chunk-BXD6FXE7.js";
|
|
14
14
|
import "../../chunk-ZNYSNETG.js";
|
|
@@ -26,10 +26,10 @@ import "../../chunk-O6NJ56NA.js";
|
|
|
26
26
|
import "../../chunk-XCKMXAL2.js";
|
|
27
27
|
import "../../chunk-2Y57U43P.js";
|
|
28
28
|
import "../../chunk-TGK5LP2H.js";
|
|
29
|
-
import "../../chunk-
|
|
29
|
+
import "../../chunk-JXWR65HE.js";
|
|
30
30
|
import "../../chunk-XHSYE74K.js";
|
|
31
|
-
import "../../chunk-OH6PXF7K.js";
|
|
32
31
|
import "../../chunk-3ICCM4IY.js";
|
|
32
|
+
import "../../chunk-OH6PXF7K.js";
|
|
33
33
|
import "../../chunk-6ZBEHPM3.js";
|
|
34
34
|
import "../../chunk-CGDNDBBP.js";
|
|
35
35
|
import "../../chunk-S6O6Q2GQ.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TreeTraceTable
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-NLT6ODDI.js";
|
|
4
|
+
import "../../chunk-CPJW35V5.js";
|
|
5
5
|
import "../../chunk-G24GHQO6.js";
|
|
6
|
-
import "../../chunk-UM5J477V.js";
|
|
7
6
|
import "../../chunk-TAA65LM3.js";
|
|
7
|
+
import "../../chunk-UM5J477V.js";
|
|
8
8
|
import "../../chunk-4WLXG7ZY.js";
|
|
9
9
|
import "../../chunk-OBQKDJXW.js";
|
|
10
10
|
import "../../chunk-3MT7JGRQ.js";
|
|
11
11
|
import "../../chunk-NWVSTRCG.js";
|
|
12
|
-
import "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-HGPMFUNY.js";
|
|
13
|
+
import "../../chunk-NX5DRDEV.js";
|
|
14
14
|
import "../../chunk-3TLAXDXL.js";
|
|
15
15
|
import "../../chunk-BXD6FXE7.js";
|
|
16
16
|
import "../../chunk-ZNYSNETG.js";
|
|
@@ -29,10 +29,10 @@ import "../../chunk-O6NJ56NA.js";
|
|
|
29
29
|
import "../../chunk-XCKMXAL2.js";
|
|
30
30
|
import "../../chunk-2Y57U43P.js";
|
|
31
31
|
import "../../chunk-TGK5LP2H.js";
|
|
32
|
-
import "../../chunk-
|
|
32
|
+
import "../../chunk-JXWR65HE.js";
|
|
33
33
|
import "../../chunk-XHSYE74K.js";
|
|
34
|
-
import "../../chunk-OH6PXF7K.js";
|
|
35
34
|
import "../../chunk-3ICCM4IY.js";
|
|
35
|
+
import "../../chunk-OH6PXF7K.js";
|
|
36
36
|
import "../../chunk-6ZBEHPM3.js";
|
|
37
37
|
import "../../chunk-CGDNDBBP.js";
|
|
38
38
|
import "../../chunk-S6O6Q2GQ.js";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TreeTraceTable
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-NLT6ODDI.js";
|
|
4
4
|
import {
|
|
5
5
|
TraceDetail
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-CPJW35V5.js";
|
|
7
7
|
import "../../chunk-G24GHQO6.js";
|
|
8
|
-
import "../../chunk-UM5J477V.js";
|
|
9
8
|
import "../../chunk-TAA65LM3.js";
|
|
9
|
+
import "../../chunk-UM5J477V.js";
|
|
10
10
|
import "../../chunk-4WLXG7ZY.js";
|
|
11
11
|
import "../../chunk-OBQKDJXW.js";
|
|
12
12
|
import "../../chunk-3MT7JGRQ.js";
|
|
13
13
|
import "../../chunk-NWVSTRCG.js";
|
|
14
|
-
import "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-HGPMFUNY.js";
|
|
15
|
+
import "../../chunk-NX5DRDEV.js";
|
|
16
16
|
import "../../chunk-3TLAXDXL.js";
|
|
17
17
|
import "../../chunk-BXD6FXE7.js";
|
|
18
18
|
import "../../chunk-ZNYSNETG.js";
|
|
@@ -31,10 +31,10 @@ import "../../chunk-O6NJ56NA.js";
|
|
|
31
31
|
import "../../chunk-XCKMXAL2.js";
|
|
32
32
|
import "../../chunk-2Y57U43P.js";
|
|
33
33
|
import "../../chunk-TGK5LP2H.js";
|
|
34
|
-
import "../../chunk-
|
|
34
|
+
import "../../chunk-JXWR65HE.js";
|
|
35
35
|
import "../../chunk-XHSYE74K.js";
|
|
36
|
-
import "../../chunk-OH6PXF7K.js";
|
|
37
36
|
import "../../chunk-3ICCM4IY.js";
|
|
37
|
+
import "../../chunk-OH6PXF7K.js";
|
|
38
38
|
import "../../chunk-6ZBEHPM3.js";
|
|
39
39
|
import "../../chunk-CGDNDBBP.js";
|
|
40
40
|
import "../../chunk-S6O6Q2GQ.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const DEFAULT_ADDRESS_LABEL_LENGTH_LIMIT = 20;
|
|
2
|
+
interface AddressLabelRecord {
|
|
3
|
+
a: string;
|
|
4
|
+
l: string;
|
|
5
|
+
t: number;
|
|
6
|
+
u: number;
|
|
7
|
+
}
|
|
8
|
+
declare const normalizeAddressLabel: (value: unknown) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Private address labels are plain text. Keep the policy here so form input,
|
|
11
|
+
* imported profile data, and persisted data use the same validation rules.
|
|
12
|
+
*/
|
|
13
|
+
declare const isValidAddressLabel: (value: unknown, lengthLimit?: number) => value is string;
|
|
14
|
+
declare const sanitizeAddressLabels: (value: unknown, lengthLimit?: number) => AddressLabelRecord[];
|
|
15
|
+
|
|
16
|
+
export { AddressLabelRecord, DEFAULT_ADDRESS_LABEL_LENGTH_LIMIT, isValidAddressLabel, normalizeAddressLabel, sanitizeAddressLabels };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT,
|
|
3
|
+
isValidPrivateText,
|
|
4
|
+
normalizePrivateText
|
|
5
|
+
} from "../chunk-7IYCCOGO.js";
|
|
6
|
+
import "../chunk-WQG2LZMB.js";
|
|
7
|
+
|
|
8
|
+
// src/utils/addressLabel.ts
|
|
9
|
+
var DEFAULT_ADDRESS_LABEL_LENGTH_LIMIT = DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT;
|
|
10
|
+
var normalizeAddressLabel = normalizePrivateText;
|
|
11
|
+
var isValidAddressLabel = (value, lengthLimit = DEFAULT_ADDRESS_LABEL_LENGTH_LIMIT) => {
|
|
12
|
+
return isValidPrivateText(value, lengthLimit);
|
|
13
|
+
};
|
|
14
|
+
var sanitizeAddressLabels = (value, lengthLimit = DEFAULT_ADDRESS_LABEL_LENGTH_LIMIT) => {
|
|
15
|
+
if (!Array.isArray(value)) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
return value.reduce((validLabels, item) => {
|
|
19
|
+
if (!item || typeof item !== "object") {
|
|
20
|
+
return validLabels;
|
|
21
|
+
}
|
|
22
|
+
const record = item;
|
|
23
|
+
const label = normalizeAddressLabel(record.l);
|
|
24
|
+
if (typeof record.a !== "string" || !record.a || typeof record.t !== "number" || !Number.isFinite(record.t) || typeof record.u !== "number" || !Number.isFinite(record.u) || !isValidAddressLabel(label, lengthLimit)) {
|
|
25
|
+
return validLabels;
|
|
26
|
+
}
|
|
27
|
+
validLabels.push({
|
|
28
|
+
a: record.a,
|
|
29
|
+
l: label,
|
|
30
|
+
t: record.t,
|
|
31
|
+
u: record.u
|
|
32
|
+
});
|
|
33
|
+
return validLabels;
|
|
34
|
+
}, []);
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
DEFAULT_ADDRESS_LABEL_LENGTH_LIMIT,
|
|
38
|
+
isValidAddressLabel,
|
|
39
|
+
normalizeAddressLabel,
|
|
40
|
+
sanitizeAddressLabels
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=addressLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/addressLabel.ts"],"sourcesContent":["import {\n DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT,\n isValidPrivateText,\n normalizePrivateText,\n} from './privateText';\n\nexport const DEFAULT_ADDRESS_LABEL_LENGTH_LIMIT =\n DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT;\n\nexport interface AddressLabelRecord {\n a: string;\n l: string;\n t: number;\n u: number;\n}\n\nexport const normalizeAddressLabel = normalizePrivateText;\n\n/**\n * Private address labels are plain text. Keep the policy here so form input,\n * imported profile data, and persisted data use the same validation rules.\n */\nexport const isValidAddressLabel = (\n value: unknown,\n lengthLimit = DEFAULT_ADDRESS_LABEL_LENGTH_LIMIT,\n): value is string => {\n return isValidPrivateText(value, lengthLimit);\n};\n\nexport const sanitizeAddressLabels = (\n value: unknown,\n lengthLimit = DEFAULT_ADDRESS_LABEL_LENGTH_LIMIT,\n): AddressLabelRecord[] => {\n if (!Array.isArray(value)) {\n return [];\n }\n\n return value.reduce<AddressLabelRecord[]>((validLabels, item) => {\n if (!item || typeof item !== 'object') {\n return validLabels;\n }\n\n const record = item as Partial<AddressLabelRecord>;\n const label = normalizeAddressLabel(record.l);\n\n if (\n typeof record.a !== 'string' ||\n !record.a ||\n typeof record.t !== 'number' ||\n !Number.isFinite(record.t) ||\n typeof record.u !== 'number' ||\n !Number.isFinite(record.u) ||\n !isValidAddressLabel(label, lengthLimit)\n ) {\n return validLabels;\n }\n\n validLabels.push({\n a: record.a,\n l: label,\n t: record.t,\n u: record.u,\n });\n return validLabels;\n }, []);\n};\n"],"mappings":";;;;;;;;AAMO,IAAM,qCACX;AASK,IAAM,wBAAwB;AAM9B,IAAM,sBAAsB,CACjC,OACA,cAAc,uCACM;AACpB,SAAO,mBAAmB,OAAO,WAAW;AAC9C;AAEO,IAAM,wBAAwB,CACnC,OACA,cAAc,uCACW;AACzB,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,MAAM,OAA6B,CAAC,aAAa,SAAS;AAC/D,QAAI,CAAC,QAAQ,OAAO,SAAS,UAAU;AACrC,aAAO;AAAA,IACT;AAEA,UAAM,SAAS;AACf,UAAM,QAAQ,sBAAsB,OAAO,CAAC;AAE5C,QACE,OAAO,OAAO,MAAM,YACpB,CAAC,OAAO,KACR,OAAO,OAAO,MAAM,YACpB,CAAC,OAAO,SAAS,OAAO,CAAC,KACzB,OAAO,OAAO,MAAM,YACpB,CAAC,OAAO,SAAS,OAAO,CAAC,KACzB,CAAC,oBAAoB,OAAO,WAAW,GACvC;AACA,aAAO;AAAA,IACT;AAEA,gBAAY,KAAK;AAAA,MACf,GAAG,OAAO;AAAA,MACV,GAAG;AAAA,MACH,GAAG,OAAO;AAAA,MACV,GAAG,OAAO;AAAA,IACZ,CAAC;AACD,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACP;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDecodeFunctionError
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-JXWR65HE.js";
|
|
4
4
|
import "../../chunk-XHSYE74K.js";
|
|
5
|
-
import "../../chunk-OH6PXF7K.js";
|
|
6
5
|
import "../../chunk-3ICCM4IY.js";
|
|
6
|
+
import "../../chunk-OH6PXF7K.js";
|
|
7
7
|
import "../../chunk-6ZBEHPM3.js";
|
|
8
8
|
import "../../chunk-CGDNDBBP.js";
|
|
9
9
|
import "../../chunk-S6O6Q2GQ.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT = 20;
|
|
2
|
+
declare const normalizePrivateText: (value: unknown) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Private profile fields are rendered as text. Keep persisted and imported
|
|
5
|
+
* values within the same plain-text policy used by form validation.
|
|
6
|
+
*/
|
|
7
|
+
declare const isValidPrivateText: (value: unknown, lengthLimit?: number) => value is string;
|
|
8
|
+
|
|
9
|
+
export { DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT, isValidPrivateText, normalizePrivateText };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT,
|
|
3
|
+
isValidPrivateText,
|
|
4
|
+
normalizePrivateText
|
|
5
|
+
} from "../chunk-7IYCCOGO.js";
|
|
6
|
+
import "../chunk-WQG2LZMB.js";
|
|
7
|
+
export {
|
|
8
|
+
DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT,
|
|
9
|
+
isValidPrivateText,
|
|
10
|
+
normalizePrivateText
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=privateText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const DEFAULT_TX_NOTE_LENGTH_LIMIT = 20;
|
|
2
|
+
interface TxNoteRecord {
|
|
3
|
+
h: string;
|
|
4
|
+
n: string;
|
|
5
|
+
t: number;
|
|
6
|
+
u: number;
|
|
7
|
+
}
|
|
8
|
+
declare const normalizeTxNote: (value: unknown) => string;
|
|
9
|
+
declare const isValidTxNote: (value: unknown, lengthLimit?: number) => value is string;
|
|
10
|
+
declare const sanitizeTxNotes: (value: unknown, lengthLimit?: number) => TxNoteRecord[];
|
|
11
|
+
|
|
12
|
+
export { DEFAULT_TX_NOTE_LENGTH_LIMIT, TxNoteRecord, isValidTxNote, normalizeTxNote, sanitizeTxNotes };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT,
|
|
3
|
+
isValidPrivateText,
|
|
4
|
+
normalizePrivateText
|
|
5
|
+
} from "../chunk-7IYCCOGO.js";
|
|
6
|
+
import "../chunk-WQG2LZMB.js";
|
|
7
|
+
|
|
8
|
+
// src/utils/txNote.ts
|
|
9
|
+
var DEFAULT_TX_NOTE_LENGTH_LIMIT = DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT;
|
|
10
|
+
var TRANSACTION_HASH_PATTERN = /^0x[0-9a-fA-F]{64}$/;
|
|
11
|
+
var normalizeTxNote = normalizePrivateText;
|
|
12
|
+
var isValidTxNote = (value, lengthLimit = DEFAULT_TX_NOTE_LENGTH_LIMIT) => isValidPrivateText(value, lengthLimit);
|
|
13
|
+
var sanitizeTxNotes = (value, lengthLimit = DEFAULT_TX_NOTE_LENGTH_LIMIT) => {
|
|
14
|
+
if (!Array.isArray(value)) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
return value.reduce((validNotes, item) => {
|
|
18
|
+
if (!item || typeof item !== "object") {
|
|
19
|
+
return validNotes;
|
|
20
|
+
}
|
|
21
|
+
const record = item;
|
|
22
|
+
const note = normalizeTxNote(record.n);
|
|
23
|
+
if (typeof record.h !== "string" || !TRANSACTION_HASH_PATTERN.test(record.h) || typeof record.t !== "number" || !Number.isFinite(record.t) || typeof record.u !== "number" || !Number.isFinite(record.u) || !isValidTxNote(note, lengthLimit)) {
|
|
24
|
+
return validNotes;
|
|
25
|
+
}
|
|
26
|
+
validNotes.push({
|
|
27
|
+
h: record.h,
|
|
28
|
+
n: note,
|
|
29
|
+
t: record.t,
|
|
30
|
+
u: record.u
|
|
31
|
+
});
|
|
32
|
+
return validNotes;
|
|
33
|
+
}, []);
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
DEFAULT_TX_NOTE_LENGTH_LIMIT,
|
|
37
|
+
isValidTxNote,
|
|
38
|
+
normalizeTxNote,
|
|
39
|
+
sanitizeTxNotes
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=txNote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/txNote.ts"],"sourcesContent":["import {\n DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT,\n isValidPrivateText,\n normalizePrivateText,\n} from './privateText';\n\nexport const DEFAULT_TX_NOTE_LENGTH_LIMIT = DEFAULT_PRIVATE_TEXT_LENGTH_LIMIT;\n\nconst TRANSACTION_HASH_PATTERN = /^0x[0-9a-fA-F]{64}$/;\n\nexport interface TxNoteRecord {\n h: string;\n n: string;\n t: number;\n u: number;\n}\n\nexport const normalizeTxNote = normalizePrivateText;\n\nexport const isValidTxNote = (\n value: unknown,\n lengthLimit = DEFAULT_TX_NOTE_LENGTH_LIMIT,\n): value is string => isValidPrivateText(value, lengthLimit);\n\nexport const sanitizeTxNotes = (\n value: unknown,\n lengthLimit = DEFAULT_TX_NOTE_LENGTH_LIMIT,\n): TxNoteRecord[] => {\n if (!Array.isArray(value)) {\n return [];\n }\n\n return value.reduce<TxNoteRecord[]>((validNotes, item) => {\n if (!item || typeof item !== 'object') {\n return validNotes;\n }\n\n const record = item as Partial<TxNoteRecord>;\n const note = normalizeTxNote(record.n);\n\n if (\n typeof record.h !== 'string' ||\n !TRANSACTION_HASH_PATTERN.test(record.h) ||\n typeof record.t !== 'number' ||\n !Number.isFinite(record.t) ||\n typeof record.u !== 'number' ||\n !Number.isFinite(record.u) ||\n !isValidTxNote(note, lengthLimit)\n ) {\n return validNotes;\n }\n\n validNotes.push({\n h: record.h,\n n: note,\n t: record.t,\n u: record.u,\n });\n return validNotes;\n }, []);\n};\n"],"mappings":";;;;;;;;AAMO,IAAM,+BAA+B;AAE5C,IAAM,2BAA2B;AAS1B,IAAM,kBAAkB;AAExB,IAAM,gBAAgB,CAC3B,OACA,cAAc,iCACM,mBAAmB,OAAO,WAAW;AAEpD,IAAM,kBAAkB,CAC7B,OACA,cAAc,iCACK;AACnB,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,MAAM,OAAuB,CAAC,YAAY,SAAS;AACxD,QAAI,CAAC,QAAQ,OAAO,SAAS,UAAU;AACrC,aAAO;AAAA,IACT;AAEA,UAAM,SAAS;AACf,UAAM,OAAO,gBAAgB,OAAO,CAAC;AAErC,QACE,OAAO,OAAO,MAAM,YACpB,CAAC,yBAAyB,KAAK,OAAO,CAAC,KACvC,OAAO,OAAO,MAAM,YACpB,CAAC,OAAO,SAAS,OAAO,CAAC,KACzB,OAAO,OAAO,MAAM,YACpB,CAAC,OAAO,SAAS,OAAO,CAAC,KACzB,CAAC,cAAc,MAAM,WAAW,GAChC;AACA,aAAO;AAAA,IACT;AAEA,eAAW,KAAK;AAAA,MACd,GAAG,OAAO;AAAA,MACV,GAAG;AAAA,MACH,GAAG,OAAO;AAAA,MACV,GAAG,OAAO;AAAA,IACZ,CAAC;AACD,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACP;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfxjs/sirius-next-common",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**"
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"unocss": "0.58.6",
|
|
83
83
|
"vitest": "3.2.3",
|
|
84
84
|
"@cfxjs/sirius-next-eslint-config": "0.0.0",
|
|
85
|
-
"@cfxjs/sirius-next-
|
|
86
|
-
"@cfxjs/sirius-next-
|
|
85
|
+
"@cfxjs/sirius-next-typescript-config": "0.0.0",
|
|
86
|
+
"@cfxjs/sirius-next-i18n": "0.3.3"
|
|
87
87
|
},
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|