Commit Graph
80 Commits
Author SHA1 Message Date
Jaco Greeff bed3f9f4c5 Add rpc_methods (#1397)
* Add rpc_methods

* Adjust interface tests

* Add account_nextIndex & contracts_call, filter

* Rework AbstractArray includes with some

* Adjust tests

* Ordering

* Correct definitions (pull in from methods)

* Be agressive on filtering, regardless of isOptional

* async/await in filterRpcMethods

* map Text[] -> string[]

* Correct naming for account_nextIndex

* Remove/don't remove rpc_methods as applicable

* Cleanup method handling errors
2019-09-16 11:40:54 +02:00
Jaco Greeff bdd0cb9d9a Remove ExtError from use (removed from util) 2019-09-10 17:55:02 +02:00
Amaury Martiny b889e56b34 Make author_insertKey public arg required (#1366)
* Make author_insertKey public arg required

* Remove blank line

* Build interfaces

* Rename to publicKey
2019-09-04 13:06:11 +02:00
Jaco Greeff 2dd7cc0e69 Typescript-eslint 2 (#1353)
* Make a start

* More minor cleanups

* Some more cleanups

* Last round?

* Exclude build folders
2019-09-02 07:01:32 +02:00
Jaco Greeff 97a5b16320 chain.getRuntimeVersion -> state.getRuntimeVersion (#1341) 2019-08-25 09:02:30 +02:00
Jaco Greeff 895ed80449 subscribeNewHeads (#1338)
* subscribeNewHeads

* Update CHANGELOG

* Rebuild interfaces

* Sort interfaces, really expose plural

* Fix mocks
2019-08-24 12:10:42 +02:00
Jaco Greeff c7c76f6edb Rework uniqTypes without duplication (#1316)
* Rework uniqTypes without  duplication

* Extra info for vX -> v7 conversion

* Add vX to naming

* Rework unwrap return

* Ignore gathering unique for v0

* Fix getUniq for V0 (well, def. throw-away, but anyway...)

* compareMap cleanup

* Cleanup author extraction

* Add modules via Struct.with (Metadata)

* Revert "Add modules via Struct.with (Metadata)"

This reverts commit 0666c3014cf840fb4ab26a5231cdf67dbe977bd7.

* Consistency in injected vs defined classes (Metadata)

* Add isTrue/isFalse to Bool

* Meta PlainType/MapType in registry

* Fix wrong v6 imports

* Extract storage modifier

* Split additional Metadata classes into interfaces

* Minor cleanups in type naming

* Static json renames

* Convert most V0 classes to interfaces

* Additional meta classes to interfaces

* No classes for Metadata V0 & V1 anymore

* Rename json imports

* Base cleanups

* Add polkadot static
2019-08-18 15:01:21 +02:00
Jaco Greeff fbac330e10 Minor readability enhancements (#1313)
* Minor readability enhancements

* Split unwieldly ApiBase

* Fix import case

* Some movements, init in root

* Simplify overloaded functions

* Some more reworks

* Hoist non-class functions

* Flatten

* Split decorate and init

* Split meta from chain

* getNext cleanup
2019-08-16 00:42:54 +02:00
Jaco Greeff 9954477de3 Some small complexity/readability improvements (#1309)
* Some small complexity/readability improvements

* Bump allowed returns to 5

* Revert override (as limiting as it seems)
2019-08-14 20:25:20 +02:00
Jaco Greeff 4115b8a4cc Cleanup & split createType (#1307)
* Cleanup & split createType

* createType import

* Reduce complexity somewhat

* Simplify wrapper check

* Revert "Simplify wrapper check"

This reverts commit e072c7e05e30e68994152af0b5d7b624dc38bba1.

* de-dup getTypeClass

* Explicit extraction, cleanup getTypeDef

* De-dup subType extraction

* createType move
2019-08-14 14:06:45 +02:00
Travis CI 230898ca04 [CI Skip] 0.90.0-beta.50 2019-08-14 05:48:42 +00:00
Jaco Greeff e5cc6836eb BlockNumber, Nonce -> u32 (#1284)
* BlockNumber -> u32

* Interface types extend, not re-use

* Merge master, rebuild

* Merge typo

* Lazy create struct types (extended definitions)

* Cleanup tests for Nonce u32

* Remove polkadot u64 BlockNumber (substrate default)

* Warn on type dup & still clear

* Allow type overrides to work at any point
2019-08-11 15:07:00 +02:00
Jaco Greeff 40cf70f415 Add polkadot attestations types (#1286)
* Add polkadot attestations types

* Config updates (misc, non-related)
2019-08-10 00:45:37 +02:00
Jaco Greeff fbd6bf1317 Update Keys, add rotateKeys RPC (#1280)
* author_rotateKeys

* Update Keys encoding
2019-08-08 12:58:36 +02:00
Jaco Greeff 17063093bf Fixup cache for multiple values (real length check now) (#1257) 2019-08-02 14:18:54 +02:00
Amaury Martiny 92044d471c Make api.rpc.*.* typed (#1237)
* Generate correctly

* Fix rpc-core

* Flexible types

* Make types work!

* Lint

* Fix grumble

* Re generate

* Fix lint

* Fix small bugs

* Maybe really fix lint?

* Fix lint again

* Fix lint

* Small ordering & formatting  changes while playing...
2019-08-01 10:46:28 +02:00
Jaco Greeff 19c3e4b510 Don't apply value-caching on single-value subs (#1246) 2019-07-31 22:15:08 +02:00
Jaco Greeff ddc46ed237 Re-add StorageData from 0.82.0-beta.96 (not an alias) (#1240) 2019-07-31 09:07:44 +02:00
Jaco Greeff c31bd20c6a Remove Promise chain, fix formatting test subscription (#1218) 2019-07-28 00:20:43 +02:00
Jaco Greeff 99368a6d4d createType allows multiple params (#1207) 2019-07-27 08:05:11 +02:00
Jaco Greeff 02cd1331aa Move Event, Address, AccountId, AccountIndex to generic (#1202)
* Move Event, Address, AccountId, AccountIndex to generic

* Move AccountId, AccountIndex, Address & Event to generic

* Move Vote
2019-07-26 16:39:28 +02:00
Amaury Martiny 441148889d CreateType is typed, add createTypeUnsafe just in case (#1199)
* Use unsafe internally

* Add comments

* Remove <> in createType

* Fix lint

* Fix classOf

* Remove createType from Text

* Fix lint

* Fix Fallback type

* Fix fallback in createType
2019-07-26 14:00:25 +02:00
Jaco Greeff 2a37b8746d Rename srml to interfaces (#1198)
* Rename srml to interfaces

* newline, package.json
2019-07-26 12:08:17 +02:00
Jaco Greeff 700eb7e1f4 Remove injectDefinitions import, prefer injector (#1195)
* Convert RPC classes to primitive classes or /srml types

* Lint passes... lokking at tests next.

* Tests pass.

* Types with basic docs (lots of work here)

* Update StorageKey.spec.ts

* Add injector to metadata doc generation

* Fix import

* Remove injectDefinitions import, prefer injector
2019-07-26 11:12:17 +02:00
Jaco Greeff 478f54c703 Convert RPC classes to primitive classes or /srml types (#1192)
* Convert RPC classes to primitive classes or /srml types

* Lint passes... lokking at tests next.

* Tests pass.

* Types with basic docs (lots of work here)

* Update StorageKey.spec.ts

* Add injector to metadata doc generation

* Fix import
2019-07-26 10:23:37 +02:00
Jaco Greeff 39323a8896 Convert all type/* (and some primitives) to srml/* (#1189)
* Convert (almost-all) non-primitives (and some primitives) to srml/*

* Move Vote to primitives, remove type folder

* Move Balance :-o

* Fixup tests, override Balance.toRaw()
2019-07-25 16:34:47 +02:00
Jaco Greeff 79e5f7c9cc Metadata v7 (#1182)
* Make a start... static is in, code copied as a start.

* Get exports (more-or-less) right

* Well, the v7/* tests pass... now just to tweak storage generation

* Linting is happy, it doesn't mean it will work...

* It compiles... ship it.
2019-07-24 21:34:51 +02:00
Amaury Martiny 66ab3ac502 Cache getTypeClass (#1183)
* Put memoizee only in types

* Add some tests

* Add failing tests

* Make instanceof work

* Better tests
2019-07-24 17:22:49 +02:00
Jaco Greeff 37022d2e23 Small rpc-core storage cleanups (#1168) 2019-07-24 12:47:50 +02:00
Jaco Greeff ebc2fbe3ee Move (some) from session & elections to srml/types (#1158)
* Move (some) from session & elections to srml/types

* Just use createType instad of (new ClassOf(type))(value)

* Cleanup generation script (import file duplication)
2019-07-23 11:47:45 +02:00
Jaco Greeff f9a3f3e53f Fix linked maps with defaults (#1162)
* isPedantic matches [] with isEmpty

* Fix undefined.undefined on  headKey

* Adjust fallback for linked maps

* Add tests for the linked map fallbacks (head and value)
2019-07-23 10:56:45 +02:00
Jaco Greeff dd7b138c02 Move contracts classes to srml/contracts (now as types-only) (#1153)
* Move contracts classes to srml/contracts (now as types-only)

* Exclude srml generated files from codeclimate

* Alos excluse types/src/scripts

* Replace Compact<T>.toBn() with unwrap()

* Fic compact type (#1156)

* Remove as unknown as T (T typing is working)

* Move interfaces back to the relevant types.ts
2019-07-22 14:49:08 +02:00
Jaco Greeff eaec0da2f5 Catch promise errors in subscription (#1138)
* Testcase for invalid tx (not caught)

* Re-enable commented tests

* Make the test pass

* Cleanup tests, check for promise to exist
2019-07-16 20:01:31 +02:00
Jaco Greeff 71c5920b1f eslint rules (#1099)
* Off to the races - 3760 problems (1794 errors, 1966 warnings)

* Convert Array<T> -> T[] (not all correct, eg. extends)

* () => { -> (): void  => {

* get is/as -> public get is/as

* public for getters, constructors & base Codec

* Some cleanups from previous overzealous search & replace

* Under 2k, 1874 problems (649 errors, 1225 warnings)

* ^^^ check that commit for details ;)

* Minor.

* rm config header

* Minor cleanups

* Default to tslint, eslint as option

* Trigger

* Update jsonrpc

* 1494 problems (433 errors, 1061 warnings)

* 1103 problems (135 errors, 968 warnings)

* 899 problems (9 errors, 890 warnings)

* 483 problems (9 errors, 474 warnings) (ignore any... for now)

* 366 problems (9 errors, 357 warnings)

* 336 problems (9 errors, 327 warnings)

* 148 problems (9 errors, 139 warnings)

* 31 problems (8 errors, 23 warnings)

* 0, 0
2019-07-14 12:15:14 +02:00
Amaury Martiny a3ce8672af Fix staking.info (#1091)
* Frankenstein

* Remove console.log

* Fix lint

* Remove console

* Fix tests

* Put back old version

* Add comment

* Store changeset data (filling in the blanks) (#1094)

* Store changeset data (filling in the blanks)

* Option(StorageData, null) when not available

* Make test pass
2019-07-10 13:08:32 +02:00
Axel Chalon 9abbaab991 Pull parameter_types! from metadata (#1066)
* @polkadot/{extrinsics,storage} moved to @polkadot/metadata

* Fix previous commit

* Fix previous commit

* Expose parameter types using api.consts

* Grumbles; update v6 static metadata; add UncleEntryItem (fix #1067)

* Update api.query.* to api.consts.* where changed

* Update tests and stray api.query.staking.sessionsPerEra

* Grumbles

* Grumbles

* Revert updates to api-derive (taken care of by #1068)

* Grumbles; fix UncleEntryItem

* Rename "@polkadot/metadata" => "@polkadot/api-metadata"

* Skip derive test

* Grumbles

* Grumbles

* Grumbles

* Cleanup merge, ensure metadata is latest

* Move api-metadata to actual api-metadata folder

* README api-metadata description (& folder link)

* Remove stray type-extrinsics package.json
2019-07-09 08:54:28 +02:00
YJ 7229a5fdfb feat: Metadata V6 with module constants (#1059)
* feat: metadata v6, minus static and test

* fix: update v5 to v6 everywhere

* fix: lint and testUtil

* fix typo

* fix: match final metadata. constants no longer optional, StorageFunctionMetadata renamed to StorageEntryMetadata.

* fix: constants constructor

* fix: unit tests pass

* fix: linting and renaming, make tests pass

* fix: skip e2e

remove console log

* fix: formatting test

* fix api e2e tests

* fix: put the skip back

* feat: yarn test:skip-e2e

* fix: grumbles, add fresh flipper wasm

* fix: grumbles, add fresh flipper wasm

* fix: changelog

* fix ci
2019-07-02 11:48:40 +02:00
Jaco Greeff b51761376b Fix StorageData checks, fix Option toHex 00/01 (#1052)
* Option.toHex should not add 00/01 (implied)

* Option tests

* We have a failing test, finally

* Adapt createType to cater for storage with length
2019-06-22 22:05:36 +02:00
Amaury Martiny fe16c09f01 refactor: Remove rpc-rx (#1037)
* Remove rpc-rx

* Make some stuff work

* Fix tests

* Update Base

* Change some stuff

* Remove rpc-rx mentions

* Add correct tests

* Make cache work

* Fix little bugs

* Rename to spec

* Fix lint

* Fix little bugs

* Add comment

* Add correct test

* Update header

* Add test

* Add comments

* Indentation
2019-06-20 11:06:13 +02:00
Jaco Greeff 6d9699a090 Apply fallback on non-sub storage (e.g. at) (#1004)
* Apply fallback on non-sub storage (e.g. at)

* Fallback test in rpc-code (getStorage)
2019-06-14 09:59:59 +02:00
Stefanie DollandAmaury Martiny e4a97d4efd Update to Metadata v5 (#991)
* add v5 folder

* Fixed typo in README

* Updated tests to v5

* added v5 methods to MetadataVersioned

* Added toV5 conversion file to v4 folder

* change from v4 to v5

* Bump up version

* Update imports in type-storage package

* Switch to v5 imports in type-extrinsics, rpc-core and rpc-provider

* 0.81.0 => 0.82.0

* Updating dependencies to 0.82.0

* update comments

* Undo version bump

* Remove release notes

* v4 to v5 conversion

* WIP tests

* Addresses Amaurys comments

* re-added conversion function

* removed unused imports

* Re-add string to HasherInput type

* addresses failing derive tests

* Fixed broken derive e2e tests

* v5 tests

* Update packages/types/src/Metadata/MetadataVersioned.ts

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

* v3->v4

* trigger hung up travis build
2019-06-13 14:42:44 +02:00
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