@lukso/transaction-decoder 1.0.1-dev.0f1bea5
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/LICENSE +201 -0
- package/README.md +486 -0
- package/dist/browser.cjs +6912 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +6 -0
- package/dist/browser.d.ts +6 -0
- package/dist/browser.js +131 -0
- package/dist/browser.js.map +1 -0
- package/dist/cdn/transaction-decoder.global.js +296 -0
- package/dist/cdn/transaction-decoder.global.js.map +1 -0
- package/dist/chunk-GGBHTWJL.js +437 -0
- package/dist/chunk-GGBHTWJL.js.map +1 -0
- package/dist/chunk-GXZOF3QY.js +839 -0
- package/dist/chunk-GXZOF3QY.js.map +1 -0
- package/dist/chunk-LJ6ES5XF.js +776 -0
- package/dist/chunk-LJ6ES5XF.js.map +1 -0
- package/dist/chunk-XVHJWV5U.js +4925 -0
- package/dist/chunk-XVHJWV5U.js.map +1 -0
- package/dist/data.cjs +5518 -0
- package/dist/data.cjs.map +1 -0
- package/dist/data.d.cts +43 -0
- package/dist/data.d.ts +43 -0
- package/dist/data.js +55 -0
- package/dist/data.js.map +1 -0
- package/dist/index-BzXh7poJ.d.cts +524 -0
- package/dist/index-BzXh7poJ.d.ts +524 -0
- package/dist/index.cjs +6912 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +756 -0
- package/dist/index.d.ts +756 -0
- package/dist/index.js +131 -0
- package/dist/index.js.map +1 -0
- package/dist/server.cjs +5644 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +217 -0
- package/dist/server.d.ts +217 -0
- package/dist/server.js +644 -0
- package/dist/server.js.map +1 -0
- package/dist/utils-CBAkjQh3.d.cts +108 -0
- package/dist/utils-xT9-km0r.d.ts +108 -0
- package/package.json +101 -0
- package/src/browser.ts +13 -0
- package/src/client/resolveAddresses.ts +157 -0
- package/src/core/addressCollector.ts +153 -0
- package/src/core/addressResolver.ts +135 -0
- package/src/core/dataModel.ts +888 -0
- package/src/core/instance.ts +33 -0
- package/src/core/integrateDecoder.ts +325 -0
- package/src/data.ts +70 -0
- package/src/decoder/GENERATOR_PROPOSAL.md +182 -0
- package/src/decoder/THREE_PHASE_EXAMPLE.md +108 -0
- package/src/decoder/aggregation.ts +218 -0
- package/src/decoder/browserCache.ts +237 -0
- package/src/decoder/cache/README.md +126 -0
- package/src/decoder/cache/index.ts +44 -0
- package/src/decoder/cache.ts +139 -0
- package/src/decoder/constants.ts +125 -0
- package/src/decoder/decodeTransaction.ts +292 -0
- package/src/decoder/errors.ts +95 -0
- package/src/decoder/events.ts +192 -0
- package/src/decoder/functionSignature.ts +344 -0
- package/src/decoder/getDataFromExternalSources.ts +248 -0
- package/src/decoder/graphqlWS.ts +22 -0
- package/src/decoder/interfaces.ts +185 -0
- package/src/decoder/keyValue.ts +5 -0
- package/src/decoder/kvCache.ts +241 -0
- package/src/decoder/lruCache.ts +184 -0
- package/src/decoder/lsp7Mint.test.ts +179 -0
- package/src/decoder/lsp7TransferBatch.test.ts +105 -0
- package/src/decoder/plugins/RegistryAbi.ts +562 -0
- package/src/decoder/plugins/enhanceBurntPix.ts +132 -0
- package/src/decoder/plugins/enhanceGraffiti.ts +70 -0
- package/src/decoder/plugins/enhanceLSP0ERC725Account.ts +179 -0
- package/src/decoder/plugins/enhanceLSP26FollowerSystem.ts +88 -0
- package/src/decoder/plugins/enhanceLSP6KeyManager.ts +231 -0
- package/src/decoder/plugins/enhanceLSP7DigitalAsset.ts +165 -0
- package/src/decoder/plugins/enhanceLSP8IdentifiableDigitalAsset.ts +170 -0
- package/src/decoder/plugins/enhanceLSP9Vault.ts +57 -0
- package/src/decoder/plugins/enhanceRetrieveAbi.ts +85 -0
- package/src/decoder/plugins/enhanceSetData.ts +135 -0
- package/src/decoder/plugins/index.ts +99 -0
- package/src/decoder/plugins/schemaDefault.ts +318 -0
- package/src/decoder/plugins/standardPlugin.ts +202 -0
- package/src/decoder/registry.ts +322 -0
- package/src/decoder/singleGQL.ts +293 -0
- package/src/decoder/transaction.ts +198 -0
- package/src/decoder/types.ts +465 -0
- package/src/decoder/utils.ts +212 -0
- package/src/example/usage.ts +172 -0
- package/src/index.ts +174 -0
- package/src/server/addressResolver.ts +68 -0
- package/src/server/caches.ts +209 -0
- package/src/server/decodeTransactionSync.ts +156 -0
- package/src/server/decodeTransactionsBatch.ts +207 -0
- package/src/server/finishDecoding.ts +116 -0
- package/src/server/index.ts +81 -0
- package/src/server/lsp23Resolver.test.ts +46 -0
- package/src/server/lsp23Resolver.ts +419 -0
- package/src/server/types.ts +168 -0
- package/src/server.ts +22 -0
- package/src/shared/addressResolver.ts +651 -0
- package/src/shared/cache.ts +144 -0
- package/src/shared/constants.ts +21 -0
- package/src/stubs/tty.ts +13 -0
- package/src/stubs/util.ts +42 -0
- package/src/types/index.ts +154 -0
- package/src/types/provider.ts +46 -0
- package/src/umd.ts +13 -0
- package/src/utils/debug.ts +49 -0
- package/src/utils/json-bigint.ts +47 -0
|
@@ -0,0 +1,4925 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/decoder/utils.ts
|
|
5
|
+
import {
|
|
6
|
+
AbiFunctionSignatureNotFoundError,
|
|
7
|
+
createPublicClient,
|
|
8
|
+
decodeAbiParameters,
|
|
9
|
+
http,
|
|
10
|
+
slice,
|
|
11
|
+
toFunctionSelector
|
|
12
|
+
} from "viem";
|
|
13
|
+
import { formatAbiItem } from "viem/utils";
|
|
14
|
+
function customDecodeFunctionData(parameters, preferError) {
|
|
15
|
+
try {
|
|
16
|
+
const { abi: abi3, data } = parameters;
|
|
17
|
+
const signature = slice(data, 0, 4);
|
|
18
|
+
const description = abi3.find(
|
|
19
|
+
(x) => x.type === (preferError ? "error" : "function") && signature === toFunctionSelector(formatAbiItem(x))
|
|
20
|
+
) || void 0;
|
|
21
|
+
if (!description)
|
|
22
|
+
throw new AbiFunctionSignatureNotFoundError(signature, {
|
|
23
|
+
docsPath: "/docs/contract/decodeFunctionData"
|
|
24
|
+
});
|
|
25
|
+
const args = "inputs" in description && description.inputs && description.inputs.length > 0 ? decodeAbiParameters(description.inputs, slice(data, 4)) : void 0;
|
|
26
|
+
const result = {
|
|
27
|
+
functionName: description.name,
|
|
28
|
+
sig: signature,
|
|
29
|
+
input: data
|
|
30
|
+
};
|
|
31
|
+
if (args) {
|
|
32
|
+
const { args: namedArgs } = createNamedArgs(args, description.inputs);
|
|
33
|
+
result.args = namedArgs;
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
__name(customDecodeFunctionData, "customDecodeFunctionData");
|
|
40
|
+
function createNamedArgs(args, inputs) {
|
|
41
|
+
const array = args.map((value, index) => {
|
|
42
|
+
return {
|
|
43
|
+
name: `args${index + 1}`,
|
|
44
|
+
...inputs?.[index],
|
|
45
|
+
value
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
return { args: array };
|
|
49
|
+
}
|
|
50
|
+
__name(createNamedArgs, "createNamedArgs");
|
|
51
|
+
function getArgByName(args, name) {
|
|
52
|
+
if (!args) return void 0;
|
|
53
|
+
const arg = args.find((arg2) => arg2.name === name);
|
|
54
|
+
return arg?.value;
|
|
55
|
+
}
|
|
56
|
+
__name(getArgByName, "getArgByName");
|
|
57
|
+
function extractAddress(address) {
|
|
58
|
+
if (typeof address === "object") {
|
|
59
|
+
return address.address;
|
|
60
|
+
}
|
|
61
|
+
return address;
|
|
62
|
+
}
|
|
63
|
+
__name(extractAddress, "extractAddress");
|
|
64
|
+
var clients = {};
|
|
65
|
+
function getPublicClient(chain) {
|
|
66
|
+
const { id } = chain;
|
|
67
|
+
if (!id) {
|
|
68
|
+
throw new Error("Chain ID is required to create a public client");
|
|
69
|
+
}
|
|
70
|
+
if (!clients[id]) {
|
|
71
|
+
clients[id] = createPublicClient({
|
|
72
|
+
chain,
|
|
73
|
+
transport: http(),
|
|
74
|
+
batch: {
|
|
75
|
+
multicall: {
|
|
76
|
+
batchSize: 100
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const result = clients[id];
|
|
82
|
+
if (!result) {
|
|
83
|
+
throw new Error(`Public client for chain ID ${id} not found`);
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
__name(getPublicClient, "getPublicClient");
|
|
88
|
+
function isAsyncOperationEnabled(asyncOption, operation) {
|
|
89
|
+
if (typeof asyncOption === "boolean") {
|
|
90
|
+
return asyncOption;
|
|
91
|
+
}
|
|
92
|
+
if (asyncOption === void 0) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return (asyncOption & operation) !== 0;
|
|
96
|
+
}
|
|
97
|
+
__name(isAsyncOperationEnabled, "isAsyncOperationEnabled");
|
|
98
|
+
function needsEnhancementSingle(item) {
|
|
99
|
+
if ("sig" in item && item.sig === "0x") {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (item.standard) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
__name(needsEnhancementSingle, "needsEnhancementSingle");
|
|
108
|
+
function needsEnhancement(result) {
|
|
109
|
+
if (needsEnhancementSingle(result)) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
if ("children" in result && Array.isArray(result.children)) {
|
|
113
|
+
return result.children.some((child) => {
|
|
114
|
+
if (child.standard) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
if ("sig" in child && child.sig === "0x") {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
__name(needsEnhancement, "needsEnhancement");
|
|
126
|
+
|
|
127
|
+
// src/core/addressCollector.ts
|
|
128
|
+
import { isHex, size } from "viem";
|
|
129
|
+
function collectDataKeys(data, skipGqlTypes = true, existingKeys) {
|
|
130
|
+
const addresses = /* @__PURE__ */ new Set();
|
|
131
|
+
if (existingKeys) {
|
|
132
|
+
for (const key of existingKeys) {
|
|
133
|
+
if (typeof key === "string") {
|
|
134
|
+
addresses.add(key);
|
|
135
|
+
} else {
|
|
136
|
+
addresses.add(JSON.stringify(key));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function collectLSP8Tokens(obj) {
|
|
141
|
+
if (obj.standard !== "LSP8IdentifiableDigitalAsset" || !obj.to || !obj.args) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const contractAddress = obj.to;
|
|
145
|
+
const args = obj.args;
|
|
146
|
+
const tokenId = getArgByName(args, "tokenId");
|
|
147
|
+
if (tokenId && tokenId !== null && tokenId !== "0x") {
|
|
148
|
+
addresses.add(`${contractAddress}:${tokenId}`);
|
|
149
|
+
}
|
|
150
|
+
const tokenIds = getArgByName(args, "tokenIds");
|
|
151
|
+
if (Array.isArray(tokenIds)) {
|
|
152
|
+
for (const tokenId2 of tokenIds) {
|
|
153
|
+
if (tokenId2 && tokenId2 !== null && tokenId2 !== "0x") {
|
|
154
|
+
addresses.add(`${contractAddress}:${tokenId2}`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
__name(collectLSP8Tokens, "collectLSP8Tokens");
|
|
160
|
+
function collect(obj, parent, visited = /* @__PURE__ */ new WeakSet(), path = []) {
|
|
161
|
+
if (obj && typeof obj === "object" && visited.has(obj)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (obj && typeof obj === "object") {
|
|
165
|
+
visited.add(obj);
|
|
166
|
+
}
|
|
167
|
+
if (typeof obj === "string" && obj.startsWith("0x")) {
|
|
168
|
+
if (obj.includes(":")) {
|
|
169
|
+
const [addressPart, tokenIdPart] = obj.split(":");
|
|
170
|
+
if (addressPart.startsWith("0x") && tokenIdPart.startsWith("0x") && isHex(addressPart) && size(addressPart) === 20) {
|
|
171
|
+
addresses.add(obj);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const isPaddedAddress = /^0x0*([a-fA-F0-9]{40})$/.test(obj);
|
|
176
|
+
if (isPaddedAddress || isHex(obj) && size(obj) === 20) {
|
|
177
|
+
if (parent && skipGqlTypes && "__gqltype" in parent) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const address = isPaddedAddress ? obj.replace(/^0x0*([a-fA-F0-9]{40})$/, "0x$1") : obj;
|
|
181
|
+
if (address.slice(2).split("").filter((c) => c === "0").length > 10) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
addresses.add(address);
|
|
185
|
+
}
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (!obj || typeof obj !== "object") return;
|
|
189
|
+
if (Array.isArray(obj)) {
|
|
190
|
+
for (let i = 0; i < obj.length; i++) {
|
|
191
|
+
collect(obj[i], parent, visited, [...path, `[${i}]`]);
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
const record = obj;
|
|
195
|
+
if ("standard" in record && "to" in record && "args" in record) {
|
|
196
|
+
collectLSP8Tokens(record);
|
|
197
|
+
}
|
|
198
|
+
for (const [key, value] of Object.entries(record)) {
|
|
199
|
+
collect(value, record, visited, [...path, key]);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
__name(collect, "collect");
|
|
204
|
+
collect(data);
|
|
205
|
+
return Array.from(addresses);
|
|
206
|
+
}
|
|
207
|
+
__name(collectDataKeys, "collectDataKeys");
|
|
208
|
+
|
|
209
|
+
// src/decoder/registry.ts
|
|
210
|
+
var PluginRegistry = class {
|
|
211
|
+
static {
|
|
212
|
+
__name(this, "PluginRegistry");
|
|
213
|
+
}
|
|
214
|
+
plugins = /* @__PURE__ */ new Map();
|
|
215
|
+
schemaPlugins = /* @__PURE__ */ new Map();
|
|
216
|
+
/**
|
|
217
|
+
* Register a decoder plugin
|
|
218
|
+
* @param name - Unique plugin name
|
|
219
|
+
* @param plugin - Plugin instance
|
|
220
|
+
* @param options - Registration options
|
|
221
|
+
*/
|
|
222
|
+
register(name, plugin, options) {
|
|
223
|
+
const {
|
|
224
|
+
override = false,
|
|
225
|
+
priority = 0,
|
|
226
|
+
required = false,
|
|
227
|
+
description,
|
|
228
|
+
version,
|
|
229
|
+
usesAsync = false
|
|
230
|
+
} = options || {};
|
|
231
|
+
const existing = this.plugins.get(name);
|
|
232
|
+
if (existing) {
|
|
233
|
+
if (existing.required) {
|
|
234
|
+
console.error(
|
|
235
|
+
`Plugin "${name}" is marked as required and cannot be overridden.`
|
|
236
|
+
);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (!override) {
|
|
240
|
+
console.warn(
|
|
241
|
+
`Plugin "${name}" is already registered. Use override: true to replace.`
|
|
242
|
+
);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
this.plugins.set(name, {
|
|
247
|
+
name,
|
|
248
|
+
plugin: Object.freeze(plugin),
|
|
249
|
+
priority,
|
|
250
|
+
required,
|
|
251
|
+
description,
|
|
252
|
+
version,
|
|
253
|
+
usesAsync
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Register a schema plugin
|
|
258
|
+
* @param name - Unique plugin name
|
|
259
|
+
* @param plugin - Schema plugin instance
|
|
260
|
+
* @param options - Registration options
|
|
261
|
+
*/
|
|
262
|
+
registerSchema(name, plugin, options) {
|
|
263
|
+
const {
|
|
264
|
+
override = false,
|
|
265
|
+
priority = 0,
|
|
266
|
+
required = false,
|
|
267
|
+
description,
|
|
268
|
+
version
|
|
269
|
+
} = options || {};
|
|
270
|
+
const existing = this.schemaPlugins.get(name);
|
|
271
|
+
if (existing) {
|
|
272
|
+
if (existing.required) {
|
|
273
|
+
console.error(
|
|
274
|
+
`Schema plugin "${name}" is marked as required and cannot be overridden.`
|
|
275
|
+
);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (!override) {
|
|
279
|
+
console.warn(
|
|
280
|
+
`Schema plugin "${name}" is already registered. Use override: true to replace.`
|
|
281
|
+
);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
this.schemaPlugins.set(name, {
|
|
286
|
+
name,
|
|
287
|
+
plugin: Object.freeze(plugin),
|
|
288
|
+
priority,
|
|
289
|
+
required,
|
|
290
|
+
description,
|
|
291
|
+
version
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Unregister a plugin
|
|
296
|
+
*/
|
|
297
|
+
unregister(name) {
|
|
298
|
+
return this.plugins.delete(name);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Get all registered decoder plugins (excluding overridden ones)
|
|
302
|
+
* @param options - Filter options
|
|
303
|
+
*/
|
|
304
|
+
async getAll(options) {
|
|
305
|
+
const { excludeNames = [], syncOnly = false } = options || {};
|
|
306
|
+
const exclude = new Set(excludeNames);
|
|
307
|
+
let plugins = Array.from(this.plugins.values());
|
|
308
|
+
if (syncOnly) {
|
|
309
|
+
plugins = plugins.filter((meta) => !meta.usesAsync);
|
|
310
|
+
}
|
|
311
|
+
for (const name of exclude) {
|
|
312
|
+
const plugin = this.plugins.get(name);
|
|
313
|
+
if (plugin?.required) {
|
|
314
|
+
console.warn(
|
|
315
|
+
`Warning: Plugin "${name}" is required and cannot be excluded. It will run first.`
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return plugins.sort((a, b) => (b.priority || 0) - (a.priority || 0)).map(({ plugin }) => plugin);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Get all schema plugins (excluding overridden ones)
|
|
323
|
+
* @param excludeNames - Plugin names to exclude
|
|
324
|
+
*/
|
|
325
|
+
getAllSchema(excludeNames) {
|
|
326
|
+
const exclude = new Set(excludeNames || []);
|
|
327
|
+
const plugins = Array.from(this.schemaPlugins.values());
|
|
328
|
+
for (const name of exclude) {
|
|
329
|
+
const plugin = this.schemaPlugins.get(name);
|
|
330
|
+
if (plugin?.required) {
|
|
331
|
+
console.warn(
|
|
332
|
+
`Warning: Schema plugin "${name}" is required and cannot be excluded. It will run first.`
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
const required = plugins.filter((meta) => meta.required).sort((a, b) => (b.priority || 0) - (a.priority || 0));
|
|
337
|
+
const optional = plugins.filter((meta) => !meta.required && !exclude.has(meta.name)).sort((a, b) => (b.priority || 0) - (a.priority || 0));
|
|
338
|
+
return [...required, ...optional].map((meta) => meta.plugin);
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Get a specific plugin by name
|
|
342
|
+
*/
|
|
343
|
+
async get(name) {
|
|
344
|
+
const meta = this.plugins.get(name);
|
|
345
|
+
return meta?.plugin;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Get plugin metadata
|
|
349
|
+
*/
|
|
350
|
+
getMetadata(name) {
|
|
351
|
+
return this.plugins.get(name);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Get schema plugin metadata
|
|
355
|
+
*/
|
|
356
|
+
getSchemaMetadata(name) {
|
|
357
|
+
return this.schemaPlugins.get(name);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Check if a plugin is registered
|
|
361
|
+
*/
|
|
362
|
+
has(name) {
|
|
363
|
+
return this.plugins.has(name);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Clear all plugins
|
|
367
|
+
*/
|
|
368
|
+
clear() {
|
|
369
|
+
this.plugins.clear();
|
|
370
|
+
this.schemaPlugins.clear();
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Get the number of registered plugins
|
|
374
|
+
*/
|
|
375
|
+
get size() {
|
|
376
|
+
return this.plugins.size + this.schemaPlugins.size;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* List all registered plugins with metadata
|
|
380
|
+
*/
|
|
381
|
+
list() {
|
|
382
|
+
return {
|
|
383
|
+
plugins: Array.from(this.plugins.values()),
|
|
384
|
+
schemaPlugins: Array.from(this.schemaPlugins.values())
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
Object.freeze(PluginRegistry.prototype);
|
|
389
|
+
Object.freeze(PluginRegistry);
|
|
390
|
+
var pluginRegistry = new PluginRegistry();
|
|
391
|
+
function registerPlugin(name, plugin, options) {
|
|
392
|
+
pluginRegistry.register(name, plugin, options);
|
|
393
|
+
}
|
|
394
|
+
__name(registerPlugin, "registerPlugin");
|
|
395
|
+
function registerSchemaPlugin(name, plugin, options) {
|
|
396
|
+
pluginRegistry.registerSchema(name, plugin, options);
|
|
397
|
+
}
|
|
398
|
+
__name(registerSchemaPlugin, "registerSchemaPlugin");
|
|
399
|
+
function createNamedSchemaPlugin(name, plugin) {
|
|
400
|
+
const namedPlugin = Object.assign(plugin, { name });
|
|
401
|
+
return namedPlugin;
|
|
402
|
+
}
|
|
403
|
+
__name(createNamedSchemaPlugin, "createNamedSchemaPlugin");
|
|
404
|
+
function createNamedPlugin(name, plugin) {
|
|
405
|
+
return { ...plugin, name };
|
|
406
|
+
}
|
|
407
|
+
__name(createNamedPlugin, "createNamedPlugin");
|
|
408
|
+
|
|
409
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP1UniversalReceiverDelegate.json
|
|
410
|
+
var LSP1UniversalReceiverDelegate_default = [
|
|
411
|
+
{
|
|
412
|
+
name: "LSP1UniversalReceiverDelegate",
|
|
413
|
+
key: "0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47",
|
|
414
|
+
keyType: "Singleton",
|
|
415
|
+
valueType: "address",
|
|
416
|
+
valueContent: "Address"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
name: "LSP1UniversalReceiverDelegate:<bytes32>",
|
|
420
|
+
key: "0x0cfc51aec37c55a4d0b10000<bytes32>",
|
|
421
|
+
keyType: "Mapping",
|
|
422
|
+
valueType: "address",
|
|
423
|
+
valueContent: "Address"
|
|
424
|
+
}
|
|
425
|
+
];
|
|
426
|
+
|
|
427
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP3ProfileMetadata.json
|
|
428
|
+
var LSP3ProfileMetadata_default = [
|
|
429
|
+
{
|
|
430
|
+
name: "SupportedStandards:LSP3Profile",
|
|
431
|
+
key: "0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347",
|
|
432
|
+
keyType: "Mapping",
|
|
433
|
+
valueType: "bytes4",
|
|
434
|
+
valueContent: "0x5ef83ad9"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
name: "LSP3Profile",
|
|
438
|
+
key: "0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5",
|
|
439
|
+
keyType: "Singleton",
|
|
440
|
+
valueType: "bytes",
|
|
441
|
+
valueContent: "VerifiableURI"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
name: "LSP12IssuedAssets[]",
|
|
445
|
+
key: "0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd",
|
|
446
|
+
keyType: "Array",
|
|
447
|
+
valueType: "address",
|
|
448
|
+
valueContent: "Address"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
name: "LSP12IssuedAssetsMap:<address>",
|
|
452
|
+
key: "0x74ac2555c10b9349e78f0000<address>",
|
|
453
|
+
keyType: "Mapping",
|
|
454
|
+
valueType: "(bytes4,uint128)",
|
|
455
|
+
valueContent: "(Bytes4,Number)"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: "LSP5ReceivedAssets[]",
|
|
459
|
+
key: "0x6460ee3c0aac563ccbf76d6e1d07bada78e3a9514e6382b736ed3f478ab7b90b",
|
|
460
|
+
keyType: "Array",
|
|
461
|
+
valueType: "address",
|
|
462
|
+
valueContent: "Address"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: "LSP5ReceivedAssetsMap:<address>",
|
|
466
|
+
key: "0x812c4334633eb816c80d0000<address>",
|
|
467
|
+
keyType: "Mapping",
|
|
468
|
+
valueType: "(bytes4,uint128)",
|
|
469
|
+
valueContent: "(Bytes4,Number)"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
name: "LSP1UniversalReceiverDelegate",
|
|
473
|
+
key: "0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47",
|
|
474
|
+
keyType: "Singleton",
|
|
475
|
+
valueType: "address",
|
|
476
|
+
valueContent: "Address"
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: "LSP1UniversalReceiverDelegate:<bytes32>",
|
|
480
|
+
key: "0x0cfc51aec37c55a4d0b10000<bytes32>",
|
|
481
|
+
keyType: "Mapping",
|
|
482
|
+
valueType: "address",
|
|
483
|
+
valueContent: "Address"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
name: "LSP17Extension:<bytes4>",
|
|
487
|
+
key: "0xcee78b4094da860110960000<bytes4>",
|
|
488
|
+
keyType: "Mapping",
|
|
489
|
+
valueType: "address",
|
|
490
|
+
valueContent: "Address"
|
|
491
|
+
}
|
|
492
|
+
];
|
|
493
|
+
|
|
494
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP4DigitalAsset.json
|
|
495
|
+
var LSP4DigitalAsset_default = [
|
|
496
|
+
{
|
|
497
|
+
name: "SupportedStandards:LSP4DigitalAsset",
|
|
498
|
+
key: "0xeafec4d89fa9619884b60000a4d96624a38f7ac2d8d9a604ecf07c12c77e480c",
|
|
499
|
+
keyType: "Mapping",
|
|
500
|
+
valueType: "bytes4",
|
|
501
|
+
valueContent: "0xa4d96624"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
name: "LSP4TokenName",
|
|
505
|
+
key: "0xdeba1e292f8ba88238e10ab3c7f88bd4be4fac56cad5194b6ecceaf653468af1",
|
|
506
|
+
keyType: "Singleton",
|
|
507
|
+
valueType: "string",
|
|
508
|
+
valueContent: "String"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
name: "LSP4TokenSymbol",
|
|
512
|
+
key: "0x2f0a68ab07768e01943a599e73362a0e17a63a72e94dd2e384d2c1d4db932756",
|
|
513
|
+
keyType: "Singleton",
|
|
514
|
+
valueType: "string",
|
|
515
|
+
valueContent: "String"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: "LSP4TokenType",
|
|
519
|
+
key: "0xe0261fa95db2eb3b5439bd033cda66d56b96f92f243a8228fd87550ed7bdfdb3",
|
|
520
|
+
keyType: "Singleton",
|
|
521
|
+
valueType: "uint256",
|
|
522
|
+
valueContent: "Number"
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
name: "LSP4Metadata",
|
|
526
|
+
key: "0x9afb95cacc9f95858ec44aa8c3b685511002e30ae54415823f406128b85b238e",
|
|
527
|
+
keyType: "Singleton",
|
|
528
|
+
valueType: "bytes",
|
|
529
|
+
valueContent: "VerifiableURI"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
name: "LSP4Creators[]",
|
|
533
|
+
key: "0x114bd03b3a46d48759680d81ebb2b414fda7d030a7105a851867accf1c2352e7",
|
|
534
|
+
keyType: "Array",
|
|
535
|
+
valueType: "address",
|
|
536
|
+
valueContent: "Address"
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
name: "LSP4CreatorsMap:<address>",
|
|
540
|
+
key: "0x6de85eaf5d982b4e5da00000<address>",
|
|
541
|
+
keyType: "Mapping",
|
|
542
|
+
valueType: "(bytes4,uint128)",
|
|
543
|
+
valueContent: "(Bytes4,Number)"
|
|
544
|
+
}
|
|
545
|
+
];
|
|
546
|
+
|
|
547
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP4DigitalAssetLegacy.json
|
|
548
|
+
var LSP4DigitalAssetLegacy_default = [
|
|
549
|
+
{
|
|
550
|
+
name: "SupportedStandards:LSP4DigitalCertificate",
|
|
551
|
+
key: "0xeafec4d89fa9619884b6b89135626455000000000000000000000000abf0613c",
|
|
552
|
+
keyType: "Mapping",
|
|
553
|
+
valueContent: "0xabf0613c",
|
|
554
|
+
valueType: "bytes"
|
|
555
|
+
}
|
|
556
|
+
];
|
|
557
|
+
|
|
558
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP5ReceivedAssets.json
|
|
559
|
+
var LSP5ReceivedAssets_default = [
|
|
560
|
+
{
|
|
561
|
+
name: "LSP5ReceivedAssets[]",
|
|
562
|
+
key: "0x6460ee3c0aac563ccbf76d6e1d07bada78e3a9514e6382b736ed3f478ab7b90b",
|
|
563
|
+
keyType: "Array",
|
|
564
|
+
valueType: "address",
|
|
565
|
+
valueContent: "Address"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: "LSP5ReceivedAssetsMap:<address>",
|
|
569
|
+
key: "0x812c4334633eb816c80d0000<address>",
|
|
570
|
+
keyType: "Mapping",
|
|
571
|
+
valueType: "(bytes4,uint128)",
|
|
572
|
+
valueContent: "(Bytes4,Number)"
|
|
573
|
+
}
|
|
574
|
+
];
|
|
575
|
+
|
|
576
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP6KeyManager.json
|
|
577
|
+
var LSP6KeyManager_default = [
|
|
578
|
+
{
|
|
579
|
+
name: "AddressPermissions[]",
|
|
580
|
+
key: "0xdf30dba06db6a30e65354d9a64c609861f089545ca58c6b4dbe31a5f338cb0e3",
|
|
581
|
+
keyType: "Array",
|
|
582
|
+
valueType: "address",
|
|
583
|
+
valueContent: "Address"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: "AddressPermissions:Permissions:<address>",
|
|
587
|
+
key: "0x4b80742de2bf82acb3630000<address>",
|
|
588
|
+
keyType: "MappingWithGrouping",
|
|
589
|
+
valueType: "bytes32",
|
|
590
|
+
valueContent: "BitArray"
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
name: "AddressPermissions:AllowedCalls:<address>",
|
|
594
|
+
key: "0x4b80742de2bf393a64c70000<address>",
|
|
595
|
+
keyType: "MappingWithGrouping",
|
|
596
|
+
valueType: "(bytes4,address,bytes4,bytes4)[CompactBytesArray]",
|
|
597
|
+
valueContent: "(BitArray,Address,Bytes4,Bytes4)"
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: "AddressPermissions:AllowedERC725YDataKeys:<address>",
|
|
601
|
+
key: "0x4b80742de2bf866c29110000<address>",
|
|
602
|
+
keyType: "MappingWithGrouping",
|
|
603
|
+
valueType: "bytes[CompactBytesArray]",
|
|
604
|
+
valueContent: "Bytes"
|
|
605
|
+
}
|
|
606
|
+
];
|
|
607
|
+
|
|
608
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP8IdentifiableDigitalAsset.json
|
|
609
|
+
var LSP8IdentifiableDigitalAsset_default = [
|
|
610
|
+
{
|
|
611
|
+
name: "LSP8TokenIdFormat",
|
|
612
|
+
key: "0xf675e9361af1c1664c1868cfa3eb97672d6b1a513aa5b81dec34c9ee330e818d",
|
|
613
|
+
keyType: "Singleton",
|
|
614
|
+
valueType: "uint256",
|
|
615
|
+
valueContent: "Number"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
name: "LSP8TokenMetadataBaseURI",
|
|
619
|
+
key: "0x1a7628600c3bac7101f53697f48df381ddc36b9015e7d7c9c5633d1252aa2843",
|
|
620
|
+
keyType: "Singleton",
|
|
621
|
+
valueType: "bytes",
|
|
622
|
+
valueContent: "VerifiableURI"
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
name: "LSP8ReferenceContract",
|
|
626
|
+
key: "0x708e7b881795f2e6b6c2752108c177ec89248458de3bf69d0d43480b3e5034e6",
|
|
627
|
+
keyType: "Singleton",
|
|
628
|
+
valueType: "(address,bytes32)",
|
|
629
|
+
valueContent: "(Address,Bytes32)"
|
|
630
|
+
}
|
|
631
|
+
];
|
|
632
|
+
|
|
633
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP9Vault.json
|
|
634
|
+
var LSP9Vault_default = [
|
|
635
|
+
{
|
|
636
|
+
name: "SupportedStandards:LSP9Vault",
|
|
637
|
+
key: "0xeafec4d89fa9619884b600007c0334a14085fefa8b51ae5a40895018882bdb90",
|
|
638
|
+
keyType: "Mapping",
|
|
639
|
+
valueType: "bytes4",
|
|
640
|
+
valueContent: "0x7c0334a1"
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
name: "LSP1UniversalReceiverDelegate",
|
|
644
|
+
key: "0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47",
|
|
645
|
+
keyType: "Singleton",
|
|
646
|
+
valueType: "address",
|
|
647
|
+
valueContent: "Address"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
name: "LSP1UniversalReceiverDelegate:<bytes32>",
|
|
651
|
+
key: "0x0cfc51aec37c55a4d0b10000<bytes32>",
|
|
652
|
+
keyType: "Mapping",
|
|
653
|
+
valueType: "address",
|
|
654
|
+
valueContent: "Address"
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
name: "LSP17Extension:<bytes4>",
|
|
658
|
+
key: "0xcee78b4094da860110960000<bytes4>",
|
|
659
|
+
keyType: "Mapping",
|
|
660
|
+
valueType: "address",
|
|
661
|
+
valueContent: "Address"
|
|
662
|
+
}
|
|
663
|
+
];
|
|
664
|
+
|
|
665
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP10ReceivedVaults.json
|
|
666
|
+
var LSP10ReceivedVaults_default = [
|
|
667
|
+
{
|
|
668
|
+
name: "LSP10VaultsMap:<address>",
|
|
669
|
+
key: "0x192448c3c0f88c7f238c0000<address>",
|
|
670
|
+
keyType: "Mapping",
|
|
671
|
+
valueType: "(bytes4,uint128)",
|
|
672
|
+
valueContent: "(Bytes4,Number)"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
name: "LSP10Vaults[]",
|
|
676
|
+
key: "0x55482936e01da86729a45d2b87a6b1d3bc582bea0ec00e38bdb340e3af6f9f06",
|
|
677
|
+
keyType: "Array",
|
|
678
|
+
valueType: "address",
|
|
679
|
+
valueContent: "Address"
|
|
680
|
+
}
|
|
681
|
+
];
|
|
682
|
+
|
|
683
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP12IssuedAssets.json
|
|
684
|
+
var LSP12IssuedAssets_default = [
|
|
685
|
+
{
|
|
686
|
+
name: "LSP12IssuedAssets[]",
|
|
687
|
+
key: "0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd",
|
|
688
|
+
keyType: "Array",
|
|
689
|
+
valueType: "address",
|
|
690
|
+
valueContent: "Address"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
name: "LSP12IssuedAssetsMap:<address>",
|
|
694
|
+
key: "0x74ac2555c10b9349e78f0000<address>",
|
|
695
|
+
keyType: "Mapping",
|
|
696
|
+
valueType: "(bytes4,uint128)",
|
|
697
|
+
valueContent: "(Bytes4,Number)"
|
|
698
|
+
}
|
|
699
|
+
];
|
|
700
|
+
|
|
701
|
+
// ../../node_modules/.pnpm/@erc725+erc725.js@0.28.2_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.13/node_modules/@erc725/erc725.js/schemas/LSP17ContractExtension.json
|
|
702
|
+
var LSP17ContractExtension_default = [
|
|
703
|
+
{
|
|
704
|
+
name: "LSP17Extension:<bytes4>",
|
|
705
|
+
key: "0xcee78b4094da860110960000<bytes4>",
|
|
706
|
+
keyType: "Mapping",
|
|
707
|
+
valueType: "address",
|
|
708
|
+
valueContent: "Address"
|
|
709
|
+
}
|
|
710
|
+
];
|
|
711
|
+
|
|
712
|
+
// src/decoder/constants.ts
|
|
713
|
+
var IPFS_GATEWAY = "https://api.universalprofile.cloud/ipfs/";
|
|
714
|
+
var FUNCTION_DICTIONARY_URL = "https://4bytesdictionary.universalprofile.cloud";
|
|
715
|
+
var OPENCHAIN_DICTIONARY_URL = "https://api.openchain.xyz/signature-database/v1/lookup";
|
|
716
|
+
var ARRAY_MAX = 1e3;
|
|
717
|
+
var defaultSchema = [
|
|
718
|
+
...LSP8IdentifiableDigitalAsset_default,
|
|
719
|
+
...LSP4DigitalAsset_default,
|
|
720
|
+
...LSP5ReceivedAssets_default,
|
|
721
|
+
...LSP3ProfileMetadata_default,
|
|
722
|
+
...LSP1UniversalReceiverDelegate_default,
|
|
723
|
+
...LSP4DigitalAssetLegacy_default,
|
|
724
|
+
...LSP6KeyManager_default,
|
|
725
|
+
...LSP9Vault_default,
|
|
726
|
+
...LSP10ReceivedVaults_default,
|
|
727
|
+
...LSP12IssuedAssets_default,
|
|
728
|
+
...LSP17ContractExtension_default,
|
|
729
|
+
{
|
|
730
|
+
name: "LSP28TheGrid",
|
|
731
|
+
key: "0x724141d9918ce69e6b8afcf53a91748466086ba2c74b94cab43c649ae2ac23ff",
|
|
732
|
+
keyType: "Singleton",
|
|
733
|
+
valueType: "bytes",
|
|
734
|
+
valueContent: "VerifiableURI"
|
|
735
|
+
}
|
|
736
|
+
];
|
|
737
|
+
|
|
738
|
+
// src/decoder/plugins/schemaDefault.ts
|
|
739
|
+
import {
|
|
740
|
+
decodeData,
|
|
741
|
+
decodeMappingKey,
|
|
742
|
+
decodePermissions,
|
|
743
|
+
decodeValueContent,
|
|
744
|
+
isDynamicKeyName
|
|
745
|
+
} from "@erc725/erc725.js";
|
|
746
|
+
import { isHex as isHex2 } from "viem";
|
|
747
|
+
|
|
748
|
+
// src/decoder/getDataFromExternalSources.ts
|
|
749
|
+
import { isDataAuthentic, patchIPFSUrlsIfApplicable } from "@erc725/erc725.js";
|
|
750
|
+
async function loadFile(_url, ipfsGateway) {
|
|
751
|
+
let url = _url;
|
|
752
|
+
if (url.startsWith("data:")) {
|
|
753
|
+
const base64Data = url.split(",")[1];
|
|
754
|
+
const binaryString = atob(base64Data);
|
|
755
|
+
const len = binaryString.length;
|
|
756
|
+
const bytes = new Uint8Array(len);
|
|
757
|
+
for (let i = 0; i < len; i++) {
|
|
758
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
759
|
+
}
|
|
760
|
+
return Promise.resolve(bytes.buffer);
|
|
761
|
+
}
|
|
762
|
+
if (url.startsWith("ipfs://")) {
|
|
763
|
+
const ipfsHash = url.replace("ipfs://", "");
|
|
764
|
+
url = `${ipfsGateway}${ipfsHash}`;
|
|
765
|
+
}
|
|
766
|
+
return fetch(url).then((response) => {
|
|
767
|
+
if (!response.ok) {
|
|
768
|
+
throw new Error("Network response was not ok");
|
|
769
|
+
}
|
|
770
|
+
return response.arrayBuffer();
|
|
771
|
+
}).catch(() => null);
|
|
772
|
+
}
|
|
773
|
+
__name(loadFile, "loadFile");
|
|
774
|
+
var getDataFromExternalSources = /* @__PURE__ */ __name((schemas, dataFromChain, ipfsGateway, throwException = true) => {
|
|
775
|
+
const promises = dataFromChain.map(async (dataEntry) => {
|
|
776
|
+
const schemaElement = schemas.find((schema) => schema.key === dataEntry.key);
|
|
777
|
+
if (!schemaElement) {
|
|
778
|
+
return dataEntry;
|
|
779
|
+
}
|
|
780
|
+
if (!["jsonurl", "asseturl", "verifiableuri"].includes(
|
|
781
|
+
schemaElement.valueContent.toLowerCase()
|
|
782
|
+
)) {
|
|
783
|
+
return dataEntry;
|
|
784
|
+
}
|
|
785
|
+
const urlDataWithHash = dataEntry.value;
|
|
786
|
+
let url;
|
|
787
|
+
let src;
|
|
788
|
+
try {
|
|
789
|
+
if (typeof dataEntry.value === "string") {
|
|
790
|
+
throw new Error(
|
|
791
|
+
`Value is string instead of ${schemaElement.valueContent}`
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
if (!dataEntry.value) {
|
|
795
|
+
throw new Error(`${schemaElement.valueContent} empty`);
|
|
796
|
+
}
|
|
797
|
+
if (Array.isArray(dataEntry.value)) {
|
|
798
|
+
throw new Error(
|
|
799
|
+
`Value is Array instead of ${schemaElement.valueContent}`
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
url = urlDataWithHash.url;
|
|
803
|
+
({ url: src } = patchIPFSUrlsIfApplicable(
|
|
804
|
+
urlDataWithHash,
|
|
805
|
+
ipfsGateway
|
|
806
|
+
));
|
|
807
|
+
let length = "unknown";
|
|
808
|
+
if (!url.startsWith("data:") && /[=?/]$/.test(url)) {
|
|
809
|
+
return dataEntry;
|
|
810
|
+
}
|
|
811
|
+
const receivedData = /^data:|^ipfs:\/\/|\/ipfs\//.test(url) ? await loadFile(src, ipfsGateway).then(
|
|
812
|
+
(buffer) => buffer ? new Uint8Array(buffer) : Promise.reject(new Error("No Data"))
|
|
813
|
+
) : await fetch(src).then(async (response) => {
|
|
814
|
+
if (!response.ok) {
|
|
815
|
+
throw new Error(response.statusText);
|
|
816
|
+
}
|
|
817
|
+
return response.arrayBuffer().then((buffer) => new Uint8Array(buffer));
|
|
818
|
+
});
|
|
819
|
+
length = receivedData.length.toString();
|
|
820
|
+
const captureHashes = {};
|
|
821
|
+
const captureErrors = [];
|
|
822
|
+
if (receivedData.length >= 2) {
|
|
823
|
+
try {
|
|
824
|
+
const capture = [];
|
|
825
|
+
capture.push(receivedData[0]);
|
|
826
|
+
if (receivedData.length > 3) {
|
|
827
|
+
capture.push(receivedData[receivedData.length - 3]);
|
|
828
|
+
}
|
|
829
|
+
if (receivedData.length > 2) {
|
|
830
|
+
capture.push(receivedData[receivedData.length - 2]);
|
|
831
|
+
}
|
|
832
|
+
if (receivedData.length > 1) {
|
|
833
|
+
capture.push(receivedData[receivedData.length - 1]);
|
|
834
|
+
}
|
|
835
|
+
const key = String.fromCharCode.apply(null, capture);
|
|
836
|
+
if (/^(\[.*\]|\{.*\})\s*$/s.test(key)) {
|
|
837
|
+
const json = new TextDecoder().decode(new Uint8Array(receivedData));
|
|
838
|
+
const value = JSON.parse(json);
|
|
839
|
+
if (isDataAuthentic(
|
|
840
|
+
value,
|
|
841
|
+
urlDataWithHash.verification,
|
|
842
|
+
captureErrors
|
|
843
|
+
)) {
|
|
844
|
+
return {
|
|
845
|
+
...dataEntry,
|
|
846
|
+
value,
|
|
847
|
+
data: urlDataWithHash.verification?.data,
|
|
848
|
+
method: urlDataWithHash.verification?.method,
|
|
849
|
+
url,
|
|
850
|
+
src
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
captureHashes[captureErrors.pop() || ""] = urlDataWithHash.verification?.data || "";
|
|
854
|
+
if (isDataAuthentic(
|
|
855
|
+
receivedData,
|
|
856
|
+
urlDataWithHash.verification,
|
|
857
|
+
captureErrors
|
|
858
|
+
)) {
|
|
859
|
+
return {
|
|
860
|
+
...dataEntry,
|
|
861
|
+
value,
|
|
862
|
+
data: urlDataWithHash.verification?.data,
|
|
863
|
+
method: urlDataWithHash.verification?.method,
|
|
864
|
+
url,
|
|
865
|
+
src
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
captureHashes[captureErrors.pop() || ""] = urlDataWithHash.verification?.data || "";
|
|
869
|
+
throw new Error(
|
|
870
|
+
`Data does not validate, ignored ${Object.entries(captureHashes).map(
|
|
871
|
+
([expected, got]) => `calculated(${got}) != expected(${expected})`
|
|
872
|
+
).join(", ")}`
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
} catch {
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
if (isDataAuthentic(
|
|
879
|
+
receivedData,
|
|
880
|
+
urlDataWithHash.verification,
|
|
881
|
+
captureErrors
|
|
882
|
+
)) {
|
|
883
|
+
return {
|
|
884
|
+
...dataEntry,
|
|
885
|
+
value: receivedData,
|
|
886
|
+
data: urlDataWithHash.verification?.data,
|
|
887
|
+
method: urlDataWithHash.verification?.method,
|
|
888
|
+
url,
|
|
889
|
+
src
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
captureHashes[captureErrors.pop() || ""] = urlDataWithHash.verification?.data || "";
|
|
893
|
+
throw new Error(
|
|
894
|
+
`Data does not validate, ignored ${Object.entries(captureHashes).map(
|
|
895
|
+
([expected, got]) => `calculated(${got}) != expected(${expected})`
|
|
896
|
+
).join(", ")}`
|
|
897
|
+
);
|
|
898
|
+
} catch (error) {
|
|
899
|
+
const message = error.message;
|
|
900
|
+
if (throwException) {
|
|
901
|
+
throw error;
|
|
902
|
+
}
|
|
903
|
+
return {
|
|
904
|
+
...dataEntry,
|
|
905
|
+
value: null,
|
|
906
|
+
error: message,
|
|
907
|
+
data: urlDataWithHash.verification?.data,
|
|
908
|
+
method: urlDataWithHash.verification?.method,
|
|
909
|
+
url,
|
|
910
|
+
src
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
return Promise.all(promises);
|
|
915
|
+
}, "getDataFromExternalSources");
|
|
916
|
+
|
|
917
|
+
// src/decoder/plugins/schemaDefault.ts
|
|
918
|
+
var schemaDefaultPlugin = decodeKeyValuePlugin(defaultSchema);
|
|
919
|
+
var schemaDefault_default = schemaDefaultPlugin;
|
|
920
|
+
function decodeKeyValuePlugin(defaultSchema2, process2) {
|
|
921
|
+
const preProcess = /* @__PURE__ */ __name(async (key, value) => {
|
|
922
|
+
const schema = defaultSchema2.find((item) => {
|
|
923
|
+
if (key === item.key) {
|
|
924
|
+
return true;
|
|
925
|
+
}
|
|
926
|
+
const index = item.key.indexOf("<");
|
|
927
|
+
if (index !== -1) {
|
|
928
|
+
return key.slice(0, index) === item.key.slice(0, index);
|
|
929
|
+
}
|
|
930
|
+
return false;
|
|
931
|
+
}) || defaultSchema2.find((item) => {
|
|
932
|
+
if (key.slice(0, 34) === item.key.slice(0, 34)) {
|
|
933
|
+
return true;
|
|
934
|
+
}
|
|
935
|
+
return false;
|
|
936
|
+
});
|
|
937
|
+
if (schema) {
|
|
938
|
+
try {
|
|
939
|
+
const name = schema.name.replace(/[:\[\]]|<.*?>/g, "");
|
|
940
|
+
if (schema.keyType === "Array") {
|
|
941
|
+
if (schema.key === key) {
|
|
942
|
+
const hexString = value.slice(2);
|
|
943
|
+
const all = new Uint8Array(hexString.length / 2);
|
|
944
|
+
for (let i = 0; i < hexString.length; i += 2) {
|
|
945
|
+
all[i / 2] = Number.parseInt(hexString.substring(i, i + 2), 16);
|
|
946
|
+
}
|
|
947
|
+
const [{ start, end } = { start: 0, end: 0 }] = all.reduce(
|
|
948
|
+
(acc, byte, index_) => {
|
|
949
|
+
let isZero = byte === 0 || index_ === 0;
|
|
950
|
+
const last = acc.at(-1);
|
|
951
|
+
let index2 = index_;
|
|
952
|
+
if (!last || last.isZero !== isZero || index2 === all.length - 1) {
|
|
953
|
+
if (index2 === all.length - 1) {
|
|
954
|
+
index2 = all.length;
|
|
955
|
+
} else if (index2 === 0) {
|
|
956
|
+
isZero = true;
|
|
957
|
+
}
|
|
958
|
+
if (last) {
|
|
959
|
+
last.end = index2;
|
|
960
|
+
last.isZero = isZero;
|
|
961
|
+
}
|
|
962
|
+
if (isZero) {
|
|
963
|
+
acc.push({
|
|
964
|
+
isZero,
|
|
965
|
+
start: index2,
|
|
966
|
+
end: index2 === 0 ? index2 + 1 : index2
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
return acc;
|
|
971
|
+
},
|
|
972
|
+
[]
|
|
973
|
+
);
|
|
974
|
+
const picked = Math.abs(end - all.length + 1) <= 4 ? all.length + 1 : Math.abs(end - all.length / 2 + 1) <= 4 ? all.length / 2 : end;
|
|
975
|
+
const segment = value.slice(0, picked * 2 + 2);
|
|
976
|
+
const length = BigInt(segment);
|
|
977
|
+
if (length > ARRAY_MAX) {
|
|
978
|
+
return {
|
|
979
|
+
...schema,
|
|
980
|
+
type: "Error",
|
|
981
|
+
key,
|
|
982
|
+
value: "Array length too large"
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
return {
|
|
986
|
+
...schema,
|
|
987
|
+
type: "ArrayLength",
|
|
988
|
+
pretty: name,
|
|
989
|
+
value: Number(length)
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
const index = BigInt(`0x${key.slice(34)}`);
|
|
993
|
+
if (index > ARRAY_MAX) {
|
|
994
|
+
return {
|
|
995
|
+
...schema,
|
|
996
|
+
type: "Error",
|
|
997
|
+
key,
|
|
998
|
+
value: "Array index too large"
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
let data2 = value !== "0x" ? decodeValueContent(schema.valueContent, value) : void 0;
|
|
1002
|
+
if (schema.valueContent.startsWith("0x")) {
|
|
1003
|
+
data2 = data2 === schema.valueContent;
|
|
1004
|
+
}
|
|
1005
|
+
return {
|
|
1006
|
+
...schema,
|
|
1007
|
+
type: "ArrayItem",
|
|
1008
|
+
pretty: name,
|
|
1009
|
+
dynamic: Number(index),
|
|
1010
|
+
value: data2
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
let dynamicKeyParts = void 0;
|
|
1014
|
+
if (isDynamicKeyName(schema.name)) {
|
|
1015
|
+
dynamicKeyParts = decodeMappingKey(key, schema).map(
|
|
1016
|
+
({ value: value2 }) => isHex2(value2) ? value2.toLowerCase() : `${value2}`
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
1019
|
+
let rawData = value !== "0x" ? decodeData(
|
|
1020
|
+
[
|
|
1021
|
+
dynamicKeyParts ? {
|
|
1022
|
+
keyName: schema.name,
|
|
1023
|
+
dynamicKeyParts,
|
|
1024
|
+
value
|
|
1025
|
+
} : { keyName: schema.name, value }
|
|
1026
|
+
],
|
|
1027
|
+
defaultSchema2
|
|
1028
|
+
) : [{ value: void 0 }];
|
|
1029
|
+
let data = rawData?.[0]?.value;
|
|
1030
|
+
if (schema.name === "LSP8TokenMetadataBaseURI") {
|
|
1031
|
+
const { url: _url } = data || {};
|
|
1032
|
+
const url2 = _url?.replace(/\0*$/g, "");
|
|
1033
|
+
if (!url2 && url2?.includes("\0")) {
|
|
1034
|
+
return {
|
|
1035
|
+
...schema,
|
|
1036
|
+
pretty: name,
|
|
1037
|
+
type: "Error",
|
|
1038
|
+
key,
|
|
1039
|
+
value: "Invalid URL (contains \\0)"
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
return { ...schema, type: "Value", name, value: url2 };
|
|
1043
|
+
}
|
|
1044
|
+
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
1045
|
+
const { url: _url } = data || {};
|
|
1046
|
+
const url2 = _url?.replace(/\0*$/g, "");
|
|
1047
|
+
if (!url2 || url2?.includes("\0")) {
|
|
1048
|
+
const newURL2 = url2?.replace(/\0/g, "\\0");
|
|
1049
|
+
const { error, data: data2, method: method2 } = rawData?.[0];
|
|
1050
|
+
return {
|
|
1051
|
+
...schema,
|
|
1052
|
+
pretty: name,
|
|
1053
|
+
type: "Error",
|
|
1054
|
+
key,
|
|
1055
|
+
value: `${error ? `${error} ` : ""}Invalid URL (contains \\0 ${newURL2})`,
|
|
1056
|
+
data: data2,
|
|
1057
|
+
method: method2,
|
|
1058
|
+
url: newURL2
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
const newURL = data.url.replace(
|
|
1062
|
+
"https://2eff.lukso.dev/ipfs/",
|
|
1063
|
+
"ipfs://"
|
|
1064
|
+
);
|
|
1065
|
+
if (newURL !== data.url) {
|
|
1066
|
+
;
|
|
1067
|
+
data.url = newURL;
|
|
1068
|
+
}
|
|
1069
|
+
rawData = await getDataFromExternalSources(
|
|
1070
|
+
defaultSchema2,
|
|
1071
|
+
rawData,
|
|
1072
|
+
IPFS_GATEWAY,
|
|
1073
|
+
false
|
|
1074
|
+
);
|
|
1075
|
+
if (rawData?.[0]?.error) {
|
|
1076
|
+
const { error, data: data2, method: method2, url: url3 } = rawData?.[0];
|
|
1077
|
+
return {
|
|
1078
|
+
...schema,
|
|
1079
|
+
type: "Error",
|
|
1080
|
+
pretty: name,
|
|
1081
|
+
value: error,
|
|
1082
|
+
data: data2,
|
|
1083
|
+
method: method2,
|
|
1084
|
+
url: url3
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
data = rawData?.[0]?.value?.[schema.name] || rawData?.[0]?.value;
|
|
1088
|
+
} else if (schema.valueContent.startsWith("0x")) {
|
|
1089
|
+
data = data === schema.valueContent;
|
|
1090
|
+
}
|
|
1091
|
+
const {
|
|
1092
|
+
data: _data,
|
|
1093
|
+
method,
|
|
1094
|
+
src,
|
|
1095
|
+
url
|
|
1096
|
+
} = rawData?.[0];
|
|
1097
|
+
if (schema.name === "AddressPermissions:Permissions:<address>") {
|
|
1098
|
+
let _value = data;
|
|
1099
|
+
try {
|
|
1100
|
+
const {
|
|
1101
|
+
ERC4337_PERMISSION: _ignore1,
|
|
1102
|
+
ALL_PERMISSIONS: _ignore2,
|
|
1103
|
+
...rest
|
|
1104
|
+
} = decodePermissions(data);
|
|
1105
|
+
if (Object.keys("rest").length === 1 && rest.ADDCONTROLLER) {
|
|
1106
|
+
rest.ISRECOVERY = true;
|
|
1107
|
+
}
|
|
1108
|
+
_value = rest;
|
|
1109
|
+
} catch {
|
|
1110
|
+
}
|
|
1111
|
+
return {
|
|
1112
|
+
...schema,
|
|
1113
|
+
type: "Value",
|
|
1114
|
+
pretty: name,
|
|
1115
|
+
value: _value,
|
|
1116
|
+
dynamic: dynamicKeyParts?.length === 1 ? dynamicKeyParts[0] : dynamicKeyParts,
|
|
1117
|
+
data: _data,
|
|
1118
|
+
method,
|
|
1119
|
+
src,
|
|
1120
|
+
url
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
return {
|
|
1124
|
+
...schema,
|
|
1125
|
+
type: "Value",
|
|
1126
|
+
pretty: name,
|
|
1127
|
+
value: data,
|
|
1128
|
+
dynamic: dynamicKeyParts?.length === 1 ? dynamicKeyParts[0] : dynamicKeyParts,
|
|
1129
|
+
data: _data,
|
|
1130
|
+
method,
|
|
1131
|
+
src,
|
|
1132
|
+
url
|
|
1133
|
+
};
|
|
1134
|
+
} catch (error) {
|
|
1135
|
+
return { ...schema, type: "Error", key, value: error };
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
return { type: "Undecoded", name: void 0, key, value };
|
|
1139
|
+
}, "preProcess");
|
|
1140
|
+
return async (key, value) => {
|
|
1141
|
+
try {
|
|
1142
|
+
const result = await preProcess(key, value);
|
|
1143
|
+
if (process2) {
|
|
1144
|
+
return await process2(result);
|
|
1145
|
+
}
|
|
1146
|
+
return result;
|
|
1147
|
+
} catch {
|
|
1148
|
+
}
|
|
1149
|
+
return void 0;
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
__name(decodeKeyValuePlugin, "decodeKeyValuePlugin");
|
|
1153
|
+
|
|
1154
|
+
// src/decoder/plugins/standardPlugin.ts
|
|
1155
|
+
function createAggregationKey(pluginOptions, key) {
|
|
1156
|
+
return `${pluginOptions.name || pluginOptions.decoderName || "unknown"}:${key}`;
|
|
1157
|
+
}
|
|
1158
|
+
__name(createAggregationKey, "createAggregationKey");
|
|
1159
|
+
function standardPlugin(abi3, pluginOptions, callbacks) {
|
|
1160
|
+
const {
|
|
1161
|
+
abiName,
|
|
1162
|
+
decoderName = "unknown",
|
|
1163
|
+
moduleHint,
|
|
1164
|
+
required,
|
|
1165
|
+
priority,
|
|
1166
|
+
name,
|
|
1167
|
+
usesAsync
|
|
1168
|
+
} = pluginOptions;
|
|
1169
|
+
const plugin = {
|
|
1170
|
+
enhance: /* @__PURE__ */ __name(async (transaction, options) => {
|
|
1171
|
+
if (callbacks.overrideEnhance) {
|
|
1172
|
+
return await callbacks.overrideEnhance(
|
|
1173
|
+
transaction,
|
|
1174
|
+
pluginOptions,
|
|
1175
|
+
options
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1178
|
+
const { preferError } = options;
|
|
1179
|
+
const {
|
|
1180
|
+
to: _to,
|
|
1181
|
+
from: _from,
|
|
1182
|
+
value: _value,
|
|
1183
|
+
input,
|
|
1184
|
+
blockNumber: _blockNumber
|
|
1185
|
+
// logs,
|
|
1186
|
+
} = transaction;
|
|
1187
|
+
const to = _to || void 0;
|
|
1188
|
+
const from = _from || void 0;
|
|
1189
|
+
const value = _value ? BigInt(_value) : 0n;
|
|
1190
|
+
const decoded = customDecodeFunctionData(
|
|
1191
|
+
{
|
|
1192
|
+
abi: abi3,
|
|
1193
|
+
data: input || "0x"
|
|
1194
|
+
},
|
|
1195
|
+
preferError
|
|
1196
|
+
);
|
|
1197
|
+
if (!decoded) {
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
const { functionName, sig, args } = decoded;
|
|
1201
|
+
const output = {
|
|
1202
|
+
isDecoded: true,
|
|
1203
|
+
...transaction,
|
|
1204
|
+
resultType: "execute",
|
|
1205
|
+
functionName,
|
|
1206
|
+
sig,
|
|
1207
|
+
input,
|
|
1208
|
+
__decoder: decoderName,
|
|
1209
|
+
standard: abiName || "unknown",
|
|
1210
|
+
moduleHint,
|
|
1211
|
+
args,
|
|
1212
|
+
to,
|
|
1213
|
+
from,
|
|
1214
|
+
value
|
|
1215
|
+
};
|
|
1216
|
+
const enhanced = await callbacks.enhance(output, pluginOptions, options);
|
|
1217
|
+
if (enhanced) {
|
|
1218
|
+
return enhanced;
|
|
1219
|
+
}
|
|
1220
|
+
return;
|
|
1221
|
+
}, "enhance"),
|
|
1222
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
1223
|
+
return callbacks.decodeEvent(log, options);
|
|
1224
|
+
}, "decodeEvent"),
|
|
1225
|
+
getAggregationKey: /* @__PURE__ */ __name(async (result, pluginOptions2, options) => {
|
|
1226
|
+
if (!callbacks.getAggregationKey) {
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
return callbacks.getAggregationKey(result, pluginOptions2, options);
|
|
1230
|
+
}, "getAggregationKey"),
|
|
1231
|
+
summarize: /* @__PURE__ */ __name(async (aggregationKey, result, pluginOptions2, options) => {
|
|
1232
|
+
if (!callbacks.summarize) {
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1235
|
+
return callbacks.summarize(aggregationKey, result, pluginOptions2, options);
|
|
1236
|
+
}, "summarize")
|
|
1237
|
+
};
|
|
1238
|
+
if (name !== void 0) {
|
|
1239
|
+
plugin.name = name;
|
|
1240
|
+
}
|
|
1241
|
+
if (required !== void 0) {
|
|
1242
|
+
plugin.required = required;
|
|
1243
|
+
}
|
|
1244
|
+
if (priority !== void 0) {
|
|
1245
|
+
plugin.priority = priority;
|
|
1246
|
+
}
|
|
1247
|
+
if (usesAsync !== void 0) {
|
|
1248
|
+
plugin.usesAsync = usesAsync;
|
|
1249
|
+
}
|
|
1250
|
+
if (callbacks.aggregations !== void 0) {
|
|
1251
|
+
plugin.aggregations = callbacks.aggregations;
|
|
1252
|
+
}
|
|
1253
|
+
const frozenPlugin = Object.freeze(plugin);
|
|
1254
|
+
if (name) {
|
|
1255
|
+
pluginRegistry.register(name, frozenPlugin, {
|
|
1256
|
+
priority,
|
|
1257
|
+
required,
|
|
1258
|
+
usesAsync
|
|
1259
|
+
// Include async flag for registration
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
return frozenPlugin;
|
|
1263
|
+
}
|
|
1264
|
+
__name(standardPlugin, "standardPlugin");
|
|
1265
|
+
function standardSchemaPlugin(schemas, pluginOptions, process2) {
|
|
1266
|
+
const basePlugin = decodeKeyValuePlugin(schemas, process2);
|
|
1267
|
+
const plugin = Object.assign(basePlugin, {
|
|
1268
|
+
name: pluginOptions?.name,
|
|
1269
|
+
required: pluginOptions?.required,
|
|
1270
|
+
priority: pluginOptions?.priority ?? 50
|
|
1271
|
+
});
|
|
1272
|
+
return Object.freeze(plugin);
|
|
1273
|
+
}
|
|
1274
|
+
__name(standardSchemaPlugin, "standardSchemaPlugin");
|
|
1275
|
+
|
|
1276
|
+
// src/utils/debug.ts
|
|
1277
|
+
var debugInstances = /* @__PURE__ */ new Map();
|
|
1278
|
+
function createDebug(namespace) {
|
|
1279
|
+
const DEBUG = typeof process !== "undefined" && process.env?.DEBUG || "";
|
|
1280
|
+
const isEnabled = /* @__PURE__ */ __name(() => {
|
|
1281
|
+
if (!DEBUG) return false;
|
|
1282
|
+
if (DEBUG === "*") return true;
|
|
1283
|
+
const patterns = DEBUG.split(",").map((p) => p.trim());
|
|
1284
|
+
for (const pattern of patterns) {
|
|
1285
|
+
if (pattern === namespace) return true;
|
|
1286
|
+
if (pattern.endsWith("*") && namespace.startsWith(pattern.slice(0, -1)))
|
|
1287
|
+
return true;
|
|
1288
|
+
if (pattern.startsWith("-")) {
|
|
1289
|
+
const negPattern = pattern.slice(1);
|
|
1290
|
+
if (negPattern === namespace) return false;
|
|
1291
|
+
if (negPattern.endsWith("*") && namespace.startsWith(negPattern.slice(0, -1)))
|
|
1292
|
+
return false;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
return false;
|
|
1296
|
+
}, "isEnabled");
|
|
1297
|
+
debugInstances.set(namespace, isEnabled());
|
|
1298
|
+
return (...args) => {
|
|
1299
|
+
if (!debugInstances.get(namespace)) return;
|
|
1300
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
1301
|
+
const prefix = `[${timestamp}] ${namespace}`;
|
|
1302
|
+
console.log(prefix, ...args);
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
__name(createDebug, "createDebug");
|
|
1306
|
+
var debug_default = createDebug;
|
|
1307
|
+
|
|
1308
|
+
// src/decoder/aggregation.ts
|
|
1309
|
+
function standardAggregation(config) {
|
|
1310
|
+
return Object.freeze(config);
|
|
1311
|
+
}
|
|
1312
|
+
__name(standardAggregation, "standardAggregation");
|
|
1313
|
+
var debug = debug_default("decoder:aggregation");
|
|
1314
|
+
var PluginAggregationEngine = class {
|
|
1315
|
+
static {
|
|
1316
|
+
__name(this, "PluginAggregationEngine");
|
|
1317
|
+
}
|
|
1318
|
+
plugins = /* @__PURE__ */ new Map();
|
|
1319
|
+
states = /* @__PURE__ */ new Map();
|
|
1320
|
+
// plugin -> key -> state
|
|
1321
|
+
/**
|
|
1322
|
+
* Register a plugin with aggregations
|
|
1323
|
+
*/
|
|
1324
|
+
registerPlugin(plugin) {
|
|
1325
|
+
if (plugin.name && plugin.aggregations && plugin.aggregations.length > 0) {
|
|
1326
|
+
debug(
|
|
1327
|
+
`Registering plugin ${plugin.name} with ${plugin.aggregations.length} aggregations`
|
|
1328
|
+
);
|
|
1329
|
+
this.plugins.set(plugin.name, plugin);
|
|
1330
|
+
this.states.set(plugin.name, /* @__PURE__ */ new Map());
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Process a transaction through relevant aggregations
|
|
1335
|
+
*/
|
|
1336
|
+
processTransaction(tx) {
|
|
1337
|
+
if (!tx.aggregationKeys || tx.aggregationKeys.length === 0) return;
|
|
1338
|
+
for (const fullKey of tx.aggregationKeys) {
|
|
1339
|
+
const [pluginName, ...keyParts] = fullKey.split(":");
|
|
1340
|
+
const aggregationKey = keyParts.join(":");
|
|
1341
|
+
const plugin = this.plugins.get(pluginName);
|
|
1342
|
+
if (!plugin || !plugin.aggregations) {
|
|
1343
|
+
debug(`processTransaction: No plugin found for ${pluginName}`);
|
|
1344
|
+
continue;
|
|
1345
|
+
}
|
|
1346
|
+
const pluginStates = this.states.get(pluginName);
|
|
1347
|
+
if (!pluginStates) {
|
|
1348
|
+
debug(`processTransaction: No states for plugin ${pluginName}`);
|
|
1349
|
+
continue;
|
|
1350
|
+
}
|
|
1351
|
+
const agg = plugin.aggregations.find((a) => a.key === aggregationKey);
|
|
1352
|
+
if (!agg) {
|
|
1353
|
+
debug(
|
|
1354
|
+
`processTransaction: No aggregation found for key ${aggregationKey} in plugin ${pluginName}`
|
|
1355
|
+
);
|
|
1356
|
+
continue;
|
|
1357
|
+
}
|
|
1358
|
+
const mapped = agg.map(tx);
|
|
1359
|
+
if (mapped !== void 0) {
|
|
1360
|
+
const currentState = pluginStates.get(aggregationKey);
|
|
1361
|
+
if (!currentState) {
|
|
1362
|
+
debug(
|
|
1363
|
+
`processTransaction: First transaction for ${pluginName}:${aggregationKey}`
|
|
1364
|
+
);
|
|
1365
|
+
pluginStates.set(aggregationKey, {
|
|
1366
|
+
data: mapped,
|
|
1367
|
+
lastTransaction: tx
|
|
1368
|
+
});
|
|
1369
|
+
} else {
|
|
1370
|
+
const newData = agg.reduce(currentState.data, mapped);
|
|
1371
|
+
pluginStates.set(aggregationKey, {
|
|
1372
|
+
data: newData,
|
|
1373
|
+
lastTransaction: tx
|
|
1374
|
+
// Always update to latest transaction
|
|
1375
|
+
});
|
|
1376
|
+
}
|
|
1377
|
+
} else {
|
|
1378
|
+
debug(
|
|
1379
|
+
`processTransaction: map returned undefined for ${pluginName}:${aggregationKey}`
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Process a batch of transactions
|
|
1386
|
+
*/
|
|
1387
|
+
processBatch(txs) {
|
|
1388
|
+
debug(`Processing batch of ${txs.length} transactions`);
|
|
1389
|
+
let processedCount = 0;
|
|
1390
|
+
for (const tx of txs) {
|
|
1391
|
+
this.processTransaction(tx);
|
|
1392
|
+
if (tx.aggregationKeys && tx.aggregationKeys.length > 0) {
|
|
1393
|
+
processedCount++;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
debug(`Processed ${processedCount} transactions with aggregationKeys`);
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Get finalized result for a specific plugin and aggregation key
|
|
1400
|
+
*/
|
|
1401
|
+
getResult(pluginName, key) {
|
|
1402
|
+
const plugin = this.plugins.get(pluginName);
|
|
1403
|
+
const pluginStates = this.states.get(pluginName);
|
|
1404
|
+
if (!plugin || !pluginStates) return void 0;
|
|
1405
|
+
const agg = plugin.aggregations?.find((a) => a.key === key);
|
|
1406
|
+
const state = pluginStates.get(key);
|
|
1407
|
+
if (!agg || state === void 0) return void 0;
|
|
1408
|
+
const aggregationResult = agg.finalize(state.data);
|
|
1409
|
+
return {
|
|
1410
|
+
...state.lastTransaction,
|
|
1411
|
+
...aggregationResult,
|
|
1412
|
+
resultType: "aggregate"
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* Get all aggregation results
|
|
1417
|
+
*/
|
|
1418
|
+
getAllResults() {
|
|
1419
|
+
const results = [];
|
|
1420
|
+
for (const [pluginName, plugin] of this.plugins) {
|
|
1421
|
+
const pluginStates = this.states.get(pluginName);
|
|
1422
|
+
if (!pluginStates) {
|
|
1423
|
+
continue;
|
|
1424
|
+
}
|
|
1425
|
+
for (const agg of plugin.aggregations || []) {
|
|
1426
|
+
const state = pluginStates.get(agg.key);
|
|
1427
|
+
if (state !== void 0) {
|
|
1428
|
+
results.push({
|
|
1429
|
+
plugin: pluginName,
|
|
1430
|
+
key: agg.key,
|
|
1431
|
+
result: {
|
|
1432
|
+
...state.lastTransaction,
|
|
1433
|
+
...agg.finalize(state.data),
|
|
1434
|
+
resultType: "aggregate"
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
return results;
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Clear all aggregation states
|
|
1444
|
+
*/
|
|
1445
|
+
clear() {
|
|
1446
|
+
for (const states of this.states.values()) {
|
|
1447
|
+
states.clear();
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Clear states for a specific plugin
|
|
1452
|
+
*/
|
|
1453
|
+
clearPlugin(pluginName) {
|
|
1454
|
+
this.states.get(pluginName)?.clear();
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Get current state (for persistence)
|
|
1458
|
+
*/
|
|
1459
|
+
getStates() {
|
|
1460
|
+
return new Map(this.states);
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Restore states (from persistence)
|
|
1464
|
+
*/
|
|
1465
|
+
restoreStates(states) {
|
|
1466
|
+
for (const [pluginName, pluginStates] of states) {
|
|
1467
|
+
this.states.set(pluginName, new Map(pluginStates));
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1472
|
+
// src/decoder/events.ts
|
|
1473
|
+
import {
|
|
1474
|
+
AbiDecodingDataSizeTooSmallError,
|
|
1475
|
+
AbiEventSignatureEmptyTopicsError,
|
|
1476
|
+
AbiEventSignatureNotFoundError,
|
|
1477
|
+
BaseError,
|
|
1478
|
+
DecodeLogDataMismatch,
|
|
1479
|
+
DecodeLogTopicsMismatch,
|
|
1480
|
+
decodeAbiParameters as decodeAbiParameters2,
|
|
1481
|
+
size as size2,
|
|
1482
|
+
toEventSelector
|
|
1483
|
+
} from "viem";
|
|
1484
|
+
import { formatAbiItem as formatAbiItem2 } from "viem/utils";
|
|
1485
|
+
var docsPath = "/docs/contract/decodeEventLog";
|
|
1486
|
+
function decodeTopic({ param, value }) {
|
|
1487
|
+
if (param.type === "string" || param.type === "bytes" || param.type === "tuple" || param.type.match(/^(.*)\[(\d+)?\]$/))
|
|
1488
|
+
return value;
|
|
1489
|
+
const decodedArg = decodeAbiParameters2([param], value) || [];
|
|
1490
|
+
return decodedArg[0];
|
|
1491
|
+
}
|
|
1492
|
+
__name(decodeTopic, "decodeTopic");
|
|
1493
|
+
function customDecodeEventLog(parameters) {
|
|
1494
|
+
const {
|
|
1495
|
+
abi: abi3,
|
|
1496
|
+
data,
|
|
1497
|
+
strict: strict_,
|
|
1498
|
+
topics
|
|
1499
|
+
} = parameters;
|
|
1500
|
+
const strict = strict_ ?? true;
|
|
1501
|
+
const [signature, ...argTopics] = topics;
|
|
1502
|
+
if (!signature) throw new AbiEventSignatureEmptyTopicsError({ docsPath });
|
|
1503
|
+
const abiItem = (() => {
|
|
1504
|
+
if (abi3.length === 1) return abi3[0];
|
|
1505
|
+
return abi3.find(
|
|
1506
|
+
(x) => x.type === "event" && signature === toEventSelector(formatAbiItem2(x))
|
|
1507
|
+
);
|
|
1508
|
+
})();
|
|
1509
|
+
if (!(abiItem && "name" in abiItem) || abiItem.type !== "event")
|
|
1510
|
+
throw new AbiEventSignatureNotFoundError(signature, { docsPath });
|
|
1511
|
+
const { name, inputs } = abiItem;
|
|
1512
|
+
const isUnnamed = inputs?.some((x) => !("name" in x && x.name));
|
|
1513
|
+
let args = isUnnamed ? [] : {};
|
|
1514
|
+
const indexedInputs = inputs.filter((x) => "indexed" in x && x.indexed);
|
|
1515
|
+
for (let i = 0; i < indexedInputs.length; i++) {
|
|
1516
|
+
const param = indexedInputs[i];
|
|
1517
|
+
const topic = argTopics[i];
|
|
1518
|
+
if (!topic)
|
|
1519
|
+
throw new DecodeLogTopicsMismatch({
|
|
1520
|
+
abiItem,
|
|
1521
|
+
param
|
|
1522
|
+
});
|
|
1523
|
+
if (isUnnamed && Array.isArray(args)) {
|
|
1524
|
+
args[i] = decodeTopic({ param, value: topic });
|
|
1525
|
+
} else if (!isUnnamed && !Array.isArray(args)) {
|
|
1526
|
+
args[param.name || i] = decodeTopic({ param, value: topic });
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
const nonIndexedInputs = inputs.filter((x) => !("indexed" in x && x.indexed));
|
|
1530
|
+
if (nonIndexedInputs.length > 0) {
|
|
1531
|
+
if (data && data !== "0x") {
|
|
1532
|
+
try {
|
|
1533
|
+
const decodedData = decodeAbiParameters2(nonIndexedInputs, data);
|
|
1534
|
+
if (decodedData) {
|
|
1535
|
+
if (isUnnamed && Array.isArray(args)) {
|
|
1536
|
+
args = [...args, ...decodedData];
|
|
1537
|
+
} else if (!isUnnamed && !Array.isArray(args)) {
|
|
1538
|
+
for (let i = 0; i < nonIndexedInputs.length; i++) {
|
|
1539
|
+
const name2 = nonIndexedInputs[i].name;
|
|
1540
|
+
if (name2) {
|
|
1541
|
+
args[name2] = decodedData[i];
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
} catch (err) {
|
|
1547
|
+
if (strict) {
|
|
1548
|
+
if (err instanceof AbiDecodingDataSizeTooSmallError || err.name === "PositionOutOfBoundsError")
|
|
1549
|
+
throw new DecodeLogDataMismatch({
|
|
1550
|
+
abiItem,
|
|
1551
|
+
data,
|
|
1552
|
+
params: nonIndexedInputs,
|
|
1553
|
+
size: size2(data)
|
|
1554
|
+
});
|
|
1555
|
+
throw err;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
} else if (strict) {
|
|
1559
|
+
throw new DecodeLogDataMismatch({
|
|
1560
|
+
abiItem,
|
|
1561
|
+
data: "0x",
|
|
1562
|
+
params: nonIndexedInputs,
|
|
1563
|
+
size: 0
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
const { args: namedArgs } = createNamedArgs(
|
|
1568
|
+
Array.isArray(args) ? args : Object.values(args),
|
|
1569
|
+
inputs
|
|
1570
|
+
);
|
|
1571
|
+
return {
|
|
1572
|
+
eventName: name,
|
|
1573
|
+
args: namedArgs
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
__name(customDecodeEventLog, "customDecodeEventLog");
|
|
1577
|
+
function decodeEvent(chain, abi3, log) {
|
|
1578
|
+
const { data: _data, address, ...rest } = log;
|
|
1579
|
+
let lastError;
|
|
1580
|
+
try {
|
|
1581
|
+
const result = customDecodeEventLog({
|
|
1582
|
+
abi: abi3,
|
|
1583
|
+
data: _data,
|
|
1584
|
+
topics: log.topics || []
|
|
1585
|
+
});
|
|
1586
|
+
return { ...log, ...result };
|
|
1587
|
+
} catch {
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
__name(decodeEvent, "decodeEvent");
|
|
1591
|
+
|
|
1592
|
+
// src/decoder/plugins/RegistryAbi.ts
|
|
1593
|
+
var RegistryAbi_default = [
|
|
1594
|
+
{
|
|
1595
|
+
inputs: [
|
|
1596
|
+
{ internalType: "address", name: "creator", type: "address" },
|
|
1597
|
+
{ internalType: "address", name: "_codehub", type: "address" }
|
|
1598
|
+
],
|
|
1599
|
+
stateMutability: "nonpayable",
|
|
1600
|
+
type: "constructor"
|
|
1601
|
+
},
|
|
1602
|
+
{ inputs: [], name: "ERC725Y_DataKeysValuesEmptyArray", type: "error" },
|
|
1603
|
+
{ inputs: [], name: "ERC725Y_DataKeysValuesLengthMismatch", type: "error" },
|
|
1604
|
+
{ inputs: [], name: "ERC725Y_MsgValueDisallowed", type: "error" },
|
|
1605
|
+
{
|
|
1606
|
+
inputs: [{ internalType: "bytes", name: "storedData", type: "bytes" }],
|
|
1607
|
+
name: "InvalidExtensionAddress",
|
|
1608
|
+
type: "error"
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
|
|
1612
|
+
name: "InvalidFunctionSelector",
|
|
1613
|
+
type: "error"
|
|
1614
|
+
},
|
|
1615
|
+
{ inputs: [], name: "LSP4TokenNameNotEditable", type: "error" },
|
|
1616
|
+
{ inputs: [], name: "LSP4TokenSymbolNotEditable", type: "error" },
|
|
1617
|
+
{ inputs: [], name: "LSP4TokenTypeNotEditable", type: "error" },
|
|
1618
|
+
{
|
|
1619
|
+
inputs: [{ internalType: "uint256", name: "callIndex", type: "uint256" }],
|
|
1620
|
+
name: "LSP8BatchCallFailed",
|
|
1621
|
+
type: "error"
|
|
1622
|
+
},
|
|
1623
|
+
{ inputs: [], name: "LSP8CannotSendToAddressZero", type: "error" },
|
|
1624
|
+
{ inputs: [], name: "LSP8CannotSendToSelf", type: "error" },
|
|
1625
|
+
{ inputs: [], name: "LSP8CannotUseAddressZeroAsOperator", type: "error" },
|
|
1626
|
+
{ inputs: [], name: "LSP8InvalidTransferBatch", type: "error" },
|
|
1627
|
+
{
|
|
1628
|
+
inputs: [{ internalType: "bytes32", name: "tokenId", type: "bytes32" }],
|
|
1629
|
+
name: "LSP8NonExistentTokenId",
|
|
1630
|
+
type: "error"
|
|
1631
|
+
},
|
|
1632
|
+
{
|
|
1633
|
+
inputs: [
|
|
1634
|
+
{ internalType: "address", name: "operator", type: "address" },
|
|
1635
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" }
|
|
1636
|
+
],
|
|
1637
|
+
name: "LSP8NonExistingOperator",
|
|
1638
|
+
type: "error"
|
|
1639
|
+
},
|
|
1640
|
+
{
|
|
1641
|
+
inputs: [
|
|
1642
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" },
|
|
1643
|
+
{ internalType: "address", name: "caller", type: "address" }
|
|
1644
|
+
],
|
|
1645
|
+
name: "LSP8NotTokenOperator",
|
|
1646
|
+
type: "error"
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
inputs: [
|
|
1650
|
+
{ internalType: "address", name: "tokenOwner", type: "address" },
|
|
1651
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" },
|
|
1652
|
+
{ internalType: "address", name: "caller", type: "address" }
|
|
1653
|
+
],
|
|
1654
|
+
name: "LSP8NotTokenOwner",
|
|
1655
|
+
type: "error"
|
|
1656
|
+
},
|
|
1657
|
+
{
|
|
1658
|
+
inputs: [
|
|
1659
|
+
{ internalType: "address", name: "tokenReceiver", type: "address" }
|
|
1660
|
+
],
|
|
1661
|
+
name: "LSP8NotifyTokenReceiverContractMissingLSP1Interface",
|
|
1662
|
+
type: "error"
|
|
1663
|
+
},
|
|
1664
|
+
{
|
|
1665
|
+
inputs: [
|
|
1666
|
+
{ internalType: "address", name: "tokenReceiver", type: "address" }
|
|
1667
|
+
],
|
|
1668
|
+
name: "LSP8NotifyTokenReceiverIsEOA",
|
|
1669
|
+
type: "error"
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
inputs: [
|
|
1673
|
+
{ internalType: "address", name: "operator", type: "address" },
|
|
1674
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" }
|
|
1675
|
+
],
|
|
1676
|
+
name: "LSP8OperatorAlreadyAuthorized",
|
|
1677
|
+
type: "error"
|
|
1678
|
+
},
|
|
1679
|
+
{ inputs: [], name: "LSP8TokenContractCannotHoldValue", type: "error" },
|
|
1680
|
+
{
|
|
1681
|
+
inputs: [{ internalType: "bytes32", name: "tokenId", type: "bytes32" }],
|
|
1682
|
+
name: "LSP8TokenIdAlreadyMinted",
|
|
1683
|
+
type: "error"
|
|
1684
|
+
},
|
|
1685
|
+
{ inputs: [], name: "LSP8TokenIdFormatNotEditable", type: "error" },
|
|
1686
|
+
{ inputs: [], name: "LSP8TokenIdsDataEmptyArray", type: "error" },
|
|
1687
|
+
{ inputs: [], name: "LSP8TokenIdsDataLengthMismatch", type: "error" },
|
|
1688
|
+
{ inputs: [], name: "LSP8TokenOwnerCannotBeOperator", type: "error" },
|
|
1689
|
+
{
|
|
1690
|
+
inputs: [
|
|
1691
|
+
{ internalType: "bytes4", name: "functionSelector", type: "bytes4" }
|
|
1692
|
+
],
|
|
1693
|
+
name: "NoExtensionFoundForFunctionSelector",
|
|
1694
|
+
type: "error"
|
|
1695
|
+
},
|
|
1696
|
+
{
|
|
1697
|
+
inputs: [
|
|
1698
|
+
{ internalType: "address", name: "callerAddress", type: "address" }
|
|
1699
|
+
],
|
|
1700
|
+
name: "OwnableCallerNotTheOwner",
|
|
1701
|
+
type: "error"
|
|
1702
|
+
},
|
|
1703
|
+
{ inputs: [], name: "OwnableCannotSetZeroAddressAsOwner", type: "error" },
|
|
1704
|
+
{
|
|
1705
|
+
anonymous: false,
|
|
1706
|
+
inputs: [
|
|
1707
|
+
{
|
|
1708
|
+
indexed: true,
|
|
1709
|
+
internalType: "bytes32",
|
|
1710
|
+
name: "dataKey",
|
|
1711
|
+
type: "bytes32"
|
|
1712
|
+
},
|
|
1713
|
+
{
|
|
1714
|
+
indexed: false,
|
|
1715
|
+
internalType: "bytes",
|
|
1716
|
+
name: "dataValue",
|
|
1717
|
+
type: "bytes"
|
|
1718
|
+
}
|
|
1719
|
+
],
|
|
1720
|
+
name: "DataChanged",
|
|
1721
|
+
type: "event"
|
|
1722
|
+
},
|
|
1723
|
+
{
|
|
1724
|
+
anonymous: false,
|
|
1725
|
+
inputs: [
|
|
1726
|
+
{
|
|
1727
|
+
indexed: true,
|
|
1728
|
+
internalType: "address",
|
|
1729
|
+
name: "operator",
|
|
1730
|
+
type: "address"
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
indexed: true,
|
|
1734
|
+
internalType: "address",
|
|
1735
|
+
name: "tokenOwner",
|
|
1736
|
+
type: "address"
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
indexed: true,
|
|
1740
|
+
internalType: "bytes32",
|
|
1741
|
+
name: "tokenId",
|
|
1742
|
+
type: "bytes32"
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
indexed: false,
|
|
1746
|
+
internalType: "bytes",
|
|
1747
|
+
name: "operatorNotificationData",
|
|
1748
|
+
type: "bytes"
|
|
1749
|
+
}
|
|
1750
|
+
],
|
|
1751
|
+
name: "OperatorAuthorizationChanged",
|
|
1752
|
+
type: "event"
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
anonymous: false,
|
|
1756
|
+
inputs: [
|
|
1757
|
+
{
|
|
1758
|
+
indexed: true,
|
|
1759
|
+
internalType: "address",
|
|
1760
|
+
name: "operator",
|
|
1761
|
+
type: "address"
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
indexed: true,
|
|
1765
|
+
internalType: "address",
|
|
1766
|
+
name: "tokenOwner",
|
|
1767
|
+
type: "address"
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
indexed: true,
|
|
1771
|
+
internalType: "bytes32",
|
|
1772
|
+
name: "tokenId",
|
|
1773
|
+
type: "bytes32"
|
|
1774
|
+
},
|
|
1775
|
+
{ indexed: false, internalType: "bool", name: "notified", type: "bool" },
|
|
1776
|
+
{
|
|
1777
|
+
indexed: false,
|
|
1778
|
+
internalType: "bytes",
|
|
1779
|
+
name: "operatorNotificationData",
|
|
1780
|
+
type: "bytes"
|
|
1781
|
+
}
|
|
1782
|
+
],
|
|
1783
|
+
name: "OperatorRevoked",
|
|
1784
|
+
type: "event"
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
anonymous: false,
|
|
1788
|
+
inputs: [
|
|
1789
|
+
{
|
|
1790
|
+
indexed: true,
|
|
1791
|
+
internalType: "address",
|
|
1792
|
+
name: "previousOwner",
|
|
1793
|
+
type: "address"
|
|
1794
|
+
},
|
|
1795
|
+
{
|
|
1796
|
+
indexed: true,
|
|
1797
|
+
internalType: "address",
|
|
1798
|
+
name: "newOwner",
|
|
1799
|
+
type: "address"
|
|
1800
|
+
}
|
|
1801
|
+
],
|
|
1802
|
+
name: "OwnershipTransferred",
|
|
1803
|
+
type: "event"
|
|
1804
|
+
},
|
|
1805
|
+
{
|
|
1806
|
+
anonymous: false,
|
|
1807
|
+
inputs: [
|
|
1808
|
+
{
|
|
1809
|
+
indexed: true,
|
|
1810
|
+
internalType: "bytes32",
|
|
1811
|
+
name: "tokenId",
|
|
1812
|
+
type: "bytes32"
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
indexed: true,
|
|
1816
|
+
internalType: "bytes32",
|
|
1817
|
+
name: "dataKey",
|
|
1818
|
+
type: "bytes32"
|
|
1819
|
+
},
|
|
1820
|
+
{
|
|
1821
|
+
indexed: false,
|
|
1822
|
+
internalType: "bytes",
|
|
1823
|
+
name: "dataValue",
|
|
1824
|
+
type: "bytes"
|
|
1825
|
+
}
|
|
1826
|
+
],
|
|
1827
|
+
name: "TokenIdDataChanged",
|
|
1828
|
+
type: "event"
|
|
1829
|
+
},
|
|
1830
|
+
{
|
|
1831
|
+
anonymous: false,
|
|
1832
|
+
inputs: [
|
|
1833
|
+
{
|
|
1834
|
+
indexed: false,
|
|
1835
|
+
internalType: "address",
|
|
1836
|
+
name: "operator",
|
|
1837
|
+
type: "address"
|
|
1838
|
+
},
|
|
1839
|
+
{ indexed: true, internalType: "address", name: "from", type: "address" },
|
|
1840
|
+
{ indexed: true, internalType: "address", name: "to", type: "address" },
|
|
1841
|
+
{
|
|
1842
|
+
indexed: true,
|
|
1843
|
+
internalType: "bytes32",
|
|
1844
|
+
name: "tokenId",
|
|
1845
|
+
type: "bytes32"
|
|
1846
|
+
},
|
|
1847
|
+
{ indexed: false, internalType: "bool", name: "force", type: "bool" },
|
|
1848
|
+
{ indexed: false, internalType: "bytes", name: "data", type: "bytes" }
|
|
1849
|
+
],
|
|
1850
|
+
name: "Transfer",
|
|
1851
|
+
type: "event"
|
|
1852
|
+
},
|
|
1853
|
+
{ stateMutability: "payable", type: "fallback" },
|
|
1854
|
+
{
|
|
1855
|
+
inputs: [
|
|
1856
|
+
{ internalType: "address", name: "operator", type: "address" },
|
|
1857
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" },
|
|
1858
|
+
{
|
|
1859
|
+
internalType: "bytes",
|
|
1860
|
+
name: "operatorNotificationData",
|
|
1861
|
+
type: "bytes"
|
|
1862
|
+
}
|
|
1863
|
+
],
|
|
1864
|
+
name: "authorizeOperator",
|
|
1865
|
+
outputs: [],
|
|
1866
|
+
stateMutability: "nonpayable",
|
|
1867
|
+
type: "function"
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
inputs: [{ internalType: "address", name: "tokenOwner", type: "address" }],
|
|
1871
|
+
name: "balanceOf",
|
|
1872
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1873
|
+
stateMutability: "view",
|
|
1874
|
+
type: "function"
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
inputs: [],
|
|
1878
|
+
name: "banner",
|
|
1879
|
+
outputs: [{ internalType: "contract Fractal", name: "", type: "address" }],
|
|
1880
|
+
stateMutability: "view",
|
|
1881
|
+
type: "function"
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }],
|
|
1885
|
+
name: "batchCalls",
|
|
1886
|
+
outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }],
|
|
1887
|
+
stateMutability: "nonpayable",
|
|
1888
|
+
type: "function"
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
inputs: [{ internalType: "bytes32", name: "dataKey", type: "bytes32" }],
|
|
1892
|
+
name: "getData",
|
|
1893
|
+
outputs: [{ internalType: "bytes", name: "dataValue", type: "bytes" }],
|
|
1894
|
+
stateMutability: "view",
|
|
1895
|
+
type: "function"
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
inputs: [
|
|
1899
|
+
{ internalType: "bytes32[]", name: "dataKeys", type: "bytes32[]" }
|
|
1900
|
+
],
|
|
1901
|
+
name: "getDataBatch",
|
|
1902
|
+
outputs: [{ internalType: "bytes[]", name: "dataValues", type: "bytes[]" }],
|
|
1903
|
+
stateMutability: "view",
|
|
1904
|
+
type: "function"
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
inputs: [
|
|
1908
|
+
{ internalType: "bytes32[]", name: "tokenIds", type: "bytes32[]" },
|
|
1909
|
+
{ internalType: "bytes32[]", name: "dataKeys", type: "bytes32[]" }
|
|
1910
|
+
],
|
|
1911
|
+
name: "getDataBatchForTokenIds",
|
|
1912
|
+
outputs: [{ internalType: "bytes[]", name: "dataValues", type: "bytes[]" }],
|
|
1913
|
+
stateMutability: "view",
|
|
1914
|
+
type: "function"
|
|
1915
|
+
},
|
|
1916
|
+
{
|
|
1917
|
+
inputs: [
|
|
1918
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" },
|
|
1919
|
+
{ internalType: "bytes32", name: "dataKey", type: "bytes32" }
|
|
1920
|
+
],
|
|
1921
|
+
name: "getDataForTokenId",
|
|
1922
|
+
outputs: [{ internalType: "bytes", name: "dataValue", type: "bytes" }],
|
|
1923
|
+
stateMutability: "view",
|
|
1924
|
+
type: "function"
|
|
1925
|
+
},
|
|
1926
|
+
{
|
|
1927
|
+
inputs: [{ internalType: "bytes32", name: "tokenId", type: "bytes32" }],
|
|
1928
|
+
name: "getOperatorsOf",
|
|
1929
|
+
outputs: [{ internalType: "address[]", name: "", type: "address[]" }],
|
|
1930
|
+
stateMutability: "view",
|
|
1931
|
+
type: "function"
|
|
1932
|
+
},
|
|
1933
|
+
{
|
|
1934
|
+
inputs: [
|
|
1935
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
1936
|
+
{ internalType: "uint32", name: "seed", type: "uint32" },
|
|
1937
|
+
{ internalType: "address", name: "fractal", type: "address" }
|
|
1938
|
+
],
|
|
1939
|
+
name: "inject",
|
|
1940
|
+
outputs: [],
|
|
1941
|
+
stateMutability: "nonpayable",
|
|
1942
|
+
type: "function"
|
|
1943
|
+
},
|
|
1944
|
+
{
|
|
1945
|
+
inputs: [
|
|
1946
|
+
{ internalType: "address", name: "operator", type: "address" },
|
|
1947
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" }
|
|
1948
|
+
],
|
|
1949
|
+
name: "isOperatorFor",
|
|
1950
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
1951
|
+
stateMutability: "view",
|
|
1952
|
+
type: "function"
|
|
1953
|
+
},
|
|
1954
|
+
{
|
|
1955
|
+
inputs: [
|
|
1956
|
+
{ internalType: "address", name: "fractal", type: "address" },
|
|
1957
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
1958
|
+
{ internalType: "address", name: "registry", type: "address" }
|
|
1959
|
+
],
|
|
1960
|
+
name: "migrate",
|
|
1961
|
+
outputs: [],
|
|
1962
|
+
stateMutability: "nonpayable",
|
|
1963
|
+
type: "function"
|
|
1964
|
+
},
|
|
1965
|
+
{
|
|
1966
|
+
inputs: [
|
|
1967
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
1968
|
+
{ internalType: "uint32", name: "seed", type: "uint32" }
|
|
1969
|
+
],
|
|
1970
|
+
name: "mint",
|
|
1971
|
+
outputs: [],
|
|
1972
|
+
stateMutability: "nonpayable",
|
|
1973
|
+
type: "function"
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
inputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
|
1977
|
+
name: "minted",
|
|
1978
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
1979
|
+
stateMutability: "view",
|
|
1980
|
+
type: "function"
|
|
1981
|
+
},
|
|
1982
|
+
{
|
|
1983
|
+
inputs: [],
|
|
1984
|
+
name: "owner",
|
|
1985
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
1986
|
+
stateMutability: "view",
|
|
1987
|
+
type: "function"
|
|
1988
|
+
},
|
|
1989
|
+
{
|
|
1990
|
+
inputs: [{ internalType: "bool", name: "_paused", type: "bool" }],
|
|
1991
|
+
name: "pause",
|
|
1992
|
+
outputs: [],
|
|
1993
|
+
stateMutability: "nonpayable",
|
|
1994
|
+
type: "function"
|
|
1995
|
+
},
|
|
1996
|
+
{
|
|
1997
|
+
inputs: [],
|
|
1998
|
+
name: "paused",
|
|
1999
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
2000
|
+
stateMutability: "view",
|
|
2001
|
+
type: "function"
|
|
2002
|
+
},
|
|
2003
|
+
{
|
|
2004
|
+
inputs: [
|
|
2005
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" },
|
|
2006
|
+
{ internalType: "uint256", name: "iters", type: "uint256" }
|
|
2007
|
+
],
|
|
2008
|
+
name: "refine",
|
|
2009
|
+
outputs: [],
|
|
2010
|
+
stateMutability: "nonpayable",
|
|
2011
|
+
type: "function"
|
|
2012
|
+
},
|
|
2013
|
+
{
|
|
2014
|
+
inputs: [],
|
|
2015
|
+
name: "renounceOwnership",
|
|
2016
|
+
outputs: [],
|
|
2017
|
+
stateMutability: "nonpayable",
|
|
2018
|
+
type: "function"
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
inputs: [
|
|
2022
|
+
{ internalType: "address", name: "operator", type: "address" },
|
|
2023
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" },
|
|
2024
|
+
{ internalType: "bool", name: "notify", type: "bool" },
|
|
2025
|
+
{
|
|
2026
|
+
internalType: "bytes",
|
|
2027
|
+
name: "operatorNotificationData",
|
|
2028
|
+
type: "bytes"
|
|
2029
|
+
}
|
|
2030
|
+
],
|
|
2031
|
+
name: "revokeOperator",
|
|
2032
|
+
outputs: [],
|
|
2033
|
+
stateMutability: "nonpayable",
|
|
2034
|
+
type: "function"
|
|
2035
|
+
},
|
|
2036
|
+
{
|
|
2037
|
+
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
2038
|
+
name: "seeds",
|
|
2039
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
|
2040
|
+
stateMutability: "view",
|
|
2041
|
+
type: "function"
|
|
2042
|
+
},
|
|
2043
|
+
{
|
|
2044
|
+
inputs: [
|
|
2045
|
+
{ internalType: "bytes32", name: "dataKey", type: "bytes32" },
|
|
2046
|
+
{ internalType: "bytes", name: "dataValue", type: "bytes" }
|
|
2047
|
+
],
|
|
2048
|
+
name: "setData",
|
|
2049
|
+
outputs: [],
|
|
2050
|
+
stateMutability: "payable",
|
|
2051
|
+
type: "function"
|
|
2052
|
+
},
|
|
2053
|
+
{
|
|
2054
|
+
inputs: [
|
|
2055
|
+
{ internalType: "bytes32[]", name: "dataKeys", type: "bytes32[]" },
|
|
2056
|
+
{ internalType: "bytes[]", name: "dataValues", type: "bytes[]" }
|
|
2057
|
+
],
|
|
2058
|
+
name: "setDataBatch",
|
|
2059
|
+
outputs: [],
|
|
2060
|
+
stateMutability: "payable",
|
|
2061
|
+
type: "function"
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
inputs: [
|
|
2065
|
+
{ internalType: "bytes32[]", name: "tokenIds", type: "bytes32[]" },
|
|
2066
|
+
{ internalType: "bytes32[]", name: "dataKeys", type: "bytes32[]" },
|
|
2067
|
+
{ internalType: "bytes[]", name: "dataValues", type: "bytes[]" }
|
|
2068
|
+
],
|
|
2069
|
+
name: "setDataBatchForTokenIds",
|
|
2070
|
+
outputs: [],
|
|
2071
|
+
stateMutability: "nonpayable",
|
|
2072
|
+
type: "function"
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
inputs: [
|
|
2076
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" },
|
|
2077
|
+
{ internalType: "bytes32", name: "dataKey", type: "bytes32" },
|
|
2078
|
+
{ internalType: "bytes", name: "dataValue", type: "bytes" }
|
|
2079
|
+
],
|
|
2080
|
+
name: "setDataForTokenId",
|
|
2081
|
+
outputs: [],
|
|
2082
|
+
stateMutability: "nonpayable",
|
|
2083
|
+
type: "function"
|
|
2084
|
+
},
|
|
2085
|
+
{
|
|
2086
|
+
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
|
|
2087
|
+
name: "supportsInterface",
|
|
2088
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
2089
|
+
stateMutability: "view",
|
|
2090
|
+
type: "function"
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
inputs: [{ internalType: "uint256", name: "index", type: "uint256" }],
|
|
2094
|
+
name: "tokenAt",
|
|
2095
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
2096
|
+
stateMutability: "view",
|
|
2097
|
+
type: "function"
|
|
2098
|
+
},
|
|
2099
|
+
{
|
|
2100
|
+
inputs: [{ internalType: "address", name: "tokenOwner", type: "address" }],
|
|
2101
|
+
name: "tokenIdsOf",
|
|
2102
|
+
outputs: [{ internalType: "bytes32[]", name: "", type: "bytes32[]" }],
|
|
2103
|
+
stateMutability: "view",
|
|
2104
|
+
type: "function"
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
inputs: [{ internalType: "bytes32", name: "tokenId", type: "bytes32" }],
|
|
2108
|
+
name: "tokenOwnerOf",
|
|
2109
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
2110
|
+
stateMutability: "view",
|
|
2111
|
+
type: "function"
|
|
2112
|
+
},
|
|
2113
|
+
{
|
|
2114
|
+
inputs: [],
|
|
2115
|
+
name: "totalSupply",
|
|
2116
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
2117
|
+
stateMutability: "view",
|
|
2118
|
+
type: "function"
|
|
2119
|
+
},
|
|
2120
|
+
{
|
|
2121
|
+
inputs: [
|
|
2122
|
+
{ internalType: "address", name: "from", type: "address" },
|
|
2123
|
+
{ internalType: "address", name: "to", type: "address" },
|
|
2124
|
+
{ internalType: "bytes32", name: "tokenId", type: "bytes32" },
|
|
2125
|
+
{ internalType: "bool", name: "force", type: "bool" },
|
|
2126
|
+
{ internalType: "bytes", name: "data", type: "bytes" }
|
|
2127
|
+
],
|
|
2128
|
+
name: "transfer",
|
|
2129
|
+
outputs: [],
|
|
2130
|
+
stateMutability: "nonpayable",
|
|
2131
|
+
type: "function"
|
|
2132
|
+
},
|
|
2133
|
+
{
|
|
2134
|
+
inputs: [
|
|
2135
|
+
{ internalType: "address[]", name: "from", type: "address[]" },
|
|
2136
|
+
{ internalType: "address[]", name: "to", type: "address[]" },
|
|
2137
|
+
{ internalType: "bytes32[]", name: "tokenId", type: "bytes32[]" },
|
|
2138
|
+
{ internalType: "bool[]", name: "force", type: "bool[]" },
|
|
2139
|
+
{ internalType: "bytes[]", name: "data", type: "bytes[]" }
|
|
2140
|
+
],
|
|
2141
|
+
name: "transferBatch",
|
|
2142
|
+
outputs: [],
|
|
2143
|
+
stateMutability: "nonpayable",
|
|
2144
|
+
type: "function"
|
|
2145
|
+
},
|
|
2146
|
+
{
|
|
2147
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
2148
|
+
name: "transferOwnership",
|
|
2149
|
+
outputs: [],
|
|
2150
|
+
stateMutability: "nonpayable",
|
|
2151
|
+
type: "function"
|
|
2152
|
+
},
|
|
2153
|
+
{ stateMutability: "payable", type: "receive" }
|
|
2154
|
+
];
|
|
2155
|
+
|
|
2156
|
+
// src/decoder/plugins/enhanceBurntPix.ts
|
|
2157
|
+
var refineAggregation = standardAggregation({
|
|
2158
|
+
key: "refine",
|
|
2159
|
+
map: /* @__PURE__ */ __name((tx) => {
|
|
2160
|
+
if ("functionName" in tx && tx.functionName === "refine" && tx.from) {
|
|
2161
|
+
return {
|
|
2162
|
+
callerCounts: {
|
|
2163
|
+
[tx.from.toLowerCase()]: {
|
|
2164
|
+
count: 1,
|
|
2165
|
+
tokenIds: {
|
|
2166
|
+
[`${tx.to}:${("args" in tx ? tx?.args?.[0]?.value : void 0) ?? "none"}`]: 1
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
},
|
|
2170
|
+
minBlock: Number(tx.blockNumber),
|
|
2171
|
+
maxBlock: Number(tx.blockNumber),
|
|
2172
|
+
count: 1
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
2175
|
+
return void 0;
|
|
2176
|
+
}, "map"),
|
|
2177
|
+
reduce: /* @__PURE__ */ __name((state, mapped) => {
|
|
2178
|
+
if (!state) return mapped;
|
|
2179
|
+
const callerCounts = { ...state.callerCounts };
|
|
2180
|
+
for (const [caller, { count, tokenIds }] of Object.entries(
|
|
2181
|
+
mapped.callerCounts
|
|
2182
|
+
)) {
|
|
2183
|
+
const item = callerCounts[caller] ?? { count: 0, tokenIds: {} };
|
|
2184
|
+
item.count += count;
|
|
2185
|
+
item.tokenIds = {
|
|
2186
|
+
...item.tokenIds,
|
|
2187
|
+
...tokenIds
|
|
2188
|
+
};
|
|
2189
|
+
}
|
|
2190
|
+
return {
|
|
2191
|
+
callerCounts,
|
|
2192
|
+
minBlock: Math.min(state.minBlock, mapped.minBlock),
|
|
2193
|
+
maxBlock: Math.max(state.maxBlock, mapped.maxBlock),
|
|
2194
|
+
count: state.count + mapped.count
|
|
2195
|
+
};
|
|
2196
|
+
}, "reduce"),
|
|
2197
|
+
finalize: /* @__PURE__ */ __name((state) => {
|
|
2198
|
+
const stats = Object.entries(state.callerCounts).sort(([, a], [, b]) => b.count - a.count).slice(0, 10).map(([address, { count, tokenIds }]) => {
|
|
2199
|
+
const tokens = Object.entries(tokenIds).sort(([, a], [, b]) => b - a).slice(0, 5).map(([token]) => token);
|
|
2200
|
+
return { address, count, tokens };
|
|
2201
|
+
});
|
|
2202
|
+
return {
|
|
2203
|
+
aggregate: {
|
|
2204
|
+
count: state.count,
|
|
2205
|
+
from: stats.map(({ address }) => address),
|
|
2206
|
+
tokens: stats.flatMap(({ tokens }) => tokens),
|
|
2207
|
+
blockRange: {
|
|
2208
|
+
from: state.minBlock,
|
|
2209
|
+
to: state.maxBlock
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
};
|
|
2213
|
+
}, "finalize")
|
|
2214
|
+
});
|
|
2215
|
+
var enhanceBurntPixPlugin = standardPlugin(
|
|
2216
|
+
RegistryAbi_default,
|
|
2217
|
+
{
|
|
2218
|
+
name: "burntpix",
|
|
2219
|
+
abiName: "BurntPix",
|
|
2220
|
+
decoderName: "@lukso/burntpix",
|
|
2221
|
+
priority: 50
|
|
2222
|
+
},
|
|
2223
|
+
{
|
|
2224
|
+
enhance: enhanceBurntPix,
|
|
2225
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
2226
|
+
return decodeEvent(options.chain, RegistryAbi_default, log);
|
|
2227
|
+
}, "decodeEvent"),
|
|
2228
|
+
aggregations: [refineAggregation]
|
|
2229
|
+
}
|
|
2230
|
+
);
|
|
2231
|
+
async function enhanceBurntPix(result, pluginOptions, options) {
|
|
2232
|
+
if ("functionName" in result && result.functionName === "refine") {
|
|
2233
|
+
return {
|
|
2234
|
+
...result,
|
|
2235
|
+
standard: pluginOptions.abiName,
|
|
2236
|
+
__decoder: pluginOptions.decoderName,
|
|
2237
|
+
aggregationKeys: [createAggregationKey(pluginOptions, "refine")]
|
|
2238
|
+
};
|
|
2239
|
+
}
|
|
2240
|
+
return void 0;
|
|
2241
|
+
}
|
|
2242
|
+
__name(enhanceBurntPix, "enhanceBurntPix");
|
|
2243
|
+
var enhanceBurntPix_default = enhanceBurntPixPlugin;
|
|
2244
|
+
|
|
2245
|
+
// src/decoder/plugins/enhanceGraffiti.ts
|
|
2246
|
+
import {
|
|
2247
|
+
bytesToString,
|
|
2248
|
+
hexToBytes,
|
|
2249
|
+
size as size3,
|
|
2250
|
+
slice as slice2
|
|
2251
|
+
} from "viem";
|
|
2252
|
+
var enhanceGraffitiPlugin = Object.freeze({
|
|
2253
|
+
enhance: /* @__PURE__ */ __name(async (result, options) => enhanceGraffiti(
|
|
2254
|
+
result,
|
|
2255
|
+
{ abiName: "graffiti", decoderName: "graffiti" },
|
|
2256
|
+
options
|
|
2257
|
+
), "enhance"),
|
|
2258
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => void 0, "decodeEvent"),
|
|
2259
|
+
required: true,
|
|
2260
|
+
priority: 1e3,
|
|
2261
|
+
name: "graffiti"
|
|
2262
|
+
});
|
|
2263
|
+
async function enhanceGraffiti(result, _pluginOptions, _options) {
|
|
2264
|
+
const { functionName, sig, args, input } = result;
|
|
2265
|
+
if (input && size3(input || "0x") >= 4 && slice2(input || "0x", 0, 4) === "0x00000000") {
|
|
2266
|
+
let graffiti = slice2(input, 4);
|
|
2267
|
+
try {
|
|
2268
|
+
graffiti = bytesToString(hexToBytes(graffiti));
|
|
2269
|
+
} catch {
|
|
2270
|
+
}
|
|
2271
|
+
return {
|
|
2272
|
+
...result,
|
|
2273
|
+
resultType: "grafitti",
|
|
2274
|
+
sig: "0x",
|
|
2275
|
+
functionName: "",
|
|
2276
|
+
input,
|
|
2277
|
+
graffiti,
|
|
2278
|
+
__decoder: "grafitti"
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
return void 0;
|
|
2282
|
+
}
|
|
2283
|
+
__name(enhanceGraffiti, "enhanceGraffiti");
|
|
2284
|
+
var enhanceGraffiti_default = enhanceGraffitiPlugin;
|
|
2285
|
+
|
|
2286
|
+
// src/decoder/plugins/enhanceLSP0ERC725Account.ts
|
|
2287
|
+
import { universalProfileAbi as UniversalProfile } from "@lukso/universalprofile-contracts/abi";
|
|
2288
|
+
|
|
2289
|
+
// src/decoder/transaction.ts
|
|
2290
|
+
import { isAddress, isAddressEqual, slice as slice3, zeroAddress } from "viem";
|
|
2291
|
+
async function decodeTransaction(fullTransaction, options) {
|
|
2292
|
+
const { preferError } = options;
|
|
2293
|
+
const {
|
|
2294
|
+
to,
|
|
2295
|
+
from,
|
|
2296
|
+
value,
|
|
2297
|
+
input: rawInput,
|
|
2298
|
+
data: rawData,
|
|
2299
|
+
...restTransaction
|
|
2300
|
+
} = fullTransaction;
|
|
2301
|
+
const { logs, ...transaction } = {
|
|
2302
|
+
...restTransaction,
|
|
2303
|
+
to,
|
|
2304
|
+
from,
|
|
2305
|
+
value,
|
|
2306
|
+
input: rawInput || rawData
|
|
2307
|
+
};
|
|
2308
|
+
const data = rawInput || rawData;
|
|
2309
|
+
if (!data || data === "0x") {
|
|
2310
|
+
if (preferError) {
|
|
2311
|
+
return {
|
|
2312
|
+
...transaction,
|
|
2313
|
+
isDecoded: true,
|
|
2314
|
+
functionName: void 0,
|
|
2315
|
+
__decoder: void 0,
|
|
2316
|
+
sig: slice3(data || "0x", 0, 4),
|
|
2317
|
+
resultType: "error",
|
|
2318
|
+
errorType: "INVALID" /* INVALID */,
|
|
2319
|
+
...createNamedArgs([], []),
|
|
2320
|
+
standard: void 0,
|
|
2321
|
+
phase: "enhanced"
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
return {
|
|
2325
|
+
...transaction,
|
|
2326
|
+
isDecoded: true,
|
|
2327
|
+
functionName: void 0,
|
|
2328
|
+
__decoder: void 0,
|
|
2329
|
+
standard: void 0,
|
|
2330
|
+
sig: slice3(data || "0x", 0, 4),
|
|
2331
|
+
...createNamedArgs([], []),
|
|
2332
|
+
resultType: "execute",
|
|
2333
|
+
phase: "enhanced"
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2336
|
+
let lastError;
|
|
2337
|
+
const activePlugins = options.plugins;
|
|
2338
|
+
for (const plugin of activePlugins) {
|
|
2339
|
+
if (to && isAddress(to) && isAddressEqual(to, zeroAddress)) {
|
|
2340
|
+
return {
|
|
2341
|
+
...transaction,
|
|
2342
|
+
isDecoded: true,
|
|
2343
|
+
...createNamedArgs([], []),
|
|
2344
|
+
resultType: "create",
|
|
2345
|
+
to,
|
|
2346
|
+
from,
|
|
2347
|
+
value,
|
|
2348
|
+
logs,
|
|
2349
|
+
phase: "immediate"
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2352
|
+
try {
|
|
2353
|
+
const check = await plugin.enhance(transaction, options);
|
|
2354
|
+
if (check) {
|
|
2355
|
+
const output = [];
|
|
2356
|
+
if (logs) {
|
|
2357
|
+
for (const log of logs) {
|
|
2358
|
+
const data2 = await plugin.decodeEvent(log, options);
|
|
2359
|
+
if (data2) {
|
|
2360
|
+
output.push(data2);
|
|
2361
|
+
continue;
|
|
2362
|
+
}
|
|
2363
|
+
let done = false;
|
|
2364
|
+
for (const eventPlugin of activePlugins) {
|
|
2365
|
+
if (eventPlugin !== plugin) {
|
|
2366
|
+
const data3 = await eventPlugin.decodeEvent(log, options);
|
|
2367
|
+
if (data3) {
|
|
2368
|
+
output.push(data3);
|
|
2369
|
+
done = true;
|
|
2370
|
+
break;
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
if (!done) {
|
|
2375
|
+
output.push(log);
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
check.logs = output;
|
|
2379
|
+
}
|
|
2380
|
+
let phase2 = plugin.usesAsync || "functionName" in check && check.functionName && check.standard || check.input === "0x" || !check.input ? "enhanced" : "immediate";
|
|
2381
|
+
const resultWithChildren = check;
|
|
2382
|
+
if (phase2 === "enhanced" && resultWithChildren.children && Array.isArray(resultWithChildren.children) && resultWithChildren.children.length > 0) {
|
|
2383
|
+
const allChildrenEnhanced = resultWithChildren.children.every(
|
|
2384
|
+
(child) => child.phase === "enhanced"
|
|
2385
|
+
);
|
|
2386
|
+
if (!allChildrenEnhanced) {
|
|
2387
|
+
phase2 = "immediate";
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
const result2 = {
|
|
2391
|
+
...transaction,
|
|
2392
|
+
...check,
|
|
2393
|
+
phase: phase2
|
|
2394
|
+
};
|
|
2395
|
+
return result2;
|
|
2396
|
+
}
|
|
2397
|
+
} catch (e) {
|
|
2398
|
+
console.error(e);
|
|
2399
|
+
continue;
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
let phase = "functionName" in transaction && transaction.functionName && transaction.standard || transaction.input === "0x" || !transaction.input ? "enhanced" : "immediate";
|
|
2403
|
+
const transactionWithChildren = transaction;
|
|
2404
|
+
if (phase === "enhanced" && transactionWithChildren.children && Array.isArray(transactionWithChildren.children) && transactionWithChildren.children.length > 0) {
|
|
2405
|
+
const allChildrenEnhanced = transactionWithChildren.children.every(
|
|
2406
|
+
(child) => child.phase === "enhanced"
|
|
2407
|
+
);
|
|
2408
|
+
if (!allChildrenEnhanced) {
|
|
2409
|
+
phase = "immediate";
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
const result = {
|
|
2413
|
+
...transaction,
|
|
2414
|
+
standard: void 0,
|
|
2415
|
+
__decoder: void 0,
|
|
2416
|
+
resultType: "raw",
|
|
2417
|
+
phase,
|
|
2418
|
+
sig: slice3(
|
|
2419
|
+
fullTransaction.input || "data" in fullTransaction && fullTransaction.data || "0x",
|
|
2420
|
+
0,
|
|
2421
|
+
4
|
|
2422
|
+
),
|
|
2423
|
+
...createNamedArgs([], []),
|
|
2424
|
+
...options.wrappers.length ? { wrappers: options.wrappers } : {},
|
|
2425
|
+
logs
|
|
2426
|
+
};
|
|
2427
|
+
return result;
|
|
2428
|
+
}
|
|
2429
|
+
__name(decodeTransaction, "decodeTransaction");
|
|
2430
|
+
|
|
2431
|
+
// src/decoder/plugins/enhanceSetData.ts
|
|
2432
|
+
async function enhanceSetData(result, pluginOptions, options) {
|
|
2433
|
+
const { functionName, sig, args, input, blockNumber, to, from, value } = result;
|
|
2434
|
+
switch (functionName) {
|
|
2435
|
+
case "setData": {
|
|
2436
|
+
const [_key, _value] = args.map(({ value: value2 }) => value2);
|
|
2437
|
+
return {
|
|
2438
|
+
...result,
|
|
2439
|
+
resultType: "setDataBatch",
|
|
2440
|
+
functionName,
|
|
2441
|
+
standard: result.standard || pluginOptions.abiName || "LSPContract",
|
|
2442
|
+
__decoder: result.__decoder || pluginOptions.decoderName || "@lukso/lsp-smart-contracts",
|
|
2443
|
+
input,
|
|
2444
|
+
blockNumber,
|
|
2445
|
+
sig,
|
|
2446
|
+
args,
|
|
2447
|
+
children: [
|
|
2448
|
+
{
|
|
2449
|
+
...result,
|
|
2450
|
+
info: await decodeKeyValueRaw(_key, _value, options),
|
|
2451
|
+
standard: result.standard || pluginOptions.abiName || "LSPContract",
|
|
2452
|
+
__decoder: result.__decoder || pluginOptions.decoderName || "@lukso/lsp-smart-contracts",
|
|
2453
|
+
phase: "enhanced",
|
|
2454
|
+
to,
|
|
2455
|
+
from,
|
|
2456
|
+
value,
|
|
2457
|
+
...args ? {
|
|
2458
|
+
...createNamedArgs(
|
|
2459
|
+
[_key, _value],
|
|
2460
|
+
[
|
|
2461
|
+
{ name: "key", type: "bytes32" },
|
|
2462
|
+
{ name: "value", type: "bytes" }
|
|
2463
|
+
]
|
|
2464
|
+
)
|
|
2465
|
+
} : {}
|
|
2466
|
+
}
|
|
2467
|
+
],
|
|
2468
|
+
to,
|
|
2469
|
+
from,
|
|
2470
|
+
value
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
case "setDataBatch": {
|
|
2474
|
+
const children = [];
|
|
2475
|
+
const [keys, values] = args.map(({ value: value2 }) => value2);
|
|
2476
|
+
for (let i = 0; i < keys.length; i++) {
|
|
2477
|
+
const key = keys[i];
|
|
2478
|
+
const _value = values[i];
|
|
2479
|
+
children.push({
|
|
2480
|
+
...result,
|
|
2481
|
+
resultType: "setData",
|
|
2482
|
+
standard: result.standard || pluginOptions.abiName || "LSPContract",
|
|
2483
|
+
__decoder: result.__decoder || pluginOptions.decoderName || "@lukso/lsp-smart-contracts",
|
|
2484
|
+
phase: "enhanced",
|
|
2485
|
+
to,
|
|
2486
|
+
from,
|
|
2487
|
+
value,
|
|
2488
|
+
...createNamedArgs(
|
|
2489
|
+
[key, _value],
|
|
2490
|
+
[
|
|
2491
|
+
{ name: "key", type: "bytes32" },
|
|
2492
|
+
{ name: "value", type: "bytes" }
|
|
2493
|
+
]
|
|
2494
|
+
),
|
|
2495
|
+
info: await decodeKeyValueRaw(key, _value, options)
|
|
2496
|
+
});
|
|
2497
|
+
}
|
|
2498
|
+
const setDataBatchResult = {
|
|
2499
|
+
...result,
|
|
2500
|
+
resultType: "setDataBatch",
|
|
2501
|
+
functionName,
|
|
2502
|
+
sig,
|
|
2503
|
+
input,
|
|
2504
|
+
...args ? { args } : {},
|
|
2505
|
+
standard: result.standard || pluginOptions.abiName || "LSPContract",
|
|
2506
|
+
__decoder: result.__decoder || pluginOptions.decoderName || "@lukso/lsp-smart-contracts",
|
|
2507
|
+
to,
|
|
2508
|
+
from,
|
|
2509
|
+
value,
|
|
2510
|
+
children
|
|
2511
|
+
};
|
|
2512
|
+
return setDataBatchResult;
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
return void 0;
|
|
2516
|
+
}
|
|
2517
|
+
__name(enhanceSetData, "enhanceSetData");
|
|
2518
|
+
|
|
2519
|
+
// src/decoder/plugins/enhanceLSP0ERC725Account.ts
|
|
2520
|
+
var enhanceLSP0ERC725AccountPlugin = standardPlugin(
|
|
2521
|
+
UniversalProfile,
|
|
2522
|
+
{
|
|
2523
|
+
name: "profile",
|
|
2524
|
+
abiName: "LSP0ERC725Account",
|
|
2525
|
+
decoderName: "@lukso/lsp-smart-contracts"
|
|
2526
|
+
},
|
|
2527
|
+
{
|
|
2528
|
+
enhance: enhanceLSP0ERC725Account,
|
|
2529
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
2530
|
+
return decodeEvent(options.chain, UniversalProfile, log);
|
|
2531
|
+
}, "decodeEvent")
|
|
2532
|
+
}
|
|
2533
|
+
);
|
|
2534
|
+
async function enhanceLSP0ERC725Account(result, pluginOptions, options) {
|
|
2535
|
+
const setData = await enhanceSetData(
|
|
2536
|
+
result,
|
|
2537
|
+
{ ...pluginOptions, abiName: "", decoderName: "" },
|
|
2538
|
+
options
|
|
2539
|
+
);
|
|
2540
|
+
if (setData) {
|
|
2541
|
+
return setData;
|
|
2542
|
+
}
|
|
2543
|
+
const {
|
|
2544
|
+
functionName,
|
|
2545
|
+
sig,
|
|
2546
|
+
args,
|
|
2547
|
+
input,
|
|
2548
|
+
blockNumber,
|
|
2549
|
+
to: _to,
|
|
2550
|
+
from: _from,
|
|
2551
|
+
value
|
|
2552
|
+
} = result;
|
|
2553
|
+
let to = _to;
|
|
2554
|
+
let from = _from;
|
|
2555
|
+
switch (functionName) {
|
|
2556
|
+
case "executeBatch": {
|
|
2557
|
+
const children = [];
|
|
2558
|
+
const [executeTypes, targets, values, inputs] = args.map(
|
|
2559
|
+
({ value: value2 }) => value2
|
|
2560
|
+
);
|
|
2561
|
+
const {
|
|
2562
|
+
functionName: _functionName,
|
|
2563
|
+
sig: _sig,
|
|
2564
|
+
args: _args,
|
|
2565
|
+
resultType: _resultType,
|
|
2566
|
+
...plainResult
|
|
2567
|
+
} = result;
|
|
2568
|
+
for (let i = 0; i < values.length; i++) {
|
|
2569
|
+
const _data = inputs[i];
|
|
2570
|
+
const _value = BigInt(values[i]);
|
|
2571
|
+
const _to2 = targets[i];
|
|
2572
|
+
const decoded = await decodeTransaction(
|
|
2573
|
+
{
|
|
2574
|
+
input: _data,
|
|
2575
|
+
to: _to2,
|
|
2576
|
+
from,
|
|
2577
|
+
value: _value
|
|
2578
|
+
},
|
|
2579
|
+
options
|
|
2580
|
+
);
|
|
2581
|
+
children.push(
|
|
2582
|
+
executeTypes[i] === 1n ? {
|
|
2583
|
+
...plainResult,
|
|
2584
|
+
...decoded,
|
|
2585
|
+
resultType: "create"
|
|
2586
|
+
} : { ...plainResult, ...decoded }
|
|
2587
|
+
);
|
|
2588
|
+
}
|
|
2589
|
+
options.wrappers.splice(0, 0, {
|
|
2590
|
+
...result,
|
|
2591
|
+
resultType: "wrapper",
|
|
2592
|
+
functionName,
|
|
2593
|
+
sig,
|
|
2594
|
+
standard: pluginOptions.abiName,
|
|
2595
|
+
args,
|
|
2596
|
+
to,
|
|
2597
|
+
from,
|
|
2598
|
+
value,
|
|
2599
|
+
input,
|
|
2600
|
+
__decoder: pluginOptions.decoderName
|
|
2601
|
+
});
|
|
2602
|
+
const execute = {
|
|
2603
|
+
...result,
|
|
2604
|
+
resultType: "executeBatch",
|
|
2605
|
+
standard: pluginOptions.abiName,
|
|
2606
|
+
__decoder: pluginOptions.decoderName,
|
|
2607
|
+
children,
|
|
2608
|
+
to,
|
|
2609
|
+
from,
|
|
2610
|
+
value
|
|
2611
|
+
};
|
|
2612
|
+
return {
|
|
2613
|
+
blockNumber,
|
|
2614
|
+
...execute
|
|
2615
|
+
};
|
|
2616
|
+
}
|
|
2617
|
+
case "execute": {
|
|
2618
|
+
const [executeType, target, value2, _data] = args.map(
|
|
2619
|
+
({ value: value3 }) => value3
|
|
2620
|
+
);
|
|
2621
|
+
const decoded = await decodeTransaction(
|
|
2622
|
+
{
|
|
2623
|
+
input: _data,
|
|
2624
|
+
to: target,
|
|
2625
|
+
from: to || from,
|
|
2626
|
+
// This should be decoded to the profile address if it's a controller.
|
|
2627
|
+
value: value2
|
|
2628
|
+
},
|
|
2629
|
+
options
|
|
2630
|
+
);
|
|
2631
|
+
from = to || from;
|
|
2632
|
+
to = target || to;
|
|
2633
|
+
options.wrappers?.splice(0, 0, {
|
|
2634
|
+
...result,
|
|
2635
|
+
resultType: "wrapper",
|
|
2636
|
+
functionName,
|
|
2637
|
+
sig,
|
|
2638
|
+
input,
|
|
2639
|
+
__decoder: pluginOptions.decoderName,
|
|
2640
|
+
to,
|
|
2641
|
+
from,
|
|
2642
|
+
value: value2,
|
|
2643
|
+
standard: pluginOptions.abiName,
|
|
2644
|
+
...createNamedArgs(
|
|
2645
|
+
[executeType, target, value2, _data],
|
|
2646
|
+
[
|
|
2647
|
+
{ name: "executeType", type: "uint256" },
|
|
2648
|
+
{ name: "target", type: "address" },
|
|
2649
|
+
{ name: "value", type: "uint256" },
|
|
2650
|
+
{ name: "data", type: "bytes" }
|
|
2651
|
+
]
|
|
2652
|
+
)
|
|
2653
|
+
});
|
|
2654
|
+
return {
|
|
2655
|
+
...result,
|
|
2656
|
+
functionName,
|
|
2657
|
+
sig,
|
|
2658
|
+
standard: pluginOptions.abiName,
|
|
2659
|
+
__decoder: pluginOptions.decoderName,
|
|
2660
|
+
...decoded,
|
|
2661
|
+
resultType: executeType === 1n ? "create" : "execute"
|
|
2662
|
+
};
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
__name(enhanceLSP0ERC725Account, "enhanceLSP0ERC725Account");
|
|
2667
|
+
var enhanceLSP0ERC725Account_default = enhanceLSP0ERC725AccountPlugin;
|
|
2668
|
+
|
|
2669
|
+
// src/decoder/plugins/enhanceLSP6KeyManager.ts
|
|
2670
|
+
import { lsp6KeyManagerAbi as KeyManager } from "@lukso/lsp6-contracts/abi";
|
|
2671
|
+
|
|
2672
|
+
// ../../node_modules/.pnpm/@lukso+lsp6-contracts@0.15.5/node_modules/@lukso/lsp6-contracts/artifacts/LSP6KeyManager.json
|
|
2673
|
+
var abi = [
|
|
2674
|
+
{
|
|
2675
|
+
inputs: [
|
|
2676
|
+
{
|
|
2677
|
+
internalType: "address",
|
|
2678
|
+
name: "target_",
|
|
2679
|
+
type: "address"
|
|
2680
|
+
}
|
|
2681
|
+
],
|
|
2682
|
+
stateMutability: "nonpayable",
|
|
2683
|
+
type: "constructor"
|
|
2684
|
+
},
|
|
2685
|
+
{
|
|
2686
|
+
inputs: [],
|
|
2687
|
+
name: "BatchExecuteParamsLengthMismatch",
|
|
2688
|
+
type: "error"
|
|
2689
|
+
},
|
|
2690
|
+
{
|
|
2691
|
+
inputs: [],
|
|
2692
|
+
name: "BatchExecuteRelayCallParamsLengthMismatch",
|
|
2693
|
+
type: "error"
|
|
2694
|
+
},
|
|
2695
|
+
{
|
|
2696
|
+
inputs: [],
|
|
2697
|
+
name: "CallingKeyManagerNotAllowed",
|
|
2698
|
+
type: "error"
|
|
2699
|
+
},
|
|
2700
|
+
{
|
|
2701
|
+
inputs: [],
|
|
2702
|
+
name: "DelegateCallDisallowedViaKeyManager",
|
|
2703
|
+
type: "error"
|
|
2704
|
+
},
|
|
2705
|
+
{
|
|
2706
|
+
inputs: [],
|
|
2707
|
+
name: "ERC725X_ExecuteParametersEmptyArray",
|
|
2708
|
+
type: "error"
|
|
2709
|
+
},
|
|
2710
|
+
{
|
|
2711
|
+
inputs: [],
|
|
2712
|
+
name: "ERC725X_ExecuteParametersLengthMismatch",
|
|
2713
|
+
type: "error"
|
|
2714
|
+
},
|
|
2715
|
+
{
|
|
2716
|
+
inputs: [],
|
|
2717
|
+
name: "ERC725Y_DataKeysValuesLengthMismatch",
|
|
2718
|
+
type: "error"
|
|
2719
|
+
},
|
|
2720
|
+
{
|
|
2721
|
+
inputs: [
|
|
2722
|
+
{
|
|
2723
|
+
internalType: "bytes32",
|
|
2724
|
+
name: "dataKey",
|
|
2725
|
+
type: "bytes32"
|
|
2726
|
+
},
|
|
2727
|
+
{
|
|
2728
|
+
internalType: "bytes",
|
|
2729
|
+
name: "dataValue",
|
|
2730
|
+
type: "bytes"
|
|
2731
|
+
}
|
|
2732
|
+
],
|
|
2733
|
+
name: "InvalidDataValuesForDataKeys",
|
|
2734
|
+
type: "error"
|
|
2735
|
+
},
|
|
2736
|
+
{
|
|
2737
|
+
inputs: [
|
|
2738
|
+
{
|
|
2739
|
+
internalType: "bytes4",
|
|
2740
|
+
name: "invalidFunction",
|
|
2741
|
+
type: "bytes4"
|
|
2742
|
+
}
|
|
2743
|
+
],
|
|
2744
|
+
name: "InvalidERC725Function",
|
|
2745
|
+
type: "error"
|
|
2746
|
+
},
|
|
2747
|
+
{
|
|
2748
|
+
inputs: [
|
|
2749
|
+
{
|
|
2750
|
+
internalType: "bytes",
|
|
2751
|
+
name: "allowedCallsValue",
|
|
2752
|
+
type: "bytes"
|
|
2753
|
+
}
|
|
2754
|
+
],
|
|
2755
|
+
name: "InvalidEncodedAllowedCalls",
|
|
2756
|
+
type: "error"
|
|
2757
|
+
},
|
|
2758
|
+
{
|
|
2759
|
+
inputs: [
|
|
2760
|
+
{
|
|
2761
|
+
internalType: "bytes",
|
|
2762
|
+
name: "value",
|
|
2763
|
+
type: "bytes"
|
|
2764
|
+
},
|
|
2765
|
+
{
|
|
2766
|
+
internalType: "string",
|
|
2767
|
+
name: "context",
|
|
2768
|
+
type: "string"
|
|
2769
|
+
}
|
|
2770
|
+
],
|
|
2771
|
+
name: "InvalidEncodedAllowedERC725YDataKeys",
|
|
2772
|
+
type: "error"
|
|
2773
|
+
},
|
|
2774
|
+
{
|
|
2775
|
+
inputs: [],
|
|
2776
|
+
name: "InvalidLSP6Target",
|
|
2777
|
+
type: "error"
|
|
2778
|
+
},
|
|
2779
|
+
{
|
|
2780
|
+
inputs: [
|
|
2781
|
+
{
|
|
2782
|
+
internalType: "bytes",
|
|
2783
|
+
name: "payload",
|
|
2784
|
+
type: "bytes"
|
|
2785
|
+
}
|
|
2786
|
+
],
|
|
2787
|
+
name: "InvalidPayload",
|
|
2788
|
+
type: "error"
|
|
2789
|
+
},
|
|
2790
|
+
{
|
|
2791
|
+
inputs: [
|
|
2792
|
+
{
|
|
2793
|
+
internalType: "address",
|
|
2794
|
+
name: "signer",
|
|
2795
|
+
type: "address"
|
|
2796
|
+
},
|
|
2797
|
+
{
|
|
2798
|
+
internalType: "uint256",
|
|
2799
|
+
name: "invalidNonce",
|
|
2800
|
+
type: "uint256"
|
|
2801
|
+
},
|
|
2802
|
+
{
|
|
2803
|
+
internalType: "bytes",
|
|
2804
|
+
name: "signature",
|
|
2805
|
+
type: "bytes"
|
|
2806
|
+
}
|
|
2807
|
+
],
|
|
2808
|
+
name: "InvalidRelayNonce",
|
|
2809
|
+
type: "error"
|
|
2810
|
+
},
|
|
2811
|
+
{
|
|
2812
|
+
inputs: [
|
|
2813
|
+
{
|
|
2814
|
+
internalType: "address",
|
|
2815
|
+
name: "from",
|
|
2816
|
+
type: "address"
|
|
2817
|
+
}
|
|
2818
|
+
],
|
|
2819
|
+
name: "InvalidWhitelistedCall",
|
|
2820
|
+
type: "error"
|
|
2821
|
+
},
|
|
2822
|
+
{
|
|
2823
|
+
inputs: [],
|
|
2824
|
+
name: "KeyManagerCannotBeSetAsExtensionForLSP20Functions",
|
|
2825
|
+
type: "error"
|
|
2826
|
+
},
|
|
2827
|
+
{
|
|
2828
|
+
inputs: [
|
|
2829
|
+
{
|
|
2830
|
+
internalType: "uint256",
|
|
2831
|
+
name: "totalValues",
|
|
2832
|
+
type: "uint256"
|
|
2833
|
+
},
|
|
2834
|
+
{
|
|
2835
|
+
internalType: "uint256",
|
|
2836
|
+
name: "msgValue",
|
|
2837
|
+
type: "uint256"
|
|
2838
|
+
}
|
|
2839
|
+
],
|
|
2840
|
+
name: "LSP6BatchExcessiveValueSent",
|
|
2841
|
+
type: "error"
|
|
2842
|
+
},
|
|
2843
|
+
{
|
|
2844
|
+
inputs: [
|
|
2845
|
+
{
|
|
2846
|
+
internalType: "uint256",
|
|
2847
|
+
name: "totalValues",
|
|
2848
|
+
type: "uint256"
|
|
2849
|
+
},
|
|
2850
|
+
{
|
|
2851
|
+
internalType: "uint256",
|
|
2852
|
+
name: "msgValue",
|
|
2853
|
+
type: "uint256"
|
|
2854
|
+
}
|
|
2855
|
+
],
|
|
2856
|
+
name: "LSP6BatchInsufficientValueSent",
|
|
2857
|
+
type: "error"
|
|
2858
|
+
},
|
|
2859
|
+
{
|
|
2860
|
+
inputs: [
|
|
2861
|
+
{
|
|
2862
|
+
internalType: "address",
|
|
2863
|
+
name: "from",
|
|
2864
|
+
type: "address"
|
|
2865
|
+
}
|
|
2866
|
+
],
|
|
2867
|
+
name: "NoCallsAllowed",
|
|
2868
|
+
type: "error"
|
|
2869
|
+
},
|
|
2870
|
+
{
|
|
2871
|
+
inputs: [
|
|
2872
|
+
{
|
|
2873
|
+
internalType: "address",
|
|
2874
|
+
name: "from",
|
|
2875
|
+
type: "address"
|
|
2876
|
+
}
|
|
2877
|
+
],
|
|
2878
|
+
name: "NoERC725YDataKeysAllowed",
|
|
2879
|
+
type: "error"
|
|
2880
|
+
},
|
|
2881
|
+
{
|
|
2882
|
+
inputs: [
|
|
2883
|
+
{
|
|
2884
|
+
internalType: "address",
|
|
2885
|
+
name: "from",
|
|
2886
|
+
type: "address"
|
|
2887
|
+
}
|
|
2888
|
+
],
|
|
2889
|
+
name: "NoPermissionsSet",
|
|
2890
|
+
type: "error"
|
|
2891
|
+
},
|
|
2892
|
+
{
|
|
2893
|
+
inputs: [
|
|
2894
|
+
{
|
|
2895
|
+
internalType: "address",
|
|
2896
|
+
name: "from",
|
|
2897
|
+
type: "address"
|
|
2898
|
+
},
|
|
2899
|
+
{
|
|
2900
|
+
internalType: "address",
|
|
2901
|
+
name: "to",
|
|
2902
|
+
type: "address"
|
|
2903
|
+
},
|
|
2904
|
+
{
|
|
2905
|
+
internalType: "bytes4",
|
|
2906
|
+
name: "selector",
|
|
2907
|
+
type: "bytes4"
|
|
2908
|
+
}
|
|
2909
|
+
],
|
|
2910
|
+
name: "NotAllowedCall",
|
|
2911
|
+
type: "error"
|
|
2912
|
+
},
|
|
2913
|
+
{
|
|
2914
|
+
inputs: [
|
|
2915
|
+
{
|
|
2916
|
+
internalType: "address",
|
|
2917
|
+
name: "from",
|
|
2918
|
+
type: "address"
|
|
2919
|
+
},
|
|
2920
|
+
{
|
|
2921
|
+
internalType: "bytes32",
|
|
2922
|
+
name: "disallowedKey",
|
|
2923
|
+
type: "bytes32"
|
|
2924
|
+
}
|
|
2925
|
+
],
|
|
2926
|
+
name: "NotAllowedERC725YDataKey",
|
|
2927
|
+
type: "error"
|
|
2928
|
+
},
|
|
2929
|
+
{
|
|
2930
|
+
inputs: [
|
|
2931
|
+
{
|
|
2932
|
+
internalType: "address",
|
|
2933
|
+
name: "from",
|
|
2934
|
+
type: "address"
|
|
2935
|
+
},
|
|
2936
|
+
{
|
|
2937
|
+
internalType: "string",
|
|
2938
|
+
name: "permission",
|
|
2939
|
+
type: "string"
|
|
2940
|
+
}
|
|
2941
|
+
],
|
|
2942
|
+
name: "NotAuthorised",
|
|
2943
|
+
type: "error"
|
|
2944
|
+
},
|
|
2945
|
+
{
|
|
2946
|
+
inputs: [
|
|
2947
|
+
{
|
|
2948
|
+
internalType: "bytes32",
|
|
2949
|
+
name: "dataKey",
|
|
2950
|
+
type: "bytes32"
|
|
2951
|
+
}
|
|
2952
|
+
],
|
|
2953
|
+
name: "NotRecognisedPermissionKey",
|
|
2954
|
+
type: "error"
|
|
2955
|
+
},
|
|
2956
|
+
{
|
|
2957
|
+
inputs: [],
|
|
2958
|
+
name: "RelayCallBeforeStartTime",
|
|
2959
|
+
type: "error"
|
|
2960
|
+
},
|
|
2961
|
+
{
|
|
2962
|
+
inputs: [],
|
|
2963
|
+
name: "RelayCallExpired",
|
|
2964
|
+
type: "error"
|
|
2965
|
+
},
|
|
2966
|
+
{
|
|
2967
|
+
anonymous: false,
|
|
2968
|
+
inputs: [
|
|
2969
|
+
{
|
|
2970
|
+
indexed: true,
|
|
2971
|
+
internalType: "address",
|
|
2972
|
+
name: "signer",
|
|
2973
|
+
type: "address"
|
|
2974
|
+
},
|
|
2975
|
+
{
|
|
2976
|
+
indexed: true,
|
|
2977
|
+
internalType: "uint256",
|
|
2978
|
+
name: "value",
|
|
2979
|
+
type: "uint256"
|
|
2980
|
+
},
|
|
2981
|
+
{
|
|
2982
|
+
indexed: true,
|
|
2983
|
+
internalType: "bytes4",
|
|
2984
|
+
name: "selector",
|
|
2985
|
+
type: "bytes4"
|
|
2986
|
+
}
|
|
2987
|
+
],
|
|
2988
|
+
name: "PermissionsVerified",
|
|
2989
|
+
type: "event"
|
|
2990
|
+
},
|
|
2991
|
+
{
|
|
2992
|
+
inputs: [],
|
|
2993
|
+
name: "VERSION",
|
|
2994
|
+
outputs: [
|
|
2995
|
+
{
|
|
2996
|
+
internalType: "string",
|
|
2997
|
+
name: "",
|
|
2998
|
+
type: "string"
|
|
2999
|
+
}
|
|
3000
|
+
],
|
|
3001
|
+
stateMutability: "view",
|
|
3002
|
+
type: "function"
|
|
3003
|
+
},
|
|
3004
|
+
{
|
|
3005
|
+
inputs: [
|
|
3006
|
+
{
|
|
3007
|
+
internalType: "bytes",
|
|
3008
|
+
name: "payload",
|
|
3009
|
+
type: "bytes"
|
|
3010
|
+
}
|
|
3011
|
+
],
|
|
3012
|
+
name: "execute",
|
|
3013
|
+
outputs: [
|
|
3014
|
+
{
|
|
3015
|
+
internalType: "bytes",
|
|
3016
|
+
name: "",
|
|
3017
|
+
type: "bytes"
|
|
3018
|
+
}
|
|
3019
|
+
],
|
|
3020
|
+
stateMutability: "payable",
|
|
3021
|
+
type: "function"
|
|
3022
|
+
},
|
|
3023
|
+
{
|
|
3024
|
+
inputs: [
|
|
3025
|
+
{
|
|
3026
|
+
internalType: "uint256[]",
|
|
3027
|
+
name: "values",
|
|
3028
|
+
type: "uint256[]"
|
|
3029
|
+
},
|
|
3030
|
+
{
|
|
3031
|
+
internalType: "bytes[]",
|
|
3032
|
+
name: "payloads",
|
|
3033
|
+
type: "bytes[]"
|
|
3034
|
+
}
|
|
3035
|
+
],
|
|
3036
|
+
name: "executeBatch",
|
|
3037
|
+
outputs: [
|
|
3038
|
+
{
|
|
3039
|
+
internalType: "bytes[]",
|
|
3040
|
+
name: "",
|
|
3041
|
+
type: "bytes[]"
|
|
3042
|
+
}
|
|
3043
|
+
],
|
|
3044
|
+
stateMutability: "payable",
|
|
3045
|
+
type: "function"
|
|
3046
|
+
},
|
|
3047
|
+
{
|
|
3048
|
+
inputs: [
|
|
3049
|
+
{
|
|
3050
|
+
internalType: "bytes",
|
|
3051
|
+
name: "signature",
|
|
3052
|
+
type: "bytes"
|
|
3053
|
+
},
|
|
3054
|
+
{
|
|
3055
|
+
internalType: "uint256",
|
|
3056
|
+
name: "nonce",
|
|
3057
|
+
type: "uint256"
|
|
3058
|
+
},
|
|
3059
|
+
{
|
|
3060
|
+
internalType: "uint256",
|
|
3061
|
+
name: "validityTimestamps",
|
|
3062
|
+
type: "uint256"
|
|
3063
|
+
},
|
|
3064
|
+
{
|
|
3065
|
+
internalType: "bytes",
|
|
3066
|
+
name: "payload",
|
|
3067
|
+
type: "bytes"
|
|
3068
|
+
}
|
|
3069
|
+
],
|
|
3070
|
+
name: "executeRelayCall",
|
|
3071
|
+
outputs: [
|
|
3072
|
+
{
|
|
3073
|
+
internalType: "bytes",
|
|
3074
|
+
name: "",
|
|
3075
|
+
type: "bytes"
|
|
3076
|
+
}
|
|
3077
|
+
],
|
|
3078
|
+
stateMutability: "payable",
|
|
3079
|
+
type: "function"
|
|
3080
|
+
},
|
|
3081
|
+
{
|
|
3082
|
+
inputs: [
|
|
3083
|
+
{
|
|
3084
|
+
internalType: "bytes[]",
|
|
3085
|
+
name: "signatures",
|
|
3086
|
+
type: "bytes[]"
|
|
3087
|
+
},
|
|
3088
|
+
{
|
|
3089
|
+
internalType: "uint256[]",
|
|
3090
|
+
name: "nonces",
|
|
3091
|
+
type: "uint256[]"
|
|
3092
|
+
},
|
|
3093
|
+
{
|
|
3094
|
+
internalType: "uint256[]",
|
|
3095
|
+
name: "validityTimestamps",
|
|
3096
|
+
type: "uint256[]"
|
|
3097
|
+
},
|
|
3098
|
+
{
|
|
3099
|
+
internalType: "uint256[]",
|
|
3100
|
+
name: "values",
|
|
3101
|
+
type: "uint256[]"
|
|
3102
|
+
},
|
|
3103
|
+
{
|
|
3104
|
+
internalType: "bytes[]",
|
|
3105
|
+
name: "payloads",
|
|
3106
|
+
type: "bytes[]"
|
|
3107
|
+
}
|
|
3108
|
+
],
|
|
3109
|
+
name: "executeRelayCallBatch",
|
|
3110
|
+
outputs: [
|
|
3111
|
+
{
|
|
3112
|
+
internalType: "bytes[]",
|
|
3113
|
+
name: "",
|
|
3114
|
+
type: "bytes[]"
|
|
3115
|
+
}
|
|
3116
|
+
],
|
|
3117
|
+
stateMutability: "payable",
|
|
3118
|
+
type: "function"
|
|
3119
|
+
},
|
|
3120
|
+
{
|
|
3121
|
+
inputs: [
|
|
3122
|
+
{
|
|
3123
|
+
internalType: "address",
|
|
3124
|
+
name: "from",
|
|
3125
|
+
type: "address"
|
|
3126
|
+
},
|
|
3127
|
+
{
|
|
3128
|
+
internalType: "uint128",
|
|
3129
|
+
name: "channelId",
|
|
3130
|
+
type: "uint128"
|
|
3131
|
+
}
|
|
3132
|
+
],
|
|
3133
|
+
name: "getNonce",
|
|
3134
|
+
outputs: [
|
|
3135
|
+
{
|
|
3136
|
+
internalType: "uint256",
|
|
3137
|
+
name: "",
|
|
3138
|
+
type: "uint256"
|
|
3139
|
+
}
|
|
3140
|
+
],
|
|
3141
|
+
stateMutability: "view",
|
|
3142
|
+
type: "function"
|
|
3143
|
+
},
|
|
3144
|
+
{
|
|
3145
|
+
inputs: [
|
|
3146
|
+
{
|
|
3147
|
+
internalType: "bytes32",
|
|
3148
|
+
name: "dataHash",
|
|
3149
|
+
type: "bytes32"
|
|
3150
|
+
},
|
|
3151
|
+
{
|
|
3152
|
+
internalType: "bytes",
|
|
3153
|
+
name: "signature",
|
|
3154
|
+
type: "bytes"
|
|
3155
|
+
}
|
|
3156
|
+
],
|
|
3157
|
+
name: "isValidSignature",
|
|
3158
|
+
outputs: [
|
|
3159
|
+
{
|
|
3160
|
+
internalType: "bytes4",
|
|
3161
|
+
name: "returnedStatus",
|
|
3162
|
+
type: "bytes4"
|
|
3163
|
+
}
|
|
3164
|
+
],
|
|
3165
|
+
stateMutability: "view",
|
|
3166
|
+
type: "function"
|
|
3167
|
+
},
|
|
3168
|
+
{
|
|
3169
|
+
inputs: [
|
|
3170
|
+
{
|
|
3171
|
+
internalType: "address",
|
|
3172
|
+
name: "",
|
|
3173
|
+
type: "address"
|
|
3174
|
+
},
|
|
3175
|
+
{
|
|
3176
|
+
internalType: "address",
|
|
3177
|
+
name: "targetContract",
|
|
3178
|
+
type: "address"
|
|
3179
|
+
},
|
|
3180
|
+
{
|
|
3181
|
+
internalType: "address",
|
|
3182
|
+
name: "caller",
|
|
3183
|
+
type: "address"
|
|
3184
|
+
},
|
|
3185
|
+
{
|
|
3186
|
+
internalType: "uint256",
|
|
3187
|
+
name: "msgValue",
|
|
3188
|
+
type: "uint256"
|
|
3189
|
+
},
|
|
3190
|
+
{
|
|
3191
|
+
internalType: "bytes",
|
|
3192
|
+
name: "callData",
|
|
3193
|
+
type: "bytes"
|
|
3194
|
+
}
|
|
3195
|
+
],
|
|
3196
|
+
name: "lsp20VerifyCall",
|
|
3197
|
+
outputs: [
|
|
3198
|
+
{
|
|
3199
|
+
internalType: "bytes4",
|
|
3200
|
+
name: "",
|
|
3201
|
+
type: "bytes4"
|
|
3202
|
+
}
|
|
3203
|
+
],
|
|
3204
|
+
stateMutability: "nonpayable",
|
|
3205
|
+
type: "function"
|
|
3206
|
+
},
|
|
3207
|
+
{
|
|
3208
|
+
inputs: [
|
|
3209
|
+
{
|
|
3210
|
+
internalType: "bytes32",
|
|
3211
|
+
name: "",
|
|
3212
|
+
type: "bytes32"
|
|
3213
|
+
},
|
|
3214
|
+
{
|
|
3215
|
+
internalType: "bytes",
|
|
3216
|
+
name: "",
|
|
3217
|
+
type: "bytes"
|
|
3218
|
+
}
|
|
3219
|
+
],
|
|
3220
|
+
name: "lsp20VerifyCallResult",
|
|
3221
|
+
outputs: [
|
|
3222
|
+
{
|
|
3223
|
+
internalType: "bytes4",
|
|
3224
|
+
name: "",
|
|
3225
|
+
type: "bytes4"
|
|
3226
|
+
}
|
|
3227
|
+
],
|
|
3228
|
+
stateMutability: "nonpayable",
|
|
3229
|
+
type: "function"
|
|
3230
|
+
},
|
|
3231
|
+
{
|
|
3232
|
+
inputs: [
|
|
3233
|
+
{
|
|
3234
|
+
internalType: "bytes4",
|
|
3235
|
+
name: "interfaceId",
|
|
3236
|
+
type: "bytes4"
|
|
3237
|
+
}
|
|
3238
|
+
],
|
|
3239
|
+
name: "supportsInterface",
|
|
3240
|
+
outputs: [
|
|
3241
|
+
{
|
|
3242
|
+
internalType: "bool",
|
|
3243
|
+
name: "",
|
|
3244
|
+
type: "bool"
|
|
3245
|
+
}
|
|
3246
|
+
],
|
|
3247
|
+
stateMutability: "view",
|
|
3248
|
+
type: "function"
|
|
3249
|
+
},
|
|
3250
|
+
{
|
|
3251
|
+
inputs: [],
|
|
3252
|
+
name: "target",
|
|
3253
|
+
outputs: [
|
|
3254
|
+
{
|
|
3255
|
+
internalType: "address",
|
|
3256
|
+
name: "",
|
|
3257
|
+
type: "address"
|
|
3258
|
+
}
|
|
3259
|
+
],
|
|
3260
|
+
stateMutability: "view",
|
|
3261
|
+
type: "function"
|
|
3262
|
+
}
|
|
3263
|
+
];
|
|
3264
|
+
|
|
3265
|
+
// src/decoder/interfaces.ts
|
|
3266
|
+
import { LRUCache } from "lru-cache";
|
|
3267
|
+
import {
|
|
3268
|
+
encodeFunctionData,
|
|
3269
|
+
getContract
|
|
3270
|
+
} from "viem";
|
|
3271
|
+
var TARGETS = new LRUCache({
|
|
3272
|
+
max: 1e3,
|
|
3273
|
+
ttl: 1e3 * 60 * 60
|
|
3274
|
+
});
|
|
3275
|
+
async function getKMTarget(chain, address) {
|
|
3276
|
+
if (!address) {
|
|
3277
|
+
return void 0;
|
|
3278
|
+
}
|
|
3279
|
+
const info = TARGETS.get(address);
|
|
3280
|
+
if (info) {
|
|
3281
|
+
return info;
|
|
3282
|
+
}
|
|
3283
|
+
const client = getPublicClient(chain);
|
|
3284
|
+
const out = client.readContract({
|
|
3285
|
+
address,
|
|
3286
|
+
abi,
|
|
3287
|
+
functionName: "target"
|
|
3288
|
+
}).catch(() => void 0);
|
|
3289
|
+
TARGETS.set(address, out);
|
|
3290
|
+
return out;
|
|
3291
|
+
}
|
|
3292
|
+
__name(getKMTarget, "getKMTarget");
|
|
3293
|
+
var INTERFACE_INFO = new LRUCache({
|
|
3294
|
+
max: 1e3,
|
|
3295
|
+
ttl: 1e3 * 60 * 60
|
|
3296
|
+
});
|
|
3297
|
+
|
|
3298
|
+
// src/decoder/plugins/enhanceLSP6KeyManager.ts
|
|
3299
|
+
var enhanceLSP6KeyManagerPlugin = standardPlugin(
|
|
3300
|
+
KeyManager,
|
|
3301
|
+
{
|
|
3302
|
+
name: "keyManager",
|
|
3303
|
+
abiName: "LSP6KeyManager",
|
|
3304
|
+
decoderName: "@lukso/lsp-smart-contracts"
|
|
3305
|
+
},
|
|
3306
|
+
{
|
|
3307
|
+
enhance: /* @__PURE__ */ __name(async (result, pluginOptions, options) => {
|
|
3308
|
+
const setData = await enhanceSetData(result, pluginOptions, options);
|
|
3309
|
+
if (setData) {
|
|
3310
|
+
return setData;
|
|
3311
|
+
}
|
|
3312
|
+
return enhanceKeyManager(result, pluginOptions, options);
|
|
3313
|
+
}, "enhance"),
|
|
3314
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
3315
|
+
return decodeEvent(options.chain, KeyManager, log);
|
|
3316
|
+
}, "decodeEvent")
|
|
3317
|
+
}
|
|
3318
|
+
);
|
|
3319
|
+
async function enhanceKeyManager(result, pluginOptions, options) {
|
|
3320
|
+
const {
|
|
3321
|
+
functionName,
|
|
3322
|
+
sig,
|
|
3323
|
+
args,
|
|
3324
|
+
input,
|
|
3325
|
+
blockNumber,
|
|
3326
|
+
to: _to,
|
|
3327
|
+
from: _from,
|
|
3328
|
+
value
|
|
3329
|
+
} = result;
|
|
3330
|
+
let to = _to;
|
|
3331
|
+
let from = _from;
|
|
3332
|
+
switch (functionName) {
|
|
3333
|
+
case "execute": {
|
|
3334
|
+
const decoded = await decodeTransaction(
|
|
3335
|
+
{
|
|
3336
|
+
input: args?.[0]?.value,
|
|
3337
|
+
to,
|
|
3338
|
+
from,
|
|
3339
|
+
value
|
|
3340
|
+
},
|
|
3341
|
+
options
|
|
3342
|
+
);
|
|
3343
|
+
options.wrappers?.splice(0, 0, {
|
|
3344
|
+
...result,
|
|
3345
|
+
resultType: "wrapper",
|
|
3346
|
+
__decoder: pluginOptions.decoderName,
|
|
3347
|
+
functionName,
|
|
3348
|
+
sig,
|
|
3349
|
+
input,
|
|
3350
|
+
standard: pluginOptions.abiName,
|
|
3351
|
+
args
|
|
3352
|
+
});
|
|
3353
|
+
const execute = {
|
|
3354
|
+
...result,
|
|
3355
|
+
...decoded,
|
|
3356
|
+
to,
|
|
3357
|
+
from,
|
|
3358
|
+
value
|
|
3359
|
+
};
|
|
3360
|
+
return {
|
|
3361
|
+
...execute
|
|
3362
|
+
};
|
|
3363
|
+
}
|
|
3364
|
+
case "executeBatch": {
|
|
3365
|
+
const children = [];
|
|
3366
|
+
const [values, inputs] = args.map(({ value: value2 }) => value2);
|
|
3367
|
+
const {
|
|
3368
|
+
functionName: _functionName,
|
|
3369
|
+
sig: _sig,
|
|
3370
|
+
args: _args,
|
|
3371
|
+
resultType: _resultType,
|
|
3372
|
+
...plainResult
|
|
3373
|
+
} = result;
|
|
3374
|
+
for (let i = 0; i < values.length; i++) {
|
|
3375
|
+
const _data = inputs[i];
|
|
3376
|
+
const _value = BigInt(values[i]);
|
|
3377
|
+
const decoded = await decodeTransaction(
|
|
3378
|
+
{
|
|
3379
|
+
input: _data,
|
|
3380
|
+
to,
|
|
3381
|
+
from,
|
|
3382
|
+
value: _value
|
|
3383
|
+
},
|
|
3384
|
+
options
|
|
3385
|
+
);
|
|
3386
|
+
children.push({ ...plainResult, ...decoded });
|
|
3387
|
+
}
|
|
3388
|
+
options.wrappers?.splice(0, 0, {
|
|
3389
|
+
...result,
|
|
3390
|
+
resultType: "wrapper",
|
|
3391
|
+
functionName,
|
|
3392
|
+
sig,
|
|
3393
|
+
__decoder: pluginOptions.decoderName,
|
|
3394
|
+
standard: pluginOptions.abiName,
|
|
3395
|
+
args,
|
|
3396
|
+
input
|
|
3397
|
+
});
|
|
3398
|
+
return {
|
|
3399
|
+
...result,
|
|
3400
|
+
resultType: "executeBatch",
|
|
3401
|
+
__decoder: "@lukso/lsp-smart-contracts",
|
|
3402
|
+
standard: pluginOptions.abiName,
|
|
3403
|
+
children,
|
|
3404
|
+
to,
|
|
3405
|
+
from,
|
|
3406
|
+
value
|
|
3407
|
+
};
|
|
3408
|
+
}
|
|
3409
|
+
case "executeRelayerCallBatch": {
|
|
3410
|
+
const [signatures, nonces, validityTimestamps, values, payloads] = args.map(({ value: value2 }) => value2);
|
|
3411
|
+
const children = [];
|
|
3412
|
+
for (let i = 0; i < values.length; i++) {
|
|
3413
|
+
const _data = payloads[i];
|
|
3414
|
+
const _value = BigInt(values[i]);
|
|
3415
|
+
const _signature = signatures[i];
|
|
3416
|
+
const _nonce = nonces[i];
|
|
3417
|
+
const _validityTimestamp = validityTimestamps[i];
|
|
3418
|
+
const decoded = await decodeTransaction(
|
|
3419
|
+
{
|
|
3420
|
+
input: _data,
|
|
3421
|
+
to,
|
|
3422
|
+
from,
|
|
3423
|
+
value: _value
|
|
3424
|
+
},
|
|
3425
|
+
options
|
|
3426
|
+
);
|
|
3427
|
+
children.push({ ...result, ...decoded });
|
|
3428
|
+
}
|
|
3429
|
+
options.wrappers?.splice(0, 0, {
|
|
3430
|
+
...result,
|
|
3431
|
+
resultType: "wrapper",
|
|
3432
|
+
__decoder: pluginOptions.decoderName,
|
|
3433
|
+
functionName,
|
|
3434
|
+
sig,
|
|
3435
|
+
input,
|
|
3436
|
+
standard: pluginOptions.abiName,
|
|
3437
|
+
args
|
|
3438
|
+
});
|
|
3439
|
+
return {
|
|
3440
|
+
...result,
|
|
3441
|
+
resultType: "executeBatch",
|
|
3442
|
+
__decoder: pluginOptions.decoderName,
|
|
3443
|
+
standard: pluginOptions.abiName,
|
|
3444
|
+
children,
|
|
3445
|
+
to,
|
|
3446
|
+
from,
|
|
3447
|
+
value
|
|
3448
|
+
};
|
|
3449
|
+
}
|
|
3450
|
+
// -> executeRelayCall
|
|
3451
|
+
case "executeRelayCall": {
|
|
3452
|
+
const [_signature, _nonce, _validityTimestamps, _input] = args.map(
|
|
3453
|
+
({ value: value2 }) => value2
|
|
3454
|
+
);
|
|
3455
|
+
const _target = await getKMTarget(options.chain, to);
|
|
3456
|
+
const decoded = await decodeTransaction(
|
|
3457
|
+
{
|
|
3458
|
+
input: _input,
|
|
3459
|
+
to: _target ?? to,
|
|
3460
|
+
from,
|
|
3461
|
+
value
|
|
3462
|
+
},
|
|
3463
|
+
options
|
|
3464
|
+
);
|
|
3465
|
+
from = to || from;
|
|
3466
|
+
to = _target || to;
|
|
3467
|
+
options.wrappers?.splice(0, 0, {
|
|
3468
|
+
...result,
|
|
3469
|
+
resultType: "wrapper",
|
|
3470
|
+
__decoder: pluginOptions.decoderName,
|
|
3471
|
+
functionName,
|
|
3472
|
+
sig,
|
|
3473
|
+
input,
|
|
3474
|
+
standard: pluginOptions.abiName,
|
|
3475
|
+
to,
|
|
3476
|
+
from,
|
|
3477
|
+
value,
|
|
3478
|
+
args
|
|
3479
|
+
});
|
|
3480
|
+
return {
|
|
3481
|
+
...decoded
|
|
3482
|
+
};
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
__name(enhanceKeyManager, "enhanceKeyManager");
|
|
3487
|
+
var enhanceLSP6KeyManager_default = enhanceLSP6KeyManagerPlugin;
|
|
3488
|
+
|
|
3489
|
+
// src/decoder/plugins/enhanceLSP7DigitalAsset.ts
|
|
3490
|
+
import {
|
|
3491
|
+
lsp7BurnableAbi,
|
|
3492
|
+
lsp7CappedSupplyAbi,
|
|
3493
|
+
lsp7DigitalAssetAbi,
|
|
3494
|
+
lsp7MintableAbi,
|
|
3495
|
+
lsp7VotesAbi
|
|
3496
|
+
} from "@lukso/lsp7-contracts/abi";
|
|
3497
|
+
|
|
3498
|
+
// src/decoder/cache.ts
|
|
3499
|
+
function makeCacheKey(type, ...parts) {
|
|
3500
|
+
return `${type}:${parts.join(":")}`;
|
|
3501
|
+
}
|
|
3502
|
+
__name(makeCacheKey, "makeCacheKey");
|
|
3503
|
+
|
|
3504
|
+
// src/decoder/plugins/enhanceLSP7DigitalAsset.ts
|
|
3505
|
+
var LSP7 = [
|
|
3506
|
+
...lsp7DigitalAssetAbi,
|
|
3507
|
+
...lsp7MintableAbi,
|
|
3508
|
+
...lsp7BurnableAbi,
|
|
3509
|
+
...lsp7CappedSupplyAbi,
|
|
3510
|
+
...lsp7VotesAbi
|
|
3511
|
+
];
|
|
3512
|
+
var enhanceLSP7DigitalAssetPlugin = standardPlugin(
|
|
3513
|
+
LSP7,
|
|
3514
|
+
{
|
|
3515
|
+
name: "lsp7",
|
|
3516
|
+
abiName: "LSP7DigitalAsset",
|
|
3517
|
+
decoderName: "@lukso/lsp-smart-contracts"
|
|
3518
|
+
},
|
|
3519
|
+
{
|
|
3520
|
+
enhance: /* @__PURE__ */ __name(async (result, pluginOptions, options) => {
|
|
3521
|
+
const setData = await enhanceSetData(
|
|
3522
|
+
result,
|
|
3523
|
+
{ ...pluginOptions, abiName: "", decoderName: "" },
|
|
3524
|
+
options
|
|
3525
|
+
);
|
|
3526
|
+
if (setData) {
|
|
3527
|
+
return setData;
|
|
3528
|
+
}
|
|
3529
|
+
if (options.async) {
|
|
3530
|
+
await enhanceLSP7Metadata(result, options);
|
|
3531
|
+
}
|
|
3532
|
+
const follow = await enhanceLSP26FollowerSystem(
|
|
3533
|
+
result,
|
|
3534
|
+
pluginOptions,
|
|
3535
|
+
options
|
|
3536
|
+
);
|
|
3537
|
+
if (follow) {
|
|
3538
|
+
return follow;
|
|
3539
|
+
}
|
|
3540
|
+
return result;
|
|
3541
|
+
}, "enhance"),
|
|
3542
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
3543
|
+
return decodeEvent(options.chain, LSP7, log);
|
|
3544
|
+
}, "decodeEvent")
|
|
3545
|
+
}
|
|
3546
|
+
);
|
|
3547
|
+
async function enhanceLSP7Metadata(result, options) {
|
|
3548
|
+
if (!options.cache || !result.to) return;
|
|
3549
|
+
const contractAddress = result.to;
|
|
3550
|
+
const cacheKey = makeCacheKey(
|
|
3551
|
+
"contract-meta" /* CONTRACT_METADATA */,
|
|
3552
|
+
contractAddress,
|
|
3553
|
+
"lsp4-token-type"
|
|
3554
|
+
);
|
|
3555
|
+
try {
|
|
3556
|
+
const metadata = await options.cache.getOrSet(
|
|
3557
|
+
cacheKey,
|
|
3558
|
+
async () => {
|
|
3559
|
+
const client = getPublicClient(options.chain);
|
|
3560
|
+
const tokenTypeData = await client.readContract({
|
|
3561
|
+
address: contractAddress,
|
|
3562
|
+
abi: LSP7,
|
|
3563
|
+
functionName: "getData",
|
|
3564
|
+
args: [
|
|
3565
|
+
"0xe0261fa95db2eb3b5439bd033cda66d56b96f92f243a8228fd87550ed7bdfdb3"
|
|
3566
|
+
]
|
|
3567
|
+
});
|
|
3568
|
+
const typeValue = tokenTypeData ? Number.parseInt(tokenTypeData, 16) : 0;
|
|
3569
|
+
return {
|
|
3570
|
+
tokenType: typeValue,
|
|
3571
|
+
isToken: typeValue === 0,
|
|
3572
|
+
isNFT: typeValue === 1,
|
|
3573
|
+
isCollection: typeValue === 2
|
|
3574
|
+
};
|
|
3575
|
+
},
|
|
3576
|
+
{
|
|
3577
|
+
ttl: 1e3 * 60 * 60 * 24,
|
|
3578
|
+
// Cache for 24 hours (metadata rarely changes)
|
|
3579
|
+
signal: options.signal
|
|
3580
|
+
}
|
|
3581
|
+
);
|
|
3582
|
+
result.custom = result.custom || {};
|
|
3583
|
+
Object.assign(result.custom, metadata);
|
|
3584
|
+
} catch (error) {
|
|
3585
|
+
console.warn("Failed to fetch LSP7 metadata:", error);
|
|
3586
|
+
result.custom = result.custom || {};
|
|
3587
|
+
result.custom.tokenType = 0;
|
|
3588
|
+
result.custom.isToken = true;
|
|
3589
|
+
result.custom.isNFT = false;
|
|
3590
|
+
result.custom.isCollection = false;
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
__name(enhanceLSP7Metadata, "enhanceLSP7Metadata");
|
|
3594
|
+
async function enhanceLSP26FollowerSystem(result, _pluginOptions, _options) {
|
|
3595
|
+
const { functionName, sig, args, input, blockNumber, to, from, value } = result;
|
|
3596
|
+
switch (functionName) {
|
|
3597
|
+
}
|
|
3598
|
+
return void 0;
|
|
3599
|
+
}
|
|
3600
|
+
__name(enhanceLSP26FollowerSystem, "enhanceLSP26FollowerSystem");
|
|
3601
|
+
var enhanceLSP7DigitalAsset_default = enhanceLSP7DigitalAssetPlugin;
|
|
3602
|
+
|
|
3603
|
+
// src/decoder/plugins/enhanceLSP8IdentifiableDigitalAsset.ts
|
|
3604
|
+
import {
|
|
3605
|
+
lsp8BurnableAbi,
|
|
3606
|
+
lsp8CappedSupplyAbi,
|
|
3607
|
+
lsp8EnumerableAbi,
|
|
3608
|
+
lsp8IdentifiableDigitalAssetAbi,
|
|
3609
|
+
lsp8MintableAbi,
|
|
3610
|
+
lsp8VotesAbi
|
|
3611
|
+
} from "@lukso/lsp8-contracts/abi";
|
|
3612
|
+
var LSP8 = [
|
|
3613
|
+
...lsp8IdentifiableDigitalAssetAbi,
|
|
3614
|
+
...lsp8MintableAbi,
|
|
3615
|
+
...lsp8BurnableAbi,
|
|
3616
|
+
...lsp8CappedSupplyAbi,
|
|
3617
|
+
...lsp8EnumerableAbi,
|
|
3618
|
+
...lsp8VotesAbi
|
|
3619
|
+
];
|
|
3620
|
+
var enhanceLSP8IdentifiableDigitalAssetPlugin = standardPlugin(
|
|
3621
|
+
LSP8,
|
|
3622
|
+
{
|
|
3623
|
+
name: "lsp8",
|
|
3624
|
+
abiName: "LSP8IdentifiableDigitalAsset",
|
|
3625
|
+
decoderName: "@lukso/lsp-smart-contracts"
|
|
3626
|
+
},
|
|
3627
|
+
{
|
|
3628
|
+
enhance: /* @__PURE__ */ __name(async (result, pluginOptions, options) => {
|
|
3629
|
+
const setData = await enhanceSetData(result, pluginOptions, options);
|
|
3630
|
+
if (setData) {
|
|
3631
|
+
return setData;
|
|
3632
|
+
}
|
|
3633
|
+
return await enhanceLSP8IdentifiableDigitalAsset(
|
|
3634
|
+
result,
|
|
3635
|
+
pluginOptions,
|
|
3636
|
+
options
|
|
3637
|
+
);
|
|
3638
|
+
}, "enhance"),
|
|
3639
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
3640
|
+
const event = decodeEvent(options.chain, LSP8, log);
|
|
3641
|
+
if (event) {
|
|
3642
|
+
const tokenId = event.args.find(({ name }) => name === "tokenId")?.value;
|
|
3643
|
+
if (tokenId) {
|
|
3644
|
+
event.address = `${event.address}:${tokenId}`;
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3647
|
+
return event;
|
|
3648
|
+
}, "decodeEvent")
|
|
3649
|
+
}
|
|
3650
|
+
);
|
|
3651
|
+
async function enhanceLSP8IdentifiableDigitalAsset(result, pluginOptions, options) {
|
|
3652
|
+
const setData = await enhanceSetData(
|
|
3653
|
+
result,
|
|
3654
|
+
{ ...pluginOptions, abiName: "", decoderName: "" },
|
|
3655
|
+
options
|
|
3656
|
+
);
|
|
3657
|
+
if (setData) {
|
|
3658
|
+
return setData;
|
|
3659
|
+
}
|
|
3660
|
+
const { functionName, sig, args, input, blockNumber, to, from, value } = result;
|
|
3661
|
+
switch (functionName) {
|
|
3662
|
+
case "setDataForTokenId": {
|
|
3663
|
+
const [tokenId, _key, _value] = args.map(({ value: value2 }) => value2);
|
|
3664
|
+
return {
|
|
3665
|
+
blockNumber,
|
|
3666
|
+
...result,
|
|
3667
|
+
__decoder: pluginOptions.decoderName,
|
|
3668
|
+
resultType: "setDataBatch",
|
|
3669
|
+
standard: pluginOptions.abiName,
|
|
3670
|
+
input,
|
|
3671
|
+
children: [
|
|
3672
|
+
{
|
|
3673
|
+
...result,
|
|
3674
|
+
standard: pluginOptions.abiName,
|
|
3675
|
+
tokenId,
|
|
3676
|
+
to: `${to}:${tokenId}`,
|
|
3677
|
+
from,
|
|
3678
|
+
value,
|
|
3679
|
+
info: await decodeKeyValueRaw(_key, _value, options)
|
|
3680
|
+
}
|
|
3681
|
+
]
|
|
3682
|
+
};
|
|
3683
|
+
}
|
|
3684
|
+
case "setDataBatchForTokenIds": {
|
|
3685
|
+
const children = [];
|
|
3686
|
+
const [tokenIds, keys, values] = args.map(({ value: value2 }) => value2);
|
|
3687
|
+
for (let i = 0; i < tokenIds.length; i++) {
|
|
3688
|
+
const tokenId = tokenIds[i];
|
|
3689
|
+
const key = keys[i];
|
|
3690
|
+
const _value = values[i];
|
|
3691
|
+
children.push({
|
|
3692
|
+
...result,
|
|
3693
|
+
resultType: "setData",
|
|
3694
|
+
__decoder: "@lukso/lsp-smart-contracts",
|
|
3695
|
+
standard: key,
|
|
3696
|
+
...createNamedArgs(
|
|
3697
|
+
[tokenId, key, _value],
|
|
3698
|
+
[
|
|
3699
|
+
{ name: "tokenId", type: "bytes32" },
|
|
3700
|
+
{ name: "key", type: "bytes32" },
|
|
3701
|
+
{ name: "value", type: "bytes" }
|
|
3702
|
+
]
|
|
3703
|
+
),
|
|
3704
|
+
tokenId,
|
|
3705
|
+
phase: "enhanced",
|
|
3706
|
+
to: `${to}:${tokenId}`,
|
|
3707
|
+
from,
|
|
3708
|
+
value,
|
|
3709
|
+
info: await decodeKeyValueRaw(key, _value, options)
|
|
3710
|
+
});
|
|
3711
|
+
}
|
|
3712
|
+
return {
|
|
3713
|
+
...result,
|
|
3714
|
+
__decoder: pluginOptions.decoderName,
|
|
3715
|
+
functionName,
|
|
3716
|
+
sig,
|
|
3717
|
+
input,
|
|
3718
|
+
standard: pluginOptions.abiName,
|
|
3719
|
+
resultType: "setDataBatch",
|
|
3720
|
+
...args ? { args } : {},
|
|
3721
|
+
to,
|
|
3722
|
+
from,
|
|
3723
|
+
value,
|
|
3724
|
+
children
|
|
3725
|
+
};
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
return result;
|
|
3729
|
+
}
|
|
3730
|
+
__name(enhanceLSP8IdentifiableDigitalAsset, "enhanceLSP8IdentifiableDigitalAsset");
|
|
3731
|
+
var enhanceLSP8IdentifiableDigitalAsset_default = enhanceLSP8IdentifiableDigitalAssetPlugin;
|
|
3732
|
+
|
|
3733
|
+
// src/decoder/plugins/enhanceLSP9Vault.ts
|
|
3734
|
+
import { lsp9VaultAbi as LSP9 } from "@lukso/lsp9-contracts/abi";
|
|
3735
|
+
var enhanceLSP9VaultPlugin = standardPlugin(
|
|
3736
|
+
LSP9,
|
|
3737
|
+
{
|
|
3738
|
+
name: "lsp9",
|
|
3739
|
+
abiName: "LSP9Vault",
|
|
3740
|
+
decoderName: "@lukso/lsp-smart-contracts"
|
|
3741
|
+
},
|
|
3742
|
+
{
|
|
3743
|
+
enhance: /* @__PURE__ */ __name(async (result, pluginOptions, options) => {
|
|
3744
|
+
const setData = await enhanceSetData(result, pluginOptions, options);
|
|
3745
|
+
if (setData) {
|
|
3746
|
+
return setData;
|
|
3747
|
+
}
|
|
3748
|
+
return await enhanceLSP9Vault(result, pluginOptions, options);
|
|
3749
|
+
}, "enhance"),
|
|
3750
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
3751
|
+
return decodeEvent(options.chain, LSP9, log);
|
|
3752
|
+
}, "decodeEvent")
|
|
3753
|
+
}
|
|
3754
|
+
);
|
|
3755
|
+
async function enhanceLSP9Vault(result, pluginOptions, options) {
|
|
3756
|
+
const { functionName, sig, args, input, blockNumber, to, from, value } = result;
|
|
3757
|
+
switch (functionName) {
|
|
3758
|
+
}
|
|
3759
|
+
return void 0;
|
|
3760
|
+
}
|
|
3761
|
+
__name(enhanceLSP9Vault, "enhanceLSP9Vault");
|
|
3762
|
+
var enhanceLSP9Vault_default = enhanceLSP9VaultPlugin;
|
|
3763
|
+
|
|
3764
|
+
// src/decoder/plugins/enhanceLSP26FollowerSystem.ts
|
|
3765
|
+
import { lsp26FollowerSystemAbi as LSP26 } from "@lukso/lsp26-contracts/abi";
|
|
3766
|
+
var enhanceLSP26FollowerSystemPlugin = standardPlugin(
|
|
3767
|
+
LSP26,
|
|
3768
|
+
{
|
|
3769
|
+
name: "lsp26",
|
|
3770
|
+
abiName: "LSP26FollowerSystem",
|
|
3771
|
+
decoderName: "@lukso/lsp-smart-contracts"
|
|
3772
|
+
},
|
|
3773
|
+
{
|
|
3774
|
+
enhance: /* @__PURE__ */ __name(async (result, pluginOptions, options) => {
|
|
3775
|
+
const setData = await enhanceSetData(result, pluginOptions, options);
|
|
3776
|
+
if (setData) {
|
|
3777
|
+
return setData;
|
|
3778
|
+
}
|
|
3779
|
+
return await enhanceLSP26FollowerSystem2(result, pluginOptions, options);
|
|
3780
|
+
}, "enhance"),
|
|
3781
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
3782
|
+
return decodeEvent(options.chain, LSP26, log);
|
|
3783
|
+
}, "decodeEvent")
|
|
3784
|
+
}
|
|
3785
|
+
);
|
|
3786
|
+
async function enhanceLSP26FollowerSystem2(result, _pluginOptions, _options) {
|
|
3787
|
+
const { functionName, sig, args, input, blockNumber, to, from, value } = result;
|
|
3788
|
+
const { args: _args, ...partialResult } = result;
|
|
3789
|
+
switch (functionName) {
|
|
3790
|
+
case "follow":
|
|
3791
|
+
case "unfollow":
|
|
3792
|
+
return {
|
|
3793
|
+
...result,
|
|
3794
|
+
children: [
|
|
3795
|
+
{
|
|
3796
|
+
...partialResult,
|
|
3797
|
+
resultType: "followProfile",
|
|
3798
|
+
phase: "enhanced",
|
|
3799
|
+
address: args[0]?.value
|
|
3800
|
+
}
|
|
3801
|
+
]
|
|
3802
|
+
};
|
|
3803
|
+
break;
|
|
3804
|
+
case "followBatch":
|
|
3805
|
+
case "unfollowBatch":
|
|
3806
|
+
return {
|
|
3807
|
+
...result,
|
|
3808
|
+
children: (result.resultType === "execute" ? result.args?.[0]?.value || [] : []).map((address) => ({
|
|
3809
|
+
...partialResult,
|
|
3810
|
+
phase: "enhanced",
|
|
3811
|
+
resultType: "followProfile",
|
|
3812
|
+
address
|
|
3813
|
+
}))
|
|
3814
|
+
};
|
|
3815
|
+
break;
|
|
3816
|
+
}
|
|
3817
|
+
return void 0;
|
|
3818
|
+
}
|
|
3819
|
+
__name(enhanceLSP26FollowerSystem2, "enhanceLSP26FollowerSystem");
|
|
3820
|
+
var enhanceLSP26FollowerSystem_default = enhanceLSP26FollowerSystemPlugin;
|
|
3821
|
+
|
|
3822
|
+
// ../../node_modules/.pnpm/@lukso+lsp-smart-contracts@0.16.7/node_modules/@lukso/lsp-smart-contracts/artifacts/LSP9Vault.json
|
|
3823
|
+
var abi2 = [
|
|
3824
|
+
{
|
|
3825
|
+
inputs: [
|
|
3826
|
+
{
|
|
3827
|
+
internalType: "address",
|
|
3828
|
+
name: "newOwner",
|
|
3829
|
+
type: "address"
|
|
3830
|
+
}
|
|
3831
|
+
],
|
|
3832
|
+
stateMutability: "payable",
|
|
3833
|
+
type: "constructor"
|
|
3834
|
+
},
|
|
3835
|
+
{
|
|
3836
|
+
inputs: [],
|
|
3837
|
+
name: "ERC725X_ContractDeploymentFailed",
|
|
3838
|
+
type: "error"
|
|
3839
|
+
},
|
|
3840
|
+
{
|
|
3841
|
+
inputs: [],
|
|
3842
|
+
name: "ERC725X_CreateOperationsRequireEmptyRecipientAddress",
|
|
3843
|
+
type: "error"
|
|
3844
|
+
},
|
|
3845
|
+
{
|
|
3846
|
+
inputs: [],
|
|
3847
|
+
name: "ERC725X_ExecuteParametersEmptyArray",
|
|
3848
|
+
type: "error"
|
|
3849
|
+
},
|
|
3850
|
+
{
|
|
3851
|
+
inputs: [],
|
|
3852
|
+
name: "ERC725X_ExecuteParametersLengthMismatch",
|
|
3853
|
+
type: "error"
|
|
3854
|
+
},
|
|
3855
|
+
{
|
|
3856
|
+
inputs: [
|
|
3857
|
+
{
|
|
3858
|
+
internalType: "uint256",
|
|
3859
|
+
name: "balance",
|
|
3860
|
+
type: "uint256"
|
|
3861
|
+
},
|
|
3862
|
+
{
|
|
3863
|
+
internalType: "uint256",
|
|
3864
|
+
name: "value",
|
|
3865
|
+
type: "uint256"
|
|
3866
|
+
}
|
|
3867
|
+
],
|
|
3868
|
+
name: "ERC725X_InsufficientBalance",
|
|
3869
|
+
type: "error"
|
|
3870
|
+
},
|
|
3871
|
+
{
|
|
3872
|
+
inputs: [],
|
|
3873
|
+
name: "ERC725X_MsgValueDisallowedInStaticCall",
|
|
3874
|
+
type: "error"
|
|
3875
|
+
},
|
|
3876
|
+
{
|
|
3877
|
+
inputs: [],
|
|
3878
|
+
name: "ERC725X_NoContractBytecodeProvided",
|
|
3879
|
+
type: "error"
|
|
3880
|
+
},
|
|
3881
|
+
{
|
|
3882
|
+
inputs: [
|
|
3883
|
+
{
|
|
3884
|
+
internalType: "uint256",
|
|
3885
|
+
name: "operationTypeProvided",
|
|
3886
|
+
type: "uint256"
|
|
3887
|
+
}
|
|
3888
|
+
],
|
|
3889
|
+
name: "ERC725X_UnknownOperationType",
|
|
3890
|
+
type: "error"
|
|
3891
|
+
},
|
|
3892
|
+
{
|
|
3893
|
+
inputs: [],
|
|
3894
|
+
name: "ERC725Y_DataKeysValuesLengthMismatch",
|
|
3895
|
+
type: "error"
|
|
3896
|
+
},
|
|
3897
|
+
{
|
|
3898
|
+
inputs: [],
|
|
3899
|
+
name: "ERC725Y_MsgValueDisallowed",
|
|
3900
|
+
type: "error"
|
|
3901
|
+
},
|
|
3902
|
+
{
|
|
3903
|
+
inputs: [
|
|
3904
|
+
{
|
|
3905
|
+
internalType: "address",
|
|
3906
|
+
name: "caller",
|
|
3907
|
+
type: "address"
|
|
3908
|
+
}
|
|
3909
|
+
],
|
|
3910
|
+
name: "LSP14CallerNotPendingOwner",
|
|
3911
|
+
type: "error"
|
|
3912
|
+
},
|
|
3913
|
+
{
|
|
3914
|
+
inputs: [],
|
|
3915
|
+
name: "LSP14CannotTransferOwnershipToSelf",
|
|
3916
|
+
type: "error"
|
|
3917
|
+
},
|
|
3918
|
+
{
|
|
3919
|
+
inputs: [],
|
|
3920
|
+
name: "LSP14MustAcceptOwnershipInSeparateTransaction",
|
|
3921
|
+
type: "error"
|
|
3922
|
+
},
|
|
3923
|
+
{
|
|
3924
|
+
inputs: [
|
|
3925
|
+
{
|
|
3926
|
+
internalType: "uint256",
|
|
3927
|
+
name: "renounceOwnershipStart",
|
|
3928
|
+
type: "uint256"
|
|
3929
|
+
},
|
|
3930
|
+
{
|
|
3931
|
+
internalType: "uint256",
|
|
3932
|
+
name: "renounceOwnershipEnd",
|
|
3933
|
+
type: "uint256"
|
|
3934
|
+
}
|
|
3935
|
+
],
|
|
3936
|
+
name: "LSP14NotInRenounceOwnershipInterval",
|
|
3937
|
+
type: "error"
|
|
3938
|
+
},
|
|
3939
|
+
{
|
|
3940
|
+
inputs: [
|
|
3941
|
+
{
|
|
3942
|
+
internalType: "bytes32",
|
|
3943
|
+
name: "dataKey",
|
|
3944
|
+
type: "bytes32"
|
|
3945
|
+
}
|
|
3946
|
+
],
|
|
3947
|
+
name: "LSP1DelegateNotAllowedToSetDataKey",
|
|
3948
|
+
type: "error"
|
|
3949
|
+
},
|
|
3950
|
+
{
|
|
3951
|
+
inputs: [
|
|
3952
|
+
{
|
|
3953
|
+
internalType: "bytes4",
|
|
3954
|
+
name: "functionSelector",
|
|
3955
|
+
type: "bytes4"
|
|
3956
|
+
}
|
|
3957
|
+
],
|
|
3958
|
+
name: "NoExtensionFoundForFunctionSelector",
|
|
3959
|
+
type: "error"
|
|
3960
|
+
},
|
|
3961
|
+
{
|
|
3962
|
+
inputs: [
|
|
3963
|
+
{
|
|
3964
|
+
internalType: "address",
|
|
3965
|
+
name: "callerAddress",
|
|
3966
|
+
type: "address"
|
|
3967
|
+
}
|
|
3968
|
+
],
|
|
3969
|
+
name: "OwnableCallerNotTheOwner",
|
|
3970
|
+
type: "error"
|
|
3971
|
+
},
|
|
3972
|
+
{
|
|
3973
|
+
anonymous: false,
|
|
3974
|
+
inputs: [
|
|
3975
|
+
{
|
|
3976
|
+
indexed: true,
|
|
3977
|
+
internalType: "uint256",
|
|
3978
|
+
name: "operationType",
|
|
3979
|
+
type: "uint256"
|
|
3980
|
+
},
|
|
3981
|
+
{
|
|
3982
|
+
indexed: true,
|
|
3983
|
+
internalType: "address",
|
|
3984
|
+
name: "contractAddress",
|
|
3985
|
+
type: "address"
|
|
3986
|
+
},
|
|
3987
|
+
{
|
|
3988
|
+
indexed: false,
|
|
3989
|
+
internalType: "uint256",
|
|
3990
|
+
name: "value",
|
|
3991
|
+
type: "uint256"
|
|
3992
|
+
},
|
|
3993
|
+
{
|
|
3994
|
+
indexed: true,
|
|
3995
|
+
internalType: "bytes32",
|
|
3996
|
+
name: "salt",
|
|
3997
|
+
type: "bytes32"
|
|
3998
|
+
}
|
|
3999
|
+
],
|
|
4000
|
+
name: "ContractCreated",
|
|
4001
|
+
type: "event"
|
|
4002
|
+
},
|
|
4003
|
+
{
|
|
4004
|
+
anonymous: false,
|
|
4005
|
+
inputs: [
|
|
4006
|
+
{
|
|
4007
|
+
indexed: true,
|
|
4008
|
+
internalType: "bytes32",
|
|
4009
|
+
name: "dataKey",
|
|
4010
|
+
type: "bytes32"
|
|
4011
|
+
},
|
|
4012
|
+
{
|
|
4013
|
+
indexed: false,
|
|
4014
|
+
internalType: "bytes",
|
|
4015
|
+
name: "dataValue",
|
|
4016
|
+
type: "bytes"
|
|
4017
|
+
}
|
|
4018
|
+
],
|
|
4019
|
+
name: "DataChanged",
|
|
4020
|
+
type: "event"
|
|
4021
|
+
},
|
|
4022
|
+
{
|
|
4023
|
+
anonymous: false,
|
|
4024
|
+
inputs: [
|
|
4025
|
+
{
|
|
4026
|
+
indexed: true,
|
|
4027
|
+
internalType: "uint256",
|
|
4028
|
+
name: "operationType",
|
|
4029
|
+
type: "uint256"
|
|
4030
|
+
},
|
|
4031
|
+
{
|
|
4032
|
+
indexed: true,
|
|
4033
|
+
internalType: "address",
|
|
4034
|
+
name: "target",
|
|
4035
|
+
type: "address"
|
|
4036
|
+
},
|
|
4037
|
+
{
|
|
4038
|
+
indexed: false,
|
|
4039
|
+
internalType: "uint256",
|
|
4040
|
+
name: "value",
|
|
4041
|
+
type: "uint256"
|
|
4042
|
+
},
|
|
4043
|
+
{
|
|
4044
|
+
indexed: true,
|
|
4045
|
+
internalType: "bytes4",
|
|
4046
|
+
name: "selector",
|
|
4047
|
+
type: "bytes4"
|
|
4048
|
+
}
|
|
4049
|
+
],
|
|
4050
|
+
name: "Executed",
|
|
4051
|
+
type: "event"
|
|
4052
|
+
},
|
|
4053
|
+
{
|
|
4054
|
+
anonymous: false,
|
|
4055
|
+
inputs: [],
|
|
4056
|
+
name: "OwnershipRenounced",
|
|
4057
|
+
type: "event"
|
|
4058
|
+
},
|
|
4059
|
+
{
|
|
4060
|
+
anonymous: false,
|
|
4061
|
+
inputs: [
|
|
4062
|
+
{
|
|
4063
|
+
indexed: true,
|
|
4064
|
+
internalType: "address",
|
|
4065
|
+
name: "previousOwner",
|
|
4066
|
+
type: "address"
|
|
4067
|
+
},
|
|
4068
|
+
{
|
|
4069
|
+
indexed: true,
|
|
4070
|
+
internalType: "address",
|
|
4071
|
+
name: "newOwner",
|
|
4072
|
+
type: "address"
|
|
4073
|
+
}
|
|
4074
|
+
],
|
|
4075
|
+
name: "OwnershipTransferStarted",
|
|
4076
|
+
type: "event"
|
|
4077
|
+
},
|
|
4078
|
+
{
|
|
4079
|
+
anonymous: false,
|
|
4080
|
+
inputs: [
|
|
4081
|
+
{
|
|
4082
|
+
indexed: true,
|
|
4083
|
+
internalType: "address",
|
|
4084
|
+
name: "previousOwner",
|
|
4085
|
+
type: "address"
|
|
4086
|
+
},
|
|
4087
|
+
{
|
|
4088
|
+
indexed: true,
|
|
4089
|
+
internalType: "address",
|
|
4090
|
+
name: "newOwner",
|
|
4091
|
+
type: "address"
|
|
4092
|
+
}
|
|
4093
|
+
],
|
|
4094
|
+
name: "OwnershipTransferred",
|
|
4095
|
+
type: "event"
|
|
4096
|
+
},
|
|
4097
|
+
{
|
|
4098
|
+
anonymous: false,
|
|
4099
|
+
inputs: [],
|
|
4100
|
+
name: "RenounceOwnershipStarted",
|
|
4101
|
+
type: "event"
|
|
4102
|
+
},
|
|
4103
|
+
{
|
|
4104
|
+
anonymous: false,
|
|
4105
|
+
inputs: [
|
|
4106
|
+
{
|
|
4107
|
+
indexed: true,
|
|
4108
|
+
internalType: "address",
|
|
4109
|
+
name: "from",
|
|
4110
|
+
type: "address"
|
|
4111
|
+
},
|
|
4112
|
+
{
|
|
4113
|
+
indexed: true,
|
|
4114
|
+
internalType: "uint256",
|
|
4115
|
+
name: "value",
|
|
4116
|
+
type: "uint256"
|
|
4117
|
+
},
|
|
4118
|
+
{
|
|
4119
|
+
indexed: true,
|
|
4120
|
+
internalType: "bytes32",
|
|
4121
|
+
name: "typeId",
|
|
4122
|
+
type: "bytes32"
|
|
4123
|
+
},
|
|
4124
|
+
{
|
|
4125
|
+
indexed: false,
|
|
4126
|
+
internalType: "bytes",
|
|
4127
|
+
name: "receivedData",
|
|
4128
|
+
type: "bytes"
|
|
4129
|
+
},
|
|
4130
|
+
{
|
|
4131
|
+
indexed: false,
|
|
4132
|
+
internalType: "bytes",
|
|
4133
|
+
name: "returnedValue",
|
|
4134
|
+
type: "bytes"
|
|
4135
|
+
}
|
|
4136
|
+
],
|
|
4137
|
+
name: "UniversalReceiver",
|
|
4138
|
+
type: "event"
|
|
4139
|
+
},
|
|
4140
|
+
{
|
|
4141
|
+
stateMutability: "payable",
|
|
4142
|
+
type: "fallback"
|
|
4143
|
+
},
|
|
4144
|
+
{
|
|
4145
|
+
inputs: [],
|
|
4146
|
+
name: "RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY",
|
|
4147
|
+
outputs: [
|
|
4148
|
+
{
|
|
4149
|
+
internalType: "uint256",
|
|
4150
|
+
name: "",
|
|
4151
|
+
type: "uint256"
|
|
4152
|
+
}
|
|
4153
|
+
],
|
|
4154
|
+
stateMutability: "view",
|
|
4155
|
+
type: "function"
|
|
4156
|
+
},
|
|
4157
|
+
{
|
|
4158
|
+
inputs: [],
|
|
4159
|
+
name: "RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD",
|
|
4160
|
+
outputs: [
|
|
4161
|
+
{
|
|
4162
|
+
internalType: "uint256",
|
|
4163
|
+
name: "",
|
|
4164
|
+
type: "uint256"
|
|
4165
|
+
}
|
|
4166
|
+
],
|
|
4167
|
+
stateMutability: "view",
|
|
4168
|
+
type: "function"
|
|
4169
|
+
},
|
|
4170
|
+
{
|
|
4171
|
+
inputs: [],
|
|
4172
|
+
name: "VERSION",
|
|
4173
|
+
outputs: [
|
|
4174
|
+
{
|
|
4175
|
+
internalType: "string",
|
|
4176
|
+
name: "",
|
|
4177
|
+
type: "string"
|
|
4178
|
+
}
|
|
4179
|
+
],
|
|
4180
|
+
stateMutability: "view",
|
|
4181
|
+
type: "function"
|
|
4182
|
+
},
|
|
4183
|
+
{
|
|
4184
|
+
inputs: [],
|
|
4185
|
+
name: "acceptOwnership",
|
|
4186
|
+
outputs: [],
|
|
4187
|
+
stateMutability: "nonpayable",
|
|
4188
|
+
type: "function"
|
|
4189
|
+
},
|
|
4190
|
+
{
|
|
4191
|
+
inputs: [
|
|
4192
|
+
{
|
|
4193
|
+
internalType: "bytes[]",
|
|
4194
|
+
name: "data",
|
|
4195
|
+
type: "bytes[]"
|
|
4196
|
+
}
|
|
4197
|
+
],
|
|
4198
|
+
name: "batchCalls",
|
|
4199
|
+
outputs: [
|
|
4200
|
+
{
|
|
4201
|
+
internalType: "bytes[]",
|
|
4202
|
+
name: "results",
|
|
4203
|
+
type: "bytes[]"
|
|
4204
|
+
}
|
|
4205
|
+
],
|
|
4206
|
+
stateMutability: "nonpayable",
|
|
4207
|
+
type: "function"
|
|
4208
|
+
},
|
|
4209
|
+
{
|
|
4210
|
+
inputs: [
|
|
4211
|
+
{
|
|
4212
|
+
internalType: "uint256",
|
|
4213
|
+
name: "operationType",
|
|
4214
|
+
type: "uint256"
|
|
4215
|
+
},
|
|
4216
|
+
{
|
|
4217
|
+
internalType: "address",
|
|
4218
|
+
name: "target",
|
|
4219
|
+
type: "address"
|
|
4220
|
+
},
|
|
4221
|
+
{
|
|
4222
|
+
internalType: "uint256",
|
|
4223
|
+
name: "value",
|
|
4224
|
+
type: "uint256"
|
|
4225
|
+
},
|
|
4226
|
+
{
|
|
4227
|
+
internalType: "bytes",
|
|
4228
|
+
name: "data",
|
|
4229
|
+
type: "bytes"
|
|
4230
|
+
}
|
|
4231
|
+
],
|
|
4232
|
+
name: "execute",
|
|
4233
|
+
outputs: [
|
|
4234
|
+
{
|
|
4235
|
+
internalType: "bytes",
|
|
4236
|
+
name: "",
|
|
4237
|
+
type: "bytes"
|
|
4238
|
+
}
|
|
4239
|
+
],
|
|
4240
|
+
stateMutability: "payable",
|
|
4241
|
+
type: "function"
|
|
4242
|
+
},
|
|
4243
|
+
{
|
|
4244
|
+
inputs: [
|
|
4245
|
+
{
|
|
4246
|
+
internalType: "uint256[]",
|
|
4247
|
+
name: "operationsType",
|
|
4248
|
+
type: "uint256[]"
|
|
4249
|
+
},
|
|
4250
|
+
{
|
|
4251
|
+
internalType: "address[]",
|
|
4252
|
+
name: "targets",
|
|
4253
|
+
type: "address[]"
|
|
4254
|
+
},
|
|
4255
|
+
{
|
|
4256
|
+
internalType: "uint256[]",
|
|
4257
|
+
name: "values",
|
|
4258
|
+
type: "uint256[]"
|
|
4259
|
+
},
|
|
4260
|
+
{
|
|
4261
|
+
internalType: "bytes[]",
|
|
4262
|
+
name: "datas",
|
|
4263
|
+
type: "bytes[]"
|
|
4264
|
+
}
|
|
4265
|
+
],
|
|
4266
|
+
name: "executeBatch",
|
|
4267
|
+
outputs: [
|
|
4268
|
+
{
|
|
4269
|
+
internalType: "bytes[]",
|
|
4270
|
+
name: "",
|
|
4271
|
+
type: "bytes[]"
|
|
4272
|
+
}
|
|
4273
|
+
],
|
|
4274
|
+
stateMutability: "payable",
|
|
4275
|
+
type: "function"
|
|
4276
|
+
},
|
|
4277
|
+
{
|
|
4278
|
+
inputs: [
|
|
4279
|
+
{
|
|
4280
|
+
internalType: "bytes32",
|
|
4281
|
+
name: "dataKey",
|
|
4282
|
+
type: "bytes32"
|
|
4283
|
+
}
|
|
4284
|
+
],
|
|
4285
|
+
name: "getData",
|
|
4286
|
+
outputs: [
|
|
4287
|
+
{
|
|
4288
|
+
internalType: "bytes",
|
|
4289
|
+
name: "dataValue",
|
|
4290
|
+
type: "bytes"
|
|
4291
|
+
}
|
|
4292
|
+
],
|
|
4293
|
+
stateMutability: "view",
|
|
4294
|
+
type: "function"
|
|
4295
|
+
},
|
|
4296
|
+
{
|
|
4297
|
+
inputs: [
|
|
4298
|
+
{
|
|
4299
|
+
internalType: "bytes32[]",
|
|
4300
|
+
name: "dataKeys",
|
|
4301
|
+
type: "bytes32[]"
|
|
4302
|
+
}
|
|
4303
|
+
],
|
|
4304
|
+
name: "getDataBatch",
|
|
4305
|
+
outputs: [
|
|
4306
|
+
{
|
|
4307
|
+
internalType: "bytes[]",
|
|
4308
|
+
name: "dataValues",
|
|
4309
|
+
type: "bytes[]"
|
|
4310
|
+
}
|
|
4311
|
+
],
|
|
4312
|
+
stateMutability: "view",
|
|
4313
|
+
type: "function"
|
|
4314
|
+
},
|
|
4315
|
+
{
|
|
4316
|
+
inputs: [],
|
|
4317
|
+
name: "owner",
|
|
4318
|
+
outputs: [
|
|
4319
|
+
{
|
|
4320
|
+
internalType: "address",
|
|
4321
|
+
name: "",
|
|
4322
|
+
type: "address"
|
|
4323
|
+
}
|
|
4324
|
+
],
|
|
4325
|
+
stateMutability: "view",
|
|
4326
|
+
type: "function"
|
|
4327
|
+
},
|
|
4328
|
+
{
|
|
4329
|
+
inputs: [],
|
|
4330
|
+
name: "pendingOwner",
|
|
4331
|
+
outputs: [
|
|
4332
|
+
{
|
|
4333
|
+
internalType: "address",
|
|
4334
|
+
name: "",
|
|
4335
|
+
type: "address"
|
|
4336
|
+
}
|
|
4337
|
+
],
|
|
4338
|
+
stateMutability: "view",
|
|
4339
|
+
type: "function"
|
|
4340
|
+
},
|
|
4341
|
+
{
|
|
4342
|
+
inputs: [],
|
|
4343
|
+
name: "renounceOwnership",
|
|
4344
|
+
outputs: [],
|
|
4345
|
+
stateMutability: "nonpayable",
|
|
4346
|
+
type: "function"
|
|
4347
|
+
},
|
|
4348
|
+
{
|
|
4349
|
+
inputs: [
|
|
4350
|
+
{
|
|
4351
|
+
internalType: "bytes32",
|
|
4352
|
+
name: "dataKey",
|
|
4353
|
+
type: "bytes32"
|
|
4354
|
+
},
|
|
4355
|
+
{
|
|
4356
|
+
internalType: "bytes",
|
|
4357
|
+
name: "dataValue",
|
|
4358
|
+
type: "bytes"
|
|
4359
|
+
}
|
|
4360
|
+
],
|
|
4361
|
+
name: "setData",
|
|
4362
|
+
outputs: [],
|
|
4363
|
+
stateMutability: "payable",
|
|
4364
|
+
type: "function"
|
|
4365
|
+
},
|
|
4366
|
+
{
|
|
4367
|
+
inputs: [
|
|
4368
|
+
{
|
|
4369
|
+
internalType: "bytes32[]",
|
|
4370
|
+
name: "dataKeys",
|
|
4371
|
+
type: "bytes32[]"
|
|
4372
|
+
},
|
|
4373
|
+
{
|
|
4374
|
+
internalType: "bytes[]",
|
|
4375
|
+
name: "dataValues",
|
|
4376
|
+
type: "bytes[]"
|
|
4377
|
+
}
|
|
4378
|
+
],
|
|
4379
|
+
name: "setDataBatch",
|
|
4380
|
+
outputs: [],
|
|
4381
|
+
stateMutability: "payable",
|
|
4382
|
+
type: "function"
|
|
4383
|
+
},
|
|
4384
|
+
{
|
|
4385
|
+
inputs: [
|
|
4386
|
+
{
|
|
4387
|
+
internalType: "bytes4",
|
|
4388
|
+
name: "interfaceId",
|
|
4389
|
+
type: "bytes4"
|
|
4390
|
+
}
|
|
4391
|
+
],
|
|
4392
|
+
name: "supportsInterface",
|
|
4393
|
+
outputs: [
|
|
4394
|
+
{
|
|
4395
|
+
internalType: "bool",
|
|
4396
|
+
name: "",
|
|
4397
|
+
type: "bool"
|
|
4398
|
+
}
|
|
4399
|
+
],
|
|
4400
|
+
stateMutability: "view",
|
|
4401
|
+
type: "function"
|
|
4402
|
+
},
|
|
4403
|
+
{
|
|
4404
|
+
inputs: [
|
|
4405
|
+
{
|
|
4406
|
+
internalType: "address",
|
|
4407
|
+
name: "newOwner",
|
|
4408
|
+
type: "address"
|
|
4409
|
+
}
|
|
4410
|
+
],
|
|
4411
|
+
name: "transferOwnership",
|
|
4412
|
+
outputs: [],
|
|
4413
|
+
stateMutability: "nonpayable",
|
|
4414
|
+
type: "function"
|
|
4415
|
+
},
|
|
4416
|
+
{
|
|
4417
|
+
inputs: [
|
|
4418
|
+
{
|
|
4419
|
+
internalType: "bytes32",
|
|
4420
|
+
name: "typeId",
|
|
4421
|
+
type: "bytes32"
|
|
4422
|
+
},
|
|
4423
|
+
{
|
|
4424
|
+
internalType: "bytes",
|
|
4425
|
+
name: "receivedData",
|
|
4426
|
+
type: "bytes"
|
|
4427
|
+
}
|
|
4428
|
+
],
|
|
4429
|
+
name: "universalReceiver",
|
|
4430
|
+
outputs: [
|
|
4431
|
+
{
|
|
4432
|
+
internalType: "bytes",
|
|
4433
|
+
name: "returnedValues",
|
|
4434
|
+
type: "bytes"
|
|
4435
|
+
}
|
|
4436
|
+
],
|
|
4437
|
+
stateMutability: "payable",
|
|
4438
|
+
type: "function"
|
|
4439
|
+
},
|
|
4440
|
+
{
|
|
4441
|
+
stateMutability: "payable",
|
|
4442
|
+
type: "receive"
|
|
4443
|
+
}
|
|
4444
|
+
];
|
|
4445
|
+
|
|
4446
|
+
// src/decoder/functionSignature.ts
|
|
4447
|
+
import {
|
|
4448
|
+
decodeAbiParameters as decodeAbiParameters3,
|
|
4449
|
+
encodeAbiParameters,
|
|
4450
|
+
getAddress,
|
|
4451
|
+
isAddress as isAddress2,
|
|
4452
|
+
isAddressEqual as isAddressEqual2,
|
|
4453
|
+
parseAbiParameters,
|
|
4454
|
+
zeroAddress as zeroAddress2
|
|
4455
|
+
} from "viem";
|
|
4456
|
+
|
|
4457
|
+
// src/decoder/lruCache.ts
|
|
4458
|
+
import { LRUCache as LRUCache2 } from "lru-cache";
|
|
4459
|
+
var LRUDecoderCache = class {
|
|
4460
|
+
static {
|
|
4461
|
+
__name(this, "LRUDecoderCache");
|
|
4462
|
+
}
|
|
4463
|
+
cache;
|
|
4464
|
+
promises;
|
|
4465
|
+
defaultTTL;
|
|
4466
|
+
defaultErrorTTL;
|
|
4467
|
+
defaultStaleWhileRevalidate;
|
|
4468
|
+
constructor(options = {}) {
|
|
4469
|
+
this.defaultTTL = options.ttl ?? 5 * 60 * 1e3;
|
|
4470
|
+
this.defaultErrorTTL = options.errorTTL ?? 30 * 1e3;
|
|
4471
|
+
this.defaultStaleWhileRevalidate = options.staleWhileRevalidate;
|
|
4472
|
+
this.cache = new LRUCache2({
|
|
4473
|
+
max: options.max ?? 1e3
|
|
4474
|
+
});
|
|
4475
|
+
this.promises = /* @__PURE__ */ new Map();
|
|
4476
|
+
}
|
|
4477
|
+
async get(key) {
|
|
4478
|
+
const entry = this.cache.get(key);
|
|
4479
|
+
if (!entry) {
|
|
4480
|
+
return void 0;
|
|
4481
|
+
}
|
|
4482
|
+
if (entry.expires && Date.now() > entry.expires) {
|
|
4483
|
+
this.cache.delete(key);
|
|
4484
|
+
return void 0;
|
|
4485
|
+
}
|
|
4486
|
+
return entry;
|
|
4487
|
+
}
|
|
4488
|
+
async set(key, value, options) {
|
|
4489
|
+
const now = Date.now();
|
|
4490
|
+
const ttl = options?.ttl ?? (options?.errorTTL ? options.errorTTL : this.defaultTTL);
|
|
4491
|
+
const isError = options?.errorTTL !== void 0;
|
|
4492
|
+
const entry = {
|
|
4493
|
+
value,
|
|
4494
|
+
expires: now + ttl,
|
|
4495
|
+
isError
|
|
4496
|
+
};
|
|
4497
|
+
const staleWhileRevalidate = options?.staleWhileRevalidate ?? this.defaultStaleWhileRevalidate;
|
|
4498
|
+
if (staleWhileRevalidate) {
|
|
4499
|
+
entry.stale = now + ttl + staleWhileRevalidate;
|
|
4500
|
+
}
|
|
4501
|
+
this.cache.set(key, entry);
|
|
4502
|
+
}
|
|
4503
|
+
async delete(key) {
|
|
4504
|
+
this.cache.delete(key);
|
|
4505
|
+
}
|
|
4506
|
+
async getMany(keys) {
|
|
4507
|
+
const result = /* @__PURE__ */ new Map();
|
|
4508
|
+
for (const key of keys) {
|
|
4509
|
+
const entry = await this.get(key);
|
|
4510
|
+
if (entry) {
|
|
4511
|
+
result.set(key, entry);
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
return result;
|
|
4515
|
+
}
|
|
4516
|
+
async setMany(entries) {
|
|
4517
|
+
for (const { key, value, options } of entries) {
|
|
4518
|
+
await this.set(key, value, options);
|
|
4519
|
+
}
|
|
4520
|
+
}
|
|
4521
|
+
async clear() {
|
|
4522
|
+
this.cache.clear();
|
|
4523
|
+
this.promises.clear();
|
|
4524
|
+
}
|
|
4525
|
+
async getOrSet(key, factory, options) {
|
|
4526
|
+
const cached = await this.get(key);
|
|
4527
|
+
const now = Date.now();
|
|
4528
|
+
if (cached && (!cached.expires || now < cached.expires)) {
|
|
4529
|
+
return cached.value;
|
|
4530
|
+
}
|
|
4531
|
+
if (cached && cached.stale && now < cached.stale && !this.promises.has(key)) {
|
|
4532
|
+
const backgroundPromise = factory(options?.signal).then(async (fresh) => {
|
|
4533
|
+
await this.set(key, fresh, options);
|
|
4534
|
+
return fresh;
|
|
4535
|
+
}).catch(() => {
|
|
4536
|
+
return cached.value;
|
|
4537
|
+
}).finally(() => {
|
|
4538
|
+
this.promises.delete(key);
|
|
4539
|
+
});
|
|
4540
|
+
this.promises.set(key, backgroundPromise);
|
|
4541
|
+
return cached.value;
|
|
4542
|
+
}
|
|
4543
|
+
const existingPromise = this.promises.get(key);
|
|
4544
|
+
if (existingPromise) {
|
|
4545
|
+
return existingPromise;
|
|
4546
|
+
}
|
|
4547
|
+
const promise = factory(options?.signal).then(async (value) => {
|
|
4548
|
+
await this.set(key, value, options);
|
|
4549
|
+
return value;
|
|
4550
|
+
}).catch(async (error) => {
|
|
4551
|
+
await this.set(key, error, {
|
|
4552
|
+
...options,
|
|
4553
|
+
ttl: options?.errorTTL ?? this.defaultErrorTTL,
|
|
4554
|
+
errorTTL: options?.errorTTL ?? this.defaultErrorTTL
|
|
4555
|
+
});
|
|
4556
|
+
throw error;
|
|
4557
|
+
}).finally(() => {
|
|
4558
|
+
this.promises.delete(key);
|
|
4559
|
+
});
|
|
4560
|
+
this.promises.set(key, promise);
|
|
4561
|
+
return promise;
|
|
4562
|
+
}
|
|
4563
|
+
};
|
|
4564
|
+
function createLRUCache(options) {
|
|
4565
|
+
return new LRUDecoderCache(options);
|
|
4566
|
+
}
|
|
4567
|
+
__name(createLRUCache, "createLRUCache");
|
|
4568
|
+
|
|
4569
|
+
// src/decoder/functionSignature.ts
|
|
4570
|
+
var defaultCache = createLRUCache({
|
|
4571
|
+
max: 500,
|
|
4572
|
+
ttl: 60 * 1e3,
|
|
4573
|
+
// 1 minute
|
|
4574
|
+
errorTTL: 30 * 1e3
|
|
4575
|
+
// 30 seconds
|
|
4576
|
+
});
|
|
4577
|
+
function generateNamedAbiParameters(signature) {
|
|
4578
|
+
const start = signature.indexOf("(");
|
|
4579
|
+
const end = signature.lastIndexOf(")");
|
|
4580
|
+
if (start === -1 || end === -1 || end <= start) {
|
|
4581
|
+
throw new Error(`Invalid signature: ${signature}`);
|
|
4582
|
+
}
|
|
4583
|
+
const paramString = signature.slice(start + 1, end);
|
|
4584
|
+
const rawParams = parseAbiParameters(paramString);
|
|
4585
|
+
const assignNames = /* @__PURE__ */ __name((params, prefix) => {
|
|
4586
|
+
return params.map((param, index) => {
|
|
4587
|
+
const name = `${prefix}${index + 1}`;
|
|
4588
|
+
if (param.type === "tuple" && "components" in param) {
|
|
4589
|
+
const components = assignNames(
|
|
4590
|
+
param.components,
|
|
4591
|
+
`${name}_`
|
|
4592
|
+
);
|
|
4593
|
+
return { ...param, name, components };
|
|
4594
|
+
}
|
|
4595
|
+
return { ...param, name };
|
|
4596
|
+
});
|
|
4597
|
+
}, "assignNames");
|
|
4598
|
+
return assignNames(rawParams, "arg");
|
|
4599
|
+
}
|
|
4600
|
+
__name(generateNamedAbiParameters, "generateNamedAbiParameters");
|
|
4601
|
+
async function fetchAbi(chain, address, options) {
|
|
4602
|
+
const explorer = chain.blockExplorers?.default?.apiUrl;
|
|
4603
|
+
if (!explorer) return void 0;
|
|
4604
|
+
const cache = options?.cache ?? defaultCache;
|
|
4605
|
+
let key = getAddress(address);
|
|
4606
|
+
const cacheKey = makeCacheKey("abi" /* ABI */, key, String(chain.id));
|
|
4607
|
+
return cache.getOrSet(
|
|
4608
|
+
cacheKey,
|
|
4609
|
+
async (signal) => {
|
|
4610
|
+
let isProxy = false;
|
|
4611
|
+
let decoderVerifiedContract = false;
|
|
4612
|
+
let factoryName;
|
|
4613
|
+
const originalKey = key;
|
|
4614
|
+
const addressUrl = new URL(`/api/v2/addresses/${key}`, explorer);
|
|
4615
|
+
const addressRes = await fetch(addressUrl, { signal });
|
|
4616
|
+
if (addressRes.ok) {
|
|
4617
|
+
const data = await addressRes.json();
|
|
4618
|
+
const {
|
|
4619
|
+
implementations: [
|
|
4620
|
+
{ address: _address, address_hash: _addressHash } = {}
|
|
4621
|
+
] = [],
|
|
4622
|
+
is_contract,
|
|
4623
|
+
is_verified: __decoderVerifiedContract,
|
|
4624
|
+
proxy_type,
|
|
4625
|
+
name: __factoryName
|
|
4626
|
+
} = data;
|
|
4627
|
+
const address2 = _address || _addressHash;
|
|
4628
|
+
factoryName = __factoryName;
|
|
4629
|
+
decoderVerifiedContract = Boolean(__decoderVerifiedContract || false);
|
|
4630
|
+
if (address2 && is_contract && proxy_type !== "null" && proxy_type != null) {
|
|
4631
|
+
key = address2;
|
|
4632
|
+
isProxy = true;
|
|
4633
|
+
}
|
|
4634
|
+
}
|
|
4635
|
+
if (!decoderVerifiedContract) {
|
|
4636
|
+
return void 0;
|
|
4637
|
+
}
|
|
4638
|
+
const url = new URL(`/api/v2/smart-contracts/${key}`, explorer);
|
|
4639
|
+
const res = await fetch(url, { signal });
|
|
4640
|
+
if (!res.ok) {
|
|
4641
|
+
return void 0;
|
|
4642
|
+
}
|
|
4643
|
+
const result = await res.json();
|
|
4644
|
+
const {
|
|
4645
|
+
name = factoryName || "UnknownName",
|
|
4646
|
+
abi: abi3,
|
|
4647
|
+
is_verified
|
|
4648
|
+
} = result || {};
|
|
4649
|
+
if (abi3 && is_verified) {
|
|
4650
|
+
return {
|
|
4651
|
+
abi: abi3,
|
|
4652
|
+
__decoderVerifiedContract: decoderVerifiedContract,
|
|
4653
|
+
// If we have an ABI, treat it as verified
|
|
4654
|
+
__decoderIsProxy: isProxy,
|
|
4655
|
+
name,
|
|
4656
|
+
explorer
|
|
4657
|
+
};
|
|
4658
|
+
}
|
|
4659
|
+
return void 0;
|
|
4660
|
+
},
|
|
4661
|
+
{ signal: options?.signal }
|
|
4662
|
+
);
|
|
4663
|
+
}
|
|
4664
|
+
__name(fetchAbi, "fetchAbi");
|
|
4665
|
+
var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, preferError = false, options) => {
|
|
4666
|
+
if (to && isAddress2(to) && isAddressEqual2(to, zeroAddress2)) {
|
|
4667
|
+
return {
|
|
4668
|
+
__decoder: "none",
|
|
4669
|
+
standard: "unknown",
|
|
4670
|
+
to,
|
|
4671
|
+
input,
|
|
4672
|
+
resultType: "raw"
|
|
4673
|
+
};
|
|
4674
|
+
}
|
|
4675
|
+
const data = input?.slice(2);
|
|
4676
|
+
const selector = data.slice(0, 8);
|
|
4677
|
+
if (selector) {
|
|
4678
|
+
if (to) {
|
|
4679
|
+
const info = await fetchAbi(chain, to, options);
|
|
4680
|
+
if (info) {
|
|
4681
|
+
const decoded = customDecodeFunctionData({
|
|
4682
|
+
abi: info.abi,
|
|
4683
|
+
data: input || "0x"
|
|
4684
|
+
});
|
|
4685
|
+
if (decoded) {
|
|
4686
|
+
return {
|
|
4687
|
+
...decoded,
|
|
4688
|
+
__decoder: info.explorer,
|
|
4689
|
+
__decoderVerifiedContract: info.__decoderVerifiedContract,
|
|
4690
|
+
__decoderIsProxy: info.__decoderIsProxy,
|
|
4691
|
+
standard: info.name
|
|
4692
|
+
};
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
const cache = options?.cache ?? defaultCache;
|
|
4697
|
+
const cacheKey = makeCacheKey("sig" /* FUNCTION_SIGNATURE */, selector);
|
|
4698
|
+
const signatureEntry = cache.getOrSet(
|
|
4699
|
+
cacheKey,
|
|
4700
|
+
async (signal) => {
|
|
4701
|
+
const url = `${OPENCHAIN_DICTIONARY_URL}?function=0x${selector}`;
|
|
4702
|
+
let __decoder = new URL(OPENCHAIN_DICTIONARY_URL).hostname;
|
|
4703
|
+
try {
|
|
4704
|
+
const res = await fetch(url, { signal });
|
|
4705
|
+
if (res.ok) {
|
|
4706
|
+
const result = await res.json();
|
|
4707
|
+
if (result) {
|
|
4708
|
+
result.__decoder = __decoder;
|
|
4709
|
+
return result;
|
|
4710
|
+
}
|
|
4711
|
+
}
|
|
4712
|
+
} catch {
|
|
4713
|
+
}
|
|
4714
|
+
__decoder = new URL(FUNCTION_DICTIONARY_URL).hostname;
|
|
4715
|
+
const fallbackRes = await fetch(
|
|
4716
|
+
`${FUNCTION_DICTIONARY_URL}/${selector}`,
|
|
4717
|
+
{ signal }
|
|
4718
|
+
);
|
|
4719
|
+
if (!fallbackRes.ok) {
|
|
4720
|
+
return void 0;
|
|
4721
|
+
}
|
|
4722
|
+
const fallbackResult = await fallbackRes.json();
|
|
4723
|
+
if (fallbackResult) {
|
|
4724
|
+
fallbackResult.__decoder = __decoder;
|
|
4725
|
+
}
|
|
4726
|
+
return fallbackResult;
|
|
4727
|
+
},
|
|
4728
|
+
{ signal: options?.signal }
|
|
4729
|
+
);
|
|
4730
|
+
const methods = await signatureEntry;
|
|
4731
|
+
if (methods?.results?.length > 0) {
|
|
4732
|
+
let search = methods.results.reverse();
|
|
4733
|
+
if (preferError) {
|
|
4734
|
+
const withError = search.filter(
|
|
4735
|
+
(result) => /Error/.test(result.text_signature)
|
|
4736
|
+
);
|
|
4737
|
+
const withoutError = search.filter(
|
|
4738
|
+
(result) => !/Error/.test(result.text_signature)
|
|
4739
|
+
);
|
|
4740
|
+
search = [...withError, ...withoutError];
|
|
4741
|
+
}
|
|
4742
|
+
for (const result of search) {
|
|
4743
|
+
try {
|
|
4744
|
+
const params = generateNamedAbiParameters(
|
|
4745
|
+
result.text_signature || result.name
|
|
4746
|
+
);
|
|
4747
|
+
const args = decodeAbiParameters3(params, `0x${data.slice(8)}`);
|
|
4748
|
+
const encodeArgs = Array.from({ length: params.length }).map(
|
|
4749
|
+
(_val, index) => {
|
|
4750
|
+
if (params[index].type === "bool") {
|
|
4751
|
+
const val = args[`${index}`];
|
|
4752
|
+
if (val !== 1 && val !== 0 && val !== true && val !== false) {
|
|
4753
|
+
throw new Error("Invalid boolean value");
|
|
4754
|
+
}
|
|
4755
|
+
}
|
|
4756
|
+
if (params[index].type === "address") {
|
|
4757
|
+
const val = args[`${index}`];
|
|
4758
|
+
if (!isAddress2(val)) {
|
|
4759
|
+
throw new Error(`Invalid address value ${val}`);
|
|
4760
|
+
}
|
|
4761
|
+
}
|
|
4762
|
+
return args[`${index}`] ?? "0x";
|
|
4763
|
+
}
|
|
4764
|
+
);
|
|
4765
|
+
const newData = encodeAbiParameters(
|
|
4766
|
+
params,
|
|
4767
|
+
encodeArgs
|
|
4768
|
+
).slice(2);
|
|
4769
|
+
if (data.slice(8) === newData) {
|
|
4770
|
+
return {
|
|
4771
|
+
resultType: "execute",
|
|
4772
|
+
standard: "unknown",
|
|
4773
|
+
sig: `0x${selector}`,
|
|
4774
|
+
functionName: result.text_signature.replace(/\(.*$/, ""),
|
|
4775
|
+
...args ? {
|
|
4776
|
+
...createNamedArgs(encodeArgs, params)
|
|
4777
|
+
} : {},
|
|
4778
|
+
__decoder: methods.__decoder || FUNCTION_DICTIONARY_URL
|
|
4779
|
+
};
|
|
4780
|
+
}
|
|
4781
|
+
} catch (error) {
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4786
|
+
return void 0;
|
|
4787
|
+
}, "getFunctionSignature");
|
|
4788
|
+
|
|
4789
|
+
// src/decoder/plugins/enhanceRetrieveAbi.ts
|
|
4790
|
+
var enhanceRetrieveAbiPlugin = standardPlugin(
|
|
4791
|
+
abi2,
|
|
4792
|
+
{
|
|
4793
|
+
abiName: "Internal",
|
|
4794
|
+
decoderName: "explorer",
|
|
4795
|
+
name: "abiRetrieve",
|
|
4796
|
+
usesAsync: true,
|
|
4797
|
+
priority: 0
|
|
4798
|
+
},
|
|
4799
|
+
{
|
|
4800
|
+
enhance: /* @__PURE__ */ __name(async () => {
|
|
4801
|
+
return void 0;
|
|
4802
|
+
}, "enhance"),
|
|
4803
|
+
overrideEnhance: enhanceRetrieveAbi,
|
|
4804
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => {
|
|
4805
|
+
if (!log) {
|
|
4806
|
+
return void 0;
|
|
4807
|
+
}
|
|
4808
|
+
const info = await fetchAbi(options.chain, log.address);
|
|
4809
|
+
if (info) {
|
|
4810
|
+
const result = decodeEvent(options.chain, info.abi, log);
|
|
4811
|
+
if (result) {
|
|
4812
|
+
return { ...result, __decoder: info.explorer };
|
|
4813
|
+
}
|
|
4814
|
+
}
|
|
4815
|
+
return void 0;
|
|
4816
|
+
}, "decodeEvent")
|
|
4817
|
+
}
|
|
4818
|
+
);
|
|
4819
|
+
async function enhanceRetrieveAbi(result, _pluginOptions, options) {
|
|
4820
|
+
const { functionName, sig, args, input, blockNumber, to, from, value } = result;
|
|
4821
|
+
try {
|
|
4822
|
+
const decoded = await getFunctionSignature(
|
|
4823
|
+
options.chain,
|
|
4824
|
+
input,
|
|
4825
|
+
to || void 0,
|
|
4826
|
+
options.preferError
|
|
4827
|
+
);
|
|
4828
|
+
if (decoded) {
|
|
4829
|
+
return {
|
|
4830
|
+
...result,
|
|
4831
|
+
...decoded,
|
|
4832
|
+
resultType: "execute",
|
|
4833
|
+
to,
|
|
4834
|
+
from,
|
|
4835
|
+
value,
|
|
4836
|
+
input
|
|
4837
|
+
};
|
|
4838
|
+
}
|
|
4839
|
+
} catch {
|
|
4840
|
+
}
|
|
4841
|
+
return void 0;
|
|
4842
|
+
}
|
|
4843
|
+
__name(enhanceRetrieveAbi, "enhanceRetrieveAbi");
|
|
4844
|
+
var enhanceRetrieveAbi_default = enhanceRetrieveAbiPlugin;
|
|
4845
|
+
|
|
4846
|
+
// src/decoder/plugins/index.ts
|
|
4847
|
+
[enhanceLSP0ERC725Account_default, enhanceLSP6KeyManager_default, enhanceLSP7DigitalAsset_default, enhanceLSP8IdentifiableDigitalAsset_default, enhanceLSP9Vault_default, enhanceLSP26FollowerSystem_default, enhanceBurntPix_default].forEach((p) => p);
|
|
4848
|
+
var defaultPlugins = Object.freeze([
|
|
4849
|
+
enhanceGraffiti_default,
|
|
4850
|
+
enhanceLSP6KeyManager_default,
|
|
4851
|
+
enhanceLSP0ERC725Account_default,
|
|
4852
|
+
enhanceLSP7DigitalAsset_default,
|
|
4853
|
+
enhanceLSP8IdentifiableDigitalAsset_default,
|
|
4854
|
+
enhanceLSP9Vault_default,
|
|
4855
|
+
enhanceLSP26FollowerSystem_default,
|
|
4856
|
+
enhanceRetrieveAbi_default,
|
|
4857
|
+
enhanceBurntPix_default
|
|
4858
|
+
]);
|
|
4859
|
+
var defaultSchemaPlugins = Object.freeze([
|
|
4860
|
+
schemaDefault_default
|
|
4861
|
+
]);
|
|
4862
|
+
async function decodeKeyValue(result, options) {
|
|
4863
|
+
const key = getArgByName(result.args, "key") ?? "0x";
|
|
4864
|
+
const value = getArgByName(result.args, "value") ?? "0x";
|
|
4865
|
+
return await decodeKeyValueRaw(key, value, options);
|
|
4866
|
+
}
|
|
4867
|
+
__name(decodeKeyValue, "decodeKeyValue");
|
|
4868
|
+
async function decodeKeyValueRaw(key, value, options) {
|
|
4869
|
+
for (const schemaPlugin of options.schemaPlugins) {
|
|
4870
|
+
try {
|
|
4871
|
+
const output = await schemaPlugin(key, value);
|
|
4872
|
+
if (output) {
|
|
4873
|
+
return output;
|
|
4874
|
+
}
|
|
4875
|
+
} catch {
|
|
4876
|
+
}
|
|
4877
|
+
}
|
|
4878
|
+
return void 0;
|
|
4879
|
+
}
|
|
4880
|
+
__name(decodeKeyValueRaw, "decodeKeyValueRaw");
|
|
4881
|
+
pluginRegistry.register("graffiti", enhanceGraffiti_default, {
|
|
4882
|
+
priority: 100,
|
|
4883
|
+
required: false
|
|
4884
|
+
});
|
|
4885
|
+
pluginRegistry.register("abiRetrieve", enhanceRetrieveAbi_default, {
|
|
4886
|
+
priority: 1,
|
|
4887
|
+
required: false,
|
|
4888
|
+
usesAsync: true
|
|
4889
|
+
});
|
|
4890
|
+
pluginRegistry.registerSchema("default-schema", schemaDefault_default, {
|
|
4891
|
+
priority: 100,
|
|
4892
|
+
required: false
|
|
4893
|
+
});
|
|
4894
|
+
|
|
4895
|
+
export {
|
|
4896
|
+
__name,
|
|
4897
|
+
customDecodeFunctionData,
|
|
4898
|
+
createNamedArgs,
|
|
4899
|
+
getArgByName,
|
|
4900
|
+
extractAddress,
|
|
4901
|
+
getPublicClient,
|
|
4902
|
+
isAsyncOperationEnabled,
|
|
4903
|
+
needsEnhancement,
|
|
4904
|
+
collectDataKeys,
|
|
4905
|
+
pluginRegistry,
|
|
4906
|
+
registerPlugin,
|
|
4907
|
+
registerSchemaPlugin,
|
|
4908
|
+
createNamedSchemaPlugin,
|
|
4909
|
+
createNamedPlugin,
|
|
4910
|
+
decodeTransaction,
|
|
4911
|
+
IPFS_GATEWAY,
|
|
4912
|
+
defaultSchema,
|
|
4913
|
+
createAggregationKey,
|
|
4914
|
+
standardPlugin,
|
|
4915
|
+
standardSchemaPlugin,
|
|
4916
|
+
createDebug,
|
|
4917
|
+
standardAggregation,
|
|
4918
|
+
PluginAggregationEngine,
|
|
4919
|
+
decodeEvent,
|
|
4920
|
+
defaultPlugins,
|
|
4921
|
+
defaultSchemaPlugins,
|
|
4922
|
+
decodeKeyValue,
|
|
4923
|
+
decodeKeyValueRaw
|
|
4924
|
+
};
|
|
4925
|
+
//# sourceMappingURL=chunk-XVHJWV5U.js.map
|