@taquito/sapling-wasm 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Sapling Wasm
2
+
3
+ [![npm](https://img.shields.io/npm/v/@taquito/sapling-wasm.svg?colorB=brightgreen)](https://www.npmjs.com/package/@taquito/sapling-wasm)
4
+
5
+ A Wasm wrapper around [Zcash Rust crates](https://github.com/zcash/librustzcash), published as part of the Taquito package namespace.
6
+
7
+ The published package name is `@taquito/sapling-wasm`.
8
+
9
+ ## Install
10
+
11
+ To add the JavaScript Sapling library into your project:
12
+
13
+ ```bash
14
+ npm install --save @taquito/sapling-wasm
15
+ ```
16
+
17
+ ## Examples
18
+
19
+ ```ts
20
+ import * as bip39 from 'bip39'
21
+ import * as sapling from '@taquito/sapling-wasm'
22
+ import { SaplingPaymentAddress } from '@taquito/sapling-wasm'
23
+
24
+ const mnemonic: string = bip39.generateMnemonic()
25
+ const seed: Buffer = await bip39.mnemonicToSeed(mnemonic, '')
26
+ const derivationPath: string = 'm/'
27
+
28
+ // create an extended spending key
29
+ const spendingKey: Buffer = await sapling.getExtendedSpendingKey(seed, derivationPath)
30
+ console.log('spendingKey =', spendingKey.toString('hex'))
31
+
32
+ // create an extended full viewing key
33
+ const viewingKey: Buffer = await sapling.getExtendedFullViewingKey(seed, derivationPath)
34
+ console.log('viewingKey =', viewingKey.toString('hex'))
35
+
36
+ // get default address
37
+ const address: SaplingPaymentAddress = await sapling.getPaymentAddressFromViewingKey(viewingKey)
38
+ console.log(
39
+ 'address.index =', address.index.toString('hex'),
40
+ 'address.raw =', address.raw.toString('hex')
41
+ )
42
+ ```
43
+
44
+ More advanced examples can be found in `./examples`.
45
+
46
+ ## Development
47
+
48
+ ```bash
49
+ npm run build
50
+ ```