Commit Graph
49 Commits
Author SHA1 Message Date
Jaco Greeff db59fbff25 Acc contracts_getStorage (#1603) 2019-11-23 22:29:33 +01:00
Jaco Greeff 75220eb54f Add payment queryInfo RPC (#1580) 2019-11-18 12:26:09 +01:00
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
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 a9c752a8d4 Complexity cleanups (#1303)
* Complexity cleanups

* Revert spread

* Sig wrapping

* Use InterfaceTypes in rpc definitions

* Types for rpc definitions
2019-08-14 07:37:20 +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 03581355be Add author_removeExtrinsic RPC (#1233) 2019-07-30 13:16:20 +02:00
Jaco Greeff fe35527a65 Method -> Call, expose findMethod on api (#1222)
* Rename Method -> Call (interface, align with Rust)

* Export Call types from types, expose findCall
2019-07-29 09:04:37 +02:00
Jaco Greeff d56905d1b5 Move Extrinsic/Method to generic (#1205)
* Move Extrinsic/Method to generic

* Strip Generic* primitives

* Move Origin & Method, pass lint/tests
2019-07-26 18:04:33 +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 a25110b281 Move additional classes to definition-only (#1165)
* Move additional classes to definition-only

* Move some additional quick-hit types

* Last of the easier type/* conversions

* Remove rhd files

* Remove commented line

* Add injector to types loading

* typo

* Update comment

* Merge master

* Rework & organize CHANGELOG

* Some small helper cleanups
2019-07-25 10:32:26 +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
Stefanie Doll c3216a524e Add child_storage and getKeys methods (#1012)
* Add childStorageKeyPrefix to type-storage package

* WIP

* fix failing build

* wrap StorageKey

* no new line

* Added childStoragePrefix param

* Add childStorageKey param

* Tests for child methods

* Finalized tests

* linting

* Changed get_keys test to :code

* Alphabetical imports

* store hex values in consts

* follow substrate order & empty line fixes

* alphabetical export

* Correct hex value for :child_storage:
2019-06-18 17:58:50 +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
Stefanie Doll db78aeb225 Fix for RPC bugs caused by uk spelling (#904)
* Replaced UK with US spelling

* -ised to -ized

* UK -> US spelling in chain rpc methods

* Tests for RPC chain methods on Alex
2019-05-14 21:27:16 +02: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 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 1ea1f6f9f5 Add system_networkState RPC (with cleanups) (#745)
* Ad system_networkState RPC (with cleanups)

* Bump external dependencies

* s/network_state/networkState/ (as per Rust PR comments)

* Bump common (latest)
2019-02-28 13:53:36 +01:00
Jaco Greeff b960580c4d Alias state_getRuntimeVersion (#663) 2019-02-09 07:35:05 +02: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 8bb40cf5a9 Add sytstem_health rpc endpoint 2019-01-08 13:39:38 +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 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 69f68509ef Expand with all currently known RPC methods 2018-12-07 12:30:09 +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 4805f9cb36 Update LICENSE and README (#408)
* Update LICENSE and README

* Bump
2018-11-21 13:37:27 +01:00
Luke Schoen f6506dbabb refactor: Fixes #381. Fix spelling of extrinsic in param name (#384) 2018-11-08 10:10:11 +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
Luke Schoen 4748e8c87f docs: Relates to #193. Generate Substrate Interface methods in API docs for RPC, Storage, and Extrinsics from Metadata (#265)
* docs: Relates to #193. Generate Methods in API docs to Substrate Interfaces Extrinsics and Storage from Metadata

* Steps to generate Gitbook:
```
yarn run build:methodsdoc;
yarn run build;
yarn gitbook serve;
```

* Allows generating a docs/METHODS_STORAGE.md and docs/METHODS_EXTRINSICS.md files by running `yarn run build:methodsdoc`
  * Note: The script runs `node packages/types/src/MetadataMdWrapper.js`, which uses Babel.js to transpile the TypeScript file MetadataMd.ts into JavaScript as MetadataMd.js by using the babel-plugin-module-resolver dependency that has been added to package.json. It runs MetadataMd.js, which parses a hard-coded copy of a Metadata response from the Substrate Node, and then generates the two aforementioned Markdown files to be included in the Gitbook.
  * Important Note: DO NOT run `./node_modules/.bin/tsc packages/types/src/MetadataMd.ts; node packages/types/src/MetadataMd.js;`, as doing so may incorrectly transpile other TypeScript files, and will give errors like `TypeError: bn_js_1.default is not a constructor` when you run your unit tests.

* Added links that work when you go to http://localhost:4000/api/ and click the "api" link on the side menu
  * Note: This was achieved by first adding the links in packages/api/README.md (i.e. `[Extrinsics (Substrate Interface)](../METHODS_EXTRINSICS.md)`). Note that the links could also be `METHODS_EXTRINSICS.html` and it would still work. It is VERY important to add links to these Markdown files in docs/SUMMARY.md (i.e. `[Storage](METHODS_STORAGE.md)`), as Gitbook generates HTML files in the same docs/ directory (i.e. it generates docs/METHODS_STORAGE.html) for any links provided in that file, and when you run `yarn run build; yarn gitbook serve` it will put a copy of those HTML files in the _book directory so it can be accessed in the browser.

* Replaces PR #249 and #255 from jg-meta-md from jg-meta-md-luke branches

* feat: Add script to generate decoded JSON file of the Metadata. Remove test.

* Summary:
  * Running `yarn run build:decodedjson` will generate packages/types/src/Metadata.decoded.json from the Metadata in the Metadata.rpc.ts file.

* docs: Manually add RPC Substrate Interface API docs including author, chain, state, system

* docs: Append Storage Substrate methods to Storage Methods. Add consistent styling. Add descriptions

* Add Description at top of Substrate Interface page for RPC, Extrinsics, and Storage in API docs

* Add styling to Substrate Interface page for Extrinsics and Storage, including:
  * ▸ symbol before each method
  * bold method names
  * adding Summary label and only showing the summary label if a summary exists
  * adding a horizonal line between each section of methods

* Fix by adding new line after description when there is one in Extrinscis and Storage

* Manually creating a markdown file containing storage.substrate methods METHODS_STORAGE_SUBSTRATE.md, and then reading from the file and appending it to the bottom of the METHODS_STORAGE.md file that is generated, since the storage.substrate methods are not available from the Metadata.

* Fix by reading and writing to file using UTF8 instead of ASCII so symbols appear correctly

* Updating docs/METHODS_RPC.md and adding a horizontal line before the first section of methods

* docs: Fix Readme file step numbering

* docs: Generate the Substrate Interface Markdown files first when run yarn run build

* refactor: Move babel register config into shared file

* refactor: Use shared function to overcome codeclimate error

* fix: Reword description of RPC methodsto address review comment

* docs: Rename to Runtime Node Interfaces to address review comment

* docs: Rename to Runtime Node Interface in api Readme to address review comment

* docs: Fix minor typos

* docs: Fixes #117 providing Readme ref to jsonrpc docs

* fix: Remove preceding whitespace

* docs: Rename so RPC is not referred to as an interface of the runtime

* docs: Refer to Storage Substrate methods as always available to runtime implementation

* test: Restore the test that was unnecessary deleted

* Move scripts into packages/types/src/scripts

* docs: Add script to generate RPC interface docs

* fix: Fix TSlint error where element had any time due to no index signature

* refactor: Restore code back to normal instead of bowing to codeclimate whims

* refactor: Declare meaningful variables to make more readable

* docs: Show .subscribe when it is isSubscription method
2018-10-12 21:15:01 +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 8cf0201bbb submitExtrinsic(extrinsic: Extrinsic) (#213) 2018-10-05 15:37:26 +02:00
Jaco Greeff 82dbc93f79 Mortal -> Extrinsic, expand for decoding start (#212)
* Mortal -> Extrinsic, expand for decoding start

* Method, Section -> Rpc{Method, Section}

* Only expose callIndex

* CallIndex -> MethodIndex in spec
2018-10-05 12:29:06 +02:00
Jaco Greeff cce329b19a UncheckedEncoding (#192)
* Re add type-extrinsics

* Add descriptor

* Add uncheked mortal extrinsic

* Add e2e test

* Add versionInfo and signatureInfo

* Skip e2e test

* Small updates

* Additions for era & extra types

* Move types to types, fixup tests

* Small test updates

* Update test for full decoding
2018-10-04 08:37:32 +02:00
Jaco Greeff 6ff847170d Various minor tweaks all-around (#194)
* Fix exports for provider

* Cleanu jsonrpc method exposure

* name -> section
2018-10-03 20:31:23 +02:00
Jaco Greeff 48e57f9a55 Rename api-codec -> types (#183)
* Rename api-codec -> types

* Cleanups with exports (as found with use)

* Docs to build for /types
2018-10-02 11:30:45 +02:00
Jaco Greeff 2f60ba0e1c Add method name & prefix to StorageFunction (#182)
* Add methods & prefix to StorageFunction

* Match method/section to exposed names

* Export method/section on extrinsic & jsonrpc

* PR comment prefix -> section
2018-10-02 11:10:17 +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 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
Jaco Greeff bd2a1f54fc Track subscriptions per method (#134)
* Track subscriptions per method

* Update subscription tests

* Correct newHead un/subscribe methods
2018-08-15 16:20:45 +02:00
Jaco Greeff a369c8804a Add chain_getBlock & author_pendingExtrinsics (#132)
* Add chain_getBlock & author_pendingExtrinsics

* Remove sample

* TSLint
2018-08-15 15:34:16 +02:00
Jaco Greeff 187c66f600 Add storage subscription API endpoints (#126)
* Add storage subscriptions

* StorageResult formatting

* Decoding WIP

* Storage subsciptions in place

* Allow null decodes, ref https://github.com/polkadot-js/apps/issues/215

* e2e tests for subscribeStorage

* Cache subscription results, return with changeset
2018-08-11 20:50:57 +02:00
Jaco Greeff ad968ec794 Import type-* from common repo (#125)
* Import type-* from common repo

* Update links

* Fix lint links (package index)
2018-08-11 11:14:20 +02:00