pendulum-chain / api-solang

This is the code for the npm package @pendulum-chain/api-solang
0 stars 0 forks source link

Adapt to breaking change in decodeEvent API of @polkadot/api-contract #3

Closed TorstenStueber closed 6 months ago

TorstenStueber commented 6 months ago

The Abi class of the package @polkadot/api-contract has a method decodeEvent. This API of this method is unstable and its type changes in version 10.12.1 of @polkadot/api-contract:

The breaking change is due to this PR and was necessary with the introduction of ink! v5. Solang still produces the metadata type of ink! v4 and fortunately the change introduced through the above PR is backward compatible and works with metadata generated by Solang as well as metadata generated by ink! v4 (which is the version Solang emits) and v5.

At the moment api-solang receives events of type EventRecord when an extrinsic is submitted and then extracts the raw byte array as follows:

This buffer is then handed to decodeEvent.

TODO