Skip to content

feat(wallet-ffi): add path-free wallet create/open and default-path helpers - #580

Open
0x-r4bbit wants to merge 1 commit into
mainfrom
feat/wallet-ffi-default-wallet-paths
Open

feat(wallet-ffi): add path-free wallet create/open and default-path helpers#580
0x-r4bbit wants to merge 1 commit into
mainfrom
feat/wallet-ffi-default-wallet-paths

Conversation

@0x-r4bbit

@0x-r4bbit 0x-r4bbit commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

🎯 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::helperfunctions and 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_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.

🧪 How to Test

Same as other wallet-ffi functions

📋 PR Completion Checklist

Mark only completed items. A complete PR should have all boxes ticked.

  • Complete PR description
  • Implement the core functionality
  • Add/update tests
  • Add/update documentation and inline comments

…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.
@0x-r4bbit
0x-r4bbit requested a review from Pravdyvy June 26, 2026 08:05

@Pravdyvy Pravdyvy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Pravdyvy

Copy link
Copy Markdown
Collaborator

@0x-r4bbit I think latest main + cargo +nightly fmt should help with CI.
Ading new reviewers, we need two to merge.

@Pravdyvy Pravdyvy added the enhancement New feature or request label Jun 26, 2026
@moudyellaz moudyellaz added from SC and removed enhancement New feature or request labels Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants