Skip to content

feat(react): add wallet-aware vault and proposal hooks - #1018

Closed
williamleewilliam1-star wants to merge 1 commit into
BCPathway:mainfrom
williamleewilliam1-star:feature/951-hook-parity
Closed

williamleewilliam1-star wants to merge 1 commit into
BCPathway:mainfrom
williamleewilliam1-star:feature/951-hook-parity

Conversation

@williamleewilliam1-star

Copy link
Copy Markdown

What does this PR do?

Completes the remaining hook-parity work for #951 against current main:

  • Keeps the already-landed useAllowance(owner, spender) hook and adds focused coverage for it.
  • Adds useVaultDeposit(), backed by a VaultClient supplied through BcForgeProvider.
  • Adds useProposalVote(), which calls the wallet-aware bcForgeClient.approveProposal path without exposing a Keypair argument.
  • Adds VaultClient.setWalletAdapter/getWalletAdapter and lets deposit fall back to the configured connected WalletAdapter when no Keypair is passed.
  • Avoids retries for deterministic missing-signer errors.
  • Adds mocked hook tests and VaultClient surface/deposit coverage.

The issue text still says useAllowance is missing, but it is already present on current main; this PR does not duplicate or replace it.

AI assistance was used for implementation and verification; the resulting diff and test output were reviewed before submission.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • CI
  • Chore

Checklist

  • I ran pre-commit run --all-files locally and it passed (repository has no .pre-commit-config.yaml)
  • All CI jobs pass on this branch (pending remote CI)
  • I added or updated tests for new behaviour
  • I updated relevant docs / comments
  • No secrets or credentials are included
  • No breaking changes to public APIs (or I've documented them)

Local verification:

  • npm run build --workspace=@bc-forge/sdk
  • npm test --workspace=@bc-forge/sdk -- --runInBand — 92/92 passing
  • npm run build --workspace=@bc-forge/react
  • npm test --workspace=@bc-forge/react -- --runInBand — 72/72 passing
  • targeted ESLint passes for the new test/context/VaultClient files
  • git diff --check

Repository-wide lint still contains pre-existing failures on main (including the existing react-hooks/set-state-in-effect findings in react/src/hooks.ts); this PR does not broaden scope to unrelated lint cleanup.

Breaking changes?

No. Existing hook and SDK call patterns remain supported; wallet-adapter signing is additive.

Related issues

Closes #951

Signed-off-by: williamleewilliam1-star <330827913+williamleewilliam1-star@users.noreply.github.com>
@williamleewilliam1-star

Copy link
Copy Markdown
Author

CI is green and the remaining #951 hook-parity scope is implemented in PR #1018. Since Stellar Wave 9 closes on September 30, could a maintainer please review this PR and, if it is eligible for the Wave, accept/assign the contribution in Drips or tell me if an additional Drips-side application step is required? I am ready to address review feedback immediately.

@p3ris0n p3ris0n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review

This is a second implementation of #951, alongside #1061.

#1061 is mergeable, CI is green, and it adds the same three hooks, vault adapter signing, and mocked tests. This branch is CONFLICTING with main, so it cannot be merged under the current rule (green CI and no conflicts).

Please rebase onto current main only if #1061 does not land. If #1061 merges, close this PR so #951 is not implemented twice.

@williamleewilliam1-star

Copy link
Copy Markdown
Author

Closing as requested: #1061 has now merged and completed #951, so keeping a second implementation open would duplicate the same scope. Thanks for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fill hook parity for allowance, vault deposit, and proposal votes

2 participants