SDK + CLI: getPositions() to fetch all wallet lend positions in one call#508
Draft
its-everdred wants to merge 2 commits into
Draft
SDK + CLI: getPositions() to fetch all wallet lend positions in one call#508its-everdred wants to merge 2 commits into
its-everdred wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
❌ Deploy Preview for actions-ui failed. Why did it fail? →
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #454
Summary
Adds
getPositions()to the SDK to fetch all of a wallet's lend positions in one call, replacing the per-marketgetPositionfan-out that every portfolio consumer had to write by hand. Wires it through the CLI and the demo.SDK
GetPositionsParams(chainId?,provider?,nonZeroOnly?), exported from the public entry.LendProvider.getPositions(walletAddress, params?)— walks the provider's market allowlist and fetches each position withPromise.allSettled, so a single bad-market RPC can't poison the batch (rejected markets are dropped).BaseLendNamespace.fetchPositions— aggregates across configured providers (or one, viaprovider), flattens, then appliesnonZeroOnly.ActionsLendNamespace.getPositions(walletAddress, params?)andWalletLendNamespace.getPositions(params?)(useswallet.addressimplicitly).CLI
actions wallet lend positions [--chain <name> | --chain-id <id>] [--non-zero-only]— onewallet.lend.getPositions()call; emitsLendMarketPosition[]verbatim (bigints stringified). NewlendPositionsoutput sink.Demo
getLendPositionsservice +GET /wallet/lend/positionsroute/controller (optionalchainId/nonZeroOnlyquery).actionsApi.getPositions,EarnOperations.getPositionson both wallet operation builders.useLendProvider.ts: both fan-out sites (mount load + post-trade refresh) now calloperations.getPositions()once. The singlegetPositionactivity-log entry is now honest (one call, one line).Testing
nonZeroOnly; wallet implicit-address path.--chain+--non-zero-onlyforwarding, multi-chain rejection, missing-lend/RPC error mapping.--non-zero-only→[];--chain base-sepoliafilters; both-flags rejected with a validation error.