@temple-wallet/sapling-wasm
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

AirGap Sapling Wasm

npm

A Wasm wrapper around Zcash Rust crates.

Fixed by Madfish Solutions to work around cant find module 'crypto' error. https://github.com/rustwasm/wasm-bindgen/issues/2323

Install

To add JS AirGap Sapling library into your project run:

$ npm install --save @airgap/sapling-wasm

Examples

import * as bip39 from 'bip39'
import * as sapling from '@airgap/sapling-wasm'
import { SaplingPaymentAddress } from '@airgap/sapling-wasm'

const mnemonic: string = bip39.generateMnemonic()
const seed: Buffer = await bip39.mnemonicToSeed(mnemonic, '')
const derivationPath: string = 'm/'

// create an extended spending key
const spendingKey: Buffer = await sapling.getExtendedSpendingKey(seed, derivationPath)
console.log('spendingKey =', spendingKey.toString('hex'))

// create an extended full viewing key
const viewingKey: Buffer = await sapling.getExtendedFullViewingKey(seed, derivationPath)
console.log('viewingKey =', viewingKey.toString('hex'))

// get default address
const address: SaplingPaymentAddress = await sapling.getPaymentAddressFromViewingKey(viewingKey)
console.log(
  'address.index =', address.index.toString('hex'),
  'address.raw =', address.raw.toString('hex')
)

More advanced examples can be found in ./examples.

Development

Build

To build a development version that links the library to examples run:

$ npm run build

To build a production version run:

$ npm run build:prod

Readme

Keywords

none

Package Sidebar

Install

npm i @temple-wallet/sapling-wasm

Weekly Downloads

1

Version

0.0.6

License

none

Unpacked Size

5.31 MB

Total Files

21

Last publish

Collaborators

  • alexseleznov
  • keshan3262
  • konchunas
  • madfish