Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update docs
  • Loading branch information
amaury1093 committed Sep 7, 2018
commit d249f6fa0a15889a978a4d1d66d8c1583f6f996d
144 changes: 74 additions & 70 deletions packages/electron/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@

@parity/electron
================
# @parity/electron

Control the Parity client from electron.

Getting Started
---------------
## Getting Started

```bash
yarn add @parity/electron
```

Usage
-----
## Usage

```javascript
import parityElectron, { isParityRunning } from '@parity/electron';
Expand All @@ -30,182 +26,190 @@ isParityRunning()

### Interfaces

* [CheckClockSyncResult](interfaces/checkclocksyncresult.md)
* [FetchParityOptions](interfaces/fetchparityoptions.md)
* [IsParityRunningOptions](interfaces/isparityrunningoptions.md)
* [ParityElectronOptions](interfaces/parityelectronoptions.md)
* [RunParityOptions](interfaces/runparityoptions.md)
- [CheckClockSyncResult](docs/interfaces/checkclocksyncresult.md)
- [FetchParityOptions](docs/interfaces/fetchparityoptions.md)
- [IsParityRunningOptions](docs/interfaces/isparityrunningoptions.md)
- [ParityElectronOptions](docs/interfaces/parityelectronoptions.md)
- [RunParityOptions](docs/interfaces/runparityoptions.md)

### Functions

* [checkClockSync](#checkclocksync)
* [defaultParityPath](#defaultparitypath)
* [deleteParity](#deleteparity)
* [fetchParity](#fetchparity)
* [getParityPath](#getparitypath)
* [isParityRunning](#isparityrunning)
* [killParity](#killparity)
* [parityElectron](#parityelectron)
* [runParity](#runparity)
* [signerNewToken](#signernewtoken)
- [checkClockSync](#checkclocksync)
- [defaultParityPath](#defaultparitypath)
- [deleteParity](#deleteparity)
- [fetchParity](#fetchparity)
- [getParityPath](#getparitypath)
- [isParityRunning](#isparityrunning)
- [killParity](#killparity)
- [parityElectron](#parityelectron)
- [runParity](#runparity)
- [signerNewToken](#signernewtoken)

---

## Functions

<a id="checkclocksync"></a>

### checkClockSync
### checkClockSync

▸ **checkClockSync**(): `Promise`<[CheckClockSyncResult](interfaces/checkclocksyncresult.md)>

*Defined in [checkClockSync.ts:21](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/checkClockSync.ts#L21)*
_Defined in [checkClockSync.ts:21](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/checkClockSync.ts#L21)_

Use SNTP to check if the local clock is synchronized; return the time drift.

**Returns:** `Promise`<[CheckClockSyncResult](interfaces/checkclocksyncresult.md)>

___
---

<a id="defaultparitypath"></a>

### defaultParityPath
### defaultParityPath

▸ **defaultParityPath**(): `Promise`<`string`>

*Defined in [getParityPath.ts:23](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/getParityPath.ts#L23)*
_Defined in [getParityPath.ts:23](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/getParityPath.ts#L23)_

The default path to install parity, in case there's no other instance found on the machine.

**Returns:** `Promise`<`string`>

___
---

<a id="deleteparity"></a>

### deleteParity
### deleteParity

▸ **deleteParity**(): `Promise`<`void`>

*Defined in [fetchParity.ts:84](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/fetchParity.ts#L84)*
_Defined in [fetchParity.ts:84](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/fetchParity.ts#L84)_

Remove parity binary or partial binary in the userData folder, if it exists.

**Returns:** `Promise`<`void`>

___
---

<a id="fetchparity"></a>

### fetchParity
### fetchParity

▸ **fetchParity**(mainWindow: *`BrowserWindow`*, options?: *[FetchParityOptions](interfaces/fetchparityoptions.md)*): `Promise`<`string`>
▸ **fetchParity**(mainWindow: _`BrowserWindow`_, options?: _[FetchParityOptions](interfaces/fetchparityoptions.md)_): `Promise`<`string`>

*Defined in [fetchParity.ts:106](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/fetchParity.ts#L106)*
_Defined in [fetchParity.ts:106](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/fetchParity.ts#L106)_

Downloads Parity, saves it to Electron's `userData` folder, and returns the path to the downloaded binary once finished.

**Parameters:**

| Param | Type | Default value |
| ------ | ------ | ------ |
| mainWindow | `BrowserWindow` | - |
| `Default value` options | [FetchParityOptions](interfaces/fetchparityoptions.md) | {onProgress: () &#x3D;&gt; {/* Do nothing by defaut. */},parityChannel: &#x27;beta&#x27;} |
| Param | Type | Default value |
| ----------------------- | ------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| mainWindow | `BrowserWindow` | - |
| `Default value` options | [FetchParityOptions](interfaces/fetchparityoptions.md) | {onProgress: () &#x3D;&gt; {/_ Do nothing by defaut. _/},parityChannel: &#x27;beta&#x27;} |

**Returns:** `Promise`<`string`>

___
---

<a id="getparitypath"></a>

### getParityPath
### getParityPath

▸ **getParityPath**(): `Promise`<`string`>

*Defined in [getParityPath.ts:119](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/getParityPath.ts#L119)*
_Defined in [getParityPath.ts:119](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/getParityPath.ts#L119)_

Returns the path to Parity, or throws if parity is not found.

**Returns:** `Promise`<`string`>

___
---

<a id="isparityrunning"></a>

### isParityRunning
### isParityRunning

▸ **isParityRunning**(options?: *[IsParityRunningOptions](interfaces/isparityrunningoptions.md)*): `Promise`<`boolean`>
▸ **isParityRunning**(options?: _[IsParityRunningOptions](interfaces/isparityrunningoptions.md)_): `Promise`<`boolean`>

*Defined in [isParityRunning.ts:20](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/isParityRunning.ts#L20)*
_Defined in [isParityRunning.ts:20](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/isParityRunning.ts#L20)_

Detect if another instance of parity is already running or not. To achieve that, we just ping on the common hosts.

**Parameters:**

| Param | Type | Default value |
| ------ | ------ | ------ |
| `Default value` options | [IsParityRunningOptions](interfaces/isparityrunningoptions.md) | {wsInterface: &#x27;127.0.0.1&#x27;,wsPort: &#x27;8546&#x27;} |
| Param | Type | Default value |
| ----------------------- | -------------------------------------------------------------- | ------------------------------------------------------------- |
| `Default value` options | [IsParityRunningOptions](interfaces/isparityrunningoptions.md) | {wsInterface: &#x27;127.0.0.1&#x27;,wsPort: &#x27;8546&#x27;} |

**Returns:** `Promise`<`boolean`>

___
---

<a id="killparity"></a>

### killParity
### killParity

▸ **killParity**(): `Promise`<`void`>

*Defined in [runParity.ts:112](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/runParity.ts#L112)*
_Defined in [runParity.ts:112](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/runParity.ts#L112)_

If a Parity process has been spawned with runParity, then it kills this process. However, there's no guarantee that Parity has been cleanly killed, and the Promise resolves instantly.

**Returns:** `Promise`<`void`>

___
---

<a id="parityelectron"></a>

### parityElectron
### parityElectron

▸ **parityElectron**(options?: *[ParityElectronOptions](interfaces/parityelectronoptions.md)*): `void`
▸ **parityElectron**(options?: _[ParityElectronOptions](interfaces/parityelectronoptions.md)_): `void`

*Defined in [index.ts:25](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/index.ts#L25)*
_Defined in [index.ts:25](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/index.ts#L25)_

Set default options for @parity/electron. Can be skipped if we don't want to override default options.

**Parameters:**

| Param | Type | Default value |
| ------ | ------ | ------ |
| `Default value` options | [ParityElectronOptions](interfaces/parityelectronoptions.md) | { logger: debug } |
| Param | Type | Default value |
| ----------------------- | ------------------------------------------------------------ | ----------------- |
| `Default value` options | [ParityElectronOptions](interfaces/parityelectronoptions.md) | { logger: debug } |

**Returns:** `void`

___
---

<a id="runparity"></a>

### runParity
### runParity

▸ **runParity**(options?: *[RunParityOptions](interfaces/runparityoptions.md)*): `Promise`<`void`>
▸ **runParity**(options?: _[RunParityOptions](interfaces/runparityoptions.md)_): `Promise`<`void`>

*Defined in [runParity.ts:44](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/runParity.ts#L44)*
_Defined in [runParity.ts:44](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/runParity.ts#L44)_

Spawns a child process to run Parity.

**Parameters:**

| Param | Type | Default value |
| ------ | ------ | ------ |
| `Default value` options | [RunParityOptions](interfaces/runparityoptions.md) | {flags: [],onParityError: () &#x3D;&gt; {/* Do nothing if error. */}} |
| Param | Type | Default value |
| ----------------------- | -------------------------------------------------- | --------------------------------------------------------------------- |
| `Default value` options | [RunParityOptions](interfaces/runparityoptions.md) | {flags: [],onParityError: () &#x3D;&gt; {/_ Do nothing if error. _/}} |

**Returns:** `Promise`<`void`>

___
---

<a id="signernewtoken"></a>

### signerNewToken
### signerNewToken

▸ **signerNewToken**(): `Promise`<`string`>

*Defined in [signerNewToken.ts:16](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/signerNewToken.ts#L16)*
_Defined in [signerNewToken.ts:16](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/signerNewToken.ts#L16)_

Runs parity signer new-token and resolves with a new secure token to be used in a dapp. Rejects if no token could be extracted.

**Returns:** `Promise`<`string`>

___

---
4 changes: 2 additions & 2 deletions packages/electron/docs/interfaces/checkclocksyncresult.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

**● isClockSync**: *`boolean`*

*Defined in [checkClockSync.ts:9](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/checkClockSync.ts#L9)*
*Defined in [checkClockSync.ts:9](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/checkClockSync.ts#L9)*

___
<a id="timedrift"></a>
Expand All @@ -32,7 +32,7 @@ ___

**● timeDrift**: *`number`*

*Defined in [checkClockSync.ts:10](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/checkClockSync.ts#L10)*
*Defined in [checkClockSync.ts:10](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/checkClockSync.ts#L10)*

___

4 changes: 2 additions & 2 deletions packages/electron/docs/interfaces/fetchparityoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

**● onProgress**: *`function`*

*Defined in [fetchParity.ts:18](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/fetchParity.ts#L18)*
*Defined in [fetchParity.ts:18](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/fetchParity.ts#L18)*

#### Type declaration
▸(progress: *`number`*): `void`
Expand All @@ -43,7 +43,7 @@ ___

**● parityChannel**: *`string`*

*Defined in [fetchParity.ts:19](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/fetchParity.ts#L19)*
*Defined in [fetchParity.ts:19](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/fetchParity.ts#L19)*

___

4 changes: 2 additions & 2 deletions packages/electron/docs/interfaces/isparityrunningoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

**● wsInterface**: *`string`*

*Defined in [isParityRunning.ts:12](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/isParityRunning.ts#L12)*
*Defined in [isParityRunning.ts:12](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/isParityRunning.ts#L12)*

___
<a id="wsport"></a>
Expand All @@ -33,7 +33,7 @@ ___
**● wsPort**: * `number` &#124; `string`
*

*Defined in [isParityRunning.ts:13](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/isParityRunning.ts#L13)*
*Defined in [isParityRunning.ts:13](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/isParityRunning.ts#L13)*

___

2 changes: 1 addition & 1 deletion packages/electron/docs/interfaces/parityelectronoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

**● logger**: *`LoggerFunction`*

*Defined in [index.ts:18](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/index.ts#L18)*
*Defined in [index.ts:18](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/index.ts#L18)*

___

4 changes: 2 additions & 2 deletions packages/electron/docs/interfaces/runparityoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

**● flags**: *`string`[]*

*Defined in [runParity.ts:15](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/runParity.ts#L15)*
*Defined in [runParity.ts:15](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/runParity.ts#L15)*

___
<a id="onparityerror"></a>
Expand All @@ -32,7 +32,7 @@ ___

**● onParityError**: *`function`*

*Defined in [runParity.ts:16](https://github.com/paritytech/js-libs/blob/67fa654/packages/electron/src/runParity.ts#L16)*
*Defined in [runParity.ts:16](https://github.com/paritytech/js-libs/blob/937a957/packages/electron/src/runParity.ts#L16)*

#### Type declaration
▸(error: *`Error`*): `void`
Expand Down
1 change: 1 addition & 0 deletions packages/electron/typedoc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
entryPoint: 'docs',
exclude: ['**/*spec.ts'],
excludeExternals: true,
excludePrivate: true,
Expand Down