@lukso/transaction-decoder 1.3.0 → 1.3.1-dev.360c7b1

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 (71) hide show
  1. package/dist/browser.cjs +41 -73
  2. package/dist/browser.cjs.map +1 -1
  3. package/dist/browser.d.cts +1 -1
  4. package/dist/browser.d.ts +1 -1
  5. package/dist/browser.js +4 -4
  6. package/dist/cdn/transaction-decoder.global.js +13 -13
  7. package/dist/cdn/transaction-decoder.global.js.map +1 -1
  8. package/dist/{chunk-G7JZHSYX.js → chunk-2ZO6MJJX.js} +11 -12
  9. package/dist/chunk-2ZO6MJJX.js.map +1 -0
  10. package/dist/{chunk-GGBHTWJL.js → chunk-FKBKAWB3.js} +5 -5
  11. package/dist/chunk-FKBKAWB3.js.map +1 -0
  12. package/dist/{chunk-GXZOF3QY.js → chunk-NDBDNXBI.js} +3 -27
  13. package/dist/chunk-NDBDNXBI.js.map +1 -0
  14. package/dist/{chunk-XVHJWV5U.js → chunk-T4H2HHIB.js} +25 -32
  15. package/dist/chunk-T4H2HHIB.js.map +1 -0
  16. package/dist/data.cjs +31 -62
  17. package/dist/data.cjs.map +1 -1
  18. package/dist/data.d.cts +2 -2
  19. package/dist/data.d.ts +2 -2
  20. package/dist/data.js +2 -2
  21. package/dist/index.cjs +41 -73
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +2 -2
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.js +4 -4
  26. package/dist/server.cjs +31 -43
  27. package/dist/server.cjs.map +1 -1
  28. package/dist/server.d.cts +1 -2
  29. package/dist/server.d.ts +1 -2
  30. package/dist/server.js +7 -12
  31. package/dist/server.js.map +1 -1
  32. package/dist/{utils-CBAkjQh3.d.cts → utils-BEpSreRR.d.cts} +1 -1
  33. package/dist/{utils-xT9-km0r.d.ts → utils-De_c6fUK.d.ts} +1 -1
  34. package/package.json +3 -3
  35. package/src/core/dataModel.ts +1 -31
  36. package/src/core/integrateDecoder.ts +1 -2
  37. package/src/decoder/browserCache.ts +1 -6
  38. package/src/decoder/errors.ts +2 -2
  39. package/src/decoder/events.ts +3 -3
  40. package/src/decoder/functionSignature.ts +9 -9
  41. package/src/decoder/getDataFromExternalSources.ts +2 -2
  42. package/src/decoder/interfaces.ts +1 -1
  43. package/src/decoder/kvCache.ts +1 -6
  44. package/src/decoder/lruCache.ts +1 -6
  45. package/src/decoder/lsp7TransferBatch.test.ts +0 -3
  46. package/src/decoder/plugins/enhanceBurntPix.ts +1 -2
  47. package/src/decoder/plugins/enhanceGraffiti.ts +3 -17
  48. package/src/decoder/plugins/enhanceLSP26FollowerSystem.ts +4 -8
  49. package/src/decoder/plugins/enhanceLSP6KeyManager.ts +0 -1
  50. package/src/decoder/plugins/enhanceLSP7DigitalAsset.ts +5 -7
  51. package/src/decoder/plugins/enhanceLSP9Vault.ts +7 -8
  52. package/src/decoder/plugins/enhanceRetrieveAbi.ts +5 -6
  53. package/src/decoder/plugins/index.ts +3 -1
  54. package/src/decoder/plugins/schemaDefault.ts +3 -4
  55. package/src/decoder/plugins/standardPlugin.ts +1 -1
  56. package/src/decoder/singleGQL.ts +2 -2
  57. package/src/decoder/transaction.ts +1 -2
  58. package/src/decoder/utils.ts +2 -2
  59. package/src/example/usage.ts +3 -4
  60. package/src/server/addressResolver.ts +1 -1
  61. package/src/server/decodeTransactionSync.ts +0 -1
  62. package/src/server/decodeTransactionsBatch.ts +1 -1
  63. package/src/server/finishDecoding.ts +4 -8
  64. package/src/server/lsp23Resolver.ts +2 -3
  65. package/src/server/types.ts +1 -1
  66. package/src/shared/addressResolver.ts +4 -4
  67. package/src/utils/json-bigint.ts +4 -4
  68. package/dist/chunk-G7JZHSYX.js.map +0 -1
  69. package/dist/chunk-GGBHTWJL.js.map +0 -1
  70. package/dist/chunk-GXZOF3QY.js.map +0 -1
  71. package/dist/chunk-XVHJWV5U.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as TransactionAddressResolver, T as TransactionDecoderResult, i as consumerModel, l as createAggregationKey, j as createGlobalInstance, a as decodeTransaction, k as decodeTransactionAsync, m as defaultPlugins, n as defaultSchemaPlugins, p as getArgByName, q as needsEnhancement, o as standardPlugin, s as standardSchemaPlugin } from './utils-CBAkjQh3.cjs';
1
+ export { A as TransactionAddressResolver, T as TransactionDecoderResult, i as consumerModel, l as createAggregationKey, j as createGlobalInstance, a as decodeTransaction, k as decodeTransactionAsync, m as defaultPlugins, n as defaultSchemaPlugins, p as getArgByName, q as needsEnhancement, o as standardPlugin, s as standardSchemaPlugin } from './utils-BEpSreRR.cjs';
2
2
  import * as viem from 'viem';
3
3
  import { Chain, Hex, Address } from 'viem';
4
4
  import * as _preact_signals_core from '@preact/signals-core';
@@ -716,7 +716,7 @@ declare const JSONbigString: {
716
716
  /**
717
717
  * Stringify an object, converting BigInt values to strings with 'n' suffix
718
718
  */
719
- stringify: (obj: any, replacer?: any, space?: string | number) => string;
719
+ stringify: (obj: any, _replacer?: any, space?: string | number) => string;
720
720
  /**
721
721
  * Parse a JSON string, converting strings ending with 'n' back to BigInt
722
722
  */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as TransactionAddressResolver, T as TransactionDecoderResult, i as consumerModel, l as createAggregationKey, j as createGlobalInstance, a as decodeTransaction, k as decodeTransactionAsync, m as defaultPlugins, n as defaultSchemaPlugins, p as getArgByName, q as needsEnhancement, o as standardPlugin, s as standardSchemaPlugin } from './utils-xT9-km0r.js';
1
+ export { A as TransactionAddressResolver, T as TransactionDecoderResult, i as consumerModel, l as createAggregationKey, j as createGlobalInstance, a as decodeTransaction, k as decodeTransactionAsync, m as defaultPlugins, n as defaultSchemaPlugins, p as getArgByName, q as needsEnhancement, o as standardPlugin, s as standardSchemaPlugin } from './utils-De_c6fUK.js';
2
2
  import * as viem from 'viem';
3
3
  import { Chain, Hex, Address } from 'viem';
4
4
  import * as _preact_signals_core from '@preact/signals-core';
@@ -716,7 +716,7 @@ declare const JSONbigString: {
716
716
  /**
717
717
  * Stringify an object, converting BigInt values to strings with 'n' suffix
718
718
  */
719
- stringify: (obj: any, replacer?: any, space?: string | number) => string;
719
+ stringify: (obj: any, _replacer?: any, space?: string | number) => string;
720
720
  /**
721
721
  * Parse a JSON string, converting strings ending with 'n' back to BigInt
722
722
  */
package/dist/index.js CHANGED
@@ -35,19 +35,19 @@ import {
35
35
  parseLSP23DeploymentsFromHypersync,
36
36
  resolveAddresses,
37
37
  subscribe
38
- } from "./chunk-G7JZHSYX.js";
38
+ } from "./chunk-2ZO6MJJX.js";
39
39
  import {
40
40
  consumerModel,
41
41
  createGlobalInstance,
42
42
  decodeTransaction,
43
43
  decodeTransactionAsync
44
- } from "./chunk-GXZOF3QY.js";
44
+ } from "./chunk-NDBDNXBI.js";
45
45
  import {
46
46
  fetchMultipleAddresses,
47
47
  fetchProfilesByControllers,
48
48
  getGraphQLEndpoint,
49
49
  getImage
50
- } from "./chunk-GGBHTWJL.js";
50
+ } from "./chunk-FKBKAWB3.js";
51
51
  import {
52
52
  PluginAggregationEngine,
53
53
  collectDataKeys,
@@ -65,7 +65,7 @@ import {
65
65
  standardAggregation,
66
66
  standardPlugin,
67
67
  standardSchemaPlugin
68
- } from "./chunk-XVHJWV5U.js";
68
+ } from "./chunk-T4H2HHIB.js";
69
69
  export {
70
70
  AddressResolver,
71
71
  DEPLOY_ERC1167_PROXIES_SELECTOR,
package/dist/server.cjs CHANGED
@@ -201,7 +201,7 @@ async function fetchMultipleAddresses(addresses, graphqlEndpoint, cache) {
201
201
  }
202
202
  if (data.Token) {
203
203
  for (const token of data.Token) {
204
- const { id, baseAsset, tokenId, ...rest } = token;
204
+ const { id: _id, baseAsset, tokenId, ...rest } = token;
205
205
  if (baseAsset?.id && tokenId) {
206
206
  const enhancedInfo = {
207
207
  address: baseAsset.id,
@@ -326,9 +326,8 @@ query ProfilesByController($controllerAddresses: [String!]) {
326
326
 
327
327
  // src/server/addressResolver.ts
328
328
  var ServerAddressResolver = class {
329
- constructor(graphqlEndpoint, chain, caches2) {
329
+ constructor(graphqlEndpoint, _chain, caches2) {
330
330
  this.graphqlEndpoint = graphqlEndpoint;
331
- this.chain = chain;
332
331
  this.caches = caches2;
333
332
  this.cacheAdapter = {
334
333
  get: /* @__PURE__ */ __name((key) => this.caches.getAddress(key), "get"),
@@ -968,7 +967,7 @@ async function decodeTransaction(fullTransaction, options) {
968
967
  phase: "enhanced"
969
968
  };
970
969
  }
971
- let lastError;
970
+ let _lastError;
972
971
  const activePlugins = options.plugins;
973
972
  for (const plugin of activePlugins) {
974
973
  if (to && isAddress(to) && isAddressEqual(to, zeroAddress)) {
@@ -1031,7 +1030,6 @@ async function decodeTransaction(fullTransaction, options) {
1031
1030
  }
1032
1031
  } catch (e) {
1033
1032
  console.error(e);
1034
- continue;
1035
1033
  }
1036
1034
  }
1037
1035
  let phase = "functionName" in transaction && transaction.functionName && transaction.standard || transaction.input === "0x" || !transaction.input ? "enhanced" : "immediate";
@@ -1251,7 +1249,7 @@ async function decodeTransactionsBatch(transactions, options, caches2) {
1251
1249
  }
1252
1250
  return decodeTransaction(tx, enhancedOptionsArray[i]);
1253
1251
  });
1254
- const remainingTime = timeoutMs * 0.6 - phase1Time;
1252
+ const _remainingTime = timeoutMs * 0.6 - phase1Time;
1255
1253
  const enhancedResults = await Promise.all(enhancePromises);
1256
1254
  enhancedResults.forEach((enhanced, i) => {
1257
1255
  if (enhanced) {
@@ -1360,19 +1358,15 @@ __name(createDebug, "createDebug");
1360
1358
  var debug_default = createDebug;
1361
1359
 
1362
1360
  // src/server/finishDecoding.ts
1363
- var debug = createDebug("decoder:finishDecoding");
1361
+ var _debug = createDebug("decoder:finishDecoding");
1364
1362
  async function finishDecoding(transaction, options, caches2) {
1365
1363
  const startTime = Date.now();
1366
- const {
1367
- timeoutMs = 5e3,
1368
- // Give more time for finishing
1369
- chain
1370
- } = options;
1364
+ const { chain } = options;
1371
1365
  try {
1372
1366
  const txHash = transaction.hash || transaction.transactionHash;
1373
1367
  if (txHash) {
1374
1368
  const cached = caches2.getTransaction(txHash);
1375
- if (cached && cached.enhancementAttempted) {
1369
+ if (cached?.enhancementAttempted) {
1376
1370
  return {
1377
1371
  ...cached,
1378
1372
  cached: true,
@@ -1840,7 +1834,7 @@ var getDataFromExternalSources = /* @__PURE__ */ __name((schemas, dataFromChain,
1840
1834
  urlDataWithHash,
1841
1835
  ipfsGateway
1842
1836
  ));
1843
- let length = "unknown";
1837
+ let _length = "unknown";
1844
1838
  if (!url.startsWith("data:") && /[=?/]$/.test(url)) {
1845
1839
  return dataEntry;
1846
1840
  }
@@ -1852,7 +1846,7 @@ var getDataFromExternalSources = /* @__PURE__ */ __name((schemas, dataFromChain,
1852
1846
  }
1853
1847
  return response.arrayBuffer().then((buffer) => new Uint8Array(buffer));
1854
1848
  });
1855
- length = receivedData.length.toString();
1849
+ _length = receivedData.length.toString();
1856
1850
  const captureHashes = {};
1857
1851
  const captureErrors = [];
1858
1852
  if (receivedData.length >= 2) {
@@ -1972,7 +1966,7 @@ function decodeKeyValuePlugin(defaultSchema2, process2) {
1972
1966
  });
1973
1967
  if (schema) {
1974
1968
  try {
1975
- const name = schema.name.replace(/[:\[\]]|<.*?>/g, "");
1969
+ const name = schema.name.replace(/[:[\]]|<.*?>/g, "");
1976
1970
  if (schema.keyType === "Array") {
1977
1971
  if (schema.key === key) {
1978
1972
  const hexString = value.slice(2);
@@ -1980,7 +1974,7 @@ function decodeKeyValuePlugin(defaultSchema2, process2) {
1980
1974
  for (let i = 0; i < hexString.length; i += 2) {
1981
1975
  all[i / 2] = Number.parseInt(hexString.substring(i, i + 2), 16);
1982
1976
  }
1983
- const [{ start, end } = { start: 0, end: 0 }] = all.reduce(
1977
+ const [{ start: _start, end } = { start: 0, end: 0 }] = all.reduce(
1984
1978
  (acc, byte, index_) => {
1985
1979
  let isZero = byte === 0 || index_ === 0;
1986
1980
  const last = acc.at(-1);
@@ -2046,7 +2040,7 @@ function decodeKeyValuePlugin(defaultSchema2, process2) {
2046
2040
  value: data2
2047
2041
  };
2048
2042
  }
2049
- let dynamicKeyParts = void 0;
2043
+ let dynamicKeyParts;
2050
2044
  if (isDynamicKeyName(schema.name)) {
2051
2045
  dynamicKeyParts = decodeMappingKey(key, schema).map(
2052
2046
  ({ value: value2 }) => isHex2(value2) ? value2.toLowerCase() : `${value2}`
@@ -2304,7 +2298,7 @@ function standardAggregation(config) {
2304
2298
  return Object.freeze(config);
2305
2299
  }
2306
2300
  __name(standardAggregation, "standardAggregation");
2307
- var debug2 = debug_default("decoder:aggregation");
2301
+ var debug = debug_default("decoder:aggregation");
2308
2302
 
2309
2303
  // src/decoder/events.ts
2310
2304
  import {
@@ -2411,9 +2405,9 @@ function customDecodeEventLog(parameters) {
2411
2405
  };
2412
2406
  }
2413
2407
  __name(customDecodeEventLog, "customDecodeEventLog");
2414
- function decodeEvent(chain, abi3, log) {
2415
- const { data: _data, address, ...rest } = log;
2416
- let lastError;
2408
+ function decodeEvent(_chain, abi3, log) {
2409
+ const { data: _data } = log;
2410
+ let _lastError;
2417
2411
  try {
2418
2412
  const result = customDecodeEventLog({
2419
2413
  abi: abi3,
@@ -3065,7 +3059,7 @@ var enhanceBurntPixPlugin = standardPlugin(
3065
3059
  aggregations: [refineAggregation]
3066
3060
  }
3067
3061
  );
3068
- async function enhanceBurntPix(result, pluginOptions, options) {
3062
+ async function enhanceBurntPix(result, pluginOptions, _options) {
3069
3063
  if ("functionName" in result && result.functionName === "refine") {
3070
3064
  return {
3071
3065
  ...result,
@@ -3080,25 +3074,20 @@ __name(enhanceBurntPix, "enhanceBurntPix");
3080
3074
  var enhanceBurntPix_default = enhanceBurntPixPlugin;
3081
3075
 
3082
3076
  // src/decoder/plugins/enhanceGraffiti.ts
3083
- import {
3084
- bytesToString,
3085
- hexToBytes,
3086
- size as size3,
3087
- slice as slice3
3088
- } from "viem";
3077
+ import { bytesToString, hexToBytes, size as size3, slice as slice3 } from "viem";
3089
3078
  var enhanceGraffitiPlugin = Object.freeze({
3090
3079
  enhance: /* @__PURE__ */ __name(async (result, options) => enhanceGraffiti(
3091
3080
  result,
3092
3081
  { abiName: "graffiti", decoderName: "graffiti" },
3093
3082
  options
3094
3083
  ), "enhance"),
3095
- decodeEvent: /* @__PURE__ */ __name(async (log, options) => void 0, "decodeEvent"),
3084
+ decodeEvent: /* @__PURE__ */ __name(async (_log, _options) => void 0, "decodeEvent"),
3096
3085
  required: true,
3097
3086
  priority: 1e3,
3098
3087
  name: "graffiti"
3099
3088
  });
3100
3089
  async function enhanceGraffiti(result, _pluginOptions, _options) {
3101
- const { functionName, sig, args, input } = result;
3090
+ const { input } = result;
3102
3091
  if (input && size3(input || "0x") >= 4 && slice3(input || "0x", 0, 4) === "0x00000000") {
3103
3092
  let graffiti = slice3(input, 4);
3104
3093
  try {
@@ -4017,7 +4006,6 @@ async function enhanceKeyManager(result, pluginOptions, options) {
4017
4006
  sig,
4018
4007
  args,
4019
4008
  input,
4020
- blockNumber,
4021
4009
  to: _to,
4022
4010
  from: _from,
4023
4011
  value
@@ -4287,7 +4275,7 @@ async function enhanceLSP7Metadata(result, options) {
4287
4275
  }
4288
4276
  __name(enhanceLSP7Metadata, "enhanceLSP7Metadata");
4289
4277
  async function enhanceLSP26FollowerSystem(result, _pluginOptions, _options) {
4290
- const { functionName, sig, args, input, blockNumber, to, from, value } = result;
4278
+ const { functionName } = result;
4291
4279
  switch (functionName) {
4292
4280
  }
4293
4281
  return void 0;
@@ -4447,8 +4435,8 @@ var enhanceLSP9VaultPlugin = standardPlugin(
4447
4435
  }, "decodeEvent")
4448
4436
  }
4449
4437
  );
4450
- async function enhanceLSP9Vault(result, pluginOptions, options) {
4451
- const { functionName, sig, args, input, blockNumber, to, from, value } = result;
4438
+ async function enhanceLSP9Vault(result, _pluginOptions, _options) {
4439
+ const { functionName } = result;
4452
4440
  switch (functionName) {
4453
4441
  }
4454
4442
  return void 0;
@@ -4479,7 +4467,7 @@ var enhanceLSP26FollowerSystemPlugin = standardPlugin(
4479
4467
  }
4480
4468
  );
4481
4469
  async function enhanceLSP26FollowerSystem2(result, _pluginOptions, _options) {
4482
- const { functionName, sig, args, input, blockNumber, to, from, value } = result;
4470
+ const { functionName, args } = result;
4483
4471
  const { args: _args, ...partialResult } = result;
4484
4472
  switch (functionName) {
4485
4473
  case "follow":
@@ -4495,7 +4483,6 @@ async function enhanceLSP26FollowerSystem2(result, _pluginOptions, _options) {
4495
4483
  }
4496
4484
  ]
4497
4485
  };
4498
- break;
4499
4486
  case "followBatch":
4500
4487
  case "unfollowBatch":
4501
4488
  return {
@@ -4507,7 +4494,6 @@ async function enhanceLSP26FollowerSystem2(result, _pluginOptions, _options) {
4507
4494
  address
4508
4495
  }))
4509
4496
  };
4510
- break;
4511
4497
  }
4512
4498
  return void 0;
4513
4499
  }
@@ -5223,7 +5209,7 @@ var LRUDecoderCache = class {
5223
5209
  if (cached && (!cached.expires || now < cached.expires)) {
5224
5210
  return cached.value;
5225
5211
  }
5226
- if (cached && cached.stale && now < cached.stale && !this.promises.has(key)) {
5212
+ if (cached?.stale && now < cached.stale && !this.promises.has(key)) {
5227
5213
  const backgroundPromise = factory(options?.signal).then(async (fresh) => {
5228
5214
  await this.set(key, fresh, options);
5229
5215
  return fresh;
@@ -5305,7 +5291,7 @@ async function fetchAbi(chain, address, options) {
5305
5291
  let isProxy = false;
5306
5292
  let decoderVerifiedContract = false;
5307
5293
  let factoryName;
5308
- const originalKey = key;
5294
+ const _originalKey = key;
5309
5295
  const addressUrl = new URL(`/api/v2/addresses/${key}`, explorer);
5310
5296
  const addressRes = await fetch(addressUrl, { signal });
5311
5297
  if (addressRes.ok) {
@@ -5473,7 +5459,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
5473
5459
  __decoder: methods.__decoder || FUNCTION_DICTIONARY_URL
5474
5460
  };
5475
5461
  }
5476
- } catch (error) {
5462
+ } catch (_error) {
5477
5463
  }
5478
5464
  }
5479
5465
  }
@@ -5512,7 +5498,7 @@ var enhanceRetrieveAbiPlugin = standardPlugin(
5512
5498
  }
5513
5499
  );
5514
5500
  async function enhanceRetrieveAbi(result, _pluginOptions, options) {
5515
- const { functionName, sig, args, input, blockNumber, to, from, value } = result;
5501
+ const { input, to, from, value } = result;
5516
5502
  try {
5517
5503
  const decoded = await getFunctionSignature(
5518
5504
  options.chain,
@@ -5539,7 +5525,9 @@ __name(enhanceRetrieveAbi, "enhanceRetrieveAbi");
5539
5525
  var enhanceRetrieveAbi_default = enhanceRetrieveAbiPlugin;
5540
5526
 
5541
5527
  // src/decoder/plugins/index.ts
5542
- [enhanceLSP0ERC725Account_default, enhanceLSP6KeyManager_default, enhanceLSP7DigitalAsset_default, enhanceLSP8IdentifiableDigitalAsset_default, enhanceLSP9Vault_default, enhanceLSP26FollowerSystem_default, enhanceBurntPix_default].forEach((p) => p);
5528
+ [enhanceLSP0ERC725Account_default, enhanceLSP6KeyManager_default, enhanceLSP7DigitalAsset_default, enhanceLSP8IdentifiableDigitalAsset_default, enhanceLSP9Vault_default, enhanceLSP26FollowerSystem_default, enhanceBurntPix_default].forEach((p) => {
5529
+ p;
5530
+ });
5543
5531
  var defaultPlugins = Object.freeze([
5544
5532
  enhanceGraffiti_default,
5545
5533
  enhanceLSP6KeyManager_default,