diff --git a/packages/api/src/checkTypes.manual.ts b/packages/api/src/checkTypes.manual.ts index c7dfcb2562..5da6533507 100644 --- a/packages/api/src/checkTypes.manual.ts +++ b/packages/api/src/checkTypes.manual.ts @@ -3,7 +3,7 @@ // Simple non-runnable checks to test type definitions in the editor itself -import { Balance, Header, Index } from '@polkadot/types/interfaces'; +import { AccountId, Balance, Header, Index } from '@polkadot/types/interfaces'; import { IExtrinsic, IMethod } from '@polkadot/types/types'; import { ApiPromise } from '@polkadot/api'; @@ -71,6 +71,20 @@ async function query (api: ApiPromise, keyring: TestKeyringMap): Promise { console.log(multiRes); + // events destructing + api.query.system.events((records): void => { + records.forEach(({ event, phase }): void => { + if (phase.isApplyExtrinsic) { + // Dunno... this should work + // eslint-disable-next-line @typescript-eslint/ban-ts-ignore + // @ts-ignore + const [accountId, value]: [AccountId, Balance] = event.data; + + console.log(`${accountId} has ${value.toHuman()}`); + } + }); + }); + // at queries const events = await api.query.system.events.at('0x12345');