@lukso/transaction-decoder 1.3.5 → 1.3.6-dev.0a1e0b9
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,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
consumerModel,
|
|
3
3
|
decodeTransaction
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RYQVLCCC.js";
|
|
5
5
|
import {
|
|
6
6
|
fetchMultipleAddresses
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HFBAO6YR.js";
|
|
8
8
|
import {
|
|
9
9
|
__name,
|
|
10
10
|
collectDataKeys,
|
|
11
11
|
defaultPlugins,
|
|
12
12
|
defaultSchemaPlugins
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-MGPLCACC.js";
|
|
14
14
|
|
|
15
15
|
// src/shared/cache.ts
|
|
16
16
|
function isPromise(value) {
|
|
@@ -801,4 +801,4 @@ export {
|
|
|
801
801
|
getAllData,
|
|
802
802
|
getAllTransactions
|
|
803
803
|
};
|
|
804
|
-
//# sourceMappingURL=chunk-
|
|
804
|
+
//# sourceMappingURL=chunk-MSTGEOTX.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
decodeTransaction,
|
|
5
5
|
isAsyncOperationEnabled,
|
|
6
6
|
pluginRegistry
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MGPLCACC.js";
|
|
8
8
|
|
|
9
9
|
// src/core/dataModel.ts
|
|
10
10
|
import { batch, effect, signal } from "@preact/signals-core";
|
|
@@ -812,4 +812,4 @@ export {
|
|
|
812
812
|
decodeTransaction2 as decodeTransaction,
|
|
813
813
|
decodeTransactionAsync
|
|
814
814
|
};
|
|
815
|
-
//# sourceMappingURL=chunk-
|
|
815
|
+
//# sourceMappingURL=chunk-RYQVLCCC.js.map
|
package/dist/data.cjs
CHANGED
|
@@ -3073,6 +3073,170 @@ 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
|
+
|
|
3076
3240
|
// src/decoder/plugins/enhanceLSP0ERC725Account.ts
|
|
3077
3241
|
var enhanceLSP0ERC725AccountPlugin = standardPlugin(
|
|
3078
3242
|
UniversalProfile,
|
|
@@ -3084,7 +3248,33 @@ var enhanceLSP0ERC725AccountPlugin = standardPlugin(
|
|
|
3084
3248
|
{
|
|
3085
3249
|
enhance: enhanceLSP0ERC725Account,
|
|
3086
3250
|
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
3087
|
-
|
|
3251
|
+
const decoded = decodeEvent(options.chain, UniversalProfile, log);
|
|
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
|
+
};
|
|
3088
3278
|
}, "decodeEvent")
|
|
3089
3279
|
}
|
|
3090
3280
|
);
|
|
@@ -4999,9 +5189,9 @@ var abi2 = [
|
|
|
4999
5189
|
|
|
5000
5190
|
// src/decoder/functionSignature.ts
|
|
5001
5191
|
import {
|
|
5002
|
-
decodeAbiParameters as
|
|
5003
|
-
encodeAbiParameters,
|
|
5004
|
-
getAddress,
|
|
5192
|
+
decodeAbiParameters as decodeAbiParameters4,
|
|
5193
|
+
encodeAbiParameters as encodeAbiParameters2,
|
|
5194
|
+
getAddress as getAddress2,
|
|
5005
5195
|
isAddress as isAddress2,
|
|
5006
5196
|
isAddressEqual as isAddressEqual2,
|
|
5007
5197
|
parseAbiParameters,
|
|
@@ -5156,7 +5346,7 @@ async function fetchAbi(chain, address, options) {
|
|
|
5156
5346
|
const explorer = chain.blockExplorers?.default?.apiUrl;
|
|
5157
5347
|
if (!explorer) return void 0;
|
|
5158
5348
|
const cache = options?.cache ?? defaultCache;
|
|
5159
|
-
let key =
|
|
5349
|
+
let key = getAddress2(address);
|
|
5160
5350
|
const cacheKey = makeCacheKey("abi" /* ABI */, key, String(chain.id));
|
|
5161
5351
|
return cache.getOrSet(
|
|
5162
5352
|
cacheKey,
|
|
@@ -5298,7 +5488,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
|
|
|
5298
5488
|
const params = generateNamedAbiParameters(
|
|
5299
5489
|
result.text_signature || result.name
|
|
5300
5490
|
);
|
|
5301
|
-
const args =
|
|
5491
|
+
const args = decodeAbiParameters4(params, `0x${data.slice(8)}`);
|
|
5302
5492
|
const encodeArgs = Array.from({ length: params.length }).map(
|
|
5303
5493
|
(_val, index) => {
|
|
5304
5494
|
if (params[index].type === "bool") {
|
|
@@ -5316,7 +5506,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
|
|
|
5316
5506
|
return args[`${index}`] ?? "0x";
|
|
5317
5507
|
}
|
|
5318
5508
|
);
|
|
5319
|
-
const newData =
|
|
5509
|
+
const newData = encodeAbiParameters2(
|
|
5320
5510
|
params,
|
|
5321
5511
|
encodeArgs
|
|
5322
5512
|
).slice(2);
|