Skip to content

Latest commit

 

History

History
149 lines (127 loc) · 4.72 KB

README.md

File metadata and controls

149 lines (127 loc) · 4.72 KB

BreezSDK – Go Package

The Breez SDK enables mobile developers to integrate lightning and bitcoin payments into their apps with a very shallow learning curve. More information can be found here.

👨‍🔧 Installation

To install the package:

$ go get github.com/breez/breez-sdk-go

Supported platforms

This library embeds the BreezSDK runtime compiled as shared library objects, and uses cgo to consume it. A set of precompiled shared library objects are provided. Thus this library works (and is tested) on the following platforms:

Platform Architecture Triple Status
Android amd64 x86_64-linux-android
aarch64 aarch64-linux-android
aarch armv7-linux-androideabi
386 i686-linux-android
Darwin amd64 x86_64-apple-darwin
aarch64 aarch64-apple-darwin
Linux amd64 x86_64-unknown-linux-gnu
aarch64 aarch64-unknown-linux-gnu
Windows amd64 x86_64-pc-windows-msvc

📄 Usage

package main

import (
	"log"
	"github.com/breez/breez-sdk-go/breez_sdk"
)

func main() {
	seed, _ := breez_sdk.MnemonicToSeed("cruise clever syrup coil cute execute laundry general cover prevent law sheriff")

	log.Printf("Seed: %v", seed)
}

Bundling

For some platforms the provided binding libraries need to be copied into a location where they need to be found during runtime.

Android

Copy the binding libraries into the jniLibs directory of your app

cp vendor/github.com/breez/breez-sdk-go/breez_sdk/lib/android-386/*.so android/app/src/main/jniLibs/x86/
cp vendor/github.com/breez/breez-sdk-go/breez_sdk/lib/android-aarch/*.so android/app/src/main/jniLibs/armeabi-v7a/
cp vendor/github.com/breez/breez-sdk-go/breez_sdk/lib/android-aarch64/*.so android/app/src/main/jniLibs/arm64-v8a/
cp vendor/github.com/breez/breez-sdk-go/breez_sdk/lib/android-amd64/*.so android/app/src/main/jniLibs/x86_64/

So they are in the following structure

└── android
    ├── app
        └── src
            └── main
                └── jniLibs
                    ├── arm64-v8a
                        ├── libbreez_sdk_bindings.so
                        └── libc++_shared.so
                    ├── armeabi-v7a
                        ├── libbreez_sdk_bindings.so
                        └── libc++_shared.so
                    ├── x86
                        ├── libbreez_sdk_bindings.so
                        └── libc++_shared.so
                    └── x86_64
                        ├── libbreez_sdk_bindings.so
                        └── libc++_shared.so
                └── AndroidManifest.xml
        └── build.gradle
    └── build.gradle

Windows

Copy the binding library to the same directory as the executable file or include the library into the windows install packager.

cp vendor/github.com/breez/breez-sdk-go/breez_sdk/lib/windows-amd64/*.dll build/windows/

💡 Information for Maintainers and Contributors

This repository is used to publish a Go package providing Go bindings to the Breez SDK's underlying Rust implementation. The Go bindings are generated using UniFFi Bindgen Go.

Any changes to the Breez SDK, the Go bindings, and the configuration of this Go package must be made via the breez-sdk repo.

To release a new version of this package, go to the Actions tab of the https://github.com/breez/breez-sdk GitHub repository. Then select the Publish All Packages workflow and fill in the form with the required version.