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
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
|
||||
[](https://polkadot.js.org)  [](https://github.com/Flet/semistandard) [](https://www.npmjs.com/package/@polkadot/api-rx) [](https://travis-ci.org/polkadot-js/api) [](https://codeclimate.com/github/polkadot-js/api/maintainability) [](https://coveralls.io/github/polkadot-js/api?branch=master) [](https://david-dm.org/polkadot-js/api?path=packages/api-rx) [](https://david-dm.org/polkadot-js/api?path=packages/api-rx#info=devDependencies)
|
||||
|
||||
@polkadot/api-rx
|
||||
================
|
||||
|
||||
An RxJs wrapper around the [@polkadot/api](../api).
|
||||
|
||||
## Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [RxApi](classes/rxapi.md)
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [RxApiInterface](#rxapiinterface)
|
||||
* [RxApiInterface$Method](#rxapiinterface_method)
|
||||
* [RxApiInterface$Section](#rxapiinterface_section)
|
||||
|
||||
### Functions
|
||||
|
||||
* [cached](#cached)
|
||||
* [createInterface](#createinterface)
|
||||
* [observable](#observable)
|
||||
* [subscription](#subscription)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="rxapiinterface"></a>
|
||||
|
||||
### RxApiInterface
|
||||
|
||||
**Ƭ RxApiInterface**: * `RxApiInterface$Keys` & `object`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:19](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/types.d.ts#L19)*
|
||||
|
||||
___
|
||||
<a id="rxapiinterface_method"></a>
|
||||
|
||||
### RxApiInterface$Method
|
||||
|
||||
**Ƭ RxApiInterface$Method**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:9](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/types.d.ts#L9)*
|
||||
|
||||
#### Type declaration
|
||||
▸(...params: *`Array`<`any`>*): `Observable`<`any`> | `BehaviorSubject`<`any`>
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Rest` params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Observable`<`any`> | `BehaviorSubject`<`any`>
|
||||
|
||||
___
|
||||
<a id="rxapiinterface_section"></a>
|
||||
|
||||
### RxApiInterface$Section
|
||||
|
||||
**Ƭ RxApiInterface$Section**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:11](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/types.d.ts#L11)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: [RxApiInterface$Method](#rxapiinterface_method)
|
||||
|
||||
___
|
||||
|
||||
## Functions
|
||||
|
||||
<a id="cached"></a>
|
||||
|
||||
### cached
|
||||
|
||||
▸ **cached**(subName: *`string`*, name: *`string`*, section: *`ApiInterface$Section`*): `function`
|
||||
|
||||
*Defined in [observable/cached.ts:19](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/observable/cached.ts#L19)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| subName | `string` |
|
||||
| name | `string` |
|
||||
| section | `ApiInterface$Section` |
|
||||
|
||||
**Returns:** `function`
|
||||
|
||||
___
|
||||
<a id="createinterface"></a>
|
||||
|
||||
### createInterface
|
||||
|
||||
▸ **createInterface**(api: *`ApiInterface`*, sectionName: *`Interface$Sections`*): [RxApiInterface$Section](#rxapiinterface_section)
|
||||
|
||||
*Defined in [interface.ts:11](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/interface.ts#L11)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| api | `ApiInterface` |
|
||||
| sectionName | `Interface$Sections` |
|
||||
|
||||
**Returns:** [RxApiInterface$Section](#rxapiinterface_section)
|
||||
|
||||
___
|
||||
<a id="observable"></a>
|
||||
|
||||
### observable
|
||||
|
||||
▸ **observable**(subName: *`string`*, name: *`string`*, section: *`ApiInterface$Section`*): `function`
|
||||
|
||||
*Defined in [observable/index.ts:14](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/observable/index.ts#L14)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| subName | `string` |
|
||||
| name | `string` |
|
||||
| section | `ApiInterface$Section` |
|
||||
|
||||
**Returns:** `function`
|
||||
|
||||
___
|
||||
<a id="subscription"></a>
|
||||
|
||||
### subscription
|
||||
|
||||
▸ **subscription**(name: *`string`*, params: *`Array`<`any`>*, section: *`ApiInterface$Section`*, unsubCallback?: * `undefined` | `function`*): `BehaviorSubject`<`any`>
|
||||
|
||||
*Defined in [observable/subject.ts:10](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/observable/subject.ts#L10)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| name | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
| section | `ApiInterface$Section` |
|
||||
| `Optional` unsubCallback | `undefined` | `function`|
|
||||
|
||||
**Returns:** `BehaviorSubject`<`any`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
[Polkadot JS API](../README.md) > [RxApi](../classes/rxapi.md)
|
||||
|
||||
# Class: RxApi
|
||||
|
||||
An RxJs wrapper around the \[\[api\]\].
|
||||
*__example__*: ```javascript
|
||||
import RxApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
const provider = new WsProvider('http://127.0.0.1:9944');
|
||||
const rxapi = new RxApi(provider);
|
||||
```
|
||||
|
||||
## Hierarchy
|
||||
|
||||
**RxApi**
|
||||
|
||||
## Implements
|
||||
|
||||
* `object` & `object`
|
||||
|
||||
## Index
|
||||
|
||||
### Constructors
|
||||
|
||||
* [constructor](rxapi.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
* [author](rxapi.md#author)
|
||||
* [chain](rxapi.md#chain)
|
||||
* [state](rxapi.md#state)
|
||||
* [system](rxapi.md#system)
|
||||
|
||||
### Methods
|
||||
|
||||
* [isConnected](rxapi.md#isconnected)
|
||||
|
||||
---
|
||||
|
||||
## Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
### constructor
|
||||
|
||||
⊕ **new RxApi**(provider?: *`ProviderInterface`*): [RxApi](rxapi.md)
|
||||
|
||||
*Defined in [index.ts:33](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/index.ts#L33)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value | Description |
|
||||
| ------ | ------ | ------ | ------ |
|
||||
| `Default value` provider | `ProviderInterface` | new Ws(defaults.WS_URL) | An API provider using HTTP or WebSocket |
|
||||
|
||||
**Returns:** [RxApi](rxapi.md)
|
||||
|
||||
___
|
||||
|
||||
## Properties
|
||||
|
||||
<a id="author"></a>
|
||||
|
||||
### author
|
||||
|
||||
**● author**: *[RxApiInterface$Section](../#rxapiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:30](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/index.ts#L30)*
|
||||
|
||||
___
|
||||
<a id="chain"></a>
|
||||
|
||||
### chain
|
||||
|
||||
**● chain**: *[RxApiInterface$Section](../#rxapiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:31](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/index.ts#L31)*
|
||||
|
||||
___
|
||||
<a id="state"></a>
|
||||
|
||||
### state
|
||||
|
||||
**● state**: *[RxApiInterface$Section](../#rxapiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:32](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/index.ts#L32)*
|
||||
|
||||
___
|
||||
<a id="system"></a>
|
||||
|
||||
### system
|
||||
|
||||
**● system**: *[RxApiInterface$Section](../#rxapiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:33](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/index.ts#L33)*
|
||||
|
||||
___
|
||||
|
||||
## Methods
|
||||
|
||||
<a id="isconnected"></a>
|
||||
|
||||
### isConnected
|
||||
|
||||
▸ **isConnected**(): `BehaviorSubject`<`boolean`>
|
||||
|
||||
*Defined in [index.ts:51](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-rx/src/index.ts#L51)*
|
||||
|
||||
**Returns:** `BehaviorSubject`<`boolean`>
|
||||
|
||||
___
|
||||
|
||||
Reference in New Issue
Block a user