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 5bb5fa4557ddcf6bd56b3d00d60b6b799e0211cb
152 changes: 77 additions & 75 deletions packages/electron/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# @parity/electron

Control the Parity client from electron.
@parity/electron
================

## Getting Started
Control the Parity Ethereum client from electron.

With this libray, you will be able, from Electron, to:

* download Parity Ethereum locally in Electron's user data folder.
* run/stop/check if Parity Ethereum is running.
* get a secure token from Parity Ethereum to access secure RPCs.

Getting Started
---------------

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

## Usage
Usage
-----

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

### Interfaces

- [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)
* [CheckClockSyncResult](interfaces/checkclocksyncresult.md)
* [FetchParityOptions](interfaces/fetchparityoptions.md)
* [IsParityRunningOptions](interfaces/isparityrunningoptions.md)
* [ParityElectronOptions](interfaces/parityelectronoptions.md)
* [RunParityOptions](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/937a957/packages/electron/src/checkClockSync.ts#L21)_
*Defined in [checkClockSync.ts:21](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/getParityPath.ts#L23)_
*Defined in [getParityPath.ts:23](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/fetchParity.ts#L84)_
*Defined in [fetchParity.ts:84](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/fetchParity.ts#L106)_
*Defined in [fetchParity.ts:106](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/getParityPath.ts#L119)_
*Defined in [getParityPath.ts:119](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/isParityRunning.ts#L20)_
*Defined in [isParityRunning.ts:20](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/runParity.ts#L112)_
*Defined in [runParity.ts:112](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/index.ts#L25)_
*Defined in [index.ts:25](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/runParity.ts#L44)_
*Defined in [runParity.ts:44](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/signerNewToken.ts#L16)_
*Defined in [signerNewToken.ts:16](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/checkClockSync.ts#L9)*
*Defined in [checkClockSync.ts:9](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/checkClockSync.ts#L10)*
*Defined in [checkClockSync.ts:10](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/fetchParity.ts#L18)*
*Defined in [fetchParity.ts:18](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/fetchParity.ts#L19)*
*Defined in [fetchParity.ts:19](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/isParityRunning.ts#L12)*
*Defined in [isParityRunning.ts:12](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/isParityRunning.ts#L13)*
*Defined in [isParityRunning.ts:13](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/index.ts#L18)*
*Defined in [index.ts:18](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/runParity.ts#L15)*
*Defined in [runParity.ts:15](https://github.com/paritytech/js-libs/blob/d249f6f/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/937a957/packages/electron/src/runParity.ts#L16)*
*Defined in [runParity.ts:16](https://github.com/paritytech/js-libs/blob/d249f6f/packages/electron/src/runParity.ts#L16)*

#### Type declaration
▸(error: *`Error`*): `void`
Expand Down
8 changes: 7 additions & 1 deletion packages/electron/src/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# @parity/electron

Control the Parity client from electron.
Control the Parity Ethereum client from electron.

With this libray, you will be able, from Electron, to:

- download Parity Ethereum locally in Electron's user data folder.
- run/stop/check if Parity Ethereum is running.
- get a secure token from Parity Ethereum to access secure RPCs.

## Getting Started

Expand Down