@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
@@ -804,7 +804,7 @@ var getDataFromExternalSources = /* @__PURE__ */ __name((schemas, dataFromChain,
804
804
  urlDataWithHash,
805
805
  ipfsGateway
806
806
  ));
807
- let length = "unknown";
807
+ let _length = "unknown";
808
808
  if (!url.startsWith("data:") && /[=?/]$/.test(url)) {
809
809
  return dataEntry;
810
810
  }
@@ -816,7 +816,7 @@ var getDataFromExternalSources = /* @__PURE__ */ __name((schemas, dataFromChain,
816
816
  }
817
817
  return response.arrayBuffer().then((buffer) => new Uint8Array(buffer));
818
818
  });
819
- length = receivedData.length.toString();
819
+ _length = receivedData.length.toString();
820
820
  const captureHashes = {};
821
821
  const captureErrors = [];
822
822
  if (receivedData.length >= 2) {
@@ -936,7 +936,7 @@ function decodeKeyValuePlugin(defaultSchema2, process2) {
936
936
  });
937
937
  if (schema) {
938
938
  try {
939
- const name = schema.name.replace(/[:\[\]]|<.*?>/g, "");
939
+ const name = schema.name.replace(/[:[\]]|<.*?>/g, "");
940
940
  if (schema.keyType === "Array") {
941
941
  if (schema.key === key) {
942
942
  const hexString = value.slice(2);
@@ -944,7 +944,7 @@ function decodeKeyValuePlugin(defaultSchema2, process2) {
944
944
  for (let i = 0; i < hexString.length; i += 2) {
945
945
  all[i / 2] = Number.parseInt(hexString.substring(i, i + 2), 16);
946
946
  }
947
- const [{ start, end } = { start: 0, end: 0 }] = all.reduce(
947
+ const [{ start: _start, end } = { start: 0, end: 0 }] = all.reduce(
948
948
  (acc, byte, index_) => {
949
949
  let isZero = byte === 0 || index_ === 0;
950
950
  const last = acc.at(-1);
@@ -1010,7 +1010,7 @@ function decodeKeyValuePlugin(defaultSchema2, process2) {
1010
1010
  value: data2
1011
1011
  };
1012
1012
  }
1013
- let dynamicKeyParts = void 0;
1013
+ let dynamicKeyParts;
1014
1014
  if (isDynamicKeyName(schema.name)) {
1015
1015
  dynamicKeyParts = decodeMappingKey(key, schema).map(
1016
1016
  ({ value: value2 }) => isHex2(value2) ? value2.toLowerCase() : `${value2}`
@@ -1574,9 +1574,9 @@ function customDecodeEventLog(parameters) {
1574
1574
  };
1575
1575
  }
1576
1576
  __name(customDecodeEventLog, "customDecodeEventLog");
1577
- function decodeEvent(chain, abi3, log) {
1578
- const { data: _data, address, ...rest } = log;
1579
- let lastError;
1577
+ function decodeEvent(_chain, abi3, log) {
1578
+ const { data: _data } = log;
1579
+ let _lastError;
1580
1580
  try {
1581
1581
  const result = customDecodeEventLog({
1582
1582
  abi: abi3,
@@ -2228,7 +2228,7 @@ var enhanceBurntPixPlugin = standardPlugin(
2228
2228
  aggregations: [refineAggregation]
2229
2229
  }
2230
2230
  );
2231
- async function enhanceBurntPix(result, pluginOptions, options) {
2231
+ async function enhanceBurntPix(result, pluginOptions, _options) {
2232
2232
  if ("functionName" in result && result.functionName === "refine") {
2233
2233
  return {
2234
2234
  ...result,
@@ -2243,25 +2243,20 @@ __name(enhanceBurntPix, "enhanceBurntPix");
2243
2243
  var enhanceBurntPix_default = enhanceBurntPixPlugin;
2244
2244
 
2245
2245
  // src/decoder/plugins/enhanceGraffiti.ts
2246
- import {
2247
- bytesToString,
2248
- hexToBytes,
2249
- size as size3,
2250
- slice as slice2
2251
- } from "viem";
2246
+ import { bytesToString, hexToBytes, size as size3, slice as slice2 } from "viem";
2252
2247
  var enhanceGraffitiPlugin = Object.freeze({
2253
2248
  enhance: /* @__PURE__ */ __name(async (result, options) => enhanceGraffiti(
2254
2249
  result,
2255
2250
  { abiName: "graffiti", decoderName: "graffiti" },
2256
2251
  options
2257
2252
  ), "enhance"),
2258
- decodeEvent: /* @__PURE__ */ __name(async (log, options) => void 0, "decodeEvent"),
2253
+ decodeEvent: /* @__PURE__ */ __name(async (_log, _options) => void 0, "decodeEvent"),
2259
2254
  required: true,
2260
2255
  priority: 1e3,
2261
2256
  name: "graffiti"
2262
2257
  });
2263
2258
  async function enhanceGraffiti(result, _pluginOptions, _options) {
2264
- const { functionName, sig, args, input } = result;
2259
+ const { input } = result;
2265
2260
  if (input && size3(input || "0x") >= 4 && slice2(input || "0x", 0, 4) === "0x00000000") {
2266
2261
  let graffiti = slice2(input, 4);
2267
2262
  try {
@@ -2333,7 +2328,7 @@ async function decodeTransaction(fullTransaction, options) {
2333
2328
  phase: "enhanced"
2334
2329
  };
2335
2330
  }
2336
- let lastError;
2331
+ let _lastError;
2337
2332
  const activePlugins = options.plugins;
2338
2333
  for (const plugin of activePlugins) {
2339
2334
  if (to && isAddress(to) && isAddressEqual(to, zeroAddress)) {
@@ -2396,7 +2391,6 @@ async function decodeTransaction(fullTransaction, options) {
2396
2391
  }
2397
2392
  } catch (e) {
2398
2393
  console.error(e);
2399
- continue;
2400
2394
  }
2401
2395
  }
2402
2396
  let phase = "functionName" in transaction && transaction.functionName && transaction.standard || transaction.input === "0x" || !transaction.input ? "enhanced" : "immediate";
@@ -3322,7 +3316,6 @@ async function enhanceKeyManager(result, pluginOptions, options) {
3322
3316
  sig,
3323
3317
  args,
3324
3318
  input,
3325
- blockNumber,
3326
3319
  to: _to,
3327
3320
  from: _from,
3328
3321
  value
@@ -3592,7 +3585,7 @@ async function enhanceLSP7Metadata(result, options) {
3592
3585
  }
3593
3586
  __name(enhanceLSP7Metadata, "enhanceLSP7Metadata");
3594
3587
  async function enhanceLSP26FollowerSystem(result, _pluginOptions, _options) {
3595
- const { functionName, sig, args, input, blockNumber, to, from, value } = result;
3588
+ const { functionName } = result;
3596
3589
  switch (functionName) {
3597
3590
  }
3598
3591
  return void 0;
@@ -3752,8 +3745,8 @@ var enhanceLSP9VaultPlugin = standardPlugin(
3752
3745
  }, "decodeEvent")
3753
3746
  }
3754
3747
  );
3755
- async function enhanceLSP9Vault(result, pluginOptions, options) {
3756
- const { functionName, sig, args, input, blockNumber, to, from, value } = result;
3748
+ async function enhanceLSP9Vault(result, _pluginOptions, _options) {
3749
+ const { functionName } = result;
3757
3750
  switch (functionName) {
3758
3751
  }
3759
3752
  return void 0;
@@ -3784,7 +3777,7 @@ var enhanceLSP26FollowerSystemPlugin = standardPlugin(
3784
3777
  }
3785
3778
  );
3786
3779
  async function enhanceLSP26FollowerSystem2(result, _pluginOptions, _options) {
3787
- const { functionName, sig, args, input, blockNumber, to, from, value } = result;
3780
+ const { functionName, args } = result;
3788
3781
  const { args: _args, ...partialResult } = result;
3789
3782
  switch (functionName) {
3790
3783
  case "follow":
@@ -3800,7 +3793,6 @@ async function enhanceLSP26FollowerSystem2(result, _pluginOptions, _options) {
3800
3793
  }
3801
3794
  ]
3802
3795
  };
3803
- break;
3804
3796
  case "followBatch":
3805
3797
  case "unfollowBatch":
3806
3798
  return {
@@ -3812,7 +3804,6 @@ async function enhanceLSP26FollowerSystem2(result, _pluginOptions, _options) {
3812
3804
  address
3813
3805
  }))
3814
3806
  };
3815
- break;
3816
3807
  }
3817
3808
  return void 0;
3818
3809
  }
@@ -4528,7 +4519,7 @@ var LRUDecoderCache = class {
4528
4519
  if (cached && (!cached.expires || now < cached.expires)) {
4529
4520
  return cached.value;
4530
4521
  }
4531
- if (cached && cached.stale && now < cached.stale && !this.promises.has(key)) {
4522
+ if (cached?.stale && now < cached.stale && !this.promises.has(key)) {
4532
4523
  const backgroundPromise = factory(options?.signal).then(async (fresh) => {
4533
4524
  await this.set(key, fresh, options);
4534
4525
  return fresh;
@@ -4610,7 +4601,7 @@ async function fetchAbi(chain, address, options) {
4610
4601
  let isProxy = false;
4611
4602
  let decoderVerifiedContract = false;
4612
4603
  let factoryName;
4613
- const originalKey = key;
4604
+ const _originalKey = key;
4614
4605
  const addressUrl = new URL(`/api/v2/addresses/${key}`, explorer);
4615
4606
  const addressRes = await fetch(addressUrl, { signal });
4616
4607
  if (addressRes.ok) {
@@ -4778,7 +4769,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
4778
4769
  __decoder: methods.__decoder || FUNCTION_DICTIONARY_URL
4779
4770
  };
4780
4771
  }
4781
- } catch (error) {
4772
+ } catch (_error) {
4782
4773
  }
4783
4774
  }
4784
4775
  }
@@ -4817,7 +4808,7 @@ var enhanceRetrieveAbiPlugin = standardPlugin(
4817
4808
  }
4818
4809
  );
4819
4810
  async function enhanceRetrieveAbi(result, _pluginOptions, options) {
4820
- const { functionName, sig, args, input, blockNumber, to, from, value } = result;
4811
+ const { input, to, from, value } = result;
4821
4812
  try {
4822
4813
  const decoded = await getFunctionSignature(
4823
4814
  options.chain,
@@ -4844,7 +4835,9 @@ __name(enhanceRetrieveAbi, "enhanceRetrieveAbi");
4844
4835
  var enhanceRetrieveAbi_default = enhanceRetrieveAbiPlugin;
4845
4836
 
4846
4837
  // src/decoder/plugins/index.ts
4847
- [enhanceLSP0ERC725Account_default, enhanceLSP6KeyManager_default, enhanceLSP7DigitalAsset_default, enhanceLSP8IdentifiableDigitalAsset_default, enhanceLSP9Vault_default, enhanceLSP26FollowerSystem_default, enhanceBurntPix_default].forEach((p) => p);
4838
+ [enhanceLSP0ERC725Account_default, enhanceLSP6KeyManager_default, enhanceLSP7DigitalAsset_default, enhanceLSP8IdentifiableDigitalAsset_default, enhanceLSP9Vault_default, enhanceLSP26FollowerSystem_default, enhanceBurntPix_default].forEach((p) => {
4839
+ p;
4840
+ });
4848
4841
  var defaultPlugins = Object.freeze([
4849
4842
  enhanceGraffiti_default,
4850
4843
  enhanceLSP6KeyManager_default,
@@ -4922,4 +4915,4 @@ export {
4922
4915
  decodeKeyValue,
4923
4916
  decodeKeyValueRaw
4924
4917
  };
4925
- //# sourceMappingURL=chunk-XVHJWV5U.js.map
4918
+ //# sourceMappingURL=chunk-T4H2HHIB.js.map