@lukso/transaction-decoder 1.3.7-dev.2df3eae → 1.3.7-dev.30530d6
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 +11 -11
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +4 -4
- package/dist/cdn/transaction-decoder.global.js.map +1 -1
- package/dist/{chunk-JP3VO7OF.js → chunk-HFBAO6YR.js} +2 -2
- package/dist/{chunk-XE5YIF5G.js → chunk-MGPLCACC.js} +12 -12
- package/dist/chunk-MGPLCACC.js.map +1 -0
- package/dist/{chunk-LZFM5SNN.js → chunk-MSTGEOTX.js} +4 -4
- package/dist/{chunk-C3O7HMFS.js → chunk-RYQVLCCC.js} +2 -2
- package/dist/data.cjs +11 -11
- package/dist/data.cjs.map +1 -1
- package/dist/data.js +2 -2
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/server.cjs +1409 -1460
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -17
- package/dist/server.d.ts +2 -17
- package/dist/server.js +2 -56
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
- package/src/server/index.ts +0 -10
- package/src/server/types.ts +1 -14
- package/src/server.ts +0 -1
- package/src/types/index.ts +1 -5
- package/dist/chunk-XE5YIF5G.js.map +0 -1
- package/src/server/decodeEventLogs.ts +0 -71
- /package/dist/{chunk-JP3VO7OF.js.map → chunk-HFBAO6YR.js.map} +0 -0
- /package/dist/{chunk-LZFM5SNN.js.map → chunk-MSTGEOTX.js.map} +0 -0
- /package/dist/{chunk-C3O7HMFS.js.map → chunk-RYQVLCCC.js.map} +0 -0
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { Hex } from 'viem'
|
|
2
|
-
import { decodeKeyValueRaw } from '../decoder/plugins'
|
|
3
|
-
import { pluginRegistry } from '../decoder/registry'
|
|
4
|
-
import type { DecodeEventResult, DecoderOptions } from '../decoder/types'
|
|
5
|
-
import type { ServerDecoderCaches } from './caches'
|
|
6
|
-
import type { ServerDecoderOptions } from './types'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Decode an array of raw log events using the registered decoder plugins.
|
|
10
|
-
*
|
|
11
|
-
* Uses the same plugin iteration pattern as transaction.ts:
|
|
12
|
-
* try each plugin's `decodeEvent`, first match wins, raw log kept as fallback.
|
|
13
|
-
*
|
|
14
|
-
* For DataChanged events, also decodes the ERC725Y key-value pair using
|
|
15
|
-
* the schema plugin system (same as setData transaction decoding).
|
|
16
|
-
*/
|
|
17
|
-
export async function decodeEventLogs(
|
|
18
|
-
logs: DecodeEventResult[],
|
|
19
|
-
options: ServerDecoderOptions,
|
|
20
|
-
_caches: ServerDecoderCaches
|
|
21
|
-
): Promise<DecodeEventResult[]> {
|
|
22
|
-
const { chain } = options
|
|
23
|
-
const plugins = await pluginRegistry.getAll({ syncOnly: true })
|
|
24
|
-
const schemaPlugins = pluginRegistry.getAllSchema()
|
|
25
|
-
|
|
26
|
-
const decoderOptions: DecoderOptions = {
|
|
27
|
-
chain,
|
|
28
|
-
plugins,
|
|
29
|
-
schemaPlugins,
|
|
30
|
-
wrappers: [],
|
|
31
|
-
async: false,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const results: DecodeEventResult[] = []
|
|
35
|
-
|
|
36
|
-
for (const log of logs) {
|
|
37
|
-
let decoded: DecodeEventResult
|
|
38
|
-
for (const plugin of plugins) {
|
|
39
|
-
decoded = await plugin.decodeEvent(log, decoderOptions)
|
|
40
|
-
if (decoded) break
|
|
41
|
-
}
|
|
42
|
-
const result = decoded ?? log
|
|
43
|
-
|
|
44
|
-
// For DataChanged events, decode the ERC725Y key-value pair
|
|
45
|
-
if (result?.eventName === 'DataChanged' && result.args) {
|
|
46
|
-
try {
|
|
47
|
-
const dataKey = result.args.find((a) => a.name === 'dataKey')?.value as
|
|
48
|
-
| Hex
|
|
49
|
-
| undefined
|
|
50
|
-
const dataValue = result.args.find((a) => a.name === 'dataValue')
|
|
51
|
-
?.value as Hex | undefined
|
|
52
|
-
if (dataKey) {
|
|
53
|
-
const info = await decodeKeyValueRaw(
|
|
54
|
-
dataKey,
|
|
55
|
-
dataValue ?? '0x',
|
|
56
|
-
decoderOptions
|
|
57
|
-
)
|
|
58
|
-
if (info) {
|
|
59
|
-
;(result as Record<string, unknown>).info = info
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
} catch {
|
|
63
|
-
// Schema decoding failed — keep event without info
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
results.push(result)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return results
|
|
71
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|