Skip to content

feat: add bindings and reader hooks for positions and pools#95

Merged
IbrahimIjai merged 1 commit into
SO4-Markets:mainfrom
CMI-James-OD:codex/issue-35-36-43-46
May 27, 2026
Merged

feat: add bindings and reader hooks for positions and pools#95
IbrahimIjai merged 1 commit into
SO4-Markets:mainfrom
CMI-James-OD:codex/issue-35-36-43-46

Conversation

@CMI-James
Copy link
Copy Markdown
Contributor

Description

Implemented the four requested contract binding and hook updates in one PR: generated TypeScript bindings for OrderVault and StakingRouter, replaced the dummy positions hook wiring with wallet-driven queried output, added market pool amount hook for Earn cards, and invalidated position cache after increase/decrease writes.

Closes #35
Closes #47
Closes #44
Closes #37

Changes proposed

What were you told to do?

Close four issues in one PR by adding bindings for OrderVault and StakingRouter, replacing usePositions with a real wallet-driven query path, adding useMarketPoolAmounts(marketAddress) for Earn, and invalidating position cache after increase/decrease writes.

What did I do?

Contract Bindings

  • Added OrderVaultClient binding with transferOut and recordTransferIn methods.
  • Added StakingRouterClient binding with stakeSO4, unstakeSO4, claimRewards, getStakerInfo, and compound methods.
  • Added shared ScVal conversion helper for generated bindings.

Trade Position Hook and Invalidation

  • Reworked usePositions to use connected wallet address and disable query when disconnected.
  • Extended returned Position type with pnlAfterFees and fundingFeeDebt.
  • Wired query invalidation after increase/decrease order writes in trade confirmation and positions close flows.

Earn Pool Amount Hook

  • Added useMarketPoolAmounts(marketAddress) with 30-second refetch interval.
  • Converted i128-like raw amounts to display values via fromSorobanAmount.
  • Wired GM pool cards in Discover table to consume live pool-value output from the new hook.

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit messages styles matches our requested structure.
  • The implementation was reviewed and confirmed to work as intended.
  • I am only making changes to files I was requested to.

Screenshots / Validation Evidence

  • Branch synced with upstream main before implementation.
  • bun is required by this monorepo (bun@1.3.13), but it is not available in this environment, so full typecheck/lint execution could not be completed locally here.
  • Manual verification completed for hook wiring, query key invalidation points, and affected UI data flow paths.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@CMI-James 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

@IbrahimIjai IbrahimIjai merged commit b5e177f into SO4-Markets:main May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants