Added Ethereum classic mainnet support#21
Conversation
WalkthroughRenames the Ethereum Classic testnet entry from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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 |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
stablepay-sdk/src/utils/config.js (1)
41-59: Redefining'ethereum-classic'key breaks existing consumers and creates inconsistency with TransactionReview.jsx.Before this PR,
'ethereum-classic'mapped to Mordor Testnet (chainId 63). This PR redefines it to ETC Mainnet (chainId 61) while introducing a new'mordor-testnet'key. Any code or persisted configs referencing'ethereum-classic'will silently receive the wrong network. Additionally,TransactionReview.jsxhardcodes"ethereum-classic": "https://etc-mordor.blockscout.com/tx/", which now points to a mainnet network key—creating broken explorer links.To preserve backwards compatibility, either:
- Keep
'ethereum-classic'pointing to Mordor Testnet and use a different key for ETC Mainnet (e.g.,'ethereum-classic-mainnet'), or- Add a deprecated alias:
networksConfig['ethereum-classic'] = networksConfig['mordor-testnet']and use a new key for mainnet.Update
TransactionReview.jsxto use the correct key and fix all network selector references to be explicit about network intent.
🧹 Nitpick comments (2)
stablepay-sdk/src/utils/config.js (2)
3-78: Normalizeuriformatting (trailing slash) to avoid subtle URL concat bugs.
sepolia.uriends with/(Line 4) while others do not (e.g., Line 23, Line 42, Line 61). If any caller doesuri + '/path'oruri + 'path', behavior diverges by network.Pick one convention (typically no trailing slash) and apply consistently:
- uri: 'https://ethereum-sepolia.publicnode.com/', + uri: 'https://ethereum-sepolia.publicnode.com',(or add trailing slashes everywhere, but keep it consistent).
41-78: Single-RPC dependency risk: consider fallback RPC(s) or a health-check path.
mordor-testnet.uriandethereum-classic.uriare single endpoints (Line 42, Line 61). If the SDK supports it, consider allowing an array of RPC URLs (or documenting recommended overrides) to reduce outages and rate-limit failures.
|
@r9jdp Great work ! Looks good to me ! Can you tweak the stablecoin value to 0.001 and see if the transaction goes through in the mordor testnet and attach the screen recording here ? Send me your address in dm to get some metc for testing on testnet and mainnet looks good ! |
|
Here's the demo with the tweaked value for the mordor testnet, I have also shown the console for details. |
|
sure heres it
|
|
@r9jdp good work ! Can you please update the sdk version to 1.0.4 , so that I can later publish to the registry ? |
|
@Zahnentferner This PR is reviewed and I will be merging this soon ,once a minor comment is tweaked |
|
check |
|
@r9jdp is this updated to the recent changes that I pushed ?please pull the changes from the main branch and keep the changes then |
|
@r9jdp Also did you build the sdk using the build command , there must changes in the dist files ad well right ? check my previous pr which i merged and see the files which were merged.We need the build files so I can publish them to registry build command : npx rollup -c |
can you check this @r9jdp |
Okay I'll do that. |
yes when you build there are changes in the dist files ,which are needed for the registry. While testing I am sure the files were changed ,did you revert them back ? |
…/r9jdp/StablePay into Ethereum_classic_mainnet_support
I have changed the name as ethereum-classic for mordor-testnet and ethereum-classic-mainnet for the mainnet, I have build and updated according to the recent changes you made. Check and tell if anything else to be done. |
|
@r9jdp for the future proof sdk ,please name mordor testnet and ethereum classic mainnet just change the hardcoded key in the transaction review to mordor-testnet for now (I will open another issue for changing the urls) please make these changes |
okay i'll do that |
@r9jdp in the latest change ,please read my comment again ,you need to also change the hardcoded line where TransactionReview.jsx hardcodes "ethereum-classic": "https://etc-mordor.blockscout.com/tx/", please do this change and build the files and push the changes |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
stablepay-sdk/src/widget/TransactionReview.jsx (1)
259-278: Hardcoded Mordor explorer URL breaks mainnet support.The
getExplorerUrl()function at line 186 correctly resolves explorer URLs per network, but this block ignores it and hardcodes the Mordor testnet URL. Transactions on ETC mainnet, Sepolia, or Milkomeda will incorrectly link to the Mordor explorer.This was specifically flagged by the reviewer in PR comments.
- {txHash && ( - <div className={styles.transactionLink}> - ✅ Transaction Hash:{" "} - <a - href={`https://blockscout.com/etc/mordor/tx/${txHash}`} - target="_blank" - rel="noopener noreferrer" - className={styles.explorerLink} - style={{ - color: "#007bff", - textDecoration: "underline", - fontWeight: "bold", - cursor: "pointer", - wordBreak: "break-word" - }} - > - {txHash.slice(0, 6)}...{txHash.slice(-6)} - </a> - </div> -)} + {txHash && ( + <div className={styles.transactionLink}> + ✅ Transaction Hash:{" "} + {getExplorerUrl() ? ( + <a + href={getExplorerUrl()} + target="_blank" + rel="noopener noreferrer" + className={styles.explorerLink} + style={{ + color: "#007bff", + textDecoration: "underline", + fontWeight: "bold", + cursor: "pointer", + wordBreak: "break-word" + }} + > + {txHash.slice(0, 6)}...{txHash.slice(-6)} + </a> + ) : ( + <span style={{ wordBreak: "break-word" }}> + {txHash.slice(0, 6)}...{txHash.slice(-6)} + </span> + )} + </div> + )}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
stablepay-sdk/dist/umd/index.js.mapis excluded by!**/dist/**,!**/*.map
📒 Files selected for processing (1)
stablepay-sdk/src/widget/TransactionReview.jsx(1 hunks)
|
@r9jdp looks good now , I will open another issue for the dynamic url links (for now this will suffice) have you tested the updated sdk ? it works fine with all the changes that you've made ? |
|
@Tanya-ruby Should i push the Hardcoded Mordor explorer URL breaks mainnet support. fix |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
stablepay-sdk/src/widget/TransactionReview.jsx (1)
186-199: Milkomeda explorer URL is not accessible; fix or remove until resolved.The
getExplorerUrl()function correctly addresses the past review by includingethereum-classic-mainnet. However, the Milkomeda mainnet explorer URL (https://explorer-mainnet-cardano-evm.c1.milkomeda.com/) is not accessible (connection failure). Either update it to a working URL or remove the Milkomeda entry until the correct endpoint is confirmed.The other explorer URLs (Mordor, ETC Mainnet, Sepolia) are accessible and working.
🧹 Nitpick comments (1)
stablepay-sdk/src/widget/TransactionReview.jsx (1)
263-283: Consider storing explorer URL in a variable.The conditional rendering logic is correct, but
getExplorerUrl()is called twice (lines 263 and 265). While the performance impact is negligible, storing the result improves readability.{txHash && ( <div className={styles.transactionLink}> ✅ Transaction Hash:{" "} - {getExplorerUrl() ? ( + {(() => { + const explorerUrl = getExplorerUrl(); + return explorerUrl ? ( <a - href={getExplorerUrl()} + href={explorerUrl} target="_blank" rel="noopener noreferrer" className={styles.explorerLink} style={{ color: "#007bff", textDecoration: "underline", fontWeight: "bold", cursor: "pointer", wordBreak: "break-word", }} > {txHash.slice(0, 6)}...{txHash.slice(-6)} </a> ) : ( <span style={{ wordBreak: "break-word" }}> {txHash.slice(0, 6)}...{txHash.slice(-6)} </span> - )} + ); + })()} </div> )}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
stablepay-sdk/dist/esm/index.jsis excluded by!**/dist/**stablepay-sdk/dist/umd/index.jsis excluded by!**/dist/**stablepay-sdk/dist/umd/index.js.mapis excluded by!**/dist/**,!**/*.map
📒 Files selected for processing (1)
stablepay-sdk/src/widget/TransactionReview.jsx(2 hunks)
|
@Tanya-ruby I have edited the TransactionReview.jsx to use getExplorerUrl instead of hardcoded Mordor URL. |
I tested this everything is working with the Merchant demo website, |
what do you mean ? I think everything should work fine , can you not change the transaction file to get url from getexplorerUrl and just leave the mordor url for this issue? |
3312c55 to
8d96fea
Compare
|
@r9jdp did u test it ? working as required ? let me know and share a recording , i am planning it to move to hard |
|
@r9jdp moved it to hard ,let me know if you were able to test this ? |
Iam testing will share a screen recording |
pr5.mp4 |
|
@r9jdp I'm asking if the mordor testnet works as needed ? because u do not have the funds for etc mainnet testing so it shouldn't go through , only the tesnet needs to go through on the mainnet you should get error in the metamask popup itself |
|
@r9jdp found it ! So when u make a tx choosing etc mainnet , it is getting connected to testnet .Can you investigate this ? |
|
@r9jdp if it is an issue with merchant demo website or if it is with the hardcoded url , let me know i will open seperate issues for it |
Iam getting Failed Transaction issue in mordor-testnet in the Merchant demo frontend
|
|
@Tanya-ruby Also
In the TransactionReview.jsx there is a hardcoded mordor url , can it cause an issue ? also in Demo frontent transaction-verifier.tsx has the following code : This maybe causing an issue |
|
@Tanya-ruby The Stablepay-sdk config works fine and most probably the issue is of Hardcoded mordor URL in TransactionReview.tsx and the URL in transaction-verifier.tsx of the Demo Merchant frontend |
|
@r9jdp good points ! can you modify the url and add mordor-testnet and now it should pass (in the merchant demo website ) can you use the tx hash and check it on the explorer if it works? I am wondering how the changes worked when you first made them |
|
@r9jdp can you provide the tx hash ? let me check it from my end for mordort testnet |
|
@r9jdp this works partially but you would also need to change the wallet context and the explorer url function for everything to work .I can help you directly with what changes are needed ,let me know and I will send you the files to change on discord |
Yes do you send me what files to be changes |

This PR updates the StablePay SDK to support the Ethereum Classic (ETC) Mainnet and renames the existing Ethereum Classic testnet configuration to "Mordor Testnet" for better clarity and standardization. It addresses Issue #18.
Fixes #18
Changes Made:
Renamed Network: Changed the existing ethereum-classic configuration key and display name to mordor-testnet.
Added Network: Added a new configuration entry for ethereum-classic with the following details:
Chain ID: 61
RPC: https://etc.rivet.link
Djed Contract: 0xCc3664d7021FD36B1Fe2b136e2324710c8442cCf (Verified via on-chain calls)
Stablecoin (ECSD): 0x5A7Ca94F6E969C94bef4CE5e2f90ed9d4891918A (Verified via Blockscout)
I have attached a video showing the exact working applicatio
PR.mp4
Summary by CodeRabbit
New Features
Bug Fix / Behavior Change
Chores
✏️ Tip: You can customize this high-level summary in your review settings.