Enable Changelly swaps on Rootstock#716
Conversation
WalkthroughThe updates adjust address handling in Ethereum transaction nonce retrieval by converting addresses to lowercase, ensuring compatibility with web3. Additionally, the Changelly provider's token initialization now includes tokens with the "RBTC" protocol, not just those with Changes
Suggested reviewers
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/swap/src/providers/changelly/index.ts (1)
134-139: Case-insensitive protocol check & optional chaining
cur.protocolmay beundefinedfor some entries.
Using optional chaining and a case-insensitive comparison avoids a possible
runtime error and future-proofs the filter.- (cur.fixRateEnabled || cur.protocol === "RBTC") && // Allow RBTC as native currency for gas fees and swaps + (cur.fixRateEnabled || cur.protocol?.toUpperCase() === "RBTC") && // Allow RBTC as native currency for gas fees and swaps
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/extension/src/providers/ethereum/libs/transaction/index.ts(1 hunks)packages/swap/src/providers/changelly/index.ts(1 hunks)
🔇 Additional comments (1)
packages/extension/src/providers/ethereum/libs/transaction/index.ts (1)
108-108: Guard against missingfrombefore calling.toLowerCase()
this.tx.fromis now dereferenced fortoLowerCase()unconditionally.
If, for any reason, the caller forgets to populatefrom, this will throw aTypeErrorlong before the intended validation path. A quick nil-check (or an early explicit error) makes the failure mode clearer.-const nonce = await this.web3.getTransactionCount(this.tx.from.toLowerCase(), 'pending'); +if (!this.tx.from) + throw new Error("Transaction.from is required to compute nonce"); +const nonce = await this.web3.getTransactionCount( + this.tx.from.toLowerCase(), + "pending", +);
Description
This PR adds minor fixes to enable
Changellyswaps on Rootstock. Currently fix rate is enabled forriftoken but forrbtcthe fix rate is not enabled. So suggesting if it's acceptable to bypass rbtc fix rate and include it for changelly swaps.Demo
Summary by CodeRabbit