diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79995bb..bb97ae5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,7 +41,7 @@ build_android: #build_ios: # stage: build # script: -# - xcodebuild -scheme AirGapSapling -destination generic/platform=iOS Simulator,arch=x86_64 +# - xcodebuild -scheme MadfishSapling -destination generic/platform=iOS Simulator,arch=x86_64 check: stage: check diff --git a/Package.swift b/Package.swift index a84f290..bfa63f0 100644 --- a/Package.swift +++ b/Package.swift @@ -15,7 +15,7 @@ let excludes: [String] = [ ] let package = Package( - name: "AirGapSapling", + name: "MadfishSapling", products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( diff --git a/README.md b/README.md index 1a8ef3c..a82e027 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# AirGap Sapling +# Madfish Sapling [![npm](https://img.shields.io/npm/v/@airgap/sapling-wasm.svg?colorB=brightgreen)](https://www.npmjs.com/package/@airgap/sapling-wasm) -[![jitpack](https://img.shields.io/jitpack/v/github/airgap-it/airgap-sapling)](https://jitpack.io/#airgap-it/airgap-sapling) -[![spm](https://img.shields.io/github/v/tag/airgap-it/airgap-sapling?include_prereleases&label=spm)](https://github.com/airgap-it/airgap-sapling/releases) +[![jitpack](https://img.shields.io/jitpack/v/github/madfish-solutions/madfish-sapling)](https://jitpack.io/#madfish-solutions/madfish-sapling) +[![spm](https://img.shields.io/github/v/tag/madfish-solutions/madfish-sapling?include_prereleases&label=spm)](https://github.com/madfish-solutions/madfish-sapling/releases) Wasm, Android and iOS wrappers around [Zcash Rust crates](https://github.com/zcash/librustzcash). @@ -16,48 +16,13 @@ The project is divided into the following packages: ## Sapling Wasm -### Install - -To add JS AirGap Sapling library into your project run: - -```bash -$ npm install --save @airgap/sapling-wasm -``` - -### Examples - -```ts -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`. +The custom version of Sapling Wasm has not been released, use [Airgap Sapling Wasm](https://github.com/airgap-it/airgap-sapling?tab=readme-ov-file#sapling-wasm). ## Sapling Android ### Install -To add Android AirGap Sapling library into your project: +To add Android Madfish Sapling library into your project: 1. Ensure [Android NDK](https://developer.android.com/ndk) is supported in your project. @@ -75,20 +40,20 @@ To add Android AirGap Sapling library into your project: ```groovy def saplingVersion = "x.y.z" - implementation "com.github.airgap-it:airgap-sapling:$saplingVersion" + implementation "com.github.madfish-solutions:madfish-sapling:$saplingVersion" ``` ## Sapling iOS ### Install -To add iOS AirGap Sapling into your project, add the package dependency: +To add iOS Madfish Sapling into your project, add the package dependency: #### Xcode -Open the `Add Package Dependency` window (as described in [the official guide](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)) and enter the AirGap Sapling GitHub repository URL: +Open the `Add Package Dependency` window (as described in [the official guide](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)) and enter the Madfish Sapling GitHub repository URL: ``` -https://github.com/airgap-it/airgap-sapling +https://github.com/madfish-solutions/madfish-sapling ``` #### Package.swift file @@ -96,6 +61,6 @@ https://github.com/airgap-it/airgap-sapling Add the following dependency in your `Package.swift` file: ```swift -.package(url: "https://github.com/airgap-it/airgap-sapling", from: "x.y.z") +.package(url: "https://github.com/madfish-solutions/madfish-sapling", from: "x.y.z") ``` diff --git a/lerna.json b/lerna.json index dac12ff..33cfc39 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "packages": [ "packages/sapling-wasm" ], - "version": "0.0.11-beta.1" + "version": "0.0.11-beta.2" } diff --git a/package-lock.json b/package-lock.json index 0f29fde..c9bcc54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "airgap-sapling", + "name": "madfish-sapling", "version": "0.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "airgap-sapling", + "name": "madfish-sapling", "version": "0.0.0", "devDependencies": { "@types/bn.js": "^4.11.6", @@ -13,7 +13,7 @@ "@typescript-eslint/eslint-plugin": "^4.9.1", "@typescript-eslint/eslint-plugin-tslint": "^4.9.1", "@typescript-eslint/parser": "^4.9.1", - "@wasm-tool/wasm-pack-plugin": "^1.7.0", + "@wasm-tool/wasm-pack-plugin": "^1.6.0", "axios": "^0.21.0", "bip39": "^3.0.3", "bn.js": "^5.1.3", diff --git a/package.json b/package.json index a8cdddd..7483e1c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "airgap-sapling", + "name": "madfish-sapling", "version": "0.0.0", "private": true, "scripts": { diff --git a/packages/sapling-android/README.md b/packages/sapling-android/README.md index f79914a..88e5ea4 100644 --- a/packages/sapling-android/README.md +++ b/packages/sapling-android/README.md @@ -1,12 +1,12 @@ -# AirGap Sapling Android +# Madfish Sapling Android -[![release](https://img.shields.io/jitpack/v/github/airgap-it/airgap-sapling)](https://jitpack.io/#airgap-it/airgap-sapling) +[![release](https://img.shields.io/jitpack/v/github/madfish-solutions/madfish-sapling)](https://jitpack.io/#madfish-solutions/madfish-sapling) An Android wrapper around [Zcash Rust crates](https://github.com/zcash/librustzcash). ## Install -To add Android AirGap Sapling library into your project: +To add Android Madfish Sapling library into your project: 1. Ensure [Android NDK](https://developer.android.com/ndk) is supported in your project. @@ -24,7 +24,7 @@ To add Android AirGap Sapling library into your project: ```groovy def saplingVersion = "x.y.z" - implementation "com.github.airgap-it:airgap-sapling:$saplingVersion" + implementation "com.github.madfish-solutions:madfish-sapling:$saplingVersion" ``` ## Development diff --git a/packages/sapling-android/app/build.gradle b/packages/sapling-android/app/build.gradle index 3649380..081bbaf 100644 --- a/packages/sapling-android/app/build.gradle +++ b/packages/sapling-android/app/build.gradle @@ -12,11 +12,11 @@ android { ndkVersion = "29.0.14206865" defaultConfig { - namespace "it.airgap.sapling" + namespace "com.madfish.sapling" minSdk 21 targetSdk 36 versionCode 1 - versionName "0.0.11-beta01" + versionName "0.0.11-beta02" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { @@ -51,7 +51,7 @@ android { cargo { module = '../../sapling' - libname = 'libairgap_sapling' + libname = 'libmadfish_sapling' targets = ['arm', 'arm64', 'x86', 'x86_64'] profile = 'release' prebuiltToolchains = true @@ -83,7 +83,7 @@ afterEvaluate { release(MavenPublication) { from components.release - groupId = 'it.airgap' + groupId = 'com.madfish' artifactId = 'sapling' version = android.defaultConfig.versionName } diff --git a/packages/sapling-android/app/src/androidTest/java/it/airgap/sapling/ExampleInstrumentedTest.kt b/packages/sapling-android/app/src/androidTest/java/com/madfish/sapling/ExampleInstrumentedTest.kt similarity index 85% rename from packages/sapling-android/app/src/androidTest/java/it/airgap/sapling/ExampleInstrumentedTest.kt rename to packages/sapling-android/app/src/androidTest/java/com/madfish/sapling/ExampleInstrumentedTest.kt index cccdaf0..35bce9e 100644 --- a/packages/sapling-android/app/src/androidTest/java/it/airgap/sapling/ExampleInstrumentedTest.kt +++ b/packages/sapling-android/app/src/androidTest/java/com/madfish/sapling/ExampleInstrumentedTest.kt @@ -1,4 +1,4 @@ -package it.airgap.sapling +package com.madfish.sapling import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -19,6 +19,6 @@ class ExampleInstrumentedTest { fun useAppContext() { // Context of the app under test. val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("it.airgap.sapling", appContext.packageName) + assertEquals("com.madfish.sapling", appContext.packageName) } } \ No newline at end of file diff --git a/packages/sapling-android/app/src/main/cpp/CMakeLists.txt b/packages/sapling-android/app/src/main/cpp/CMakeLists.txt index 6c4a8bd..291c6e0 100644 --- a/packages/sapling-android/app/src/main/cpp/CMakeLists.txt +++ b/packages/sapling-android/app/src/main/cpp/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.10.2) # Declares and names the project. -project("airgap-sapling") +project("madfish-sapling") # Creates and names a library, sets it as either STATIC # or SHARED, and provides the relative paths to its source code. diff --git a/packages/sapling-android/app/src/main/cpp/include/sapling_ffi.h b/packages/sapling-android/app/src/main/cpp/include/sapling_ffi.h index d3f2bd6..75f8975 100644 --- a/packages/sapling-android/app/src/main/cpp/include/sapling_ffi.h +++ b/packages/sapling-android/app/src/main/cpp/include/sapling_ffi.h @@ -1,5 +1,5 @@ -#ifndef AIRGAP_SAPLING_H -#define AIRGAP_SAPLING_H +#ifndef MADFISH_SAPLING_H +#define MADFISH_SAPLING_H #include "stdlib.h" #include "stddef.h" @@ -254,4 +254,4 @@ extern "C" { }; #endif // __cplusplus -#endif // AIRGAP_SAPLING_H \ No newline at end of file +#endif // MADFISH_SAPLING_H \ No newline at end of file diff --git a/packages/sapling-android/app/src/main/cpp/libs/arm64-v8a/libsapling_ffi.a b/packages/sapling-android/app/src/main/cpp/libs/arm64-v8a/libsapling_ffi.a index d147398..6069f57 100644 Binary files a/packages/sapling-android/app/src/main/cpp/libs/arm64-v8a/libsapling_ffi.a and b/packages/sapling-android/app/src/main/cpp/libs/arm64-v8a/libsapling_ffi.a differ diff --git a/packages/sapling-android/app/src/main/cpp/libs/armeabi-v7a/libsapling_ffi.a b/packages/sapling-android/app/src/main/cpp/libs/armeabi-v7a/libsapling_ffi.a index 55c1618..484d149 100644 Binary files a/packages/sapling-android/app/src/main/cpp/libs/armeabi-v7a/libsapling_ffi.a and b/packages/sapling-android/app/src/main/cpp/libs/armeabi-v7a/libsapling_ffi.a differ diff --git a/packages/sapling-android/app/src/main/cpp/libs/x86/libsapling_ffi.a b/packages/sapling-android/app/src/main/cpp/libs/x86/libsapling_ffi.a index c318159..2511e2c 100644 Binary files a/packages/sapling-android/app/src/main/cpp/libs/x86/libsapling_ffi.a and b/packages/sapling-android/app/src/main/cpp/libs/x86/libsapling_ffi.a differ diff --git a/packages/sapling-android/app/src/main/cpp/libs/x86_64/libsapling_ffi.a b/packages/sapling-android/app/src/main/cpp/libs/x86_64/libsapling_ffi.a index 98c2faf..6b1cd31 100644 Binary files a/packages/sapling-android/app/src/main/cpp/libs/x86_64/libsapling_ffi.a and b/packages/sapling-android/app/src/main/cpp/libs/x86_64/libsapling_ffi.a differ diff --git a/packages/sapling-android/app/src/main/cpp/sapling.cpp b/packages/sapling-android/app/src/main/cpp/sapling.cpp index 23f1d45..496f4dc 100644 --- a/packages/sapling-android/app/src/main/cpp/sapling.cpp +++ b/packages/sapling-android/app/src/main/cpp/sapling.cpp @@ -4,7 +4,7 @@ extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extPakFromXsk( +Java_com_madfish_sapling_Sapling_extPakFromXsk( JNIEnv *env, jobject /* this */, jbyteArray jxsk) { @@ -25,7 +25,7 @@ Java_it_airgap_sapling_Sapling_extPakFromXsk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extComputeCmu( +Java_com_madfish_sapling_Sapling_extComputeCmu( JNIEnv *env, jobject /* this */, jbyteArray jaddr, @@ -54,7 +54,7 @@ Java_it_airgap_sapling_Sapling_extComputeCmu( extern "C" JNIEXPORT jboolean JNICALL -Java_it_airgap_sapling_Sapling_extInitParameters( +Java_com_madfish_sapling_Sapling_extInitParameters( JNIEnv *env, jobject /* this */, jbyteArray jspendParams, @@ -77,7 +77,7 @@ Java_it_airgap_sapling_Sapling_extInitParameters( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extKeyAgreement( +Java_com_madfish_sapling_Sapling_extKeyAgreement( JNIEnv *env, jobject /* this */, jbyteArray jp, @@ -103,7 +103,7 @@ Java_it_airgap_sapling_Sapling_extKeyAgreement( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extMerkleHash( +Java_com_madfish_sapling_Sapling_extMerkleHash( JNIEnv *env, jobject /* this */, jlong jdepth, @@ -132,7 +132,7 @@ Java_it_airgap_sapling_Sapling_extMerkleHash( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extComputeNullifierWithXfvk( +Java_com_madfish_sapling_Sapling_extComputeNullifierWithXfvk( JNIEnv *env, jobject /* this */, jbyteArray jxfvk, @@ -169,7 +169,7 @@ Java_it_airgap_sapling_Sapling_extComputeNullifierWithXfvk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extOutputDescriptionFromXfvk( +Java_com_madfish_sapling_Sapling_extOutputDescriptionFromXfvk( JNIEnv *env, jobject /* this */, jlong jctx, @@ -204,7 +204,7 @@ Java_it_airgap_sapling_Sapling_extOutputDescriptionFromXfvk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extOutputDescriptionFromXfvkWithMemo( +Java_com_madfish_sapling_Sapling_extOutputDescriptionFromXfvkWithMemo( JNIEnv *env, jobject /* this */, jlong jctx, @@ -256,7 +256,7 @@ Java_it_airgap_sapling_Sapling_extOutputDescriptionFromXfvkWithMemo( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extOutputDescriptionFromOvk( +Java_com_madfish_sapling_Sapling_extOutputDescriptionFromOvk( JNIEnv *env, jobject /* this */, jlong jctx, @@ -291,7 +291,7 @@ Java_it_airgap_sapling_Sapling_extOutputDescriptionFromOvk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extPartialOutputDescription( +Java_com_madfish_sapling_Sapling_extPartialOutputDescription( JNIEnv *env, jobject /* this */, jlong jctx, @@ -326,7 +326,7 @@ Java_it_airgap_sapling_Sapling_extPartialOutputDescription( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extDeriveEpkFromEsk( +Java_com_madfish_sapling_Sapling_extDeriveEpkFromEsk( JNIEnv *env, jobject /* this */, jbyteArray jdiv, @@ -352,7 +352,7 @@ Java_it_airgap_sapling_Sapling_extDeriveEpkFromEsk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extDefaultPaymentAddressFromXfvk( +Java_com_madfish_sapling_Sapling_extDefaultPaymentAddressFromXfvk( JNIEnv *env, jobject /* this */, jbyteArray jxfvk) { @@ -371,7 +371,7 @@ Java_it_airgap_sapling_Sapling_extDefaultPaymentAddressFromXfvk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extNextPaymentAddressFromXfvk( +Java_com_madfish_sapling_Sapling_extNextPaymentAddressFromXfvk( JNIEnv *env, jobject /* this */, jbyteArray jxfvk, @@ -394,7 +394,7 @@ Java_it_airgap_sapling_Sapling_extNextPaymentAddressFromXfvk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extPaymentAddressFromXfvk( +Java_com_madfish_sapling_Sapling_extPaymentAddressFromXfvk( JNIEnv *env, jobject /* this */, jbyteArray jxfvk, @@ -418,7 +418,7 @@ Java_it_airgap_sapling_Sapling_extPaymentAddressFromXfvk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extPaymentAddressFromIvk( +Java_com_madfish_sapling_Sapling_extPaymentAddressFromIvk( JNIEnv *env, jobject /* this */, jbyteArray jivk, @@ -442,7 +442,7 @@ Java_it_airgap_sapling_Sapling_extPaymentAddressFromIvk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extDiversifierFromPaymentAddress( +Java_com_madfish_sapling_Sapling_extDiversifierFromPaymentAddress( JNIEnv *env, jobject /* this */, jbyteArray jaddr) { @@ -461,7 +461,7 @@ Java_it_airgap_sapling_Sapling_extDiversifierFromPaymentAddress( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extPkdFromPaymentAddress( +Java_com_madfish_sapling_Sapling_extPkdFromPaymentAddress( JNIEnv *env, jobject /* this */, jbyteArray jaddr) { @@ -482,7 +482,7 @@ Java_it_airgap_sapling_Sapling_extPkdFromPaymentAddress( extern "C" JNIEXPORT jlong JNICALL -Java_it_airgap_sapling_Sapling_extInitProvingContext( +Java_com_madfish_sapling_Sapling_extInitProvingContext( JNIEnv *env, jobject /* this */) { return (jlong) c_init_proving_context(); @@ -490,7 +490,7 @@ Java_it_airgap_sapling_Sapling_extInitProvingContext( extern "C" JNIEXPORT void JNICALL -Java_it_airgap_sapling_Sapling_extDropProvingContext( +Java_com_madfish_sapling_Sapling_extDropProvingContext( JNIEnv *env, jobject /* this */, jlong jctx) { @@ -501,7 +501,7 @@ Java_it_airgap_sapling_Sapling_extDropProvingContext( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extRandR(JNIEnv *env, jobject /* this */) { +Java_com_madfish_sapling_Sapling_extRandR(JNIEnv *env, jobject /* this */) { size_t r_len; unsigned char *r = c_rand_r(&r_len); jbyteArray jr = uchar_to_jbyteArray(env, r, r_len); @@ -515,7 +515,7 @@ Java_it_airgap_sapling_Sapling_extRandR(JNIEnv *env, jobject /* this */) { extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extCreateBindingSignature( +Java_com_madfish_sapling_Sapling_extCreateBindingSignature( JNIEnv *env, jobject /* this */, jlong jctx, @@ -541,7 +541,7 @@ Java_it_airgap_sapling_Sapling_extCreateBindingSignature( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extSpendDescriptionFromXsk( +Java_com_madfish_sapling_Sapling_extSpendDescriptionFromXsk( JNIEnv *env, jobject /* this */, jlong jctx, @@ -607,7 +607,7 @@ Java_it_airgap_sapling_Sapling_extSpendDescriptionFromXsk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extSpendDescriptionFromPak( +Java_com_madfish_sapling_Sapling_extSpendDescriptionFromPak( JNIEnv *env, jobject /* this */, jlong jctx, @@ -673,7 +673,7 @@ Java_it_airgap_sapling_Sapling_extSpendDescriptionFromPak( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extSignSpendDescriptionWithXsk( +Java_com_madfish_sapling_Sapling_extSignSpendDescriptionWithXsk( JNIEnv *env, jobject /* this */, jbyteArray js_desc, @@ -719,7 +719,7 @@ Java_it_airgap_sapling_Sapling_extSignSpendDescriptionWithXsk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extXsk( +Java_com_madfish_sapling_Sapling_extXsk( JNIEnv *env, jobject /* this */, jbyteArray jseed, @@ -744,7 +744,7 @@ Java_it_airgap_sapling_Sapling_extXsk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extXfvk( +Java_com_madfish_sapling_Sapling_extXfvk( JNIEnv *env, jobject /* this */, jbyteArray jseed, @@ -767,7 +767,7 @@ Java_it_airgap_sapling_Sapling_extXfvk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extXfvkFromXsk( +Java_com_madfish_sapling_Sapling_extXfvkFromXsk( JNIEnv *env, jobject /* this */, jbyteArray jxsk) { @@ -786,7 +786,7 @@ Java_it_airgap_sapling_Sapling_extXfvkFromXsk( extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extOvkFromXfvk(JNIEnv *env, jobject /* this */, jbyteArray jxfvk) { +Java_com_madfish_sapling_Sapling_extOvkFromXfvk(JNIEnv *env, jobject /* this */, jbyteArray jxfvk) { size_t xfvk_len; const unsigned char *xfvk = jbyteArray_to_uchar(env, jxfvk, &xfvk_len); @@ -802,7 +802,7 @@ Java_it_airgap_sapling_Sapling_extOvkFromXfvk(JNIEnv *env, jobject /* this */, j extern "C" JNIEXPORT jbyteArray JNICALL -Java_it_airgap_sapling_Sapling_extXfvkToIvk(JNIEnv *env, jobject /* this */, jbyteArray jxfvk) { +Java_com_madfish_sapling_Sapling_extXfvkToIvk(JNIEnv *env, jobject /* this */, jbyteArray jxfvk) { size_t xfvk_len; const unsigned char *xfvk = jbyteArray_to_uchar(env, jxfvk, &xfvk_len); diff --git a/packages/sapling-android/app/src/main/java/it/airgap/sapling/Sapling.kt b/packages/sapling-android/app/src/main/java/com/madfish/sapling/Sapling.kt similarity index 99% rename from packages/sapling-android/app/src/main/java/it/airgap/sapling/Sapling.kt rename to packages/sapling-android/app/src/main/java/com/madfish/sapling/Sapling.kt index e626491..33a96da 100644 --- a/packages/sapling-android/app/src/main/java/it/airgap/sapling/Sapling.kt +++ b/packages/sapling-android/app/src/main/java/com/madfish/sapling/Sapling.kt @@ -1,4 +1,4 @@ -package it.airgap.sapling +package com.madfish.sapling public class Sapling { diff --git a/packages/sapling-android/app/src/main/java/it/airgap/sapling/SaplingException.kt b/packages/sapling-android/app/src/main/java/com/madfish/sapling/SaplingException.kt similarity index 70% rename from packages/sapling-android/app/src/main/java/it/airgap/sapling/SaplingException.kt rename to packages/sapling-android/app/src/main/java/com/madfish/sapling/SaplingException.kt index bd10bb5..271f39c 100644 --- a/packages/sapling-android/app/src/main/java/it/airgap/sapling/SaplingException.kt +++ b/packages/sapling-android/app/src/main/java/com/madfish/sapling/SaplingException.kt @@ -1,3 +1,3 @@ -package it.airgap.sapling +package com.madfish.sapling public class SaplingException(message: String) : Exception(message) \ No newline at end of file diff --git a/packages/sapling-android/app/src/test/java/it/airgap/sapling/ExampleUnitTest.kt b/packages/sapling-android/app/src/test/java/com/madfish/sapling/ExampleUnitTest.kt similarity index 92% rename from packages/sapling-android/app/src/test/java/it/airgap/sapling/ExampleUnitTest.kt rename to packages/sapling-android/app/src/test/java/com/madfish/sapling/ExampleUnitTest.kt index b3ebdb7..cbccfdc 100644 --- a/packages/sapling-android/app/src/test/java/it/airgap/sapling/ExampleUnitTest.kt +++ b/packages/sapling-android/app/src/test/java/com/madfish/sapling/ExampleUnitTest.kt @@ -1,4 +1,4 @@ -package it.airgap.sapling +package com.madfish.sapling import org.junit.Test diff --git a/packages/sapling-ios/README.md b/packages/sapling-ios/README.md index b690616..c6527ae 100644 --- a/packages/sapling-ios/README.md +++ b/packages/sapling-ios/README.md @@ -1,18 +1,18 @@ -# AirGap Sapling iOS +# Madfish Sapling iOS -[![release](https://img.shields.io/github/v/tag/airgap-it/airgap-sapling?include_prereleases)](https://github.com/airgap-it/airgap-sapling/releases) +[![release](https://img.shields.io/github/v/tag/madfish-solutions/madfish-sapling?include_prereleases)](https://github.com/madfish-solutions/madfish-sapling/releases) An iOS wrapper around [Zcash Rust crates](https://github.com/zcash/librustzcash). ## Install -To add iOS AirGap Sapling into your project, add the package dependency: +To add iOS Madfish Sapling into your project, add the package dependency: ### Xcode -Open the `Add Package Dependency` window (as described in [the official guide](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)) and enter the AirGap Sapling GitHub repository URL: +Open the `Add Package Dependency` window (as described in [the official guide](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)) and enter the Madfish Sapling GitHub repository URL: ``` -https://github.com/airgap-it/airgap-sapling +https://github.com/madfish-solutions/madfish-sapling ``` ### Package.swift file @@ -20,7 +20,7 @@ https://github.com/airgap-it/airgap-sapling Add the following dependency in your `Package.swift` file: ```swift -.package(url: "https://github.com/airgap-it/airgap-sapling", from: "x.y.z") +.package(url: "https://github.com/madfish-solutions/madfish-sapling", from: "x.y.z") ``` diff --git a/packages/sapling-ios/SaplingFFI.xcframework/Info.plist b/packages/sapling-ios/SaplingFFI.xcframework/Info.plist index 752c52d..5e7e597 100644 --- a/packages/sapling-ios/SaplingFFI.xcframework/Info.plist +++ b/packages/sapling-ios/SaplingFFI.xcframework/Info.plist @@ -5,34 +5,39 @@ AvailableLibraries + BinaryPath + libmadfish_sapling.a HeadersPath Headers LibraryIdentifier - ios-arm64 + ios-arm64_x86_64-simulator LibraryPath - libairgap_sapling.a + libmadfish_sapling.a SupportedArchitectures arm64 + x86_64 SupportedPlatform ios + SupportedPlatformVariant + simulator + BinaryPath + libmadfish_sapling.a HeadersPath Headers LibraryIdentifier - ios-x86_64-simulator + ios-arm64 LibraryPath - libairgap_sapling.a + libmadfish_sapling.a SupportedArchitectures - x86_64 + arm64 SupportedPlatform ios - SupportedPlatformVariant - simulator CFBundlePackageType diff --git a/packages/sapling/include/airgap_sapling.h b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/Headers/madfish_sapling.h similarity index 98% rename from packages/sapling/include/airgap_sapling.h rename to packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/Headers/madfish_sapling.h index d3f2bd6..75f8975 100644 --- a/packages/sapling/include/airgap_sapling.h +++ b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/Headers/madfish_sapling.h @@ -1,5 +1,5 @@ -#ifndef AIRGAP_SAPLING_H -#define AIRGAP_SAPLING_H +#ifndef MADFISH_SAPLING_H +#define MADFISH_SAPLING_H #include "stdlib.h" #include "stddef.h" @@ -254,4 +254,4 @@ extern "C" { }; #endif // __cplusplus -#endif // AIRGAP_SAPLING_H \ No newline at end of file +#endif // MADFISH_SAPLING_H \ No newline at end of file diff --git a/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/Headers/module.modulemap b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/Headers/module.modulemap index 6918c02..8431f11 100644 --- a/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/Headers/module.modulemap +++ b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/Headers/module.modulemap @@ -1,4 +1,4 @@ module SaplingFFI { - header "airgap_sapling.h" + header "madfish_sapling.h" export * } diff --git a/packages/sapling-ios/SaplingFFI.xcframework/ios-x86_64-simulator/libairgap_sapling.a b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/libmadfish_sapling.a similarity index 64% rename from packages/sapling-ios/SaplingFFI.xcframework/ios-x86_64-simulator/libairgap_sapling.a rename to packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/libmadfish_sapling.a index ced5d95..b616642 100644 Binary files a/packages/sapling-ios/SaplingFFI.xcframework/ios-x86_64-simulator/libairgap_sapling.a and b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/libmadfish_sapling.a differ diff --git a/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/Headers/airgap_sapling.h b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64_x86_64-simulator/Headers/madfish_sapling.h similarity index 98% rename from packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/Headers/airgap_sapling.h rename to packages/sapling-ios/SaplingFFI.xcframework/ios-arm64_x86_64-simulator/Headers/madfish_sapling.h index d3f2bd6..75f8975 100644 --- a/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/Headers/airgap_sapling.h +++ b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64_x86_64-simulator/Headers/madfish_sapling.h @@ -1,5 +1,5 @@ -#ifndef AIRGAP_SAPLING_H -#define AIRGAP_SAPLING_H +#ifndef MADFISH_SAPLING_H +#define MADFISH_SAPLING_H #include "stdlib.h" #include "stddef.h" @@ -254,4 +254,4 @@ extern "C" { }; #endif // __cplusplus -#endif // AIRGAP_SAPLING_H \ No newline at end of file +#endif // MADFISH_SAPLING_H \ No newline at end of file diff --git a/packages/sapling-ios/SaplingFFI.xcframework/ios-x86_64-simulator/Headers/module.modulemap b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap similarity index 53% rename from packages/sapling-ios/SaplingFFI.xcframework/ios-x86_64-simulator/Headers/module.modulemap rename to packages/sapling-ios/SaplingFFI.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap index 6918c02..8431f11 100644 --- a/packages/sapling-ios/SaplingFFI.xcframework/ios-x86_64-simulator/Headers/module.modulemap +++ b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap @@ -1,4 +1,4 @@ module SaplingFFI { - header "airgap_sapling.h" + header "madfish_sapling.h" export * } diff --git a/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/libairgap_sapling.a b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64_x86_64-simulator/libmadfish_sapling.a similarity index 71% rename from packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/libairgap_sapling.a rename to packages/sapling-ios/SaplingFFI.xcframework/ios-arm64_x86_64-simulator/libmadfish_sapling.a index ac40b35..d51f4cb 100644 Binary files a/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64/libairgap_sapling.a and b/packages/sapling-ios/SaplingFFI.xcframework/ios-arm64_x86_64-simulator/libmadfish_sapling.a differ diff --git a/packages/sapling-ios/build-ffi.sh b/packages/sapling-ios/build-ffi.sh index b6dc64a..aab3416 100755 --- a/packages/sapling-ios/build-ffi.sh +++ b/packages/sapling-ios/build-ffi.sh @@ -6,16 +6,9 @@ function help () { echo "Usage: build-ffi [option]" echo "Options:" echo " -h, --help show help text" - echo " -m, --manual build using the manual script" - echo " -l, --lipo build using the cargo-lipo crate (default)" echo } -MODE_MANUAL=manual -MODE_LIPO=lipo - -MODE=$MODE_LIPO - while [ -n "$1" ]; do case "$1" in @@ -23,12 +16,6 @@ while [ -n "$1" ]; do help exit ;; - -m|--manual) - MODE=$MODE_MANUAL - ;; - -l|--lipo) - MODE=$MODE_LIPO - ;; esac shift @@ -37,6 +24,7 @@ done ARM_64=arm64 X86_64=x86_64 +ARM_64_SIMULATOR=arm64-sim CURR_DIR=${BASH_SOURCE[0]%/build-ffi.sh} CORE_MANIFEST_PATH="$CURR_DIR/../sapling/Cargo.toml" @@ -46,8 +34,8 @@ function ios_target () { "$ARM_64") echo ios-arm64 ;; - "$X86_64") - echo ios-x86_64-simulator + "$ARM_64_SIMULATOR" | "$X86_64") + echo ios-arm64_x86_64-simulator ;; *) echo "Error: Unknown iOS target." @@ -61,6 +49,9 @@ function rust_target () { "$ARM_64") echo aarch64-apple-ios ;; + "$ARM_64_SIMULATOR") + echo aarch64-apple-ios-sim + ;; "$X86_64") echo x86_64-apple-ios ;; @@ -130,6 +121,7 @@ function manual_build () { echo " Adding Rust targets..." add_target $ARM_64 add_target $X86_64 + add_target $ARM_64_SIMULATOR ### SETUP COMPILE end ### @@ -141,61 +133,14 @@ function manual_build () { local target target=$(rust_target "$1") - echo " RUSTFLAGS='--cfg target_os=\"ios\"' cargo build --manifest-path $CORE_MANIFEST_PATH --release --features \"c_bindings\" --target $target" + echo " RUSTFLAGS='cargo build --manifest-path $CORE_MANIFEST_PATH --release --features \"c_bindings\" --target $target" - RUSTFLAGS='--cfg target_os="ios"' cargo build --manifest-path "$CORE_MANIFEST_PATH" --release --features "c_bindings" --target "" + cargo build --manifest-path "$CORE_MANIFEST_PATH" --release --features "c_bindings" --target "$target" } build $ARM_64 build $X86_64 - - ### COMPILE end ### -} - -function lipo_build () { - ### CHECK begin ### - - echo "Checking the environment..." - - echo " [commands]" - if which xcodebuild >/dev/null; then - echo -e " \xE2\x9C\x94 xcodebuild" - else - echo -e " \xE2\x9C\x97 xcodebuild" - ERROR="xcode-select could not been found" - fi - - if which cargo >/dev/null; then - echo -e " \xE2\x9C\x94 cargo-lipo" - else - echo -e " \xE2\x9C\x97 cargo-lipo" - ERROR="cargo-lipo could not been found" - fi - - if [[ -n "${ERROR}" ]]; then - echo "Error: $ERROR." - exit 1 - fi - - ### CHECK end ### - - ### SETUP COMPILE begin ### - - echo -e "\nSetting up compile targets..." - - echo " Adding Rust targets..." - add_target $ARM_64 - add_target $X86_64 - - echo " Installing cargo-lipo..." - cargo install cargo-lipo - - ### SETUP COMPILE end ### - - ### COMPILE begin ### - - echo -e "\nCompiling..." - RUSTFLAGS='--cfg target_os="ios"' cargo lipo --manifest-path "$CORE_MANIFEST_PATH" --release --features "c_bindings" + build $ARM_64_SIMULATOR ### COMPILE end ### } @@ -213,10 +158,15 @@ function create_framework () { XCFRAMEWORK_DIR=$CURR_DIR/SaplingFFI.xcframework rm -rf $XCFRAMEWORK_DIR + lipo -create \ + "$TARGET_DIR/$(rust_target "$X86_64")/release/lib$LIB_NAME.a" \ + "$TARGET_DIR/$(rust_target "$ARM_64_SIMULATOR")/release/lib$LIB_NAME.a" \ + -output /tmp/lib${LIB_NAME}.a + xcodebuild -create-xcframework \ -library "$TARGET_DIR/$(rust_target "$ARM_64")/release/lib$LIB_NAME.a" \ -headers "$INCLUDE_DIR" \ - -library "$TARGET_DIR/$(rust_target "$X86_64")/release/lib$LIB_NAME.a" \ + -library "/tmp/lib${LIB_NAME}.a" \ -headers "$INCLUDE_DIR" \ -output "$XCFRAMEWORK_DIR" @@ -226,7 +176,7 @@ function create_framework () { module_map_path=$(ios_target "$1")/Headers/module.modulemap if printf "%s\n" \ "module SaplingFFI {" \ - "$(echo -e "\theader \"airgap_sapling.h\"")" \ + "$(echo -e "\theader \"madfish_sapling.h\"")" \ "$(echo -e "\texport *")" \ "}" > "$XCFRAMEWORK_DIR/$module_map_path"; then echo -e " \xE2\x9C\x94 $1 module map ($module_map_path)" @@ -238,19 +188,12 @@ function create_framework () { create_module $ARM_64 create_module $X86_64 + create_module $ARM_64_SIMULATOR ### CREATE XCFRAMEWORK end ### } -case "$MODE" in - "$MODE_MANUAL") - manual_build - create_framework - ;; - "$MODE_LIPO") - lipo_build - create_framework - ;; -esac +manual_build +create_framework echo -e "\nDone." diff --git a/packages/sapling-wasm/package-lock.json b/packages/sapling-wasm/package-lock.json index 0fc2c4f..3be0949 100644 --- a/packages/sapling-wasm/package-lock.json +++ b/packages/sapling-wasm/package-lock.json @@ -1,6 +1,6 @@ { "name": "@airgap/sapling-wasm", - "version": "0.0.11-beta.1", + "version": "0.0.11-beta.2", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/sapling-wasm/package.json b/packages/sapling-wasm/package.json index e5963cf..9a822a9 100644 --- a/packages/sapling-wasm/package.json +++ b/packages/sapling-wasm/package.json @@ -1,7 +1,7 @@ { "name": "@airgap/sapling-wasm", "author": "Papers.ch ", - "version": "0.0.11-beta.1", + "version": "0.0.11-beta.2", "homepage": "https://www.airgap.it", "repository": { "type": "git", diff --git a/packages/sapling/Cargo.toml b/packages/sapling/Cargo.toml index eab1751..6a874ff 100644 --- a/packages/sapling/Cargo.toml +++ b/packages/sapling/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "airgap_sapling" -version = "0.0.11-beta.1" +name = "madfish_sapling" +version = "0.0.11-beta.2" authors = ["Papers.ch "] edition = "2018" diff --git a/packages/sapling/README.md b/packages/sapling/README.md index 1d33162..d741dde 100644 --- a/packages/sapling/README.md +++ b/packages/sapling/README.md @@ -1,3 +1,3 @@ -# AirGap Sapling +# Madfish Sapling -Common Rust sources for AirGap wrappers, the package provides C and Wasm bindings for [Zcash Rust crates](https://github.com/zcash/librustzcash). \ No newline at end of file +Common Rust sources for Madfish wrappers, the package provides C and Wasm bindings for [Zcash Rust crates](https://github.com/zcash/librustzcash). diff --git a/packages/sapling-ios/SaplingFFI.xcframework/ios-x86_64-simulator/Headers/airgap_sapling.h b/packages/sapling/include/madfish_sapling.h similarity index 98% rename from packages/sapling-ios/SaplingFFI.xcframework/ios-x86_64-simulator/Headers/airgap_sapling.h rename to packages/sapling/include/madfish_sapling.h index d3f2bd6..75f8975 100644 --- a/packages/sapling-ios/SaplingFFI.xcframework/ios-x86_64-simulator/Headers/airgap_sapling.h +++ b/packages/sapling/include/madfish_sapling.h @@ -1,5 +1,5 @@ -#ifndef AIRGAP_SAPLING_H -#define AIRGAP_SAPLING_H +#ifndef MADFISH_SAPLING_H +#define MADFISH_SAPLING_H #include "stdlib.h" #include "stddef.h" @@ -254,4 +254,4 @@ extern "C" { }; #endif // __cplusplus -#endif // AIRGAP_SAPLING_H \ No newline at end of file +#endif // MADFISH_SAPLING_H \ No newline at end of file