@lukso/transaction-decoder 1.3.6-dev.637d4ef → 1.3.6-dev.6cff3c3
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 +13 -203
- 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 +71 -71
- package/dist/cdn/transaction-decoder.global.js.map +1 -1
- package/dist/{chunk-HFBAO6YR.js → chunk-FKBKAWB3.js} +2 -2
- package/dist/{chunk-RYQVLCCC.js → chunk-NDBDNXBI.js} +2 -2
- package/dist/{chunk-MSTGEOTX.js → chunk-SSY7TTU2.js} +4 -4
- package/dist/{chunk-MGPLCACC.js → chunk-T4H2HHIB.js} +8 -198
- package/dist/chunk-T4H2HHIB.js.map +1 -0
- package/dist/data.cjs +7 -197
- 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-BWD9DaG6.d.ts → index-C5YGrCiY.d.cts} +0 -5
- package/dist/{index-BWD9DaG6.d.cts → index-C5YGrCiY.d.ts} +0 -5
- package/dist/index.cjs +13 -203
- 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 +7 -197
- 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-OR-XzeYG.d.cts → utils-B9wHdaOz.d.cts} +1 -1
- package/dist/{utils-4Qdavg8r.d.ts → utils-BLjnC-HG.d.ts} +1 -1
- package/package.json +3 -3
- package/src/decoder/lsp7Mint.test.ts +11 -18
- package/src/decoder/plugins/enhanceLSP0ERC725Account.ts +2 -39
- package/src/decoder/types.ts +0 -2
- package/dist/chunk-MGPLCACC.js.map +0 -1
- package/src/decoder/plugins/universalReceiverTypeIds.ts +0 -277
- /package/dist/{chunk-HFBAO6YR.js.map → chunk-FKBKAWB3.js.map} +0 -0
- /package/dist/{chunk-RYQVLCCC.js.map → chunk-NDBDNXBI.js.map} +0 -0
- /package/dist/{chunk-MSTGEOTX.js.map → chunk-SSY7TTU2.js.map} +0 -0
package/dist/data.cjs
CHANGED
|
@@ -3073,170 +3073,6 @@ async function enhanceSetData(result, pluginOptions, options) {
|
|
|
3073
3073
|
}
|
|
3074
3074
|
__name(enhanceSetData, "enhanceSetData");
|
|
3075
3075
|
|
|
3076
|
-
// src/decoder/plugins/universalReceiverTypeIds.ts
|
|
3077
|
-
import {
|
|
3078
|
-
decodeAbiParameters as decodeAbiParameters3,
|
|
3079
|
-
encodeAbiParameters,
|
|
3080
|
-
getAddress,
|
|
3081
|
-
keccak256,
|
|
3082
|
-
slice as slice4,
|
|
3083
|
-
toHex
|
|
3084
|
-
} from "viem";
|
|
3085
|
-
function encodeEventLog(eventName, params, values) {
|
|
3086
|
-
const sig = `${eventName}(${params.map((p) => p.type).join(",")})`;
|
|
3087
|
-
const topic0 = keccak256(toHex(sig));
|
|
3088
|
-
const data = encodeAbiParameters(params, values);
|
|
3089
|
-
return { topics: [topic0], data };
|
|
3090
|
-
}
|
|
3091
|
-
__name(encodeEventLog, "encodeEventLog");
|
|
3092
|
-
var TYPEID_LSP26_FOLLOW = "0x71e02f9f05bcd5816ec4f3134aa2e5a916669537ec6c77fe66ea595fabc2d51a";
|
|
3093
|
-
var TYPEID_LSP26_UNFOLLOW = "0x9d3c0b4012b69658977b099bdaa51eff0f0460f421fba96d15669506c00d1c4f";
|
|
3094
|
-
var TYPEID_LSP7_TOKENSSENDER = "0x429ac7a06903dbc9c13dfcb3c9d11df8194581fa047c96d7a4171fc7402958ea";
|
|
3095
|
-
var TYPEID_LSP7_TOKENSRECIPIENT = "0x20804611b3e2ea21c480dc465142210acf4a2485947541770ec1fb87dee4a55c";
|
|
3096
|
-
var TYPEID_LSP8_TOKENSSENDER = "0xb23eae7e6d1564b295b4c3e3be402d9a2f0776c57bdf365903496f6fa481ab00";
|
|
3097
|
-
var TYPEID_LSP8_TOKENSRECIPIENT = "0x0b084a55ebf70fd3c06fd755269dac2212c4d3f0f4d09079780bfa50c1b2984d";
|
|
3098
|
-
var followParams = [
|
|
3099
|
-
{ name: "follower", type: "address" },
|
|
3100
|
-
{ name: "addr", type: "address" }
|
|
3101
|
-
];
|
|
3102
|
-
var unfollowParams = [
|
|
3103
|
-
{ name: "unfollower", type: "address" },
|
|
3104
|
-
{ name: "addr", type: "address" }
|
|
3105
|
-
];
|
|
3106
|
-
var lsp7TransferParams = [
|
|
3107
|
-
{ name: "operator", type: "address" },
|
|
3108
|
-
{ name: "from", type: "address" },
|
|
3109
|
-
{ name: "to", type: "address" },
|
|
3110
|
-
{ name: "amount", type: "uint256" },
|
|
3111
|
-
{ name: "force", type: "bool" },
|
|
3112
|
-
{ name: "data", type: "bytes" }
|
|
3113
|
-
];
|
|
3114
|
-
var lsp8TransferParams = [
|
|
3115
|
-
{ name: "operator", type: "address" },
|
|
3116
|
-
{ name: "from", type: "address" },
|
|
3117
|
-
{ name: "to", type: "address" },
|
|
3118
|
-
{ name: "tokenId", type: "bytes32" },
|
|
3119
|
-
{ name: "force", type: "bool" },
|
|
3120
|
-
{ name: "data", type: "bytes" }
|
|
3121
|
-
];
|
|
3122
|
-
var notificationParams = [
|
|
3123
|
-
{ name: "from", type: "address" },
|
|
3124
|
-
{ name: "typeId", type: "bytes32" },
|
|
3125
|
-
{ name: "data", type: "bytes" }
|
|
3126
|
-
];
|
|
3127
|
-
function unwrapLSP26Follow(receivedData, _from, profileAddress, _eventName) {
|
|
3128
|
-
if (!receivedData || receivedData.length < 42) {
|
|
3129
|
-
return void 0;
|
|
3130
|
-
}
|
|
3131
|
-
const followerAddress = getAddress(slice4(receivedData, 0, 20));
|
|
3132
|
-
const values = [followerAddress, profileAddress];
|
|
3133
|
-
return {
|
|
3134
|
-
eventName: "URDFollow",
|
|
3135
|
-
...createNamedArgs(values, followParams),
|
|
3136
|
-
...encodeEventLog("URDFollow", followParams, values),
|
|
3137
|
-
standard: "LSP26FollowerSystem"
|
|
3138
|
-
};
|
|
3139
|
-
}
|
|
3140
|
-
__name(unwrapLSP26Follow, "unwrapLSP26Follow");
|
|
3141
|
-
function unwrapLSP26Unfollow(receivedData, _from, profileAddress, _eventName) {
|
|
3142
|
-
if (!receivedData || receivedData.length < 42) {
|
|
3143
|
-
return void 0;
|
|
3144
|
-
}
|
|
3145
|
-
const unfollowerAddress = getAddress(slice4(receivedData, 0, 20));
|
|
3146
|
-
const values = [unfollowerAddress, profileAddress];
|
|
3147
|
-
return {
|
|
3148
|
-
eventName: "URDUnfollow",
|
|
3149
|
-
...createNamedArgs(values, unfollowParams),
|
|
3150
|
-
...encodeEventLog("URDUnfollow", unfollowParams, values),
|
|
3151
|
-
standard: "LSP26FollowerSystem"
|
|
3152
|
-
};
|
|
3153
|
-
}
|
|
3154
|
-
__name(unwrapLSP26Unfollow, "unwrapLSP26Unfollow");
|
|
3155
|
-
function unwrapLSP7Transfer(receivedData, _from, _profileAddress, eventName) {
|
|
3156
|
-
try {
|
|
3157
|
-
const [operator, sender, recipient, amount, data] = decodeAbiParameters3(
|
|
3158
|
-
[
|
|
3159
|
-
{ name: "operator", type: "address" },
|
|
3160
|
-
{ name: "from", type: "address" },
|
|
3161
|
-
{ name: "to", type: "address" },
|
|
3162
|
-
{ name: "amount", type: "uint256" },
|
|
3163
|
-
{ name: "data", type: "bytes" }
|
|
3164
|
-
],
|
|
3165
|
-
receivedData
|
|
3166
|
-
);
|
|
3167
|
-
const values = [operator, sender, recipient, amount, true, data];
|
|
3168
|
-
return {
|
|
3169
|
-
eventName,
|
|
3170
|
-
...createNamedArgs(values, lsp7TransferParams),
|
|
3171
|
-
...encodeEventLog(eventName, lsp7TransferParams, values),
|
|
3172
|
-
standard: "LSP7DigitalAsset"
|
|
3173
|
-
};
|
|
3174
|
-
} catch {
|
|
3175
|
-
return void 0;
|
|
3176
|
-
}
|
|
3177
|
-
}
|
|
3178
|
-
__name(unwrapLSP7Transfer, "unwrapLSP7Transfer");
|
|
3179
|
-
function unwrapLSP8Transfer(receivedData, _from, _profileAddress, eventName) {
|
|
3180
|
-
try {
|
|
3181
|
-
const [operator, sender, recipient, tokenId, data] = decodeAbiParameters3(
|
|
3182
|
-
[
|
|
3183
|
-
{ name: "operator", type: "address" },
|
|
3184
|
-
{ name: "from", type: "address" },
|
|
3185
|
-
{ name: "to", type: "address" },
|
|
3186
|
-
{ name: "tokenId", type: "bytes32" },
|
|
3187
|
-
{ name: "data", type: "bytes" }
|
|
3188
|
-
],
|
|
3189
|
-
receivedData
|
|
3190
|
-
);
|
|
3191
|
-
const values = [operator, sender, recipient, tokenId, true, data];
|
|
3192
|
-
return {
|
|
3193
|
-
eventName,
|
|
3194
|
-
...createNamedArgs(values, lsp8TransferParams),
|
|
3195
|
-
...encodeEventLog(eventName, lsp8TransferParams, values),
|
|
3196
|
-
standard: "LSP8IdentifiableDigitalAsset"
|
|
3197
|
-
};
|
|
3198
|
-
} catch {
|
|
3199
|
-
return void 0;
|
|
3200
|
-
}
|
|
3201
|
-
}
|
|
3202
|
-
__name(unwrapLSP8Transfer, "unwrapLSP8Transfer");
|
|
3203
|
-
var typeIdUnwrappers = {
|
|
3204
|
-
[TYPEID_LSP26_FOLLOW]: { fn: unwrapLSP26Follow, eventName: "Follow" },
|
|
3205
|
-
[TYPEID_LSP26_UNFOLLOW]: { fn: unwrapLSP26Unfollow, eventName: "Unfollow" },
|
|
3206
|
-
[TYPEID_LSP7_TOKENSSENDER]: {
|
|
3207
|
-
fn: unwrapLSP7Transfer,
|
|
3208
|
-
eventName: "URDTokensSent"
|
|
3209
|
-
},
|
|
3210
|
-
[TYPEID_LSP7_TOKENSRECIPIENT]: {
|
|
3211
|
-
fn: unwrapLSP7Transfer,
|
|
3212
|
-
eventName: "URDTokensReceived"
|
|
3213
|
-
},
|
|
3214
|
-
[TYPEID_LSP8_TOKENSSENDER]: {
|
|
3215
|
-
fn: unwrapLSP8Transfer,
|
|
3216
|
-
eventName: "URDTokensSent"
|
|
3217
|
-
},
|
|
3218
|
-
[TYPEID_LSP8_TOKENSRECIPIENT]: {
|
|
3219
|
-
fn: unwrapLSP8Transfer,
|
|
3220
|
-
eventName: "URDTokensReceived"
|
|
3221
|
-
}
|
|
3222
|
-
};
|
|
3223
|
-
function unwrapUniversalReceiver(typeId, receivedData, from, profileAddress) {
|
|
3224
|
-
const entry = typeIdUnwrappers[typeId];
|
|
3225
|
-
if (entry) {
|
|
3226
|
-
const result = entry.fn(receivedData, from, profileAddress, entry.eventName);
|
|
3227
|
-
if (result) {
|
|
3228
|
-
return result;
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
|
-
const values = [from, typeId, receivedData];
|
|
3232
|
-
return {
|
|
3233
|
-
eventName: "URDNotification",
|
|
3234
|
-
...createNamedArgs(values, notificationParams),
|
|
3235
|
-
...encodeEventLog("Notification", notificationParams, values)
|
|
3236
|
-
};
|
|
3237
|
-
}
|
|
3238
|
-
__name(unwrapUniversalReceiver, "unwrapUniversalReceiver");
|
|
3239
|
-
|
|
3240
3076
|
// src/decoder/plugins/enhanceLSP0ERC725Account.ts
|
|
3241
3077
|
var enhanceLSP0ERC725AccountPlugin = standardPlugin(
|
|
3242
3078
|
UniversalProfile,
|
|
@@ -3248,33 +3084,7 @@ var enhanceLSP0ERC725AccountPlugin = standardPlugin(
|
|
|
3248
3084
|
{
|
|
3249
3085
|
enhance: enhanceLSP0ERC725Account,
|
|
3250
3086
|
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
3251
|
-
|
|
3252
|
-
if (!decoded || decoded.eventName !== "UniversalReceiver") {
|
|
3253
|
-
return decoded;
|
|
3254
|
-
}
|
|
3255
|
-
const typeId = decoded.args.find((a) => a.name === "typeId")?.value;
|
|
3256
|
-
const receivedData = decoded.args.find((a) => a.name === "receivedData")?.value;
|
|
3257
|
-
const from = decoded.args.find((a) => a.name === "from")?.value;
|
|
3258
|
-
const profileAddress = decoded.address;
|
|
3259
|
-
if (!typeId || !receivedData || !from) {
|
|
3260
|
-
return decoded;
|
|
3261
|
-
}
|
|
3262
|
-
const unwrapped = unwrapUniversalReceiver(
|
|
3263
|
-
typeId,
|
|
3264
|
-
receivedData,
|
|
3265
|
-
from,
|
|
3266
|
-
profileAddress
|
|
3267
|
-
);
|
|
3268
|
-
const { wrappers: _w, standard: _s, ...logBase } = decoded;
|
|
3269
|
-
return {
|
|
3270
|
-
...logBase,
|
|
3271
|
-
eventName: unwrapped.eventName,
|
|
3272
|
-
args: unwrapped.args,
|
|
3273
|
-
standard: unwrapped.standard,
|
|
3274
|
-
topics: unwrapped.topics,
|
|
3275
|
-
data: unwrapped.data,
|
|
3276
|
-
wrappers: [logBase]
|
|
3277
|
-
};
|
|
3087
|
+
return decodeEvent(options.chain, UniversalProfile, log);
|
|
3278
3088
|
}, "decodeEvent")
|
|
3279
3089
|
}
|
|
3280
3090
|
);
|
|
@@ -5189,9 +4999,9 @@ var abi2 = [
|
|
|
5189
4999
|
|
|
5190
5000
|
// src/decoder/functionSignature.ts
|
|
5191
5001
|
import {
|
|
5192
|
-
decodeAbiParameters as
|
|
5193
|
-
encodeAbiParameters
|
|
5194
|
-
getAddress
|
|
5002
|
+
decodeAbiParameters as decodeAbiParameters3,
|
|
5003
|
+
encodeAbiParameters,
|
|
5004
|
+
getAddress,
|
|
5195
5005
|
isAddress as isAddress2,
|
|
5196
5006
|
isAddressEqual as isAddressEqual2,
|
|
5197
5007
|
parseAbiParameters,
|
|
@@ -5346,7 +5156,7 @@ async function fetchAbi(chain, address, options) {
|
|
|
5346
5156
|
const explorer = chain.blockExplorers?.default?.apiUrl;
|
|
5347
5157
|
if (!explorer) return void 0;
|
|
5348
5158
|
const cache = options?.cache ?? defaultCache;
|
|
5349
|
-
let key =
|
|
5159
|
+
let key = getAddress(address);
|
|
5350
5160
|
const cacheKey = makeCacheKey("abi" /* ABI */, key, String(chain.id));
|
|
5351
5161
|
return cache.getOrSet(
|
|
5352
5162
|
cacheKey,
|
|
@@ -5488,7 +5298,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
|
|
|
5488
5298
|
const params = generateNamedAbiParameters(
|
|
5489
5299
|
result.text_signature || result.name
|
|
5490
5300
|
);
|
|
5491
|
-
const args =
|
|
5301
|
+
const args = decodeAbiParameters3(params, `0x${data.slice(8)}`);
|
|
5492
5302
|
const encodeArgs = Array.from({ length: params.length }).map(
|
|
5493
5303
|
(_val, index) => {
|
|
5494
5304
|
if (params[index].type === "bool") {
|
|
@@ -5506,7 +5316,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
|
|
|
5506
5316
|
return args[`${index}`] ?? "0x";
|
|
5507
5317
|
}
|
|
5508
5318
|
);
|
|
5509
|
-
const newData =
|
|
5319
|
+
const newData = encodeAbiParameters(
|
|
5510
5320
|
params,
|
|
5511
5321
|
encodeArgs
|
|
5512
5322
|
).slice(2);
|