Commit Graph
11 Commits
Author SHA1 Message Date
Jaco Greeff 0c906e54f8 Properly toJSON() on StorageFunction (#179)
* Properly toJSON() on StorageFunction

* Add isZero(), cmp & toStringFormat

* Update tests for UInt toString()
2018-10-01 16:33:01 +02:00
Jaco Greeff 4fc0eedbe8 Expand e2e (#178)
* Expand e2e

* Add toJSON method for StorageFunction
2018-10-01 15:18:56 +02:00
Jaco Greeff 876c34c532 E2E testing (#177)
* Move e2e tests to provider

* Rx subscriptions

* Import @polkadot/api-provider, fix package names

* Decrease verbosity, skip all e2e tests
2018-10-01 14:11:43 +02:00
Jaco Greeff 782bb8063c Pull in observable API from UI (#175)
* Pull in observable api...

* Progress changing stuff...

* votingBalance

* Update resul types

* Expose toBn on Moment

* Rework... WIP

* ... More type cleanups

* Linting passes

* BN helpers for UInt

* Update api-observable

* Add api-observable package.json

* Allow Struct/Tuple to create from hex string

* Future-proof Length with bitLength (u64/u128 compant encoding PR out)

* Make Compact number encoding shareable

* Split Api into functional sections

* Cleanup types

* Additional per-use comments

* Remove params/primitives from README

* api-format  -> api-codec

* Whitespace.
2018-10-01 11:22:15 +02:00
Jaco Greeff b3a95b58ed Cleanup jsonrpc, refer to api-codec (#174)
* Cleanup jsonrpc, refer to api-codec

* Move storagekey legacy into type-params (legacy)

* Remove misplaced debug log

* Remove header encoding, use api-codec/Header

* Remove legacy types

* Add metadat array (hack around json import)

* Move json metadata to ts
2018-09-28 18:35:39 +02:00
Jaco Greeff 74737b6367 API formatting for inputs & outputs (#171)
* API formatting for inputs & outputs

* Shorten naming

* getStorage (signle key) operational

* Remove api-format (not used in api anymore)

* Cleanup creation logic

* Cleanup linting

* Cleanup storage creation

* e2e state test

* Add code test

* Add isBare flag to toU8a

* Uppercase... wtill wrong though

* Update metadata json

* We are creating keys properly

* Cleanup tslint

* Type splitting,m handling Tuple & Vector

* StorageChangeSet results in-place

* Update deps

* Allow Tuples to have array constructors

* Test for uncloded vec/tuple

* Update deps
2018-09-28 15:42:23 +02:00
Jaco Greeff 773358195a Round out metadata types (#169)
* Fake Origin for compatibility

* Add Gas

* Add Moment

* Cleanups

* NewAccountOutcome

* Permill & Perbill

* PrendingExtrinsics -> PendingExtrinsics

* Extrinsics & PendingExtrinsics

* Alias String -> Text (as found in jsonrpc, expose it)

* MetaDate -> Metadata (compat)

* Add StorageData, StorageKey & ChangeSet

* Cleanup comments

* Comment update

* Comment typo

* Add ParachainId

* Add Tuple type

* Tuple tests

* Clenaup Tuple generics

* Expand comment

* Expose keys/values on struct

* Array-like at -> get

* Cleanup & simplify EnumType

* Use setValue internally to fromU8a

* Add RuntimeVersion

* Expose RuntimeVersion
2018-09-27 12:42:20 +02:00
Jaco Greeff dfd2e70931 Expand types & tests (#166)
* RegEx for alias

* Expand tests

* Cleanup naming

* Options & Struct tests

* Cleanup Length with tests

* Enum tests

* TODO... expand/question assumption

* Remove extra line

* Hashin tests (commented, encoding change)

* Export Type on Vector & Struct

* Test Type & Base

* Address FIXME & additional test

* Cleanup TODOs

* Add MisbehaviorReport

* Add index.ts combinators

* typo in export

* Comment typo

* Update index.ts

* Update MisbehaviorReport.ts

* Update MisbehaviorReport.spec.js

* Extract Bft, add SignedBlock (allow anonymous structures)

* <foo>Struct -> <foo>Value (for constructor args)

* AnyNumber/U8a types for inputs (PR comment)

* Comment struct generics

* Typo in comment

* Simplify StorageFunctionType construction

* Fix liniting (wtf?)

* Fix linting & tests, make more robust
2018-09-26 14:33:12 +02:00
Jaco Greeff 964bf84b83 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
2018-09-25 18:22:25 +02:00
Jaco Greeff 60d3d6396a Expand api-codec types (#163)
* Add missing U* (number) types

* Missing number types & indexes

* Add H256, H512, Hash & Signature

* Add Bool, KeyValue & U8a (base)

* Fix LengthCompact encoder (with tests)

* AccountId

* AccountId toU8a

* Order imports

* Apply type aliasses, PropIndex -> ProposalIndex

* Cleanup mappers

* Add fromJSON to Type

* Spliut with Address, AccountId & AccountIndex

* Add some comments around the types

* instanceOf check

* Address can construct from AccountIndex or AccountId

* Remove Address.encode (unused)

* Allow instance of class in constructor

* Cleanup instanceof (String, Bool, H256, H512)

* AccountId/AccountIndex check around CodecU8a

* Fix unused imports

* Additional in-constructor instanceof constructions

* u8a allows hex, string or u8a inputs

* Metadata.fromJSON

* Add Header

* Allow CodecNumber to take hex/string inputs

* fromJSON uses decoder

* Remove LengthFixed (only compact used), add tests

* Some tests around Type

* Remove unused package

* PR comments

* Expand tests (and fix some bug - yay for tests)

* Rename /base -> /codec
2018-09-25 13:33:28 +02:00
Jaco Greeff d9b05cf9f2 Decode runtime metadata (#162)
* WIP

* Some output, still borken...

* Events decoded correctly

* WIP, metadata decoded

* String cleanups

* Expand with generics

* Add getters

* Start docs...

* Additional docs

* Extra whitespace on Compact

* CodecLength FIXME

* Remove FIXME (impl. takes care)

* Swap in LengthCompact encoding

* Extend docs, play with auto-type for struct

* Trim strings, add Type for type-specific String

* More string-type hackery

* Don't allow Type re-encoding

* Remove struct experiment

* Cleanup Option

* Remove extra type defs from CodecStruct usage

* Expand Storage function with map (and type returns)

* Description around BaseCodec

* Cleanup linting, add Metadata test

* Move to api-codec

* Extract uniq types

* Uniq updates

* Unwrap, ungeneric
2018-09-24 13:51:20 +02:00