Skip to content

Commit

Permalink
chore(docs): update readme to include setting up new network (#160)
Browse files Browse the repository at this point in the history
* chore: update readme

* Update README.md

Co-authored-by: Anil Kumar Kammari <[email protected]>
  • Loading branch information
aleem1314 and anilcse authored Sep 2, 2022
1 parent dbc0bfd commit b9f7784
Show file tree
Hide file tree
Showing 5 changed files with 384 additions and 321 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ Supported features:
- [ ] Groups
- [x] Multisig

## Adding new network

To add mainet use one of template from the `example` directory and add it to the `mainNets` object in `src/utils/networks.ts`.
To add testnet use one of template from the `example` directory and add it to the `testNets` object in `src/utils/networks.ts`.

* If your network is already registered with Keplr use `example/chain.json` template.
* To register your network with keplr use `example/experimental.json` template.

## Install deps
```bash
# clone the repo with git and checkout to master
$ git clone https://github.com/vitwit/Staking.git
$ cd Staking
$ git clone https://github.com/vitwit/resolute.git
$ cd resolute
$ git checkout master
$ yarn
```
Expand Down
28 changes: 28 additions & 0 deletions examples/chain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"showAirdrop": false,
"logos": {
"menu": "https://raw.githubusercontent.com/vitwit/chain-registry/08711dbf4cbc12d37618cecd290ad756c07d538b/cosmoshub/images/cosmoshub.svg",
"toolbar": "https://raw.githubusercontent.com/vitwit/chain-registry/08711dbf4cbc12d37618cecd290ad756c07d538b/cosmoshub/images/cosmoshub-logo.png"
},
"experimental": false,
"isTestnet": false,
"explorerTxHashEndpoint": "https://www.mintscan.io/cosmos/txs/",
"config": {
"chainId": "cosmoshub-4",
"chainName": "Cosmos Hub",
"rest": "https://resolute.witval.com/cosmos_api",
"rpc": "https://resolute.witval.com/cosmos_rpc/",
"gasPriceStep": { "low": 0.01, "average": 0.025, "high": 0.03 },
"currencies": [
{ "coinDenom": "ATOM", "coinMinimalDenom": "uatom", "coinDecimals": 6 }
],
"bech32Config": {
"bech32PrefixAccAddr": "cosmos",
"bech32PrefixAccPub": "cosmospub",
"bech32PrefixValAddr": "cosmosvaloper",
"bech32PrefixValPub": "cosmosvaloperpub",
"bech32PrefixConsAddr": "cosmosgvalcons",
"bech32PrefixConsPub": "cosmosvalconspub"
}
}
}
50 changes: 50 additions & 0 deletions examples/experimental-chain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"experimental": true,
"showAirdrop": false,
"logos": {
"toolbar": "https://raw.githubusercontent.com/vitwit/chain-registry/aleem/staking-assets/passage3d/images/passage3d-logo.png",
"menu": "https://raw.githubusercontent.com/vitwit/chain-registry/aleem/staking-assets/passage3d/images/passage.png"
},
"isTestnet": false,
"explorerTxHashEndpoint": "https://passage.aneka.io/txs/",
"config": {
"chainId": "passage-1",
"chainName": "Passage",
"rest": "https://api.passage.vitwit.com/",
"rpc": "https://rpc.passage.vitwit.com",
"stakeCurrency": {
"coinDenom": "PASG",
"coinMinimalDenom": "upasg",
"coinDecimals": 6,
"coinGeckoId": "passage3d"
},
"bip44": { "coinType": 118 },
"bech32Config": {
"bech32PrefixAccAddr": "pasg",
"bech32PrefixAccPub": "pasgpub",
"bech32PrefixValAddr": "pasgvaloper",
"bech32PrefixValPub": "pasgvaloperpub",
"bech32PrefixConsAddr": "pasgvalcons",
"bech32PrefixConsPub": "pasgvalconspub"
},
"currencies": [
{
"coinDenom": "PASG",
"coinMinimalDenom": "upasg",
"coinDecimals": 6,
"coinGeckoId": "passage"
}
],
"feeCurrencies": [
{
"coinDenom": "PASG",
"coinMinimalDenom": "upasg",
"coinDecimals": 6,
"coinGeckoId": "passage"
}
],
"coinType": 118,
"gasPriceStep": { "low": 0.0, "average": 0.0, "high": 0.0 },
"walletUrlForStaking": "https://airdrop.passage3d.com/staking"
}
}
60 changes: 60 additions & 0 deletions src/utils/network.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
type Currency = {
coinDenom: string;
coinMinimalDenom: string;
coinDecimals: number;
coinGeckoId?: string;
};

type Logos = { toolbar: string; menu: string };

type StakeCurrency = {
coinDenom: string;
coinMinimalDenom: string;
coinDecimals: number;
coinGeckoId?: string;
};

type BIP44 = { coinType: number };

type GasPrice = { low: number; average: number; high: number };

type Bech32Config = {
bech32PrefixAccAddr: string;
bech32PrefixAccPub: string;
bech32PrefixValAddr: string;
bech32PrefixValPub: string;
bech32PrefixConsAddr: string;
bech32PrefixConsPub: string;
};

interface NetworkConfig {
chainId: string;
chainName: string;
rest: string;
rpc: string;
stakeCurrency?: StakeCurrency;
bip44?: BIP44;
bech32Config: Bech32Config;
currencies: Currency[];
feeCurrencies?: Currency[];
coinType?: number;
gasPriceStep: GasPrice;
walletUrlForStaking?: string;
}

interface AirdropAction {
type: string;
title: string;
redirect?: string;
}

interface Network {
showAirdrop: boolean;
logos: Logos;
experimental: boolean;
isTestnet: boolean;
explorerTxHashEndpoint: string;
config: NetworkConfig;
airdropMessage?: string;
airdropActions?: AirdropAction[];
}
Loading

0 comments on commit b9f7784

Please sign in to comment.