@lukso/transaction-decoder 1.3.0-dev.c21633f → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.cjs +73 -41
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +4 -4
- package/dist/cdn/transaction-decoder.global.js +13 -13
- package/dist/cdn/transaction-decoder.global.js.map +1 -1
- package/dist/{chunk-2ZO6MJJX.js → chunk-G7JZHSYX.js} +12 -11
- package/dist/chunk-G7JZHSYX.js.map +1 -0
- package/dist/{chunk-FKBKAWB3.js → chunk-GGBHTWJL.js} +5 -5
- package/dist/chunk-GGBHTWJL.js.map +1 -0
- package/dist/{chunk-NDBDNXBI.js → chunk-GXZOF3QY.js} +27 -3
- package/dist/chunk-GXZOF3QY.js.map +1 -0
- package/dist/{chunk-T4H2HHIB.js → chunk-XVHJWV5U.js} +32 -25
- package/dist/chunk-XVHJWV5U.js.map +1 -0
- package/dist/data.cjs +62 -31
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.cts +2 -2
- package/dist/data.d.ts +2 -2
- package/dist/data.js +2 -2
- package/dist/index.cjs +73 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/server.cjs +43 -31
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -1
- package/dist/server.d.ts +2 -1
- package/dist/server.js +12 -7
- package/dist/server.js.map +1 -1
- package/dist/{utils-BEpSreRR.d.cts → utils-CBAkjQh3.d.cts} +1 -1
- package/dist/{utils-De_c6fUK.d.ts → utils-xT9-km0r.d.ts} +1 -1
- package/package.json +3 -3
- package/src/core/dataModel.ts +31 -1
- package/src/core/integrateDecoder.ts +2 -1
- package/src/decoder/browserCache.ts +6 -1
- package/src/decoder/errors.ts +2 -2
- package/src/decoder/events.ts +3 -3
- package/src/decoder/functionSignature.ts +9 -9
- package/src/decoder/getDataFromExternalSources.ts +2 -2
- package/src/decoder/interfaces.ts +1 -1
- package/src/decoder/kvCache.ts +6 -1
- package/src/decoder/lruCache.ts +6 -1
- package/src/decoder/lsp7TransferBatch.test.ts +3 -0
- package/src/decoder/plugins/enhanceBurntPix.ts +2 -1
- package/src/decoder/plugins/enhanceGraffiti.ts +17 -3
- package/src/decoder/plugins/enhanceLSP26FollowerSystem.ts +8 -4
- package/src/decoder/plugins/enhanceLSP6KeyManager.ts +1 -0
- package/src/decoder/plugins/enhanceLSP7DigitalAsset.ts +7 -5
- package/src/decoder/plugins/enhanceLSP9Vault.ts +8 -7
- package/src/decoder/plugins/enhanceRetrieveAbi.ts +6 -5
- package/src/decoder/plugins/index.ts +1 -3
- package/src/decoder/plugins/schemaDefault.ts +4 -3
- package/src/decoder/plugins/standardPlugin.ts +1 -1
- package/src/decoder/singleGQL.ts +2 -2
- package/src/decoder/transaction.ts +2 -1
- package/src/decoder/utils.ts +2 -2
- package/src/example/usage.ts +4 -3
- package/src/server/addressResolver.ts +1 -1
- package/src/server/decodeTransactionSync.ts +1 -0
- package/src/server/decodeTransactionsBatch.ts +1 -1
- package/src/server/finishDecoding.ts +8 -4
- package/src/server/lsp23Resolver.ts +3 -2
- package/src/server/types.ts +1 -1
- package/src/shared/addressResolver.ts +4 -4
- package/src/utils/json-bigint.ts +4 -4
- package/dist/chunk-2ZO6MJJX.js.map +0 -1
- package/dist/chunk-FKBKAWB3.js.map +0 -1
- package/dist/chunk-NDBDNXBI.js.map +0 -1
- package/dist/chunk-T4H2HHIB.js.map +0 -1
|
@@ -804,7 +804,7 @@ var getDataFromExternalSources = /* @__PURE__ */ __name((schemas, dataFromChain,
|
|
|
804
804
|
urlDataWithHash,
|
|
805
805
|
ipfsGateway
|
|
806
806
|
));
|
|
807
|
-
let
|
|
807
|
+
let length = "unknown";
|
|
808
808
|
if (!url.startsWith("data:") && /[=?/]$/.test(url)) {
|
|
809
809
|
return dataEntry;
|
|
810
810
|
}
|
|
@@ -816,7 +816,7 @@ var getDataFromExternalSources = /* @__PURE__ */ __name((schemas, dataFromChain,
|
|
|
816
816
|
}
|
|
817
817
|
return response.arrayBuffer().then((buffer) => new Uint8Array(buffer));
|
|
818
818
|
});
|
|
819
|
-
|
|
819
|
+
length = receivedData.length.toString();
|
|
820
820
|
const captureHashes = {};
|
|
821
821
|
const captureErrors = [];
|
|
822
822
|
if (receivedData.length >= 2) {
|
|
@@ -936,7 +936,7 @@ function decodeKeyValuePlugin(defaultSchema2, process2) {
|
|
|
936
936
|
});
|
|
937
937
|
if (schema) {
|
|
938
938
|
try {
|
|
939
|
-
const name = schema.name.replace(/[
|
|
939
|
+
const name = schema.name.replace(/[:\[\]]|<.*?>/g, "");
|
|
940
940
|
if (schema.keyType === "Array") {
|
|
941
941
|
if (schema.key === key) {
|
|
942
942
|
const hexString = value.slice(2);
|
|
@@ -944,7 +944,7 @@ function decodeKeyValuePlugin(defaultSchema2, process2) {
|
|
|
944
944
|
for (let i = 0; i < hexString.length; i += 2) {
|
|
945
945
|
all[i / 2] = Number.parseInt(hexString.substring(i, i + 2), 16);
|
|
946
946
|
}
|
|
947
|
-
const [{ start
|
|
947
|
+
const [{ start, end } = { start: 0, end: 0 }] = all.reduce(
|
|
948
948
|
(acc, byte, index_) => {
|
|
949
949
|
let isZero = byte === 0 || index_ === 0;
|
|
950
950
|
const last = acc.at(-1);
|
|
@@ -1010,7 +1010,7 @@ function decodeKeyValuePlugin(defaultSchema2, process2) {
|
|
|
1010
1010
|
value: data2
|
|
1011
1011
|
};
|
|
1012
1012
|
}
|
|
1013
|
-
let dynamicKeyParts;
|
|
1013
|
+
let dynamicKeyParts = void 0;
|
|
1014
1014
|
if (isDynamicKeyName(schema.name)) {
|
|
1015
1015
|
dynamicKeyParts = decodeMappingKey(key, schema).map(
|
|
1016
1016
|
({ value: value2 }) => isHex2(value2) ? value2.toLowerCase() : `${value2}`
|
|
@@ -1574,9 +1574,9 @@ function customDecodeEventLog(parameters) {
|
|
|
1574
1574
|
};
|
|
1575
1575
|
}
|
|
1576
1576
|
__name(customDecodeEventLog, "customDecodeEventLog");
|
|
1577
|
-
function decodeEvent(
|
|
1578
|
-
const { data: _data } = log;
|
|
1579
|
-
let
|
|
1577
|
+
function decodeEvent(chain, abi3, log) {
|
|
1578
|
+
const { data: _data, address, ...rest } = log;
|
|
1579
|
+
let lastError;
|
|
1580
1580
|
try {
|
|
1581
1581
|
const result = customDecodeEventLog({
|
|
1582
1582
|
abi: abi3,
|
|
@@ -2228,7 +2228,7 @@ var enhanceBurntPixPlugin = standardPlugin(
|
|
|
2228
2228
|
aggregations: [refineAggregation]
|
|
2229
2229
|
}
|
|
2230
2230
|
);
|
|
2231
|
-
async function enhanceBurntPix(result, pluginOptions,
|
|
2231
|
+
async function enhanceBurntPix(result, pluginOptions, options) {
|
|
2232
2232
|
if ("functionName" in result && result.functionName === "refine") {
|
|
2233
2233
|
return {
|
|
2234
2234
|
...result,
|
|
@@ -2243,20 +2243,25 @@ __name(enhanceBurntPix, "enhanceBurntPix");
|
|
|
2243
2243
|
var enhanceBurntPix_default = enhanceBurntPixPlugin;
|
|
2244
2244
|
|
|
2245
2245
|
// src/decoder/plugins/enhanceGraffiti.ts
|
|
2246
|
-
import {
|
|
2246
|
+
import {
|
|
2247
|
+
bytesToString,
|
|
2248
|
+
hexToBytes,
|
|
2249
|
+
size as size3,
|
|
2250
|
+
slice as slice2
|
|
2251
|
+
} from "viem";
|
|
2247
2252
|
var enhanceGraffitiPlugin = Object.freeze({
|
|
2248
2253
|
enhance: /* @__PURE__ */ __name(async (result, options) => enhanceGraffiti(
|
|
2249
2254
|
result,
|
|
2250
2255
|
{ abiName: "graffiti", decoderName: "graffiti" },
|
|
2251
2256
|
options
|
|
2252
2257
|
), "enhance"),
|
|
2253
|
-
decodeEvent: /* @__PURE__ */ __name(async (
|
|
2258
|
+
decodeEvent: /* @__PURE__ */ __name(async (log, options) => void 0, "decodeEvent"),
|
|
2254
2259
|
required: true,
|
|
2255
2260
|
priority: 1e3,
|
|
2256
2261
|
name: "graffiti"
|
|
2257
2262
|
});
|
|
2258
2263
|
async function enhanceGraffiti(result, _pluginOptions, _options) {
|
|
2259
|
-
const { input } = result;
|
|
2264
|
+
const { functionName, sig, args, input } = result;
|
|
2260
2265
|
if (input && size3(input || "0x") >= 4 && slice2(input || "0x", 0, 4) === "0x00000000") {
|
|
2261
2266
|
let graffiti = slice2(input, 4);
|
|
2262
2267
|
try {
|
|
@@ -2328,7 +2333,7 @@ async function decodeTransaction(fullTransaction, options) {
|
|
|
2328
2333
|
phase: "enhanced"
|
|
2329
2334
|
};
|
|
2330
2335
|
}
|
|
2331
|
-
let
|
|
2336
|
+
let lastError;
|
|
2332
2337
|
const activePlugins = options.plugins;
|
|
2333
2338
|
for (const plugin of activePlugins) {
|
|
2334
2339
|
if (to && isAddress(to) && isAddressEqual(to, zeroAddress)) {
|
|
@@ -2391,6 +2396,7 @@ async function decodeTransaction(fullTransaction, options) {
|
|
|
2391
2396
|
}
|
|
2392
2397
|
} catch (e) {
|
|
2393
2398
|
console.error(e);
|
|
2399
|
+
continue;
|
|
2394
2400
|
}
|
|
2395
2401
|
}
|
|
2396
2402
|
let phase = "functionName" in transaction && transaction.functionName && transaction.standard || transaction.input === "0x" || !transaction.input ? "enhanced" : "immediate";
|
|
@@ -3316,6 +3322,7 @@ async function enhanceKeyManager(result, pluginOptions, options) {
|
|
|
3316
3322
|
sig,
|
|
3317
3323
|
args,
|
|
3318
3324
|
input,
|
|
3325
|
+
blockNumber,
|
|
3319
3326
|
to: _to,
|
|
3320
3327
|
from: _from,
|
|
3321
3328
|
value
|
|
@@ -3585,7 +3592,7 @@ async function enhanceLSP7Metadata(result, options) {
|
|
|
3585
3592
|
}
|
|
3586
3593
|
__name(enhanceLSP7Metadata, "enhanceLSP7Metadata");
|
|
3587
3594
|
async function enhanceLSP26FollowerSystem(result, _pluginOptions, _options) {
|
|
3588
|
-
const { functionName } = result;
|
|
3595
|
+
const { functionName, sig, args, input, blockNumber, to, from, value } = result;
|
|
3589
3596
|
switch (functionName) {
|
|
3590
3597
|
}
|
|
3591
3598
|
return void 0;
|
|
@@ -3745,8 +3752,8 @@ var enhanceLSP9VaultPlugin = standardPlugin(
|
|
|
3745
3752
|
}, "decodeEvent")
|
|
3746
3753
|
}
|
|
3747
3754
|
);
|
|
3748
|
-
async function enhanceLSP9Vault(result,
|
|
3749
|
-
const { functionName } = result;
|
|
3755
|
+
async function enhanceLSP9Vault(result, pluginOptions, options) {
|
|
3756
|
+
const { functionName, sig, args, input, blockNumber, to, from, value } = result;
|
|
3750
3757
|
switch (functionName) {
|
|
3751
3758
|
}
|
|
3752
3759
|
return void 0;
|
|
@@ -3777,7 +3784,7 @@ var enhanceLSP26FollowerSystemPlugin = standardPlugin(
|
|
|
3777
3784
|
}
|
|
3778
3785
|
);
|
|
3779
3786
|
async function enhanceLSP26FollowerSystem2(result, _pluginOptions, _options) {
|
|
3780
|
-
const { functionName, args } = result;
|
|
3787
|
+
const { functionName, sig, args, input, blockNumber, to, from, value } = result;
|
|
3781
3788
|
const { args: _args, ...partialResult } = result;
|
|
3782
3789
|
switch (functionName) {
|
|
3783
3790
|
case "follow":
|
|
@@ -3793,6 +3800,7 @@ async function enhanceLSP26FollowerSystem2(result, _pluginOptions, _options) {
|
|
|
3793
3800
|
}
|
|
3794
3801
|
]
|
|
3795
3802
|
};
|
|
3803
|
+
break;
|
|
3796
3804
|
case "followBatch":
|
|
3797
3805
|
case "unfollowBatch":
|
|
3798
3806
|
return {
|
|
@@ -3804,6 +3812,7 @@ async function enhanceLSP26FollowerSystem2(result, _pluginOptions, _options) {
|
|
|
3804
3812
|
address
|
|
3805
3813
|
}))
|
|
3806
3814
|
};
|
|
3815
|
+
break;
|
|
3807
3816
|
}
|
|
3808
3817
|
return void 0;
|
|
3809
3818
|
}
|
|
@@ -4519,7 +4528,7 @@ var LRUDecoderCache = class {
|
|
|
4519
4528
|
if (cached && (!cached.expires || now < cached.expires)) {
|
|
4520
4529
|
return cached.value;
|
|
4521
4530
|
}
|
|
4522
|
-
if (cached
|
|
4531
|
+
if (cached && cached.stale && now < cached.stale && !this.promises.has(key)) {
|
|
4523
4532
|
const backgroundPromise = factory(options?.signal).then(async (fresh) => {
|
|
4524
4533
|
await this.set(key, fresh, options);
|
|
4525
4534
|
return fresh;
|
|
@@ -4601,7 +4610,7 @@ async function fetchAbi(chain, address, options) {
|
|
|
4601
4610
|
let isProxy = false;
|
|
4602
4611
|
let decoderVerifiedContract = false;
|
|
4603
4612
|
let factoryName;
|
|
4604
|
-
const
|
|
4613
|
+
const originalKey = key;
|
|
4605
4614
|
const addressUrl = new URL(`/api/v2/addresses/${key}`, explorer);
|
|
4606
4615
|
const addressRes = await fetch(addressUrl, { signal });
|
|
4607
4616
|
if (addressRes.ok) {
|
|
@@ -4769,7 +4778,7 @@ var getFunctionSignature = /* @__PURE__ */ __name(async (chain, input, to, prefe
|
|
|
4769
4778
|
__decoder: methods.__decoder || FUNCTION_DICTIONARY_URL
|
|
4770
4779
|
};
|
|
4771
4780
|
}
|
|
4772
|
-
} catch (
|
|
4781
|
+
} catch (error) {
|
|
4773
4782
|
}
|
|
4774
4783
|
}
|
|
4775
4784
|
}
|
|
@@ -4808,7 +4817,7 @@ var enhanceRetrieveAbiPlugin = standardPlugin(
|
|
|
4808
4817
|
}
|
|
4809
4818
|
);
|
|
4810
4819
|
async function enhanceRetrieveAbi(result, _pluginOptions, options) {
|
|
4811
|
-
const { input, to, from, value } = result;
|
|
4820
|
+
const { functionName, sig, args, input, blockNumber, to, from, value } = result;
|
|
4812
4821
|
try {
|
|
4813
4822
|
const decoded = await getFunctionSignature(
|
|
4814
4823
|
options.chain,
|
|
@@ -4835,9 +4844,7 @@ __name(enhanceRetrieveAbi, "enhanceRetrieveAbi");
|
|
|
4835
4844
|
var enhanceRetrieveAbi_default = enhanceRetrieveAbiPlugin;
|
|
4836
4845
|
|
|
4837
4846
|
// src/decoder/plugins/index.ts
|
|
4838
|
-
[enhanceLSP0ERC725Account_default, enhanceLSP6KeyManager_default, enhanceLSP7DigitalAsset_default, enhanceLSP8IdentifiableDigitalAsset_default, enhanceLSP9Vault_default, enhanceLSP26FollowerSystem_default, enhanceBurntPix_default].forEach((p) =>
|
|
4839
|
-
p;
|
|
4840
|
-
});
|
|
4847
|
+
[enhanceLSP0ERC725Account_default, enhanceLSP6KeyManager_default, enhanceLSP7DigitalAsset_default, enhanceLSP8IdentifiableDigitalAsset_default, enhanceLSP9Vault_default, enhanceLSP26FollowerSystem_default, enhanceBurntPix_default].forEach((p) => p);
|
|
4841
4848
|
var defaultPlugins = Object.freeze([
|
|
4842
4849
|
enhanceGraffiti_default,
|
|
4843
4850
|
enhanceLSP6KeyManager_default,
|
|
@@ -4915,4 +4922,4 @@ export {
|
|
|
4915
4922
|
decodeKeyValue,
|
|
4916
4923
|
decodeKeyValueRaw
|
|
4917
4924
|
};
|
|
4918
|
-
//# sourceMappingURL=chunk-
|
|
4925
|
+
//# sourceMappingURL=chunk-XVHJWV5U.js.map
|