Skip to content

airgap-it/airgap-sapling

Repository files navigation

AirGap Sapling

npm jitpack spm

Wasm, Android and iOS wrappers around Zcash Rust crates.

Project Overview

The project is divided into the following packages:

  • sapling - common sources in Rust, provides C and Wasm bindings for Zcash crates
  • sapling-wasm - a JavaScript library using Wasm bindings from the sapling package
  • sapling-android - a native Android library using C bindings from the sapling package
  • sapling-ios - a native iOS library using C bindings from the sapling package

Sapling Wasm

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 js/examples.

Sapling Android

Install

To add Android AirGap Sapling library into your project:

  1. Ensure Android NDK is supported in your project.

  2. Add the JitPack repository to your root build.gradle file:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
  1. Add the dependency:
def saplingVersion = "x.y.z"

implementation "com.github.airgap-it:airgap-sapling:$saplingVersion"

Sapling iOS

Install

To add iOS AirGap Sapling into your project, add the package dependency:

Xcode

Open the Add Package Dependency window (as described in the official guide) and enter the AirGap Sapling GitHub repository URL:

https://github.com/airgap-it/airgap-sapling

Package.swift file

Add the following dependency in your Package.swift file:

.package(url: "https://github.com/airgap-it/airgap-sapling", from: "x.y.z")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •