@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 +50 -0
- package/dist/f163b2ed6a9bb7b7e6a7_wasm.js +2 -0
- package/dist/f163b2ed6a9bb7b7e6a7_wasm.js.map +1 -0
- package/dist/index.browser.js +2 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.node.js +2 -0
- package/dist/index.node.js.map +1 -0
- package/dist/internal/address/payment-address.d.ts +8 -0
- package/dist/internal/key/authorizing-key.d.ts +2 -0
- package/dist/internal/key/key-agreement.d.ts +2 -0
- package/dist/internal/key/spending-key.d.ts +2 -0
- package/dist/internal/key/viewing-key.d.ts +5 -0
- package/dist/internal/parameters.d.ts +2 -0
- package/dist/internal/transaction/binding-signature.d.ts +2 -0
- package/dist/internal/transaction/commitment.d.ts +2 -0
- package/dist/internal/transaction/merkle-tree.d.ts +2 -0
- package/dist/internal/transaction/nullifier.d.ts +2 -0
- package/dist/internal/transaction/output-description.d.ts +5 -0
- package/dist/internal/transaction/spend-description.d.ts +5 -0
- package/dist/internal/types.d.ts +2 -0
- package/dist/internal/utils.d.ts +9 -0
- package/dist/sapling.d.ts +223 -0
- package/dist/types.d.ts +61 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Sapling Wasm
|
|
2
|
+
|
|
3
|
+
[](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
|
+
```
|