Add Types from RPC (and more tests) (#165)

* Tests for Array for proper coverage

* Expand tests

* Add PropIndex :(

* Add RawAddress

* Index -> Nonce

* Disable test for alias code (commented)

* Block & Extrinsic (base)

* String -> Text, Array -> Vector

* Remove Codec* prefixes

* Unsigned -> Long

* import renames

* Values for structures

* Export classes from Metadata

* Long -> UInt

* Alias vec<u8> -> Bytes
This commit is contained in:
Jaco Greeff
2018-09-25 18:22:25 +02:00
committed by GitHub
parent b13486f9ab
commit 964bf84b83
39 changed files with 588 additions and 291 deletions
+27
View File
@@ -0,0 +1,27 @@
// Copyright 2017-2018 @polkadot/api-codec authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import Struct from './codec/Struct';
import Vector from './codec/Vector';
import Extrinsic from './Extrinsic';
import Header from './Header';
// A block encoded with header and extrinsics
export default class Block extends Struct {
constructor (value?: any) {
super({
header: Header,
extrinsics: Vector.with(Extrinsic)
}, value);
}
get extrinsics (): Vector<Extrinsic> {
return this.raw.extrinsics as Vector<Extrinsic>;
}
get header (): Header {
return this.raw.header as Header;
}
}