@lukso/transaction-decoder 1.0.1-dev.0f1bea5

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 (110) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +486 -0
  3. package/dist/browser.cjs +6912 -0
  4. package/dist/browser.cjs.map +1 -0
  5. package/dist/browser.d.cts +6 -0
  6. package/dist/browser.d.ts +6 -0
  7. package/dist/browser.js +131 -0
  8. package/dist/browser.js.map +1 -0
  9. package/dist/cdn/transaction-decoder.global.js +296 -0
  10. package/dist/cdn/transaction-decoder.global.js.map +1 -0
  11. package/dist/chunk-GGBHTWJL.js +437 -0
  12. package/dist/chunk-GGBHTWJL.js.map +1 -0
  13. package/dist/chunk-GXZOF3QY.js +839 -0
  14. package/dist/chunk-GXZOF3QY.js.map +1 -0
  15. package/dist/chunk-LJ6ES5XF.js +776 -0
  16. package/dist/chunk-LJ6ES5XF.js.map +1 -0
  17. package/dist/chunk-XVHJWV5U.js +4925 -0
  18. package/dist/chunk-XVHJWV5U.js.map +1 -0
  19. package/dist/data.cjs +5518 -0
  20. package/dist/data.cjs.map +1 -0
  21. package/dist/data.d.cts +43 -0
  22. package/dist/data.d.ts +43 -0
  23. package/dist/data.js +55 -0
  24. package/dist/data.js.map +1 -0
  25. package/dist/index-BzXh7poJ.d.cts +524 -0
  26. package/dist/index-BzXh7poJ.d.ts +524 -0
  27. package/dist/index.cjs +6912 -0
  28. package/dist/index.cjs.map +1 -0
  29. package/dist/index.d.cts +756 -0
  30. package/dist/index.d.ts +756 -0
  31. package/dist/index.js +131 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/server.cjs +5644 -0
  34. package/dist/server.cjs.map +1 -0
  35. package/dist/server.d.cts +217 -0
  36. package/dist/server.d.ts +217 -0
  37. package/dist/server.js +644 -0
  38. package/dist/server.js.map +1 -0
  39. package/dist/utils-CBAkjQh3.d.cts +108 -0
  40. package/dist/utils-xT9-km0r.d.ts +108 -0
  41. package/package.json +101 -0
  42. package/src/browser.ts +13 -0
  43. package/src/client/resolveAddresses.ts +157 -0
  44. package/src/core/addressCollector.ts +153 -0
  45. package/src/core/addressResolver.ts +135 -0
  46. package/src/core/dataModel.ts +888 -0
  47. package/src/core/instance.ts +33 -0
  48. package/src/core/integrateDecoder.ts +325 -0
  49. package/src/data.ts +70 -0
  50. package/src/decoder/GENERATOR_PROPOSAL.md +182 -0
  51. package/src/decoder/THREE_PHASE_EXAMPLE.md +108 -0
  52. package/src/decoder/aggregation.ts +218 -0
  53. package/src/decoder/browserCache.ts +237 -0
  54. package/src/decoder/cache/README.md +126 -0
  55. package/src/decoder/cache/index.ts +44 -0
  56. package/src/decoder/cache.ts +139 -0
  57. package/src/decoder/constants.ts +125 -0
  58. package/src/decoder/decodeTransaction.ts +292 -0
  59. package/src/decoder/errors.ts +95 -0
  60. package/src/decoder/events.ts +192 -0
  61. package/src/decoder/functionSignature.ts +344 -0
  62. package/src/decoder/getDataFromExternalSources.ts +248 -0
  63. package/src/decoder/graphqlWS.ts +22 -0
  64. package/src/decoder/interfaces.ts +185 -0
  65. package/src/decoder/keyValue.ts +5 -0
  66. package/src/decoder/kvCache.ts +241 -0
  67. package/src/decoder/lruCache.ts +184 -0
  68. package/src/decoder/lsp7Mint.test.ts +179 -0
  69. package/src/decoder/lsp7TransferBatch.test.ts +105 -0
  70. package/src/decoder/plugins/RegistryAbi.ts +562 -0
  71. package/src/decoder/plugins/enhanceBurntPix.ts +132 -0
  72. package/src/decoder/plugins/enhanceGraffiti.ts +70 -0
  73. package/src/decoder/plugins/enhanceLSP0ERC725Account.ts +179 -0
  74. package/src/decoder/plugins/enhanceLSP26FollowerSystem.ts +88 -0
  75. package/src/decoder/plugins/enhanceLSP6KeyManager.ts +231 -0
  76. package/src/decoder/plugins/enhanceLSP7DigitalAsset.ts +165 -0
  77. package/src/decoder/plugins/enhanceLSP8IdentifiableDigitalAsset.ts +170 -0
  78. package/src/decoder/plugins/enhanceLSP9Vault.ts +57 -0
  79. package/src/decoder/plugins/enhanceRetrieveAbi.ts +85 -0
  80. package/src/decoder/plugins/enhanceSetData.ts +135 -0
  81. package/src/decoder/plugins/index.ts +99 -0
  82. package/src/decoder/plugins/schemaDefault.ts +318 -0
  83. package/src/decoder/plugins/standardPlugin.ts +202 -0
  84. package/src/decoder/registry.ts +322 -0
  85. package/src/decoder/singleGQL.ts +293 -0
  86. package/src/decoder/transaction.ts +198 -0
  87. package/src/decoder/types.ts +465 -0
  88. package/src/decoder/utils.ts +212 -0
  89. package/src/example/usage.ts +172 -0
  90. package/src/index.ts +174 -0
  91. package/src/server/addressResolver.ts +68 -0
  92. package/src/server/caches.ts +209 -0
  93. package/src/server/decodeTransactionSync.ts +156 -0
  94. package/src/server/decodeTransactionsBatch.ts +207 -0
  95. package/src/server/finishDecoding.ts +116 -0
  96. package/src/server/index.ts +81 -0
  97. package/src/server/lsp23Resolver.test.ts +46 -0
  98. package/src/server/lsp23Resolver.ts +419 -0
  99. package/src/server/types.ts +168 -0
  100. package/src/server.ts +22 -0
  101. package/src/shared/addressResolver.ts +651 -0
  102. package/src/shared/cache.ts +144 -0
  103. package/src/shared/constants.ts +21 -0
  104. package/src/stubs/tty.ts +13 -0
  105. package/src/stubs/util.ts +42 -0
  106. package/src/types/index.ts +154 -0
  107. package/src/types/provider.ts +46 -0
  108. package/src/umd.ts +13 -0
  109. package/src/utils/debug.ts +49 -0
  110. package/src/utils/json-bigint.ts +47 -0
@@ -0,0 +1,562 @@
1
+ export default [
2
+ {
3
+ inputs: [
4
+ { internalType: 'address', name: 'creator', type: 'address' },
5
+ { internalType: 'address', name: '_codehub', type: 'address' },
6
+ ],
7
+ stateMutability: 'nonpayable',
8
+ type: 'constructor',
9
+ },
10
+ { inputs: [], name: 'ERC725Y_DataKeysValuesEmptyArray', type: 'error' },
11
+ { inputs: [], name: 'ERC725Y_DataKeysValuesLengthMismatch', type: 'error' },
12
+ { inputs: [], name: 'ERC725Y_MsgValueDisallowed', type: 'error' },
13
+ {
14
+ inputs: [{ internalType: 'bytes', name: 'storedData', type: 'bytes' }],
15
+ name: 'InvalidExtensionAddress',
16
+ type: 'error',
17
+ },
18
+ {
19
+ inputs: [{ internalType: 'bytes', name: 'data', type: 'bytes' }],
20
+ name: 'InvalidFunctionSelector',
21
+ type: 'error',
22
+ },
23
+ { inputs: [], name: 'LSP4TokenNameNotEditable', type: 'error' },
24
+ { inputs: [], name: 'LSP4TokenSymbolNotEditable', type: 'error' },
25
+ { inputs: [], name: 'LSP4TokenTypeNotEditable', type: 'error' },
26
+ {
27
+ inputs: [{ internalType: 'uint256', name: 'callIndex', type: 'uint256' }],
28
+ name: 'LSP8BatchCallFailed',
29
+ type: 'error',
30
+ },
31
+ { inputs: [], name: 'LSP8CannotSendToAddressZero', type: 'error' },
32
+ { inputs: [], name: 'LSP8CannotSendToSelf', type: 'error' },
33
+ { inputs: [], name: 'LSP8CannotUseAddressZeroAsOperator', type: 'error' },
34
+ { inputs: [], name: 'LSP8InvalidTransferBatch', type: 'error' },
35
+ {
36
+ inputs: [{ internalType: 'bytes32', name: 'tokenId', type: 'bytes32' }],
37
+ name: 'LSP8NonExistentTokenId',
38
+ type: 'error',
39
+ },
40
+ {
41
+ inputs: [
42
+ { internalType: 'address', name: 'operator', type: 'address' },
43
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
44
+ ],
45
+ name: 'LSP8NonExistingOperator',
46
+ type: 'error',
47
+ },
48
+ {
49
+ inputs: [
50
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
51
+ { internalType: 'address', name: 'caller', type: 'address' },
52
+ ],
53
+ name: 'LSP8NotTokenOperator',
54
+ type: 'error',
55
+ },
56
+ {
57
+ inputs: [
58
+ { internalType: 'address', name: 'tokenOwner', type: 'address' },
59
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
60
+ { internalType: 'address', name: 'caller', type: 'address' },
61
+ ],
62
+ name: 'LSP8NotTokenOwner',
63
+ type: 'error',
64
+ },
65
+ {
66
+ inputs: [
67
+ { internalType: 'address', name: 'tokenReceiver', type: 'address' },
68
+ ],
69
+ name: 'LSP8NotifyTokenReceiverContractMissingLSP1Interface',
70
+ type: 'error',
71
+ },
72
+ {
73
+ inputs: [
74
+ { internalType: 'address', name: 'tokenReceiver', type: 'address' },
75
+ ],
76
+ name: 'LSP8NotifyTokenReceiverIsEOA',
77
+ type: 'error',
78
+ },
79
+ {
80
+ inputs: [
81
+ { internalType: 'address', name: 'operator', type: 'address' },
82
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
83
+ ],
84
+ name: 'LSP8OperatorAlreadyAuthorized',
85
+ type: 'error',
86
+ },
87
+ { inputs: [], name: 'LSP8TokenContractCannotHoldValue', type: 'error' },
88
+ {
89
+ inputs: [{ internalType: 'bytes32', name: 'tokenId', type: 'bytes32' }],
90
+ name: 'LSP8TokenIdAlreadyMinted',
91
+ type: 'error',
92
+ },
93
+ { inputs: [], name: 'LSP8TokenIdFormatNotEditable', type: 'error' },
94
+ { inputs: [], name: 'LSP8TokenIdsDataEmptyArray', type: 'error' },
95
+ { inputs: [], name: 'LSP8TokenIdsDataLengthMismatch', type: 'error' },
96
+ { inputs: [], name: 'LSP8TokenOwnerCannotBeOperator', type: 'error' },
97
+ {
98
+ inputs: [
99
+ { internalType: 'bytes4', name: 'functionSelector', type: 'bytes4' },
100
+ ],
101
+ name: 'NoExtensionFoundForFunctionSelector',
102
+ type: 'error',
103
+ },
104
+ {
105
+ inputs: [
106
+ { internalType: 'address', name: 'callerAddress', type: 'address' },
107
+ ],
108
+ name: 'OwnableCallerNotTheOwner',
109
+ type: 'error',
110
+ },
111
+ { inputs: [], name: 'OwnableCannotSetZeroAddressAsOwner', type: 'error' },
112
+ {
113
+ anonymous: false,
114
+ inputs: [
115
+ {
116
+ indexed: true,
117
+ internalType: 'bytes32',
118
+ name: 'dataKey',
119
+ type: 'bytes32',
120
+ },
121
+ {
122
+ indexed: false,
123
+ internalType: 'bytes',
124
+ name: 'dataValue',
125
+ type: 'bytes',
126
+ },
127
+ ],
128
+ name: 'DataChanged',
129
+ type: 'event',
130
+ },
131
+ {
132
+ anonymous: false,
133
+ inputs: [
134
+ {
135
+ indexed: true,
136
+ internalType: 'address',
137
+ name: 'operator',
138
+ type: 'address',
139
+ },
140
+ {
141
+ indexed: true,
142
+ internalType: 'address',
143
+ name: 'tokenOwner',
144
+ type: 'address',
145
+ },
146
+ {
147
+ indexed: true,
148
+ internalType: 'bytes32',
149
+ name: 'tokenId',
150
+ type: 'bytes32',
151
+ },
152
+ {
153
+ indexed: false,
154
+ internalType: 'bytes',
155
+ name: 'operatorNotificationData',
156
+ type: 'bytes',
157
+ },
158
+ ],
159
+ name: 'OperatorAuthorizationChanged',
160
+ type: 'event',
161
+ },
162
+ {
163
+ anonymous: false,
164
+ inputs: [
165
+ {
166
+ indexed: true,
167
+ internalType: 'address',
168
+ name: 'operator',
169
+ type: 'address',
170
+ },
171
+ {
172
+ indexed: true,
173
+ internalType: 'address',
174
+ name: 'tokenOwner',
175
+ type: 'address',
176
+ },
177
+ {
178
+ indexed: true,
179
+ internalType: 'bytes32',
180
+ name: 'tokenId',
181
+ type: 'bytes32',
182
+ },
183
+ { indexed: false, internalType: 'bool', name: 'notified', type: 'bool' },
184
+ {
185
+ indexed: false,
186
+ internalType: 'bytes',
187
+ name: 'operatorNotificationData',
188
+ type: 'bytes',
189
+ },
190
+ ],
191
+ name: 'OperatorRevoked',
192
+ type: 'event',
193
+ },
194
+ {
195
+ anonymous: false,
196
+ inputs: [
197
+ {
198
+ indexed: true,
199
+ internalType: 'address',
200
+ name: 'previousOwner',
201
+ type: 'address',
202
+ },
203
+ {
204
+ indexed: true,
205
+ internalType: 'address',
206
+ name: 'newOwner',
207
+ type: 'address',
208
+ },
209
+ ],
210
+ name: 'OwnershipTransferred',
211
+ type: 'event',
212
+ },
213
+ {
214
+ anonymous: false,
215
+ inputs: [
216
+ {
217
+ indexed: true,
218
+ internalType: 'bytes32',
219
+ name: 'tokenId',
220
+ type: 'bytes32',
221
+ },
222
+ {
223
+ indexed: true,
224
+ internalType: 'bytes32',
225
+ name: 'dataKey',
226
+ type: 'bytes32',
227
+ },
228
+ {
229
+ indexed: false,
230
+ internalType: 'bytes',
231
+ name: 'dataValue',
232
+ type: 'bytes',
233
+ },
234
+ ],
235
+ name: 'TokenIdDataChanged',
236
+ type: 'event',
237
+ },
238
+ {
239
+ anonymous: false,
240
+ inputs: [
241
+ {
242
+ indexed: false,
243
+ internalType: 'address',
244
+ name: 'operator',
245
+ type: 'address',
246
+ },
247
+ { indexed: true, internalType: 'address', name: 'from', type: 'address' },
248
+ { indexed: true, internalType: 'address', name: 'to', type: 'address' },
249
+ {
250
+ indexed: true,
251
+ internalType: 'bytes32',
252
+ name: 'tokenId',
253
+ type: 'bytes32',
254
+ },
255
+ { indexed: false, internalType: 'bool', name: 'force', type: 'bool' },
256
+ { indexed: false, internalType: 'bytes', name: 'data', type: 'bytes' },
257
+ ],
258
+ name: 'Transfer',
259
+ type: 'event',
260
+ },
261
+ { stateMutability: 'payable', type: 'fallback' },
262
+ {
263
+ inputs: [
264
+ { internalType: 'address', name: 'operator', type: 'address' },
265
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
266
+ {
267
+ internalType: 'bytes',
268
+ name: 'operatorNotificationData',
269
+ type: 'bytes',
270
+ },
271
+ ],
272
+ name: 'authorizeOperator',
273
+ outputs: [],
274
+ stateMutability: 'nonpayable',
275
+ type: 'function',
276
+ },
277
+ {
278
+ inputs: [{ internalType: 'address', name: 'tokenOwner', type: 'address' }],
279
+ name: 'balanceOf',
280
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
281
+ stateMutability: 'view',
282
+ type: 'function',
283
+ },
284
+ {
285
+ inputs: [],
286
+ name: 'banner',
287
+ outputs: [{ internalType: 'contract Fractal', name: '', type: 'address' }],
288
+ stateMutability: 'view',
289
+ type: 'function',
290
+ },
291
+ {
292
+ inputs: [{ internalType: 'bytes[]', name: 'data', type: 'bytes[]' }],
293
+ name: 'batchCalls',
294
+ outputs: [{ internalType: 'bytes[]', name: 'results', type: 'bytes[]' }],
295
+ stateMutability: 'nonpayable',
296
+ type: 'function',
297
+ },
298
+ {
299
+ inputs: [{ internalType: 'bytes32', name: 'dataKey', type: 'bytes32' }],
300
+ name: 'getData',
301
+ outputs: [{ internalType: 'bytes', name: 'dataValue', type: 'bytes' }],
302
+ stateMutability: 'view',
303
+ type: 'function',
304
+ },
305
+ {
306
+ inputs: [
307
+ { internalType: 'bytes32[]', name: 'dataKeys', type: 'bytes32[]' },
308
+ ],
309
+ name: 'getDataBatch',
310
+ outputs: [{ internalType: 'bytes[]', name: 'dataValues', type: 'bytes[]' }],
311
+ stateMutability: 'view',
312
+ type: 'function',
313
+ },
314
+ {
315
+ inputs: [
316
+ { internalType: 'bytes32[]', name: 'tokenIds', type: 'bytes32[]' },
317
+ { internalType: 'bytes32[]', name: 'dataKeys', type: 'bytes32[]' },
318
+ ],
319
+ name: 'getDataBatchForTokenIds',
320
+ outputs: [{ internalType: 'bytes[]', name: 'dataValues', type: 'bytes[]' }],
321
+ stateMutability: 'view',
322
+ type: 'function',
323
+ },
324
+ {
325
+ inputs: [
326
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
327
+ { internalType: 'bytes32', name: 'dataKey', type: 'bytes32' },
328
+ ],
329
+ name: 'getDataForTokenId',
330
+ outputs: [{ internalType: 'bytes', name: 'dataValue', type: 'bytes' }],
331
+ stateMutability: 'view',
332
+ type: 'function',
333
+ },
334
+ {
335
+ inputs: [{ internalType: 'bytes32', name: 'tokenId', type: 'bytes32' }],
336
+ name: 'getOperatorsOf',
337
+ outputs: [{ internalType: 'address[]', name: '', type: 'address[]' }],
338
+ stateMutability: 'view',
339
+ type: 'function',
340
+ },
341
+ {
342
+ inputs: [
343
+ { internalType: 'address', name: 'to', type: 'address' },
344
+ { internalType: 'uint32', name: 'seed', type: 'uint32' },
345
+ { internalType: 'address', name: 'fractal', type: 'address' },
346
+ ],
347
+ name: 'inject',
348
+ outputs: [],
349
+ stateMutability: 'nonpayable',
350
+ type: 'function',
351
+ },
352
+ {
353
+ inputs: [
354
+ { internalType: 'address', name: 'operator', type: 'address' },
355
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
356
+ ],
357
+ name: 'isOperatorFor',
358
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
359
+ stateMutability: 'view',
360
+ type: 'function',
361
+ },
362
+ {
363
+ inputs: [
364
+ { internalType: 'address', name: 'fractal', type: 'address' },
365
+ { internalType: 'address', name: 'owner', type: 'address' },
366
+ { internalType: 'address', name: 'registry', type: 'address' },
367
+ ],
368
+ name: 'migrate',
369
+ outputs: [],
370
+ stateMutability: 'nonpayable',
371
+ type: 'function',
372
+ },
373
+ {
374
+ inputs: [
375
+ { internalType: 'address', name: 'to', type: 'address' },
376
+ { internalType: 'uint32', name: 'seed', type: 'uint32' },
377
+ ],
378
+ name: 'mint',
379
+ outputs: [],
380
+ stateMutability: 'nonpayable',
381
+ type: 'function',
382
+ },
383
+ {
384
+ inputs: [{ internalType: 'uint32', name: '', type: 'uint32' }],
385
+ name: 'minted',
386
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
387
+ stateMutability: 'view',
388
+ type: 'function',
389
+ },
390
+ {
391
+ inputs: [],
392
+ name: 'owner',
393
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
394
+ stateMutability: 'view',
395
+ type: 'function',
396
+ },
397
+ {
398
+ inputs: [{ internalType: 'bool', name: '_paused', type: 'bool' }],
399
+ name: 'pause',
400
+ outputs: [],
401
+ stateMutability: 'nonpayable',
402
+ type: 'function',
403
+ },
404
+ {
405
+ inputs: [],
406
+ name: 'paused',
407
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
408
+ stateMutability: 'view',
409
+ type: 'function',
410
+ },
411
+ {
412
+ inputs: [
413
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
414
+ { internalType: 'uint256', name: 'iters', type: 'uint256' },
415
+ ],
416
+ name: 'refine',
417
+ outputs: [],
418
+ stateMutability: 'nonpayable',
419
+ type: 'function',
420
+ },
421
+ {
422
+ inputs: [],
423
+ name: 'renounceOwnership',
424
+ outputs: [],
425
+ stateMutability: 'nonpayable',
426
+ type: 'function',
427
+ },
428
+ {
429
+ inputs: [
430
+ { internalType: 'address', name: 'operator', type: 'address' },
431
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
432
+ { internalType: 'bool', name: 'notify', type: 'bool' },
433
+ {
434
+ internalType: 'bytes',
435
+ name: 'operatorNotificationData',
436
+ type: 'bytes',
437
+ },
438
+ ],
439
+ name: 'revokeOperator',
440
+ outputs: [],
441
+ stateMutability: 'nonpayable',
442
+ type: 'function',
443
+ },
444
+ {
445
+ inputs: [{ internalType: 'address', name: '', type: 'address' }],
446
+ name: 'seeds',
447
+ outputs: [{ internalType: 'uint32', name: '', type: 'uint32' }],
448
+ stateMutability: 'view',
449
+ type: 'function',
450
+ },
451
+ {
452
+ inputs: [
453
+ { internalType: 'bytes32', name: 'dataKey', type: 'bytes32' },
454
+ { internalType: 'bytes', name: 'dataValue', type: 'bytes' },
455
+ ],
456
+ name: 'setData',
457
+ outputs: [],
458
+ stateMutability: 'payable',
459
+ type: 'function',
460
+ },
461
+ {
462
+ inputs: [
463
+ { internalType: 'bytes32[]', name: 'dataKeys', type: 'bytes32[]' },
464
+ { internalType: 'bytes[]', name: 'dataValues', type: 'bytes[]' },
465
+ ],
466
+ name: 'setDataBatch',
467
+ outputs: [],
468
+ stateMutability: 'payable',
469
+ type: 'function',
470
+ },
471
+ {
472
+ inputs: [
473
+ { internalType: 'bytes32[]', name: 'tokenIds', type: 'bytes32[]' },
474
+ { internalType: 'bytes32[]', name: 'dataKeys', type: 'bytes32[]' },
475
+ { internalType: 'bytes[]', name: 'dataValues', type: 'bytes[]' },
476
+ ],
477
+ name: 'setDataBatchForTokenIds',
478
+ outputs: [],
479
+ stateMutability: 'nonpayable',
480
+ type: 'function',
481
+ },
482
+ {
483
+ inputs: [
484
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
485
+ { internalType: 'bytes32', name: 'dataKey', type: 'bytes32' },
486
+ { internalType: 'bytes', name: 'dataValue', type: 'bytes' },
487
+ ],
488
+ name: 'setDataForTokenId',
489
+ outputs: [],
490
+ stateMutability: 'nonpayable',
491
+ type: 'function',
492
+ },
493
+ {
494
+ inputs: [{ internalType: 'bytes4', name: 'interfaceId', type: 'bytes4' }],
495
+ name: 'supportsInterface',
496
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
497
+ stateMutability: 'view',
498
+ type: 'function',
499
+ },
500
+ {
501
+ inputs: [{ internalType: 'uint256', name: 'index', type: 'uint256' }],
502
+ name: 'tokenAt',
503
+ outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }],
504
+ stateMutability: 'view',
505
+ type: 'function',
506
+ },
507
+ {
508
+ inputs: [{ internalType: 'address', name: 'tokenOwner', type: 'address' }],
509
+ name: 'tokenIdsOf',
510
+ outputs: [{ internalType: 'bytes32[]', name: '', type: 'bytes32[]' }],
511
+ stateMutability: 'view',
512
+ type: 'function',
513
+ },
514
+ {
515
+ inputs: [{ internalType: 'bytes32', name: 'tokenId', type: 'bytes32' }],
516
+ name: 'tokenOwnerOf',
517
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
518
+ stateMutability: 'view',
519
+ type: 'function',
520
+ },
521
+ {
522
+ inputs: [],
523
+ name: 'totalSupply',
524
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
525
+ stateMutability: 'view',
526
+ type: 'function',
527
+ },
528
+ {
529
+ inputs: [
530
+ { internalType: 'address', name: 'from', type: 'address' },
531
+ { internalType: 'address', name: 'to', type: 'address' },
532
+ { internalType: 'bytes32', name: 'tokenId', type: 'bytes32' },
533
+ { internalType: 'bool', name: 'force', type: 'bool' },
534
+ { internalType: 'bytes', name: 'data', type: 'bytes' },
535
+ ],
536
+ name: 'transfer',
537
+ outputs: [],
538
+ stateMutability: 'nonpayable',
539
+ type: 'function',
540
+ },
541
+ {
542
+ inputs: [
543
+ { internalType: 'address[]', name: 'from', type: 'address[]' },
544
+ { internalType: 'address[]', name: 'to', type: 'address[]' },
545
+ { internalType: 'bytes32[]', name: 'tokenId', type: 'bytes32[]' },
546
+ { internalType: 'bool[]', name: 'force', type: 'bool[]' },
547
+ { internalType: 'bytes[]', name: 'data', type: 'bytes[]' },
548
+ ],
549
+ name: 'transferBatch',
550
+ outputs: [],
551
+ stateMutability: 'nonpayable',
552
+ type: 'function',
553
+ },
554
+ {
555
+ inputs: [{ internalType: 'address', name: 'newOwner', type: 'address' }],
556
+ name: 'transferOwnership',
557
+ outputs: [],
558
+ stateMutability: 'nonpayable',
559
+ type: 'function',
560
+ },
561
+ { stateMutability: 'payable', type: 'receive' },
562
+ ]
@@ -0,0 +1,132 @@
1
+ import { standardAggregation } from '../aggregation'
2
+ import { decodeEvent } from '../events'
3
+ import type {
4
+ DecodeEventResult,
5
+ DecoderOptions,
6
+ DecoderResult,
7
+ PluginOptions,
8
+ ResultAggregate,
9
+ } from '../types'
10
+ import { createAggregationKey, standardPlugin } from '.'
11
+ import { enhanceSetData } from './enhanceSetData'
12
+ import RegistryAbi from './RegistryAbi'
13
+
14
+ // Define aggregation state type
15
+ interface RefineAggregationState {
16
+ callerCounts: Record<
17
+ string,
18
+ { count: number; tokenIds: Record<`0x${string}:${string}`, number> }
19
+ >
20
+ minBlock: number
21
+ maxBlock: number
22
+ count: number
23
+ }
24
+
25
+ // Create the refine aggregation
26
+ const refineAggregation = standardAggregation<RefineAggregationState>({
27
+ key: 'refine',
28
+
29
+ map: (tx) => {
30
+ // Only process refine calls
31
+ if ('functionName' in tx && tx.functionName === 'refine' && tx.from) {
32
+ return {
33
+ callerCounts: {
34
+ [tx.from.toLowerCase()]: {
35
+ count: 1,
36
+ tokenIds: {
37
+ [`${tx.to}:${('args' in tx ? tx?.args?.[0]?.value : undefined) ?? 'none'}`]: 1,
38
+ },
39
+ },
40
+ },
41
+ minBlock: Number(tx.blockNumber),
42
+ maxBlock: Number(tx.blockNumber),
43
+ count: 1,
44
+ }
45
+ }
46
+ return undefined
47
+ },
48
+
49
+ reduce: (state, mapped) => {
50
+ if (!state) return mapped
51
+
52
+ // Merge caller counts
53
+ const callerCounts = { ...state.callerCounts }
54
+ for (const [caller, { count, tokenIds }] of Object.entries(
55
+ mapped.callerCounts
56
+ )) {
57
+ const item = callerCounts[caller] ?? { count: 0, tokenIds: {} }
58
+ item.count += count
59
+ item.tokenIds = {
60
+ ...item.tokenIds,
61
+ ...tokenIds,
62
+ }
63
+ }
64
+
65
+ return {
66
+ callerCounts,
67
+ minBlock: Math.min(state.minBlock, mapped.minBlock),
68
+ maxBlock: Math.max(state.maxBlock, mapped.maxBlock),
69
+ count: state.count + mapped.count,
70
+ }
71
+ },
72
+
73
+ finalize: (state): Omit<ResultAggregate, 'resultType'> => {
74
+ const stats = Object.entries(state.callerCounts)
75
+ .sort(([, a], [, b]) => b.count - a.count)
76
+ .slice(0, 10)
77
+ .map(([address, { count, tokenIds }]) => {
78
+ const tokens = Object.entries(tokenIds)
79
+ .sort(([, a], [, b]) => b - a)
80
+ .slice(0, 5)
81
+ .map(([token]) => token)
82
+ return { address, count, tokens }
83
+ })
84
+ return {
85
+ aggregate: {
86
+ count: state.count,
87
+ from: stats.map(({ address }) => address),
88
+ tokens: stats.flatMap(({ tokens }) => tokens),
89
+ blockRange: {
90
+ from: state.minBlock,
91
+ to: state.maxBlock,
92
+ },
93
+ },
94
+ }
95
+ },
96
+ })
97
+
98
+ export const enhanceBurntPixPlugin = standardPlugin(
99
+ RegistryAbi,
100
+ {
101
+ name: 'burntpix',
102
+ abiName: 'BurntPix',
103
+ decoderName: '@lukso/burntpix',
104
+ priority: 50,
105
+ },
106
+ {
107
+ enhance: enhanceBurntPix,
108
+ decodeEvent: async (log: DecodeEventResult, options: DecoderOptions) => {
109
+ return decodeEvent(options.chain, RegistryAbi, log)
110
+ },
111
+ aggregations: [refineAggregation],
112
+ }
113
+ )
114
+
115
+ export async function enhanceBurntPix(
116
+ result: DecoderResult,
117
+ pluginOptions: PluginOptions,
118
+ options: DecoderOptions
119
+ ): Promise<DecoderResult | undefined> {
120
+ // Mark refine transactions as aggregatable
121
+ if ('functionName' in result && result.functionName === 'refine') {
122
+ return {
123
+ ...result,
124
+ standard: pluginOptions.abiName,
125
+ __decoder: pluginOptions.decoderName,
126
+ aggregationKeys: [createAggregationKey(pluginOptions, 'refine')],
127
+ } as DecoderResult
128
+ }
129
+ return undefined
130
+ }
131
+
132
+ export default enhanceBurntPixPlugin