@lukso/transaction-decoder 1.3.6-dev.45215f7 → 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.
- package/dist/browser.cjs +203 -13
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +4 -4
- package/dist/cdn/transaction-decoder.global.js +75 -75
- package/dist/cdn/transaction-decoder.global.js.map +1 -1
- package/dist/{chunk-FKBKAWB3.js → chunk-HFBAO6YR.js} +2 -2
- package/dist/{chunk-T4H2HHIB.js → chunk-MGPLCACC.js} +198 -8
- package/dist/chunk-MGPLCACC.js.map +1 -0
- package/dist/{chunk-SSY7TTU2.js → chunk-MSTGEOTX.js} +4 -4
- package/dist/{chunk-NDBDNXBI.js → chunk-RYQVLCCC.js} +2 -2
- package/dist/data.cjs +197 -7
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.cts +3 -3
- package/dist/data.d.ts +3 -3
- package/dist/data.js +2 -2
- package/dist/{index-BzXh7poJ.d.ts → index-BWD9DaG6.d.cts} +6 -1
- package/dist/{index-BzXh7poJ.d.cts → index-BWD9DaG6.d.ts} +6 -1
- package/dist/index.cjs +203 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/server.cjs +197 -7
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +2 -2
- package/dist/{utils-De_c6fUK.d.ts → utils-4Qdavg8r.d.ts} +2 -2
- package/dist/{utils-BEpSreRR.d.cts → utils-OR-XzeYG.d.cts} +2 -2
- package/package.json +8 -8
- package/src/decoder/lsp7Mint.test.ts +18 -11
- package/src/decoder/plugins/enhanceLSP0ERC725Account.ts +39 -2
- package/src/decoder/plugins/universalReceiverTypeIds.ts +277 -0
- package/src/decoder/types.ts +2 -0
- package/dist/chunk-T4H2HHIB.js.map +0 -1
- /package/dist/{chunk-FKBKAWB3.js.map → chunk-HFBAO6YR.js.map} +0 -0
- /package/dist/{chunk-SSY7TTU2.js.map → chunk-MSTGEOTX.js.map} +0 -0
- /package/dist/{chunk-NDBDNXBI.js.map → chunk-RYQVLCCC.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__name
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MGPLCACC.js";
|
|
4
4
|
|
|
5
5
|
// src/shared/addressResolver.ts
|
|
6
6
|
import request, { gql } from "graphql-request";
|
|
@@ -434,4 +434,4 @@ export {
|
|
|
434
434
|
fetchProfilesByControllers,
|
|
435
435
|
getImage
|
|
436
436
|
};
|
|
437
|
-
//# sourceMappingURL=chunk-
|
|
437
|
+
//# sourceMappingURL=chunk-HFBAO6YR.js.map
|
|
@@ -2510,6 +2510,170 @@ async function enhanceSetData(result, pluginOptions, options) {
|
|
|
2510
2510
|
}
|
|
2511
2511
|
__name(enhanceSetData, "enhanceSetData");
|
|
2512
2512
|
|
|
2513
|
+
// src/decoder/plugins/universalReceiverTypeIds.ts
|
|
2514
|
+
import {
|
|
2515
|
+
decodeAbiParameters as decodeAbiParameters3,
|
|
2516
|
+
encodeAbiParameters,
|
|
2517
|
+
getAddress,
|
|
2518
|
+
keccak256,
|
|
2519
|
+
slice as slice4,
|
|
2520
|
+
toHex
|
|
2521
|
+
} from "viem";
|
|
2522
|
+
function encodeEventLog(eventName, params, values) {
|
|
2523
|
+
const sig = `${eventName}(${params.map((p) => p.type).join(",")})`;
|
|
2524
|
+
const topic0 = keccak256(toHex(sig));
|
|
2525
|
+
const data = encodeAbiParameters(params, values);
|
|
2526
|
+
return { topics: [topic0], data };
|
|
2527
|
+
}
|
|
2528
|
+
__name(encodeEventLog, "encodeEventLog");
|
|
2529
|
+
var TYPEID_LSP26_FOLLOW = "0x71e02f9f05bcd5816ec4f3134aa2e5a916669537ec6c77fe66ea595fabc2d51a";
|
|
2530
|
+
var TYPEID_LSP26_UNFOLLOW = "0x9d3c0b4012b69658977b099bdaa51eff0f0460f421fba96d15669506c00d1c4f";
|
|
2531
|
+
var TYPEID_LSP7_TOKENSSENDER = "0x429ac7a06903dbc9c13dfcb3c9d11df8194581fa047c96d7a4171fc7402958ea";
|
|
2532
|
+
var TYPEID_LSP7_TOKENSRECIPIENT = "0x20804611b3e2ea21c480dc465142210acf4a2485947541770ec1fb87dee4a55c";
|
|
2533
|
+
var TYPEID_LSP8_TOKENSSENDER = "0xb23eae7e6d1564b295b4c3e3be402d9a2f0776c57bdf365903496f6fa481ab00";
|
|
2534
|
+
var TYPEID_LSP8_TOKENSRECIPIENT = "0x0b084a55ebf70fd3c06fd755269dac2212c4d3f0f4d09079780bfa50c1b2984d";
|
|
2535
|
+
var followParams = [
|
|
2536
|
+
{ name: "follower", type: "address" },
|
|
2537
|
+
{ name: "addr", type: "address" }
|
|
2538
|
+
];
|
|
2539
|
+
var unfollowParams = [
|
|
2540
|
+
{ name: "unfollower", type: "address" },
|
|
2541
|
+
{ name: "addr", type: "address" }
|
|
2542
|
+
];
|
|
2543
|
+
var lsp7TransferParams = [
|
|
2544
|
+
{ name: "operator", type: "address" },
|
|
2545
|
+
{ name: "from", type: "address" },
|
|
2546
|
+
{ name: "to", type: "address" },
|
|
2547
|
+
{ name: "amount", type: "uint256" },
|
|
2548
|
+
{ name: "force", type: "bool" },
|
|
2549
|
+
{ name: "data", type: "bytes" }
|
|
2550
|
+
];
|
|
2551
|
+
var lsp8TransferParams = [
|
|
2552
|
+
{ name: "operator", type: "address" },
|
|
2553
|
+
{ name: "from", type: "address" },
|
|
2554
|
+
{ name: "to", type: "address" },
|
|
2555
|
+
{ name: "tokenId", type: "bytes32" },
|
|
2556
|
+
{ name: "force", type: "bool" },
|
|
2557
|
+
{ name: "data", type: "bytes" }
|
|
2558
|
+
];
|
|
2559
|
+
var notificationParams = [
|
|
2560
|
+
{ name: "from", type: "address" },
|
|
2561
|
+
{ name: "typeId", type: "bytes32" },
|
|
2562
|
+
{ name: "data", type: "bytes" }
|
|
2563
|
+
];
|
|
2564
|
+
function unwrapLSP26Follow(receivedData, _from, profileAddress, _eventName) {
|
|
2565
|
+
if (!receivedData || receivedData.length < 42) {
|
|
2566
|
+
return void 0;
|
|
2567
|
+
}
|
|
2568
|
+
const followerAddress = getAddress(slice4(receivedData, 0, 20));
|
|
2569
|
+
const values = [followerAddress, profileAddress];
|
|
2570
|
+
return {
|
|
2571
|
+
eventName: "URDFollow",
|
|
2572
|
+
...createNamedArgs(values, followParams),
|
|
2573
|
+
...encodeEventLog("URDFollow", followParams, values),
|
|
2574
|
+
standard: "LSP26FollowerSystem"
|
|
2575
|
+
};
|
|
2576
|
+
}
|
|
2577
|
+
__name(unwrapLSP26Follow, "unwrapLSP26Follow");
|
|
2578
|
+
function unwrapLSP26Unfollow(receivedData, _from, profileAddress, _eventName) {
|
|
2579
|
+
if (!receivedData || receivedData.length < 42) {
|
|
2580
|
+
return void 0;
|
|
2581
|
+
}
|
|
2582
|
+
const unfollowerAddress = getAddress(slice4(receivedData, 0, 20));
|
|
2583
|
+
const values = [unfollowerAddress, profileAddress];
|
|
2584
|
+
return {
|
|
2585
|
+
eventName: "URDUnfollow",
|
|
2586
|
+
...createNamedArgs(values, unfollowParams),
|
|
2587
|
+
...encodeEventLog("URDUnfollow", unfollowParams, values),
|
|
2588
|
+
standard: "LSP26FollowerSystem"
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2591
|
+
__name(unwrapLSP26Unfollow, "unwrapLSP26Unfollow");
|
|
2592
|
+
function unwrapLSP7Transfer(receivedData, _from, _profileAddress, eventName) {
|
|
2593
|
+
try {
|
|
2594
|
+
const [operator, sender, recipient, amount, data] = decodeAbiParameters3(
|
|
2595
|
+
[
|
|
2596
|
+
{ name: "operator", type: "address" },
|
|
2597
|
+
{ name: "from", type: "address" },
|
|
2598
|
+
{ name: "to", type: "address" },
|
|
2599
|
+
{ name: "amount", type: "uint256" },
|
|
2600
|
+
{ name: "data", type: "bytes" }
|
|
2601
|
+
],
|
|
2602
|
+
receivedData
|
|
2603
|
+
);
|
|
2604
|
+
const values = [operator, sender, recipient, amount, true, data];
|
|
2605
|
+
return {
|
|
2606
|
+
eventName,
|
|
2607
|
+
...createNamedArgs(values, lsp7TransferParams),
|
|
2608
|
+
...encodeEventLog(eventName, lsp7TransferParams, values),
|
|
2609
|
+
standard: "LSP7DigitalAsset"
|
|
2610
|
+
};
|
|
2611
|
+
} catch {
|
|
2612
|
+
return void 0;
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
__name(unwrapLSP7Transfer, "unwrapLSP7Transfer");
|
|
2616
|
+
function unwrapLSP8Transfer(receivedData, _from, _profileAddress, eventName) {
|
|
2617
|
+
try {
|
|
2618
|
+
const [operator, sender, recipient, tokenId, data] = decodeAbiParameters3(
|
|
2619
|
+
[
|
|
2620
|
+
{ name: "operator", type: "address" },
|
|
2621
|
+
{ name: "from", type: "address" },
|
|
2622
|
+
{ name: "to", type: "address" },
|
|
2623
|
+
{ name: "tokenId", type: "bytes32" },
|
|
2624
|
+
{ name: "data", type: "bytes" }
|
|
2625
|
+
],
|
|
2626
|
+
receivedData
|
|
2627
|
+
);
|
|
2628
|
+
const values = [operator, sender, recipient, tokenId, true, data];
|
|
2629
|
+
return {
|
|
2630
|
+
eventName,
|
|
2631
|
+
...createNamedArgs(values, lsp8TransferParams),
|
|
2632
|
+
...encodeEventLog(eventName, lsp8TransferParams, values),
|
|
2633
|
+
standard: "LSP8IdentifiableDigitalAsset"
|
|
2634
|
+
};
|
|
2635
|
+
} catch {
|
|
2636
|
+
return void 0;
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
__name(unwrapLSP8Transfer, "unwrapLSP8Transfer");
|
|
2640
|
+
var typeIdUnwrappers = {
|
|
2641
|
+
[TYPEID_LSP26_FOLLOW]: { fn: unwrapLSP26Follow, eventName: "Follow" },
|
|
2642
|
+
[TYPEID_LSP26_UNFOLLOW]: { fn: unwrapLSP26Unfollow, eventName: "Unfollow" },
|
|
2643
|
+
[TYPEID_LSP7_TOKENSSENDER]: {
|
|
2644
|
+
fn: unwrapLSP7Transfer,
|
|
2645
|
+
eventName: "URDTokensSent"
|
|
2646
|
+
},
|
|
2647
|
+
[TYPEID_LSP7_TOKENSRECIPIENT]: {
|
|
2648
|
+
fn: unwrapLSP7Transfer,
|
|
2649
|
+
eventName: "URDTokensReceived"
|
|
2650
|
+
},
|
|
2651
|
+
[TYPEID_LSP8_TOKENSSENDER]: {
|
|
2652
|
+
fn: unwrapLSP8Transfer,
|
|
2653
|
+
eventName: "URDTokensSent"
|
|
2654
|
+
},
|
|
2655
|
+
[TYPEID_LSP8_TOKENSRECIPIENT]: {
|
|
2656
|
+
fn: unwrapLSP8Transfer,
|
|
2657
|
+
eventName: "URDTokensReceived"
|
|
2658
|
+
}
|
|
2659
|
+
};
|
|
2660
|
+
function unwrapUniversalReceiver(typeId, receivedData, from, profileAddress) {
|
|
2661
|
+
const entry = typeIdUnwrappers[typeId];
|
|
2662
|
+
if (entry) {
|
|
2663
|
+
const result = entry.fn(receivedData, from, profileAddress, entry.eventName);
|
|
2664
|
+
if (result) {
|
|
2665
|
+
return result;
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
const values = [from, typeId, receivedData];
|
|
2669
|
+
return {
|
|
2670
|
+
eventName: "URDNotification",
|
|
2671
|
+
...createNamedArgs(values, notificationParams),
|
|
2672
|
+
...encodeEventLog("Notification", notificationParams, values)
|
|
2673
|
+
};
|
|
2674
|
+
}
|
|
2675
|
+
__name(unwrapUniversalReceiver, "unwrapUniversalReceiver");
|
|
2676
|
+
|
|
2513
2677
|
// src/decoder/plugins/enhanceLSP0ERC725Account.ts
|
|
2514
2678
|
var enhanceLSP0ERC725AccountPlugin = standardPlugin(
|
|
2515
2679
|
UniversalProfile,
|
|
@@ -2521,7 +2685,33 @@ var enhanceLSP0ERC725AccountPlugin = standardPlugin(
|
|
|
2521
2685
|
{
|
|
2522
2686
|
enhance: enhanceLSP0ERC725Account,
|
|
2523
2687
|
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
2524
|
-
|
|
2688
|
+
const decoded = decodeEvent(options.chain, UniversalProfile, log);
|
|
2689
|
+
if (!decoded || decoded.eventName !== "UniversalReceiver") {
|
|
2690
|
+
return decoded;
|
|
2691
|
+
}
|
|
2692
|
+
const typeId = decoded.args.find((a) => a.name === "typeId")?.value;
|
|
2693
|
+
const receivedData = decoded.args.find((a) => a.name === "receivedData")?.value;
|
|
2694
|
+
const from = decoded.args.find((a) => a.name === "from")?.value;
|
|
2695
|
+
const profileAddress = decoded.address;
|
|
2696
|
+
if (!typeId || !receivedData || !from) {
|
|
2697
|
+
return decoded;
|
|
2698
|
+
}
|
|
2699
|
+
const unwrapped = unwrapUniversalReceiver(
|
|
2700
|
+
typeId,
|
|
2701
|
+
receivedData,
|
|
2702
|
+
from,
|
|
2703
|
+
profileAddress
|
|
2704
|
+
);
|
|
2705
|
+
const { wrappers: _w, standard: _s, ...logBase } = decoded;
|
|
2706
|
+
return {
|
|
2707
|
+
...logBase,
|
|
2708
|
+
eventName: unwrapped.eventName,
|
|
2709
|
+
args: unwrapped.args,
|
|
2710
|
+
standard: unwrapped.standard,
|
|
2711
|
+
topics: unwrapped.topics,
|
|
2712
|
+
data: unwrapped.data,
|
|
2713
|
+
wrappers: [logBase]
|
|
2714
|
+
};
|
|
2525
2715
|
}, "decodeEvent")
|
|
2526
2716
|
}
|
|
2527
2717
|
);
|
|
@@ -4436,9 +4626,9 @@ var abi2 = [
|
|
|
4436
4626
|
|
|
4437
4627
|
// src/decoder/functionSignature.ts
|
|
4438
4628
|
import {
|
|
4439
|
-
decodeAbiParameters as
|
|
4440
|
-
encodeAbiParameters,
|
|
4441
|
-
getAddress,
|
|
4629
|
+
decodeAbiParameters as decodeAbiParameters4,
|
|
4630
|
+
encodeAbiParameters as encodeAbiParameters2,
|
|
4631
|
+
getAddress as getAddress2,
|
|
4442
4632
|
isAddress as isAddress2,
|
|
4443
4633
|
isAddressEqual as isAddressEqual2,
|
|
4444
4634
|
parseAbiParameters,
|
|
@@ -4593,7 +4783,7 @@ async function fetchAbi(chain, address, options) {
|
|
|
4593
4783
|
const explorer = chain.blockExplorers?.default?.apiUrl;
|
|
4594
4784
|
if (!explorer) return void 0;
|
|
4595
4785
|
const cache = options?.cache ?? defaultCache;
|
|
4596
|
-
let key =
|
|
4786
|
+
let key = getAddress2(address);
|
|
4597
4787
|
const cacheKey = makeCacheKey("abi" /* ABI */, key, String(chain.id));
|
|
4598
4788
|
return cache.getOrSet(
|
|
4599
4789
|
cacheKey,
|
|
@@ -4735,7 +4925,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
|
|
|
4735
4925
|
const params = generateNamedAbiParameters(
|
|
4736
4926
|
result.text_signature || result.name
|
|
4737
4927
|
);
|
|
4738
|
-
const args =
|
|
4928
|
+
const args = decodeAbiParameters4(params, `0x${data.slice(8)}`);
|
|
4739
4929
|
const encodeArgs = Array.from({ length: params.length }).map(
|
|
4740
4930
|
(_val, index) => {
|
|
4741
4931
|
if (params[index].type === "bool") {
|
|
@@ -4753,7 +4943,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
|
|
|
4753
4943
|
return args[`${index}`] ?? "0x";
|
|
4754
4944
|
}
|
|
4755
4945
|
);
|
|
4756
|
-
const newData =
|
|
4946
|
+
const newData = encodeAbiParameters2(
|
|
4757
4947
|
params,
|
|
4758
4948
|
encodeArgs
|
|
4759
4949
|
).slice(2);
|
|
@@ -4915,4 +5105,4 @@ export {
|
|
|
4915
5105
|
decodeKeyValue,
|
|
4916
5106
|
decodeKeyValueRaw
|
|
4917
5107
|
};
|
|
4918
|
-
//# sourceMappingURL=chunk-
|
|
5108
|
+
//# sourceMappingURL=chunk-MGPLCACC.js.map
|