feat(wallet-ffi): add path-free wallet create/open and default-path helpers - #580
Open
0x-r4bbit wants to merge 1 commit into
Open
feat(wallet-ffi): add path-free wallet create/open and default-path helpers#5800x-r4bbit wants to merge 1 commit into
0x-r4bbit wants to merge 1 commit into
Conversation
…elpers Wallet consumers (e.g. the Qt module and apps built on it) currently have to reconstruct LEZ's wallet path layout themselves to call create/open, which duplicates the logic in `wallet::helperfunctions` and silently drifts if the default home or filenames change. Add functions that resolve everything from LEZ's canonical home (`LEE_WALLET_HOME_DIR` or `~/.lee/wallet`): - `wallet_ffi_create_new_default(password)` — create at the default home (resolves paths, creates the directory), path-free `wallet_ffi_create_new`. - `wallet_ffi_open_default()` — open the default wallet via `WalletCore::from_env`. - `wallet_ffi_default_config_path()` / `wallet_ffi_default_storage_path()` — return the resolved paths (caller frees with `wallet_ffi_free_string`). - `wallet_ffi_wallet_exists_default()` — whether a wallet already exists at the default home, for choosing between an open and a create flow. Together these let consumers drop their own path handling entirely. The C header (`wallet_ffi.h`) is regenerated by the cbindgen build step.
Collaborator
|
@0x-r4bbit I think latest main + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Purpose
Wallet consumers (e.g. the Qt module and apps built on it) currently have to reconstruct LEZ's wallet path layout themselves to call create/open, which duplicates the logic in
wallet::helperfunctionsand silently drifts if the default home or filenames change.Together these let consumers drop their own path handling entirely. The C header (
wallet_ffi.h) is regenerated by the cbindgen build step.⚙️ Approach
Describe the core changes introduced by this PR.
Add functions that resolve everything from LEZ's canonical home (
LEE_WALLET_HOME_DIRor~/.lee/wallet):wallet_ffi_create_new_default(password)— create at the default home (resolves paths, creates the directory), path-freewallet_ffi_create_new.wallet_ffi_open_default()— open the default wallet viaWalletCore::from_env.wallet_ffi_default_config_path()/wallet_ffi_default_storage_path()— return the resolved paths (caller frees withwallet_ffi_free_string).wallet_ffi_wallet_exists_default()— whether a wallet already exists at the default home, for choosing between an open and a create flow.🧪 How to Test
Same as other wallet-ffi functions
📋 PR Completion Checklist
Mark only completed items. A complete PR should have all boxes ticked.