Skip to content

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Nov 5, 2025

Description

Adds Bebop swapper, nothing more nothing less.

TODO:
- [x] make it work 
- [x] cross-account
- [x] cleanup
- [x] triple check math
- [x] triple check affiliate fees are happy 
- [ ] TODO but not required as part of opening this: spike and create an issue for multi-quotes + gasless?

Issue (if applicable)

closes #8963

Risk

High Risk PRs Require 2 approvals

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

Testing

  • Try a few routes with Bebop and confirm happy
  • Confirm that on-chain is matching final Bebop quote
  • Do test cross-account bebop trades and confirm happy too

Engineering

  • ☝🏽

Operations

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

Screenshots (if applicable)

  • Same account trade

https://jam.dev/c/e6e61bf9-3666-40b3-a133-e29368b7c40a

  • Cross account trade

https://jam.dev/c/c99072ca-67fc-4f23-a9e0-5e8f209a1f92

Summary by CodeRabbit

  • New Features

    • Added Bebop as a new swapping service with UI branding and swapper selection.
    • Bebop provides live trade quotes, rates, fee estimates, and unsigned transaction support for EVM chains.
    • Bebop enabled for cross-account trades and supported across multiple EVM networks.
  • Configuration

    • Feature flag to enable/disable Bebop swaps and an environment setting for the Bebop API key.
  • Documentation

    • Added comprehensive Bebop integration guides, templates, and common gotchas for swapper authors.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 5, 2025

📝 Walkthrough

Walkthrough

Adds a Bebop swapper proof-of-concept: new swapper code (quote/rate endpoints, service, helpers, types), CSP, feature flag and env vars, UI icon and state wiring, and extensive integration docs and templates. No removals; primarily additions and wiring under a feature flag.

Changes

Cohort / File(s) Summary
Env & Config
​.env, ​.env.development, src/config.ts
Added VITE_BEBOP_API_KEY and VITE_FEATURE_BEBOP_SWAP env vars; enabled flag in development and added config validators.
Swapper Types & Registration
packages/swapper/src/types.ts, packages/swapper/src/constants.ts
Added SwapperName.Bebop, SwapperConfig.VITE_BEBOP_API_KEY, TradeQuoteStep.bebopTransactionMetadata, registered Bebop in swappers map and default slippage mapping.
Bebop Swapper Core & API
packages/swapper/src/swappers/BebopSwapper/*.ts, .../index.ts, packages/swapper/src/index.ts
New Bebop swapper export (bebopSwapper) and API (bebopApi) with implementations for getTradeQuote, getTradeRate, unsigned tx assembly, fee estimation, and status check.
Quote & Rate Logic
packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/..., getBebopTradeRate/...
Implemented getBebopTradeQuote and getBebopTradeRate: validation, slippage defaults, route selection, rate calculation, fee estimation, and monadic error mapping.
Service & Fetch Utilities
packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts, .../fetchFromBebop.ts
Added bebopServiceFactory (axios wrapper with short cache and API key header) and fetchBebopQuote / fetchBebopPrice with request construction and Result-mapped error handling.
Helpers & Type Definitions
packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts, packages/swapper/src/swappers/BebopSwapper/types.ts
New helpers for token mapping, chain support checks, trade validation, rate calculation; Bebop-specific types, supported chain list, chain mapping, and constants (BEBOP_NATIVE_MARKER, BEBOP_DUMMY_ADDRESS).
Headers / CSP
headers/csps/defi/swappers/Bebop.ts, headers/csps/index.ts
Added CSP entry for https://api.bebop.xyz and registered it in the CSP collection.
State & Feature Flags
src/state/helpers.ts, src/state/slices/preferencesSlice/preferencesSlice.ts, src/test/mocks/store.ts
Introduced BebopSwap feature flag in FeatureFlags, initial state and mock store; enabled Bebop in getEnabledSwappers and cross-account trade support.
UI
src/components/.../SwapperIcon/SwapperIcon.tsx
Added BebopIcon handling in SwapperIcon component.
Docs & Templates
.claude/skills/swapper-integration/*.md, packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
Added comprehensive swapper-integration docs, common-gotchas, examples/templates, reference material, and a Bebop-specific integration guide.

Sequence Diagram(s)

sequenceDiagram
    rect rgba(44,130,201,0.08)
    participant UI as UI / Client
    participant API as SwapperAPI (endpoints)
    participant QuoteFn as getBebopTradeQuote
    participant Service as bebopService
    participant Bebop as Bebop API
    participant Adapter as EvmChainAdapter
    end

    UI->>API: getTradeQuote(input)
    API->>QuoteFn: delegate request
    QuoteFn->>QuoteFn: validate assets & slippage
    QuoteFn->>Service: fetchBebopQuote(params, apiKey)
    Service->>Bebop: GET /quote (x-api-key)
    Bebop-->>Service: BebopQuoteResponse
    Service-->>QuoteFn: Result<BebopQuoteResponse>
    alt routes present
      QuoteFn->>QuoteFn: select best route, build TradeQuote
      QuoteFn->>Adapter: evm.getFees / estimate gas
      Adapter-->>QuoteFn: fees
      QuoteFn-->>API: TradeQuote
      API-->>UI: TradeQuote[][]
    else no route / error
      QuoteFn-->>API: Error Result
      API-->>UI: Error
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Areas to focus during review:

  • getBebopTradeQuote and getBebopTradeRate: validation, monadic Result handling, numeric precision and rate math.
  • endpoints unsigned tx assembly: metadata extraction, hex→bigint handling, gas limit selection (API vs node).
  • bebopServiceFactory: header injection and caching behavior for /quote and /price.
  • Types: alignment of new Bebop-specific types and TradeQuoteStep.bebopTransactionMetadata.
  • Feature-flag wiring and CSP registration.

Suggested labels

high risk

Suggested reviewers

  • NeOMakinG
  • premiumjibles
  • kaladinlight

Poem

🐇 I hopped to Bebop's API gate,
Collected quotes and checked the rate.
With keys and flags I paved the way—
A tiny hop, a swapper's day. ✨

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: bebop swapper' clearly and concisely identifies the main change—adding Bebop swapper support. It follows conventional commit format and accurately represents the changeset.
Linked Issues check ✅ Passed The PR implements all primary objectives from issue #8963: Bebop swapper is feature-flagged, provides rates/quoting functionality, integrates with Bebop APIs (/quote endpoint), includes cross-account trade support, and follows established swapper patterns.
Out of Scope Changes check ✅ Passed All changes are directly related to Bebop swapper integration. Configuration, types, UI components, CSP headers, and documentation are appropriately scoped to fulfill the linked issue requirements. No unrelated modifications detected.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat_bebop_new_swapper_who_dis

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.

gomesalexandre and others added 2 commits November 5, 2025 13:26
yeah nah this pr was getting absolutely cooked with fluff so gave it a proper cleanup:

- yeeted 218 lines of deadweight code and ai spew comments (bonza!)
- binned the entire utils/constants.ts file - 7 outta 9 constants were just takin up space like a bludger
- removed 6 unused types that were doing fuck all (BebopRoute, BebopToken, BebopGasFee, etc)
- chucked out isNativeEthSell() function - never even got called once, useless as tits on a bull
- ditched bebop-specific slippage default, now uses the generic 0.2% like zrx (she'll be right)
- simplified hex value handling - no more defensive ternary bullshit, just proper viem fromHex() calls
- replaced dodgy type casting with proper isAddress() validation for type narrowing (mint!)
- nuked that mental gas limit fallback calculation - bebop always gives us the goods anyway
- fixed up all the types to use proper Hex instead of string for transaction data
- removed a metric fuckton of obvious comments that were just stating the bloody obvious
- sorted the missing Hex import and gas optional type (was being a drongo)

code's now clean as a whistle and follows the zrx gold standard pattern. lint:fix and type-check both passing like an absolute weapon. no fluff, no worries, just quality code ready to ship 🍺

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gomesalexandre gomesalexandre changed the title wip: new swapper who dis feat: new swapper who dis Nov 5, 2025
gomesalexandre and others added 5 commits November 5, 2025 14:10
proper sorted out the cross-account trade support for bebop:

- flipped bebop to return true in isCrossAccountTradeSupported (was false for no good reason)
- updated fetchBebopQuote to accept separate takerAddress and receiverAddress params (mint!)
- taker = wallet that signs and has sell tokens (sendAddress || receiveAddress)
- receiver = destination wallet for buy tokens (receiveAddress)
- tested with bebop api - works a treat with different taker/receiver addresses
- follows same pattern as butterswap (from: sendAddress, receiver: receiveAddress)
- removed redundant Hex type casts since types are already proper in the definitions
- removed unused Hex import that was sookin

now you can send tokens to a different wallet no worries, bebop handles it sweet as 🦘

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…erly ya mad kunt

went full scorched earth on the remaining bloat:

- yeeted another 95 lines of unnecessary wrapper functions (bonza!)
- deleted bebopTokenToAssetId - never even used once, complete waste of space
- nuked getBebopChainName, buildBebopApiUrl, formatBebopAmount, getSlippageTolerance - all one-liner wrappers, just inline the buggers
- simplified assetIdToBebopToken using isToken() util with early return (proper clean)
- renamed BEBOP_NATIVE_TOKEN_ADDRESS to BEBOP_NATIVE_MARKER (matches codebase terminology)
- fixed fetchBebopPrice to use real wallet address when available instead of always using dummy (was being a drongo)
- wired up cross-account trades properly - taker vs receiver addresses now handled mint
- verified fund destination flow - bebop sends buy tokens to correct receive address (tested with api, she's sweet)
- removed all console.debug and remaining ai spew comments
- fixed parseFloat to use bnOrZero pattern (proper shapeshift way)
- removed unused imports after cleanup

code's now lean as fuck - no fluff wrappers, proper dependency injection like zrx, cross-account working, funds going to right place. lint and type-check passing like a weapon 🍺

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
nuked the last obvious comment "// Validate best price exists" - code speaks for itself mate

fetchFromBebop.ts now 100% comment-free and clean as a whistle 🍺

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
… ya legend

the rebase absolutely borked everything so had to fix it all up:

- re-applied all the fluff removal that got lost (inlined helper functions)
- fixed fetchBebopQuote signature back to takerAddress/receiverAddress params
- added BEBOP_DUMMY_ADDRESS constant to types.ts with proper explanation
- wired up safety check in getBebopTradeQuote - throws if trying to execute with dummy address (mint defensive programming)
- fixed fetchBebopPrice to use receiveAddress param when wallet connected
- using bn() instead of parseFloat for slippage calc (proper shapeshift pattern)
- removed all the deleted helper function imports that came back from the dead
- fixed variable naming from takerWillBe to just takerAddress (cleaner)

now we got proper safety - can't accidentally execute quotes with dummy address, cross-account working mint, and all the cleanup is back in place 🍺

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gomesalexandre gomesalexandre marked this pull request as ready for review November 5, 2025 05:31
@gomesalexandre gomesalexandre requested a review from a team as a code owner November 5, 2025 05:31
@gomesalexandre gomesalexandre changed the title feat: new swapper who dis feat: bebop swapper Nov 5, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
.env.development (1)

6-6: Drop the duplicate Bebop flag.

We already enable VITE_FEATURE_BEBOP_SWAP in the base .env, so the extra definition here just creates redundancy. Please remove it from .env.development.

bebop-integration-technical-findings.md (1)

23-41: Remove real API key from the repo immediately

The documentation includes an actual Bebop API key in the sample curl commands. This is a high-severity secret leak—anyone with repository access can use or abuse the key right now. Please strip the key from the file, rotate/revoke it with Bebop, and force-push a version with only redacted placeholders before proceeding.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8c7c2a0 and 875ce6f.

⛔ Files ignored due to path filters (1)
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/bebop-icon.png is excluded by !**/*.png
📒 Files selected for processing (23)
  • .env (1 hunks)
  • .env.development (1 hunks)
  • bebop-integration-technical-findings.md (1 hunks)
  • bebop_integration_analysis.md (1 hunks)
  • headers/csps/defi/swappers/Bebop.ts (1 hunks)
  • headers/csps/index.ts (2 hunks)
  • packages/swapper/src/constants.ts (3 hunks)
  • packages/swapper/src/index.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/index.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/types.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts (1 hunks)
  • packages/swapper/src/types.ts (3 hunks)
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx (2 hunks)
  • src/config.ts (1 hunks)
  • src/state/helpers.ts (3 hunks)
  • src/state/slices/preferencesSlice/preferencesSlice.ts (2 hunks)
  • src/test/mocks/store.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (13)
packages/swapper/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

packages/swapper/**/*.ts: Use TypeScript with explicit types (e.g., SupportedChainIds) in all swapper-related files.
Use camelCase for variables and functions, PascalCase for types and interfaces, and kebab-case for filenames in swapper-related files.

Files:

  • packages/swapper/src/index.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
packages/swapper/src/index.ts

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

Export unique functions/types from packages/swapper/src/index.ts if needed.

Files:

  • packages/swapper/src/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.{ts,tsx}: ALWAYS use Result<T, E> pattern for error handling in swappers and APIs
ALWAYS use Ok() and Err() from @sniptt/monads for monadic error handling
ALWAYS use custom error classes from @shapeshiftoss/errors
ALWAYS provide meaningful error codes for internationalization
ALWAYS include relevant details in error objects
ALWAYS wrap async operations in try-catch blocks
ALWAYS use AsyncResultOf utility for converting promises to Results
ALWAYS provide fallback error handling
ALWAYS use timeoutMonadic for API calls
ALWAYS provide appropriate timeout values for API calls
ALWAYS handle timeout errors gracefully
ALWAYS validate inputs before processing
ALWAYS provide clear validation error messages
ALWAYS use early returns for validation failures
ALWAYS log errors for debugging
ALWAYS use structured logging for errors
ALWAYS include relevant context in error logs
Throwing errors instead of using monadic patterns is an anti-pattern
Missing try-catch blocks for async operations is an anti-pattern
Generic error messages without context are an anti-pattern
Not handling specific error types is an anti-pattern
Missing timeout handling is an anti-pattern
No input validation is an anti-pattern
Poor error logging is an anti-pattern
Using any for error types is an anti-pattern
Missing error codes for internationalization is an anti-pattern
No fallback error handling is an anti-pattern
Console.error without structured logging is an anti-pattern

**/*.{ts,tsx}: ALWAYS use camelCase for variables, functions, and methods
ALWAYS use descriptive names that explain the purpose for variables and functions
ALWAYS use verb prefixes for functions that perform actions
ALWAYS use PascalCase for types, interfaces, and enums
ALWAYS use descriptive names that indicate the structure for types, interfaces, and enums
ALWAYS use suffixes like Props, State, Config, Type when appropriate for types and interfaces
ALWAYS use UPPER_SNAKE_CASE for constants and configuration values
ALWAYS use d...

Files:

  • packages/swapper/src/index.ts
  • src/test/mocks/store.ts
  • headers/csps/defi/swappers/Bebop.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • src/state/slices/preferencesSlice/preferencesSlice.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • src/config.ts
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
  • headers/csps/index.ts
**/swapper/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/swapper/**/*.{ts,tsx}: AVOID throwing within swapper API implementations; return Err() instead. UI layers may still throw (caught by React error boundaries).
ALWAYS use makeSwapErrorRight for swapper errors
ALWAYS use TradeQuoteError enum for error codes in swapper errors
ALWAYS provide detailed error information in swapper errors

Files:

  • packages/swapper/src/index.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
**/*

📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)

**/*: ALWAYS use appropriate file extensions
Flag files without kebab-case

Files:

  • packages/swapper/src/index.ts
  • src/test/mocks/store.ts
  • headers/csps/defi/swappers/Bebop.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • src/state/slices/preferencesSlice/preferencesSlice.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • bebop_integration_analysis.md
  • src/config.ts
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • bebop-integration-technical-findings.md
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
  • headers/csps/index.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)

USE Redux only for global state shared across multiple places

Files:

  • packages/swapper/src/index.ts
  • src/test/mocks/store.ts
  • headers/csps/defi/swappers/Bebop.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • src/state/slices/preferencesSlice/preferencesSlice.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • src/config.ts
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
  • headers/csps/index.ts
packages/swapper/src/{constants,types}.ts

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.

Files:

  • packages/swapper/src/types.ts
  • packages/swapper/src/constants.ts
packages/swapper/src/swappers/**/*

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

Avoid placing swapper files outside packages/swapper/src/swappers/.

Files:

  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
packages/swapper/src/swappers/*/{*.ts,endpoints.ts}

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

packages/swapper/src/swappers/*/{*.ts,endpoints.ts}: All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.
Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.
Validate inputs and log errors for debugging in swapper implementations.
Avoid side effects in swap logic within swapper implementation files.
Include comments explaining swap logic in swapper implementation files.
Verify chain ID filtering in filterAssetIdsBySellable and filterBuyAssetsBySellAssetId methods.

Files:

  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
packages/swapper/src/swappers/*/{*.ts,utils/*.ts}

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

Each swapper must be implemented in its own directory under packages/swapper/src/swappers// with the following files: .ts, endpoints.ts, utils/constants.ts, utils/helpers.ts, types.ts.

Files:

  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.tsx: ALWAYS wrap components in error boundaries
ALWAYS provide user-friendly fallback components in error boundaries
ALWAYS log errors for debugging in error boundaries
ALWAYS use useErrorToast hook for displaying errors
ALWAYS provide translated error messages in error toasts
ALWAYS handle different error types appropriately in error toasts
Missing error boundaries in React components is an anti-pattern

**/*.tsx: ALWAYS use PascalCase for React component names
ALWAYS use descriptive names that indicate the component's purpose
ALWAYS match the component name to the file name
Flag components without PascalCase
Flag default exports for components

Files:

  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)

**/*.{tsx,jsx}: ALWAYS use useMemo for expensive computations, object/array creations, and filtered data
ALWAYS use useMemo for derived values and computed properties
ALWAYS use useMemo for conditional values and simple transformations
ALWAYS use useCallback for event handlers and functions passed as props
ALWAYS use useCallback for any function that could be passed as a prop or dependency
ALWAYS include all dependencies in useEffect, useMemo, useCallback dependency arrays
NEVER use // eslint-disable-next-line react-hooks/exhaustive-deps unless absolutely necessary
ALWAYS explain why dependencies are excluded if using eslint disable
ALWAYS use named exports for components
NEVER use default exports for components
KEEP component files under 200 lines when possible
BREAK DOWN large components into smaller, reusable pieces
EXTRACT complex logic into custom hooks
USE local state for component-level state
LIFT state up when needed across multiple components
USE Context for avoiding prop drilling
ALWAYS wrap components in error boundaries for production
ALWAYS handle async errors properly
ALWAYS provide user-friendly error messages
ALWAYS use virtualization for lists with 100+ items
ALWAYS implement proper key props for list items
ALWAYS lazy load heavy components
ALWAYS use React.lazy for code splitting
Components receiving props are wrapped with memo

Files:

  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
packages/swapper/src/constants.ts

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

Prevent unregistered swappers in the registry (i.e., all swappers must be registered in packages/swapper/src/constants.ts).

Files:

  • packages/swapper/src/constants.ts
🧠 Learnings (31)
📓 Common learnings
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Include comments explaining swap logic in swapper implementation files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/{constants,types}.ts : Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/**/*.@(test|spec).ts : Write unit tests for swapper methods and API endpoints.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/**/*.ts : Use TypeScript with explicit types (e.g., SupportedChainIds) in all swapper-related files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS use TradeQuoteError enum for error codes in swapper errors
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Ensure adherence to Swapper and SwapperApi interfaces in code review.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,utils/*.ts} : Each swapper must be implemented in its own directory under packages/swapper/src/swappers/<SwapperName>/ with the following files: <SwapperName>.ts, endpoints.ts, utils/constants.ts, utils/helpers.ts, types.ts.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10458
File: src/plugins/walletConnectToDapps/types.ts:7-7
Timestamp: 2025-09-10T15:34:29.604Z
Learning: gomesalexandre is comfortable relying on transitive dependencies (like abitype through ethers/viem) rather than explicitly declaring them in package.json, preferring to avoid package.json bloat when the transitive dependency approach works reliably in practice.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/config.ts:127-128
Timestamp: 2025-08-07T11:20:44.614Z
Learning: gomesalexandre prefers required environment variables without default values in the config file (src/config.ts). They want explicit configuration and fail-fast behavior when environment variables are missing, rather than having fallback defaults.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/modals/ContractInteractionBreakdown.tsx:0-0
Timestamp: 2025-09-13T16:45:18.813Z
Learning: gomesalexandre prefers aggressively deleting unused/obsolete code files ("ramboing") rather than fixing technical issues in code that won't be used, demonstrating his preference for keeping codebases clean and PR scope focused.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10503
File: .env:56-56
Timestamp: 2025-09-16T13:17:02.938Z
Learning: gomesalexandre prefers to enable feature flags globally in the base .env file when the intent is to activate features everywhere, even when there are known issues like crashes, demonstrating his preference for intentional global feature rollouts over cautious per-environment enablement.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10249
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:447-503
Timestamp: 2025-08-13T17:07:10.763Z
Learning: gomesalexandre prefers relying on TypeScript's type system for validation rather than adding defensive runtime null checks when types are properly defined. They favor a TypeScript-first approach over defensive programming with runtime validations.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/hooks/useActionCenterSubscribers/useThorchainLpDepositActionSubscriber.tsx:61-66
Timestamp: 2025-08-14T17:51:47.556Z
Learning: gomesalexandre is not concerned about structured logging and prefers to keep console.error usage as-is rather than implementing structured logging patterns, even when project guidelines suggest otherwise.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10413
File: src/components/Modals/FiatRamps/fiatRampProviders/onramper/utils.ts:29-55
Timestamp: 2025-09-02T14:26:19.028Z
Learning: gomesalexandre prefers to keep preparatory/reference code simple until it's actively consumed, rather than implementing comprehensive error handling, validation, and robustness improvements upfront. They prefer to add these improvements when the code is actually being used in production.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:396-402
Timestamp: 2025-08-14T17:55:57.490Z
Learning: gomesalexandre is comfortable with functions/variables that return undefined or true (tri-state) when only the truthy case matters, preferring to rely on JavaScript's truthy/falsy behavior rather than explicitly returning boolean values.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10783
File: src/context/ModalStackProvider/useModalRegistration.ts:30-41
Timestamp: 2025-10-16T11:14:40.657Z
Learning: gomesalexandre prefers to add lint rules (like typescript-eslint/strict-boolean-expressions for truthiness checks on numbers) to catch common issues project-wide rather than relying on code review to catch them.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/lib/moralis.ts:47-85
Timestamp: 2025-08-07T11:22:16.983Z
Learning: gomesalexandre prefers console.error over structured logging for Moralis API integration debugging, as they find it more conventional and prefer to examine XHR requests directly rather than rely on structured logs for troubleshooting.
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/index.ts : Export unique functions/types from packages/swapper/src/index.ts if needed.

Applied to files:

  • packages/swapper/src/index.ts
  • headers/csps/defi/swappers/Bebop.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
  • headers/csps/index.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/{constants,types}.ts : Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.

Applied to files:

  • packages/swapper/src/index.ts
  • headers/csps/defi/swappers/Bebop.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • src/state/slices/preferencesSlice/preferencesSlice.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • src/config.ts
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • bebop-integration-technical-findings.md
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
  • headers/csps/index.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

Applied to files:

  • packages/swapper/src/index.ts
  • src/test/mocks/store.ts
  • headers/csps/defi/swappers/Bebop.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • bebop_integration_analysis.md
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • bebop-integration-technical-findings.md
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
  • headers/csps/index.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.

Applied to files:

  • packages/swapper/src/index.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • bebop-integration-technical-findings.md
  • headers/csps/index.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Include comments explaining swap logic in swapper implementation files.

Applied to files:

  • packages/swapper/src/index.ts
  • headers/csps/defi/swappers/Bebop.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • bebop_integration_analysis.md
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • bebop-integration-technical-findings.md
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
  • headers/csps/index.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/constants.ts : Prevent unregistered swappers in the registry (i.e., all swappers must be registered in packages/swapper/src/constants.ts).

Applied to files:

  • packages/swapper/src/index.ts
  • packages/swapper/src/types.ts
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • headers/csps/index.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/**/*.ts : Use TypeScript with explicit types (e.g., SupportedChainIds) in all swapper-related files.

Applied to files:

  • packages/swapper/src/index.ts
  • headers/csps/defi/swappers/Bebop.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • bebop-integration-technical-findings.md
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
  • headers/csps/index.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/**/*.ts : Use camelCase for variables and functions, PascalCase for types and interfaces, and kebab-case for filenames in swapper-related files.

Applied to files:

  • packages/swapper/src/index.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • headers/csps/index.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,utils/*.ts} : Each swapper must be implemented in its own directory under packages/swapper/src/swappers/<SwapperName>/ with the following files: <SwapperName>.ts, endpoints.ts, utils/constants.ts, utils/helpers.ts, types.ts.

Applied to files:

  • packages/swapper/src/index.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.

Applied to files:

  • packages/swapper/src/index.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • bebop_integration_analysis.md
  • src/state/helpers.ts
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • bebop-integration-technical-findings.md
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
  • headers/csps/index.ts
📚 Learning: 2025-09-04T10:18:34.140Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10427
File: src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx:40-40
Timestamp: 2025-09-04T10:18:34.140Z
Learning: In the shapeshift/web codebase, src/state/slices/selectors.ts uses wildcard exports (`export * from './[sliceName]/selectors'`) to re-export all selectors from individual slice selector files, making them available through the barrel import. This means selectors like selectTxByFilter from txHistorySlice/selectors are properly accessible via '@/state/slices/selectors' even though they don't appear in explicit named exports.

Applied to files:

  • packages/swapper/src/index.ts
📚 Learning: 2025-08-03T22:09:37.542Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS use makeSwapErrorRight for swapper errors

Applied to files:

  • packages/swapper/src/index.ts
  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • src/state/helpers.ts
  • packages/swapper/src/constants.ts
  • headers/csps/index.ts
📚 Learning: 2025-09-09T06:01:24.130Z
Learnt from: 0xApotheosis
Repo: shapeshift/web PR: 10424
File: .env.production:3-3
Timestamp: 2025-09-09T06:01:24.130Z
Learning: In Vite, environment variables have a fallback mechanism where .env.production takes precedence over .env, but variables defined only in .env will still be available in the production environment if not overridden in .env.production.

Applied to files:

  • .env.development
  • .env
📚 Learning: 2025-08-22T13:02:38.078Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10323
File: src/pages/Explore/Explore.tsx:91-92
Timestamp: 2025-08-22T13:02:38.078Z
Learning: In the ShapeShift web codebase, feature flags are consistently used as string literals with the useFeatureFlag hook (e.g., useFeatureFlag('RfoxFoxEcosystemPage')), not as enums. The hook accepts keyof FeatureFlags which provides type safety through the TypeScript type system rather than requiring an enum. This is the established pattern used throughout the entire codebase.

Applied to files:

  • src/test/mocks/store.ts
  • src/state/slices/preferencesSlice/preferencesSlice.ts
📚 Learning: 2025-08-03T22:09:37.542Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS use TradeQuoteError enum for error codes in swapper errors

Applied to files:

  • packages/swapper/src/types.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • bebop_integration_analysis.md
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • packages/swapper/src/constants.ts
  • bebop-integration-technical-findings.md
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
  • headers/csps/index.ts
📚 Learning: 2025-11-03T22:31:30.786Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10985
File: packages/swapper/src/swappers/PortalsSwapper/getPortalsTradeQuote/getPortalsTradeQuote.ts:0-0
Timestamp: 2025-11-03T22:31:30.786Z
Learning: In packages/swapper/src/swappers/PortalsSwapper, the rate and quote files intentionally use different approaches for calculating buyAmountBeforeSlippageCryptoBaseUnit: getPortalsTradeRate.tsx uses minOutputAmount / (1 - buffer) for conservative estimates, while getPortalsTradeQuote.ts uses outputAmount / (1 - buffer) for final quote display. This difference is validated by on-chain simulation testing and is intentional.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • bebop_integration_analysis.md
  • packages/swapper/src/constants.ts
  • bebop-integration-technical-findings.md
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Verify chain ID filtering in filterAssetIdsBySellable and filterBuyAssetsBySellAssetId methods.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • bebop_integration_analysis.md
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
  • bebop-integration-technical-findings.md
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Validate inputs and log errors for debugging in swapper implementations.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts
  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • src/state/helpers.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
  • bebop-integration-technical-findings.md
  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/**/*.@(test|spec).ts : Write unit tests for swapper methods and API endpoints.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
  • bebop_integration_analysis.md
  • packages/swapper/src/constants.ts
  • packages/swapper/src/swappers/BebopSwapper/index.ts
📚 Learning: 2025-08-03T22:09:37.542Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS provide detailed error information in swapper errors

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts
  • packages/swapper/src/constants.ts
📚 Learning: 2025-08-08T14:59:40.422Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10231
File: src/pages/Explore/ExploreCategory.tsx:231-238
Timestamp: 2025-08-08T14:59:40.422Z
Learning: In src/pages/Explore/ExploreCategory.tsx, for the PageHeader filter trigger, NeOMakinG considers changing a clickable Chakra Icon to IconButton too nitpicky for this PR and prefers to keep the current Icon-based trigger; such minor a11y/UI nitpicks should be deferred to a follow-up if needed.

Applied to files:

  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
📚 Learning: 2025-07-29T15:04:28.083Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10139
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx:109-115
Timestamp: 2025-07-29T15:04:28.083Z
Learning: In src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx, the component is used under an umbrella that 100% of the time contains the quote, making the type assertion `activeTradeQuote?.steps[currentHopIndex] as TradeQuoteStep` safe. Adding conditional returns before hooks would violate React's Rules of Hooks.

Applied to files:

  • src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx
📚 Learning: 2025-08-11T09:46:41.060Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10219
File: src/components/MultiHopTrade/components/TradeInput/TradeInput.tsx:167-172
Timestamp: 2025-08-11T09:46:41.060Z
Learning: In the shapeshift/web repository, the display cache logic for trade quotes (using `selectUserAvailableTradeQuotes` and `selectUserUnavailableTradeQuotes`) is intentionally kept the same between `TradeInput.tsx` and `TradeQuotes.tsx` components. The `hasQuotes` computation in `TradeInput.tsx` uses these display cache selectors by design, matching the pattern used in `TradeQuotes.tsx`.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
📚 Learning: 2025-08-07T11:20:44.614Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/config.ts:127-128
Timestamp: 2025-08-07T11:20:44.614Z
Learning: gomesalexandre prefers required environment variables without default values in the config file (src/config.ts). They want explicit configuration and fail-fast behavior when environment variables are missing, rather than having fallback defaults.

Applied to files:

  • src/config.ts
📚 Learning: 2025-08-04T16:02:27.360Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10171
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandedStepperSteps.tsx:458-458
Timestamp: 2025-08-04T16:02:27.360Z
Learning: In multi-hop swap transactions, last hop sell transactions might not be detected by the swapper (unlike buy transactions which are always known immediately). The conditional stepSource logic for last hop buy transactions (`isLastHopSellTxSeen ? stepSource : undefined`) serves as defensive programming for future multi-hop support with intermediate chains, even though multi-hop functionality is not currently supported in production.

Applied to files:

  • src/state/helpers.ts
📚 Learning: 2025-08-04T15:36:25.122Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10171
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandedStepperSteps.tsx:458-458
Timestamp: 2025-08-04T15:36:25.122Z
Learning: In swap transaction handling, buy transaction hashes should always use the swapper's explorer (stepSource) because they are known by the swapper immediately upon swap execution. The conditional logic for using default explorers applies primarily to sell transactions which need to be detected/indexed by external systems like Thorchain or ViewBlock.

Applied to files:

  • src/state/helpers.ts
📚 Learning: 2025-10-23T14:27:19.073Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10857
File: src/plugins/walletConnectToDapps/eventsManager/useWalletConnectEventsHandler.ts:101-104
Timestamp: 2025-10-23T14:27:19.073Z
Learning: In WalletConnect wallet_switchEthereumChain and wallet_addEthereumChain requests, the chainId parameter is always present as per the protocol spec. Type guards checking for missing chainId in these handlers (like `if (!evmNetworkIdHex) return`) are solely for TypeScript compiler satisfaction, not real runtime edge cases.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/types.ts
📚 Learning: 2025-08-05T23:36:13.214Z
Learnt from: premiumjibles
Repo: shapeshift/web PR: 10187
File: src/state/slices/preferencesSlice/selectors.ts:21-25
Timestamp: 2025-08-05T23:36:13.214Z
Learning: The AssetId type from 'shapeshiftoss/caip' package is a string type alias, so it can be used directly as a return type for cache key resolvers in re-reselect selectors without needing explicit string conversion.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
📚 Learning: 2025-08-17T21:53:03.806Z
Learnt from: 0xApotheosis
Repo: shapeshift/web PR: 10290
File: scripts/generateAssetData/color-map.json:41-47
Timestamp: 2025-08-17T21:53:03.806Z
Learning: In the ShapeShift web codebase, native assets (using CAIP-19 slip44 namespace like eip155:1/slip44:60, bip122:.../slip44:..., cosmos:.../slip44:...) are manually hardcoded and not generated via the automated asset generation script. Only ERC20/BEP20 tokens go through the asset generation process. The validation scripts should only validate generated assets, not manually added native assets.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
📚 Learning: 2025-08-05T16:39:58.598Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10191
File: src/pages/Explore/Explore.tsx:56-56
Timestamp: 2025-08-05T16:39:58.598Z
Learning: In the ShapeShift web codebase, the established pattern for handling floating point numbers is to use BigNumber operations (bnOrZero, bn) for calculations and convert to strings using .toString() before passing to UI components like Amount.Fiat, Amount.Crypto, and Amount.Percent. This prevents JavaScript floating point precision issues and maintains consistency across the application.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts
🧬 Code graph analysis (10)
headers/csps/defi/swappers/Bebop.ts (1)
headers/types.ts (1)
  • Csp (2-2)
packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts (9)
packages/swapper/src/types.ts (5)
  • GetEvmTradeQuoteInputBase (184-187)
  • TradeQuote (442-447)
  • SwapErrorRight (84-90)
  • TradeQuoteStep (269-329)
  • SingleHopTradeQuoteSteps (429-429)
src/lib/utils/evm/index.ts (1)
  • assertGetEvmChainAdapter (185-194)
packages/types/src/base.ts (1)
  • AssetsByIdPartial (96-96)
packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts (2)
  • assertValidTrade (23-64)
  • calculateRate (66-84)
packages/swapper/src/swappers/BebopSwapper/types.ts (1)
  • BEBOP_DUMMY_ADDRESS (102-102)
packages/swapper/src/utils.ts (1)
  • makeSwapErrorRight (28-44)
packages/swapper/src/constants.ts (1)
  • getDefaultSlippageDecimalPercentageForSwapper (96-126)
packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts (1)
  • fetchBebopQuote (16-111)
packages/swapper/src/swappers/utils/helpers/helpers.ts (1)
  • isNativeEvmAsset (29-51)
packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts (7)
packages/swapper/src/types.ts (4)
  • GetEvmTradeRateInput (188-191)
  • TradeRate (457-461)
  • SwapErrorRight (84-90)
  • SingleHopTradeRateSteps (432-432)
packages/types/src/base.ts (1)
  • AssetsByIdPartial (96-96)
packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts (2)
  • assertValidTrade (23-64)
  • calculateRate (66-84)
packages/swapper/src/constants.ts (1)
  • getDefaultSlippageDecimalPercentageForSwapper (96-126)
packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts (1)
  • fetchBebopPrice (113-140)
packages/swapper/src/utils.ts (1)
  • makeSwapErrorRight (28-44)
packages/swapper/src/swappers/utils/helpers/helpers.ts (1)
  • isNativeEvmAsset (29-51)
packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts (2)
packages/swapper/src/swappers/BebopSwapper/index.ts (1)
  • bebopSwapper (1-1)
packages/swapper/src/types.ts (1)
  • Swapper (569-593)
src/state/slices/preferencesSlice/preferencesSlice.ts (1)
src/config.ts (1)
  • getConfig (212-214)
packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts (2)
packages/swapper/src/types.ts (1)
  • MonadicSwapperAxiosService (682-682)
packages/swapper/src/utils.ts (2)
  • createCache (59-76)
  • makeSwapperAxiosServiceMonadic (99-151)
packages/swapper/src/swappers/BebopSwapper/endpoints.ts (5)
packages/swapper/src/types.ts (3)
  • SwapperApi (595-616)
  • GetEvmTradeQuoteInputBase (184-187)
  • GetEvmTradeRateInput (188-191)
packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts (1)
  • getBebopTradeQuote (26-163)
src/lib/utils/evm/index.ts (1)
  • assertGetEvmChainAdapter (185-194)
packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts (1)
  • getBebopTradeRate (20-116)
packages/swapper/src/utils.ts (3)
  • isExecutableTradeQuote (291-292)
  • getExecutableTradeStep (297-307)
  • checkEvmSwapStatus (237-273)
packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts (6)
packages/swapper/src/swappers/BebopSwapper/types.ts (4)
  • BebopQuoteResponse (80-85)
  • chainIdToBebopChain (87-95)
  • BebopSupportedChainId (14-14)
  • BEBOP_DUMMY_ADDRESS (102-102)
packages/swapper/src/types.ts (1)
  • SwapErrorRight (84-90)
packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts (1)
  • assetIdToBebopToken (13-17)
packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts (1)
  • bebopServiceFactory (25-44)
packages/swapper/src/utils.ts (1)
  • makeSwapErrorRight (28-44)
src/state/apis/swapper/types.ts (1)
  • TradeQuoteError (39-39)
packages/swapper/src/constants.ts (2)
packages/swapper/src/swappers/BebopSwapper/BebopSwapper.ts (1)
  • bebopSwapper (4-6)
packages/swapper/src/swappers/BebopSwapper/endpoints.ts (1)
  • bebopApi (10-86)
packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts (5)
packages/caip/src/assetId/assetId.ts (2)
  • AssetId (17-17)
  • fromAssetId (143-178)
packages/utils/src/index.ts (1)
  • isToken (28-41)
packages/swapper/src/swappers/BebopSwapper/types.ts (3)
  • BEBOP_NATIVE_MARKER (97-97)
  • BebopSupportedChainId (14-14)
  • bebopSupportedChainIds (4-12)
packages/swapper/src/utils.ts (1)
  • makeSwapErrorRight (28-44)
src/state/apis/swapper/types.ts (1)
  • TradeQuoteError (39-39)
🪛 Gitleaks (8.28.0)
.env

[high] 178-178: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

bebop-integration-technical-findings.md

[high] 32-33: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 36-37: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 40-41: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 23-23: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 33-33: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 37-37: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 41-41: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🪛 LanguageTool
bebop_integration_analysis.md

[uncategorized] ~846-~846: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...it API keys to version control ### 5.2 Rate Limiting - Bebop API may have rate limits - Impl...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

bebop-integration-technical-findings.md

[uncategorized] ~343-~343: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...- [x] Native ETH vs WETH behavior - [x] Rate limiting assessment - [x] Minimum trade amount v...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🪛 markdownlint-cli2 (0.18.1)
bebop_integration_analysis.md

37-37: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


126-126: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

bebop-integration-technical-findings.md

50-50: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


194-194: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (9)
packages/swapper/src/index.ts (1)

6-6: LGTM!

The BebopSwapper export follows the established barrel pattern and maintains alphabetical ordering with other swapper exports.

src/components/MultiHopTrade/components/TradeInput/components/SwapperIcon/SwapperIcon.tsx (1)

7-7: LGTM!

The BebopIcon import and switch case follow the established pattern for swapper icons. The placement maintains consistency with the existing code structure.

Also applies to: 49-50

src/test/mocks/store.ts (1)

162-162: LGTM!

The BebopSwap feature flag mock follows the established pattern and is appropriately initialized to false for test scenarios.

src/config.ts (1)

189-190: Verify required API key is intentional.

The VITE_BEBOP_API_KEY validator uses str() without a default, making it a required environment variable. While this follows your preference for fail-fast behavior, confirm this is intentional since:

  1. The key is provided in the base .env file (which may have security implications - see separate comment)
  2. Other swapper API keys like VITE_CHAINFLIP_API_KEY (line 172) are also required without defaults

If Bebop functionality should gracefully degrade when the key is missing, consider adding { default: '' } and handling empty strings in the swapper implementation.

src/state/helpers.ts (2)

41-41: LGTM!

The BebopSwap feature flag is correctly destructured and wired into the enabled swappers map, following the established pattern for other swappers.

Also applies to: 71-72


15-15: Cross-account support is already implemented in BebopSwapper.

The actual implementation in packages/swapper/src/swappers/BebopSwapper/utils/fetchBebopQuote.ts passes both taker_address and receiver_address as separate parameters to the Bebop API (lines 58-59), enabling cross-account trades. The code in getBebopTradeQuote extracts both sendAddress and receiveAddress from input and passes them correctly.

Verify that your PR TODO checklist's "cross-account" item should be marked as complete since the feature is fully implemented and functional.

packages/swapper/src/swappers/BebopSwapper/index.ts (1)

1-2: LGTM!

The barrel exports follow the established swapper pattern, re-exporting the swapper instance and API endpoints with proper camelCase naming.

src/state/slices/preferencesSlice/preferencesSlice.ts (1)

89-89: LGTM!

The BebopSwap feature flag is correctly added to the FeatureFlags type and properly initialized from config, following the established pattern for all other feature flags.

Also applies to: 216-216

.env (1)

178-178: Verify API key is non-sensitive or use placeholder.

The API key b4a7ffa9-2abb-45ae-8ddd-ec33bc377939 is committed to the base .env file. If this is a production or sensitive key, it should be removed and:

  1. Replaced with a placeholder (e.g., your-bebop-api-key-here)
  2. Documented in README for developers to obtain their own key
  3. Actual keys stored in .env.local (git-ignored) or environment-specific files

If this is a publicly available test/development key, consider adding a comment to clarify.

⛔ Skipped due to learnings
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: .env:113-114
Timestamp: 2025-08-07T11:17:09.291Z
Learning: In the shapeshift/web project, storing API keys directly in the .env file (including production keys) is an intentional design decision. The team is aware of potential abuse but chooses this approach for their API key management. This should not be flagged as a security concern in future reviews.

- Fix hex gas limit conversion: convert Bebop's hex gas values to decimal before fee calculations
- Replace `any` types with proper TypeScript types based on actual API response
- Add gas estimate validation: fail gracefully if Bebop doesn't provide gas
- Clarify slippage format: rename slippageBps → slippagePercentage with docs
- Add BebopError type for proper error handling
- Type toSign payload with actual structure from API

Resolves CodeRabbit issues from PR #11000

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/swapper/src/swappers/BebopSwapper/endpoints.ts (1)

21-29: LGTM!

The getTradeRate implementation follows the same pattern as getTradeQuote and correctly wraps the result in a 2D array format as expected by the SwapperApi interface.

🧹 Nitpick comments (2)
packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts (2)

45-47: Consider using the centralized default slippage helper.

The inline default of 0.003 should ideally use getDefaultSlippageDecimalPercentageForSwapper(SwapperName.Bebop) for consistency with how getBebopTradeQuote handles defaults. This ensures all slippage defaults are managed in one place.

Apply this diff:

-    const slippagePercentage = bn(slippageTolerancePercentageDecimal ?? 0.003)
+    const slippagePercentage = bn(
+      slippageTolerancePercentageDecimal ?? 
+      getDefaultSlippageDecimalPercentageForSwapper(SwapperName.Bebop)
+    )
       .times(100)
       .toNumber()

You'll also need to import the helper:

+import { getDefaultSlippageDecimalPercentageForSwapper } from '../../../constants'
+import { SwapperName } from '../../../types'

141-141: Clarify the intentional slippage difference for price fetching.

The hardcoded slippage of '0.01' (1%) differs from the 0.003 (0.3%) default in fetchBebopQuote. If this higher value is intentional for price/rate fetching (to get more conservative estimates), consider documenting this decision or extracting to a named constant like BEBOP_PRICE_SLIPPAGE_DECIMAL.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 875ce6f and 6d7335a.

📒 Files selected for processing (4)
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/types.ts (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts
  • packages/swapper/src/swappers/BebopSwapper/types.ts
🧰 Additional context used
📓 Path-based instructions (8)
packages/swapper/src/swappers/*/{*.ts,utils/*.ts}

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

Each swapper must be implemented in its own directory under packages/swapper/src/swappers// with the following files: .ts, endpoints.ts, utils/constants.ts, utils/helpers.ts, types.ts.

Files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
packages/swapper/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

packages/swapper/**/*.ts: Use TypeScript with explicit types (e.g., SupportedChainIds) in all swapper-related files.
Use camelCase for variables and functions, PascalCase for types and interfaces, and kebab-case for filenames in swapper-related files.

Files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
packages/swapper/src/swappers/**/*

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

Avoid placing swapper files outside packages/swapper/src/swappers/.

Files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.{ts,tsx}: ALWAYS use Result<T, E> pattern for error handling in swappers and APIs
ALWAYS use Ok() and Err() from @sniptt/monads for monadic error handling
ALWAYS use custom error classes from @shapeshiftoss/errors
ALWAYS provide meaningful error codes for internationalization
ALWAYS include relevant details in error objects
ALWAYS wrap async operations in try-catch blocks
ALWAYS use AsyncResultOf utility for converting promises to Results
ALWAYS provide fallback error handling
ALWAYS use timeoutMonadic for API calls
ALWAYS provide appropriate timeout values for API calls
ALWAYS handle timeout errors gracefully
ALWAYS validate inputs before processing
ALWAYS provide clear validation error messages
ALWAYS use early returns for validation failures
ALWAYS log errors for debugging
ALWAYS use structured logging for errors
ALWAYS include relevant context in error logs
Throwing errors instead of using monadic patterns is an anti-pattern
Missing try-catch blocks for async operations is an anti-pattern
Generic error messages without context are an anti-pattern
Not handling specific error types is an anti-pattern
Missing timeout handling is an anti-pattern
No input validation is an anti-pattern
Poor error logging is an anti-pattern
Using any for error types is an anti-pattern
Missing error codes for internationalization is an anti-pattern
No fallback error handling is an anti-pattern
Console.error without structured logging is an anti-pattern

**/*.{ts,tsx}: ALWAYS use camelCase for variables, functions, and methods
ALWAYS use descriptive names that explain the purpose for variables and functions
ALWAYS use verb prefixes for functions that perform actions
ALWAYS use PascalCase for types, interfaces, and enums
ALWAYS use descriptive names that indicate the structure for types, interfaces, and enums
ALWAYS use suffixes like Props, State, Config, Type when appropriate for types and interfaces
ALWAYS use UPPER_SNAKE_CASE for constants and configuration values
ALWAYS use d...

Files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
**/swapper/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/swapper/**/*.{ts,tsx}: AVOID throwing within swapper API implementations; return Err() instead. UI layers may still throw (caught by React error boundaries).
ALWAYS use makeSwapErrorRight for swapper errors
ALWAYS use TradeQuoteError enum for error codes in swapper errors
ALWAYS provide detailed error information in swapper errors

Files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
**/*

📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)

**/*: ALWAYS use appropriate file extensions
Flag files without kebab-case

Files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)

USE Redux only for global state shared across multiple places

Files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
packages/swapper/src/swappers/*/{*.ts,endpoints.ts}

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

packages/swapper/src/swappers/*/{*.ts,endpoints.ts}: All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.
Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.
Validate inputs and log errors for debugging in swapper implementations.
Avoid side effects in swap logic within swapper implementation files.
Include comments explaining swap logic in swapper implementation files.
Verify chain ID filtering in filterAssetIdsBySellable and filterBuyAssetsBySellAssetId methods.

Files:

  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
🧠 Learnings (14)
📓 Common learnings
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10569
File: src/plugins/walletConnectToDapps/components/WalletConnectSigningModal/WalletConnectModalSigningFooter.tsx:121-129
Timestamp: 2025-09-17T22:40:30.149Z
Learning: gomesalexandre maintains strict scope discipline even for style/UI PRs in shapeshift/web, declining functionally correct UX improvements (like keeping Cancel button enabled during gas simulation loading) when they fall outside the PR's stated styling objectives, demonstrating his consistent pattern of deferring valid but tangential improvements to separate efforts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/{constants,types}.ts : Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/**/*.@(test|spec).ts : Write unit tests for swapper methods and API endpoints.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Ensure adherence to Swapper and SwapperApi interfaces in code review.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Include comments explaining swap logic in swapper implementation files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,utils/*.ts} : Each swapper must be implemented in its own directory under packages/swapper/src/swappers/<SwapperName>/ with the following files: <SwapperName>.ts, endpoints.ts, utils/constants.ts, utils/helpers.ts, types.ts.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10458
File: src/plugins/walletConnectToDapps/types.ts:7-7
Timestamp: 2025-09-10T15:34:29.604Z
Learning: gomesalexandre is comfortable relying on transitive dependencies (like abitype through ethers/viem) rather than explicitly declaring them in package.json, preferring to avoid package.json bloat when the transitive dependency approach works reliably in practice.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/config.ts:127-128
Timestamp: 2025-08-07T11:20:44.614Z
Learning: gomesalexandre prefers required environment variables without default values in the config file (src/config.ts). They want explicit configuration and fail-fast behavior when environment variables are missing, rather than having fallback defaults.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/modals/ContractInteractionBreakdown.tsx:0-0
Timestamp: 2025-09-13T16:45:18.813Z
Learning: gomesalexandre prefers aggressively deleting unused/obsolete code files ("ramboing") rather than fixing technical issues in code that won't be used, demonstrating his preference for keeping codebases clean and PR scope focused.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10503
File: .env:56-56
Timestamp: 2025-09-16T13:17:02.938Z
Learning: gomesalexandre prefers to enable feature flags globally in the base .env file when the intent is to activate features everywhere, even when there are known issues like crashes, demonstrating his preference for intentional global feature rollouts over cautious per-environment enablement.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10249
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:447-503
Timestamp: 2025-08-13T17:07:10.763Z
Learning: gomesalexandre prefers relying on TypeScript's type system for validation rather than adding defensive runtime null checks when types are properly defined. They favor a TypeScript-first approach over defensive programming with runtime validations.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/hooks/useActionCenterSubscribers/useThorchainLpDepositActionSubscriber.tsx:61-66
Timestamp: 2025-08-14T17:51:47.556Z
Learning: gomesalexandre is not concerned about structured logging and prefers to keep console.error usage as-is rather than implementing structured logging patterns, even when project guidelines suggest otherwise.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10413
File: src/components/Modals/FiatRamps/fiatRampProviders/onramper/utils.ts:29-55
Timestamp: 2025-09-02T14:26:19.028Z
Learning: gomesalexandre prefers to keep preparatory/reference code simple until it's actively consumed, rather than implementing comprehensive error handling, validation, and robustness improvements upfront. They prefer to add these improvements when the code is actually being used in production.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:396-402
Timestamp: 2025-08-14T17:55:57.490Z
Learning: gomesalexandre is comfortable with functions/variables that return undefined or true (tri-state) when only the truthy case matters, preferring to rely on JavaScript's truthy/falsy behavior rather than explicitly returning boolean values.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10783
File: src/context/ModalStackProvider/useModalRegistration.ts:30-41
Timestamp: 2025-10-16T11:14:40.657Z
Learning: gomesalexandre prefers to add lint rules (like typescript-eslint/strict-boolean-expressions for truthiness checks on numbers) to catch common issues project-wide rather than relying on code review to catch them.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/lib/moralis.ts:47-85
Timestamp: 2025-08-07T11:22:16.983Z
Learning: gomesalexandre prefers console.error over structured logging for Moralis API integration debugging, as they find it more conventional and prefer to examine XHR requests directly rather than rely on structured logs for troubleshooting.
📚 Learning: 2025-11-03T22:31:30.786Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10985
File: packages/swapper/src/swappers/PortalsSwapper/getPortalsTradeQuote/getPortalsTradeQuote.ts:0-0
Timestamp: 2025-11-03T22:31:30.786Z
Learning: In packages/swapper/src/swappers/PortalsSwapper, the rate and quote files intentionally use different approaches for calculating buyAmountBeforeSlippageCryptoBaseUnit: getPortalsTradeRate.tsx uses minOutputAmount / (1 - buffer) for conservative estimates, while getPortalsTradeQuote.ts uses outputAmount / (1 - buffer) for final quote display. This difference is validated by on-chain simulation testing and is intentional.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
📚 Learning: 2025-08-03T22:09:37.542Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS use TradeQuoteError enum for error codes in swapper errors

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Verify chain ID filtering in filterAssetIdsBySellable and filterBuyAssetsBySellAssetId methods.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Include comments explaining swap logic in swapper implementation files.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/index.ts : Export unique functions/types from packages/swapper/src/index.ts if needed.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/{constants,types}.ts : Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
📚 Learning: 2025-11-03T05:46:24.190Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10985
File: packages/swapper/src/swappers/PortalsSwapper/getPortalsTradeRate/getPortalsTradeRate.tsx:130-141
Timestamp: 2025-11-03T05:46:24.190Z
Learning: In packages/swapper/src/swappers/PortalsSwapper/getPortalsTradeRate/getPortalsTradeRate.tsx, gomesalexandre prefers "let it crash" approach when Portals returns zero outputAmount or 100% buffer causing division by zero, rather than adding defensive guards to surface zero quotes. He wants to fail fast with exceptions that bubble up to the try/catch wrapper, surfacing upstream data issues rather than masking them with defensive programming.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
📚 Learning: 2025-08-11T09:46:41.060Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10219
File: src/components/MultiHopTrade/components/TradeInput/TradeInput.tsx:167-172
Timestamp: 2025-08-11T09:46:41.060Z
Learning: In the shapeshift/web repository, the display cache logic for trade quotes (using `selectUserAvailableTradeQuotes` and `selectUserUnavailableTradeQuotes`) is intentionally kept the same between `TradeInput.tsx` and `TradeQuotes.tsx` components. The `hasQuotes` computation in `TradeInput.tsx` uses these display cache selectors by design, matching the pattern used in `TradeQuotes.tsx`.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Validate inputs and log errors for debugging in swapper implementations.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/**/*.@(test|spec).ts : Write unit tests for swapper methods and API endpoints.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/endpoints.ts
🧬 Code graph analysis (2)
packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts (6)
packages/swapper/src/swappers/BebopSwapper/types.ts (4)
  • BebopQuoteResponse (100-105)
  • chainIdToBebopChain (107-115)
  • BebopSupportedChainId (14-14)
  • BEBOP_DUMMY_ADDRESS (122-122)
packages/swapper/src/types.ts (1)
  • SwapErrorRight (84-90)
packages/swapper/src/swappers/BebopSwapper/utils/helpers/helpers.ts (1)
  • assetIdToBebopToken (13-17)
packages/swapper/src/swappers/BebopSwapper/utils/bebopService.ts (1)
  • bebopServiceFactory (25-44)
packages/swapper/src/utils.ts (1)
  • makeSwapErrorRight (28-44)
src/state/apis/swapper/types.ts (1)
  • TradeQuoteError (39-39)
packages/swapper/src/swappers/BebopSwapper/endpoints.ts (5)
packages/swapper/src/types.ts (3)
  • SwapperApi (595-616)
  • GetEvmTradeQuoteInputBase (184-187)
  • GetEvmTradeRateInput (188-191)
packages/swapper/src/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.ts (1)
  • getBebopTradeQuote (26-166)
src/lib/utils/evm/index.ts (1)
  • assertGetEvmChainAdapter (185-194)
packages/swapper/src/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.ts (1)
  • getBebopTradeRate (20-116)
packages/swapper/src/utils.ts (3)
  • isExecutableTradeQuote (291-292)
  • getExecutableTradeStep (297-307)
  • checkEvmSwapStatus (237-273)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install and Cache
🔇 Additional comments (7)
packages/swapper/src/swappers/BebopSwapper/utils/fetchFromBebop.ts (3)

50-78: LGTM!

The URL parameter construction and API call handling are well-structured. The conditional affiliate fee inclusion and proper error wrapping with TradeQuoteError.QueryFailed follow best practices.


80-104: LGTM!

The response validation correctly distinguishes between normal partial failures (logged for debugging) and actual quote failures (no routes or missing bestPrice). The use of TradeQuoteError.NoRouteFound and TradeQuoteError.InvalidResponse provides appropriate error codes for these cases.


106-116: LGTM!

The success path and catch-all error handling follow the monadic pattern correctly, ensuring all paths return Result<BebopQuoteResponse, SwapErrorRight>.

packages/swapper/src/swappers/BebopSwapper/endpoints.ts (4)

30-65: LGTM! Good defensive gas limit calculation.

The transaction building logic is sound. Line 63's use of BigNumber.max to choose the higher gas limit between the node estimate and Bebop's API estimate provides good defense against gas estimation edge cases. The comment clearly explains this decision.

The error throwing on lines 37, 42, and 52 is necessary given that getUnsignedEvmTransaction returns Promise<SignTx> rather than a Result type per the SwapperApi interface.


66-88: LGTM!

The fee calculation correctly reuses the same validation and metadata extraction logic as getUnsignedEvmTransaction, then returns just the network fee portion. The implementation is consistent and correct.


89-89: LGTM!

Correctly delegates to the shared checkEvmSwapStatus utility as recommended by the swapper implementation guidelines.

Based on learnings


11-20: Type assertion is safely validated by immediate chain filtering—no action required.

The type assertion on line 13 is intentional and safe. BebopSwapper is EVM-only (implements only executeEvmTransaction), and chain validation occurs immediately via assertValidTrade(), which checks both assets against bebopSupportedChainIds and returns TradeQuoteError.UnsupportedChain if either asset's chain is unsupported. The caller (swapper.ts) already selected this swapper by name (SwapperName.Bebop), establishing the contract at the routing layer. This pattern is consistent across all EVM swappers in the codebase.

@premiumjibles premiumjibles self-requested a review November 5, 2025 10:42
Copy link
Collaborator

@premiumjibles premiumjibles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing part of this now and part tomorrow. So just posting initial testing until I get to proper code review

  • Tested swap from ETH on arb -> USDC on arb, verified values against arbiscan ✔️
  • Tested swap from ETH on ethereum -> USDC on ethereum, verified values against etherscan ✔️
  • Tested swap from USDC on arb -> USDT0 on arb on different wallet, verified values against arbiscan ✔️
  • Tested quote refresh on timer ✔️
  • Tested click through to explorer transaction ✔️

Happy with behaviour, everything seems to work great 👌

Create comprehensive Claude Code skill to guide swapper integrations:

**Skill Structure:**
- SKILL.md: Main workflow orchestrator with 5 phases
- reference.md: General patterns and architecture knowledge
- examples.md: Code templates for common patterns
- common-gotchas.md: Critical bugs to avoid from past integrations

**Key Features:**
- Interactive information gathering (API docs, chains, auth, etc.)
- Guides research of existing swappers before coding
- Covers full integration: packages/swapper + UI + config
- Emphasizes feature flags and proper registration
- Documents 12 common bugs with solutions

**Documentation:**
- Move bebop-integration-technical-findings.md → BebopSwapper/INTEGRATION.md
- Delete redundant bebop_integration_analysis.md
- Establish pattern for swapper-specific integration docs

This enables natural language swapper integration requests like
"integrate Jupiter swapper" with guided, consistent implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (7)
.claude/skills/swapper-integration/common-gotchas.md (1)

23-39: Add language specifiers to all code blocks for consistency.

Several code blocks are missing language specifications (MD040). Update all code blocks to include the language identifier (e.g., ```typescript instead of ```). This improves syntax highlighting and readability.

Example fixes:

  • Lines 23-39: Change ``` to ```typescript
  • Lines 52-59: Change ``` to ```typescript
  • Lines 82-88: Change ``` to ```typescript

And so on for all remaining code blocks in the file.

Also applies to: 52-59, 62-65, 82-88, 111-123, 132-139, 163-168, 172-184, 200-206, 210-220, 260-262, 285-293, 334-342

.claude/skills/swapper-integration/SKILL.md (2)

41-41: Fix compound adjective formatting.

Change "Rate limiting" to "Rate-limiting" since it modifies the following noun "details".


105-108: Add language specifiers to code blocks.

Update code blocks to include language specifications for consistency with markdown best practices:

  • Lines 105-108: Change ``` to ```bash
  • Lines 151-160: Keep as generic reference block or use ```typescript if showing code examples

Also applies to: 151-160

packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md (4)

50-50: Use markdown heading syntax for better structure.

Line 50 uses emphasis instead of a heading syntax. Change to ### PMMv3 (Private Market Maker) for proper document hierarchy and linting compliance.

-**PMMv3 (Private Market Maker)**
+### PMMv3 (Private Market Maker)

56-60: Use markdown heading syntax for better structure.

Line 56 should also be a heading to maintain consistent document hierarchy with PMMv3 above it.

-**JAMv2 (Just-in-time Aggregation Model)**
+### JAMv2 (Just-in-time Aggregation Model)

194-194: Specify language for fenced code block.

The code block at line 194 is missing a language identifier. Add typescript to the opening fence for syntax highlighting and linting compliance.

-```
+```typescript
 packages/swapper/src/swappers/BebopSwapper/

343-343: Fix compound adjective hyphenation.

"Minimum trade amount" should be hyphenated as a compound adjective modifying "validation" in the checklist context.

-[x] Minimum trade amount validation
+[x] Minimum-trade-amount validation
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6d7335a and b09a126.

📒 Files selected for processing (5)
  • .claude/skills/swapper-integration/SKILL.md (1 hunks)
  • .claude/skills/swapper-integration/common-gotchas.md (1 hunks)
  • .claude/skills/swapper-integration/examples.md (1 hunks)
  • .claude/skills/swapper-integration/reference.md (1 hunks)
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • .claude/skills/swapper-integration/reference.md
  • .claude/skills/swapper-integration/examples.md
🧰 Additional context used
📓 Path-based instructions (2)
packages/swapper/src/swappers/**/*

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

Avoid placing swapper files outside packages/swapper/src/swappers/.

Files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
**/*

📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)

**/*: ALWAYS use appropriate file extensions
Flag files without kebab-case

Files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
🧠 Learnings (17)
📓 Common learnings
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10569
File: src/plugins/walletConnectToDapps/components/WalletConnectSigningModal/WalletConnectModalSigningFooter.tsx:121-129
Timestamp: 2025-09-17T22:40:30.149Z
Learning: gomesalexandre maintains strict scope discipline even for style/UI PRs in shapeshift/web, declining functionally correct UX improvements (like keeping Cancel button enabled during gas simulation loading) when they fall outside the PR's stated styling objectives, demonstrating his consistent pattern of deferring valid but tangential improvements to separate efforts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Include comments explaining swap logic in swapper implementation files.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10985
File: packages/swapper/src/swappers/PortalsSwapper/getPortalsTradeQuote/getPortalsTradeQuote.ts:0-0
Timestamp: 2025-11-03T22:31:30.786Z
Learning: In packages/swapper/src/swappers/PortalsSwapper, the rate and quote files intentionally use different approaches for calculating buyAmountBeforeSlippageCryptoBaseUnit: getPortalsTradeRate.tsx uses minOutputAmount / (1 - buffer) for conservative estimates, while getPortalsTradeQuote.ts uses outputAmount / (1 - buffer) for final quote display. This difference is validated by on-chain simulation testing and is intentional.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/{constants,types}.ts : Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Ensure adherence to Swapper and SwapperApi interfaces in code review.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS use TradeQuoteError enum for error codes in swapper errors
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/**/*.ts : Use TypeScript with explicit types (e.g., SupportedChainIds) in all swapper-related files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Validate inputs and log errors for debugging in swapper implementations.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10458
File: src/plugins/walletConnectToDapps/types.ts:7-7
Timestamp: 2025-09-10T15:34:29.604Z
Learning: gomesalexandre is comfortable relying on transitive dependencies (like abitype through ethers/viem) rather than explicitly declaring them in package.json, preferring to avoid package.json bloat when the transitive dependency approach works reliably in practice.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/config.ts:127-128
Timestamp: 2025-08-07T11:20:44.614Z
Learning: gomesalexandre prefers required environment variables without default values in the config file (src/config.ts). They want explicit configuration and fail-fast behavior when environment variables are missing, rather than having fallback defaults.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/modals/ContractInteractionBreakdown.tsx:0-0
Timestamp: 2025-09-13T16:45:18.813Z
Learning: gomesalexandre prefers aggressively deleting unused/obsolete code files ("ramboing") rather than fixing technical issues in code that won't be used, demonstrating his preference for keeping codebases clean and PR scope focused.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10503
File: .env:56-56
Timestamp: 2025-09-16T13:17:02.938Z
Learning: gomesalexandre prefers to enable feature flags globally in the base .env file when the intent is to activate features everywhere, even when there are known issues like crashes, demonstrating his preference for intentional global feature rollouts over cautious per-environment enablement.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10249
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:447-503
Timestamp: 2025-08-13T17:07:10.763Z
Learning: gomesalexandre prefers relying on TypeScript's type system for validation rather than adding defensive runtime null checks when types are properly defined. They favor a TypeScript-first approach over defensive programming with runtime validations.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/hooks/useActionCenterSubscribers/useThorchainLpDepositActionSubscriber.tsx:61-66
Timestamp: 2025-08-14T17:51:47.556Z
Learning: gomesalexandre is not concerned about structured logging and prefers to keep console.error usage as-is rather than implementing structured logging patterns, even when project guidelines suggest otherwise.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10413
File: src/components/Modals/FiatRamps/fiatRampProviders/onramper/utils.ts:29-55
Timestamp: 2025-09-02T14:26:19.028Z
Learning: gomesalexandre prefers to keep preparatory/reference code simple until it's actively consumed, rather than implementing comprehensive error handling, validation, and robustness improvements upfront. They prefer to add these improvements when the code is actually being used in production.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:396-402
Timestamp: 2025-08-14T17:55:57.490Z
Learning: gomesalexandre is comfortable with functions/variables that return undefined or true (tri-state) when only the truthy case matters, preferring to rely on JavaScript's truthy/falsy behavior rather than explicitly returning boolean values.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10783
File: src/context/ModalStackProvider/useModalRegistration.ts:30-41
Timestamp: 2025-10-16T11:14:40.657Z
Learning: gomesalexandre prefers to add lint rules (like typescript-eslint/strict-boolean-expressions for truthiness checks on numbers) to catch common issues project-wide rather than relying on code review to catch them.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/lib/moralis.ts:47-85
Timestamp: 2025-08-07T11:22:16.983Z
Learning: gomesalexandre prefers console.error over structured logging for Moralis API integration debugging, as they find it more conventional and prefer to examine XHR requests directly rather than rely on structured logs for troubleshooting.
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Include comments explaining swap logic in swapper implementation files.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
  • .claude/skills/swapper-integration/common-gotchas.md
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
  • .claude/skills/swapper-integration/common-gotchas.md
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
  • .claude/skills/swapper-integration/common-gotchas.md
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/{constants,types}.ts : Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
  • .claude/skills/swapper-integration/common-gotchas.md
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,utils/*.ts} : Each swapper must be implemented in its own directory under packages/swapper/src/swappers/<SwapperName>/ with the following files: <SwapperName>.ts, endpoints.ts, utils/constants.ts, utils/helpers.ts, types.ts.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Ensure adherence to Swapper and SwapperApi interfaces in code review.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
  • .claude/skills/swapper-integration/common-gotchas.md
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/**/*.ts : Use TypeScript with explicit types (e.g., SupportedChainIds) in all swapper-related files.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
  • .claude/skills/swapper-integration/common-gotchas.md
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/**/*.@(test|spec).ts : Write unit tests for swapper methods and API endpoints.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-08-03T22:09:37.542Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS provide detailed error information in swapper errors

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
  • .claude/skills/swapper-integration/common-gotchas.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Validate inputs and log errors for debugging in swapper implementations.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
  • .claude/skills/swapper-integration/common-gotchas.md
📚 Learning: 2025-08-03T22:09:37.542Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS use TradeQuoteError enum for error codes in swapper errors

Applied to files:

  • .claude/skills/swapper-integration/common-gotchas.md
📚 Learning: 2025-08-03T22:09:37.542Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS use makeSwapErrorRight for swapper errors

Applied to files:

  • .claude/skills/swapper-integration/common-gotchas.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/index.ts : Export unique functions/types from packages/swapper/src/index.ts if needed.

Applied to files:

  • .claude/skills/swapper-integration/common-gotchas.md
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-11-03T22:31:30.786Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10985
File: packages/swapper/src/swappers/PortalsSwapper/getPortalsTradeQuote/getPortalsTradeQuote.ts:0-0
Timestamp: 2025-11-03T22:31:30.786Z
Learning: In packages/swapper/src/swappers/PortalsSwapper, the rate and quote files intentionally use different approaches for calculating buyAmountBeforeSlippageCryptoBaseUnit: getPortalsTradeRate.tsx uses minOutputAmount / (1 - buffer) for conservative estimates, while getPortalsTradeQuote.ts uses outputAmount / (1 - buffer) for final quote display. This difference is validated by on-chain simulation testing and is intentional.

Applied to files:

  • .claude/skills/swapper-integration/common-gotchas.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Verify chain ID filtering in filterAssetIdsBySellable and filterBuyAssetsBySellAssetId methods.

Applied to files:

  • .claude/skills/swapper-integration/common-gotchas.md
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
🪛 Gitleaks (8.28.0)
packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md

[high] 32-33: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 36-37: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 40-41: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 23-23: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 33-33: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 37-37: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 41-41: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🪛 LanguageTool
.claude/skills/swapper-integration/SKILL.md

[uncategorized] ~41-~41: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...tion API key to add to .env.base - Rate limiting details 2. Supported Networks -...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

.claude/skills/swapper-integration/common-gotchas.md

[grammar] ~235-~235: Ensure spelling is correct
Context: ...ng loose string types instead of proper viem types, losing type safety. *Examples...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[style] ~450-~450: Consider an alternative verb to strengthen your wording.
Context: ...des handled correctly --- ## When You See These Errors **"Taker address not chec...

(IF_YOU_HAVE_THIS_PROBLEM)

packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md

[uncategorized] ~343-~343: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...- [x] Native ETH vs WETH behavior - [x] Rate limiting assessment - [x] Minimum trade amount v...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🪛 markdownlint-cli2 (0.18.1)
.claude/skills/swapper-integration/SKILL.md

9-9: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md

50-50: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


194-194: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install and Cache
🔇 Additional comments (2)
.claude/skills/swapper-integration/common-gotchas.md (1)

1-476: Excellent gotchas reference aligned with PR objectives.

This documentation effectively aggregates critical bugs discovered across previous swapper integrations, with concrete examples and solutions. The Bebop-specific examples (slippage format, response structure, hex conversion) directly address known issues and will help prevent regressions. The checklists and error reference section provide actionable guidance for developers implementing new swappers.

.claude/skills/swapper-integration/SKILL.md (1)

1-399: Comprehensive swapper integration workflow—well-structured and practical.

This skill document provides a clear 5-phase workflow that mirrors the learnings embedded in the codebase. The emphasis on researching existing swappers (BebopSwapper, ZrxSwapper, etc.) before implementation aligns with the principle of copying established patterns rather than inventing new ones. The checklists, directory structure templates, and registration steps accurately reflect the actual patterns used in the repo.

Strong points:

  • Phase 1 information gathering upfront prevents costly rework
  • Explicit directory structure reduces ambiguity
  • CSP header and feature flag integration steps are concrete and actionable
  • Testing & validation guidance is pragmatic

This will reduce friction for future swapper integrations.

Update environment variable instructions to match actual project structure:
- `.env` is the base file (not `.env.base`)
- Both API key and feature flag go in `.env` (with flag=false)
- `.env.development` has API key filled and flag=true
- Added explicit naming conventions with Bebop example

Also improved Phase 1:
- Split API docs into two separate questions (main docs + Swagger)
- Added Phase 2 Step 0: Study API documentation before coding
- Instructed to use AskUserQuestion tool for interactive prompts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
.claude/skills/swapper-integration/SKILL.md (3)

151-160: Add language specifier to fenced code block.

The bash code block starting at line 151 lacks a language identifier, violating markdown linting standards. The block should specify bash for syntax highlighting consistency.

Apply this diff to fix the markdown:

-```
+```bash
 # List all existing swappers
 ls packages/swapper/src/swappers/
-```
+```bash

187-203: Add language specifier to fenced code block.

The tree/directory structure code block at line 187 lacks a language identifier. While optional for tree output, specifying a language (e.g., tree, text, or bash) maintains markdown linting compliance and consistency.

Apply this diff:

-```
+```tree
 [SwapperName]Swapper/
 ├── index.ts
 ├── [SwapperName]Swapper.ts
 ├── endpoints.ts
 ├── types.ts
 ├── get[SwapperName]TradeQuote/
 │   └── get[SwapperName]TradeQuote.ts
 ├── get[SwapperName]TradeRate/
 │   └── get[SwapperName]TradeRate.ts
 └── utils/
     ├── constants.ts
     ├── [swapperName]Service.ts
     ├── fetchFrom[SwapperName].ts
     └── helpers/
         └── helpers.ts
-```
+```tree

40-40: Clarify environment file naming and placement.

The guidance references .env.base in Phase 1 (line 40), but Phase 3 shows .env and .env.development (lines 303–308) without clarifying the distinction. This inconsistency may confuse implementers about where to place API keys and feature flags.

Clarify by adding a note early in Phase 3 explaining the env file hierarchy:

 **Environment variables** - Follow naming conventions (e.g., Bebop):
 
+**Note**: The `.env.base` file is the template for base configuration (shared across all environments). Individual environment overrides are handled via `.env` (production) and `.env.development`.
+
 **`.env`** (base/production - both API key and feature flag OFF):

Alternatively, update line 40 in Phase 1 to say:

-   - **If API key needed**: Obtain production API key to add to `.env.base`
+   - **If API key needed**: Obtain production API key (will be added to `.env` and `.env.development`)

Also applies to: 303-308

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b09a126 and d006044.

📒 Files selected for processing (1)
  • .claude/skills/swapper-integration/SKILL.md (1 hunks)
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10569
File: src/plugins/walletConnectToDapps/components/WalletConnectSigningModal/WalletConnectModalSigningFooter.tsx:121-129
Timestamp: 2025-09-17T22:40:30.149Z
Learning: gomesalexandre maintains strict scope discipline even for style/UI PRs in shapeshift/web, declining functionally correct UX improvements (like keeping Cancel button enabled during gas simulation loading) when they fall outside the PR's stated styling objectives, demonstrating his consistent pattern of deferring valid but tangential improvements to separate efforts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/{constants,types}.ts : Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Include comments explaining swap logic in swapper implementation files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/**/*.@(test|spec).ts : Write unit tests for swapper methods and API endpoints.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Ensure adherence to Swapper and SwapperApi interfaces in code review.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/**/*.ts : Use TypeScript with explicit types (e.g., SupportedChainIds) in all swapper-related files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS use TradeQuoteError enum for error codes in swapper errors
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Validate inputs and log errors for debugging in swapper implementations.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10458
File: src/plugins/walletConnectToDapps/types.ts:7-7
Timestamp: 2025-09-10T15:34:29.604Z
Learning: gomesalexandre is comfortable relying on transitive dependencies (like abitype through ethers/viem) rather than explicitly declaring them in package.json, preferring to avoid package.json bloat when the transitive dependency approach works reliably in practice.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/config.ts:127-128
Timestamp: 2025-08-07T11:20:44.614Z
Learning: gomesalexandre prefers required environment variables without default values in the config file (src/config.ts). They want explicit configuration and fail-fast behavior when environment variables are missing, rather than having fallback defaults.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/modals/ContractInteractionBreakdown.tsx:0-0
Timestamp: 2025-09-13T16:45:18.813Z
Learning: gomesalexandre prefers aggressively deleting unused/obsolete code files ("ramboing") rather than fixing technical issues in code that won't be used, demonstrating his preference for keeping codebases clean and PR scope focused.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10503
File: .env:56-56
Timestamp: 2025-09-16T13:17:02.938Z
Learning: gomesalexandre prefers to enable feature flags globally in the base .env file when the intent is to activate features everywhere, even when there are known issues like crashes, demonstrating his preference for intentional global feature rollouts over cautious per-environment enablement.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10249
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:447-503
Timestamp: 2025-08-13T17:07:10.763Z
Learning: gomesalexandre prefers relying on TypeScript's type system for validation rather than adding defensive runtime null checks when types are properly defined. They favor a TypeScript-first approach over defensive programming with runtime validations.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/hooks/useActionCenterSubscribers/useThorchainLpDepositActionSubscriber.tsx:61-66
Timestamp: 2025-08-14T17:51:47.556Z
Learning: gomesalexandre is not concerned about structured logging and prefers to keep console.error usage as-is rather than implementing structured logging patterns, even when project guidelines suggest otherwise.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10413
File: src/components/Modals/FiatRamps/fiatRampProviders/onramper/utils.ts:29-55
Timestamp: 2025-09-02T14:26:19.028Z
Learning: gomesalexandre prefers to keep preparatory/reference code simple until it's actively consumed, rather than implementing comprehensive error handling, validation, and robustness improvements upfront. They prefer to add these improvements when the code is actually being used in production.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:396-402
Timestamp: 2025-08-14T17:55:57.490Z
Learning: gomesalexandre is comfortable with functions/variables that return undefined or true (tri-state) when only the truthy case matters, preferring to rely on JavaScript's truthy/falsy behavior rather than explicitly returning boolean values.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10783
File: src/context/ModalStackProvider/useModalRegistration.ts:30-41
Timestamp: 2025-10-16T11:14:40.657Z
Learning: gomesalexandre prefers to add lint rules (like typescript-eslint/strict-boolean-expressions for truthiness checks on numbers) to catch common issues project-wide rather than relying on code review to catch them.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/lib/moralis.ts:47-85
Timestamp: 2025-08-07T11:22:16.983Z
Learning: gomesalexandre prefers console.error over structured logging for Moralis API integration debugging, as they find it more conventional and prefer to examine XHR requests directly rather than rely on structured logs for troubleshooting.
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Include comments explaining swap logic in swapper implementation files.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Ensure adherence to Swapper and SwapperApi interfaces in code review.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,utils/*.ts} : Each swapper must be implemented in its own directory under packages/swapper/src/swappers/<SwapperName>/ with the following files: <SwapperName>.ts, endpoints.ts, utils/constants.ts, utils/helpers.ts, types.ts.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/{constants,types}.ts : Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/**/*.@(test|spec).ts : Write unit tests for swapper methods and API endpoints.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
📚 Learning: 2025-08-03T22:09:37.542Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-08-03T22:09:37.542Z
Learning: Applies to **/swapper/**/*.{ts,tsx} : ALWAYS provide detailed error information in swapper errors

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Validate inputs and log errors for debugging in swapper implementations.

Applied to files:

  • .claude/skills/swapper-integration/SKILL.md
🪛 LanguageTool
.claude/skills/swapper-integration/SKILL.md

[uncategorized] ~41-~41: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...tion API key to add to .env.base - Rate limiting details 2. Supported Networks -...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🪛 markdownlint-cli2 (0.18.1)
.claude/skills/swapper-integration/SKILL.md

151-151: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


187-187: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install and Cache
🔇 Additional comments (1)
.claude/skills/swapper-integration/SKILL.md (1)

389-406: Key Principles and Success Criteria are well-defined.

The documentation clearly articulates the integration workflow, from research through testing to documentation. The success criteria (lines 400–406) provide a concrete checklist for developers.

Copy link
Collaborator

@premiumjibles premiumjibles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 🤌 . Bebop looks like a great option, particularly for people looking for lowest gas

Few minor non blocking sanity checks but overall happy with this

Replace hardcoded API key with placeholder in 5 locations:
- Authentication example
- 3 curl test commands
- Configuration comment

Added note for Claude Code sessions to find actual key in .env files.
API key was already in git history and .env, but good practice
to use placeholders in documentation going forward.

Addresses CodeRabbit security warning.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gomesalexandre gomesalexandre enabled auto-merge (squash) November 5, 2025 23:28
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md (2)

52-52: Consider using heading syntax for section headers.

Lines 52 and 58 use emphasis (**text**) to introduce subsections (PMMv3, JAMv2), but these would be more structurally consistent as level 4 headings (####). This improves markdown semantics and tooling compatibility.

-**PMMv3 (Private Market Maker)**
+#### PMMv3 (Private Market Maker)
-**JAMv2 (Just-in-time Aggregation Model)**
+#### JAMv2 (Just-in-time Aggregation Model)

Also applies to: 58-58


196-210: Add language identifier to fenced code block.

Line 196 contains a fenced code block without a language specifier. While this renders correctly, adding text or tree clarifies intent for markdown linters and syntax highlighting tools.

-\```
+\```text
 packages/swapper/src/swappers/BebopSwapper/
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d006044 and 906b678.

📒 Files selected for processing (1)
  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
packages/swapper/src/swappers/**/*

📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)

Avoid placing swapper files outside packages/swapper/src/swappers/.

Files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
**/*

📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)

**/*: ALWAYS use appropriate file extensions
Flag files without kebab-case

Files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
🧠 Learnings (21)
📓 Common learnings
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10569
File: src/plugins/walletConnectToDapps/components/WalletConnectSigningModal/WalletConnectModalSigningFooter.tsx:121-129
Timestamp: 2025-09-17T22:40:30.149Z
Learning: gomesalexandre maintains strict scope discipline even for style/UI PRs in shapeshift/web, declining functionally correct UX improvements (like keeping Cancel button enabled during gas simulation loading) when they fall outside the PR's stated styling objectives, demonstrating his consistent pattern of deferring valid but tangential improvements to separate efforts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Include comments explaining swap logic in swapper implementation files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/{constants,types}.ts : Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Ensure adherence to Swapper and SwapperApi interfaces in code review.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/**/*.@(test|spec).ts : Write unit tests for swapper methods and API endpoints.
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10458
File: src/plugins/walletConnectToDapps/types.ts:7-7
Timestamp: 2025-09-10T15:34:29.604Z
Learning: gomesalexandre is comfortable relying on transitive dependencies (like abitype through ethers/viem) rather than explicitly declaring them in package.json, preferring to avoid package.json bloat when the transitive dependency approach works reliably in practice.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/config.ts:127-128
Timestamp: 2025-08-07T11:20:44.614Z
Learning: gomesalexandre prefers required environment variables without default values in the config file (src/config.ts). They want explicit configuration and fail-fast behavior when environment variables are missing, rather than having fallback defaults.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/modals/ContractInteractionBreakdown.tsx:0-0
Timestamp: 2025-09-13T16:45:18.813Z
Learning: gomesalexandre prefers aggressively deleting unused/obsolete code files ("ramboing") rather than fixing technical issues in code that won't be used, demonstrating his preference for keeping codebases clean and PR scope focused.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10503
File: .env:56-56
Timestamp: 2025-09-16T13:17:02.938Z
Learning: gomesalexandre prefers to enable feature flags globally in the base .env file when the intent is to activate features everywhere, even when there are known issues like crashes, demonstrating his preference for intentional global feature rollouts over cautious per-environment enablement.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10249
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:447-503
Timestamp: 2025-08-13T17:07:10.763Z
Learning: gomesalexandre prefers relying on TypeScript's type system for validation rather than adding defensive runtime null checks when types are properly defined. They favor a TypeScript-first approach over defensive programming with runtime validations.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/hooks/useActionCenterSubscribers/useThorchainLpDepositActionSubscriber.tsx:61-66
Timestamp: 2025-08-14T17:51:47.556Z
Learning: gomesalexandre is not concerned about structured logging and prefers to keep console.error usage as-is rather than implementing structured logging patterns, even when project guidelines suggest otherwise.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10413
File: src/components/Modals/FiatRamps/fiatRampProviders/onramper/utils.ts:29-55
Timestamp: 2025-09-02T14:26:19.028Z
Learning: gomesalexandre prefers to keep preparatory/reference code simple until it's actively consumed, rather than implementing comprehensive error handling, validation, and robustness improvements upfront. They prefer to add these improvements when the code is actually being used in production.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:396-402
Timestamp: 2025-08-14T17:55:57.490Z
Learning: gomesalexandre is comfortable with functions/variables that return undefined or true (tri-state) when only the truthy case matters, preferring to rely on JavaScript's truthy/falsy behavior rather than explicitly returning boolean values.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10783
File: src/context/ModalStackProvider/useModalRegistration.ts:30-41
Timestamp: 2025-10-16T11:14:40.657Z
Learning: gomesalexandre prefers to add lint rules (like typescript-eslint/strict-boolean-expressions for truthiness checks on numbers) to catch common issues project-wide rather than relying on code review to catch them.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/lib/moralis.ts:47-85
Timestamp: 2025-08-07T11:22:16.983Z
Learning: gomesalexandre prefers console.error over structured logging for Moralis API integration debugging, as they find it more conventional and prefer to examine XHR requests directly rather than rely on structured logs for troubleshooting.
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Include comments explaining swap logic in swapper implementation files.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Ensure adherence to Swapper and SwapperApi interfaces in code review.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Leverage shared utilities (e.g., executeEvmTransaction, checkEvmSwapStatus) in swapper implementations when applicable.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/{constants,types}.ts : Register new swappers in packages/swapper/src/constants.ts and add them to the SwapperName enum in packages/swapper/src/types.ts.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : All swappers must conform to the Swapper and SwapperApi interfaces defined in packages/swapper/src/types.ts.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/**/*.ts : Use TypeScript with explicit types (e.g., SupportedChainIds) in all swapper-related files.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Verify chain ID filtering in filterAssetIdsBySellable and filterBuyAssetsBySellAssetId methods.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/**/*.@(test|spec).ts : Write unit tests for swapper methods and API endpoints.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,utils/*.ts} : Each swapper must be implemented in its own directory under packages/swapper/src/swappers/<SwapperName>/ with the following files: <SwapperName>.ts, endpoints.ts, utils/constants.ts, utils/helpers.ts, types.ts.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-08-07T11:17:09.291Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: .env:113-114
Timestamp: 2025-08-07T11:17:09.291Z
Learning: In the shapeshift/web project, storing API keys directly in the .env file (including production keys) is an intentional design decision. The team is aware of potential abuse but chooses this approach for their API key management. This should not be flagged as a security concern in future reviews.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-08-08T15:00:22.321Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10231
File: src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokens.tsx:14-14
Timestamp: 2025-08-08T15:00:22.321Z
Learning: In shapeshift/web reviews for NeOMakinG, avoid nitpicks to change deep-relative imports to '@/…' alias paths within feature/non-refactor PRs; defer such style-only changes to a dedicated follow-up refactor unless they fix an issue.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-09-12T13:15:41.265Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/utils/tenderly/index.ts:229-244
Timestamp: 2025-09-12T13:15:41.265Z
Learning: gomesalexandre is comfortable with exposing API keys client-side during development phases for WalletConnect/Tenderly integration, dismissing security concerns with "she fine" when the implementation is preparatory or non-production.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-09-12T13:26:26.277Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/utils/tenderly/index.ts:0-0
Timestamp: 2025-09-12T13:26:26.277Z
Learning: gomesalexandre uses "we do that errwhere ser" (everywhere, sir) to indicate that client-side API key exposure is an accepted codebase-wide pattern, consistent with his comfort level for development/preparatory phases across the WalletConnect/Tenderly integration.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-08-08T15:00:49.887Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10231
File: src/components/AssetSearch/components/AssetList.tsx:2-2
Timestamp: 2025-08-08T15:00:49.887Z
Learning: Project shapeshift/web: NeOMakinG prefers avoiding minor a11y/UI nitpicks (e.g., adding aria-hidden to decorative icons in empty states like src/components/AssetSearch/components/AssetList.tsx) within feature PRs; defer such suggestions to a follow-up instead of blocking the PR.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-07-29T10:22:27.037Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10136
File: src/lib/asset-service/service/encodedRelatedAssetIndex.json:1-1
Timestamp: 2025-07-29T10:22:27.037Z
Learning: PRs with titles starting with "feat: regenerate asset data" are routine daily asset updates that don't need detailed code analysis. Users prefer to skip automated reviews for these maintenance PRs using coderabbitai ignore.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-09-12T11:56:19.437Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/utils/tenderly/index.ts:0-0
Timestamp: 2025-09-12T11:56:19.437Z
Learning: gomesalexandre rejected verbose try/catch error handling for address validation in Tenderly integration (PR #10461), calling the approach "ugly" but still implemented safety measures in commit ad7e424b89, preferring cleaner safety implementations over defensive programming patterns.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-09-13T16:45:17.166Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/WalletConnectSigningModal/StructuredMessage/StructuredMessage.tsx:0-0
Timestamp: 2025-09-13T16:45:17.166Z
Learning: gomesalexandre appreciates safety-focused suggestions for UI rendering in WalletConnect components, specifically defensive programming approaches that prevent null/undefined values from displaying as literal "null"/"undefined" strings in the user interface.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-09-02T08:34:08.157Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10380
File: src/pages/Dashboard/components/AccountList/AccountTable.tsx:60-0
Timestamp: 2025-09-02T08:34:08.157Z
Learning: NeOMakinG prefers code review comments to focus only on actual PR changes, not pre-existing code issues, unless there are critical security or correctness concerns directly related to the new functionality.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
📚 Learning: 2025-09-17T22:40:30.149Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10569
File: src/plugins/walletConnectToDapps/components/WalletConnectSigningModal/WalletConnectModalSigningFooter.tsx:121-129
Timestamp: 2025-09-17T22:40:30.149Z
Learning: gomesalexandre maintains strict scope discipline even for style/UI PRs in shapeshift/web, declining functionally correct UX improvements (like keeping Cancel button enabled during gas simulation loading) when they fall outside the PR's stated styling objectives, demonstrating his consistent pattern of deferring valid but tangential improvements to separate efforts.

Applied to files:

  • packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md
🪛 LanguageTool
packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md

[uncategorized] ~345-~345: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...- [x] Native ETH vs WETH behavior - [x] Rate limiting assessment - [x] Minimum trade amount v...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🪛 markdownlint-cli2 (0.18.1)
packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md

52-52: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


196-196: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Call / Static
🔇 Additional comments (1)
packages/swapper/src/swappers/BebopSwapper/INTEGRATION.md (1)

1-416: Comprehensive integration documentation—well structured and thorough.

This documentation provides excellent technical grounding for the Bebop swapper implementation: dual-route system analysis, mandatory checksumming requirements, response schemas, phased rollout plan, and code pattern examples. The mapping to existing swappers (Zrx, CowSwap) will help maintainers align new code with established conventions. API key placeholders are properly masked, and the testing checklist is complete.

@gomesalexandre gomesalexandre merged commit ea373d2 into develop Nov 6, 2025
4 checks passed
@gomesalexandre gomesalexandre deleted the feat_bebop_new_swapper_who_dis branch November 6, 2025 00:22
gomesalexandre added a commit that referenced this pull request Dec 2, 2025
…and implementation guide

This update transforms the swapper-integration skill from basic guidance into a comprehensive, production-ready integration framework based on analysis of 3 major swapper PRs (Bebop, NEAR Intents, Cetus) and deep understanding of the swapper abstraction.

## Major Enhancements

### Phase 0: Proactive Research (NEW)
- Use WebFetch/WebSearch to research swapper APIs BEFORE asking user
- Automatically find documentation, chain support, existing integrations
- Only ask user for what can't be found online

### Expanded allowed-tools
- Added WebFetch, WebSearch for autonomous research
- Added AskUserQuestion for structured multi-question prompts
- Added gh pr:* for PR research

### Deep Swapper Categorization
- EVM Direct Transaction (Bebop, 0x, Portals)
- Deposit-to-Address (Chainflip, NEAR Intents, THORChain)
- Gasless Order-Based (CowSwap)
- Solana-Only (Jupiter)
- Chain-Specific (Cetus/Sui, Tron, etc.)

### Complete Implementation Guide
- Step-by-step file creation order (10 files)
- Full code templates for each file with actual TypeScript
- Detailed explanations of monadic error handling
- HTTP service factory with caching pattern
- Rate calculation strategies

### Swapper-Specific Metadata Deep Dive
- When to use vs when to skip
- THREE places to wire (types, quote, TWO extraction points)
- Critical: Both useTradeButtonProps AND tradeExecution.ts
- Example flows from NEAR Intents

### Registration Checklist (9 steps)
- SwapperConfig types
- Constants registration
- CSP headers with examples
- Feature flags (3 files)
- UI icon integration
- Environment variables (.env patterns)
- Test mocks

### Proactive Gotcha Prevention
- 10 critical bugs to check BEFORE testing
- Based on real issues from Bebop/NEAR Intents/Cetus PRs
- Slippage format, checksumming, hex conversion, response parsing

### Testing Framework
- Automated checks (type-check, lint, build)
- 11-point manual testing checklist
- 6-point edge case testing
- Rate vs quote delta verification

### Common Errors & Solutions
- 8 common error messages with exact fixes
- Direct mapping from error → solution
- Based on actual PR comments and fixes

## Key Insights from PR Analysis

### From Bebop PR (#11000)
- Dual routing with partial failure handling
- Affiliate fee delta issues (rate vs quote)
- Hex → decimal conversion patterns
- Address checksumming requirements

### From NEAR Intents PR (#11016)
- Deposit-to-address metadata flow
- Status polling with swap metadata
- Cross-chain EVM/UTXO/Solana handling
- OneClick SDK integration patterns

### From Cetus PR (#11240)
- Sui chain-specific adaptations
- Non-EVM transaction metadata
- Chain adapter fee estimation
- Token vs coin namespace handling

## Skill Quality Improvements

- 1500+ lines of comprehensive guidance (3x expansion)
- Code templates with actual imports and types
- File structure with exact locations
- Integration checklist (28 items)
- Three-phase workflow (Research → Implement → Test)

## Technical Depth

- Monadic Result<T, SwapErrorRight> pattern explained
- HTTP service with caching (createCache, makeSwapperAxiosServiceMonadic)
- Chain adapter usage for fee estimation
- Native token marker handling
- TradeQuote vs TradeRate differences
- accountNumber: undefined requirement for rates

## Documentation Template

- Complete INTEGRATION.md structure
- API details section
- Implementation notes with code
- Known gotchas documentation
- Testing strategies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
gomesalexandre added a commit that referenced this pull request Dec 2, 2025
…and implementation guide

This update transforms the swapper-integration skill from basic guidance into a comprehensive, production-ready integration framework based on analysis of 3 major swapper PRs (Bebop, NEAR Intents, Cetus) and deep understanding of the swapper abstraction.

## Major Enhancements

### Phase 0: Proactive Research (NEW)
- Use WebFetch/WebSearch to research swapper APIs BEFORE asking user
- Automatically find documentation, chain support, existing integrations
- Only ask user for what can't be found online

### Expanded allowed-tools
- Added WebFetch, WebSearch for autonomous research
- Added AskUserQuestion for structured multi-question prompts
- Added gh pr:* for PR research

### Deep Swapper Categorization
- EVM Direct Transaction (Bebop, 0x, Portals)
- Deposit-to-Address (Chainflip, NEAR Intents, THORChain)
- Gasless Order-Based (CowSwap)
- Solana-Only (Jupiter)
- Chain-Specific (Cetus/Sui, Tron, etc.)

### Complete Implementation Guide
- Step-by-step file creation order (10 files)
- Full code templates for each file with actual TypeScript
- Detailed explanations of monadic error handling
- HTTP service factory with caching pattern
- Rate calculation strategies

### Swapper-Specific Metadata Deep Dive
- When to use vs when to skip
- THREE places to wire (types, quote, TWO extraction points)
- Critical: Both useTradeButtonProps AND tradeExecution.ts
- Example flows from NEAR Intents

### Registration Checklist (9 steps)
- SwapperConfig types
- Constants registration
- CSP headers with examples
- Feature flags (3 files)
- UI icon integration
- Environment variables (.env patterns)
- Test mocks

### Proactive Gotcha Prevention
- 10 critical bugs to check BEFORE testing
- Based on real issues from Bebop/NEAR Intents/Cetus PRs
- Slippage format, checksumming, hex conversion, response parsing

### Testing Framework
- Automated checks (type-check, lint, build)
- 11-point manual testing checklist
- 6-point edge case testing
- Rate vs quote delta verification

### Common Errors & Solutions
- 8 common error messages with exact fixes
- Direct mapping from error → solution
- Based on actual PR comments and fixes

## Key Insights from PR Analysis

### From Bebop PR (#11000)
- Dual routing with partial failure handling
- Affiliate fee delta issues (rate vs quote)
- Hex → decimal conversion patterns
- Address checksumming requirements

### From NEAR Intents PR (#11016)
- Deposit-to-address metadata flow
- Status polling with swap metadata
- Cross-chain EVM/UTXO/Solana handling
- OneClick SDK integration patterns

### From Cetus PR (#11240)
- Sui chain-specific adaptations
- Non-EVM transaction metadata
- Chain adapter fee estimation
- Token vs coin namespace handling

## Skill Quality Improvements

- 1500+ lines of comprehensive guidance (3x expansion)
- Code templates with actual imports and types
- File structure with exact locations
- Integration checklist (28 items)
- Three-phase workflow (Research → Implement → Test)

## Technical Depth

- Monadic Result<T, SwapErrorRight> pattern explained
- HTTP service with caching (createCache, makeSwapperAxiosServiceMonadic)
- Chain adapter usage for fee estimation
- Native token marker handling
- TradeQuote vs TradeRate differences
- accountNumber: undefined requirement for rates

## Documentation Template

- Complete INTEGRATION.md structure
- API details section
- Implementation notes with code
- Known gotchas documentation
- Testing strategies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
0xApotheosis pushed a commit that referenced this pull request Dec 3, 2025
* feat: display current nonce in WalletConnect transaction advanced parameters

Fetches and displays the current/next nonce for the account in the advanced parameters section instead of showing "Nonce..." placeholder text. Users can now see what nonce will be automatically used if they don't set a custom one.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: massively enhance swapper-integration skill with deep research and implementation guide

This update transforms the swapper-integration skill from basic guidance into a comprehensive, production-ready integration framework based on analysis of 3 major swapper PRs (Bebop, NEAR Intents, Cetus) and deep understanding of the swapper abstraction.

## Major Enhancements

### Phase 0: Proactive Research (NEW)
- Use WebFetch/WebSearch to research swapper APIs BEFORE asking user
- Automatically find documentation, chain support, existing integrations
- Only ask user for what can't be found online

### Expanded allowed-tools
- Added WebFetch, WebSearch for autonomous research
- Added AskUserQuestion for structured multi-question prompts
- Added gh pr:* for PR research

### Deep Swapper Categorization
- EVM Direct Transaction (Bebop, 0x, Portals)
- Deposit-to-Address (Chainflip, NEAR Intents, THORChain)
- Gasless Order-Based (CowSwap)
- Solana-Only (Jupiter)
- Chain-Specific (Cetus/Sui, Tron, etc.)

### Complete Implementation Guide
- Step-by-step file creation order (10 files)
- Full code templates for each file with actual TypeScript
- Detailed explanations of monadic error handling
- HTTP service factory with caching pattern
- Rate calculation strategies

### Swapper-Specific Metadata Deep Dive
- When to use vs when to skip
- THREE places to wire (types, quote, TWO extraction points)
- Critical: Both useTradeButtonProps AND tradeExecution.ts
- Example flows from NEAR Intents

### Registration Checklist (9 steps)
- SwapperConfig types
- Constants registration
- CSP headers with examples
- Feature flags (3 files)
- UI icon integration
- Environment variables (.env patterns)
- Test mocks

### Proactive Gotcha Prevention
- 10 critical bugs to check BEFORE testing
- Based on real issues from Bebop/NEAR Intents/Cetus PRs
- Slippage format, checksumming, hex conversion, response parsing

### Testing Framework
- Automated checks (type-check, lint, build)
- 11-point manual testing checklist
- 6-point edge case testing
- Rate vs quote delta verification

### Common Errors & Solutions
- 8 common error messages with exact fixes
- Direct mapping from error → solution
- Based on actual PR comments and fixes

## Key Insights from PR Analysis

### From Bebop PR (#11000)
- Dual routing with partial failure handling
- Affiliate fee delta issues (rate vs quote)
- Hex → decimal conversion patterns
- Address checksumming requirements

### From NEAR Intents PR (#11016)
- Deposit-to-address metadata flow
- Status polling with swap metadata
- Cross-chain EVM/UTXO/Solana handling
- OneClick SDK integration patterns

### From Cetus PR (#11240)
- Sui chain-specific adaptations
- Non-EVM transaction metadata
- Chain adapter fee estimation
- Token vs coin namespace handling

## Skill Quality Improvements

- 1500+ lines of comprehensive guidance (3x expansion)
- Code templates with actual imports and types
- File structure with exact locations
- Integration checklist (28 items)
- Three-phase workflow (Research → Implement → Test)

## Technical Depth

- Monadic Result<T, SwapErrorRight> pattern explained
- HTTP service with caching (createCache, makeSwapperAxiosServiceMonadic)
- Chain adapter usage for fee estimation
- Native token marker handling
- TradeQuote vs TradeRate differences
- accountNumber: undefined requirement for rates

## Documentation Template

- Complete INTEGRATION.md structure
- API details section
- Implementation notes with code
- Known gotchas documentation
- Testing strategies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: reverts

* fix: remove references to missing companion files

Remove references to @reference.md, @common-gotchas.md, @examples.md
that don't exist. The skill already contains all needed information inline.

Addresses CodeRabbit review feedback.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: remove all companion file references

Remove all references to non-existent @reference.md, @common-gotchas.md,
and @examples.md files. The skill contains all needed information inline.

Addresses CodeRabbit critical feedback.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: address CodeRabbit feedback on swapper skill

Updates swapper integration skill to address CodeRabbit review comments:

Feature flag pattern fixes:
- Replace placeholder [SwapperName]Swap with actual example (BebopSwap)
- Update getEnabledSwappers to show direct flag destructuring pattern
- Fix isCrossAccountTradeSupported to use enum values not placeholders
- Align all examples with actual codebase implementation

Markdown formatting improvements:
- Convert 8 bold emphasis sections to proper headings (#### and ###)
- Add language specifiers to 4 code blocks (text, markdown)
- Fix heading structure for better lint compliance

These changes improve accuracy and ensure the skill matches the actual
patterns used in the ShapeShift codebase.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
@coderabbitai coderabbitai bot mentioned this pull request Dec 3, 2025
1 task
@coderabbitai coderabbitai bot mentioned this pull request Dec 17, 2025
23 tasks
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.

Bebop - Rates PoC/spike

3 participants