Skip to content

fix(payments): correct BTC precision in webhook test fixture [AMB-3240] - #53

Open
bufo24 wants to merge 1 commit into
mainfrom
fix/AMB-3240-btc-webhook-fixture-precision
Open

bufo24 wants to merge 1 commit into
mainfrom
fix/AMB-3240-btc-webhook-fixture-precision

Conversation

@bufo24

@bufo24 bufo24 commented Sep 21, 2026

Copy link
Copy Markdown
Member

Changes precision: 11precision: 8 in the BTC BASE_ASSET blocks of the webhook verification fixture (webhooks.test.ts:18,29).

Why

The fixture was captured from a live payload, and the live value is wrong. The BTC BASE_ASSET row was seeded with 11 (millisatoshi) while BTC wire amounts are satoshis — so an integrator reading precision at runtime, as our docs instruct, sends 1000x too much. AmbossTech/amboss-shared#1079 corrects the row to 8.

amboss-shared/src/types/webhook-events.ts:26-28 already documents BTC webhook payloads as precision: 8, so this aligns the fixture with the contract rather than inventing a new value.

Notes for the reviewer

  • Fixture only — no SDK behavior changes. The SDK never does arithmetic with precision; it passes the value from the GraphQL response straight through to the caller. Verified: no Math.pow, 10 **, or division near a precision reference anywhere in packages/.
  • Safe to edit: the test signs BODY at runtime via sign() (webhooks.test.ts:48-50), so there is no hardcoded HMAC to regenerate. No assertion reads precision.
  • ambosstech-sdk holds an identical fixture but appears superseded by this repo (its HEAD is ~3 months older). Left alone — say the word if it's still live and I'll match it.

Test plan

  • pnpm run test — 62 pass, 0 fail
  • Merge after amboss-shared#1079, so the fixture and the database agree

Note: pnpm --filter @ambosstech/payments run test alone fails every test file — @ambosstech/core must be built first, which the root test script does. Not related to this change.

🤖 Generated with Claude Code

The fixture captured the live BASE_ASSET value of 11 (millisatoshi).
BTC webhook amounts are satoshis, so the documented contract in
amboss-shared and the corrected database row both use 8.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bufo24
bufo24 force-pushed the fix/AMB-3240-btc-webhook-fixture-precision branch from b5fa057 to 5c8e6b1 Compare September 22, 2026 09:27
@bufo24
bufo24 marked this pull request as ready for review September 22, 2026 09:27
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