Skip to content

Added Ethereum classic mainnet support#21

Open
r9jdp wants to merge 9 commits intoDjedAlliance:mainfrom
r9jdp:Ethereum_classic_mainnet_support
Open

Added Ethereum classic mainnet support#21
r9jdp wants to merge 9 commits intoDjedAlliance:mainfrom
r9jdp:Ethereum_classic_mainnet_support

Conversation

@r9jdp
Copy link

@r9jdp r9jdp commented Dec 13, 2025

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

    • Added separate entries for Ethereum Classic mainnet and Mordor testnet in network listings and explorer support.
  • Bug Fix / Behavior Change

    • Explorer link generation updated to use the new network keys; older network keys may no longer resolve.
  • Chores

    • Package version bumped to 1.0.4

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

Walkthrough

Renames the Ethereum Classic testnet entry from ethereum-classic to mordor-testnet, adds an ethereum-classic-mainnet network configuration, updates the widget explorer mapping to include both keys, and bumps stablepay-sdk version from 1.0.2 to 1.0.4.

Changes

Cohort / File(s) Summary
Network configuration
stablepay-sdk/src/utils/config.js
Renamed ethereum-classicmordor-testnet; added ethereum-classic-mainnet with RPC URI, chainId, djedAddress, tokens (stablecoin and native) and feeUI. Other networks unchanged.
Widget explorer mapping
stablepay-sdk/src/widget/TransactionReview.jsx
Added explorer base URLs for mordor-testnet and ethereum-classic-mainnet; updated getExplorerUrl() usage to reference expanded mapping. Minor inline style formatting changes only.
Package metadata
stablepay-sdk/package.json
Bumped package version 1.0.21.0.4. No other edits.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • Check RPC URIs, chainId, addresses (djedAddress), token metadata (symbols, decimals) and feeUI values in config.js.
  • Verify TransactionReview.jsx explorer mapping keys match the renamed network key (mordor-testnet) and new mainnet key, and that explorers generate correct URLs.
  • Confirm version bump is intentional and consistent with release process.

Possibly related PRs

Suggested reviewers

  • Zahnentferner

Poem

🐇 I hopped through configs, quick and neat,
Mordor renamed, mainnet found its seat.
RPCs and explorers now lined in a row,
A tiny version bump — onward we go! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding Ethereum Classic mainnet support. It is concise, clear, and directly related to the primary objective of the PR.
Linked Issues check ✅ Passed The PR addresses the primary coding requirements from issue #18: adding ETC mainnet configuration, renaming testnet to mordor-testnet, updating explorer URLs in TransactionReview.jsx, and bumping the SDK version to 1.0.4.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #18 requirements: network configuration updates, explorer URL mapping, and version bump. No unrelated code modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3312c55 and 8d96fea.

⛔ Files ignored due to path filters (1)
  • stablepay-sdk/dist/umd/index.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (1)
  • stablepay-sdk/src/widget/TransactionReview.jsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • stablepay-sdk/src/widget/TransactionReview.jsx

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.

Copy link

@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

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.jsx hardcodes "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.jsx to 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: Normalize uri formatting (trailing slash) to avoid subtle URL concat bugs.
sepolia.uri ends with / (Line 4) while others do not (e.g., Line 23, Line 42, Line 61). If any caller does uri + '/path' or uri + '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.uri and ethereum-classic.uri are 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.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8dde4f3 and 7f1d4cb.

📒 Files selected for processing (1)
  • stablepay-sdk/src/utils/config.js (2 hunks)

@Tanya-ruby
Copy link
Contributor

@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 !

@Tanya-ruby Tanya-ruby self-requested a review December 13, 2025 10:36
@r9jdp
Copy link
Author

r9jdp commented Dec 13, 2025

Here's the demo with the tweaked value for the mordor testnet, I have also shown the console for details.
https://github.com/user-attachments/assets/e4881eaf-b9b0-4ade-ba7b-e3413fa2f5c6

@Tanya-ruby
Copy link
Contributor

Here's the demo with the tweaked value for the mordor testnet, I have also shown the console for details. https://github.com/user-attachments/assets/e4881eaf-b9b0-4ade-ba7b-e3413fa2f5c6
great ! can you paste the tx hash for me here? thanks !

@r9jdp
Copy link
Author

r9jdp commented Dec 13, 2025

Here's the demo with the tweaked value for the mordor testnet, I have also shown the console for details. https://github.com/user-attachments/assets/e4881eaf-b9b0-4ade-ba7b-e3413fa2f5c6
great ! can you paste the tx hash for me here? thanks !

sure heres it

  • 0x95c1c8b875100ca4a12d498196b82d74b567d02eaa31f1b3db64ecf6111cf52c

@Tanya-ruby
Copy link
Contributor

@r9jdp good work ! Can you please update the sdk version to 1.0.4 , so that I can later publish to the registry ?

@Tanya-ruby
Copy link
Contributor

@Zahnentferner This PR is reviewed and I will be merging this soon ,once a minor comment is tweaked

@r9jdp
Copy link
Author

r9jdp commented Dec 13, 2025

check

@Tanya-ruby
Copy link
Contributor

@r9jdp is this updated to the recent changes that I pushed ?please pull the changes from the main branch and keep the changes then

@Tanya-ruby
Copy link
Contributor

@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

@Tanya-ruby
Copy link
Contributor

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.jsx hardcodes "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.jsx to use the correct key and fix all network selector references to be explicit about network intent.

📜 Review details

can you check this @r9jdp

@r9jdp
Copy link
Author

r9jdp commented Dec 13, 2025

@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

Okay I'll do that.

@Tanya-ruby
Copy link
Contributor

@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

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
Copy link
Author

r9jdp commented Dec 13, 2025

@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

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 ?

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.

@Tanya-ruby
Copy link
Contributor

@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

@r9jdp
Copy link
Author

r9jdp commented Dec 13, 2025

@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

@Tanya-ruby
Copy link
Contributor

@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

Copy link

@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

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

📥 Commits

Reviewing files that changed from the base of the PR and between b23aec4 and 9161d0e.

⛔ Files ignored due to path filters (1)
  • stablepay-sdk/dist/umd/index.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (1)
  • stablepay-sdk/src/widget/TransactionReview.jsx (1 hunks)

@Tanya-ruby
Copy link
Contributor

@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 ?

@r9jdp
Copy link
Author

r9jdp commented Dec 13, 2025

@Tanya-ruby Should i push the Hardcoded Mordor explorer URL breaks mainnet support. fix

Copy link

@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

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 including ethereum-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

📥 Commits

Reviewing files that changed from the base of the PR and between 0ed8f67 and 3312c55.

⛔ Files ignored due to path filters (3)
  • stablepay-sdk/dist/esm/index.js is excluded by !**/dist/**
  • stablepay-sdk/dist/umd/index.js is excluded by !**/dist/**
  • stablepay-sdk/dist/umd/index.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (1)
  • stablepay-sdk/src/widget/TransactionReview.jsx (2 hunks)

@r9jdp
Copy link
Author

r9jdp commented Dec 13, 2025

@Tanya-ruby I have edited the TransactionReview.jsx to use getExplorerUrl instead of hardcoded Mordor URL.

@r9jdp
Copy link
Author

r9jdp commented Dec 13, 2025

@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 ?

I tested this everything is working with the Merchant demo website,
But when i confirm the payment from my wallet the Merchant demo frontend is has a failed to fetch issue.

@Tanya-ruby
Copy link
Contributor

@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 ?

I tested this everything is working with the Merchant demo website, But when i confirm the payment from my wallet the Merchant demo frontend is has a failed to fetch issue.

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?

@r9jdp r9jdp force-pushed the Ethereum_classic_mainnet_support branch from 3312c55 to 8d96fea Compare December 14, 2025 00:56
@Tanya-ruby
Copy link
Contributor

@r9jdp did u test it ? working as required ?

let me know and share a recording , i am planning it to move to hard

@Tanya-ruby
Copy link
Contributor

@r9jdp moved it to hard ,let me know if you were able to test this ?

@r9jdp
Copy link
Author

r9jdp commented Dec 14, 2025

@r9jdp moved it to hard ,let me know if you were able to test this ?

Iam testing will share a screen recording

@r9jdp
Copy link
Author

r9jdp commented Dec 14, 2025

@r9jdp moved it to hard ,let me know if you were able to test this ?

pr5.mp4

@Tanya-ruby
Copy link
Contributor

@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

@Tanya-ruby
Copy link
Contributor

@r9jdp found it ! So when u make a tx choosing etc mainnet , it is getting connected to testnet .Can you investigate this ?

@Tanya-ruby
Copy link
Contributor

@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

@r9jdp
Copy link
Author

r9jdp commented Dec 14, 2025

@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
There is an issue i guess in it

image

@r9jdp
Copy link
Author

r9jdp commented Dec 14, 2025

@Tanya-ruby Also

@r9jdp found it ! So when u make a tx choosing etc mainnet , it is getting connected to testnet .Can you investigate this ?

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 :
const BLOCKSCOUT_ENDPOINTS: Record<string, string> = {
"ethereum-classic": "https://etc-mordor.blockscout.com/api", // Uses Mordor testnet under the hood
"sepolia": "https://eth-sepolia.blockscout.com/api",
"milkomeda-mainnet": "https://explorer-mainnet-cardano-evm.c1.milkomeda.com/api",
}

This maybe causing an issue

@r9jdp
Copy link
Author

r9jdp commented Dec 14, 2025

@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

@Tanya-ruby
Copy link
Contributor

Tanya-ruby commented Dec 14, 2025

@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

@Tanya-ruby
Copy link
Contributor

@r9jdp can you provide the tx hash ? let me check it from my end for mordort testnet

@Tanya-ruby
Copy link
Contributor

@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

@r9jdp
Copy link
Author

r9jdp commented Dec 15, 2025

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Ethereum Classic Mainnet Support and Rename Testnet to Mordor in StablePay SDK

2 participants