Commit Graph
39 Commits
Author SHA1 Message Date
Stefanie DollandAmaury Martiny c01ade86a6 Convert tests to ts and fix existing (#936)
* Add jest watch option to package.json

* convert promise-alex-spec to ts & add types

* convert ./api tests from JS to TS

* convert ./api tests from JS to TS pt. 2

* More convert tests from JS to TS

* rpc-provider convert tests from js to ts

* rpc-provider tests js => ts

* rpc-provider tests js => ts

* linting issues

* tslint fixes

* 101 => 68 typescript errors

* WIP

* connect() e2e tests

* more fixes

* Fix linting errors of new ERA tests after merge

* test for listeners in connect

* formatting

* getting there...

* re-add skips

* test refactoring & codeclimate fixes

* more fixed tests

* mock.body workaround

* Fixed wrong test description

* ApiPromiseInterface => Api

* ws polyfill / send

* bring back isZero() test

* .then().catch() => .catch()

* Removed leftover body

* Type ProviderInterface => Http

* Fixed polyfill tests

* trailing whitespce

* (mock.body as any)['test_body'] and Balance

* Fix autoconnect in WsProvider

* Fixed part of linting errors in ERA tests

* call unused const unsubscribe

* added ts-ignores for testing private properties/ methods of Provider

* Archive node test

* Fixed linting for ERA tests

* Further changes

* Update packages/rpc-provider/src/ws/polyfill.spec.ts

Co-Authored-By: Amaury Martiny <amaury.martiny@protonmail.com>

* relative paths for imports inside module & reordering of imports pt. 1

* relative paths for imports inside module & reordering of imports pt. 2

* added skip back to e2e transactions

* Fix some more tests in TS (#952)

* Fix some more tests in ts

* Add more constructor

* More typing in ./api

* .skip

* <SubmittableResult>'s

* .catch() -> return()

* Extrinsics tests

* Left TODO's for extrinsic e2e tests

* Workaround for failing Type Extrinsic tests
2019-05-27 17:08:06 +02:00
Jaco GreeffandAmaury Martiny f8f05ba21e Show section.method on storage read error (#928)
* Show section.method on storage read error

* Update packages/types/src/primitive/StorageKey.ts

Co-Authored-By: Amaury Martiny <amaury.martiny@protonmail.com>

* Update StorageKey.ts
2019-05-17 14:39:17 +02:00
Jaco Greeff 03234a0cc9 Codec Fallback on createType (along with pedantic) (#929)
* Codec Fallback on createType (along with pedantic)

* Updates for numbers (fix failing tests)

* Add isPedantic to linked
2019-05-17 14:07:51 +02:00
Amaury Martiny 2b538f5f58 refactor: Metadata overhaul (#913)
* Replace part1

* Replace part2

* Replace part3

* Replace part5

* Replace part6

* Fix small bugs

* Fix double map toString

* Small fixes

* Update to v4

* Fix docs script

* Grumbles

* Alphabetical

* Reads better

* comment

* module to modul
2019-05-16 12:57:51 +02:00
Jaco Greeff 7b04ea0bfe new EventRecord with topics (#902)
* new EventRecord with topics

* Add additional decoding checks (from #612)

* Slightly rework storage parsing (future checks)

* Split storage result formatting (set vs data)

* Allow v3 event parsing

* Max Vector length check

* assert during Event parsing

* Well, HACK-y fallback

* Revert "Well, HACK-y fallback"

This reverts commit edbf61b99da2753bec3a535126660e71bdcd9861.

* Node overrides...

* Add implVersion

* Register types

* Update with polkadot as well

* inject compatibility types

* EventRecord77 in testing

* Conversion with DoubleMap

* E2E tested against v3 & v4

* Filter with some

* Split archive/remove alex tests

* beforeAll -> beforeEach

* Remove .only

* EventRecordV0 -> 77
2019-05-15 08:07:23 +02:00
Amaury Martiny 4dd320fc89 Use custom hasher for Map (#857)
* Use blake2 instead of two_x

* Add v4

* Update to new v4 static

* Update json

* Revert

* Use hasher enum

* Fix metadata v4 test

* Fix metadata v4 test

* Fix versioned metadata

* refactor & clean

* Use consistent naming

* Make jsons consistent

* Add backward compat

* Fix tests

* Start working on type-storage

* Fix output

* Grumble

* Update to latest static

* Clean code

* Fix imports

* Remove useless imports

* Fix tests

* Use prettier output for toJSON in metadata

* Implement different hashers

* Remove generic storageKey

* Bump version

* Add backwards-compat

* Fix hashing function, use Twox128

* Grumbles

* Add tests
2019-04-25 15:34:35 +02:00
Jaco Greeff e2b15adaf2 Update keyring, new ss58 checksums (#812) 2019-03-29 15:16:11 +01:00
Jaco Greeff 6fef86cc78 Adjust support fo US English as per substrate (#811)
* Rename ExtinsicStatus Finalised -> Finalized

* Finalised heads -> Finalized
2019-03-29 14:12:56 +01:00
Jaco Greeff cda0ef3486 Linked map support (#801)
* able to get head

* head actually working

* Correctly get linkage

* I think it is working

* Results now return both keys and values
2019-03-27 15:34:11 +01:00
Jaco Greeff 34888bd4fb Remove /index imports (swap to bare) (#773)
* Remove /index imports (swap to bare)

* Bump common
2019-03-14 09:02:55 +01:00
Jaco Greeff b313614935 Pull in vuepress foir docs (as opposed to gitbook) (#742)
* Pull in latest @polkadot/dev, cleanup existing *.html

* Cleanups (old gitbook interfaces)

* Bump, WIP

* Ready for testing

* Update examples

* Include source

* Cleanup links

* Adjust links

* Add typedoc exclusions

* Default classes from class files

* Adjust imports

* Adjust config

* Re-add types split

* Update links to substrate interfaces

* Anchors for metadata

* Adjust links

* Restore HTML (to be deleted on CI)

* Bump deps

* Re-gen yarn.lock

* Remove a in links

* Adjust interfaces
2019-02-26 15:21:39 +01:00
Jaco Greeff 8a946aeaa1 Option create, order of checks (#733)
* Option create, order of checks

* Alphabetical
2019-02-22 10:50:48 +01:00
Jaco Greeff f8bd74ee85 Cleanup Option result value handling (#731) 2019-02-22 09:58:24 +01:00
Jaco Greeff 67a1bccb48 Construct Option new via type instance (#721) 2019-02-19 21:15:52 +01:00
Jaco Greeff f807a93e87 Handle storage with optional modifiers (#717)
* Handle storage with optional modifiers

* Storage docs indicate Option

* Cleanup Option logic

* Convert Optional derive to use Option

* Bump version, update changelog

* Update CHANGELOG description

* Enum.spec.js -> Enum.spec.ts

* Add isEmpty to primitive types
2019-02-19 13:47:36 +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 a2f863c56b Expose api.disconnect() (#664)
* Expose api.disconnect()

* Noop for non-WS disconnects
2019-02-08 16:32:38 +02: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
Jaco Greeff 70ff3c5dfc Use rpc-rx internally to api-promise (#539)
* Use rpc-rx internally to api-promise

* Don't swallow errors

* Remove unused imports
2019-01-07 15:44:15 +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 50103dcfab WS error logging & stacks trimmed (#448)
* Cleanup error stacks

* Close error code & reason

* Re-add debug throw

* Remove stack

* Cleanup console checks (bullsh*t, wtf did I add these anyway)
2018-12-07 10:07:20 +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 4805f9cb36 Update LICENSE and README (#408)
* Update LICENSE and README

* Bump
2018-11-21 13:37:27 +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 49136de47b Catch errors while subscribing (#385) 2018-11-08 13:56:51 +01:00
Jaco Greeff cb9a48dc15 Allow construction of all types via U8a (#382) 2018-11-07 20:38:12 +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 55ac4626d5 Cleanup imports from @polkadot/util (#315)
* Cleanup imports from @polkadot/util

* Example imports

* Alphabetic imports
2018-10-18 13:30:04 +02:00
Amaury Martiny 106c59d341 Don't use fromJSON/fromU8a anywhere in code (#298)
* Don't use fromJSON/u8a anywhere

* Remove useless cast

* Nicer formatting
2018-10-16 12:35:40 +02:00
Jaco Greeff 78101e1292 Update subscription naming handling (#266) 2018-10-12 15:39:00 +02:00
Jaco Greeff f8d9f1c76e Align all RPC methods with Rust (#264)
* Align all RPC methods with Rust

* Adjust tests for extrinsicUpdate (e2e & working)

* Update transfer.spec.js

Auto-complete imports removed
2018-10-12 14:47:22 +02:00
Jaco Greeff 8fafedcf00 Extend examples for ApiPromise (#261)
* examples-rpc -> examples/rpc

* 01-simple-connect

* 02-chain-newHead

* Subscriptions only return value
2018-10-12 11:19:35 +02:00
Jaco Greeff 2b88a8f43c Expand API documentation (#259)
* Expand API documentation

* Cleanups

* Structuring

* Checks & cleanups
2018-10-11 20:56:42 +02:00
Amaury Martiny f5948fee52 Intelligent constructor (Part 2) (#252)
* Fix AccountId

* Fix AccountIndex

* Add Bool

* Fix Address

* Small fixes

* Fix Bytes

* Fix ExtrinsicSignature

* Small fixes

* Sorta fix Method

* Fix Extrinsic

* Fix method

* Fix Bytes and KeyValue

* Fix Moment

* Length-prefix the storage key

* Fix Bytes prefix

* Add comment
2018-10-11 13:39:27 +02:00
Jaco Greeff 27b2885722 Extend ApiRx from abstract Base (prepare for promise) (#243)
* Extend ApiRx from abstract Base (prepare for promise)

* Update Metadata parsing

* Update Base.ts

* Update types.d.ts

* Cleanup base

* Cleanup linting (renamed imports)

* PR comments

* Update decoded Metadata.json
2018-10-11 10:20:54 +02:00
Jaco Greeff 7180f8958e @polkadot/api/rx (#233)
* api-rx (new)

* Update SubmittableExtrinsic.ts

* Update types.d.ts

* Update index.ts

* Retrieve genesisHash

* extrinsics -> tx, state -> st

* Update index.ts

* Type cleanup

* Update index.ts

* Update index.ts

* Update index.ts

* Sign returns SubmittableExtrinsic

* Example cleanup

* Move to api-rx package

* Add connected/disconnected events

* Expand storage creation

* isReady/isConnected

* Add static create

* Cleanup docs

* Cleanups

* ReplaySubjects

* Basic tests

* Add runtimeVersion

* Test for version, meta & hash

* Package location

* Expand README

* 2 ways of init

* whenReady -> isReady

* api-rx -> api/rx

* Namings
2018-10-10 20:18:48 +02:00
Luke Schoen bba764bd28 feat: Fixes #210. Add Mermaid.js Gitbook plugin. Generate API flow diagram (#211)
* feat: Add Mermaid.js Gitbook plugin. Generate API flow diagram

* fix: Remove HTTP from diagram. Change text to funnel user to WS
2018-10-10 13:16:36 +02:00
Jaco Greeff 4344f33de8 First stage renames, rpc-{core,provider,rx} (#220)
* Docs renames (& removal for re-gen)

* Rename api, api-provider & api-rx

* Apoi -> Rpc, RxApi -> RpcRx (classes)

* Add .nodoc

* Bump version

* Link updates (summary)

* Cleanup deleted (master version)

* Deleted re-instated

* More... ;)

* Types...

* Revert .nodoc
2018-10-10 10:01:34 +02:00