feat: integrate sei evm chain and debridge swapper (cross-chain + same-chain)#11941
feat: integrate sei evm chain and debridge swapper (cross-chain + same-chain)#11941gomesalexandre merged 34 commits intodevelopfrom
Conversation
Add Sei EVM chain support including: - CAIP identifiers (seiChainId, seiAssetId) - HDWallet support flags across all wallet implementations - Chain adapter (SeiChainAdapter extending EvmBaseAdapter) - Viem client and ethers provider configuration - Feature flag (VITE_FEATURE_SEI) with dev-only enablement - Plugin registration and wallet support hooks - CoinGecko adapter with sei-v2 platform mapping - Zerion chain mapping - Relay swapper chain mapping - CSP headers for RPC endpoint - Asset generation scripts - Market/portfolio/opportunities integration - Popular assets discoverability Part of #11902
Implement the core deBridge DLN protocol swapper for cross-chain bridging. Supports 12 EVM chains including SEI, Ethereum, Arbitrum, Base, Polygon, Avalanche, BSC, Optimism, Gnosis, Monad, HyperEVM, and Plasma. Includes API types, chain ID mapping, trade quote/rate builders, two-phase status tracking (source tx -> orderId -> order status), and EVM transaction construction following AcrossSwapper patterns. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add SwapperName.Debridge enum, debridgeTransactionMetadata to TradeQuoteStep and SwapperSpecificMetadata, VITE_DEBRIDGE_API_URL to SwapperConfig, register swapper in constants map, wire slippage and auto-slippage support, and add export. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Wire VITE_FEATURE_DEBRIDGE_SWAP and VITE_DEBRIDGE_API_URL through config validation, Redux preferences slice, swapper enablement logic, and test mocks. Enabled in development, disabled in production. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Allow connect-src for dln.debridge.finance and stats-api.dln.trade to enable API calls to the deBridge DLN protocol. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add deBridge icon SVG, register in SwapperIcon component switch, and wire debridgeTransactionMetadata in swap metadata for trade execution tracking. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds Sei (a second-class EVM chain) and a Debridge cross-chain swapper. Changes span environment/config, CSPs, CAIP/types, EVM adapters/clients, HDWallet capability flags, asset data/scripts, Debridge swapper implementation (API, utils, types, endpoints), UI wiring, plugin registration, and feature-flag gating. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as Client(UI)
participant Swapper as DebridgeSwapper
participant DebridgeAPI as Debridge API
participant Adapter as EVM Adapter / Viem
participant Blockchain as Sei Node
UI->>Swapper: request getUnsignedEvmTransaction(quote, from, stepIndex)
Swapper->>DebridgeAPI: GET/POST create-tx or single-chain endpoint (VITE_DEBRIDGE_API_URL)
DebridgeAPI-->>Swapper: tx metadata + gas hints
Swapper->>Adapter: assertGetEvmChainAdapter -> getFeeData / build custom tx
Adapter->>Blockchain: on-chain fee estimation / chain data
Blockchain-->>Adapter: gas/fee data
Adapter-->>Swapper: unsigned EVM tx (with EIP-1559 fields if supported)
Swapper-->>UI: unsigned transaction + metadata
sequenceDiagram
participant Poller as UI / Background
participant Swapper as DebridgeSwapper
participant Adapter as EVM Adapter
participant DebridgeStats as Debridge Stats API
Poller->>Swapper: checkTradeStatus(txHash, chainId, address, swap)
Swapper->>Adapter: checkEvmSwapStatus(txHash) (same-chain source)
Adapter-->>Swapper: receipt / on-chain status
alt cross-chain & on-chain step done
Swapper->>DebridgeStats: query order IDs / order status
DebridgeStats-->>Swapper: order status (Created/Fulfilled/Cancelled)
Swapper-->>Poller: mapped TxStatus (Pending/Confirmed/Failed) + messages
else unable to map
Swapper-->>Poller: Unknown / Pending
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
d47e273 to
4267156
Compare
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (7)
src/plugins/activePlugins.ts (1)
61-62: Minor:seiandscrollare swapped relative to alphabetical order
scrollsorts beforesei(comparing'c'<'e'), but the array has them reversed. The imports (lines 25–26) are already in the correct order.♻️ Proposed fix
- sei, scroll, + sei,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/plugins/activePlugins.ts` around lines 61 - 62, The array of plugin identifiers in activePlugins.ts has 'sei' and 'scroll' out of alphabetical order; swap their positions so 'scroll' comes before 'sei' to match the import order and alphabetical sorting rule — update the list where the identifiers appear (the array containing sei and scroll) so it reads scroll, sei.src/plugins/sei/index.tsx (1)
22-36:fromAssetIdcalled twice per asset — once infilter, once inmap.Each asset calls
fromAssetIdin the filter (line 26) and again in the map (line 31) to extractassetReference. A single pass (e.g.,reduceorflatMap) would avoid the redundant parse.♻️ Suggested single-pass approach
- return assetService.assets - .filter(asset => { - const { chainId, assetNamespace } = fromAssetId(asset.assetId) - return chainId === seiChainId && assetNamespace === 'erc20' - }) - .map(asset => ({ - assetId: asset.assetId, - contractAddress: fromAssetId(asset.assetId).assetReference, - symbol: asset.symbol, - name: asset.name, - precision: asset.precision, - })) + return assetService.assets.reduce<Array<{ assetId: string; contractAddress: string; symbol: string; name: string; precision: number }>>((acc, asset) => { + const { chainId, assetNamespace, assetReference } = fromAssetId(asset.assetId) + if (chainId === seiChainId && assetNamespace === 'erc20') { + acc.push({ + assetId: asset.assetId, + contractAddress: assetReference, + symbol: asset.symbol, + name: asset.name, + precision: asset.precision, + }) + } + return acc + }, [])🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/plugins/sei/index.tsx` around lines 22 - 36, getKnownTokens calls fromAssetId twice per asset (once in the filter and again in the map); update getKnownTokens to call fromAssetId only once per asset by performing a single pass: iterate assetService.assets and for each asset call fromAssetId(asset.assetId) once, check chainId/assetNamespace on the parsed result, and if it matches push/return the object using parsed.assetReference for contractAddress (preserve symbol/name/precision). This can be implemented with a single reduce/map that stores the parsed result per asset and avoids the duplicate fromAssetId calls.packages/swapper/src/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.ts (1)
12-30: MissingcodeinmakeSwapErrorRight— useTradeQuoteErrorenum.Both validation error paths omit the
codeproperty. As per coding guidelines, swapper errors should always include aTradeQuoteErrorenum code for internationalization and structured error handling.♻️ Add error codes
Err( makeSwapErrorRight({ message: 'sendAddress is required', + code: TradeQuoteError.InternalError, }), ),Err( makeSwapErrorRight({ message: 'receiveAddress is required', + code: TradeQuoteError.InternalError, }), ),As per coding guidelines:
ALWAYS use makeSwapErrorRight for swapper errors with TradeQuoteError enum for error codes and provide detailed error information.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/swapper/src/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.ts` around lines 12 - 30, The validation branches returning Err(...) for missing addresses must include a TradeQuoteError code; update both checks (the sendAddress and receiveAddress guards in getTradeQuote) to call makeSwapErrorRight with a code property set to the appropriate enum value (e.g., TradeQuoteError.MissingSendAddress and TradeQuoteError.MissingReceiveAddress) alongside the message so the returned error uses the TradeQuoteError enum for structured handling.packages/swapper/src/swappers/DebridgeSwapper/utils/getTrade.ts (1)
138-146: RedundantbuyDebridgeChainIdvalidation — already checked at lines 78–87.The early-exit block at lines 78–87 already returns
Err(UnsupportedChain)whenchainIdToDebridgeChainId[buyAsset.chainId]isundefined(for the cross-chain path). Lines 138–146 repeat the same check, which can never fail at that point. This is dead code that adds noise.♻️ Suggested simplification
- const buyDebridgeChainId = chainIdToDebridgeChainId[buyAsset.chainId] - if (buyDebridgeChainId === undefined) { - return Err( - makeSwapErrorRight({ - message: `Buy asset chain '${buyAsset.chainId}' not supported by deBridge`, - code: TradeQuoteError.UnsupportedChain, - }), - ) - } + // buyDebridgeChainId was already validated above (lines 78–87) + const buyDebridgeChainId = chainIdToDebridgeChainId[buyAsset.chainId]!🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/swapper/src/swappers/DebridgeSwapper/utils/getTrade.ts` around lines 138 - 146, The second validation of buyDebridgeChainId is redundant because chainIdToDebridgeChainId[buyAsset.chainId] was already checked and early-returned with Err(UnsupportedChain) for the cross-chain path earlier in getTrade; remove the dead block that re-checks buyDebridgeChainId (the const buyDebridgeChainId = ... and the subsequent if returning Err) so the function does not duplicate the UnsupportedChain guard and to keep logic concise.packages/swapper/src/swappers/DebridgeSwapper/endpoints.ts (1)
144-144: Reassigning the destructuredtxHashparameter — prefer a newconst.Line 144 rebinds the destructured parameter
txHash, which violates the "avoidletassignments — preferconst" guideline. The mutation also makes it harder to trace which hash is being used at each point in the function.♻️ Proposed fix
- txHash = sourceTxStatus.buyTxHash ?? txHash + const resolvedTxHash = sourceTxStatus.buyTxHash ?? txHash const maybeOrderIdsResponse = await debridgeService.get<DebridgeOrderIdsResponse>( - `${DEBRIDGE_STATS_API_URL}/api/Transaction/${txHash}/orderIds`, + `${DEBRIDGE_STATS_API_URL}/api/Transaction/${resolvedTxHash}/orderIds`, )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/swapper/src/swappers/DebridgeSwapper/endpoints.ts` at line 144, The code reassigns the destructured parameter txHash (txHash = sourceTxStatus.buyTxHash ?? txHash); instead leave the parameter immutable and create a new const (e.g., const resolvedTxHash = sourceTxStatus.buyTxHash ?? txHash) and then use resolvedTxHash in subsequent logic; update any references that relied on the reassigned txHash to use the new const, keeping sourceTxStatus and the original txHash parameter untouched.src/lib/utils/sei.ts (1)
30-59:getSeiTransactionStatusshould use the available viem client instead of a rawfetch.
viemClientByChainId[KnownChainIds.SeiMainnet](viemSeiClient) is already available in@shapeshiftoss/contracts. The same-chain path inDebridgeSwapper/endpoints.tsalready usesviemClient.getTransactionReceiptfor Sei. Using viem here keeps the two receipt-check paths consistent and removes the hand-rolled JSON-RPC body, the'0x1'/'0x0'string comparison, and the missing request timeout.♻️ Suggested refactor
+import { viemClientByChainId } from '@shapeshiftoss/contracts' +import { KnownChainIds } from '@shapeshiftoss/types' import type { EvmChainAdapter } from '@shapeshiftoss/chain-adapters' import { TxStatus } from '@shapeshiftoss/unchained-client' +import type { Hex } from 'viem' -export const getSeiTransactionStatus = async (txHash: string): Promise<TxStatus> => { - const rpcUrl = getConfig().VITE_SEI_NODE_URL +export const getSeiTransactionStatus = async (txHash: string): Promise<TxStatus> => { + const viemClient = viemClientByChainId[KnownChainIds.SeiMainnet] + if (!viemClient) return TxStatus.Unknown try { - const response = await fetch(rpcUrl, { ... }) - if (!response.ok) return TxStatus.Unknown - const data = await response.json() - const receipt = data?.result - if (!receipt) return TxStatus.Pending - if (receipt.status === '0x1') return TxStatus.Confirmed - if (receipt.status === '0x0') return TxStatus.Failed - return TxStatus.Unknown + const receipt = await viemClient.getTransactionReceipt({ hash: txHash as Hex }) + return receipt.status === 'success' ? TxStatus.Confirmed : TxStatus.Failed } catch (error) { - console.error('Error fetching Sei transaction status:', error) + // tx not yet mined — treat as pending return TxStatus.Unknown } }Additionally,
console.erroron line 57 should use the project's structured logger per the coding guidelines.packages/swapper/src/constants.ts (1)
142-198:isAutoSlippageSupportedBySwapperandgetDefaultSlippageDecimalPercentageForSwapperare inconsistent for Debridge.Every other auto-slippage swapper (
Jupiter,Relay,Across) throws ingetDefaultSlippageDecimalPercentageForSwapper, while Debridge returns'0.03'. This hybrid behaviour exists because same-chain Debridge swaps use explicit slippage (3%) while cross-chain usesdstChainTokenOutAmount: 'auto'. However,isAutoSlippageSupportedBySwapperis chain-mode-agnostic, so UI code that callsisAutoSlippageSupportedBySwapper(SwapperName.Debridge) === truemay skip slippage UI for same-chain swaps where a concrete 3% default is actually meaningful.Consider either:
- Keeping both functions consistent by moving
DEFAULT_DEBRIDGE_SLIPPAGE_DECIMAL_PERCENTAGEout of this function and using it only insidegetSameChainTrade, OR- Documenting the intentional hybrid behaviour with an inline comment.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/swapper/src/constants.ts` around lines 142 - 198, The two functions are inconsistent for Debridge: isAutoSlippageSupportedBySwapper(SwapperName.Debridge) returns true but getDefaultSlippageDecimalPercentageForSwapper currently returns DEFAULT_DEBRIDGE_SLIPPAGE_DECIMAL_PERCENTAGE; make them consistent by removing Debridge’s special-case return from getDefaultSlippageDecimalPercentageForSwapper (throw like Jupiter/Relay/Across) and move DEFAULT_DEBRIDGE_SLIPPAGE_DECIMAL_PERCENTAGE usage into the same-chain flow (e.g., getSameChainTrade) so same-chain Debridge trades still use the 3% constant while global auto-slippage stays “unsupported” by the default-provider; update imports/usages accordingly (symbols: DEFAULT_DEBRIDGE_SLIPPAGE_DECIMAL_PERCENTAGE, getDefaultSlippageDecimalPercentageForSwapper, isAutoSlippageSupportedBySwapper, getSameChainTrade).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@headers/csps/debridge.ts`:
- Around line 3-5: Replace the hardcoded origins in the exported csp object with
a dynamic value loaded via Vite's loadEnv similar to across.ts: create a mode
value (using process.env.MODE or NODE_ENV or 'development'), call loadEnv(mode,
process.cwd(), '') to get env, and set 'connect-src' to use
env.VITE_DEBRIDGE_API_URL (append a trailing slash when present) alongside the
existing 'https://stats-api.dln.trade/' entry; update the exported const csp in
debridge.ts to reference that env value instead of the fixed URL.
In `@packages/chain-adapters/src/evm/sei/SeiChainAdapter.ts`:
- Around line 18-20: The isSeiChainAdapter function currently calls (adapter as
ChainAdapter).getType() and will throw if adapter is null/undefined; update
isSeiChainAdapter to first guard against falsy values (e.g., if (!adapter)
return false) and also verify the adapter exposes a callable getType (e.g.,
typeof (adapter as any).getType === "function") before calling it, then compare
the returned value to KnownChainIds.SeiMainnet; reference the isSeiChainAdapter
function and KnownChainIds.SeiMainnet when making this change.
In `@packages/swapper/src/swappers/DebridgeSwapper/constant.ts`:
- Around line 1-39: Move the current constant.ts contents into a new file at
utils/constants.ts within the DebridgeSwapper folder and delete the original
constant.ts; ensure all exports remain identical (chainIdToDebridgeChainId,
debridgeChainIdToChainId, DEBRIDGE_SUPPORTED_CHAIN_IDS,
DEFAULT_DEBRIDGE_TOKEN_ADDRESS, DEFAULT_DEBRIDGE_USER_ADDRESS) and update any
import sites to import from "…/utils/constants" instead of "./constant" so the
swapper follows the required SwapperName/utils/constants.ts convention.
In `@packages/swapper/src/swappers/DebridgeSwapper/endpoints.ts`:
- Around line 107-114: checkTradeStatus currently ignores the passed-in config
and hardcodes the DLN order status base URL; destructure config (or
VITE_DEBRIDGE_API_URL) from the CheckTradeStatusInput in the checkTradeStatus
signature and use config.VITE_DEBRIDGE_API_URL when building the order status
URL instead of "https://dln.debridge.finance"; leave DEBRIDGE_STATS_API_URL
hardcoded as-is. Update the URL construction/usage inside the checkTradeStatus
function (where the order status fetch is done) to reference the config value so
non-production environments honor VITE_DEBRIDGE_API_URL.
In `@packages/swapper/src/swappers/DebridgeSwapper/utils/getTrade.ts`:
- Around line 182-217: The buyAmountBeforeFeesCryptoBaseUnit calculation
erroneously converts and adds a sell-side DLN protocol fee (protocolFeeAmount
using sellChainFeeAssetDecimals) to a buy-side amount, causing a
currency/precision mismatch; update the logic in the
buyAmountBeforeFeesCryptoBaseUnit block (and the analogous same-chain block) to
not add the converted fee—simply return buyAmountAfterFeesCryptoBaseUnit when a
DlnProtocolFee is present (i.e., remove the fee conversion/addition using
convertPrecision, BigAmount.fromBaseUnit, and related deps.assetsById precision
handling) so the net destination amount remains correct.
In `@packages/swapper/src/swappers/DebridgeSwapper/utils/types.ts`:
- Around line 176-178: The current type guard isDebridgeError is too broad
because it treats any object with a 'message' property (including native Errors)
as a DebridgeError; update the guard to check only for Debridge-specific fields
(e.g., 'errorCode' or 'errorId') and/or a combination that cannot be present on
native Error objects so it reliably narrows to DebridgeError. Locate the
isDebridgeError function in types.ts and replace the condition ("'message' in
error" or loose object checks) with checks like typeof error === 'object' &&
error !== null && ('errorCode' in error || 'errorId' in error) (or similar
unique-key checks) so consumers using isDebridgeError won't misclassify generic
Errors.
---
Nitpick comments:
In `@packages/swapper/src/constants.ts`:
- Around line 142-198: The two functions are inconsistent for Debridge:
isAutoSlippageSupportedBySwapper(SwapperName.Debridge) returns true but
getDefaultSlippageDecimalPercentageForSwapper currently returns
DEFAULT_DEBRIDGE_SLIPPAGE_DECIMAL_PERCENTAGE; make them consistent by removing
Debridge’s special-case return from
getDefaultSlippageDecimalPercentageForSwapper (throw like Jupiter/Relay/Across)
and move DEFAULT_DEBRIDGE_SLIPPAGE_DECIMAL_PERCENTAGE usage into the same-chain
flow (e.g., getSameChainTrade) so same-chain Debridge trades still use the 3%
constant while global auto-slippage stays “unsupported” by the default-provider;
update imports/usages accordingly (symbols:
DEFAULT_DEBRIDGE_SLIPPAGE_DECIMAL_PERCENTAGE,
getDefaultSlippageDecimalPercentageForSwapper, isAutoSlippageSupportedBySwapper,
getSameChainTrade).
In `@packages/swapper/src/swappers/DebridgeSwapper/endpoints.ts`:
- Line 144: The code reassigns the destructured parameter txHash (txHash =
sourceTxStatus.buyTxHash ?? txHash); instead leave the parameter immutable and
create a new const (e.g., const resolvedTxHash = sourceTxStatus.buyTxHash ??
txHash) and then use resolvedTxHash in subsequent logic; update any references
that relied on the reassigned txHash to use the new const, keeping
sourceTxStatus and the original txHash parameter untouched.
In
`@packages/swapper/src/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.ts`:
- Around line 12-30: The validation branches returning Err(...) for missing
addresses must include a TradeQuoteError code; update both checks (the
sendAddress and receiveAddress guards in getTradeQuote) to call
makeSwapErrorRight with a code property set to the appropriate enum value (e.g.,
TradeQuoteError.MissingSendAddress and TradeQuoteError.MissingReceiveAddress)
alongside the message so the returned error uses the TradeQuoteError enum for
structured handling.
In `@packages/swapper/src/swappers/DebridgeSwapper/utils/getTrade.ts`:
- Around line 138-146: The second validation of buyDebridgeChainId is redundant
because chainIdToDebridgeChainId[buyAsset.chainId] was already checked and
early-returned with Err(UnsupportedChain) for the cross-chain path earlier in
getTrade; remove the dead block that re-checks buyDebridgeChainId (the const
buyDebridgeChainId = ... and the subsequent if returning Err) so the function
does not duplicate the UnsupportedChain guard and to keep logic concise.
In `@src/plugins/activePlugins.ts`:
- Around line 61-62: The array of plugin identifiers in activePlugins.ts has
'sei' and 'scroll' out of alphabetical order; swap their positions so 'scroll'
comes before 'sei' to match the import order and alphabetical sorting rule —
update the list where the identifiers appear (the array containing sei and
scroll) so it reads scroll, sei.
In `@src/plugins/sei/index.tsx`:
- Around line 22-36: getKnownTokens calls fromAssetId twice per asset (once in
the filter and again in the map); update getKnownTokens to call fromAssetId only
once per asset by performing a single pass: iterate assetService.assets and for
each asset call fromAssetId(asset.assetId) once, check chainId/assetNamespace on
the parsed result, and if it matches push/return the object using
parsed.assetReference for contractAddress (preserve symbol/name/precision). This
can be implemented with a single reduce/map that stores the parsed result per
asset and avoids the duplicate fromAssetId calls.
packages/swapper/src/swappers/DebridgeSwapper/utils/getTrade.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/context/WalletProvider/WalletConnectV2/config.ts (1)
54-66:⚠️ Potential issue | 🟠 MajorAdd Sei RPC mapping in WalletConnect provider config.
Sei is added as an optional chain, but
walletConnectV2ProviderConfig.rpcMapdoesn’t include an RPC URL forCHAIN_REFERENCE.SeiMainnet. This can break chain switching or provider initialization for Sei because WalletConnect won’t know which RPC to use. Please add the VITE_SEI_NODE_URL config entry and map it inrpcMap.✅ Proposed fix
const { VITE_WALLET_CONNECT_WALLET_PROJECT_ID, VITE_AVALANCHE_NODE_URL, VITE_OPTIMISM_NODE_URL, VITE_BNBSMARTCHAIN_NODE_URL, VITE_POLYGON_NODE_URL, VITE_GNOSIS_NODE_URL, VITE_ETHEREUM_NODE_URL, VITE_ARBITRUM_NODE_URL, VITE_BASE_NODE_URL, VITE_INK_NODE_URL, VITE_FLOWEVM_NODE_URL, + VITE_SEI_NODE_URL, } = getConfig() rpcMap: { [CHAIN_REFERENCE.AvalancheCChain]: VITE_AVALANCHE_NODE_URL, [CHAIN_REFERENCE.OptimismMainnet]: VITE_OPTIMISM_NODE_URL, [CHAIN_REFERENCE.BnbSmartChainMainnet]: VITE_BNBSMARTCHAIN_NODE_URL, [CHAIN_REFERENCE.PolygonMainnet]: VITE_POLYGON_NODE_URL, [CHAIN_REFERENCE.GnosisMainnet]: VITE_GNOSIS_NODE_URL, [CHAIN_REFERENCE.EthereumMainnet]: VITE_ETHEREUM_NODE_URL, [CHAIN_REFERENCE.ArbitrumMainnet]: VITE_ARBITRUM_NODE_URL, [CHAIN_REFERENCE.BaseMainnet]: VITE_BASE_NODE_URL, [CHAIN_REFERENCE.InkMainnet]: VITE_INK_NODE_URL, [CHAIN_REFERENCE.FlowEvmMainnet]: VITE_FLOWEVM_NODE_URL, + [CHAIN_REFERENCE.SeiMainnet]: VITE_SEI_NODE_URL, },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/context/WalletProvider/WalletConnectV2/config.ts` around lines 54 - 66, walletConnectV2OptionalChains includes the Sei chain but walletConnectV2ProviderConfig.rpcMap is missing an RPC entry for CHAIN_REFERENCE.SeiMainnet; add a new VITE_SEI_NODE_URL env config and include its URL in walletConnectV2ProviderConfig.rpcMap keyed by CHAIN_REFERENCE.SeiMainnet so WalletConnect can resolve the correct RPC for Sei during provider initialization and chain switching (update the config where walletConnectV2ProviderConfig and rpcMap are defined).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/utils/src/assetData/baseAssets.ts`:
- Around line 604-605: Replace the main icon URL for the CoinGecko image id
28205 so it uses the /large/ variant instead of /small/ (i.e. change the string
'https://assets.coingecko.com/coins/images/28205/small/Sei_Logo_-_Transparent.png'
used for the icon field to use '/large/'); leave the networkIcon value as-is
(keep the /small/ variant).
- Line 604: The SEI asset entry currently sets icon to the CoinGecko /small/
path which is low-res; update the asset's main icon URL (the property named
"icon" for the SEI entry referencing "Sei_Logo") to use the higher-resolution
CoinGecko /large/ path while leaving the "networkIcon" property on the same SEI
entry pointing to the /small/ path unchanged; ensure you only change the main
icon string for the SEI asset in baseAssets.ts.
---
Outside diff comments:
In `@src/context/WalletProvider/WalletConnectV2/config.ts`:
- Around line 54-66: walletConnectV2OptionalChains includes the Sei chain but
walletConnectV2ProviderConfig.rpcMap is missing an RPC entry for
CHAIN_REFERENCE.SeiMainnet; add a new VITE_SEI_NODE_URL env config and include
its URL in walletConnectV2ProviderConfig.rpcMap keyed by
CHAIN_REFERENCE.SeiMainnet so WalletConnect can resolve the correct RPC for Sei
during provider initialization and chain switching (update the config where
walletConnectV2ProviderConfig and rpcMap are defined).
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (10)
packages/caip/src/adapters/coingecko/generated/index.tsis excluded by!**/generated/**public/generated/asset-manifest.jsonis excluded by!**/generated/**public/generated/asset-manifest.json.bris excluded by!**/generated/**public/generated/asset-manifest.json.gzis excluded by!**/*.gz,!**/generated/**public/generated/generatedAssetData.jsonis excluded by!**/generated/**public/generated/generatedAssetData.json.bris excluded by!**/generated/**public/generated/generatedAssetData.json.gzis excluded by!**/*.gz,!**/generated/**public/generated/relatedAssetIndex.jsonis excluded by!**/generated/**public/generated/relatedAssetIndex.json.bris excluded by!**/generated/**public/generated/relatedAssetIndex.json.gzis excluded by!**/*.gz,!**/generated/**
📒 Files selected for processing (50)
.env.env.developmentheaders/csps/debridge.tsheaders/csps/index.tspackages/caip/src/adapters/coingecko/index.test.tspackages/caip/src/adapters/coingecko/index.tspackages/caip/src/constants.tspackages/chain-adapters/src/evm/EvmBaseAdapter.tspackages/chain-adapters/src/evm/SecondClassEvmAdapter.tspackages/chain-adapters/src/evm/index.tspackages/chain-adapters/src/types.tspackages/contracts/src/ethersProviderSingleton.tspackages/contracts/src/viemClient.tspackages/hdwallet-coinbase/src/coinbase.tspackages/hdwallet-core/src/ethereum.tspackages/hdwallet-core/src/wallet.tspackages/hdwallet-gridplus/src/gridplus.tspackages/hdwallet-keepkey/src/keepkey.tspackages/hdwallet-ledger/src/ledger.tspackages/hdwallet-metamask-multichain/src/shapeshift-multichain.tspackages/hdwallet-native/src/ethereum.tspackages/hdwallet-phantom/src/phantom.tspackages/hdwallet-trezor/src/trezor.tspackages/hdwallet-vultisig/src/vultisig.tspackages/hdwallet-walletconnectv2/src/walletconnectV2.tspackages/public-api/src/config.tspackages/swapper/src/swappers/RelaySwapper/constant.tspackages/swapper/src/swappers/RelaySwapper/utils/relayTokenToAssetId.tspackages/types/src/base.tspackages/types/src/zerion.tspackages/utils/src/assetData/baseAssets.tspackages/utils/src/assetData/getBaseAsset.tspackages/utils/src/chainIdToFeeAssetId.tspackages/utils/src/getAssetNamespaceFromChainId.tspackages/utils/src/getChainShortName.tspackages/utils/src/getNativeFeeAssetReference.tsscripts/generateAssetData/coingecko.tsscripts/generateAssetData/generateAssetData.tssrc/components/TradeAssetSearch/hooks/useGetPopularAssetsQuery.tsxsrc/config.tssrc/constants/chains.tssrc/context/PluginProvider/PluginProvider.tsxsrc/context/WalletProvider/WalletConnectV2/config.tssrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxsrc/hooks/useWalletSupportsChain/useWalletSupportsChain.tssrc/lib/account/evm.tssrc/lib/asset-service/service/AssetService.tssrc/lib/coingecko/utils.tssrc/pages/Markets/components/MarketsRow.tsxsrc/plugins/activePlugins.ts
🚧 Files skipped from review as they are similar to previous changes (32)
- packages/chain-adapters/src/evm/index.ts
- src/lib/asset-service/service/AssetService.ts
- src/components/TradeAssetSearch/hooks/useGetPopularAssetsQuery.tsx
- packages/types/src/base.ts
- packages/swapper/src/swappers/RelaySwapper/utils/relayTokenToAssetId.ts
- packages/hdwallet-coinbase/src/coinbase.ts
- packages/hdwallet-core/src/ethereum.ts
- src/context/PluginProvider/PluginProvider.tsx
- src/lib/coingecko/utils.ts
- packages/hdwallet-metamask-multichain/src/shapeshift-multichain.ts
- packages/hdwallet-ledger/src/ledger.ts
- packages/hdwallet-core/src/wallet.ts
- packages/chain-adapters/src/evm/EvmBaseAdapter.ts
- src/config.ts
- src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
- packages/caip/src/constants.ts
- packages/hdwallet-gridplus/src/gridplus.ts
- packages/utils/src/getNativeFeeAssetReference.ts
- src/pages/Markets/components/MarketsRow.tsx
- packages/swapper/src/swappers/RelaySwapper/constant.ts
- packages/utils/src/getAssetNamespaceFromChainId.ts
- packages/contracts/src/ethersProviderSingleton.ts
- scripts/generateAssetData/generateAssetData.ts
- packages/caip/src/adapters/coingecko/index.ts
- headers/csps/debridge.ts
- packages/chain-adapters/src/types.ts
- src/constants/chains.ts
- headers/csps/index.ts
- packages/hdwallet-phantom/src/phantom.ts
- packages/hdwallet-keepkey/src/keepkey.ts
- scripts/generateAssetData/coingecko.ts
- src/hooks/useWalletSupportsChain/useWalletSupportsChain.ts
gomesalexandre
left a comment
There was a problem hiding this comment.
Conceptually looking very sane after salvaging and regenerating ! Will give a runtime pass in a few.
- cross-chain buyAmountBeforeFees: use buyAmountAfterFees as-is (DlnProtocolFee is sell-chain native, cannot add to buy amount without exchange rate) - same-chain buyAmountBeforeFees: protocolFee is in tokenOut (buy asset) units, remove broken convertPrecision that was treating it as 18-dec ETH - same-chain feeData.protocolFees: key by buyAsset.assetId with buy asset info, not sell chain fee asset (protocolFee is tokenOut-denominated per api) - checkTradeStatus: use config.VITE_DEBRIDGE_API_URL for order status endpoint (same pattern as Relay/Across), extract resolvedTxHash to avoid param mutation - rename seiChain -> sei in baseAssets.ts, getBaseAsset.ts, generate scripts - fix sei icon from /small/ to /large/ (13KB vs 1.3KB - renders non-blurry) - delete src/lib/utils/sei.ts - sei is standard evm, default case in subscriber handles it - remove getSeiTransactionStatus import and case from useSendActionSubscriber - regen sei assets with fixed icon url Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
src/lib/utils/sei.ts
Outdated
There was a problem hiding this comment.
done, deleted in 2341454 - SEI is standard EVM, the default case in useSendActionSubscriber handles it via the adapter generically
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/swapper/src/swappers/DebridgeSwapper/endpoints.ts (1)
134-148: Avoidlet resolvedTxHash; extract a resolver for const‑only flow.Style guidelines prefer avoiding
let. Consider extracting the EVM confirmation/txHash resolution into a helper returning either aTradeStatus(early return) or a resolved hash, so the remainder can operate onconst.As per coding guidelines: Avoid let variable assignments - prefer const with inline IIFE switch statements or extract to functions for conditional logic.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/swapper/src/swappers/DebridgeSwapper/endpoints.ts` around lines 134 - 148, The current flow mutates resolvedTxHash with let; extract the EVM confirmation/hash resolution into a helper (e.g., resolveEvmTxHash or getResolvedTxHash) that accepts (txHash, chainId, address, assertGetEvmChainAdapter, fetchIsSmartContractAddressQuery) and inside calls isEvmChainId and checkEvmSwapStatus; have the helper return either a TradeStatus/TxStatus object (when source status !== TxStatus.Confirmed) to allow an immediate return, or a string resolved hash (buyTxHash ?? txHash); then in the caller use a const for the returned value and branch: if the helper returned a TradeStatus return it, otherwise set a const resolvedTxHash to the returned string and continue. This removes the let and keeps logic in a single-responsibility function.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/swapper/src/swappers/DebridgeSwapper/endpoints.ts`:
- Around line 118-132: The same‑chain branch in isSameChainSwap is
reimplementing EVM receipt logic instead of reusing the shared utility; replace
the custom viem getTransactionReceipt block with a call to checkEvmSwapStatus,
passing the txHash and chainId (and any required context such as
viemClientByChainId or provider map) and return its result; ensure you import
checkEvmSwapStatus and preserve the current return shape (buyTxHash, status,
message) and the fallback behavior when no viem client exists by delegating that
handling to or preserving it around checkEvmSwapStatus.
In `@packages/swapper/src/swappers/DebridgeSwapper/utils/getTrade.ts`:
- Around line 57-99: The recipientAddress can be undefined for quotes
(input.quoteOrRate !== 'rate') and the deBridge API is invoked before explicit
validation; add an early validation in getTrade (before building
recipientAddress / before any deBridge API call) that returns an Err via
makeSwapErrorRight when input.quoteOrRate !== 'rate' and input.receiveAddress is
falsy, with a clear message like "Missing receiveAddress for quote" and an
appropriate error code (e.g., TradeQuoteError.Validation) to keep error
reporting deterministic; reference recipientAddress and
input.quoteOrRate/input.receiveAddress when adding this check.
---
Nitpick comments:
In `@packages/swapper/src/swappers/DebridgeSwapper/endpoints.ts`:
- Around line 134-148: The current flow mutates resolvedTxHash with let; extract
the EVM confirmation/hash resolution into a helper (e.g., resolveEvmTxHash or
getResolvedTxHash) that accepts (txHash, chainId, address,
assertGetEvmChainAdapter, fetchIsSmartContractAddressQuery) and inside calls
isEvmChainId and checkEvmSwapStatus; have the helper return either a
TradeStatus/TxStatus object (when source status !== TxStatus.Confirmed) to allow
an immediate return, or a string resolved hash (buyTxHash ?? txHash); then in
the caller use a const for the returned value and branch: if the helper returned
a TradeStatus return it, otherwise set a const resolvedTxHash to the returned
string and continue. This removes the let and keeps logic in a
single-responsibility function.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (6)
public/generated/asset-manifest.jsonis excluded by!**/generated/**public/generated/asset-manifest.json.bris excluded by!**/generated/**public/generated/asset-manifest.json.gzis excluded by!**/*.gz,!**/generated/**public/generated/generatedAssetData.jsonis excluded by!**/generated/**public/generated/generatedAssetData.json.bris excluded by!**/generated/**public/generated/generatedAssetData.json.gzis excluded by!**/*.gz,!**/generated/**
📒 Files selected for processing (6)
packages/swapper/src/swappers/DebridgeSwapper/endpoints.tspackages/swapper/src/swappers/DebridgeSwapper/utils/getTrade.tspackages/utils/src/assetData/baseAssets.tspackages/utils/src/assetData/getBaseAsset.tsscripts/generateAssetData/coingecko.tsscripts/generateAssetData/sei/index.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- scripts/generateAssetData/sei/index.ts
- scripts/generateAssetData/coingecko.ts
- packages/utils/src/assetData/getBaseAsset.ts
- packages/utils/src/assetData/baseAssets.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
packages/caip/src/constants.ts (1)
42-42: Align new constants with UPPER_SNAKE_CASE naming rule.
seiAssetIdandseiChainIdare camelCase constants. If renaming across the public API is too disruptive for this PR, please consider a follow‑up standardization plan or compatibility aliases so new additions don’t drift further from the guideline.
As per coding guidelines: Use UPPER_SNAKE_CASE for constants and configuration values with descriptive names.Also applies to: 123-123
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/caip/src/constants.ts` at line 42, Rename the newly added camelCase constants to follow UPPER_SNAKE_CASE (e.g., SEI_ASSET_ID and SEI_CHAIN_ID) to comply with the project's constant naming guideline; update all references to seiAssetId and seiChainId in the codebase (exports, imports, tests, and public API surfaces) or provide backwards-compatible aliases that re-export the new names (e.g., export const seiAssetId = SEI_ASSET_ID) if renaming the public API in this PR is unacceptable, and ensure types (AssetId) and any documentation are updated to use the new identifiers.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/caip/src/constants.ts`:
- Line 195: Remove the inline doc comment added after the SeiMainnet entry in
the constants mapping: keep the existing key/value pair SeiMainnet: '1329' but
delete the trailing comment "// https://docs.sei.io" so the line contains only
the value assignment; do not add any other comments or changes to surrounding
entries.
- Around line 309-310: The FEE_ASSET_IDS list is missing the Sei fee asset,
causing fee resolution/estimation to fail for Sei; update the FEE_ASSET_IDS
array to include seiAssetId alongside existing entries (e.g., add seiAssetId
near CHAIN_REFERENCE.SeiMainnet/CHAIN_REFERENCE.CeloMainnet entries) so
fee-asset resolution and fee estimation for Sei transactions work correctly,
ensuring you reference the existing seiAssetId constant and the FEE_ASSET_IDS
symbol when making the change.
In `@packages/swapper/src/swappers/DebridgeSwapper/endpoints.ts`:
- Around line 142-176: The error branches for deBridge API calls silently ignore
failures; add console.error logs before each early return: when
maybeOrderIdsResponse.isErr() log the error with resolvedTxHash and chainId (and
include maybeOrderIdsResponse.unwrapErr() or the error object) and when
maybeStatusResponse.isErr() log the error with resolvedTxHash, orderId and
chainId (and include maybeStatusResponse.unwrapErr()); update the branches
around debridgeService.get calls that produce maybeOrderIdsResponse and
maybeStatusResponse to follow the logging pattern used in
SunioSwapper/StonfiSwapper.
- Around line 17-104: The catch blocks in getEvmTransactionFees and
getUnsignedEvmTransaction are swallowing exceptions; change both catches to
capture the error (catch (error)) and emit structured logs before falling back:
call a logger (e.g., logger.error) or console.error with metadata { error,
chainId: sellAsset.chainId, stepIndex, to, value, data, gasLimitFromApi } and a
short message indicating gas estimation failed for evm.getFees; ensure you
reference evm.getFees, adapter.getGasFeeData, getEvmTransactionFees and
getUnsignedEvmTransaction so the logs provide context, and only then proceed
with the existing fallback logic.
---
Nitpick comments:
In `@packages/caip/src/constants.ts`:
- Line 42: Rename the newly added camelCase constants to follow UPPER_SNAKE_CASE
(e.g., SEI_ASSET_ID and SEI_CHAIN_ID) to comply with the project's constant
naming guideline; update all references to seiAssetId and seiChainId in the
codebase (exports, imports, tests, and public API surfaces) or provide
backwards-compatible aliases that re-export the new names (e.g., export const
seiAssetId = SEI_ASSET_ID) if renaming the public API in this PR is
unacceptable, and ensure types (AssetId) and any documentation are updated to
use the new identifiers.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
packages/caip/src/constants.tspackages/swapper/src/swappers/DebridgeSwapper/endpoints.ts
gomesalexandre
left a comment
There was a problem hiding this comment.
Happy on almost all counts but:
- Simulation and Tx failing (Rabby)
- Same old econd-class Tx history upsertion/action center execution price sad for cross-chain swaps to SEI
https://jam.dev/c/e2435dca-b18b-4bd2-a4c0-2e283e86c0be
Will fix both and we're gucci
Same rpc limitation as flow evm/blast/zksync/celo - use wrapped native withdrawal event fallback for tx history parsing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fixFee and prependedOperatingExpenseCost are baked into tx.value by deBridge, making the wallet think it needs way more native than the sell amount alone. Surface them as a protocol fee with requiresBalance: true so balance checks account for them. Drops the broken DlnProtocolFee entry (was ETH assetId key with USDC amount - negligible ~$0.00076 anyway). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
deBridge API returns conservative gasLimits (1.6-2.3M gas). At high gas prices (660 gwei on Polygon) this causes tx fees to exceed MetaMask's 1 ETH cap. Use eth_estimateGas result with a 1.2x buffer instead; fall back to API value only when estimation fails. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- add seiAssetId to FEE_ASSET_IDS (missing, causing fee resolution to fail) - drop trailing url comment on SeiMainnet constant entry - add console.error to debridge catch blocks and status api failures Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
auto slippage from deBridge resolves to ~1% which is too tight for chains like SEI's AlgebraPool (4-5% price impact even for small trades). Default to 5% to avoid "Return amount is not enough" reverts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
DebridgeOrderStatus had no fulfillment tx hash. When order is confirmed,
fetch /api/Orders/{orderId} from stats-api.dln.trade to get
fulfilledDstEventMetadata.transactionHash, surfaced as buyTxHash
so parseTx runs for SEI destination tx and execution price shows.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
stats-api.dln.trade/api/Orders returns transactionHash as a
DebridgeHashObject {stringValue, bytesValue, bytesArrayValue} not
a plain string. Was storing the full object as buyTxHash, causing
txHashFilter.toLowerCase crash in selectors and invalid
eth_getTransactionByHash params.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
disregard the double-review i'm a derp bot
gomesalexandre
left a comment
There was a problem hiding this comment.
hey @NeOMakinG, picking up from where you left off - summary of what landed after fc60407ebd:
chain integration
- merge develop + full sei integration (
4cc3314da1) - debridge fee math fix, sei icon, rm custom tx status (
2341454adf) - sei chain adapter null guard + debridge error type guard (
3845aaf941) - same-chain status via
checkEvmSwapStatus(55cd0e1eef) - celo to
VALID_CHAIN_IDS(5d91547042)
sei parseTx / second-class tx history
- skip
debug_traceTransactionfor sei (69c035b018) - same rpc limitation as blast/zkSync/flow. WSEI burn event detection now works as fallback -> execution price now shows in tx history
debridge gas + fee fixes
- surface
fixFee + prependedOperatingExpenseCostas protocol fee withrequiresBalance: truefor cross-chain (51ad24f37b) eth_estimateGas * 1.2buffer instead of inflated api gas limit (feb9bed30a) - was causing "fee exceeds cap" on polygonseiAssetIdadded toFEE_ASSET_IDS(was missing, would've broken fee resolution)- debridge error logging improvements (
e75cceb3af)
same-chain sei fix
- default slippage to 5% instead of
auto(e4011f80ff) - sei's algebrapool has ~4-5% price impact,autoresolves to ~1% so swap always reverted. same-chain sei swaps now work
cross-chain buyTxHash + app crash fix
- fetch
fulfilledDstEventMetadata.transactionHashfromstats-api.dln.trade/api/Orders/{orderId}on confirmation (2f3816359a) soparseTxruns for the sei destination tx 0099ec0071<- this one was crashing the app: stats-api returns all hashes as{stringValue, bytesValue, bytesArrayValue}objects, not plain strings. was storing the full object asbuyTxHash->txHashFilter.toLowerCase is not a functionin selectors. now extracts.stringValue. execution price shows
tl;dr ser the receipts are right there, no excuses: https://jam.dev/c/8da29a16-761c-4fdd-b3ec-ef9dcec17694
Description
Integrate Sei EVM chain (eip155:1329) as a second-class citizen and add the deBridge DLN swapper with both cross-chain bridging and same-chain swap support.
This PR combines the SEI chain integration (#11928) with the deBridge swapper for a single cohesive rollout — SEI needs deBridge for on-chain swaps since Relay only supports bridging USDC.N to SEI.
SEI Chain Integration
seiChainId,seiAssetId,CHAIN_REFERENCE.SeiMainnet)SeiChainAdapterextendingSecondClassEvmAdapter(ethersJsonRpcProvider+ viem client)sei-v2platform mapping (~50+ token mappings including USDC)VITE_FEATURE_SEI(dev-only)deBridge DLN Swapper
GET /v1.0/dln/order/create-tx— 12 EVM chains supportedGET /v1.0/chain/transaction— enables on-chain swaps (e.g., SEI ↔ USDC on Sei)SecondClassEvmAdapterchains wherehttpProvideris unavailable)estimateGaswith fallback to deBridge API-providedgasLimit(deBridge's off-chain simulation overestimates output on SEI by ~2.4%, causingestimateGasto revert even with fresh calldata)dstChainTokenOutAmount=autoVITE_FEATURE_DEBRIDGE_SWAP(dev-only)Bug Fixes
[object Object]passed as URL param in deBridge status checks (DebridgeOrderIdtype extraction)SecondClassEvmAdapterchains (SEI) — uses viemgetTransactionReceiptinstead of unavailablehttpProvider.getTransactionNew Files
packages/swapper/src/swappers/DebridgeSwapper/— Complete swapper implementationpackages/swapper/src/swappers/DebridgeSwapper/utils/fetchDebridgeSingleChainTrade.ts— Same-chain swap APIheaders/csps/debridge.ts— CSP headers for deBridge API domainssrc/components/.../SwapperIcon/debridge-icon.svg— Swapper iconIssue (if applicable)
Part of #11902
Supersedes #11928
Risk
Low risk — both features are behind independent feature flags (
VITE_FEATURE_SEI,VITE_FEATURE_DEBRIDGE_SWAP), both disabled in production. No changes to existing swapper logic or shared infrastructure beyond adding new enum values and metadata types.Testing
Engineering
VITE_FEATURE_SEI=trueandVITE_FEATURE_DEBRIDGE_SWAP=trueSEI chain:
3. Verify Sei appears as an available chain in the app
4. Verify SEI native asset and USDC on Sei appear with correct market data
5. Verify wallet support detection works for supported wallet types
deBridge cross-chain:
6. Navigate to Trade, select a cross-chain pair (e.g., ETH → AVAX)
7. Verify deBridge appears as a quote option alongside existing swappers
8. Execute a small test trade and verify status tracking (Created → Fulfilled → Confirmed)
deBridge same-chain (SEI):
9. Select SEI → USDC on Sei (same-chain swap)
10. Verify deBridge quote appears with fee estimate (uses API gasLimit fallback)
11. Execute the swap and verify:
- Transaction broadcasts successfully
- Status correctly reflects success/failure from on-chain receipt
12. Test reverse direction: USDC → SEI on Sei
Operations
Screenshots (if applicable)
https://jam.dev/c/eaa9b2e6-f230-46bc-b8ff-b89cc669b78e
N/A — chain integration and swapper behind feature flags, appearing in existing trade flow.
Summary by CodeRabbit