Commit Graph
193 Commits
Author SHA1 Message Date
Jaco Greeff c4ba8ca64d Add ts-check for examples (#705)
* Add ts-check for examples

* Typing cleanups, now shows properly

* Bump

* Cleanup checks

* Bump keyring
2019-02-16 12:25:53 +01:00
Jaco Greeff 4735253cbd Bump deps (#702)
* Bump deps

* Update keyring
2019-02-15 17:38:49 +01:00
Jaco Greeff 15b22dab1c Allow indexOf to work with Codec eq (#699)
* Allow indexOf to work with Codec eq

* Convert to type before check

* Swap compare (in case of empty/invalid values)
2019-02-15 10:52:00 +01:00
Jaco Greeff ead67ec9d6 Integrate new keyring (#693)
* Integrate new keyring

* Bump

* Bump version

* ed25519 dusl-support
2019-02-14 23:17:02 +01:00
Jaco Greeff b88b6646af Additional export cleanups (root & types) (#694) 2019-02-13 21:12:49 +01:00
Jaco Greeff f95763906e Add codec exports to types index (#689)
* Add codec exports to types index

* Use actual index exports (internally)

* Merge {AccountId, Balance, Moment}Of into parent classes
2019-02-13 16:00:59 +01:00
Jaco Greeff b754ea6ffb Expose #687 on index (#688) 2019-02-13 10:02:49 +01:00
Jaco Greeff 0ef15dc547 Add {AccountId, Balance, Moment, Seed}Of (#687) 2019-02-12 17:40:40 +01:00
Jaco Greeff acc318761e Fix encodedLength for non-ascii strings (#684) 2019-02-12 11:28:52 +01:00
Jaco Greeff dbd37da72f Allow enum definitions via JSON (#681)
* Allow enum definitions via JSON

* Return only type of type & value via toString()

* Remove displaced console.error

* Fix toString tests
2019-02-11 15:46:10 +01:00
Jaco Greeff 96624a6d66 Allow boolean decoding for Vote constructor (#677) 2019-02-11 12:52:15 +01:00
Jaco Greeff 6d759cd234 Add api.registerTypes (#670) 2019-02-09 08:02:47 +02:00
Jaco Greeff c1a6f0230c Cater for signature over hash (with version checks) (#655)
* Cater for signature over hash (with version checks)

* Allow Submittable signAndSend

* isUndefined for nonce check

* .sign with backwards compat

* e2e tests started

* Work around optional callback for Promise

* Commit actual e2e test

* Promise allows for submitExtrinsic

* e2e tests are passing

* Bump version, update CHANGELOG
2019-01-31 18:01:14 +01:00
Jaco Greeff 661cb3c453 Codec types (call definitions in API) (#650)
* Codec types (call definitions)

* Pass Codec & Subscription generic types

* WIP typing

* Typing seems ok

* Linting

* Queryable storage retuns Hash & U64 for .hash and .size

* Better typing for SubmittableExtrinsic

* Indentation.

* Update with needsCallback

* Update SubmittableExtrinsic.ts
2019-01-31 14:15:59 +01:00
Jaco Greeff aea223f024 Updates for V1 formatting changes (#651)
* Updates for V1 formatting changes

* Rework V1 with the new simplified structures

* Parsing parses

* asV0 in-place, rework class splits

* e2e testing completed

* Update args, docs & fallback (shorter, non-collision naming)

* More v0-like event output
2019-01-30 15:41:49 +01:00
Jaco Greeff 82531493da Option unwrapOr helper (#652)
* Option unwrapOrNull helper

* unwrapOrNull -> unwrapOr
2019-01-30 15:40:59 +01:00
Jaco Greeff 383573658b Auto-convert large numbers to hex, smaller as number (#647)
* Auto-convert large numbers to hex, smaller as number

* Update tests
2019-01-29 17:09:54 +01:00
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