[SDK] Add mUSDC balance and allowance helpers
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start with packages/stellar-sdk-helpers/src/positions.ts and the web balance hook under apps/web/src/hooks to see how existing token reads and RPC errors are handled; inspect packages/contracts/musdc-token for the token interface. Add typed mUSDC balance, allowance, and trustline reads with address validation, then cover the four specified cases and update the docs to distinguish wallet balance from vault position.
Written by the indexing model from the issue text.
Description
Summary
The SDK can build vault calls but has no helpers for reading mUSDC balances, allowances, or trustlines. A client that wants to show a position or prepare a transfer must call the token contract directly.
Motivation
mUSDC is a custom SEP-41 token with a vault callback on transfer. Consumers need the same read behavior the web app uses. A small typed helper avoids each integration reimplementing ScVal decoding and address checks.
Proposed Solution
Add getBalance, getAllowance, and hasTrustline helpers for mUSDC. Accept a network configuration and an address, validate the address, and return typed values in stroops. Document that balance reads are separate from vault share pricing. Cover a zero balance, a funded balance, a missing trustline, and an RPC failure with tests.
Scope
| Field | Value |
|---|---|
| Area | SDK |
| Protocol affected | None |
| Network | testnet and mainnet |
| Breaking change? | No |
Alternatives Considered
Leaving token reads to the caller keeps the SDK narrow but pushes ScVal handling and error mapping into every consumer. A generic contract-call helper is broader than this need.
Acceptance Criteria
- The SDK exposes balance, allowance, and trustline reads for mUSDC
- Addresses are validated before the RPC call
- Values are returned in stroops with typed errors
- The docs explain the difference between wallet balance and vault position
- Tests cover zero, funded, missing trustline, and RPC failure
-
pnpm lintandpnpm typecheckpass
Additional Context
Existing token reads are in packages/stellar-sdk-helpers/src/positions.ts and the web balance hook is under apps/web/src/hooks. The token contract is packages/contracts/musdc-token.
- Dominant language
- TypeScript
- Stars
- 17
- Forks
- 129
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 54
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from drydocs/meridian
-
chore
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
drydocs/meridian#1503 · 1 comment ·
Maintainers usually reply within 2 days
-
[Docs] Add a supported wallet capability matrixPossibly taken @Joeljosef7 claimed this 3 days ago. Opendocs frontend Stellar Wave trivial
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
drydocs/meridian#1349 · 6 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[Test] Add cross-language conformance vectors for vault mathPossibly taken @VeronicDev claimed this 3 days ago. Opencontracts medium sdk Stellar Wave testing
drydocs/meridian#1444 · 5 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[Security] Extend CSP and security headers to landing and docs routesPossibly taken @anietie234 claimed this 3 days ago. Openapi frontend medium security Stellar Wave
drydocs/meridian#1443 · 5 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[Docs] Establish ADRs and backfill architecture decisionsPossibly taken @Sammydz456 claimed this 3 days ago. Opendocs medium Stellar Wave
drydocs/meridian#1442 · 5 comments · 1 assignee ·
Maintainers usually reply within 2 days
All issues in drydocs/meridian
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
External sources always come back in English: `lc` isn't passed to `/api/v3/external_sources`Possibly taken @Anurag1428 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
openfoodfacts/openfoodfacts-explorer#2264 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
cloudflare/workers-sdk#17139 ·
Maintainers usually reply within 1 day
-
area: editor P3 type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
halisonworks/mod-codeling#290 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
colinhacks/zod#6776 ·
Maintainers usually reply within 1 day