@beclab/olaresid 0.1.1 → 0.1.3

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 (93) hide show
  1. package/CLI.md +1300 -0
  2. package/README.md +40 -31
  3. package/TAG.md +589 -0
  4. package/dist/abi/RootResolver2ABI.d.ts +54 -0
  5. package/dist/abi/RootResolver2ABI.d.ts.map +1 -0
  6. package/dist/abi/RootResolver2ABI.js +240 -0
  7. package/dist/abi/RootResolver2ABI.js.map +1 -0
  8. package/dist/business/index.d.ts +302 -0
  9. package/dist/business/index.d.ts.map +1 -0
  10. package/dist/business/index.js +1211 -0
  11. package/dist/business/index.js.map +1 -0
  12. package/dist/business/tag-context.d.ts +219 -0
  13. package/dist/business/tag-context.d.ts.map +1 -0
  14. package/dist/business/tag-context.js +560 -0
  15. package/dist/business/tag-context.js.map +1 -0
  16. package/dist/cli.js +2102 -39
  17. package/dist/cli.js.map +1 -1
  18. package/dist/debug.d.ts.map +1 -1
  19. package/dist/debug.js +14 -2
  20. package/dist/debug.js.map +1 -1
  21. package/dist/index.d.ts +51 -2
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +241 -12
  24. package/dist/index.js.map +1 -1
  25. package/dist/utils/crypto-utils.d.ts +130 -0
  26. package/dist/utils/crypto-utils.d.ts.map +1 -0
  27. package/dist/utils/crypto-utils.js +402 -0
  28. package/dist/utils/crypto-utils.js.map +1 -0
  29. package/dist/utils/error-parser.d.ts +35 -0
  30. package/dist/utils/error-parser.d.ts.map +1 -0
  31. package/dist/utils/error-parser.js +202 -0
  32. package/dist/utils/error-parser.js.map +1 -0
  33. package/dist/utils/olares-id.d.ts +36 -0
  34. package/dist/utils/olares-id.d.ts.map +1 -0
  35. package/dist/utils/olares-id.js +52 -0
  36. package/dist/utils/olares-id.js.map +1 -0
  37. package/dist/utils/tag-abi-codec.d.ts +69 -0
  38. package/dist/utils/tag-abi-codec.d.ts.map +1 -0
  39. package/dist/utils/tag-abi-codec.js +144 -0
  40. package/dist/utils/tag-abi-codec.js.map +1 -0
  41. package/dist/utils/tag-type-builder.d.ts +158 -0
  42. package/dist/utils/tag-type-builder.d.ts.map +1 -0
  43. package/dist/utils/tag-type-builder.js +410 -0
  44. package/dist/utils/tag-type-builder.js.map +1 -0
  45. package/examples/crypto-utilities.ts +140 -0
  46. package/examples/domain-context.ts +80 -0
  47. package/examples/generate-mnemonic.ts +149 -0
  48. package/examples/index.ts +1 -1
  49. package/examples/ip.ts +171 -0
  50. package/examples/legacy.ts +10 -10
  51. package/examples/list-wallets.ts +81 -0
  52. package/examples/olares-id-format.ts +197 -0
  53. package/examples/quasar-demo/.eslintrc.js +23 -0
  54. package/examples/quasar-demo/.quasar/app.js +43 -0
  55. package/examples/quasar-demo/.quasar/client-entry.js +38 -0
  56. package/examples/quasar-demo/.quasar/client-prefetch.js +130 -0
  57. package/examples/quasar-demo/.quasar/quasar-user-options.js +16 -0
  58. package/examples/quasar-demo/README.md +49 -0
  59. package/examples/quasar-demo/index.html +11 -0
  60. package/examples/quasar-demo/package-lock.json +6407 -0
  61. package/examples/quasar-demo/package.json +36 -0
  62. package/examples/quasar-demo/quasar.config.js +73 -0
  63. package/examples/quasar-demo/src/App.vue +13 -0
  64. package/examples/quasar-demo/src/css/app.scss +1 -0
  65. package/examples/quasar-demo/src/layouts/MainLayout.vue +21 -0
  66. package/examples/quasar-demo/src/pages/IndexPage.vue +905 -0
  67. package/examples/quasar-demo/src/router/index.ts +25 -0
  68. package/examples/quasar-demo/src/router/routes.ts +11 -0
  69. package/examples/quasar-demo/tsconfig.json +28 -0
  70. package/examples/register-subdomain.ts +152 -0
  71. package/examples/rsa-keypair.ts +148 -0
  72. package/examples/tag-builder.ts +235 -0
  73. package/examples/tag-management.ts +534 -0
  74. package/examples/tag-nested-tuple.ts +190 -0
  75. package/examples/tag-simple.ts +149 -0
  76. package/examples/tag-tagger.ts +217 -0
  77. package/examples/test-nested-tuple-conversion.ts +143 -0
  78. package/examples/test-type-bytes-parser.ts +70 -0
  79. package/examples/transfer-domain.ts +197 -0
  80. package/examples/wallet-management.ts +196 -0
  81. package/package.json +24 -15
  82. package/src/abi/RootResolver2ABI.ts +237 -0
  83. package/src/business/index.ts +1492 -0
  84. package/src/business/tag-context.ts +747 -0
  85. package/src/cli.ts +2772 -39
  86. package/src/debug.ts +17 -2
  87. package/src/index.ts +313 -17
  88. package/src/utils/crypto-utils.ts +459 -0
  89. package/src/utils/error-parser.ts +225 -0
  90. package/src/utils/olares-id.ts +49 -0
  91. package/src/utils/tag-abi-codec.ts +158 -0
  92. package/src/utils/tag-type-builder.ts +469 -0
  93. package/tsconfig.json +1 -1
@@ -0,0 +1,560 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TagContext = void 0;
4
+ const error_parser_1 = require("../utils/error-parser");
5
+ const tag_type_builder_1 = require("../utils/tag-type-builder");
6
+ const tag_abi_codec_1 = require("../utils/tag-abi-codec");
7
+ const olares_id_1 = require("../utils/olares-id");
8
+ /**
9
+ * Tag Operation Context
10
+ * Provides complete Tag management functionality
11
+ */
12
+ class TagContext {
13
+ constructor(console, fromDomain) {
14
+ this.console = console;
15
+ this.fromDomain = fromDomain;
16
+ // Support Olares ID format (user@domain.com)
17
+ this.fromDomain = (0, olares_id_1.normalizeToDomain)(fromDomain);
18
+ }
19
+ // ========================================
20
+ // 1. Tag Type Definition Management
21
+ // ========================================
22
+ /**
23
+ * Set the tagger (manager) for a Tag
24
+ * Only the domain owner can set the tagger
25
+ *
26
+ * @param tagName Tag name
27
+ * @param taggerAddress Address of the tagger (manager)
28
+ * @returns Transaction result
29
+ *
30
+ * @example
31
+ * // Set a specific address as the tagger
32
+ * await tagCtx.setTagger('email', '0x1234...');
33
+ *
34
+ * // Set zero address to allow anyone to manage
35
+ * await tagCtx.setTagger('email', '0x0000000000000000000000000000000000000000');
36
+ */
37
+ async setTagger(tagName, taggerAddress) {
38
+ const contract = this.console.getSignerContractDID();
39
+ try {
40
+ const tx = await contract.setTagger(this.fromDomain, tagName, taggerAddress);
41
+ const receipt = await tx.wait();
42
+ return {
43
+ success: true,
44
+ transactionHash: receipt.hash,
45
+ gasUsed: receipt.gasUsed,
46
+ blockNumber: receipt.blockNumber
47
+ };
48
+ }
49
+ catch (error) {
50
+ const errorInfo = (0, error_parser_1.parseContractError)(error);
51
+ if (errorInfo.isNetworkError) {
52
+ throw new Error(`Network error: ${errorInfo.message}`);
53
+ }
54
+ throw new Error(`Failed to set tagger: ${errorInfo.message}`);
55
+ }
56
+ }
57
+ /**
58
+ * Get the tagger (manager) address for a Tag
59
+ *
60
+ * @param tagName Tag name
61
+ * @returns Tagger address (returns zero address if no tagger is set)
62
+ *
63
+ * @example
64
+ * const tagger = await tagCtx.getTagger('email');
65
+ * console.log('Tagger address:', tagger);
66
+ *
67
+ * if (tagger === '0x0000000000000000000000000000000000000000') {
68
+ * console.log('No specific tagger, anyone can manage');
69
+ * }
70
+ */
71
+ async getTagger(tagName) {
72
+ const contract = this.console.getContractDID();
73
+ return await contract.getTagger(this.fromDomain, tagName);
74
+ }
75
+ /**
76
+ * Define a new Tag type
77
+ * @param tagName Tag name
78
+ * @param tagType Tag type object (built using TagTypeBuilder)
79
+ * @returns Transaction result
80
+ *
81
+ * @example
82
+ * const emailType = TagTypeBuilder.string();
83
+ * await tagCtx.defineTag('email', emailType);
84
+ */
85
+ async defineTag(tagName, tagType) {
86
+ const contract = this.console.getSignerContractDID();
87
+ // Get type bytes directly from TagTypeBuilder (no contract call needed)
88
+ const abiTypeBytes = '0x' + tagType.getTypeBytes();
89
+ // Get field names (for complex types)
90
+ const fieldNames = tagType.getFieldNames();
91
+ try {
92
+ const tx = await contract.defineTag(this.fromDomain, tagName, abiTypeBytes, fieldNames);
93
+ const receipt = await tx.wait();
94
+ return {
95
+ success: true,
96
+ transactionHash: receipt.hash,
97
+ gasUsed: receipt.gasUsed,
98
+ blockNumber: receipt.blockNumber
99
+ };
100
+ }
101
+ catch (error) {
102
+ const errorInfo = (0, error_parser_1.parseContractError)(error);
103
+ if (errorInfo.isNetworkError) {
104
+ throw new Error(`Network error: ${errorInfo.message}`);
105
+ }
106
+ throw new Error(`Failed to define tag: ${errorInfo.message}`);
107
+ }
108
+ }
109
+ /**
110
+ * Get Tag type definition
111
+ * @param tagName Tag name
112
+ * @returns Tag type information, or null if not found
113
+ */
114
+ async getTagType(tagName) {
115
+ try {
116
+ const contract = this.console.getContractDID();
117
+ const [abiType, fieldNamesHash] = await contract.getTagType(this.fromDomain, tagName);
118
+ return { abiType, fieldNamesHash };
119
+ }
120
+ catch (error) {
121
+ const errorInfo = (0, error_parser_1.parseContractError)(error);
122
+ if (errorInfo.errorName === 'UndefinedTag') {
123
+ return null;
124
+ }
125
+ throw error;
126
+ }
127
+ }
128
+ /**
129
+ * Get all Tag names defined by the domain
130
+ * @returns Array of Tag names
131
+ */
132
+ async getDefinedTagNames() {
133
+ const contract = this.console.getContractDID();
134
+ return await contract.getDefinedTagNames(this.fromDomain);
135
+ }
136
+ /**
137
+ * Get the count of Tags defined by the domain
138
+ */
139
+ async getDefinedTagCount() {
140
+ const contract = this.console.getContractDID();
141
+ const count = await contract.getDefinedTagCount(this.fromDomain);
142
+ return Number(count);
143
+ }
144
+ // ========================================
145
+ // 2. Tag Value Operations
146
+ // ========================================
147
+ /**
148
+ * Set Tag value
149
+ * Supports simple values, arrays, and tuples (as objects or arrays)
150
+ * Objects are automatically converted to arrays based on ABI type structure
151
+ *
152
+ * @param toDomain Target domain
153
+ * @param tagName Tag name
154
+ * @param value Tag value (objects for tuples, arrays, or simple values)
155
+ * @returns Transaction result
156
+ *
157
+ * @example
158
+ * // Simple value
159
+ * await tagCtx.setTag('example.com', 'email', 'user@example.com');
160
+ *
161
+ * // Array type
162
+ * await tagCtx.setTag('example.com', 'links', ['https://...', 'https://...']);
163
+ *
164
+ * // Tuple type - object notation (recommended)
165
+ * await tagCtx.setTag('example.com', 'userInfo', {
166
+ * name: 'Alice',
167
+ * age: 30,
168
+ * verified: true
169
+ * });
170
+ *
171
+ * // Tuple type - array notation (still supported)
172
+ * await tagCtx.setTag('example.com', 'userInfo', ['Alice', 30, true]);
173
+ *
174
+ * // Nested tuple - object notation
175
+ * await tagCtx.setTag('example.com', 'profile', {
176
+ * name: 'Alice',
177
+ * details: {
178
+ * age: 30,
179
+ * verified: true
180
+ * }
181
+ * });
182
+ */
183
+ async setTag(toDomain, tagName, value) {
184
+ // Support Olares ID format
185
+ toDomain = (0, olares_id_1.normalizeToDomain)(toDomain);
186
+ const contract = this.console.getSignerContractDID();
187
+ // Get tag type
188
+ const tagTypeInfo = await this.getTagType(tagName);
189
+ if (!tagTypeInfo) {
190
+ throw new Error(`Tag "${tagName}" is not defined in domain "${this.fromDomain}"`);
191
+ }
192
+ try {
193
+ // Parse type bytes to ABI type string
194
+ const abiType = tag_type_builder_1.TagTypeBuilder.parseTypeBytesToAbiString(tagTypeInfo.abiType);
195
+ // Encode the ENTIRE value using TagAbiCodec
196
+ // Objects are automatically converted to arrays based on ABI type structure
197
+ const encodedValue = tag_abi_codec_1.TagAbiCodec.encode(abiType, value);
198
+ // Check if tag already exists
199
+ const hasTag = await contract.hasTag(this.fromDomain, toDomain, tagName);
200
+ let tx;
201
+ if (hasTag) {
202
+ // Update tag value
203
+ tx = await contract.updateTagElem(this.fromDomain, toDomain, tagName, [], // Empty path means root element
204
+ encodedValue);
205
+ }
206
+ else {
207
+ // Add new tag
208
+ tx = await contract.addTag(this.fromDomain, toDomain, tagName, encodedValue);
209
+ }
210
+ const receipt = await tx.wait();
211
+ return {
212
+ success: true,
213
+ transactionHash: receipt.hash,
214
+ gasUsed: receipt.gasUsed,
215
+ blockNumber: receipt.blockNumber
216
+ };
217
+ }
218
+ catch (error) {
219
+ const errorInfo = (0, error_parser_1.parseContractError)(error);
220
+ if (errorInfo.isNetworkError) {
221
+ throw new Error(`Network error: ${errorInfo.message}`);
222
+ }
223
+ throw new Error(`Failed to set tag: ${errorInfo.message}`);
224
+ }
225
+ }
226
+ /**
227
+ * Get Tag value
228
+ * @param toDomain Target domain
229
+ * @param tagName Tag name
230
+ * @returns Tag value, or null if not found
231
+ */
232
+ async getTag(toDomain, tagName) {
233
+ // Support Olares ID format
234
+ toDomain = (0, olares_id_1.normalizeToDomain)(toDomain);
235
+ try {
236
+ const contract = this.console.getContractDID();
237
+ // Get tag type
238
+ const tagTypeInfo = await this.getTagType(tagName);
239
+ if (!tagTypeInfo) {
240
+ return null;
241
+ }
242
+ // Get encoded value
243
+ const encodedValue = await contract.getTagElem(this.fromDomain, toDomain, tagName, []);
244
+ // Parse type and decode
245
+ const abiType = tag_type_builder_1.TagTypeBuilder.parseTypeBytesToAbiString(tagTypeInfo.abiType);
246
+ return tag_abi_codec_1.TagAbiCodec.decode(abiType, encodedValue);
247
+ }
248
+ catch (error) {
249
+ const errorInfo = (0, error_parser_1.parseContractError)(error);
250
+ if (errorInfo.errorName === 'TagInvalidOp' ||
251
+ errorInfo.errorName === 'UndefinedTag') {
252
+ return null;
253
+ }
254
+ if (errorInfo.isNetworkError) {
255
+ throw new Error(`Network error: ${errorInfo.message}`);
256
+ }
257
+ throw error;
258
+ }
259
+ }
260
+ /**
261
+ * Remove Tag
262
+ * @param toDomain Target domain
263
+ * @param tagName Tag name
264
+ * @returns Transaction result
265
+ */
266
+ async removeTag(toDomain, tagName) {
267
+ // Support Olares ID format
268
+ toDomain = (0, olares_id_1.normalizeToDomain)(toDomain);
269
+ try {
270
+ const contract = this.console.getSignerContractDID();
271
+ const tx = await contract.removeTag(this.fromDomain, toDomain, tagName);
272
+ const receipt = await tx.wait();
273
+ return {
274
+ success: true,
275
+ transactionHash: receipt.hash,
276
+ gasUsed: receipt.gasUsed,
277
+ blockNumber: receipt.blockNumber
278
+ };
279
+ }
280
+ catch (error) {
281
+ const errorInfo = (0, error_parser_1.parseContractError)(error);
282
+ if (errorInfo.isNetworkError) {
283
+ throw new Error(`Network error: ${errorInfo.message}`);
284
+ }
285
+ throw new Error(`Failed to remove tag: ${errorInfo.message}`);
286
+ }
287
+ }
288
+ /**
289
+ * Check if Tag exists
290
+ * @param toDomain Target domain
291
+ * @param tagName Tag name
292
+ * @returns Whether the tag exists
293
+ */
294
+ async hasTag(toDomain, tagName) {
295
+ // Support Olares ID format
296
+ toDomain = (0, olares_id_1.normalizeToDomain)(toDomain);
297
+ const contract = this.console.getContractDID();
298
+ return await contract.hasTag(this.fromDomain, toDomain, tagName);
299
+ }
300
+ /**
301
+ * Get all Tag names for the domain
302
+ * @param toDomain Target domain
303
+ * @returns Array of Tag names
304
+ */
305
+ async getTagNames(toDomain) {
306
+ // Support Olares ID format
307
+ toDomain = (0, olares_id_1.normalizeToDomain)(toDomain);
308
+ const contract = this.console.getContractDID();
309
+ const count = await contract.getTagCount(this.fromDomain, toDomain);
310
+ const names = [];
311
+ for (let i = 0; i < count; i++) {
312
+ const name = await contract.getTagNameByIndex(this.fromDomain, toDomain, i);
313
+ names.push(name);
314
+ }
315
+ return names;
316
+ }
317
+ /**
318
+ * Get all Tags and their values for the domain
319
+ * @param toDomain Target domain
320
+ * @returns Array of Tags, each containing name and value
321
+ */
322
+ async getAllTags(toDomain) {
323
+ const names = await this.getTagNames(toDomain);
324
+ const result = [];
325
+ for (const name of names) {
326
+ const value = await this.getTag(toDomain, name);
327
+ result.push({ name, value });
328
+ }
329
+ return result;
330
+ }
331
+ // ========================================
332
+ // 3. Array Operations (Advanced Features)
333
+ // ========================================
334
+ /**
335
+ * Add an element to an array Tag
336
+ * @param toDomain Target domain
337
+ * @param tagName Tag name
338
+ * @param value Element value to add
339
+ * @param elemPath Element path (for nested arrays), defaults to empty array
340
+ * @returns Transaction result
341
+ *
342
+ * @example
343
+ * // Add element to a 1D array
344
+ * await tagCtx.pushElement('example.com', 'socialLinks', 'https://twitter.com/user');
345
+ *
346
+ * // Add element to the first sub-array of a 2D array
347
+ * await tagCtx.pushElement('example.com', 'matrix', 'value', [0]);
348
+ */
349
+ async pushElement(toDomain, tagName, value, elemPath = []) {
350
+ // Support Olares ID format
351
+ toDomain = (0, olares_id_1.normalizeToDomain)(toDomain);
352
+ const contract = this.console.getSignerContractDID();
353
+ // Get tag type and encode element
354
+ const tagTypeInfo = await this.getTagType(tagName);
355
+ if (!tagTypeInfo) {
356
+ throw new Error(`Tag "${tagName}" is not defined`);
357
+ }
358
+ try {
359
+ // Parse type bytes to ABI string
360
+ const rootAbiType = tag_type_builder_1.TagTypeBuilder.parseTypeBytesToAbiString(tagTypeInfo.abiType);
361
+ // Get ELEMENT type (not root type!)
362
+ const elementAbiType = this.getElementAbiType(rootAbiType, elemPath);
363
+ // Encode the SINGLE ELEMENT (not the whole array)
364
+ const encodedValue = tag_abi_codec_1.TagAbiCodec.encode(elementAbiType, value);
365
+ const tx = await contract.pushTagElem(this.fromDomain, toDomain, tagName, elemPath, encodedValue);
366
+ const receipt = await tx.wait();
367
+ return {
368
+ success: true,
369
+ transactionHash: receipt.hash,
370
+ gasUsed: receipt.gasUsed,
371
+ blockNumber: receipt.blockNumber
372
+ };
373
+ }
374
+ catch (error) {
375
+ const errorInfo = (0, error_parser_1.parseContractError)(error);
376
+ if (errorInfo.isNetworkError) {
377
+ throw new Error(`Network error: ${errorInfo.message}`);
378
+ }
379
+ throw new Error(`Failed to push element: ${errorInfo.message}`);
380
+ }
381
+ }
382
+ /**
383
+ * Remove the last element from an array Tag
384
+ * @param toDomain Target domain
385
+ * @param tagName Tag name
386
+ * @param elemPath Element path, defaults to empty array
387
+ * @returns Transaction result
388
+ */
389
+ async popElement(toDomain, tagName, elemPath = []) {
390
+ // Support Olares ID format
391
+ toDomain = (0, olares_id_1.normalizeToDomain)(toDomain);
392
+ try {
393
+ const contract = this.console.getSignerContractDID();
394
+ const tx = await contract.popTagElem(this.fromDomain, toDomain, tagName, elemPath);
395
+ const receipt = await tx.wait();
396
+ return {
397
+ success: true,
398
+ transactionHash: receipt.hash,
399
+ gasUsed: receipt.gasUsed,
400
+ blockNumber: receipt.blockNumber
401
+ };
402
+ }
403
+ catch (error) {
404
+ const errorInfo = (0, error_parser_1.parseContractError)(error);
405
+ if (errorInfo.isNetworkError) {
406
+ throw new Error(`Network error: ${errorInfo.message}`);
407
+ }
408
+ throw new Error(`Failed to pop element: ${errorInfo.message}`);
409
+ }
410
+ }
411
+ /**
412
+ * Update a specific element in an array or tuple
413
+ * @param toDomain Target domain
414
+ * @param tagName Tag name
415
+ * @param elemPath Element path (e.g., [0] for the first element)
416
+ * @param value New value
417
+ * @returns Transaction result
418
+ *
419
+ * @example
420
+ * // Update the first element of an array
421
+ * await tagCtx.updateElement('example.com', 'links', [0], 'https://new-url.com');
422
+ *
423
+ * // Update an element in a 2D array
424
+ * await tagCtx.updateElement('example.com', 'matrix', [0, 1], 'value');
425
+ */
426
+ async updateElement(toDomain, tagName, elemPath, value) {
427
+ // Support Olares ID format
428
+ toDomain = (0, olares_id_1.normalizeToDomain)(toDomain);
429
+ const contract = this.console.getSignerContractDID();
430
+ const tagTypeInfo = await this.getTagType(tagName);
431
+ if (!tagTypeInfo) {
432
+ throw new Error(`Tag "${tagName}" is not defined`);
433
+ }
434
+ try {
435
+ // Parse type bytes to ABI string
436
+ const rootAbiType = tag_type_builder_1.TagTypeBuilder.parseTypeBytesToAbiString(tagTypeInfo.abiType);
437
+ // Get element type
438
+ const elementAbiType = this.getElementAbiType(rootAbiType, elemPath);
439
+ // Encode the element value
440
+ const encodedValue = tag_abi_codec_1.TagAbiCodec.encode(elementAbiType, value);
441
+ const tx = await contract.updateTagElem(this.fromDomain, toDomain, tagName, elemPath, encodedValue);
442
+ const receipt = await tx.wait();
443
+ return {
444
+ success: true,
445
+ transactionHash: receipt.hash,
446
+ gasUsed: receipt.gasUsed,
447
+ blockNumber: receipt.blockNumber
448
+ };
449
+ }
450
+ catch (error) {
451
+ const errorInfo = (0, error_parser_1.parseContractError)(error);
452
+ if (errorInfo.isNetworkError) {
453
+ throw new Error(`Network error: ${errorInfo.message}`);
454
+ }
455
+ throw new Error(`Failed to update element: ${errorInfo.message}`);
456
+ }
457
+ }
458
+ /**
459
+ * Get the length of an array Tag
460
+ * @param toDomain Target domain
461
+ * @param tagName Tag name
462
+ * @param elemPath Element path, defaults to empty array
463
+ * @returns Array length
464
+ */
465
+ async getArrayLength(toDomain, tagName, elemPath = []) {
466
+ // Support Olares ID format
467
+ toDomain = (0, olares_id_1.normalizeToDomain)(toDomain);
468
+ const contract = this.console.getContractDID();
469
+ const length = await contract.getTagElemLength(this.fromDomain, toDomain, tagName, elemPath);
470
+ return Number(length);
471
+ }
472
+ /**
473
+ * Get a specific element from an array or tuple
474
+ * @param toDomain Target domain
475
+ * @param tagName Tag name
476
+ * @param elemPath Element path
477
+ * @returns Element value, or null if not found
478
+ *
479
+ * @example
480
+ * // Get the first element of an array
481
+ * const first = await tagCtx.getElement('example.com', 'links', [0]);
482
+ *
483
+ * // Get an element from a 2D array
484
+ * const value = await tagCtx.getElement('example.com', 'matrix', [0, 1]);
485
+ */
486
+ async getElement(toDomain, tagName, elemPath) {
487
+ // Support Olares ID format
488
+ toDomain = (0, olares_id_1.normalizeToDomain)(toDomain);
489
+ try {
490
+ const contract = this.console.getContractDID();
491
+ const encodedValue = await contract.getTagElem(this.fromDomain, toDomain, tagName, elemPath);
492
+ // Get tag type and decode element value
493
+ const tagTypeInfo = await this.getTagType(tagName);
494
+ if (!tagTypeInfo) {
495
+ return null;
496
+ }
497
+ // Parse type bytes to ABI string
498
+ const rootAbiType = tag_type_builder_1.TagTypeBuilder.parseTypeBytesToAbiString(tagTypeInfo.abiType);
499
+ // Get element type
500
+ const elementAbiType = this.getElementAbiType(rootAbiType, elemPath);
501
+ // Decode the element
502
+ return tag_abi_codec_1.TagAbiCodec.decode(elementAbiType, encodedValue);
503
+ }
504
+ catch (error) {
505
+ const errorInfo = (0, error_parser_1.parseContractError)(error);
506
+ if (errorInfo.errorName === 'TagInvalidOp') {
507
+ return null;
508
+ }
509
+ if (errorInfo.isNetworkError) {
510
+ throw new Error(`Network error: ${errorInfo.message}`);
511
+ }
512
+ throw error;
513
+ }
514
+ }
515
+ // ========================================
516
+ // Helper Methods (Private)
517
+ // ========================================
518
+ /**
519
+ * Get element ABI type based on path
520
+ * Example: string[][] + [0] = string[]
521
+ * string[][] + [0, 0] = string
522
+ *
523
+ * Special case: For pushElement/popElement on array type with empty path,
524
+ * we want the element type:
525
+ * Example: string[] + [] → string (for push operation)
526
+ */
527
+ getElementAbiType(abiType, elemPath) {
528
+ let currentType = abiType;
529
+ // If elemPath is empty and currentType is an array,
530
+ // return the element type (for push/pop operations)
531
+ if (elemPath.length === 0) {
532
+ const arrayMatch = currentType.match(/^(.+?)\[(\d*)\]$/);
533
+ if (arrayMatch) {
534
+ return arrayMatch[1]; // Return element type
535
+ }
536
+ // Not an array, return as-is
537
+ return currentType;
538
+ }
539
+ // Process each level of the path
540
+ for (const _index of elemPath) {
541
+ // Parse ABI type string
542
+ // Handle array types: type[] or type[N]
543
+ const arrayMatch = currentType.match(/^(.+?)\[(\d*)\]$/);
544
+ if (arrayMatch) {
545
+ // Array type, element type is the base type
546
+ currentType = arrayMatch[1];
547
+ }
548
+ else if (currentType.startsWith('tuple(')) {
549
+ // Tuple type - not supported for element access by index
550
+ throw new Error('Tuple element access by index not supported yet. Use field names instead.');
551
+ }
552
+ else {
553
+ throw new Error(`Cannot access element of non-array type "${currentType}" at path ${elemPath}`);
554
+ }
555
+ }
556
+ return currentType;
557
+ }
558
+ }
559
+ exports.TagContext = TagContext;
560
+ //# sourceMappingURL=tag-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag-context.js","sourceRoot":"","sources":["../../src/business/tag-context.ts"],"names":[],"mappings":";;;AAEA,wDAA2D;AAC3D,gEAA2D;AAC3D,0DAAqD;AACrD,kDAAuD;AAEvD;;;GAGG;AACH,MAAa,UAAU;IACtB,YAAoB,OAAmB,EAAU,UAAkB;QAA/C,YAAO,GAAP,OAAO,CAAY;QAAU,eAAU,GAAV,UAAU,CAAQ;QAClE,6CAA6C;QAC7C,IAAI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