Skip to content

feat(sdk-core): depositToVault with getVaultConfig and Concrete BTC support#9211

Open
venkateshv1266 wants to merge 2 commits into
masterfrom
venkatesh/defi-279-deposittovault-getvaultconfig
Open

feat(sdk-core): depositToVault with getVaultConfig and Concrete BTC support#9211
venkateshv1266 wants to merge 2 commits into
masterfrom
venkatesh/defi-279-deposittovault-getvaultconfig

Conversation

@venkateshv1266

Copy link
Copy Markdown
Contributor

Summary

  • Add VaultProvider enum (Morpho, ConcreteBtccx) and named result types ConcreteDepositResult / MorphoDepositResult; update DepositResult union to use them
  • Add getVaultConfig to DefiVault and IDefiVault, proxying GET /api/defi-service/v1/vaults/:id
  • Add protocol dispatch in depositToVault: routes ConcreteBtccxdepositToConcreteVault, MorphodepositToMorphoVault, else throws unsupported provider error
  • depositToConcreteVault: single sendMany with type: 'defi-deposit' and defiParams; no recipients (WP resolves escrow destination server-side)
  • Add defiParams: t.unknown to BuildParams whitelist and optional defiParams to SendManyOptions; bump @bitgo/public-types to ^6.39.0
  • Unit tests: getVaultConfig happy path + error cases, Concrete dispatch (single sendMany, pendingApproval extraction, passphrase forwarding), Morpho regression guard

Test plan

  • yarn unit-test -- --grep "DefiVault" in modules/sdk-core: all passing
  • yarn build in modules/sdk-core: no TypeScript errors
  • Morpho existing tests are green (regression guard)
  • Concrete path: depositToVault with a concrete_btccx vault returns { pendingApprovalId, state }
  • Unsupported provider throws descriptive error

CLOSES TICKET: DEFI-279

@linear-code

linear-code Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

DEFI-279

@venkateshv1266 venkateshv1266 force-pushed the venkatesh/defi-279-deposittovault-getvaultconfig branch 4 times, most recently from 61f2d24 to e9261f7 Compare July 8, 2026 17:23
@venkateshv1266 venkateshv1266 requested a deployment to breaking-changes-override July 8, 2026 17:33 — with GitHub Actions Waiting
*/
private async depositToConcreteVault(params: DepositToVaultOptions): Promise<ConcreteDepositResult> {
const sendManyResult = await this.wallet.sendMany({
type: 'defi-deposit',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have common intent type case as I can see most of intent type follow camel case but here we are using Kebab Case ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same in BitGoJS sdk too,

case 'defiApprove':
txRequest = await this.tssUtils!.prebuildTxWithIntent(
{
reqId,
intentType: 'defi-approve',
defiParams: params.defiParams as {
vaultId: string;
amount: string;
clientIdempotencyKey?: string;
},
},
apiVersion,
params.preview
);
break;
case 'defiDeposit':
txRequest = await this.tssUtils!.prebuildTxWithIntent(
{
reqId,
intentType: 'defi-deposit',
defiParams: params.defiParams as {
vaultId: string;
amount: string;
operationId?: string;
clientIdempotencyKey?: string;
},
},
apiVersion,
params.preview
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are building a new service, we should align the intent type naming convention with what we follow in WP. The existing intent types use camelCase, so it would be better to keep the same convention here instead of introducing kebab-case.

@venkateshv1266 venkateshv1266 Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of morpho, these changes are already done and its live in prod i guess cc: @kamleshmugdiya @hafeezshaik933

@nvjsr

nvjsr commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

CI is failing

@venkateshv1266 venkateshv1266 marked this pull request as ready for review July 9, 2026 09:59
@venkateshv1266 venkateshv1266 requested review from a team as code owners July 9, 2026 09:59

@OttoAllmendinger OttoAllmendinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we still not using typed routes?

@venkateshv1266 venkateshv1266 marked this pull request as draft July 9, 2026 15:00
- Add DefiVault class with depositToVault (Morpho + Concrete paths),
  resumeDeposit, getVaultConfig, getOperation, listOperations
- getVaultConfig uses decodeWithCodec(GetVaultResponse) for runtime
  validation of the defi-service API response
- VaultProtocol/GetVaultResponse imported from @bitgo/public-types;
  removes local VaultProvider/VaultConfig/ConcreteVaultConfig duplicates
- Expose wallet.defi getter on Wallet class
- Add defiParams to SendManyOptions and BuildParams whitelist
- Add DEFI- to commitlint issuePrefixes

TICKET: DEFI-279
@venkateshv1266 venkateshv1266 force-pushed the venkatesh/defi-279-deposittovault-getvaultconfig branch from e9261f7 to 68c4ab7 Compare July 9, 2026 18:42
@venkateshv1266 venkateshv1266 deployed to breaking-changes-override July 9, 2026 18:52 — with GitHub Actions Active
@venkateshv1266 venkateshv1266 marked this pull request as ready for review July 9, 2026 18:57
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.

3 participants