Use cleaner types and update README

This commit is contained in:
Marvin ROGER 2018-07-11 17:30:07 +02:00 committed by Marvin ROGER
commit 6eae7a967e
12 changed files with 105 additions and 81 deletions

View file

@ -7,7 +7,7 @@
---
A [battle-tested](__tests__) toolkit for the Nano cryptocurrency, allowing you to derive keys, generate seeds, hashes, signatures, proofs of work and state blocks.
A [battle-tested](__tests__) toolkit for the Nano cryptocurrency.
If you are looking for legacy blocks, you will want the `^1.0.0` versions.
@ -17,13 +17,43 @@ The documentation is available locally in [docs/](docs/) or online at [https://m
---
## Features
- Generate seeds
- Derive secret keys, public keys and addresses
- Hash blocks
- Sign and verify blocks
- Compute and test proofs of work
- Check the format of seeds, secret keys, public keys, addresses, amounts, etc.
- Convert Nano units
- **CLI doing all of the above**
---
## Usage
To install the library:
```
npm install nanocurrency
# or yarn add nanocurrency
```
```js
import * as nanocurrency from 'nanocurrency';
```
To install the CLI:
```
npm install -g nanocurrency
# or yarn global add nanocurrency
```
```bash
nanocurrency --help
```
---
## Performance
@ -39,21 +69,15 @@ Considering you can pre-compute and cache the work prior to an actual transactio
Contributions are very welcome. To develop, make use of the following commands (using [Yarn](https://yarnpkg.com)):
* `yarn build:dev`: build the C++ code to WebAssembly and bundle the files into the `dist` directory, without optimization so that it is fast while developing. Note that you'll need to have Docker installed
- `yarn build:dev`: build the C++ code to WebAssembly and bundle the files into the `dist` directory, without optimization so that it is fast while developing. Note that you'll need to have Docker installed
* `yarn test`: test the code
- `yarn test`: test the code
* `yarn lint`: lint the code against [JavaScript Standard Style](https://standardjs.com)
- `yarn lint`: lint the code against [JavaScript Standard Style](https://standardjs.com)
* `yarn format`: format the code with [Prettier](https://prettier.io)
- `yarn format`: format the code with [Prettier](https://prettier.io)
* `yarn generate-docs`: generate the `DOCUMENTATION.md` file from the [JSDoc](http://usejsdoc.org) annotations
---
## Helpful materials
* Article about seed / secret key / public key / address generation: https://medium.com/@benkray/raiblocks-deterministic-keys-8cb869cc6046
- `yarn generate-docs`: generate the `DOCUMENTATION.md` file from the [JSDoc](http://usejsdoc.org) annotations
---

View file

@ -1055,7 +1055,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">KNano<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"> =&nbsp;&quot;KNano&quot;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L39">conversion.ts:39</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L39">conversion.ts:39</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1070,7 +1070,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">MNano<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"> =&nbsp;&quot;MNano&quot;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L41">conversion.ts:41</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L41">conversion.ts:41</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1085,7 +1085,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">NANO<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"> =&nbsp;&quot;NANO&quot;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L37">conversion.ts:37</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L37">conversion.ts:37</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1100,7 +1100,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">Nano<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"> =&nbsp;&quot;Nano&quot;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L35">conversion.ts:35</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L35">conversion.ts:35</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1115,7 +1115,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">hex<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"> =&nbsp;&quot;hex&quot;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L27">conversion.ts:27</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L27">conversion.ts:27</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1130,7 +1130,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">knano<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"> =&nbsp;&quot;knano&quot;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L33">conversion.ts:33</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L33">conversion.ts:33</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1145,7 +1145,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">nano<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"> =&nbsp;&quot;nano&quot;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L31">conversion.ts:31</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L31">conversion.ts:31</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1160,7 +1160,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">raw<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"> =&nbsp;&quot;raw&quot;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L29">conversion.ts:29</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L29">conversion.ts:29</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View file

@ -1049,13 +1049,13 @@ img { max-width: 100%; }
<a name="checkaddress" class="tsd-anchor"></a>
<h3>check<wbr>Address</h3>
<ul class="tsd-signatures tsd-kind-function tsd-is-external">
<li class="tsd-signature tsd-kind-icon">check<wbr>Address<span class="tsd-signature-symbol">(</span>address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
<li class="tsd-signature tsd-kind-icon">check<wbr>Address<span class="tsd-signature-symbol">(</span>address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/check.ts#L82">check.ts:82</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/check.ts#L82">check.ts:82</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1066,7 +1066,7 @@ img { max-width: 100%; }
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>address: <span class="tsd-signature-type">any</span></h5>
<h5>address: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The address to check</p>
</div>
@ -1081,13 +1081,13 @@ img { max-width: 100%; }
<a name="checkamount" class="tsd-anchor"></a>
<h3>check<wbr>Amount</h3>
<ul class="tsd-signatures tsd-kind-function tsd-is-external">
<li class="tsd-signature tsd-kind-icon">check<wbr>Amount<span class="tsd-signature-symbol">(</span>amount<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
<li class="tsd-signature tsd-kind-icon">check<wbr>Amount<span class="tsd-signature-symbol">(</span>amount<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/check.ts#L38">check.ts:38</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/check.ts#L38">check.ts:38</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1098,7 +1098,7 @@ img { max-width: 100%; }
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>amount: <span class="tsd-signature-type">any</span></h5>
<h5>amount: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The amount to check</p>
</div>
@ -1113,13 +1113,13 @@ img { max-width: 100%; }
<a name="checkhash" class="tsd-anchor"></a>
<h3>check<wbr>Hash</h3>
<ul class="tsd-signatures tsd-kind-function tsd-is-external">
<li class="tsd-signature tsd-kind-icon">check<wbr>Hash<span class="tsd-signature-symbol">(</span>hash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
<li class="tsd-signature tsd-kind-icon">check<wbr>Hash<span class="tsd-signature-symbol">(</span>hash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/check.ts#L62">check.ts:62</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/check.ts#L62">check.ts:62</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1130,7 +1130,7 @@ img { max-width: 100%; }
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>hash: <span class="tsd-signature-type">any</span></h5>
<h5>hash: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The hash to check</p>
</div>
@ -1145,13 +1145,13 @@ img { max-width: 100%; }
<a name="checkkey" class="tsd-anchor"></a>
<h3>check<wbr>Key</h3>
<ul class="tsd-signatures tsd-kind-function tsd-is-external">
<li class="tsd-signature tsd-kind-icon">check<wbr>Key<span class="tsd-signature-symbol">(</span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
<li class="tsd-signature tsd-kind-icon">check<wbr>Key<span class="tsd-signature-symbol">(</span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/check.ts#L72">check.ts:72</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/check.ts#L72">check.ts:72</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1162,7 +1162,7 @@ img { max-width: 100%; }
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>key: <span class="tsd-signature-type">any</span></h5>
<h5>key: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The key to check</p>
</div>
@ -1177,13 +1177,13 @@ img { max-width: 100%; }
<a name="checkseed" class="tsd-anchor"></a>
<h3>check<wbr>Seed</h3>
<ul class="tsd-signatures tsd-kind-function tsd-is-external">
<li class="tsd-signature tsd-kind-icon">check<wbr>Seed<span class="tsd-signature-symbol">(</span>seed<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
<li class="tsd-signature tsd-kind-icon">check<wbr>Seed<span class="tsd-signature-symbol">(</span>seed<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/check.ts#L52">check.ts:52</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/check.ts#L52">check.ts:52</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1194,7 +1194,7 @@ img { max-width: 100%; }
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>seed: <span class="tsd-signature-type">any</span></h5>
<h5>seed: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The seed to check</p>
</div>
@ -1209,13 +1209,13 @@ img { max-width: 100%; }
<a name="checksignature" class="tsd-anchor"></a>
<h3>check<wbr>Signature</h3>
<ul class="tsd-signatures tsd-kind-function tsd-is-external">
<li class="tsd-signature tsd-kind-icon">check<wbr>Signature<span class="tsd-signature-symbol">(</span>signature<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
<li class="tsd-signature tsd-kind-icon">check<wbr>Signature<span class="tsd-signature-symbol">(</span>signature<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/check.ts#L104">check.ts:104</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/check.ts#L104">check.ts:104</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1226,7 +1226,7 @@ img { max-width: 100%; }
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>signature: <span class="tsd-signature-type">any</span></h5>
<h5>signature: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The signature to check</p>
</div>
@ -1241,13 +1241,13 @@ img { max-width: 100%; }
<a name="checkwork" class="tsd-anchor"></a>
<h3>check<wbr>Work</h3>
<ul class="tsd-signatures tsd-kind-function tsd-is-external">
<li class="tsd-signature tsd-kind-icon">check<wbr>Work<span class="tsd-signature-symbol">(</span>work<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
<li class="tsd-signature tsd-kind-icon">check<wbr>Work<span class="tsd-signature-symbol">(</span>work<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/check.ts#L94">check.ts:94</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/check.ts#L94">check.ts:94</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1258,7 +1258,7 @@ img { max-width: 100%; }
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>work: <span class="tsd-signature-type">any</span></h5>
<h5>work: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The work to check</p>
</div>
@ -1279,7 +1279,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/accelerated.ts#L55">accelerated.ts:55</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/accelerated.ts#L55">accelerated.ts:55</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1318,7 +1318,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L59">conversion.ts:59</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L59">conversion.ts:59</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1356,7 +1356,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/block.ts#L36">block.ts:36</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/block.ts#L36">block.ts:36</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1396,7 +1396,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/keys.ts#L98">keys.ts:98</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/keys.ts#L98">keys.ts:98</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1434,7 +1434,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/keys.ts#L66">keys.ts:66</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/keys.ts#L66">keys.ts:66</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1466,7 +1466,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/keys.ts#L40">keys.ts:40</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/keys.ts#L40">keys.ts:40</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1504,7 +1504,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/keys.ts#L19">keys.ts:19</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/keys.ts#L19">keys.ts:19</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1527,7 +1527,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/hash.ts#L39">hash.ts:39</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/hash.ts#L39">hash.ts:39</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1559,7 +1559,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/signature.ts#L26">signature.ts:26</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/signature.ts#L26">signature.ts:26</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1591,7 +1591,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/work.ts#L29">work.ts:29</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/work.ts#L29">work.ts:29</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1623,7 +1623,7 @@ img { max-width: 100%; }
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/signature.ts#L54">signature.ts:54</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/signature.ts#L54">signature.ts:54</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View file

@ -1051,7 +1051,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">balance<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/block.ts#L24">block.ts:24</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/block.ts#L24">block.ts:24</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1066,7 +1066,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">link<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/block.ts#L26">block.ts:26</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/block.ts#L26">block.ts:26</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1081,7 +1081,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">previous<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/block.ts#L20">block.ts:20</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/block.ts#L20">block.ts:20</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1096,7 +1096,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">representative<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/block.ts#L22">block.ts:22</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/block.ts#L22">block.ts:22</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1111,7 +1111,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">work<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/block.ts#L18">block.ts:18</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/block.ts#L18">block.ts:18</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View file

@ -1039,7 +1039,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">worker<wbr>Count<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/accelerated.ts#L44">accelerated.ts:44</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/accelerated.ts#L44">accelerated.ts:44</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1054,7 +1054,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">worker<wbr>Index<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/accelerated.ts#L42">accelerated.ts:42</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/accelerated.ts#L42">accelerated.ts:42</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View file

@ -1039,7 +1039,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">from<span class="tsd-signature-symbol">:</span> <a href="../enums/unit.html" class="tsd-signature-type">Unit</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L47">conversion.ts:47</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L47">conversion.ts:47</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1054,7 +1054,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">to<span class="tsd-signature-symbol">:</span> <a href="../enums/unit.html" class="tsd-signature-type">Unit</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/conversion.ts#L49">conversion.ts:49</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/conversion.ts#L49">conversion.ts:49</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View file

@ -1035,7 +1035,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">use<wbr>Nano<wbr>Prefix<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">true</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/keys.ts#L88">keys.ts:88</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/keys.ts#L88">keys.ts:88</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View file

@ -1051,7 +1051,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">account<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/hash.ts#L22">hash.ts:22</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/hash.ts#L22">hash.ts:22</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1066,7 +1066,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">balance<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/hash.ts#L28">hash.ts:28</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/hash.ts#L28">hash.ts:28</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1081,7 +1081,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">link<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/hash.ts#L30">hash.ts:30</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/hash.ts#L30">hash.ts:30</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1096,7 +1096,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">previous<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/hash.ts#L24">hash.ts:24</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/hash.ts#L24">hash.ts:24</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1111,7 +1111,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">representative<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/hash.ts#L26">hash.ts:26</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/hash.ts#L26">hash.ts:26</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View file

@ -1039,7 +1039,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">hash<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/signature.ts#L15">signature.ts:15</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/signature.ts#L15">signature.ts:15</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1054,7 +1054,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">secret<wbr>Key<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/signature.ts#L17">signature.ts:17</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/signature.ts#L17">signature.ts:17</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View file

@ -1039,7 +1039,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">block<wbr>Hash<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/work.ts#L18">work.ts:18</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/work.ts#L18">work.ts:18</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1054,7 +1054,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">work<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/work.ts#L20">work.ts:20</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/work.ts#L20">work.ts:20</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View file

@ -1043,7 +1043,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">hash<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/signature.ts#L41">signature.ts:41</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/signature.ts#L41">signature.ts:41</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1058,7 +1058,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">public<wbr>Key<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/signature.ts#L45">signature.ts:45</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/signature.ts#L45">signature.ts:45</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
@ -1073,7 +1073,7 @@ img { max-width: 100%; }
<div class="tsd-signature tsd-kind-icon">signature<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/bb54fc1/src/signature.ts#L43">signature.ts:43</a></li>
<li>Defined in <a href="https://github.com/marvinroger/nanocurrency-js/blob/d404f5a/src/signature.ts#L43">signature.ts:43</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">

View file

@ -35,7 +35,7 @@ export function checkNumber(candidate: any) {
* @param amount - The amount to check
* @returns Valid
*/
export function checkAmount(amount: any) {
export function checkAmount(amount: string) {
if (!checkString(amount) || !/^[1-9]{1}[0-9]{0,38}$/.test(amount)) return false;
const candidate = new BigNumber(amount);
@ -49,7 +49,7 @@ export function checkAmount(amount: any) {
* @param seed - The seed to check
* @returns Valid
*/
export function checkSeed(seed: any) {
export function checkSeed(seed: string) {
return checkString(seed) && /^[0-9a-fA-F]{64}$/.test(seed);
}
@ -59,7 +59,7 @@ export function checkSeed(seed: any) {
* @param hash - The hash to check
* @returns Valid
*/
export function checkHash(hash: any) {
export function checkHash(hash: string) {
return checkSeed(hash);
}
@ -69,7 +69,7 @@ export function checkHash(hash: any) {
* @param key - The key to check
* @returns Valid
*/
export function checkKey(key: any) {
export function checkKey(key: string) {
return checkSeed(key);
}
@ -79,7 +79,7 @@ export function checkKey(key: any) {
* @param address - The address to check
* @returns Valid
*/
export function checkAddress(address: any) {
export function checkAddress(address: string) {
const parseResult = parseAddress(address);
return parseResult.valid;
@ -91,7 +91,7 @@ export function checkAddress(address: any) {
* @param work - The work to check
* @returns Valid
*/
export function checkWork(work: any) {
export function checkWork(work: string) {
return checkString(work) && /^[0-9a-fA-F]{16}$/.test(work);
}
@ -101,6 +101,6 @@ export function checkWork(work: any) {
* @param signature - The signature to check
* @returns Valid
*/
export function checkSignature(signature: any) {
export function checkSignature(signature: string) {
return checkString(signature) && /^[0-9a-fA-F]{128}$/.test(signature);
}