Commit Graph
114 Commits
Author SHA1 Message Date
Jaco Greeff b52a86eab0 Fix types documentation links (#445)
* Fix types documentation links

* Adjust CSS selector

* Don't include Summary in the README
2018-12-06 12:11:56 +01:00
Jaco Greeff 101f869423 Expose a hasOrigin getter (public vs private) (#437)
* Expose a hasOrigin getter (public vs private)

* Add tests, fix hex creation
2018-12-04 13:49:37 +01:00
Amaury Martiny e2c029cc9e Expose map and filter on Tuple (#436) 2018-12-04 11:42:08 +01:00
Jaco Greeff 637182baf9 API cleanups, circular deps (#433)
* Cleanups with @polkadot/util packages

* Initi registry at types root

* Revert test throw

* Fallback to root types when registry lookup fails

* Update StorageChangeSet.spec.ts

* Update createType.ts

* Linting update

* Update createType.ts

* Rename TypeRegistry.ts to typeRegistry.ts
2018-12-04 10:17:26 +01:00
Amaury Martiny 1d1832111b Tuple extends Array (#432)
* Tuple extend array

* Fix all tests

* Add tests on Tupel

* Remove getAtIndex for tuples

* Add noInheritDoc

* Update comments

* Update docs
2018-12-03 15:54:52 +01:00
Jaco Greeff a7b177d7dd Document getters and functions for all types (static missing) (#431)
* Document getters and functions for all types (static missing)

* Update SignedBlock.ts

* Bump @polkadot/dev, introduce @noInheritDoc

* Text inherits from String

* Link to indv. types from README

* Add base to UInt toString
2018-12-03 15:47:22 +01:00
Jaco Greeff 6cab9be9c8 Document @polkadot/types (#430)
* Start with codec descriptions

* Base codec types have definitions...

* Base interface defintions

* Descriptions for all type classes

* Link to types docs

* Remove stray template block

* Typos

* Hash -> H256 in description
2018-12-03 11:23:18 +01:00
Xiliang Chen 82dcbe50d5 Type registry (#428)
* basic type registry

* register all buildin types

* get types from TypeRegistry

* Update Api constructor options to include additionalTypes

* Fix linter issue

* Style improvements and rename ApiBaseOptions to ApiOptions

* refactor Api classes constructor options
2018-11-30 15:52:40 +01:00
Jaco Greeff df1c6dc21b Define properties on Struct.with automatically (#425)
* Define properties on Struct.with automatically

* getAtIndex(index) -> get(key)
2018-11-29 17:47:37 +01:00
Jaco Greeff ffad4f1715 Revert "Define properties on Struct.with automatically"
This reverts commit d348f50dcf.
2018-11-29 16:12:58 +01:00
Jaco Greeff d348f50dcf Define properties on Struct.with automatically 2018-11-29 16:10:50 +01:00
Jaco Greeff 9092250acc Move types.d.ts -> types.ts (#421)
* Move types.d.ts -> types.ts

* Bump common deps
2018-11-29 12:13:28 +01:00
Jaco Greeff 2aa78f2cad createType makes new instance, StorageData tests (#417)
* createType makes new instance, StorageData tests

* Unused import
2018-11-28 12:04:38 +01:00
Jaco Greeff 5e5f8b8dab Bump deps, update with stricter TS checks from dev (#415)
* Bump deps, update with stricter TS checks from dev

* Add pretty to tsc
2018-11-27 14:44:51 +01:00
Jaco Greeff 16df614b0c Bytes from StorageData (possibly prefixed) (#413)
* Bytes from StorageData (possibly prefixed)

* StorageData extends Data

* Cyclic-dep require, StorageData extends Bytes
2018-11-27 12:53:46 +01:00
Jaco Greeff 1a47d555a6 Allow ability to add raw signature (bytes) to Extrinsic (#412)
* Allow ability to add raw signature (bytes) to Extrinsic

* Linting

* Alphabetical

* Remove unused imports

* Export Immortal era constant
2018-11-26 15:06:36 +01:00
Jaco Greeff 585350702d Update with Grandpa types (#411)
* Update with Grandpa types

* JSON rename for input/output

* JSON -> latest

* Revert rpc update

* Remove U8a | Uint8Array (equivalent)

* Justification is Bytes

* Update MisbehaviourReport

* Fix JSON
2018-11-23 13:29:54 +01:00
Jaco Greeff d0ff8937a4 Use compact* from util for encoding (#409)
* Use compact* from util for encoding

* Remove @polkadot/extrinsics from types imports

* Cleanup manual length concat

* Add missing @polkadot/types dependencies
2018-11-21 17:21:44 +01:00
Jaco Greeff 4805f9cb36 Update LICENSE and README (#408)
* Update LICENSE and README

* Bump
2018-11-21 13:37:27 +01:00
Mario Neises 141f761063 fix usage with typescript (#405)
* fix usage with typescript
- export Base within codec
- Codec is not generic
- use wildcard import for json rpc types

* remove unsued generic + remove unsued import

* import Codec instead of Base

* use correct import for codec type

* replace Base by Codec import and usage

* remove unsued import
2018-11-20 17:04:28 +01:00
Amaury Martiny b6dd43ee71 Vector extends Array (#404)
* Vector extends Array

* Update tests

* Add tests for Vector

* Remove .get on Vector

* Change back toString representation
2018-11-20 12:45:56 +01:00
Amaury Martiny 9548f977f5 Simplify Base (#403)
* Convert Base to a wrapper

* Remove isEmpty

* Fix bug with storage

* Fix lint

* Fix imports

* Protected raw

* Remove useless imports

* Remove test for Base

* Use unwrap on Option

* Storage unwrap

* Use isNone

* Add test for accessing values

* Remove comment

* toU8a always return Uint8Array
2018-11-19 11:38:47 +01:00
Jaco Greeff 945818959a Use .toString() instead of .raw for metadata uniq (#402) 2018-11-15 15:58:20 +01:00
Amaury Martiny b580c12149 Bool extends Boolean (#401)
* Bool extends Boolean

* Private static

* Add tests for Bool

* Type
2018-11-15 14:55:50 +01:00
Amaury Martiny 681cda22b3 Moment extends Date (#400)
* Moment extends Date

* FIx tests

* Add comments

* Use toISOString

* Use toISOString
2018-11-15 14:51:51 +01:00
Amaury Martiny f381a4d045 Text extends String (#399)
* Text extends String

* Fix type

* Cleaner code

* Add explicit return type
2018-11-15 14:19:41 +01:00
Amaury Martiny d097a7a32d UInt extends BN (#396)
* Fix Uint and Moment and Compact

* Fix address and account index

* Remove .toBN

* Add comment

* Fix lint

* _raw to raw

* bitLength as method in U8aFixed
2018-11-14 12:35:06 +01:00
Jaco Greeff 42e9347033 Override subarray, returning via Uint8Array.from (#395)
* Override subarray, returning via Uint8Array.from

* Import order

* Use .from in subarray test
2018-11-13 16:00:16 +01:00
Amaury Martiny 73710b708b U8a extends Uint8Array (#392)
* U8a implements Codec

* Fix U8aFixed

* Fix Bytes

* Fix AccountId

* Remove if instanceof U8a

* Fix Bytes

* Fix lint

* Fix AccountId

* Remove any type

* Remove isBuffer

* Use this directly
2018-11-13 12:49:21 +01:00
Jaco Greeff 8121aa2927 Bump util, fix constructors (#393) 2018-11-12 18:15:35 +01:00
Jaco Greeff 77a883c89c Vector should instantiate from Vector (#389) 2018-11-09 16:44:56 +01:00
Jaco Greeff 1c1a9dd253 Don't try and auto-detect hex Bytes with length (#387) 2018-11-08 15:59:24 +01:00
Jaco Greeff f1920e911a Small U8a cleanup for Moment, duplicate line in Text (#383) 2018-11-07 21:05:28 +01:00
Jaco Greeff cb9a48dc15 Allow construction of all types via U8a (#382) 2018-11-07 20:38:12 +01:00
Jaco Greeff c32bace2cd Handle both prefixed and non-prefixed hex Bytes (#379) 2018-11-07 15:05:02 +01:00
Jaco Greeff e597f1b21f Allow rawStorage queries via Uint8Array keys (#378)
* Allow rawStorage queries via Uint8Array keys

* Data fallback
2018-11-07 13:39:12 +01:00
Jaco Greeff a03babe65c Expose event meta (#372) 2018-11-01 11:57:01 +01:00
Jaco Greeff b09cbf6707 Event data carries section + method (#369)
* Event data carries section + method

* Expose method & section on event itself

* Expose typeDef on Event via EventData
2018-10-31 17:45:51 +01:00
Jaco Greeff 50d23b7611 Export missing types, e.g. Digest, Event, Type (#368) 2018-10-31 16:29:39 +01:00
Jaco Greeff 686ea05167 Add Set basetype (#365)
* Add Set basetype

* Test and log invalid init values

* Set.value -> Set.values

* isEmpty used this.values in Set

* Cleanup erronenous export

* Export Option for codec
2018-10-30 17:23:20 +01:00
Jaco Greeff 90d88ae2b6 Header.BlockNumber is Compact (#364) 2018-10-29 16:50:50 +01:00
Jaco Greeff 246c482323 Seal.slot as U64 (#363) 2018-10-29 15:18:34 +01:00
Jaco Greeff 28fd04c9e9 Add toU8a for EnumType (#362) 2018-10-29 14:51:07 +01:00
Jaco Greeff 96dc7dfd90 Add DigestItem(Seal) for Aura (#361)
* Add DigestItem(Seal) for Aura

* Re-add DigestItem export
2018-10-29 14:15:16 +01:00
Jaco Greeff 22632342c8 Decode meta <T as HasCompact>::Type (#358)
* Decode meta with HasCompact

* Revert saved meta (until create done)

* Construct Compact.with, allow Compact extends Base

* Remove (now invalid) comment

* createType creates Compact<*>

* Allow Compact<Moment>

* Update Type.ts

* Update Type.ts

* Update Type.ts
2018-10-29 11:40:36 +01:00
Jaco Greeff 78f179c09e Remove PairOf, convert to simple Tuple (#360) 2018-10-29 11:29:22 +01:00
Jaco Greeff 822f15e3a2 AccountIndex extends U32 (#355)
* AccountIndex extends U32

* Re-add toU8a with isBare override

* Small clarifications

* case-sensitive import

* Update comment
2018-10-29 11:18:20 +01:00
Jaco Greeff a2b22e3bb8 Allow Block/Header constructor via Uint8Array (client use) (#357) 2018-10-29 10:30:20 +01:00
Jaco Greeff 4997d8fb06 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
2018-10-26 14:24:38 +02:00
Jaco Greeff c42b71a6d8 Add EventRecord & PairOf (#349)
* Fix metadata type output for storage

* Add EventRecord

* Add PairOf, rename .with to .with<Class>

* Revert .with changes, test for EventRecord

* ApplkyExtrinsic extends u32

* Log EnumType errors a tiny bit better
2018-10-25 21:21:19 +02:00