feat(bitstamp): add Bitstamp Enterprise connector#679
Conversation
Add a new Enterprise Edition PSP connector for Bitstamp exchange, mirroring the Coinbase Prime connector pattern with Bitstamp-specific adaptations for HMAC-SHA256 auth (hex signature, UUID nonce, ms timestamp), offset-based pagination, and dynamic JSON key parsing. Capabilities: FETCH_ACCOUNTS, FETCH_BALANCES, FETCH_PAYMENTS API: Bitstamp REST v2 with form-urlencoded POST endpoints Auth: HMAC-SHA256 with X-Auth headers Key implementation details: - Deterministic asset selection for multi-currency trades (largest absolute value) - Positive-match currency key extraction against loaded currencies map - Offset pagination with len(transactions) increment to avoid skipping records - Named constants for Bitstamp transaction type codes - Fixed epoch CreatedAt (Bitstamp launch date) for accounts - Lazy-load currency precision from /api/v2/currencies/ with mutex safety net
Allow overriding the Bitstamp API base URL via the `baseUrl` config field. When not set, defaults to https://www.bitstamp.net (production). This enables testing against UAT or sandbox environments.
- Fix data race in ensureCurrencies: use atomic.Bool for fast path instead of unsafe map length check outside mutex - Fix double otelhttp.NewTransport wrapping: httpwrapper.NewClient already adds the OTel layer, remove redundant wrapping in client - Fix signRequest: use req.URL fields directly instead of re-parsing with url.Parse (which swallowed errors) - Extract normalizeCurrency() and isZeroAmount() shared helpers to eliminate 6x duplicated strings.ToUpper(strings.TrimSpace()) and fragile hardcoded zero-string comparisons - Merge resolveAssetAndPrecision + extractAmount into single-pass resolveAssetAndAmount, eliminating redundant map iteration
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #679 +/- ##
==========================================
- Coverage 63.09% 62.94% -0.15%
==========================================
Files 832 841 +9
Lines 37635 38089 +454
==========================================
+ Hits 23744 23975 +231
- Misses 12316 12517 +201
- Partials 1575 1597 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
ee/plugins/bitstamp/)FETCH_ACCOUNTS,FETCH_BALANCES,FETCH_PAYMENTS(identical to Coinbase Prime)baseUrlfor UAT/staging environments (defaults tohttps://www.bitstamp.net)Key implementation details
X-Authheaders, form-urlencoded POST bodiesCreatedAt= Bitstamp launch date)POST /api/v2/account_balances/, usesavailablefieldPOST /api/v2/user_transactions/, deterministic asset selection for multi-currency trades (largest absolute value)GET /api/v2/currencies/with atomic lazy-load safety netUnmarshalJSONwith positive-match against known currencies mapFiles
ee/plugins/bitstamp/(~2000 lines)ee/plugins/list.go,enterprise_ce.go,v3-connectors-config.yaml, OpenAPI + SDK generated filesTest plan
go build ./ee/plugins/bitstamp/...compilesgo test ./ee/plugins/bitstamp/...— 38/38 passjust pcpasses (tidy, generate, lint, openapi, compile plugins & capabilities)bitstampregistered inEnterpriseOnlyPluginsfor CE error messagingV3BitstampConfigschema in OpenAPI spec