Skip to content

feat(sdk-core): type BitGoBase.wallets() as BitGoApiV1Wallets#9280

Open
mmcshinsky-bitgo wants to merge 1 commit into
masterfrom
side/types-sdk-api-wallets
Open

feat(sdk-core): type BitGoBase.wallets() as BitGoApiV1Wallets#9280
mmcshinsky-bitgo wants to merge 1 commit into
masterfrom
side/types-sdk-api-wallets

Conversation

@mmcshinsky-bitgo

@mmcshinsky-bitgo mmcshinsky-bitgo commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace BitGoBase.wallets(): any with a full v1-only type: BitGoApiV1Wallets.
  • Wire the same type through BitGoAPI.wallets() (re-exported from @bitgo/sdk-core).
  • Source of truth: modules/sdk-api/src/v1/wallets.ts (all 16 prototype methods).

v1 vs v2 (important)

Accessor Type API
bitgo.wallets() BitGoApiV1Wallets v1 (this PR)
bitgo.coin(name).wallets() IWallets v2 (unchanged)

Retail / modern callers that use sdkCoin.wallets().get(...) are on v2 and are unaffected.

What this covers

  • Collection methods: list, get / getWallet, add, remove, createKey, createWalletWithKeychains, createForwardWallet
  • Invite / share: listInvites, cancelInvite, listShares, getShare, updateShare, cancelShare, acceptShare, resendShareInvite
  • Param types for the above (BitGoApiV1*Params)
  • BitGoApiV1BitGo / BitGoApiV1Keychains — minimal client surface used by the v1 facade (leaf types; no import of BitGoBase)

Wallet instance returns (get / getWallet / add)

Still Promise<any>. A stub BitGoApiV1Wallet return with [key: string]: unknown broke abstract-utxo recovery (v1wallet.recover / .sweep, assignability to local WalletV1). Full typing of sdk-api/src/v1/wallet.ts is a follow-up.

Circular-deps note

BitGoApiV1Wallets.bitgo is BitGoApiV1BitGo, not BitGoBase. Import graph: bitgoBase → v1Wallets → api (acyclic).

Intentionally out of scope

  • Full typing of sdk-api/src/v1/wallet.ts
  • Typing other remaining any v1 facades on BitGoAPI (keychains(), pendingApprovals(), etc.)
  • Changes to v2 IWallets / IWallet

Test plan

  • yarn tsc --noEmit in modules/sdk-core, modules/sdk-api, modules/abstract-utxo
  • yarn mocha test/unit/bitgoAPI.ts --grep wallets

No ticket — local side improvement (WEB-000).

@mmcshinsky-bitgo
mmcshinsky-bitgo force-pushed the side/types-sdk-api-wallets branch from 5411630 to 9255ffb Compare July 16, 2026 16:07
@mmcshinsky-bitgo mmcshinsky-bitgo changed the title feat(sdk-api): type BitGoAPI.wallets() as BitGoApiV1Wallets feat(sdk-core): type BitGoBase.wallets() as BitGoApiV1Wallets Jul 16, 2026
@mmcshinsky-bitgo
mmcshinsky-bitgo force-pushed the side/types-sdk-api-wallets branch 3 times, most recently from 1627f3b to 2d25b54 Compare July 16, 2026 16:44
@mmcshinsky-bitgo mmcshinsky-bitgo self-assigned this Jul 16, 2026
@mmcshinsky-bitgo
mmcshinsky-bitgo marked this pull request as ready for review July 16, 2026 19:23
@mmcshinsky-bitgo
mmcshinsky-bitgo requested review from a team as code owners July 16, 2026 19:23
Define the full deprecated v1 wallets facade and use it on BitGoBase
and BitGoAPI.wallets(). BitGoApiV1BitGo is a leaf type (imports api
only) to avoid a bitgoBase/v1Wallets circular dependency. Docs make
clear this is v1-only; v2 is coin().wallets() / IWallets.

get/getWallet/add still return Promise<any> for the CommonJS v1 Wallet
instance so abstract-utxo recovery (recover/sweep, WalletV1) keeps
typechecking until v1/wallet.ts is typed.

WEB-000
@mmcshinsky-bitgo
mmcshinsky-bitgo force-pushed the side/types-sdk-api-wallets branch from 2d25b54 to 0dcccf8 Compare July 16, 2026 19:26
@davidkaplanbitgo

Copy link
Copy Markdown
Contributor

@claude review this PR and concentrate if this has any implications for v2 wallets or have unintended sideeffects for v2 wallets

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Claude finished @davidkaplanbitgo's task —— View job


I'll analyze this and get back to you.

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.

2 participants