multiversx / mx-sdk-js-network-providers

Network Provider (API, Gateway) components (compatible with sdk-js).
Other
6 stars 6 forks source link

TokenOperationsOutcomeParser: error when a transaction has multiple events #57

Closed gfusee closed 4 months ago

gfusee commented 4 months ago

The implementation of the functions inside the class TokenOperationsOutcomeParser expect transactions to have only one event of interest: "issue", "ESDTNFTCreate", "ESDTLocalBurn", etc.

However this condition is not true, especially for indirect events in smart contract calls.

Here is a reproducible example:

import {ProxyNetworkProvider} from "@multiversx/sdk-network-providers/out"
import {TokenOperationsOutcomeParser} from "@multiversx/sdk-core/out"

async function main() {
    const provider = new ProxyNetworkProvider("https://gateway.multiversx.com")

    const tx = await provider.getTransaction("8c972e4756c553f11ba5dbdb74d9152c6bd0305761cd675b8b3945977d1d2a1a")

    const parser = new TokenOperationsOutcomeParser()
    const result = parser.parseNFTCreate(tx)

    console.log(result)
}

main()
gfusee commented 4 months ago

TokenOperationsOutcomeParser is a part of the core repo. I re-opened this issue in this latter: https://github.com/multiversx/mx-sdk-js-core/issues/397