Skip to content

3.0 beta, step 1: wallet update, freeze, maximum spendable, total balances and the cross-coin list - #53

Merged
neto737 merged 1 commit into
mainfrom
feat/3.0-beta-wallets
Nov 12, 2026
Merged

neto737 merged 1 commit into
mainfrom
feat/3.0-beta-wallets

Conversation

@neto737

@neto737 neto737 commented Nov 12, 2026

Copy link
Copy Markdown
Owner

The first 3.0.0-beta step: the wallet calls that 2.x had and the alpha didn't, plus the cross-coin list.

$wallet = $bitgo->coin('tbtc')->wallet($walletId);
$wallet->update(label: 'Cold storage', approvalsRequired: 2);              // PUT  /tbtc/wallet/{id}
$wallet->freeze(duration: 86400, reason: 'UserRequest');                    // POST /tbtc/wallet/{id}/freeze
$wallet->maximumSpendable(minValue: Amount::fromDisplay('0.0001', 8));      // GET  /tbtc/wallet/{id}/maximumSpendable

$bitgo->coin('tbtc')->wallets()->balances();                                // GET  /tbtc/wallet/balances
foreach ($bitgo->wallets()->list(coin: [CoinCode::TBTC, 'ttao']) as $w) {} // GET  /wallets
$bitgo->wallets()->balances(allTokens: true);                               // GET  /wallet/balances

What changed

  • Wallet: update(), freeze() and maximumSpendable(). Each takes the params in BitGo's current reference as named args, plus $extra.
  • Coin\Wallets::balances(): one coin's totals. This is the endpoint 2.x's getTotalBalances() called.
  • New Wallets, from BitGo::wallets(): list() on /api/v2/wallets (a lazy Paginator, like the per-coin list) and balances() on /api/v2/wallet/balances. The coin filter takes CoinCodes or strings.
  • README coverage table and CHANGELOG [Unreleased] updated.

Choices worth a look

  • freeze() always sends duration, 3600 by default. BitGo marks it required, with 3600 as the default, so sending it never depends on BitGo filling in a missing field. 2.x required an otp here, but BitGo's current reference doesn't list one, so it isn't named. It can still go through $extra.
  • maximumSpendable()'s minValue and maxValue take Amount|string|int, the first verb to take an Amount in a query. BitGo wants a string for DOGE.
  • The cross-coin class is neto737\BitGoSDK\Wallets, next to BitGo, the same way Coin\Wallets sits under Coin.
  • Not in this PR: deleting a wallet. The parity table in ROADMAP.md lists "update/delete wallet", but step 1's checklist doesn't. Delete stays a separate decision.

Testing

  • composer check passes: CS, Rector, PHPStan and 195 PHPUnit tests. Line coverage is 100% (355/355).
  • New WalletTest and AllWalletsTest, plus balances() cases in WalletsTest. They assert each request's method, URL (including array and Amount query encoding) and body. The navigation test now covers $bitgo->wallets()->list() sending nothing until it's iterated.
  • These were not run against BitGo testnet. Endpoints, params and response shapes come from BitGo's current API reference.

…per coin and across coins, and the cross-coin $bitgo->wallets()->list().
@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8eecf6c) to head (9dc755d).

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #53   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       159       170   +11     
===========================================
  Files             16        17    +1     
  Lines            370       436   +66     
===========================================
+ Hits             370       436   +66     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@neto737
neto737 merged commit 24478fa into main Nov 12, 2026
13 checks passed
@neto737
neto737 deleted the feat/3.0-beta-wallets branch November 12, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant