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:
in the previous versions it took an argument of type data: Bytes | Uint8Array
starting in version 10.12.1 it takes an argument of type record: EventRecord
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:
take recordRecord.event.data
filter for events of type pallet-contracts -> ContractEmitted
The
Abi
class of the package@polkadot/api-contract
has a methoddecodeEvent
. This API of this method is unstable and its type changes in version 10.12.1 of@polkadot/api-contract
:data: Bytes | Uint8Array
record: EventRecord
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:recordRecord.event.data
pallet-contracts
->ContractEmitted
ContractEmitted
data
entry (which is a hex string)This buffer is then handed to
decodeEvent
.TODO
EventRecord
todecodeEvent
.