fix(FLOW-15): Return per-token balances in getPendingRequestsByUserUnpacked#36
fix(FLOW-15): Return per-token balances in getPendingRequestsByUserUnpacked#36
Conversation
…packed
Previously, `getPendingRequestsByUserUnpacked` only returned native FLOW
balances, ignoring ERC20/WFLOW balances. This made it impossible for
clients to see pending balances for non-native tokens.
Changes:
- Solidity: Return `balanceTokens[]`, `pendingBalances[]`, and
`claimableRefundsArray[]` instead of single uint256 values
- Cadence: Update `PendingRequestsInfo` struct to use dictionaries
`pendingBalances: {String: UFix64}` and `claimableRefunds: {String: UFix64}`
- Update ABI decoding to handle new array types
- Update all tests to use new return format
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pull Request ReviewOverviewThis PR successfully addresses issue #30 by enhancing ✅ Strengths1. Clean API Design
2. Cross-VM Consistency
3. Test Coverage
4. Documentation
|
| assertEq(pendingBalance, 3 ether, "Pending balance should be sum of amounts"); | ||
| assertEq(balanceTokens[0], NATIVE_FLOW, "First balance token should be NATIVE_FLOW"); | ||
| assertEq(pendingBalances[0], 3 ether, "Pending balance should be sum of amounts"); | ||
| } |
There was a problem hiding this comment.
maybe also assertEq(balanceTokens.length == 2), and balanceTokens[1] == WFLOW, as well as the pending balance is correct.
Summary
Fixes #30
Previously,
getPendingRequestsByUserUnpackedonly returned native FLOW balances, which made it harder for clients to surface per-token pending/refund balances.Note:
balanceTokens/pendingBalances/claimableRefundsArraycurrently coverNATIVE_FLOWand (when configured)WFLOWonly. Other supported ERC20 balances remain queryable viagetUserPendingBalance(user, token)andgetClaimableRefund(user, token).Changes:
balanceTokens[],pendingBalances[], andclaimableRefundsArray[]instead of single uint256 valuesPendingRequestsInfostruct to use dictionariespendingBalances: {String: UFix64}andclaimableRefunds: {String: UFix64}Test plan
🤖 Generated with Claude Code