@aigne/afs-ocap 1.12.0-beta.5
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/LICENSE.md +26 -0
- package/README.md +144 -0
- package/aup/accounts/default.json +64 -0
- package/aup/accounts/item.json +510 -0
- package/aup/assets/default.json +70 -0
- package/aup/assets/item.json +360 -0
- package/aup/bridges/_addr/blocks/item.json +168 -0
- package/aup/bridges/default.json +79 -0
- package/aup/bridges/item.json +868 -0
- package/aup/config/default.json +806 -0
- package/aup/default.json +387 -0
- package/aup/delegates/default.json +71 -0
- package/aup/delegates/item.json +241 -0
- package/aup/factories/default.json +78 -0
- package/aup/factories/item.json +310 -0
- package/aup/stakes/default.json +76 -0
- package/aup/stakes/item.json +374 -0
- package/aup/tokens/default.json +76 -0
- package/aup/tokens/item.json +384 -0
- package/aup/transactions/default.json +102 -0
- package/aup/transactions/item.json +286 -0
- package/aup/validators/default.json +57 -0
- package/aup/validators/item.json +99 -0
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs +10 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +4 -0
- package/dist/method-colors.cjs +137 -0
- package/dist/method-colors.mjs +136 -0
- package/dist/method-colors.mjs.map +1 -0
- package/dist/provider.cjs +2490 -0
- package/dist/provider.d.cts +453 -0
- package/dist/provider.d.cts.map +1 -0
- package/dist/provider.d.mts +453 -0
- package/dist/provider.d.mts.map +1 -0
- package/dist/provider.mjs +2490 -0
- package/dist/provider.mjs.map +1 -0
- package/dist/remote-source.cjs +338 -0
- package/dist/remote-source.d.cts +62 -0
- package/dist/remote-source.d.cts.map +1 -0
- package/dist/remote-source.d.mts +62 -0
- package/dist/remote-source.d.mts.map +1 -0
- package/dist/remote-source.mjs +339 -0
- package/dist/remote-source.mjs.map +1 -0
- package/dist/source.d.cts +77 -0
- package/dist/source.d.cts.map +1 -0
- package/dist/source.d.mts +77 -0
- package/dist/source.d.mts.map +1 -0
- package/dist/types.d.cts +572 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +572 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/utils.cjs +581 -0
- package/dist/utils.mjs +557 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
//#region src/method-colors.ts
|
|
2
|
+
/**
|
|
3
|
+
* OCAP-native tx group palette — verbatim mirror of the legacy block-explorer
|
|
4
|
+
* (`blocklet/block-explorer/src/tx/tx-types.js`).
|
|
5
|
+
*
|
|
6
|
+
* Lives in the OCAP provider (not the UI provider) so chain-specific
|
|
7
|
+
* protocol knowledge stays scoped to the chain provider. The provider
|
|
8
|
+
* injects `_methodGroup` + `_methodColor` on every tx entry's content;
|
|
9
|
+
* the UI's generic `colored-badge` formatter then reads the per-row color
|
|
10
|
+
* pair without owning any chain knowledge.
|
|
11
|
+
*
|
|
12
|
+
* Any time the legacy palette changes upstream, update this file AND the
|
|
13
|
+
* paired `test/method-colors.test.ts` lock-step — those tests are the
|
|
14
|
+
* "no visual downgrade" gate.
|
|
15
|
+
*/
|
|
16
|
+
/** Group → upstream-canonical PascalCase tx types (verbatim). */
|
|
17
|
+
const METHOD_GROUPS = {
|
|
18
|
+
account: [
|
|
19
|
+
"AccountMigrate",
|
|
20
|
+
"Declare",
|
|
21
|
+
"Delegate",
|
|
22
|
+
"RevokeDelegate"
|
|
23
|
+
],
|
|
24
|
+
asset: [
|
|
25
|
+
"AcquireAssetV2",
|
|
26
|
+
"AcquireAssetV3",
|
|
27
|
+
"CreateAsset",
|
|
28
|
+
"MintAsset",
|
|
29
|
+
"UpdateAsset",
|
|
30
|
+
"ConsumeAsset"
|
|
31
|
+
],
|
|
32
|
+
factory: ["CreateFactory"],
|
|
33
|
+
governance: [
|
|
34
|
+
"ClaimStake",
|
|
35
|
+
"RevokeStake",
|
|
36
|
+
"SlashStake",
|
|
37
|
+
"ReturnStake",
|
|
38
|
+
"Stake"
|
|
39
|
+
],
|
|
40
|
+
bridge: [
|
|
41
|
+
"ClaimBlockReward",
|
|
42
|
+
"CreateRollup",
|
|
43
|
+
"CreateRollupBlock",
|
|
44
|
+
"JoinRollup",
|
|
45
|
+
"LeaveRollup",
|
|
46
|
+
"PauseRollup",
|
|
47
|
+
"ResumeRollup",
|
|
48
|
+
"UpdateRollup",
|
|
49
|
+
"CloseRollup",
|
|
50
|
+
"MigrateRollup",
|
|
51
|
+
"MigrateRollupContract",
|
|
52
|
+
"MigrateRollupToken"
|
|
53
|
+
],
|
|
54
|
+
token: [
|
|
55
|
+
"CreateToken",
|
|
56
|
+
"DepositTokenV2",
|
|
57
|
+
"WithdrawTokenV2",
|
|
58
|
+
"MintToken",
|
|
59
|
+
"BurnToken",
|
|
60
|
+
"CreateTokenFactory",
|
|
61
|
+
"UpdateTokenFactory"
|
|
62
|
+
],
|
|
63
|
+
trade: [
|
|
64
|
+
"ExchangeV2",
|
|
65
|
+
"Transfer",
|
|
66
|
+
"TransferV2",
|
|
67
|
+
"TransferV3"
|
|
68
|
+
]
|
|
69
|
+
};
|
|
70
|
+
/** Group → main+light hex pair (verbatim from block-explorer txColors). */
|
|
71
|
+
const METHOD_GROUP_COLORS = {
|
|
72
|
+
trade: {
|
|
73
|
+
main: "#006fee",
|
|
74
|
+
light: "#F0F7FF"
|
|
75
|
+
},
|
|
76
|
+
governance: {
|
|
77
|
+
main: "#FE9344",
|
|
78
|
+
light: "#FFF7F0"
|
|
79
|
+
},
|
|
80
|
+
bridge: {
|
|
81
|
+
main: "#8C6AFC",
|
|
82
|
+
light: "#F6F2FF"
|
|
83
|
+
},
|
|
84
|
+
asset: {
|
|
85
|
+
main: "#5D8BB4",
|
|
86
|
+
light: "#F0F8FF"
|
|
87
|
+
},
|
|
88
|
+
token: {
|
|
89
|
+
main: "#5D8BB4",
|
|
90
|
+
light: "#F0F8FF"
|
|
91
|
+
},
|
|
92
|
+
factory: {
|
|
93
|
+
main: "#5D8BB4",
|
|
94
|
+
light: "#F0F8FF"
|
|
95
|
+
},
|
|
96
|
+
account: {
|
|
97
|
+
main: "#1DC1C7",
|
|
98
|
+
light: "#F0FDFF"
|
|
99
|
+
},
|
|
100
|
+
default: {
|
|
101
|
+
main: "#2482F6",
|
|
102
|
+
light: "#F0F7FF"
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Build a flat lookup that accepts both upstream PascalCase keys ("TransferV3")
|
|
107
|
+
* AND OCAP snake_case keys ("transfer_v3"). OCAP returns the snake form via
|
|
108
|
+
* `content.type`, but the upstream mapping was authored against PascalCase, so
|
|
109
|
+
* we normalize on input and on construction.
|
|
110
|
+
*/
|
|
111
|
+
function buildTypeToGroup() {
|
|
112
|
+
const out = {};
|
|
113
|
+
for (const [group, types] of Object.entries(METHOD_GROUPS)) for (const t of types) {
|
|
114
|
+
out[t] = group;
|
|
115
|
+
out[t.toLowerCase()] = group;
|
|
116
|
+
const snake = t.replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").replace(/([a-z\d])([A-Z])/g, "$1_$2").toLowerCase();
|
|
117
|
+
out[snake] = group;
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
const TYPE_TO_GROUP = buildTypeToGroup();
|
|
122
|
+
/** Returns the group name for a tx type, or "default" if unknown. */
|
|
123
|
+
function getTxGroup(type) {
|
|
124
|
+
if (!type) return "default";
|
|
125
|
+
const direct = TYPE_TO_GROUP[type];
|
|
126
|
+
if (direct) return direct;
|
|
127
|
+
return TYPE_TO_GROUP[type.toLowerCase()] ?? "default";
|
|
128
|
+
}
|
|
129
|
+
/** Returns the {main, light} color pair for a tx type. */
|
|
130
|
+
function getTxColor(type) {
|
|
131
|
+
return METHOD_GROUP_COLORS[getTxGroup(type)] ?? METHOD_GROUP_COLORS.default;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
//#endregion
|
|
135
|
+
export { getTxColor, getTxGroup };
|
|
136
|
+
//# sourceMappingURL=method-colors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method-colors.mjs","names":[],"sources":["../src/method-colors.ts"],"sourcesContent":["/**\n * OCAP-native tx group palette — verbatim mirror of the legacy block-explorer\n * (`blocklet/block-explorer/src/tx/tx-types.js`).\n *\n * Lives in the OCAP provider (not the UI provider) so chain-specific\n * protocol knowledge stays scoped to the chain provider. The provider\n * injects `_methodGroup` + `_methodColor` on every tx entry's content;\n * the UI's generic `colored-badge` formatter then reads the per-row color\n * pair without owning any chain knowledge.\n *\n * Any time the legacy palette changes upstream, update this file AND the\n * paired `test/method-colors.test.ts` lock-step — those tests are the\n * \"no visual downgrade\" gate.\n */\n\n/** Group → upstream-canonical PascalCase tx types (verbatim). */\nexport const METHOD_GROUPS: Readonly<Record<string, readonly string[]>> = {\n account: [\"AccountMigrate\", \"Declare\", \"Delegate\", \"RevokeDelegate\"],\n asset: [\n \"AcquireAssetV2\",\n \"AcquireAssetV3\",\n \"CreateAsset\",\n \"MintAsset\",\n \"UpdateAsset\",\n \"ConsumeAsset\",\n ],\n factory: [\"CreateFactory\"],\n governance: [\"ClaimStake\", \"RevokeStake\", \"SlashStake\", \"ReturnStake\", \"Stake\"],\n bridge: [\n \"ClaimBlockReward\",\n \"CreateRollup\",\n \"CreateRollupBlock\",\n \"JoinRollup\",\n \"LeaveRollup\",\n \"PauseRollup\",\n \"ResumeRollup\",\n \"UpdateRollup\",\n \"CloseRollup\",\n \"MigrateRollup\",\n \"MigrateRollupContract\",\n \"MigrateRollupToken\",\n ],\n token: [\n \"CreateToken\",\n \"DepositTokenV2\",\n \"WithdrawTokenV2\",\n \"MintToken\",\n \"BurnToken\",\n \"CreateTokenFactory\",\n \"UpdateTokenFactory\",\n ],\n trade: [\"ExchangeV2\", \"Transfer\", \"TransferV2\", \"TransferV3\"],\n};\n\n/** Group → main+light hex pair (verbatim from block-explorer txColors). */\nexport const METHOD_GROUP_COLORS: Readonly<Record<string, { main: string; light: string }>> = {\n trade: { main: \"#006fee\", light: \"#F0F7FF\" },\n governance: { main: \"#FE9344\", light: \"#FFF7F0\" },\n bridge: { main: \"#8C6AFC\", light: \"#F6F2FF\" },\n asset: { main: \"#5D8BB4\", light: \"#F0F8FF\" },\n token: { main: \"#5D8BB4\", light: \"#F0F8FF\" },\n factory: { main: \"#5D8BB4\", light: \"#F0F8FF\" },\n account: { main: \"#1DC1C7\", light: \"#F0FDFF\" },\n default: { main: \"#2482F6\", light: \"#F0F7FF\" },\n};\n\n/**\n * Build a flat lookup that accepts both upstream PascalCase keys (\"TransferV3\")\n * AND OCAP snake_case keys (\"transfer_v3\"). OCAP returns the snake form via\n * `content.type`, but the upstream mapping was authored against PascalCase, so\n * we normalize on input and on construction.\n */\nfunction buildTypeToGroup(): Record<string, string> {\n const out: Record<string, string> = {};\n for (const [group, types] of Object.entries(METHOD_GROUPS)) {\n for (const t of types) {\n out[t] = group;\n out[t.toLowerCase()] = group;\n // Convert TransferV3 → transfer_v3 for snake-case lookup\n const snake = t\n .replace(/([A-Z])([A-Z][a-z])/g, \"$1_$2\")\n .replace(/([a-z\\d])([A-Z])/g, \"$1_$2\")\n .toLowerCase();\n out[snake] = group;\n }\n }\n return out;\n}\n\nexport const TYPE_TO_GROUP: Readonly<Record<string, string>> = buildTypeToGroup();\n\n/** Returns the group name for a tx type, or \"default\" if unknown. */\nexport function getTxGroup(type: string | null | undefined): string {\n if (!type) return \"default\";\n const direct = TYPE_TO_GROUP[type];\n if (direct) return direct;\n const lower = TYPE_TO_GROUP[type.toLowerCase()];\n return lower ?? \"default\";\n}\n\n/** Returns the {main, light} color pair for a tx type. */\nexport function getTxColor(type: string | null | undefined): { main: string; light: string } {\n return METHOD_GROUP_COLORS[getTxGroup(type)] ?? METHOD_GROUP_COLORS.default!;\n}\n"],"mappings":";;;;;;;;;;;;;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