Manual testcase for Tuples (#2201)

* Manual testcase for Tuples

* Unused import

* Length check
This commit is contained in:
Jaco Greeff
2020-10-14 19:38:06 +02:00
committed by GitHub
parent fed93e2459
commit a8a10aec0c
+15 -1
View File
@@ -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<void> {
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');