Right now the WASM SDK exposes the RGB wallet and the RLN as two separate objects, and each of them has a different backup flow.
There are two main issues:
-
Wallet and node are created separately
At the moment, RlnWasmWallet and RlnWasmNode are initialized independently, and the app has to manually call: node.attachWallet(wallet) before starting RLN. This makes the wasm rln setup a bit tricky and more complex than UniFFi bindings
-
RLN state VSS backup is automatic, but wallet backup is manual
RLN state is backed up automatically on every state change.
But the wallet stream is only backed up manually, so rgb-sdk-web currently has to wrap every state-changing wallet operation with vssBackup(). This is easy to miss. If one mutating method is not wrapped correctly, the node backup stays up to date, but the wallet backup becomes stale. Then after restore, we can end up with inconsistent state or possible data loss.
The WASM SDK should hide this complexity from JS consumers:
- wallet and node should be initialized/managed as one connected unit
- wallet backup should happen automatically, the same way node backup already does
- wasm should not need to remember to call attachWallet() or manually wrap every mutating wallet method with vssBackup()
The general UX flow should be as close as possible to the UniFFI flow. The goal is to reduce the gap between the wasm version and UniFFI, so working with both platforms feels more consistent, simpler, and easier to understand for SDK consumers.
Right now the WASM SDK exposes the RGB wallet and the RLN as two separate objects, and each of them has a different backup flow.
There are two main issues:
Wallet and node are created separately
At the moment, RlnWasmWallet and RlnWasmNode are initialized independently, and the app has to manually call: node.attachWallet(wallet) before starting RLN. This makes the wasm rln setup a bit tricky and more complex than UniFFi bindings
RLN state VSS backup is automatic, but wallet backup is manual
RLN state is backed up automatically on every state change.
But the wallet stream is only backed up manually, so rgb-sdk-web currently has to wrap every state-changing wallet operation with vssBackup(). This is easy to miss. If one mutating method is not wrapped correctly, the node backup stays up to date, but the wallet backup becomes stale. Then after restore, we can end up with inconsistent state or possible data loss.
The WASM SDK should hide this complexity from JS consumers:
The general UX flow should be as close as possible to the UniFFI flow. The goal is to reduce the gap between the wasm version and UniFFI, so working with both platforms feels more consistent, simpler, and easier to understand for SDK consumers.