Skip to content

fix(sdk-core): stamp enterprise-id header on getVaultConfig call#9363

Open
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
defi-496-enterprise-id-header
Open

fix(sdk-core): stamp enterprise-id header on getVaultConfig call#9363
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
defi-496-enterprise-id-header

Conversation

@bitgo-ai-agent-dev

@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot commented Jul 27, 2026

Copy link
Copy Markdown

What

  • Stamped .set('enterprise-id', this.wallet.toJSON().enterprise) on the getVaultConfig GET request to defi-service
  • No constructor change needed — enterprise id is read directly from the wallet via IWallet.toJSON()
  • Updated tests: added enterprise to mock wallet data, set stub to mockRequest, and assertion that the header is sent

Why

  • DefiVault.getVaultConfig() was calling the defi-service vault config endpoint without the enterprise-id header that defi-service requires to resolve vault details
  • The UI uses token shapes without accessToken.enterprise populated, so defi-service received an empty enterprise and returned 404/empty results, causing the entire deposit flow to fail at the first step

Test plan

  • Unit tests pass: yarn run unit-test --scope @bitgo/sdk-core (34 passing)
  • Verify getVaultConfig test asserts .set('enterprise-id', 'test-enterprise-id') is called
  • TypeScript compiles cleanly

Ticket: DEFI-496

@linear-code

linear-code Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

DEFI-496

@ralph-bitgo
ralph-bitgo Bot force-pushed the defi-496-enterprise-id-header branch from 8228319 to 9bc0820 Compare July 27, 2026 15:26
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the defi-496-enterprise-id-header branch from 9bc0820 to 6a45ec4 Compare July 27, 2026 15:26
@ralph-bitgo
ralph-bitgo Bot force-pushed the defi-496-enterprise-id-header branch from 774dfe2 to ce3d765 Compare July 27, 2026 15:39
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the defi-496-enterprise-id-header branch from ce3d765 to 02a4e77 Compare July 27, 2026 15:39
DefiVault.getVaultConfig() was calling the defi-service vault config
endpoint without the `enterprise-id` header that defi-service requires.
This caused the entire deposit flow to fail for UI clients whose access
tokens don't have `accessToken.enterprise` populated as a fallback in
WP's auth resolution.

Fix: call `.set('enterprise-id', this.wallet.toJSON().enterprise)` on
the GET request. The enterprise id is sourced directly from the wallet
context via the IWallet.toJSON() accessor — no constructor change needed.

Tests: add `enterprise: 'test-enterprise-id'` to mock wallet data,
add `set: sinon.stub().returnsThis()` to mockRequest helper, and assert
`.set('enterprise-id', 'test-enterprise-id')` is called on the GET.

Ticket: DEFI-496
Session-Id: 1434552b-96ce-4eac-9922-cc2288aa5054
Task-Id: ba541f90-9eb1-45ed-a30f-a0605abde178
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the defi-496-enterprise-id-header branch from 02a4e77 to 974cd3f Compare July 27, 2026 15:41
@ralph-bitgo
ralph-bitgo Bot force-pushed the defi-496-enterprise-id-header branch from 974cd3f to 17fd5cb Compare July 27, 2026 15:42
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the defi-496-enterprise-id-header branch from 17fd5cb to 55a0150 Compare July 27, 2026 15:42
@venkateshv1266
venkateshv1266 marked this pull request as ready for review July 27, 2026 16:13
@venkateshv1266
venkateshv1266 requested review from a team as code owners July 27, 2026 16:13
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