Commit Graph
176 Commits
Author SHA1 Message Date
Jaco Greeff ebcb7954cc EnumType toJSON to include type & value (#645)
* EnumType toJSON to include type & value

* Update metadata for new EnumType formatting

* PlainType & MapType
2019-01-28 18:01:25 +01:00
Jaco Greeff b34277aeca Filter events based on order and actual number of events (#644) 2019-01-28 16:50:57 +01:00
Jaco Greeff e798df949b Ensure large >U32 is encoded as hex (#641)
* Ensure large >U32 is enocoded as hex

* Update U64 test compares to hex

* Update subscribe.spec.ts
2019-01-28 13:11:44 +01:00
Jaco Greeff 5898caa71e Compact unwrap (returns raw UInt/Moment) (#636) 2019-01-28 12:14:27 +01:00
Jaco Greeff 3ced943f36 derive.chain.* allows for non-available session (#638)
* derive.chain.* allows for non-available session

* Cleanup typing

* Slightly more robust validators init
2019-01-26 16:45:11 +01:00
Jaco Greeff fd93fbc4a6 Support new versioned metadata format (#632)
* Start something...

* Parsing via proxy (everything still all-ok)

* Imp[ort order (minor)

* WIP expanding the structure

* Adjust V1 structure

* Parsing seems to do the trick...

* Add CodeHash and Schedule types

* //v0/ -> /v0/

* Update Extrinsic.ts

* Updated with compact outerDispatch, non-throw construction

* v1 to V0 conversion

* Bubble non-magic errors in constructor

* Update e2e after testing them

* Bump version with CHANGELOG  (potentially breaking change)
2019-01-26 16:27:00 +01:00
Jaco Greeff 25c18bb399 Pull in latest contract types (#634) 2019-01-24 18:09:09 +01:00
Jaco Greeff 10bdaf518a Check actual valueOf in bool for yes/no (#633)
* Check actual valueOf in bool for yes/no

* Add test for false encoding
2019-01-24 14:38:20 +01:00
Jaco Greeff 843f374ca7 Misc small cleanups (#625)
* Misc small cleanups

* Bump deps
2019-01-23 22:10:38 +01:00
Jaco Greeff 52718d76f7 Add .eq to Codec (#622)
* Add .eq to Codec

* Tests for Codec .eq

* Extra ()'s around checks

* Update AbstractInt.ts

* Use .size in Map compare

* Equivalency comment

* Update Compact.eq to user wrapper eq
2019-01-23 13:29:03 +01:00
Jaco Greeff a1c64be28c ValidatorPref threshold -> Compact<u32> (#613) 2019-01-21 13:38:26 +01:00
Jaco Greeff cfd71db468 Allow EnumType to decode isHex (#611)
* Allow EnumType to decode isHex

* Consistently use string (not String/string mix)
2019-01-21 10:30:04 +01:00
Jaco Greeff 15721c16a6 Make U8aFixed always return the correct length (#605)
* Make U8aFixed always return the correct length

* compact isEmpty check

* Revert unsigned-as-long-string

* Skip extra object allocation

* Shortcut version encoding

* Move isEmpty to U8a (base)

* Slightly more optimal set (only when needed)
2019-01-21 10:29:32 +01:00
Jaco Greeff 0d29925406 ValidatorPrefs has Compact<Balance> (#604) 2019-01-21 10:29:09 +01:00
Xiliang Chen 97c6eca01f fix peerId mapping (#608) 2019-01-21 00:37:10 +01:00
Jaco Greeff db832f0207 Add derive.chain.{getHeader,subscribeNewHead} with author (#602)
* Add derive.chain.{getHeader,subscribeNewHead} with author

* tslint cast, ignore
2019-01-18 14:44:55 +01:00
Jaco Greeff a3e421f665 Allow for balance/indices lookups (#596)
* Allow for balance/indices lookups

* Latest metadata

* Indices work

* Update json with actual decoded

* Update Type.ts

* Some tests updated

* Update final tests

* Remove .only from derive e2e (really skip it)
2019-01-17 15:11:50 +01:00
Jaco Greeff 695e4f2cad AccountId toString() with isEmpty (#592)
* AccountId toString() with isEmpty

* isEmpty is real isEmpty check
2019-01-16 10:05:46 +01:00
Jaco Greeff 0576375a2b Add isEmpty to AccountId (#583) 2019-01-14 14:42:51 +01:00
Xiliang Chen 9a4973237e Fix Compact decode hex value (#582)
* decode header is broken

* Ignore length for Compact isHex check
2019-01-14 07:49:59 +01:00
Jaco Greeff 8f698d7964 As gettters, as{ContainedType} to EnumType (convenience) (#579)
* As as{ContainedType} to EnumType (convenience)

* Use as inside phase filter

* asFinalised in SubmittableExtrinsic

* Cleanup imports (lint)

* Cleanup imports (linting)
2019-01-12 16:05:21 +01:00
Jaco Greeff 1f401d6791 Add system_peers RPC endpoint (#577)
* Add system_peers RPC endpoint

* Don't double-up on error logs
2019-01-12 09:22:27 +01:00
Jaco Greeff a2f176dca7 Construct Bytes via Array<number> (no prefix) (#573)
* Construct Bytes via Array<number> (no prefix)

* Remove unused imports

* Allow extrinsics with/without prefix
2019-01-11 16:59:34 +01:00
Jaco Greeff 132a8dd4ed Align fromHex in AbstractInt with toHex (and with actual BE JSON) (#571)
* Align fromHex in AbstractInt with toHex (and with actual BE JSON)

* Update test (hex input in BE)
2019-01-11 14:16:49 +01:00
Jaco Greeff 6ddc9e408c Support and return default values (#547)
* Support and return default values

* e2e tests for queries, with and without defaults

* remove .only

* Remove unused Codec import

* Remove commented import

* Add default creation test

* Test creation with empty Bytes

* Default storage test

* Remove non-existent throw test
2019-01-09 16:04:56 +01:00
Amaury Martiny 483a66257a Update metadata (#550) 2019-01-08 14:30:39 +01:00
Jaco Greeff d9655f8a21 Allow Tuple types defined as struct or Array (#548)
* Allow Tuple types defined as struct or Array

* Update tests (not requiring injection)

* Update KeyValue.ts
2019-01-08 14:28:07 +01:00
Jaco Greeff d589a1bbfd Compact<Index> in extrinsics (#515)
* Basic compact index

* Nonce is only used in signatures, alias it

* typo

* s/NonceCompact/IndexCompact/

* Update tests
2019-01-08 14:21:14 +01:00
Jaco Greeff 7f316b6864 Merge branch 'master' of github.com:polkadot-js/api 2019-01-08 13:39:45 +01:00
Jaco Greeff 8bb40cf5a9 Add sytstem_health rpc endpoint 2019-01-08 13:39:38 +01:00
Jaco Greeff 783db16cea Consistency in exposing header hashes (#546)
* Consistency in exposing header hashes

* Cleanup comments
2019-01-08 13:18:09 +01:00
Jaco Greeff 95af8dbb6d Ad link to substrate storage section (#535) 2019-01-06 11:23:30 +01:00
Jaco Greeff d1a4415be9 Subscription method rendering (#532)
* Subscription method rendering

* Update MetadataMd.ts
2019-01-06 11:05:36 +01:00
Jaco Greeff 6678d7255c Remove api-observable (#530)
* 2019

* Remove api-observable

* tuples (SomeLonelyType) -> SomeLonelyType

* Bump to 0.37.0
2019-01-04 16:18:44 +01:00
Jaco Greeff 3be56ad56c Subscriptions return unsubscribe/dispose function (#527)
* Combinator return unsubscribe/dispose function

* Submittable extrinsics return UnsubFunction

* RPC methods with unsub callback returns

* Update changelog, bump version

* CHANGELOG typo

* Fix combinator unsubscribes

* Be explicit in returns for UnsubFunction (combineLatest)
2019-01-03 16:31:09 +01:00
Jaco Greeff fb36c59f34 Expose H256 & H512 types (#519) 2018-12-29 17:18:37 +01:00
Jaco Greeff 85434e082b Bump util, min compact bitlength (#516) 2018-12-25 13:58:58 +01:00
Jaco Greeff 1e880757e4 Update to latest util for Compact (#511)
* Update to latest util for Compact

* Expand FIXME comments
2018-12-21 13:38:38 +01:00
Amaury Martiny db953403ba Let static use the RPC response json directly (#509)
* Let static use the RPC response json directly

* Put data in static

* Remove useless file
2018-12-21 13:17:45 +01:00
Jaco Greeff 4a9069e495 Allow registry to create via object/string definitions (#503)
* Allow registry to create via object/string definitions

* typo
2018-12-21 11:19:11 +01:00
Jaco Greeff 900da0c852 Pull in large-value Compact encoding changes (#508)
* Pull in large-value Compact encoding changes

* Update size check
2018-12-21 10:32:11 +01:00
Amaury Martiny 51751d0781 Add support for default values (#484)
* Create AbstractInt

* Use abstract class

* Bump packages

* Allow decoding metadata with default values

* Add console.logs

* Add latest rpc

* Add Bytes decode

* Get encoded lenght right

* Remove useless tests

* Add getter

* Metadata json with default as hex

* FIx bugs

* Fix lint

* EOF add line

* Remove file

* Update latest rpc

* Update static.ts

* Typo

* Don't create types for default values for now, leave as Bytes

* Update & skip tests

* Remove unused file
2018-12-20 20:33:32 +01:00
Amaury Martiny b934846248 Add missing types (#504)
* Update rpc

* Simplify Type

* Create AbstractInt

* Add integers

* Add missing types

* Add tests for negative numbers

* Use abstract class

* Fix comments

* Bump packages

* FIx bugs

* Fix lint

* EOF add line

* Fix comment

* Typo
2018-12-20 18:12:25 +01:00
Jaco Greeff 919a73ccf6 Allow new Extrinsic(method: Method) (#499)
* Allow new Extrinsic(method: Method)

* Update types

* Be explicit in returned types

* Submittable with Method constructor
2018-12-20 12:21:03 +01:00
Jaco Greeff caff93941b Method -> Extrinsic circular dep (#495)
* Method -> Extrinsic circular dep

* Cleanup test formatting
2018-12-19 14:43:30 +01:00
Jaco Greeff 33a4280028 Expand ExtrinsicStatus to mirror Rust types (#494)
* Expand ExtrinsicStatus to mirror Rust types

* Remove .only

* Update test expectation

* typo

* Invalid extends Null

* Remove debug log
2018-12-19 13:39:20 +01:00
Jaco Greeff 5b978246a7 Remove circular imports from types (#492)
* Remove circular imports from types

- These are creating issues on RN and is not correct
- Uint is equivalent to BN (extends it), so remove it.
- Don't import all classes (it imports types itself) - CodecTypes can be exposed elsewhere if needed

* Cleanup linting & imports

* Cleanup compact decoding
2018-12-19 09:29:53 +01:00
Jaco Greeff 4ef8bd36c3 Add missing Polkadot (parachains module) types (#491)
* Add ParaId (u32, originally ParachainId)

* Add AttestedCandidate (setHeads)

* Bump dependencies

* Cater for latest.substrate.json rename

* Update version deps
2018-12-18 16:46:39 +01:00
Jaco Greeff edfd62558f Allow creating Struct from JSON (#489)
* Allow creating Struct from JSON

* Fix Struct import
2018-12-18 16:26:42 +01:00
Amaury Martiny 46b10a0874 Factorize some u8a decoding logic (#483)
* Simplify decoding u8a

* Move to another folder

* Refactor isU8a in struct

* Remove ts ignore

* Whitespaces

* Don't modify input args
2018-12-18 10:40:25 +01:00