npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lwk-rn

v0.9.0-2.0.3

Published

Liquid Wallet Kit react native module

Readme

Liquid Wallet Kit - react native

LWK-rn is a React Native module for Liquid Wallet Kit. Its goal is to provide all the necessary building blocks for mobile development of a liquid wallet.

NOTE: LWK and LWK-rn is in public beta and still undergoing significant development. Use it at your own risk.

Please consider reviewing, experimenting and contributing

Thanks for taking a look!

Installation

Using npm:

npm install lwk-rn

Using yarn:

yarn add lwk-rn

Note: Use android sdk version >= 24 and iOS >= v13 .

Usage

Import LWK-rn library

import { Mnemonic, Network, Signer, Wollet } from 'lwk-rn';

Create a signer for a mnemonic and a network

let mnemonic = new Mnemonic("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"); 
let network = Network.testnet();
let signer = new Signer(mnemonic, network);
console.log(mnemonic.toString());

Create and update a wollet from the signer descriptor

let singlesigDesc = signer.wpkhSlip77Descriptor();
let wollet = new Wollet(network, singlesigDesc, undefined);
let client = network.defaultElectrumClient();
let update = client.fullScan(wollet);
if (update) { 
  wollet.applyUpdate(update);
}

Get a new unused address

let latest_address = wollet.address(undefined); 
console.log(latest_address.address().scriptPubkey().toString());

Get balance as [AssetId : UInt64]

let balance = wollet.balance();
console.log(balance);
for (var b of balance.entries()) {
  console.log("asset: ", b[0], ", value: ", b[1]);
}

Get a transaction list

let txs = wollet.transactions();
console.log(txs);
for (var tx of txs) {
  for (var output of tx.outputs()) {
    let script_pubkey = output?.scriptPubkey().toString();
    let value = output?.unblinded().value().toString();
    console.log("script_pubkey: ", script_pubkey, ", value: ", value);
  }
}

Build, sign, finalize and broadcast a transaction of policy asset

let latest_address = wollet.address(undefined);
let out_address = latest_address.address();
let satoshis = 900n;
let fee_rate = 280; // this seems like absolute fees
let builder = network.txBuilder();
builder.addLbtcRecipient(out_address, satoshis);
builder.feeRate(fee_rate);
let pset = builder.finish(wollet);
let signed_pset = signer.sign(pset);
let finalized_pset = wollet.finalize(signed_pset);
let txid = client
    .broadcast(finalized_pset.extractTx());
console.log("BROADCASTED TX!\nTXID: ", txid);

Build, sign, finalize and broadcast a transaction of liquid asset

let latest_address = wollet.address(undefined);
let out_address = latest_address.address();
let satoshis = 900n;
let fee_rate = 280; // this seems like absolute fees
let builder = network.txBuilder();
builder.addLbtcRecipient(out_address, satoshis);
builder.feeRate(fee_rate);
// sign and send
let pset = builder.finish(wollet);
let signed_pset = signer.sign(pset);
let finalized_pset = wollet.finalize(signed_pset);
let txid = client.broadcast(finalized_pset.extractTx());
console.log("BROADCASTED TX!\nTXID: ", txid.toString());

Build, sign, finalize and broadcast a transaction of liquid asset

let builder = network.txBuilder();
let asset = '0f1040289a4e88e6acef89b65ce4847b6fd68ac39b89fa978bf23e2c039f5e27';
builder.addRecipient(out_address, 100n, asset);
builder.feeRate(fee_rate);
let pset = builder.finish(wollet);
let signed_pset = signer.sign(pset);
let finalized_pset = wollet.finalize(signed_pset);
let txid = client.broadcast(finalized_pset.extractTx());
console.log("BROADCASTED TX!\nTXID: ", txid.toString());

Build

LWK-rn repository contains the pre-generated lwk bindings for android and ios.

Follow the steps to generate bindings by your own:

Install C++ tooling

# For MacOS, using homebrew:
brew install cmake ninja clang-format
# For Debian flavoured Linux:
apt-get install cmake ninja clang-format

Add the Android specific targets

rustup target add \
    aarch64-linux-android \
    armv7-linux-androideabi \
    i686-linux-android \
    x86_64-linux-android
# Install cargo-ndk
cargo install cargo-ndk

Add the iOS specific targets

rustup target add \
    aarch64-apple-ios \
    aarch64-apple-ios-sim \
    x86_64-apple-ios
# Ensure xcodebuild is available
xcode-select --install

Install deps and uniffi-bindgen-react-native.

$ yarn install

Fetch LWK library with some hacks.

The script changes path to avoid using workspace configuration and rust version. The project require rust >= v1.18 . The scipt replacing package name in Cargo.toml for a library name bug in uniffi-bindgen-react-native.

$ sh fetch_lwk.sh

Generate bindings for android and ios:

$ yarn ubrn:android
$ yarn ubrn:ios

Example

Open demo application in ./example/ folder and read the code in ./example/src/App.tsx .

You could run the example on the Android demo app on device/emulator by:

$ yarn example android

Or you could run the iOS demo app by:

$ cd example
$ bundle install
$ bundle exec pod install # every time you update your native dependencies
$ cd ..
$ yarn example ios

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

HOWTO

See the how-to to learn how works lwk-rn react native module and the repo code.

Greetings

Thanks to all Blockstream LWK team for the amazing library.

A special thanks to @rcasatta to help me about packaging library for iOS and Android.

A big thanks to @BlakeKaufman because give me the opportunity to build this library with a Bounty and made contributions by itself.

License

MIT


Made with create-react-native-library using uniffi-bindgen-react-native