react-native-nitro-ark
v0.0.131
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.
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
