Skip to content

feat(react): add allowance, vault deposit, and proposal vote hooks - #1061

Merged
p3ris0n merged 1 commit into
BCPathway:mainfrom
Ayfataan:feature/951-hook-parity
Sep 28, 2026
Merged

p3ris0n merged 1 commit into
BCPathway:mainfrom
Ayfataan:feature/951-hook-parity

Conversation

@Ayfataan

@Ayfataan Ayfataan commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Complete the existing useAllowance hook state handling by clearing stale errors on a new read; preserve its data/loading/error/refetch envelope.
  • Add useVaultDeposit and useProposalVote, each returning an action callback with loading and error state, and export both through the existing hooks barrel.
  • Add optional VaultClient configuration to BcForgeProvider and expose its configured client to the deposit hook.
  • Keep WalletProvider adapter registration and cleanup in sync across token and vault clients.
  • Add VaultClient runtime adapter setters and optional adapter-backed signing for deposits, retaining optional explicit Keypair compatibility for existing SDK callers.
  • Reject missing or disconnected signers immediately rather than retrying deterministic signer errors.
  • Add Jest coverage for each React hook and SDK regression coverage for adapter-backed and missing-signer vault deposits.

Validation

  • React focused hooks: 3 tests passed.
  • React full suite: 10 suites and 85 tests passed.
  • SDK full suite: 13 suites and 93 tests passed.
  • SDK focused VaultClient regression and behavior suite after the final signer-state change: 2 suites and 11 tests passed.
  • SDK TypeScript build: passed.
  • React production bundle and declaration build: passed.
  • git diff --check: passed.

API behavior

useAllowance with owner and spender returns data, loading, error, and refetch. useVaultDeposit returns deposit, loading, and error; it requires vaultConfig on BcForgeProvider, and the action does not accept a secret key. useProposalVote returns vote, loading, and error and uses the client wallet adapter.

Closes #951

@drips-wave

drips-wave Bot commented Sep 28, 2026

Copy link
Copy Markdown

@Ayfataan Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@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 covers #951.

  • useAllowance, useVaultDeposit, and useProposalVote are exported through react/src/hooks.ts, which @bc-forge/react already re-exports.
  • Deposit signs with the vault wallet adapter (source omitted). Vote calls approveProposal with no secret key.
  • Jest tests mock the token and vault clients. SDK coverage checks adapter-backed deposit and the missing-signer rejection.
  • useAllowance clears a stale error on the next read.

CI is green and the branch merges cleanly. Approving.

After #1063 lands, rebase so useVaultDeposit and useProposalVote also go through the shared connected-wallet guard. Those hooks are not in this branch's useRequireConnectedWallet path because that guard is only on #1063.

@p3ris0n
p3ris0n merged commit 7801413 into BCPathway:main Sep 28, 2026
9 checks passed
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