Skip to content

feat: integrate BOB Gateway swapper (BTC ↔ BOB)#12390

Open
slavastartsev wants to merge 1 commit into
shapeshift:bob-swapperfrom
slavastartsev:bob-swapper
Open

feat: integrate BOB Gateway swapper (BTC ↔ BOB)#12390
slavastartsev wants to merge 1 commit into
shapeshift:bob-swapperfrom
slavastartsev:bob-swapper

Conversation

@slavastartsev
Copy link
Copy Markdown

@slavastartsev slavastartsev commented May 28, 2026

Description

Issue (if applicable)

closes #

Risk

High Risk PRs Require 2 approvals

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

Testing

Engineering

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Screenshots (if applicable)

Summary by CodeRabbit

  • New Features
    • Added BOB Gateway as a swapper option for cross-chain token swaps
    • Added support for Telos and Swell networks

Review Change Stack

@slavastartsev slavastartsev requested a review from a team as a code owner May 28, 2026 13:24
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Caution

Review failed

Failed to post review comments

📝 Walkthrough

Walkthrough

This PR integrates the BOB Gateway swapper into the trading platform, adding environment configuration, CSP security headers, new EVM chains (Telos, Swell), a complete quote/rate/execution API, transaction building for both UTXO and EVM paths, feature flag controls, and UI integration with metadata persistence.

Changes

BOB Gateway Swapper Integration

Layer / File(s) Summary
Environment and Configuration Setup
.env, .env.development, packages/public-api/src/config.ts, packages/public-api/src/env.ts, src/config.ts
Three new environment variables control BOB Gateway: feature flag (false in prod, true in dev), affiliate ID, and API key. Config validation and server-side routing added.
Content Security Policy for BOB Gateway API
headers/csps/defi/swappers/BobGateway.ts, headers/csps/index.ts
New CSP module permits https://gateway-api-mainnet.gobob.xyz via connect-src and integrates it into the CSP registry.
Chain Support: Telos and Swell
packages/caip/src/constants.ts
Added Telos (eip155:40) and Swell (eip155:1923) chain IDs with references and EVM chain validation.
Swapper Type System and Metadata
packages/swapper/src/types.ts
Introduced SwapperName.BobGateway enum variant, extended SwapperConfig with BOB affiliate/API keys, and added optional bobSpecific metadata fields to TradeQuoteStep and SwapperSpecificMetadata for quote and swap tracking.
BOB Gateway Constants and Conversion Helpers
packages/swapper/src/swappers/BobGatewaySwapper/utils/constants.ts, packages/swapper/src/swappers/BobGatewaySwapper/utils/helpers/helpers.ts
Constants for API base URL, chain naming, supported chains, token/address placeholders, and slippage; helper functions for chain/asset ID conversion, client instantiation with config-driven API key, affiliate validation, order status mapping, and quote metadata extraction.
Quote and Rate Retrieval API
packages/swapper/src/swappers/BobGatewaySwapper/swapperApi/getTradeQuote.ts, packages/swapper/src/swappers/BobGatewaySwapper/swapperApi/getTradeRate.ts
getTradeQuote validates inputs and route, fetches BOB Gateway quote, computes optimistic fee data (UTXO via xpub or EVM gas estimation), and structures response with execution metadata. getTradeRate similarly validates route, fetches quote, and builds rate object with single step.
Transaction Building and Fee Estimation
packages/swapper/src/swappers/BobGatewaySwapper/endpoints.ts
Implements getUnsignedUtxoTransaction, getUtxoTransactionFees, getUnsignedEvmTransaction, getEvmTransactionFees, and checkTradeStatus. Lazily creates BOB orders caching deposit/transaction data, computes fees via chain adapters, and maps order status to TxStatus with fallback handling for missing orders.
Swapper Registration and Dependencies
packages/swapper/package.json, packages/swapper/src/constants.ts, packages/swapper/src/index.ts, packages/swapper/src/swappers/BobGatewaySwapper/BobGatewaySwapper.ts, packages/swapper/src/swappers/BobGatewaySwapper/index.ts
Added @gobob/bob-sdk@5.6.0 dependency, registered BobGateway in swapper registry, defined default slippage (0.5%), created barrel export, and implemented bobGatewaySwapper with EVM and UTXO transaction execution.
Feature Flag and Enablement Wiring
src/state/slices/preferencesSlice/preferencesSlice.ts, src/state/helpers.ts, src/test/mocks/store.ts
Added BobGatewaySwap feature flag to FeatureFlags, wired it through getEnabledSwappers, marked as cross-account-trade supported, and set to false in mock store for tests.
UI Integration: Icon and Trade Metadata
src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx, src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeButtonProps.tsx, src/lib/tradeExecution.ts
Added BOB Gateway icon asset and case handler, threaded bobSpecific metadata through trade confirmation payload and trade execution to persist quote data.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

  • BOB swapper #12267: Directly addresses the BOB swapper implementation checklist with all required components (env vars, CSP, SwapperName enum, types, API endpoints, transaction building, icon, feature flag, and trade metadata).

Suggested labels

high risk

Suggested reviewers

  • gomesalexandre
  • 0xApotheosis
  • NeOMakinG

🐰 A gateway to chains cross-chain, with BOB it's not in vain!
Telos and Swell now play, while quotes and fees are on display.
UTXO, EVM, both routes align—affiliate marks the swap's design!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Bob swapper' is vague and lacks specificity about what was changed, using generic phrasing that doesn't clearly convey the main change or its scope. Use a more descriptive title that clearly specifies the feature or change, such as 'Add Bob Gateway swapper integration' or 'Implement BOB Gateway swap functionality with SDK integration'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch bob-swapper

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@slavastartsev slavastartsev changed the base branch from develop to bob-swapper May 28, 2026 13:25
@slavastartsev slavastartsev changed the title Bob swapper feat: integrate BOB Gateway swapper (BTC ↔ BOB) May 28, 2026
@slavastartsev
Copy link
Copy Markdown
Author

image I can’t figure out why network fees are displayed as `(unknown)`

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