feat(sdk-core): add wallet.defi DeFi vault orchestration methods#8912
feat(sdk-core): add wallet.defi DeFi vault orchestration methods#8912hitansh-madan wants to merge 1 commit into
Conversation
065e0e5 to
ef017e9
Compare
| try { | ||
| await this.cancelTxRequest(approveTxRequestId); | ||
| } catch { | ||
| // Best-effort cancel; the reconciler will clean up if this fails | ||
| } | ||
| throw err; |
There was a problem hiding this comment.
thoughts on this?
| try { | |
| await this.cancelTxRequest(approveTxRequestId); | |
| } catch { | |
| // Best-effort cancel; the reconciler will clean up if this fails | |
| } | |
| throw err; | |
| await this.cancelTxRequest(approveTxRequestId); |
| private operationUrl(operationId: string): string { | ||
| return `/api/defi-service/v1/operations/${operationId}`; |
There was a problem hiding this comment.
I think this endpoint should also be be wallet.
without wallet scope, in the resumeDeposit() flow, it can potentially fetch operation from foreign wallet.
| private operationUrl(operationId: string): string { | |
| return `/api/defi-service/v1/operations/${operationId}`; | |
| private operationUrl(operationId: string): string { | |
| return `/api/defi-service/v1/wallets/${this.wallet.id()}/operations/${operationId}`; |
| if (!operationId) { | ||
| throw new Error('operationId not found in approve txRequest response'); | ||
| } |
There was a problem hiding this comment.
should we do cleanup if the operationId is not present in the response?
| } | ||
|
|
||
| private async cancelTxRequest(txRequestId: string): Promise<void> { | ||
| await this.bitgo.del(this.bitgo.url('/wallet/' + this.wallet.id() + '/txrequests/' + txRequestId, 2)).result(); |
There was a problem hiding this comment.
does this endpoint exist today in platform?
DELETE /txrequests/{id}
| const query: Record<string, string | number> = { | ||
| walletId: this.wallet.id(), | ||
| vaultId: params.vaultId, | ||
| }; | ||
| if (params.state) query.state = params.state; | ||
| if (params.type) query.type = params.type; | ||
| if (params.limit) query.limit = params.limit; | ||
| if (params.cursor) query.cursor = params.cursor; | ||
|
|
||
| return await this.bitgo | ||
| .get(this.bitgo.microservicesUrl(this.vaultOperationsUrl(params.vaultId))) | ||
| .query(query) | ||
| .result(); | ||
| } |
There was a problem hiding this comment.
vaultId redundant in the request
It's present in both URL path and query string.
| ...(params.clientIdempotencyKey ? { clientIdempotencyKey: params.clientIdempotencyKey } : {}), | ||
| }; | ||
|
|
||
| const approveTxRequest = await this.createTxRequest(approveIntent); |
There was a problem hiding this comment.
instead of using createTxRequest can we use the sendMany() method?
tomorrow, if we need to extend the depositToVault() for hot wallets, it will be easier.
54e300f to
e4fff33
Compare
Add SDK-side orchestration for Galaxy × Morpho ERC-4626 vault deposits. Introduces wallet.defi.depositToVault() which sequences approve + deposit txRequests with fail-fast auto-cancel, plus resumeDeposit() for recovery, and getOperation()/listOperations() for status tracking. Ticket: CGD-1533 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
e4fff33 to
2c562ff
Compare
Add SDK-side orchestration for Galaxy × Morpho ERC-4626 vault deposits. Introduces wallet.defi.depositToVault() which sequences approve + deposit txRequests with fail-fast auto-cancel, plus resumeDeposit() for recovery, and getOperation()/listOperations() for status tracking.
Ticket: CGD-1533