react-native-nitro-ark
v0.0.142
Published
Pure C++ Nitro Modules for Ark client
Maintainers
Readme
react-native-nitro-ark
Pure C++ Nitro Modules for Ark client
Installation
npm install react-native-nitro-ark react-native-nitro-modules
react-native-nitro-modulesis required as this library relies on Nitro Modules.
Usage
- Please check the
src/index.tsxfile for all methods and type definitions.
VTXO recovery key gap
Set config.vtxo_key_gap_limit when creating or opening a wallet to control how many consecutive unused key indices recovery and VTXO imports scan. It defaults to 250 when omitted. Increase it for wallets that issued many addresses without receiving into them. Values must be integers from 0 to 100,000; larger scans take more work.
Wallet snapshots
createWalletSnapshot uses SQLite Online Backup to create a consistent database image while the wallet remains loaded. The destination's parent directory must exist, and an existing destination is never overwritten.
import {
createWalletSnapshot,
subscribeWalletStateChanges,
validateWalletSnapshot,
} from 'react-native-nitro-ark';
const snapshot = await createWalletSnapshot(snapshotPath);
// Persist snapshot.sha256 only after uploading snapshot.path successfully.
await validateWalletSnapshot(snapshot.path, {
network: snapshot.network,
walletFingerprint: snapshot.walletFingerprint,
});
const subscription = subscribeWalletStateChanges((event) => {
// Debounce databaseChanged events before creating the next snapshot.
// An initial event is emitted so clients can reconcile on startup.
});
subscription.stop();State-change sequence values are local to each subscription and reset on restart. They are backup scheduling signals, not durable wallet generations. Clients should compare the SHA-256 returned by a newly created startup snapshot with the last successfully uploaded snapshot.
License
MIT
Made with create-react-native-library
