api icon indicating copy to clipboard operation
api copied to clipboard

How to get event args values from contracts::contractemitted data?

Open ayudh37 opened this issue 2 years ago • 0 comments

  • I'm submitting a ...
  • [x] Support request
  • What is the current behavior and expected behavior?

I am using

const decodedEvent = Abi.decodeEvent(Uint8Array.from(Buffer.from("00000064a7b3b6e00d000000000000000000000000000000000000000000000000", 'hex'))) 

(00000064a7b3b6e00d000000000000000000000000000000000000000000000000 is the data in the contracts::contractemitted event.)

But I cannot access the actual argument values, only their types. I'd like to be able to access the values when decoding the event. What am I missing?

Currently when accessing the decodedEvent.event.args, I only see the names and types. Where can I access the values?

Here's the decodedEvent.event.args Screenshot 2022-09-08 at 11 34 43 AM

  • Please tell us about your environment:
  • Version: @polkadot/api-contract": "9.3.3"

  • Environment: Macbook Air m1 chip

    • [x] Node.js
  • Language:

    • [x] JavaScript

ayudh37 avatar Sep 07 '22 05:09 ayudh37