update npmignore to make the module smaller, update readme
This commit is contained in:
parent
06e7cf38db
commit
73f1de2b91
4 changed files with 84 additions and 74 deletions
|
|
@ -1,10 +1,11 @@
|
||||||
.git/
|
.git/
|
||||||
node_modules/
|
node_modules/
|
||||||
test/
|
test/
|
||||||
src/
|
lib/
|
||||||
.gitignore
|
.gitignore
|
||||||
.editorconfig
|
.editorconfig
|
||||||
.travis.yml
|
.travis.yml
|
||||||
webpack.config.json
|
webpack.config.js
|
||||||
tsconfig.json
|
tsconfig.json
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
index.ts
|
||||||
|
|
|
||||||
51
README.md
51
README.md
|
|
@ -1,7 +1,8 @@
|
||||||
# nanocurrency-web
|
# nanocurrency-web
|
||||||
|
|
||||||
[](https://travis-ci.org/numsu/nanocurrency-web-js)
|
[](https://travis-ci.org/numsu/nanocurrency-web-js)
|
||||||
[](https://github.com/numsu/nanocurrency-web-js/blob/master/LICENSE)
|
|
||||||
[](https://badge.fury.io/js/nanocurrency-web)
|
[](https://badge.fury.io/js/nanocurrency-web)
|
||||||
|
[](https://github.com/numsu/nanocurrency-web-js/blob/master/LICENSE)
|
||||||
|
|
||||||
Toolkit for Nano cryptocurrency client side offline implementations allowing you to build web- and mobile applications using Nano without compromising the user's keys by sending them out of their own device.
|
Toolkit for Nano cryptocurrency client side offline implementations allowing you to build web- and mobile applications using Nano without compromising the user's keys by sending them out of their own device.
|
||||||
|
|
||||||
|
|
@ -13,7 +14,7 @@ The toolkit supports creating and importing wallets and signing blocks on-device
|
||||||
* BIP39/44 private key derivation
|
* BIP39/44 private key derivation
|
||||||
* Mnemonic is compatible with the Ledger Nano implementation
|
* Mnemonic is compatible with the Ledger Nano implementation
|
||||||
* Import wallets with a mnemonic phrase or a seed
|
* Import wallets with a mnemonic phrase or a seed
|
||||||
* Sign send, receive and change blocks with a private key
|
* Sign send, receive and change representative blocks with a private key
|
||||||
* Runs in all web browsers and mobile frameworks built with Javascript
|
* Runs in all web browsers and mobile frameworks built with Javascript
|
||||||
* Convert Nano units
|
* Convert Nano units
|
||||||
|
|
||||||
|
|
@ -23,15 +24,16 @@ The toolkit supports creating and importing wallets and signing blocks on-device
|
||||||
|
|
||||||
### From NPM
|
### From NPM
|
||||||
|
|
||||||
```
|
```console
|
||||||
npm install nanocurrency-web
|
npm install nanocurrency-web
|
||||||
```
|
```
|
||||||
| WARNING: do not use any of the keys or addresses listed below to send real assets |
|
|
||||||
|
| WARNING: do not use any of the keys or addresses listed below to send real assets! |
|
||||||
| --- |
|
| --- |
|
||||||
|
|
||||||
|
#### Wallet handling
|
||||||
|
|
||||||
Wallet handling
|
```javascript
|
||||||
```
|
|
||||||
import { wallet } from 'nanocurrency-web'
|
import { wallet } from 'nanocurrency-web'
|
||||||
|
|
||||||
// Generates a new wallet with a mnemonic phrase, seed and an account
|
// Generates a new wallet with a mnemonic phrase, seed and an account
|
||||||
|
|
@ -48,8 +50,9 @@ const wallet = wallet.fromSeed(seed)
|
||||||
// Derive private keys for a seed, from and to are number indexes
|
// Derive private keys for a seed, from and to are number indexes
|
||||||
const accounts = wallet.accounts(seed, from, to)
|
const accounts = wallet.accounts(seed, from, to)
|
||||||
```
|
```
|
||||||
```
|
|
||||||
The returned wallet JSON format is as follows:
|
```javascript
|
||||||
|
// The returned wallet JSON format is as follows:
|
||||||
{
|
{
|
||||||
mnemonic: 'edge defense waste choose enrich upon flee junk siren film clown finish luggage leader kid quick brick print evidence swap drill paddle truly occur',
|
mnemonic: 'edge defense waste choose enrich upon flee junk siren film clown finish luggage leader kid quick brick print evidence swap drill paddle truly occur',
|
||||||
seed: '0dc285fde768f7ff29b66ce7252d56ed92fe003b605907f7a4f683c3dc8586d34a914d3c71fc099bb38ee4a59e5b081a3497b7a323e90cc68f67b5837690310c',
|
seed: '0dc285fde768f7ff29b66ce7252d56ed92fe003b605907f7a4f683c3dc8586d34a914d3c71fc099bb38ee4a59e5b081a3497b7a323e90cc68f67b5837690310c',
|
||||||
|
|
@ -64,8 +67,9 @@ The returned wallet JSON format is as follows:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Signing a receive block
|
#### Signing a receive block
|
||||||
```
|
|
||||||
|
```javascript
|
||||||
import { block } from 'nanocurrency-web'
|
import { block } from 'nanocurrency-web'
|
||||||
|
|
||||||
const privateKey = '781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3';
|
const privateKey = '781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3';
|
||||||
|
|
@ -96,8 +100,9 @@ const data = {
|
||||||
const signedBlock = block.receive(data, privateKey)
|
const signedBlock = block.receive(data, privateKey)
|
||||||
```
|
```
|
||||||
|
|
||||||
Signing a send block
|
#### Signing a send block
|
||||||
```
|
|
||||||
|
```javascript
|
||||||
import { block } from 'nanocurrency-web'
|
import { block } from 'nanocurrency-web'
|
||||||
|
|
||||||
const privateKey = '781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3';
|
const privateKey = '781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3';
|
||||||
|
|
@ -128,8 +133,9 @@ const data = {
|
||||||
const signedBlock = block.send(data, privateKey)
|
const signedBlock = block.send(data, privateKey)
|
||||||
```
|
```
|
||||||
|
|
||||||
Signing a change representative block
|
#### Signing a change representative block
|
||||||
```
|
|
||||||
|
```javascript
|
||||||
import { block } from 'nanocurrency-web'
|
import { block } from 'nanocurrency-web'
|
||||||
|
|
||||||
const privateKey = '781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3';
|
const privateKey = '781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3';
|
||||||
|
|
@ -154,8 +160,11 @@ const data = {
|
||||||
const signedBlock = block.representative(data, privateKey)
|
const signedBlock = block.representative(data, privateKey)
|
||||||
```
|
```
|
||||||
|
|
||||||
Converting units
|
#### Converting units
|
||||||
```
|
|
||||||
|
Supported unit values are RAW, NANO, MRAI, KRAI, RAW.
|
||||||
|
|
||||||
|
```javascript
|
||||||
import { converter } from 'nanocurrency-web'
|
import { converter } from 'nanocurrency-web'
|
||||||
|
|
||||||
// Convert 1 Nano to RAW
|
// Convert 1 Nano to RAW
|
||||||
|
|
@ -167,9 +176,9 @@ const converted = converter.convert('1000000000000000000000000000000', 'RAW', 'N
|
||||||
|
|
||||||
### In web
|
### In web
|
||||||
|
|
||||||
```
|
```html
|
||||||
<script src="https://unpkg.com/nanocurrency-web@1.0.5" type="text/javascript"></script>
|
<script src="https://unpkg.com/nanocurrency-web@1.0.6" type="text/javascript"></script>
|
||||||
<scrypt type="text/javascript">
|
<script type="text/javascript">
|
||||||
NanocurrencyWeb.wallet.generate(...);
|
NanocurrencyWeb.wallet.generate(...);
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
@ -178,7 +187,7 @@ const converted = converter.convert('1000000000000000000000000000000', 'RAW', 'N
|
||||||
|
|
||||||
## Contributions
|
## Contributions
|
||||||
|
|
||||||
You are welcome to contribute to the module. To develop, use the following commands
|
You are welcome to contribute to the module. To develop, use the following commands.
|
||||||
|
|
||||||
* `npm install` to install all the dependencies
|
* `npm install` to install all the dependencies
|
||||||
* `npm run build` to build the Typescript code
|
* `npm run build` to build the Typescript code
|
||||||
|
|
@ -188,4 +197,4 @@ You are welcome to contribute to the module. To develop, use the following comma
|
||||||
|
|
||||||
If this helped you in your endeavours and you feel like supporting the developer, feel free to donate some Nano:
|
If this helped you in your endeavours and you feel like supporting the developer, feel free to donate some Nano:
|
||||||
|
|
||||||
`nano_35wfowmdqqe34uhmh4fo8i51kxkpr9ybahc4fb7yuzzxtez3oje4et5nk75d`
|
`nano_1wmcgzbqgbyyawsto6t37sc6y7pkekpctzp7n3ay6pcxcy717p5g79rpfj7e`
|
||||||
|
|
|
||||||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "nanocurrency-web",
|
"name": "nanocurrency-web",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "nanocurrency-web",
|
"name": "nanocurrency-web",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"description": "Toolkit for Nano cryptocurrency client side offline integrations",
|
"description": "Toolkit for Nano cryptocurrency client side offline integrations",
|
||||||
"author": "Miro Metsänheimo <miro@metsanheimo.fi>",
|
"author": "Miro Metsänheimo <miro@metsanheimo.fi>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue