Small fixes in operation (#200)

* Small fixes in operation

* Move length encoding to Extrinsic
This commit is contained in:
Jaco Greeff
2018-10-04 12:15:01 +02:00
committed by GitHub
parent c5d713aa77
commit 81348c60de
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ export default class ApiBase {
try {
const meta = await this._api.state.getMetadata().toPromise();
this._genesisHash = await this._api.state.getBlockHash(0).toPromise();
this._genesisHash = await this._api.chain.getBlockHash(0).toPromise();
ApiBase.extrinsics = extrinsicsFromMeta(meta);
ApiBase.storage = storageFromMeta(meta);
+9
View File
@@ -2,6 +2,7 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import u8aToHex from '@polkadot/util/u8a/toHex';
import blake2Asu8a from '@polkadot/util-crypto/blake2/asU8a';
import Bytes from './Bytes';
@@ -18,4 +19,12 @@ export default class Extrinsic extends Bytes {
blake2Asu8a(this.toU8a(), 256)
);
}
toHex (): string {
return u8aToHex(this.toU8a());
}
toJSON (): any {
return this.toHex();
}
}