ethereum-optimism / ethereum-optimism/actions
Borrow: add aggregate getPositions support
- Dominant language
- TypeScript
- Stars
- 32
- Forks
- 25
- Avg merge
- 10h 20m
- Merged PRs (30d)
- 16
Description
## Problem
The borrow SDK only supports reading one market position at a time. Consumers that need a wallet-wide view must list markets and coordinate concurrent `getPosition()` calls themselves; the demo duplicates this fan-out in its hook and API client, while the CLI only exposes a singular position command. This scatters filtering, failure isolation, and multi-chain behavior across clients.
## Solution
Add aggregate borrow `getPositions()` support across the SDK, CLI, backend, and frontend, following the lend implementation in PR #508.
- Add borrow position parameters for mutually exclusive `chainId` or `chainIds`, an optional provider filter, and `options.nonZeroOnly`.
- Expose `actions.borrow.getPositions(walletAddress, params?)` and `wallet.borrow.getPositions(params?)`.
- Aggregate configured borrow markets concurrently and preserve successful positions when an individual market read fails.
- Add plural CLI commands for arbitrary-address and connected-wallet position lists.
- Replace the demo's manual borrow-position fan-outs with the aggregate SDK operation.
- Cover provider aggregation, filters, partial failures, wallet address binding, CLI forwarding, and demo integration with tests.
## Acceptance criteria
- One SDK call returns a wallet's borrow positions across configured providers and selected chains.
- Actions and wallet namespaces preserve their existing address semantics.
- CLI users can list all borrow positions rather than selecting one market.
- Demo consumers no longer coordinate per-market borrow position requests.
- Existing singular `getPosition()` behavior remains available.
## Reference
- Lend implementation and integration model: https://github.com/ethereum-optimism/actions/pull/508
Contributor guide
Research direction
Start by studying the lend implementation and integration model in PR #508, then trace the existing borrow getPosition() through the SDK, CLI, backend, and demo hook/API client. Run the existing borrow tests and inspect the singular CLI command before adding coverage for aggregation, filters, partial failures, address binding, CLI forwarding, and demo integration. Done means aggregate SDK, wallet, CLI, and demo support works while singular getPosition() remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend, cli, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100