@airgap/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.

    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

    Keywords

    none

    Install

    npm i @airgap/sapling-wasm

    DownloadsWeekly Downloads

    176

    Version

    0.0.6

    License

    none

    Unpacked Size

    5.52 MB

    Total Files

    20

    Last publish

    Collaborators

    • avatar