Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CamDL and CamDL Testnet to the supported network #308

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ Upon installation, a configuration folder will be created at `~/.config/open-att

## Supported networks

| Network ID | Name | Network | Type |
| ---------- | ------------------------ | ------------ | ---------- |
| `1` | Ethereum Mainnet | `mainnet` | Production |
| `11155111` | Ethereum Testnet Sepolia | `sepolia` | Test |
| `137` | Polygon Mainnet | `polygon` | Production |
| `80002` | Polygon Testnet Amoy | `Amoy` | Test |
| `50` | XDC Network | `xdc` | Production |
| `51` | XDC Apothem Network | `xdcapothem` | Test |

| Network ID | Name | Network | Type |
| ---------- | ------------------------ | --------------- | ---------- |
| `1` | Ethereum Mainnet | `mainnet` | Production |
| `11155111` | Ethereum Testnet Sepolia | `sepolia` | Test |
| `137` | Polygon Mainnet | `polygon` | Production |
| `80002` | Polygon Testnet Amoy | `Amoy` | Test |
| `50` | XDC Network | `xdc` | Production |
| `51` | XDC Apothem Network | `xdcapothem` | Test |
| `95` | CamDL Network | `camdl` | Production |
| `395` | CamDL Test Network | `camdl-testnet` | Test |

---

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/commands/config/config.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export enum TestNetwork {
Sepolia = "sepolia",
Amoy = "amoy (polygon)",
Apothem = "apothem (xdc)",
CamdlTestnet = "camdl (testnet)",
}
3 changes: 2 additions & 1 deletion src/commands/config/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const handler = async (args: CreateConfigCommand): Promise<void> => {
args.configTemplatePath = configTemplatePath;
}

const networks = [TestNetwork.Local, TestNetwork.Sepolia, TestNetwork.Amoy, TestNetwork.Apothem];
const networks = [TestNetwork.Local, TestNetwork.Sepolia, TestNetwork.Amoy, TestNetwork.Apothem, TestNetwork.CamdlTestnet];
const { network } = await inquirer.prompt({
type: "list",
name: "network",
Expand All @@ -84,6 +84,7 @@ const convertNetworkToNetworkCmdName = (selectedNetwork: TestNetwork): NetworkCm
[TestNetwork.Sepolia]: NetworkCmdName.Sepolia,
[TestNetwork.Amoy]: NetworkCmdName.Amoy,
[TestNetwork.Apothem]: NetworkCmdName.XDCApothem,
[TestNetwork.CamdlTestnet]: NetworkCmdName.CamdlTestnet,
};
return network[selectedNetwork];
};
18 changes: 17 additions & 1 deletion src/common/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { providers } from "ethers";
import type { GasStationFunction } from "./gas-station";
import { gasStation } from "./gas-station";

export type networkCurrency = "ETH" | "MATIC" | "XDC";
export type networkCurrency = "ETH" | "MATIC" | "XDC" | "CADL";

type SupportedNetwork = {
explorer: string;
Expand All @@ -21,6 +21,8 @@ export enum NetworkCmdName {
Amoy = "amoy",
XDC = "xdc",
XDCApothem = "xdcapothem",
Camdl = "camdl",
CamdlTestnet = "camdl-testnet",
}

const defaultInfuraProvider =
Expand Down Expand Up @@ -87,6 +89,20 @@ export const supportedNetwork: {
networkName: NetworkCmdName.XDCApothem,
currency: "XDC",
},
[NetworkCmdName.Camdl]: {
explorer: "https://explorer.camdl.gov.kh",
provider: jsonRpcProvider("https://rpc1.camdl.gov.kh"),
networkId: 95,
networkName: NetworkCmdName.Camdl,
currency: "CADL",
},
[NetworkCmdName.CamdlTestnet]: {
explorer: "https://explorer.testnet.camdl.gov.kh",
provider: jsonRpcProvider("https://rpc1.testnet.camdl.gov.kh"),
networkId: 395,
networkName: NetworkCmdName.CamdlTestnet,
currency: "CADL",
},
};

export const getSupportedNetwork = (networkCmdName: string): SupportedNetwork => {
Expand Down