Add BCH and EVM to Bridgeless plugin#450
Conversation
| const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' | ||
|
|
||
| const EDGE_PLUGINID_CHAINID_MAP: Record<string, string> = { | ||
| // base: '8453', // only support btc for now |
There was a problem hiding this comment.
Suggestion: This comment is stale — the PR adds BCH, ETH, and BSC support, so "only support btc for now" is misleading. Consider updating to clarify why Base is excluded (e.g., // Base: not yet enabled in Bridgeless) or removing the line entirely per delete-unnecessary-code.
| } catch (e) { | ||
| // ignore tokens that fail validation | ||
| } | ||
| try { | ||
| if (toTokenInfoForToken == null) { | ||
| const tokenId = await getTokenId(request.toWallet, info.address) | ||
| if ( | ||
| info.chain_id === | ||
| EDGE_PLUGINID_CHAINID_MAP[ | ||
| request.toWallet.currencyInfo.pluginId | ||
| ] && | ||
| tokenId === request.toTokenId | ||
| ) { | ||
| toTokenInfoForToken = info | ||
| } | ||
| } | ||
| } catch (e) { |
There was a problem hiding this comment.
Suggestion: Both catch (e) blocks should use catch (e: unknown) per project TypeScript standards (catch-typing).
Add bitcoin cash chain id Add zero address constant Use correct fetch Reaplce switch/case with if for Zano special case
The plugin isn't handling tokenId or decimals correctly. It just kind of worked for bitcoin because the number of decimals matched on both sides of the swap. For tokenId, only the fromWallet was used so the plugin is broken if the swap goes from token->token.
5d2f486 to
55cdc49
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 55cdc49. Configure here.
| fromAmount, | ||
| fromTokenInfo, | ||
| toChainId, | ||
| receiver: toAddress |
There was a problem hiding this comment.
EVM path uses raw address instead of hex-encoded receiver
High Severity
The EVM case passes toAddress (the raw base58 Zano address) to makeBridgelessEvmSpendInfo instead of the receiver variable computed at the top of the function. The receiver variable correctly hex-encodes Zano addresses via base16.encode(base58.decode(toAddress)). The bitcoin/BCH case correctly uses receiver, but the EVM case does not. Since the plugin requires Zano involvement, every EVM swap destination is Zano, so the smart contract will always receive the address in the wrong format, likely causing lost funds.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 55cdc49. Configure here.
There was a problem hiding this comment.
The Zano address is passed in directly https://docs.bridgeless.com/docs/specs/arch/signer/integration/bridging/evm/#erc20-to-asset
I will move the receiver const into the utxo block so it's not interpreted as a const for all paths
This is an arbitrary limitation. Other swaps should work (ie. bitcoin to ethereum btcx token) but they are untested. # Conflicts: # CHANGELOG.md
a94adb2 to
96f6760
Compare


CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneDescription
noneNote
Medium Risk
Adds new chain support and introduces EVM contract-call/approval transaction generation, which can affect funds flow if memo/data encoding or amount-scaling is wrong. Includes new rounding/decimal conversion logic that impacts minimum/quoted amounts across chains.
Overview
Bridgeless swaps now support Bitcoin Cash and EVM chains (Ethereum + BNB Chain) in addition to the existing Zano flows, including EVM token approvals via
createEvmApprovalEdgeTransactionsand ABI-encodeddepositNative/depositERC20call data placed into the spend memo.Quote math is updated to scale native amounts across differing token decimals (new
scaleNativeAmountwith rounding) so min/commission checks work when bridging between chains with different precisions, and order tracking is adjusted for EVM token deposits (uses log index1for the nonce). Unit tests were added forscaleNativeAmount, and the changelog notes the new Bridgeless chain support.Reviewed by Cursor Bugbot for commit 96f6760. Bugbot is set up for automated code reviews on this repo. Configure here.