Event definitions (#350)

* Event definitions

* Compact things a bit

* Cleanup AccountIndex decoding, align Address

* Remove stand-alone MethodIndex (declutter)

* Inject metadata into Event from api

* Update API TODOs to reflect current state

* Update & expand comments

* EventData only takes Uint8Array inputs (via EventRecord)

* Remove duplicated toHex

* Add FIXME with link to base issue
This commit is contained in:
Jaco Greeff
2018-10-26 14:24:38 +02:00
committed by Amaury Martiny
parent 06079c424e
commit 4997d8fb06
15 changed files with 197 additions and 101 deletions
+2 -2
View File
@@ -12,6 +12,7 @@ import extrinsicsFromMeta from '@polkadot/extrinsics/fromMetadata';
import { Storage } from '@polkadot/storage/types';
import storageFromMeta from '@polkadot/storage/fromMetadata';
import { Hash, Method, RuntimeVersion } from '@polkadot/types/index';
import Event from '@polkadot/types/Event';
import RuntimeMetadata from '@polkadot/types/Metadata';
import { assert, isUndefined, logger } from '@polkadot/util';
@@ -188,8 +189,6 @@ export default abstract class ApiBase<R, S, E> implements ApiBaseInterface<R, S,
// TODO When re-connected (i.e. disconnected and then connected), we want to do a couple of things
// - refresh metadata as needed, decorating again
// - re-create storage subscriptions for those we already have
// - re-watch extrinsics where we have subscriptions already
// - need to refresh genesisHash, extrinsic resub only when it matches
if (isReady) {
return;
@@ -217,6 +216,7 @@ export default abstract class ApiBase<R, S, E> implements ApiBaseInterface<R, S,
this._extrinsics = this.decorateExtrinsics(extrinsics);
this._query = this.decorateStorage(storage);
Event.injectMetadata(this.runtimeMetadata);
Method.injectExtrinsics(extrinsics);
return true;