feat(opencode): move to the batched GetBalances RPC - #1458
Merged
Merged
Conversation
ocp-protobuf-api replaced Balance.GetBalance with GetBalances (owners list, optional mint filter, owner -> mint -> quarks map). Update BalanceApi, BalanceService, BalanceRepository, and BalanceController through the same chain, add an OwnerBalance domain type plus mapper to carry the two-level result, and drop the now-impossible NOT_FOUND handling in favor of the absent-map-entry path. Compiles against the local ocp-client-protocol checkout via protoLocalRoot. No feature currently calls BalanceController, so this is scaffolding only.
bmc08gt
marked this pull request as ready for review
September 14, 2026 19:05
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.
Blocked on code-payments/ocp-client-protocol#6. Draft until
0.4.0is published, because this pins a version that does not exist yet — Gradle resolution reportscom.flipcash:ocp-client-protocol:0.4.0 FAILEDuntil then. CI never sees the local override, sinceprotoLocalRootlives in untrackedlocal.properties.Why
ocp-protobuf-apiremovedGetBalancein favour ofGetBalances(#66). TheBalanceservice had exactly one RPC, so there is no way to take the new package without moving the call sites.The request goes from a single
ownertorepeated owners(1-1024) plus an optionalmintsfilter. The response goes from a flatcore_mint_valuetomap<string, OwnerBalance> balances_by_owner, where each entry keeps acore_mint_valuetotal and adds abalances_by_mintbreakdown.What changed
All under
services/opencode/src/main/kotlin/com/getcode/opencode/:internal/network/api/BalanceApi.ktgetBalance(owner)→getBalances(owners, mints = emptyList()), built withaddAllOwners/addAllMintsinternal/network/services/BalanceService.ktResultenum, returnsResult<List<OwnerBalance>>frombalancesByOwnerMap.valuesmodel/financial/OwnerBalance.ktinternal/domain/mapping/OwnerBalanceMapper.ktSolanaAccountId.toPublicKey()/.toMint()extensionsrepositories/BalanceRepository.kt,internal/domain/repositories/InternalBalanceRepository.ktcontrollers/BalanceController.ktPublicKeys, as the RPC stays unauthenticatedmodel/core/errors/Errors.ktGetBalanceError→GetBalancesErrorper the repo'sGet<Rpc>Errorconvention,NotFoundcase removedNOT_FOUNDis gone from the protoResultenum.OKandDENIEDkeep0and1, so nothing renumbered, but an owner with no balances is now absent from the map rather than signalled by a result code.InternalBalanceRepositorynow only special-casesDeniedbefore reporting.