Skip to content

Commit

Permalink
Add Cronos mainnet and latest testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinaco committed Nov 28, 2021
1 parent 564e8cb commit 728a564
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { AppstoreOutlined, SettingOutlined } from '@ant-design/icons';
import './App.css';
import AddChainButton from './AddChainButton';
import { Cronostestnet_338_2 } from './chain/cronostestnet_338-2';
import { Cronosmainnet_25_1 } from './chain/cronosmainnet_25_1';
import { Cronostestnet_338_3 } from './chain/cronostestnet_338-3';
import { Testnet_Croeseid_4 } from './chain/testnet-croeseid-4';
import AddChainForm from './AddChainForm';

Expand Down Expand Up @@ -31,6 +33,8 @@ function App() {
title="Quick Add Chains"
/ >
<ul className="ChainList">
<li><AddChainButton network={Cronosmainnet_25_1} /></li>
<li><AddChainButton network={Cronostestnet_338_3} /></li>
<li><AddChainButton network={Cronostestnet_338_2} /></li>
<li><AddChainButton network={Testnet_Croeseid_4} /></li>
</ul>
Expand Down
95 changes: 95 additions & 0 deletions src/chain/cronosmainnet_25_1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { KeplrChainConfig } from "../keplr/types";

export const Cronosmainnet_25_1: KeplrChainConfig = {
// Chain-id of the Cosmos SDK chain.
chainId: "cronosmainnet_25-1",
// The name of the chain to be displayed to the user.
chainName: "Cronos",
// RPC endpoint of the chain.
rpc: "https://rpc-cronos.crypto.org",
// REST endpoint of the chain.
rest: "https://rest-cronos.crypto.org",
// Staking coin information
stakeCurrency: {
// Coin denomination to be displayed to the user.
coinDenom: "CRO",
// Actual denom (i.e. uatom, uscrt) used by the blockchain.
coinMinimalDenom: "basecro",
// # of decimal points to convert minimal denomination to user-facing denomination.
coinDecimals: 18,
// (Optional) Keplr can show the fiat value of the coin if a coingecko id is provided.
// You can get id from https://api.coingecko.com/api/v3/coins/list if it is listed.
coinGeckoId: "crypto-com-chain"
},
// (Optional) If you have a wallet webpage used to stake the coin then provide the url to the website in `walletUrlForStaking`.
// The 'stake' button in Keplr extension will link to the webpage.
// walletUrlForStaking: "",
// The BIP44 path.
bip44: {
// You can only set the coin type of BIP44.
// 'Purpose' is fixed to 44.
coinType: 60,
},
// Bech32 configuration to show the address to user.
// This field is the interface of
// {
// bech32PrefixAccAddr: string;
// bech32PrefixAccPub: string;
// bech32PrefixValAddr: string;
// bech32PrefixValPub: string;
// bech32PrefixConsAddr: string;
// bech32PrefixConsPub: string;
// }
bech32Config: {
bech32PrefixAccAddr: "crc",
bech32PrefixAccPub: "crcpub",
bech32PrefixValAddr: "crcvaloper",
bech32PrefixValPub: "crcvaloperpub",
bech32PrefixConsAddr: "crcvalcons",
bech32PrefixConsPub: "crcvalconspub",
},
// List of all coin/tokens used in this chain.
currencies: [
{
// Coin denomination to be displayed to the user.
coinDenom: "CRO",
// Actual denom (i.e. uatom, uscrt) used by the blockchain.
coinMinimalDenom: "basecro",
// # of decimal points to convert minimal denomination to user-facing denomination.
coinDecimals: 18,
// (Optional) Keplr can show the fiat value of the coin if a coingecko id is provided.
// You can get id from https://api.coingecko.com/api/v3/coins/list if it is listed.
coinGeckoId: "crypto-com-chain"
},
],
// List of coin/tokens used as a fee token in this chain.
feeCurrencies: [
{
// Coin denomination to be displayed to the user.
coinDenom: "CRO",
// Actual denom (i.e. uatom, uscrt) used by the blockchain.
coinMinimalDenom: "basecro",
// # of decimal points to convert minimal denomination to user-facing denomination.
coinDecimals: 18,
// (Optional) Keplr can show the fiat value of the coin if a coingecko id is provided.
// You can get id from https://api.coingecko.com/api/v3/coins/list if it is listed.
coinGeckoId: "crypto-com-chain"
},
],
// (Optional) The number of the coin type.
// This field is only used to fetch the address from ENS.
// Ideally, it is recommended to be the same with BIP44 path's coin type.
// However, some early chains may choose to use the Cosmos Hub BIP44 path of '118'.
// So, this is separated to support such chains.
coinType: 60,
// (Optional) This is used to set the fee of the transaction.
// If this field is not provided, Keplr extension will set the default gas price as (low: 0.01, average: 0.025, high: 0.04).
// Currently, Keplr doesn't support dynamic calculation of the gas prices based on on-chain data.
// Make sure that the gas prices are higher than the minimum gas prices accepted by chain validators and RPC/REST endpoint.
gasPriceStep: {
low: 5000000000000,
average: 5000000000000,
high: 5000000000000,
},
features: ["stargate", "ibc-transfer"],
};
95 changes: 95 additions & 0 deletions src/chain/cronostestnet_338-3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { KeplrChainConfig } from "../keplr/types";

export const Cronostestnet_338_3: KeplrChainConfig = {
// Chain-id of the Cosmos SDK chain.
chainId: "cronostestnet_338-3",
// The name of the chain to be displayed to the user.
chainName: "Cronos Testnet 3",
// RPC endpoint of the chain.
rpc: "https://cronos-testnet-3.crypto.org:26657",
// REST endpoint of the chain.
rest: "https://cronos-testnet-3.crypto.org:1317",
// Staking coin information
stakeCurrency: {
// Coin denomination to be displayed to the user.
coinDenom: "TCRO",
// Actual denom (i.e. uatom, uscrt) used by the blockchain.
coinMinimalDenom: "basetcro",
// # of decimal points to convert minimal denomination to user-facing denomination.
coinDecimals: 18,
// (Optional) Keplr can show the fiat value of the coin if a coingecko id is provided.
// You can get id from https://api.coingecko.com/api/v3/coins/list if it is listed.
// coinGeckoId: ""
},
// (Optional) If you have a wallet webpage used to stake the coin then provide the url to the website in `walletUrlForStaking`.
// The 'stake' button in Keplr extension will link to the webpage.
// walletUrlForStaking: "",
// The BIP44 path.
bip44: {
// You can only set the coin type of BIP44.
// 'Purpose' is fixed to 44.
coinType: 60,
},
// Bech32 configuration to show the address to user.
// This field is the interface of
// {
// bech32PrefixAccAddr: string;
// bech32PrefixAccPub: string;
// bech32PrefixValAddr: string;
// bech32PrefixValPub: string;
// bech32PrefixConsAddr: string;
// bech32PrefixConsPub: string;
// }
bech32Config: {
bech32PrefixAccAddr: "tcrc",
bech32PrefixAccPub: "tcrcpub",
bech32PrefixValAddr: "tcrcvaloper",
bech32PrefixValPub: "tcrcvaloperpub",
bech32PrefixConsAddr: "tcrcvalcons",
bech32PrefixConsPub: "tcrcvalconspub",
},
// List of all coin/tokens used in this chain.
currencies: [
{
// Coin denomination to be displayed to the user.
coinDenom: "TCRO",
// Actual denom (i.e. uatom, uscrt) used by the blockchain.
coinMinimalDenom: "basetcro",
// # of decimal points to convert minimal denomination to user-facing denomination.
coinDecimals: 18,
// (Optional) Keplr can show the fiat value of the coin if a coingecko id is provided.
// You can get id from https://api.coingecko.com/api/v3/coins/list if it is listed.
// coinGeckoId: ""
},
],
// List of coin/tokens used as a fee token in this chain.
feeCurrencies: [
{
// Coin denomination to be displayed to the user.
coinDenom: "TCRO",
// Actual denom (i.e. uatom, uscrt) used by the blockchain.
coinMinimalDenom: "basetcro",
// # of decimal points to convert minimal denomination to user-facing denomination.
coinDecimals: 18,
// (Optional) Keplr can show the fiat value of the coin if a coingecko id is provided.
// You can get id from https://api.coingecko.com/api/v3/coins/list if it is listed.
// coinGeckoId: ""
},
],
// (Optional) The number of the coin type.
// This field is only used to fetch the address from ENS.
// Ideally, it is recommended to be the same with BIP44 path's coin type.
// However, some early chains may choose to use the Cosmos Hub BIP44 path of '118'.
// So, this is separated to support such chains.
coinType: 60,
// (Optional) This is used to set the fee of the transaction.
// If this field is not provided, Keplr extension will set the default gas price as (low: 0.01, average: 0.025, high: 0.04).
// Currently, Keplr doesn't support dynamic calculation of the gas prices based on on-chain data.
// Make sure that the gas prices are higher than the minimum gas prices accepted by chain validators and RPC/REST endpoint.
gasPriceStep: {
low: 5000000000000,
average: 5000000000000,
high: 5000000000000,
},
features: ["stargate", "ibc-transfer"],
};
1 change: 1 addition & 0 deletions src/keplr/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface Currency {
coinDenom?: string;
coinMinimalDenom?: string;
coinDecimals?: number;
coinGeckoId?: string;
}

export interface GasPriceStep {
Expand Down

0 comments on commit 728a564

Please sign in to comment.