@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.
Files changed (58) hide show
  1. package/LICENSE.md +26 -0
  2. package/README.md +144 -0
  3. package/aup/accounts/default.json +64 -0
  4. package/aup/accounts/item.json +510 -0
  5. package/aup/assets/default.json +70 -0
  6. package/aup/assets/item.json +360 -0
  7. package/aup/bridges/_addr/blocks/item.json +168 -0
  8. package/aup/bridges/default.json +79 -0
  9. package/aup/bridges/item.json +868 -0
  10. package/aup/config/default.json +806 -0
  11. package/aup/default.json +387 -0
  12. package/aup/delegates/default.json +71 -0
  13. package/aup/delegates/item.json +241 -0
  14. package/aup/factories/default.json +78 -0
  15. package/aup/factories/item.json +310 -0
  16. package/aup/stakes/default.json +76 -0
  17. package/aup/stakes/item.json +374 -0
  18. package/aup/tokens/default.json +76 -0
  19. package/aup/tokens/item.json +384 -0
  20. package/aup/transactions/default.json +102 -0
  21. package/aup/transactions/item.json +286 -0
  22. package/aup/validators/default.json +57 -0
  23. package/aup/validators/item.json +99 -0
  24. package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.cjs +11 -0
  25. package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs +10 -0
  26. package/dist/index.cjs +7 -0
  27. package/dist/index.d.cts +5 -0
  28. package/dist/index.d.mts +5 -0
  29. package/dist/index.mjs +4 -0
  30. package/dist/method-colors.cjs +137 -0
  31. package/dist/method-colors.mjs +136 -0
  32. package/dist/method-colors.mjs.map +1 -0
  33. package/dist/provider.cjs +2490 -0
  34. package/dist/provider.d.cts +453 -0
  35. package/dist/provider.d.cts.map +1 -0
  36. package/dist/provider.d.mts +453 -0
  37. package/dist/provider.d.mts.map +1 -0
  38. package/dist/provider.mjs +2490 -0
  39. package/dist/provider.mjs.map +1 -0
  40. package/dist/remote-source.cjs +338 -0
  41. package/dist/remote-source.d.cts +62 -0
  42. package/dist/remote-source.d.cts.map +1 -0
  43. package/dist/remote-source.d.mts +62 -0
  44. package/dist/remote-source.d.mts.map +1 -0
  45. package/dist/remote-source.mjs +339 -0
  46. package/dist/remote-source.mjs.map +1 -0
  47. package/dist/source.d.cts +77 -0
  48. package/dist/source.d.cts.map +1 -0
  49. package/dist/source.d.mts +77 -0
  50. package/dist/source.d.mts.map +1 -0
  51. package/dist/types.d.cts +572 -0
  52. package/dist/types.d.cts.map +1 -0
  53. package/dist/types.d.mts +572 -0
  54. package/dist/types.d.mts.map +1 -0
  55. package/dist/utils.cjs +581 -0
  56. package/dist/utils.mjs +557 -0
  57. package/dist/utils.mjs.map +1 -0
  58. package/package.json +61 -0
@@ -0,0 +1,286 @@
1
+ {
2
+ "id": "tx-detail",
3
+ "type": "view",
4
+ "props": {
5
+ "layout": { "direction": "column", "gap": "md" },
6
+ "animate": "slide-up",
7
+ "style": { "padding": "16px 24px" }
8
+ },
9
+ "children": [
10
+ {
11
+ "id": "tx-header",
12
+ "type": "view",
13
+ "props": {
14
+ "layout": { "direction": "row", "gap": "md", "crossAlign": "center" }
15
+ },
16
+ "children": [
17
+ {
18
+ "id": "tx-avatar",
19
+ "type": "media",
20
+ "props": {
21
+ "type": "avatar",
22
+ "variant": "did-motif",
23
+ "seed": "${content.hash}",
24
+ "size": 56
25
+ }
26
+ },
27
+ {
28
+ "id": "tx-title-block",
29
+ "type": "view",
30
+ "props": { "layout": { "direction": "column", "gap": "xs", "crossAlign": "start" } },
31
+ "children": [
32
+ {
33
+ "id": "tx-type",
34
+ "type": "text",
35
+ "props": {
36
+ "content": "${content._typeName|default:Transaction}",
37
+ "level": 2
38
+ }
39
+ },
40
+ {
41
+ "id": "tx-meta",
42
+ "type": "view",
43
+ "props": {
44
+ "layout": { "direction": "row", "gap": "sm", "crossAlign": "center" }
45
+ },
46
+ "children": [
47
+ {
48
+ "id": "tx-status",
49
+ "type": "text",
50
+ "props": {
51
+ "content": "${content._statusLabel|default:Success}",
52
+ "intent": "${content._statusIntent|default:success}",
53
+ "variant": "badge"
54
+ }
55
+ },
56
+ {
57
+ "id": "tx-time-rel",
58
+ "type": "time",
59
+ "props": {
60
+ "mode": "display",
61
+ "value": "${content.time}",
62
+ "timeMode": "both"
63
+ }
64
+ }
65
+ ]
66
+ }
67
+ ]
68
+ }
69
+ ]
70
+ },
71
+ {
72
+ "id": "tx-overview",
73
+ "type": "entity-overview",
74
+ "props": {
75
+ "layout": "2",
76
+ "data": "${content}",
77
+ "cards": [
78
+ {
79
+ "id": "tx-card-details",
80
+ "title": "Details",
81
+ "fields": [
82
+ {
83
+ "key": "hash",
84
+ "label": "Transaction Hash",
85
+ "format": "did",
86
+ "tooltip": "Unique 32-byte SHA hash of this transaction. Click to copy."
87
+ },
88
+ {
89
+ "key": "_typeName",
90
+ "label": "Type",
91
+ "tooltip": "OCAP transaction type (Transfer V3 / Declare / Stake / etc.). Determines which fields appear below."
92
+ },
93
+ {
94
+ "key": "sender",
95
+ "label": "Sender",
96
+ "format": "did",
97
+ "navigateTo": "accounts/{value}",
98
+ "tooltip": "DID of the account that signed and submitted this transaction."
99
+ },
100
+ {
101
+ "key": "_resolvedReceiver",
102
+ "label": "Receiver",
103
+ "format": "did",
104
+ "navigateTo": "accounts/{value}",
105
+ "hideWhenEmpty": true,
106
+ "tooltip": "DID of the receiving party. Null for txs without a single counterparty (declare / stake)."
107
+ },
108
+ {
109
+ "key": "time",
110
+ "label": "Time",
111
+ "format": "datetime",
112
+ "interactive": true,
113
+ "tooltip": "Block timestamp when this transaction was indexed. Click to switch between UTC, Local time, and Unix Timestamp."
114
+ },
115
+ {
116
+ "key": "_nonce",
117
+ "label": "Nonce",
118
+ "hideWhenEmpty": true,
119
+ "tooltip": "Sender's per-account counter, prevents replay. Strictly increasing."
120
+ },
121
+ {
122
+ "key": "_gasFeeRaw",
123
+ "label": "Gas Fee",
124
+ "format": "bignum:18",
125
+ "symbol": "ABT",
126
+ "strikethrough": "${content._gasExempted}",
127
+ "caption": "${content._gasExemptedNote}",
128
+ "tooltip": "Quoted gas cost in ABT. Strikethrough means the chain waived the fee — sender qualifies for the staking exemption."
129
+ },
130
+ {
131
+ "key": "_serviceFeeDisplay",
132
+ "label": "Service Fee",
133
+ "tooltip": "Optional ABT paid to a third-party app for tx-related services. \"Free\" means none was charged."
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ "id": "tx-card-type-info",
139
+ "title": "Type Info",
140
+ "hideWhenEmpty": true,
141
+ "fields": [
142
+ {
143
+ "key": "_itxAddress",
144
+ "label": "${content._typeContext.addressLabel}",
145
+ "format": "did",
146
+ "navigateTo": "${content._typeContext.addressPath}",
147
+ "hideWhenEmpty": true,
148
+ "tooltip": "DID of the on-chain object this tx operates on. The label and link target adapt to the tx type (Token / Asset / Stake / Account / Factory)."
149
+ },
150
+ {
151
+ "key": "_itxMoniker",
152
+ "label": "${content._typeContext.monikerLabel}",
153
+ "hideWhenEmpty": true,
154
+ "tooltip": "Human-readable name carried in the inner tx — typically the moniker the issuer gave the new token, asset, or factory."
155
+ },
156
+ {
157
+ "key": "_itxFactory",
158
+ "label": "${content._typeContext.factoryLabel}",
159
+ "format": "did",
160
+ "navigateTo": "factories/{value}",
161
+ "hideWhenEmpty": true,
162
+ "tooltip": "Factory contract that the inner tx targets — for asset txs this is the NFT factory, for token txs the token factory."
163
+ },
164
+ {
165
+ "key": "_itxTokenFactory",
166
+ "label": "Token Factory",
167
+ "format": "did",
168
+ "navigateTo": "factories/{value}",
169
+ "hideWhenEmpty": true,
170
+ "tooltip": "Bonding-curve token factory address — present on mint / burn / deposit / withdraw token txs."
171
+ },
172
+ {
173
+ "key": "_itxRollup",
174
+ "label": "${content._typeContext.rollupLabel}",
175
+ "format": "did",
176
+ "navigateTo": "bridges/{value}",
177
+ "hideWhenEmpty": true,
178
+ "tooltip": "Bridge contract this tx interacts with."
179
+ },
180
+ {
181
+ "key": "_itxBlockHash",
182
+ "label": "${content._typeContext.blockHashLabel}",
183
+ "format": "did",
184
+ "hideWhenEmpty": true,
185
+ "tooltip": "Inner-tx block reference — for publish-bridge-block txs this is the bridge-side block hash, NOT this tx's parent block."
186
+ },
187
+ {
188
+ "key": "_itxBlockHeight",
189
+ "label": "${content._typeContext.blockHeightLabel}",
190
+ "format": "number",
191
+ "hideWhenEmpty": true,
192
+ "tooltip": "Inner-tx block height — for publish-bridge-block txs this is the bridge-side block height, NOT this tx's parent block height."
193
+ }
194
+ ]
195
+ }
196
+ ]
197
+ }
198
+ },
199
+ {
200
+ "id": "tx-tabs",
201
+ "type": "view",
202
+ "props": {
203
+ "mode": "tabs",
204
+ "layout": { "direction": "column", "gap": "sm" }
205
+ },
206
+ "children": [
207
+ {
208
+ "id": "tx-tab-receipts",
209
+ "type": "view",
210
+ "props": {
211
+ "mode": "card",
212
+ "tabLabel": "Receipts",
213
+ "tabIcon": "clipboard-check",
214
+ "layout": { "direction": "column", "gap": "xs" }
215
+ },
216
+ "children": [
217
+ {
218
+ "id": "tx-tab-receipts-list",
219
+ "type": "afs-list",
220
+ "src": "${_parentPath}/receipts",
221
+ "props": {
222
+ "layout": "table",
223
+ "columns": [
224
+ {
225
+ "key": "content.account",
226
+ "label": "Account",
227
+ "format": "did",
228
+ "navigateTo": "accounts/{value}",
229
+ "width": "200px"
230
+ },
231
+ { "key": "content.action", "label": "Action", "width": "100px" },
232
+ {
233
+ "key": "content.symbol",
234
+ "label": "Token",
235
+ "width": "80px",
236
+ "navigateTo": "tokens/{value}",
237
+ "linkValueKey": "content._tokenLink"
238
+ },
239
+ { "key": "content.valueFormatted", "label": "Amount" }
240
+ ],
241
+ "showBreadcrumb": false,
242
+ "pagination": "manual",
243
+ "pageSize": 20,
244
+ "autoSelect": false,
245
+ "filter": { "exclude": ".." }
246
+ }
247
+ }
248
+ ]
249
+ },
250
+ {
251
+ "id": "tx-tab-raw",
252
+ "type": "view",
253
+ "props": {
254
+ "mode": "card",
255
+ "tabLabel": "Raw",
256
+ "tabIcon": "code-2",
257
+ "layout": { "direction": "column", "gap": "xs" }
258
+ },
259
+ "children": [
260
+ {
261
+ "id": "tx-raw-kv",
262
+ "type": "key-value-list",
263
+ "props": {
264
+ "data": "${content}",
265
+ "fields": [
266
+ {
267
+ "key": "tx",
268
+ "label": "tx (envelope)",
269
+ "format": "json",
270
+ "tooltip": "Outer transaction envelope — sender, signature, gas, nonce"
271
+ },
272
+ {
273
+ "key": "_itxJson",
274
+ "label": "itx (inner tx payload)",
275
+ "format": "json",
276
+ "tooltip": "Decoded inner-transaction payload — type-specific fields"
277
+ }
278
+ ]
279
+ }
280
+ }
281
+ ]
282
+ }
283
+ ]
284
+ }
285
+ ]
286
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "id": "validators-view",
3
+ "type": "view",
4
+ "props": {
5
+ "layout": {
6
+ "direction": "column",
7
+ "gap": "none"
8
+ },
9
+ "style": {
10
+ "flex": "1",
11
+ "overflow": "auto"
12
+ }
13
+ },
14
+ "children": [
15
+ {
16
+ "id": "validators-title",
17
+ "type": "text",
18
+ "props": { "content": "Validators", "level": 1 }
19
+ },
20
+ {
21
+ "id": "validators-view-list",
22
+ "type": "afs-list",
23
+ "src": "${_parentPath}",
24
+ "props": {
25
+ "layout": "table",
26
+ "columns": [
27
+ {
28
+ "key": "content.name",
29
+ "label": "Name",
30
+ "width": "180px"
31
+ },
32
+ {
33
+ "key": "content.address",
34
+ "label": "Address",
35
+ "format": "did",
36
+ "width": "200px"
37
+ },
38
+ {
39
+ "key": "content.votingPower",
40
+ "label": "Voting Power",
41
+ "format": "number",
42
+ "width": "120px",
43
+ "align": "right"
44
+ }
45
+ ],
46
+ "pageSize": 20,
47
+ "pagination": "manual",
48
+ "clickMode": "both",
49
+ "autoSelect": false,
50
+ "filter": {
51
+ "exclude": ".."
52
+ },
53
+ "showBreadcrumb": false
54
+ }
55
+ }
56
+ ]
57
+ }
@@ -0,0 +1,99 @@
1
+ {
2
+ "id": "validator-detail",
3
+ "type": "view",
4
+ "props": {
5
+ "layout": { "direction": "column", "gap": "md" },
6
+ "animate": "slide-up",
7
+ "style": { "padding": "16px 24px" }
8
+ },
9
+ "children": [
10
+ {
11
+ "id": "val-header",
12
+ "type": "view",
13
+ "props": {
14
+ "layout": { "direction": "row", "gap": "md", "crossAlign": "center" }
15
+ },
16
+ "children": [
17
+ {
18
+ "id": "val-avatar",
19
+ "type": "media",
20
+ "props": {
21
+ "type": "avatar",
22
+ "variant": "did-motif",
23
+ "seed": "${content.address}",
24
+ "size": 56
25
+ }
26
+ },
27
+ {
28
+ "id": "val-title-block",
29
+ "type": "view",
30
+ "props": { "layout": { "direction": "column", "gap": "xs", "crossAlign": "start" } },
31
+ "children": [
32
+ {
33
+ "id": "val-title",
34
+ "type": "text",
35
+ "props": {
36
+ "content": "${content.name|default:Validator}",
37
+ "level": 2
38
+ }
39
+ },
40
+ {
41
+ "id": "val-addr",
42
+ "type": "text",
43
+ "props": {
44
+ "content": "${content.address}",
45
+ "scale": "sm",
46
+ "format": "did"
47
+ }
48
+ }
49
+ ]
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "id": "val-overview",
55
+ "type": "entity-overview",
56
+ "props": {
57
+ "layout": "row",
58
+ "data": "${content}",
59
+ "cards": [
60
+ {
61
+ "id": "val-card-info",
62
+ "title": "Validator Info",
63
+ "fields": [
64
+ {
65
+ "key": "votingPower",
66
+ "label": "Voting Power",
67
+ "format": "number",
68
+ "tooltip": "Stake-weighted vote weight this validator carries in consensus rounds."
69
+ },
70
+ {
71
+ "key": "maxPeers",
72
+ "label": "Max Peers",
73
+ "format": "number",
74
+ "tooltip": "Maximum number of peers this validator will connect to."
75
+ },
76
+ {
77
+ "key": "pubKeyType",
78
+ "label": "Public Key Type",
79
+ "tooltip": "Cryptographic algorithm of the validator's signing key (ed25519 / secp256k1)."
80
+ },
81
+ {
82
+ "key": "proposerPriority",
83
+ "label": "Proposer Priority",
84
+ "format": "number",
85
+ "tooltip": "Tendermint scheduling priority. Increases when not selected, drops back when chosen as proposer."
86
+ },
87
+ {
88
+ "key": "geoInfo",
89
+ "label": "Geo",
90
+ "hideWhenEmpty": true,
91
+ "tooltip": "Approximate geographic location, when reported by the node operator."
92
+ }
93
+ ]
94
+ }
95
+ ]
96
+ }
97
+ }
98
+ ]
99
+ }
@@ -0,0 +1,11 @@
1
+
2
+ //#region \0@oxc-project+runtime@0.108.0/helpers/decorate.js
3
+ function __decorate(decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ }
9
+
10
+ //#endregion
11
+ exports.__decorate = __decorate;
@@ -0,0 +1,10 @@
1
+ //#region \0@oxc-project+runtime@0.108.0/helpers/decorate.js
2
+ function __decorate(decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ }
8
+
9
+ //#endregion
10
+ export { __decorate };
package/dist/index.cjs ADDED
@@ -0,0 +1,7 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ const require_remote_source = require('./remote-source.cjs');
3
+ const require_provider = require('./provider.cjs');
4
+
5
+ exports.AFSOCAP = require_provider.AFSOCAP;
6
+ exports.OcapRemoteSource = require_remote_source.OcapRemoteSource;
7
+ exports.default = require_provider;
@@ -0,0 +1,5 @@
1
+ import { OcapDataSource } from "./source.cjs";
2
+ import { AFSOCAPOptions, AccountFilters, AccountState, AccountToken, AssetFactoryState, AssetFilters, AssetState, BridgeFilters, ChainConfig, ChainInfo, DelegateOpEntry, DelegateState, DelegationFilters, FactoryFilters, ForeignTokenInfo, IndexedAccountState, IndexedAssetState, IndexedDelegationState, IndexedFactoryState, IndexedRollupBlock, IndexedRollupState, IndexedRollupValidator, IndexedStakeState, IndexedTokenFlow, IndexedTokenState, IndexedTransaction, PagedResult, Paging, RollupBlock, RollupBlockFilters, RollupState, RollupTokenInfo, SearchResult, StakeFilters, StakeState, TokenFilters, TokenFlowDirection, TokenState, TransactionInfo, TxFilters, ValidatorInfo, Validity } from "./types.cjs";
3
+ import { AFSOCAP } from "./provider.cjs";
4
+ import { OcapRemoteSource } from "./remote-source.cjs";
5
+ export { AFSOCAP, AFSOCAPOptions, AccountFilters, AccountState, AccountToken, AssetFactoryState, AssetFilters, AssetState, BridgeFilters, ChainConfig, ChainInfo, DelegateOpEntry, DelegateState, DelegationFilters, FactoryFilters, ForeignTokenInfo, IndexedAccountState, IndexedAssetState, IndexedDelegationState, IndexedFactoryState, IndexedRollupBlock, IndexedRollupState, IndexedRollupValidator, IndexedStakeState, IndexedTokenFlow, IndexedTokenState, IndexedTransaction, type OcapDataSource, OcapRemoteSource, PagedResult, Paging, RollupBlock, RollupBlockFilters, RollupState, RollupTokenInfo, SearchResult, StakeFilters, StakeState, TokenFilters, TokenFlowDirection, TokenState, TransactionInfo, TxFilters, ValidatorInfo, Validity, AFSOCAP as default };
@@ -0,0 +1,5 @@
1
+ import { OcapDataSource } from "./source.mjs";
2
+ import { AFSOCAPOptions, AccountFilters, AccountState, AccountToken, AssetFactoryState, AssetFilters, AssetState, BridgeFilters, ChainConfig, ChainInfo, DelegateOpEntry, DelegateState, DelegationFilters, FactoryFilters, ForeignTokenInfo, IndexedAccountState, IndexedAssetState, IndexedDelegationState, IndexedFactoryState, IndexedRollupBlock, IndexedRollupState, IndexedRollupValidator, IndexedStakeState, IndexedTokenFlow, IndexedTokenState, IndexedTransaction, PagedResult, Paging, RollupBlock, RollupBlockFilters, RollupState, RollupTokenInfo, SearchResult, StakeFilters, StakeState, TokenFilters, TokenFlowDirection, TokenState, TransactionInfo, TxFilters, ValidatorInfo, Validity } from "./types.mjs";
3
+ import { AFSOCAP } from "./provider.mjs";
4
+ import { OcapRemoteSource } from "./remote-source.mjs";
5
+ export { AFSOCAP, AFSOCAPOptions, AccountFilters, AccountState, AccountToken, AssetFactoryState, AssetFilters, AssetState, BridgeFilters, ChainConfig, ChainInfo, DelegateOpEntry, DelegateState, DelegationFilters, FactoryFilters, ForeignTokenInfo, IndexedAccountState, IndexedAssetState, IndexedDelegationState, IndexedFactoryState, IndexedRollupBlock, IndexedRollupState, IndexedRollupValidator, IndexedStakeState, IndexedTokenFlow, IndexedTokenState, IndexedTransaction, type OcapDataSource, OcapRemoteSource, PagedResult, Paging, RollupBlock, RollupBlockFilters, RollupState, RollupTokenInfo, SearchResult, StakeFilters, StakeState, TokenFilters, TokenFlowDirection, TokenState, TransactionInfo, TxFilters, ValidatorInfo, Validity, AFSOCAP as default };
package/dist/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import { OcapRemoteSource } from "./remote-source.mjs";
2
+ import provider_default, { AFSOCAP } from "./provider.mjs";
3
+
4
+ export { AFSOCAP, OcapRemoteSource, provider_default as default };
@@ -0,0 +1,137 @@
1
+
2
+ //#region src/method-colors.ts
3
+ /**
4
+ * OCAP-native tx group palette — verbatim mirror of the legacy block-explorer
5
+ * (`blocklet/block-explorer/src/tx/tx-types.js`).
6
+ *
7
+ * Lives in the OCAP provider (not the UI provider) so chain-specific
8
+ * protocol knowledge stays scoped to the chain provider. The provider
9
+ * injects `_methodGroup` + `_methodColor` on every tx entry's content;
10
+ * the UI's generic `colored-badge` formatter then reads the per-row color
11
+ * pair without owning any chain knowledge.
12
+ *
13
+ * Any time the legacy palette changes upstream, update this file AND the
14
+ * paired `test/method-colors.test.ts` lock-step — those tests are the
15
+ * "no visual downgrade" gate.
16
+ */
17
+ /** Group → upstream-canonical PascalCase tx types (verbatim). */
18
+ const METHOD_GROUPS = {
19
+ account: [
20
+ "AccountMigrate",
21
+ "Declare",
22
+ "Delegate",
23
+ "RevokeDelegate"
24
+ ],
25
+ asset: [
26
+ "AcquireAssetV2",
27
+ "AcquireAssetV3",
28
+ "CreateAsset",
29
+ "MintAsset",
30
+ "UpdateAsset",
31
+ "ConsumeAsset"
32
+ ],
33
+ factory: ["CreateFactory"],
34
+ governance: [
35
+ "ClaimStake",
36
+ "RevokeStake",
37
+ "SlashStake",
38
+ "ReturnStake",
39
+ "Stake"
40
+ ],
41
+ bridge: [
42
+ "ClaimBlockReward",
43
+ "CreateRollup",
44
+ "CreateRollupBlock",
45
+ "JoinRollup",
46
+ "LeaveRollup",
47
+ "PauseRollup",
48
+ "ResumeRollup",
49
+ "UpdateRollup",
50
+ "CloseRollup",
51
+ "MigrateRollup",
52
+ "MigrateRollupContract",
53
+ "MigrateRollupToken"
54
+ ],
55
+ token: [
56
+ "CreateToken",
57
+ "DepositTokenV2",
58
+ "WithdrawTokenV2",
59
+ "MintToken",
60
+ "BurnToken",
61
+ "CreateTokenFactory",
62
+ "UpdateTokenFactory"
63
+ ],
64
+ trade: [
65
+ "ExchangeV2",
66
+ "Transfer",
67
+ "TransferV2",
68
+ "TransferV3"
69
+ ]
70
+ };
71
+ /** Group → main+light hex pair (verbatim from block-explorer txColors). */
72
+ const METHOD_GROUP_COLORS = {
73
+ trade: {
74
+ main: "#006fee",
75
+ light: "#F0F7FF"
76
+ },
77
+ governance: {
78
+ main: "#FE9344",
79
+ light: "#FFF7F0"
80
+ },
81
+ bridge: {
82
+ main: "#8C6AFC",
83
+ light: "#F6F2FF"
84
+ },
85
+ asset: {
86
+ main: "#5D8BB4",
87
+ light: "#F0F8FF"
88
+ },
89
+ token: {
90
+ main: "#5D8BB4",
91
+ light: "#F0F8FF"
92
+ },
93
+ factory: {
94
+ main: "#5D8BB4",
95
+ light: "#F0F8FF"
96
+ },
97
+ account: {
98
+ main: "#1DC1C7",
99
+ light: "#F0FDFF"
100
+ },
101
+ default: {
102
+ main: "#2482F6",
103
+ light: "#F0F7FF"
104
+ }
105
+ };
106
+ /**
107
+ * Build a flat lookup that accepts both upstream PascalCase keys ("TransferV3")
108
+ * AND OCAP snake_case keys ("transfer_v3"). OCAP returns the snake form via
109
+ * `content.type`, but the upstream mapping was authored against PascalCase, so
110
+ * we normalize on input and on construction.
111
+ */
112
+ function buildTypeToGroup() {
113
+ const out = {};
114
+ for (const [group, types] of Object.entries(METHOD_GROUPS)) for (const t of types) {
115
+ out[t] = group;
116
+ out[t.toLowerCase()] = group;
117
+ const snake = t.replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").replace(/([a-z\d])([A-Z])/g, "$1_$2").toLowerCase();
118
+ out[snake] = group;
119
+ }
120
+ return out;
121
+ }
122
+ const TYPE_TO_GROUP = buildTypeToGroup();
123
+ /** Returns the group name for a tx type, or "default" if unknown. */
124
+ function getTxGroup(type) {
125
+ if (!type) return "default";
126
+ const direct = TYPE_TO_GROUP[type];
127
+ if (direct) return direct;
128
+ return TYPE_TO_GROUP[type.toLowerCase()] ?? "default";
129
+ }
130
+ /** Returns the {main, light} color pair for a tx type. */
131
+ function getTxColor(type) {
132
+ return METHOD_GROUP_COLORS[getTxGroup(type)] ?? METHOD_GROUP_COLORS.default;
133
+ }
134
+
135
+ //#endregion
136
+ exports.getTxColor = getTxColor;
137
+ exports.getTxGroup = getTxGroup;