Rename bdk-kotlin companion project, fix gradle warnings
This commit is contained in:
parent
333f694d55
commit
5303de9593
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,7 +2,7 @@ target
|
||||
build
|
||||
Cargo.lock
|
||||
*.h
|
||||
/local.properties
|
||||
/bdk-kotlin/local.properties
|
||||
.gradle
|
||||
wallet_db
|
||||
bdk_ffi_test
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "bdk_ffi"
|
||||
name = "bdk-ffi"
|
||||
version = "0.1.0"
|
||||
authors = ["Steve Myers <steve@notmandatory.org>"]
|
||||
edition = "2018"
|
||||
|
@ -1,43 +0,0 @@
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "bdk_ffi.h"
|
||||
|
||||
int main (int argc, char const * const argv[])
|
||||
{
|
||||
char const * name = "test_wallet";
|
||||
char const * desc = "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)";
|
||||
char const * change = "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/1/*)";
|
||||
|
||||
// test new_wallet
|
||||
{
|
||||
WalletPtr_t * wallet = new_wallet(name, desc, change);
|
||||
assert(wallet != NULL);
|
||||
|
||||
// test sync_wallet
|
||||
sync_wallet(wallet);
|
||||
|
||||
// test new_address
|
||||
char * address1 = new_address(wallet);
|
||||
//printf("address1: %s\n", address1);
|
||||
assert( 0 == strcmp(address1,"tb1qgkhp034fyxeta00h0nne9tzfm0vsxq4prduzxp"));
|
||||
free_string(address1);
|
||||
|
||||
char * address2 = new_address(wallet);
|
||||
//printf("address2: %s\n", address2);
|
||||
assert(0 == strcmp(address2,"tb1qd6u9q327sru2ljvwzdtfrdg36sapax7udz97wf"));
|
||||
free_string(address2);
|
||||
|
||||
// test free_wallet
|
||||
free_wallet(wallet);
|
||||
|
||||
// test free_wallet NULL doesn't crash
|
||||
free_wallet(NULL);
|
||||
|
||||
// verify sync_wallet after sync_wallet fails (double free detected, core dumped)
|
||||
////sync_wallet(&wallet);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
22
build.gradle
22
build.gradle
@ -1,22 +0,0 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.10'
|
||||
repositories {
|
||||
//google()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
//classpath 'com.android.tools.build:gradle:3.6.4'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
//google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
15
build.sh
15
build.sh
@ -1,13 +1,14 @@
|
||||
# rust
|
||||
cargo build
|
||||
cargo test --features c-headers -- generate_headers
|
||||
export LD_LIBRARY_PATH=`pwd`/target/debug
|
||||
|
||||
# cc
|
||||
cc bdk_ffi_test.c -o bdk_ffi_test -L target/debug -l bdk_ffi -l pthread -l dl -l m
|
||||
#valgrind --leak-check=full ./bdk_ffi_test
|
||||
./bdk_ffi_test
|
||||
export LD_LIBRARY_PATH=`pwd`/target/debug
|
||||
cc cc/bdk_ffi_test.c -o cc/bdk_ffi_test -L target/debug -l bdk_ffi -l pthread -l dl -l m
|
||||
#valgrind --leak-check=full cc/bdk_ffi_test
|
||||
cc/bdk_ffi_test
|
||||
|
||||
# jvm
|
||||
mkdir -p jvm/build/jniLibs/x86_64_linux
|
||||
cp target/debug/libbdk_ffi.so jvm/build/jniLibs/x86_64_linux
|
||||
# bdk-kotlin
|
||||
mkdir -p bdk-kotlin/jar/libs/x86_64_linux
|
||||
cp target/debug/libbdk_ffi.so bdk-kotlin/jar/libs/x86_64_linux
|
||||
(cd bdk-kotlin && gradle test)
|
||||
|
@ -1,21 +0,0 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
@ -1,3 +0,0 @@
|
||||
rootProject.name = 'bdk_ffi'
|
||||
|
||||
include 'jvm'
|
@ -7,6 +7,6 @@ mod wallet;
|
||||
#[test]
|
||||
fn generate_headers() -> ::std::io::Result<()> {
|
||||
::safer_ffi::headers::builder()
|
||||
.to_file("bdk_ffi.h")?
|
||||
.to_file("cc/bdk_ffi.h")?
|
||||
.generate()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user