@lukso/transaction-decoder 1.3.6-dev.4a582bd → 1.3.6-dev.637d4ef

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 (40) hide show
  1. package/dist/browser.cjs +203 -13
  2. package/dist/browser.cjs.map +1 -1
  3. package/dist/browser.d.cts +2 -2
  4. package/dist/browser.d.ts +2 -2
  5. package/dist/browser.js +4 -4
  6. package/dist/cdn/transaction-decoder.global.js +75 -75
  7. package/dist/cdn/transaction-decoder.global.js.map +1 -1
  8. package/dist/{chunk-FKBKAWB3.js → chunk-HFBAO6YR.js} +2 -2
  9. package/dist/{chunk-T4H2HHIB.js → chunk-MGPLCACC.js} +198 -8
  10. package/dist/chunk-MGPLCACC.js.map +1 -0
  11. package/dist/{chunk-SSY7TTU2.js → chunk-MSTGEOTX.js} +4 -4
  12. package/dist/{chunk-NDBDNXBI.js → chunk-RYQVLCCC.js} +2 -2
  13. package/dist/data.cjs +197 -7
  14. package/dist/data.cjs.map +1 -1
  15. package/dist/data.d.cts +3 -3
  16. package/dist/data.d.ts +3 -3
  17. package/dist/data.js +2 -2
  18. package/dist/{index-BzXh7poJ.d.ts → index-BWD9DaG6.d.cts} +6 -1
  19. package/dist/{index-BzXh7poJ.d.cts → index-BWD9DaG6.d.ts} +6 -1
  20. package/dist/index.cjs +203 -13
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +3 -3
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +4 -4
  25. package/dist/server.cjs +197 -7
  26. package/dist/server.cjs.map +1 -1
  27. package/dist/server.d.cts +1 -1
  28. package/dist/server.d.ts +1 -1
  29. package/dist/server.js +2 -2
  30. package/dist/{utils-De_c6fUK.d.ts → utils-4Qdavg8r.d.ts} +2 -2
  31. package/dist/{utils-BEpSreRR.d.cts → utils-OR-XzeYG.d.cts} +2 -2
  32. package/package.json +8 -8
  33. package/src/decoder/lsp7Mint.test.ts +18 -11
  34. package/src/decoder/plugins/enhanceLSP0ERC725Account.ts +39 -2
  35. package/src/decoder/plugins/universalReceiverTypeIds.ts +277 -0
  36. package/src/decoder/types.ts +2 -0
  37. package/dist/chunk-T4H2HHIB.js.map +0 -1
  38. /package/dist/{chunk-FKBKAWB3.js.map → chunk-HFBAO6YR.js.map} +0 -0
  39. /package/dist/{chunk-SSY7TTU2.js.map → chunk-MSTGEOTX.js.map} +0 -0
  40. /package/dist/{chunk-NDBDNXBI.js.map → chunk-RYQVLCCC.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
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';
1
+ export { A as TransactionAddressResolver, T as TransactionDecoderResult, i as consumerModel, j as createAggregationKey, k as createGlobalInstance, f as decodeTransaction, l as decodeTransactionAsync, m as defaultPlugins, n as defaultSchemaPlugins, o as getArgByName, p as needsEnhancement, q as standardPlugin, s as standardSchemaPlugin } from './utils-OR-XzeYG.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';
5
- import { c as DataKey, E as EnhancedInfo, I as IDataModel, h as DecoderOptions, b as DecoderResult, T as TransactionState, n as DecoderPlugin, p as ResultAggregate, m as Aggregation, S as SchemaPlugin, e as Info, d as AddressState } from './index-BzXh7poJ.cjs';
6
- export { j as DecodeEventCallback, a as DecodeEventResult, i as EnhancerCallback, g as IDataModelConsumer, P as PluginOptions, q as ResultCreate, r as ResultError, s as ResultExecute, t as ResultExecuteBatch, u as ResultFollowProfile, v as ResultGrafitti, w as ResultRaw, o as ResultSetData, x as ResultSetDataBatch, y as ResultWrapper } from './index-BzXh7poJ.cjs';
5
+ import { b as DataKey, E as EnhancedInfo, I as IDataModel, h as DecoderOptions, c as DecoderResult, T as TransactionState, n as DecoderPlugin, p as ResultAggregate, m as Aggregation, S as SchemaPlugin, e as Info, d as AddressState } from './index-BWD9DaG6.cjs';
6
+ export { j as DecodeEventCallback, a as DecodeEventResult, i as EnhancerCallback, g as IDataModelConsumer, P as PluginOptions, q as ResultCreate, r as ResultError, s as ResultExecute, t as ResultExecuteBatch, u as ResultFollowProfile, v as ResultGrafitti, w as ResultRaw, o as ResultSetData, x as ResultSetDataBatch, y as ResultWrapper } from './index-BWD9DaG6.cjs';
7
7
  import '@erc725/erc725.js';
8
8
 
9
9
  /**
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
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';
1
+ export { A as TransactionAddressResolver, T as TransactionDecoderResult, i as consumerModel, j as createAggregationKey, k as createGlobalInstance, f as decodeTransaction, l as decodeTransactionAsync, m as defaultPlugins, n as defaultSchemaPlugins, o as getArgByName, p as needsEnhancement, q as standardPlugin, s as standardSchemaPlugin } from './utils-4Qdavg8r.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';
5
- import { c as DataKey, E as EnhancedInfo, I as IDataModel, h as DecoderOptions, b as DecoderResult, T as TransactionState, n as DecoderPlugin, p as ResultAggregate, m as Aggregation, S as SchemaPlugin, e as Info, d as AddressState } from './index-BzXh7poJ.js';
6
- export { j as DecodeEventCallback, a as DecodeEventResult, i as EnhancerCallback, g as IDataModelConsumer, P as PluginOptions, q as ResultCreate, r as ResultError, s as ResultExecute, t as ResultExecuteBatch, u as ResultFollowProfile, v as ResultGrafitti, w as ResultRaw, o as ResultSetData, x as ResultSetDataBatch, y as ResultWrapper } from './index-BzXh7poJ.js';
5
+ import { b as DataKey, E as EnhancedInfo, I as IDataModel, h as DecoderOptions, c as DecoderResult, T as TransactionState, n as DecoderPlugin, p as ResultAggregate, m as Aggregation, S as SchemaPlugin, e as Info, d as AddressState } from './index-BWD9DaG6.js';
6
+ export { j as DecodeEventCallback, a as DecodeEventResult, i as EnhancerCallback, g as IDataModelConsumer, P as PluginOptions, q as ResultCreate, r as ResultError, s as ResultExecute, t as ResultExecuteBatch, u as ResultFollowProfile, v as ResultGrafitti, w as ResultRaw, o as ResultSetData, x as ResultSetDataBatch, y as ResultWrapper } from './index-BWD9DaG6.js';
7
7
  import '@erc725/erc725.js';
8
8
 
9
9
  /**
package/dist/index.js CHANGED
@@ -35,19 +35,19 @@ import {
35
35
  parseLSP23DeploymentsFromHypersync,
36
36
  resolveAddresses,
37
37
  subscribe
38
- } from "./chunk-SSY7TTU2.js";
38
+ } from "./chunk-MSTGEOTX.js";
39
39
  import {
40
40
  consumerModel,
41
41
  createGlobalInstance,
42
42
  decodeTransaction,
43
43
  decodeTransactionAsync
44
- } from "./chunk-NDBDNXBI.js";
44
+ } from "./chunk-RYQVLCCC.js";
45
45
  import {
46
46
  fetchMultipleAddresses,
47
47
  fetchProfilesByControllers,
48
48
  getGraphQLEndpoint,
49
49
  getImage
50
- } from "./chunk-FKBKAWB3.js";
50
+ } from "./chunk-HFBAO6YR.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-T4H2HHIB.js";
68
+ } from "./chunk-MGPLCACC.js";
69
69
  export {
70
70
  AddressResolver,
71
71
  DEPLOY_ERC1167_PROXIES_SELECTOR,
package/dist/server.cjs CHANGED
@@ -3200,6 +3200,170 @@ async function enhanceSetData(result, pluginOptions, options) {
3200
3200
  }
3201
3201
  __name(enhanceSetData, "enhanceSetData");
3202
3202
 
3203
+ // src/decoder/plugins/universalReceiverTypeIds.ts
3204
+ import {
3205
+ decodeAbiParameters as decodeAbiParameters3,
3206
+ encodeAbiParameters,
3207
+ getAddress,
3208
+ keccak256,
3209
+ slice as slice4,
3210
+ toHex
3211
+ } from "viem";
3212
+ function encodeEventLog(eventName, params, values) {
3213
+ const sig = `${eventName}(${params.map((p) => p.type).join(",")})`;
3214
+ const topic0 = keccak256(toHex(sig));
3215
+ const data = encodeAbiParameters(params, values);
3216
+ return { topics: [topic0], data };
3217
+ }
3218
+ __name(encodeEventLog, "encodeEventLog");
3219
+ var TYPEID_LSP26_FOLLOW = "0x71e02f9f05bcd5816ec4f3134aa2e5a916669537ec6c77fe66ea595fabc2d51a";
3220
+ var TYPEID_LSP26_UNFOLLOW = "0x9d3c0b4012b69658977b099bdaa51eff0f0460f421fba96d15669506c00d1c4f";
3221
+ var TYPEID_LSP7_TOKENSSENDER = "0x429ac7a06903dbc9c13dfcb3c9d11df8194581fa047c96d7a4171fc7402958ea";
3222
+ var TYPEID_LSP7_TOKENSRECIPIENT = "0x20804611b3e2ea21c480dc465142210acf4a2485947541770ec1fb87dee4a55c";
3223
+ var TYPEID_LSP8_TOKENSSENDER = "0xb23eae7e6d1564b295b4c3e3be402d9a2f0776c57bdf365903496f6fa481ab00";
3224
+ var TYPEID_LSP8_TOKENSRECIPIENT = "0x0b084a55ebf70fd3c06fd755269dac2212c4d3f0f4d09079780bfa50c1b2984d";
3225
+ var followParams = [
3226
+ { name: "follower", type: "address" },
3227
+ { name: "addr", type: "address" }
3228
+ ];
3229
+ var unfollowParams = [
3230
+ { name: "unfollower", type: "address" },
3231
+ { name: "addr", type: "address" }
3232
+ ];
3233
+ var lsp7TransferParams = [
3234
+ { name: "operator", type: "address" },
3235
+ { name: "from", type: "address" },
3236
+ { name: "to", type: "address" },
3237
+ { name: "amount", type: "uint256" },
3238
+ { name: "force", type: "bool" },
3239
+ { name: "data", type: "bytes" }
3240
+ ];
3241
+ var lsp8TransferParams = [
3242
+ { name: "operator", type: "address" },
3243
+ { name: "from", type: "address" },
3244
+ { name: "to", type: "address" },
3245
+ { name: "tokenId", type: "bytes32" },
3246
+ { name: "force", type: "bool" },
3247
+ { name: "data", type: "bytes" }
3248
+ ];
3249
+ var notificationParams = [
3250
+ { name: "from", type: "address" },
3251
+ { name: "typeId", type: "bytes32" },
3252
+ { name: "data", type: "bytes" }
3253
+ ];
3254
+ function unwrapLSP26Follow(receivedData, _from, profileAddress, _eventName) {
3255
+ if (!receivedData || receivedData.length < 42) {
3256
+ return void 0;
3257
+ }
3258
+ const followerAddress = getAddress(slice4(receivedData, 0, 20));
3259
+ const values = [followerAddress, profileAddress];
3260
+ return {
3261
+ eventName: "URDFollow",
3262
+ ...createNamedArgs(values, followParams),
3263
+ ...encodeEventLog("URDFollow", followParams, values),
3264
+ standard: "LSP26FollowerSystem"
3265
+ };
3266
+ }
3267
+ __name(unwrapLSP26Follow, "unwrapLSP26Follow");
3268
+ function unwrapLSP26Unfollow(receivedData, _from, profileAddress, _eventName) {
3269
+ if (!receivedData || receivedData.length < 42) {
3270
+ return void 0;
3271
+ }
3272
+ const unfollowerAddress = getAddress(slice4(receivedData, 0, 20));
3273
+ const values = [unfollowerAddress, profileAddress];
3274
+ return {
3275
+ eventName: "URDUnfollow",
3276
+ ...createNamedArgs(values, unfollowParams),
3277
+ ...encodeEventLog("URDUnfollow", unfollowParams, values),
3278
+ standard: "LSP26FollowerSystem"
3279
+ };
3280
+ }
3281
+ __name(unwrapLSP26Unfollow, "unwrapLSP26Unfollow");
3282
+ function unwrapLSP7Transfer(receivedData, _from, _profileAddress, eventName) {
3283
+ try {
3284
+ const [operator, sender, recipient, amount, data] = decodeAbiParameters3(
3285
+ [
3286
+ { name: "operator", type: "address" },
3287
+ { name: "from", type: "address" },
3288
+ { name: "to", type: "address" },
3289
+ { name: "amount", type: "uint256" },
3290
+ { name: "data", type: "bytes" }
3291
+ ],
3292
+ receivedData
3293
+ );
3294
+ const values = [operator, sender, recipient, amount, true, data];
3295
+ return {
3296
+ eventName,
3297
+ ...createNamedArgs(values, lsp7TransferParams),
3298
+ ...encodeEventLog(eventName, lsp7TransferParams, values),
3299
+ standard: "LSP7DigitalAsset"
3300
+ };
3301
+ } catch {
3302
+ return void 0;
3303
+ }
3304
+ }
3305
+ __name(unwrapLSP7Transfer, "unwrapLSP7Transfer");
3306
+ function unwrapLSP8Transfer(receivedData, _from, _profileAddress, eventName) {
3307
+ try {
3308
+ const [operator, sender, recipient, tokenId, data] = decodeAbiParameters3(
3309
+ [
3310
+ { name: "operator", type: "address" },
3311
+ { name: "from", type: "address" },
3312
+ { name: "to", type: "address" },
3313
+ { name: "tokenId", type: "bytes32" },
3314
+ { name: "data", type: "bytes" }
3315
+ ],
3316
+ receivedData
3317
+ );
3318
+ const values = [operator, sender, recipient, tokenId, true, data];
3319
+ return {
3320
+ eventName,
3321
+ ...createNamedArgs(values, lsp8TransferParams),
3322
+ ...encodeEventLog(eventName, lsp8TransferParams, values),
3323
+ standard: "LSP8IdentifiableDigitalAsset"
3324
+ };
3325
+ } catch {
3326
+ return void 0;
3327
+ }
3328
+ }
3329
+ __name(unwrapLSP8Transfer, "unwrapLSP8Transfer");
3330
+ var typeIdUnwrappers = {
3331
+ [TYPEID_LSP26_FOLLOW]: { fn: unwrapLSP26Follow, eventName: "Follow" },
3332
+ [TYPEID_LSP26_UNFOLLOW]: { fn: unwrapLSP26Unfollow, eventName: "Unfollow" },
3333
+ [TYPEID_LSP7_TOKENSSENDER]: {
3334
+ fn: unwrapLSP7Transfer,
3335
+ eventName: "URDTokensSent"
3336
+ },
3337
+ [TYPEID_LSP7_TOKENSRECIPIENT]: {
3338
+ fn: unwrapLSP7Transfer,
3339
+ eventName: "URDTokensReceived"
3340
+ },
3341
+ [TYPEID_LSP8_TOKENSSENDER]: {
3342
+ fn: unwrapLSP8Transfer,
3343
+ eventName: "URDTokensSent"
3344
+ },
3345
+ [TYPEID_LSP8_TOKENSRECIPIENT]: {
3346
+ fn: unwrapLSP8Transfer,
3347
+ eventName: "URDTokensReceived"
3348
+ }
3349
+ };
3350
+ function unwrapUniversalReceiver(typeId, receivedData, from, profileAddress) {
3351
+ const entry = typeIdUnwrappers[typeId];
3352
+ if (entry) {
3353
+ const result = entry.fn(receivedData, from, profileAddress, entry.eventName);
3354
+ if (result) {
3355
+ return result;
3356
+ }
3357
+ }
3358
+ const values = [from, typeId, receivedData];
3359
+ return {
3360
+ eventName: "URDNotification",
3361
+ ...createNamedArgs(values, notificationParams),
3362
+ ...encodeEventLog("Notification", notificationParams, values)
3363
+ };
3364
+ }
3365
+ __name(unwrapUniversalReceiver, "unwrapUniversalReceiver");
3366
+
3203
3367
  // src/decoder/plugins/enhanceLSP0ERC725Account.ts
3204
3368
  var enhanceLSP0ERC725AccountPlugin = standardPlugin(
3205
3369
  UniversalProfile,
@@ -3211,7 +3375,33 @@ var enhanceLSP0ERC725AccountPlugin = standardPlugin(
3211
3375
  {
3212
3376
  enhance: enhanceLSP0ERC725Account,
3213
3377
  decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
3214
- return decodeEvent(options.chain, UniversalProfile, log);
3378
+ const decoded = decodeEvent(options.chain, UniversalProfile, log);
3379
+ if (!decoded || decoded.eventName !== "UniversalReceiver") {
3380
+ return decoded;
3381
+ }
3382
+ const typeId = decoded.args.find((a) => a.name === "typeId")?.value;
3383
+ const receivedData = decoded.args.find((a) => a.name === "receivedData")?.value;
3384
+ const from = decoded.args.find((a) => a.name === "from")?.value;
3385
+ const profileAddress = decoded.address;
3386
+ if (!typeId || !receivedData || !from) {
3387
+ return decoded;
3388
+ }
3389
+ const unwrapped = unwrapUniversalReceiver(
3390
+ typeId,
3391
+ receivedData,
3392
+ from,
3393
+ profileAddress
3394
+ );
3395
+ const { wrappers: _w, standard: _s, ...logBase } = decoded;
3396
+ return {
3397
+ ...logBase,
3398
+ eventName: unwrapped.eventName,
3399
+ args: unwrapped.args,
3400
+ standard: unwrapped.standard,
3401
+ topics: unwrapped.topics,
3402
+ data: unwrapped.data,
3403
+ wrappers: [logBase]
3404
+ };
3215
3405
  }, "decodeEvent")
3216
3406
  }
3217
3407
  );
@@ -5126,9 +5316,9 @@ var abi2 = [
5126
5316
 
5127
5317
  // src/decoder/functionSignature.ts
5128
5318
  import {
5129
- decodeAbiParameters as decodeAbiParameters3,
5130
- encodeAbiParameters,
5131
- getAddress,
5319
+ decodeAbiParameters as decodeAbiParameters4,
5320
+ encodeAbiParameters as encodeAbiParameters2,
5321
+ getAddress as getAddress2,
5132
5322
  isAddress as isAddress2,
5133
5323
  isAddressEqual as isAddressEqual2,
5134
5324
  parseAbiParameters,
@@ -5283,7 +5473,7 @@ async function fetchAbi(chain, address, options) {
5283
5473
  const explorer = chain.blockExplorers?.default?.apiUrl;
5284
5474
  if (!explorer) return void 0;
5285
5475
  const cache = options?.cache ?? defaultCache;
5286
- let key = getAddress(address);
5476
+ let key = getAddress2(address);
5287
5477
  const cacheKey = makeCacheKey("abi" /* ABI */, key, String(chain.id));
5288
5478
  return cache.getOrSet(
5289
5479
  cacheKey,
@@ -5425,7 +5615,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
5425
5615
  const params = generateNamedAbiParameters(
5426
5616
  result.text_signature || result.name
5427
5617
  );
5428
- const args = decodeAbiParameters3(params, `0x${data.slice(8)}`);
5618
+ const args = decodeAbiParameters4(params, `0x${data.slice(8)}`);
5429
5619
  const encodeArgs = Array.from({ length: params.length }).map(
5430
5620
  (_val, index) => {
5431
5621
  if (params[index].type === "bool") {
@@ -5443,7 +5633,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
5443
5633
  return args[`${index}`] ?? "0x";
5444
5634
  }
5445
5635
  );
5446
- const newData = encodeAbiParameters(
5636
+ const newData = encodeAbiParameters2(
5447
5637
  params,
5448
5638
  encodeArgs
5449
5639
  ).slice(2);