Commit Graph
62 Commits
Author SHA1 Message Date
Luke Schoen ae54a71dc9 fix: Fixes #208. Uses correct HTTP or WS URL prefix and port (#209) 2018-10-05 23:00:20 +02:00
Luke Schoen d4990f8381 fix: Fixes #204. Adds coloured syntax highlighting to TypeDoc code examples (#207)
* fix: Fixes #204. Adds coloured syntax highlighting to TypeDoc code examples

* Add Gitbook plugin Sunlight Highlighter https://www.npmjs.com/package/gitbook-plugin-sunlight-highlighter

* Still requires use of <BR> HTML element to shift code onto a new line

* Example use of Sunlight Highlighter from their README `javascript+theme:gitbook+lineNumbers:true+lineNumberStart:100` (in this example it uses their gitbook theme with line numbers shown and line numbers starting from 100)

* Updated book.json to add the Sunlight Highlighter plugin, and explicitely configured it to use the gitbook theme by default

* Enable showing line numbers only on TypeDoc example code that is longer (i.e. 8 lines long)

* fix: Remove unnecessary inline config for no line numbers since is default

* fix: Remove use of line numbers so consistent with the rest
2018-10-05 17:34:32 +02:00
Luke Schoen fd596a1eb4 fix: Fixes #154 Modify TypeDocs that change the source to resolve rendering correctly (#203)
* fix: Modify TypeDocs that change the source to resolve rendering correctly

* Add TypeDoc/TSDoc labels

* Use HTML <BR> element in TypeDoc to generate new lines even to achieve a newline between lines of code

* Use HTML <PRE><CODE> combination in TypeDoc for multiple line code generation

* Add missing TypeDocs for HTTP `constructor` and `send` for HTTP and WS

* Remove unnecessary assignment of `= true` default value in TypeDoc @param value and clean up text alignment

* Verified that it displays correctly in development environment by running `yarn; yarn polkadot-dev-build-docs; yarn gitbook serve`, and then navigating to localhost:4000

* fix: remove signature that was used with jsdocs flowtype
2018-10-05 08:42:32 +02:00
Jaco Greeff 02aba14e7e Expose whenReady and extrinsics/storage (#199)
* Expose whenReady and extrinsics/storage

* Load genesisHash, expose

* Fix import

* whenReady -> Observable<boolean>

* Check isConnected before making call

* Fix import order
2018-10-04 11:16:45 +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
Amaury Martiny cbd3246c26 Rewrite type-storage (#164)
* Only modify type-storage folder to avoid conflicts

* Use new syntax

* Export default

* Add legacy code

* Skip outdates tests

* Use fromJSON for metadata

* Add comment to move function to repo

* Add whitespace

* Add type

* Use original files

* Fix bug test

* Simplify code

* Fix bug initializing well known keys

* Rename well known keys to substrate

* Linting

* Linting
2018-09-27 12:25:58 +02:00
Luke Schoen f399bb6fd6 docs: Fixes #154 (#167)
* Move triple backticks onto new line so it doesn't break the code snippet formatting

* Add newline between dependency imports and variable declarations

* Add link to relevant line of Github repo of eventemitter3 instead of the travis build directory

* Add full stop at end of sentence in line before `@example` in .ts files, since I noticed that was the only difference between code snippet in docs that was being rendered correctly and one that was not (if the docs were generated from it). Not sure if this actually makes any difference though, but it doesn't hurt to try. i.e. change `[[unsubscribe]]` to `[[unsubscribe]].`

* Add missing code syntax for `new Ws(defaults.WS_URL)`

* Add missing `*__example__*:`

* Add missing semi-colons throughout code

* Fix typos and some grammar

* Move import of external libraries i.e. `const BN = require('bn.js');` or `const crypto = require('crypto');` before `@polkadot` ones in code

* Change from `e` to `error` in catch blocks for readable documentation
2018-09-26 07:24:03 +02:00
Chevdor 0981a30d84 Add documentation and examples (#145)
* Add documentation

* Justification u8a decoding and json encoding (#146)

* Decode Justifications

* Json encoding for justifications

* Bump deps

* Allow extrinsic length encoding to operate on u8a[] (#148)

* Fix config and move generated doc to a subfolder

* Cleanup extrinsic encoding (#150)

* Cleanup extrinsic encoding

* Removed now-defunct type

* Add uncheckedLength encoding

* Add examples

* Ignore package-lock since we use yarn

* Cleanup examples

* Add gitbook config and some base files for the doc

* Do not make full doc mandatory for now

* Add contributing guide, polish doc and samples

* Update the deps of all samples and add yarn scripts
Fix and regenerate the doc

* Fix Contributing guide
2018-09-15 09:11:56 +02:00
Jaco Greeff c3065263fc API docs -> WS (#141)
* API docs -> WS

* API docs update

* HttpProvider -> WsProvider

* sub<something> -> subscribing

* Update dependencies

* Test message checks update
2018-08-28 14:51:16 +02:00
Jaco Greeff 137468d4a5 Fix mock tests (dep upgrade) 2018-08-16 13:25:21 +02:00
Jaco Greeff a5c64709a2 Map sub-id on types, not methods (#135) 2018-08-15 17:07:17 +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 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
Jaco Greeff 6b2c7a1d20 isConnected bugfix 2018-08-08 01:31:22 +02:00
Jaco Greeff fe4c34defe Classify Http & Ws providers (#120)
* Class-ify HttpProvider

* Class-ify WsProvider (tests still WIP)

* Rework tests

* rx-api usage
2018-08-07 16:59:40 +02:00
Jaco Greeff 53e14da740 Pass isLe parameter 2018-07-29 16:19:13 +02:00
Jaco Greeff baf5dd746b Revert params: null for jsonrpc (fixed in Node) (#116) 2018-07-23 17:12:55 +02:00
Jaco Greeff b60a3f3cc0 Pass empty params as null (#115) 2018-07-22 12:12:37 +02:00
Jaco Greeff 4bf6fef5b3 Trap exceptions on WebSocket create (#114) 2018-07-11 17:18:40 +02:00
Jaco Greeff f5a9c207d0 Add TSLint (#106)
* Add TSLint

* Update dependencies

* Update dependencies
2018-06-27 12:22:52 +02:00
Jaco Greeff ae9fc0bd97 Update @polkadot/types (#105) 2018-06-26 11:11:43 +02:00
Jaco Greeff 8ca5dc0d70 Update dependencies, onClose connect 2018-06-25 09:36:13 +02:00
Jaco Greeff 432f9a73a9 TypeScript conversion (#101)
* Auto-conversion

* ES6 import/export

* WIP...

* WIP...

* And... we are TS typed, some good, some bad, some better, some worse

* Tests passing
2018-06-23 13:39:31 +02:00
Jaco Greeff 41acc4a5e7 Copyright project authors (#98)
* Copyright project authors

* Add contributors
2018-06-13 22:27:29 +02:00
Jaco Greeff 2246f866f8 Allow wss & https endpoints (#96) 2018-05-29 15:54:13 +02:00
Jaco Greeff c68bf8a689 Update from new @polkadot/params (#95) 2018-05-29 12:26:19 +02:00
Jaco Greeff 9cef7feea1 Update dependencies (#93) 2018-05-24 16:41:41 +02:00
Jaco Greeff 861155f9ef Use jsonrpc definitions from @polkadot/jsonrpc (#91)
* Drop api-jsonrpc in favour of @polkadot/jsonrpc

* Change converters

* Address issues after conversion
2018-05-18 10:08:08 +02:00
Jaco Greeff ed3b63dccc Update mock key names 2018-05-13 21:33:38 +02:00
Jaco Greeff bf9aa457b0 Align timestamp with Rust (#85) 2018-05-03 15:03:16 +02:00
Jaco Greeff d899cd62a5 Mock nonce (#84)
* Mock nonce

* Cleanup
2018-05-02 16:10:52 +02:00
Jaco Greeff 61a00d3ff9 Upgrades (#83)
* Upgrades

* Update refs
2018-05-02 15:10:39 +02:00
Jaco Greeff 233a47b626 Mock tim:val for queries (#82)
* Mock tim:val for queries

* Update for failing types

* Use @polkadot/storage

* Upgrades
2018-05-01 12:40:14 +02:00
Jaco Greeff e9e4b339c3 Update mocks to use new testing keyring (#80) 2018-04-25 10:36:29 +02:00
Jaco Greeff 8df1228e6f Mock events emitter (#79) 2018-04-25 10:01:33 +02:00
Jaco Greeff 5b9c75b9cf Provider emits connected/disconnected (#76)
* Add provider.on stub (mock/http)

* Emit connected/disconnected from ws

* Update dependencies

* Expose .on on api
2018-04-24 10:01:47 +02:00
Jaco Greeff e71b11a13b Workaround for circular connect (#73)
* Workaround for circular connect

* Upgrade dependencies
2018-04-23 10:38:42 +02:00
Jaco Greeff 9c5b5103a7 Encode mock results as string (#69) 2018-04-17 14:06:12 +02:00
Jaco Greeff 47ead04dae state_getStorage mock (#67) 2018-04-17 12:23:02 +02:00
Jaco Greeff d86cd86251 Encode mock responses as JSON (#66)
* Encode mock responses as JSON

* Update primitives
2018-04-16 18:07:21 +02:00
Jaco Greeff e592f4787e Remove extra_* namespace (#65) 2018-04-16 16:27:17 +02:00
Jaco Greeff 418e1ca7c2 Mock interfaces has isSubscription flag (#64)
* Mock interfaces has isSubscription flag

* chain_newHead mock
2018-04-16 15:38:33 +02:00
Jaco Greeff 462fa6e5c4 Expose WS subscribe/unsubscribe (#63)
* Expose WS subscribe

* Support unsubscribe

* Align unsubscribe with method

* Basic e2e sub test

* Cleanup parameter positions

* Small update

* Handle non-supplied in output formatter
2018-04-16 13:49:02 +02:00
Jaco Greeff 913d6d8bd0 Add basic mock provider (#58) 2018-03-16 12:10:13 +01:00
Jaco Greeff 21c14bd85c Add pubsub interface definition (#54)
* Add pubsub interface definition

* Functional JsonRpcCoder

* Functional HttpProvider

* Functional WsProvider

* Functional split completed

* Split actual method subscription

* Update flow

* Flatten no user-specified array in sub call
2018-03-15 12:59:49 +01:00