@beclab/olaresid 0.1.1 → 0.1.2

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