@exodus/post-restore-modal
v1.2.0
Published
The post-restore-modal feature
Downloads
5,436
Readme
@exodus/post-restore-modal
This feature encapsulates logic to determine whether a user receives any balance after the restore process is complete.
How It Works
- The feature creates a storage atom called
shouldShowPostRestoredModalAtom
, which stores a boolean value indicating whether the post-restore modal should be displayed. - Once the restore process finishes, it checks if the user has any balance and sets the
shouldShowPostRestoredModalAtom
totrue
.
Usage
This feature is designed for use with @exodus/headless
. For more information on how features integrate with the SDK, see Using the
SDK.
Play with it
- Open the playground at https://exodus-hydra.pages.dev/.
- Run the command
selectors.postRestoreModal.shouldShowRestoredModal(store.getState())
in the Dev Tools Console to view the current state of the post-restore modal. - You should see a value of
false
, indicating that you have balance after restore. - To clear the value and restart the logic, run
exodus.postRestoreModal.clear()
. - Run
exodus.application.import({ mnemonic, passphrase })
with mnemonic phrase that contains balance - Run
exodus.application.unlock({ passphrase })
- After some time when restore finishes run
selectors.postRestoreModal.shouldShowRestoredModal(store.getState())
to seetrue
meaning you have balance and restore finished/
API Side Setup
For more details on how features integrate with the SDK and the API interface, see using the sdk
exodus.postRestoreModal.clear() // To clear the value in storage so that the logic re-runs on next restore.
UI Side Setup
For more details on basic UI-side setup, see using the sdk.
const showRestoreModal = useSelector(selectors.postRestoreModal.shouldShowRestoredModal)
This showRestoreModal
variable can be used in your UI code to determine whether to display the post-restore modal.