Skip to content

Instantly share code, notes, and snippets.

@Toktar
Last active November 26, 2021 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Toktar/20ebfaf0fac1e822563a4c8309750dd0 to your computer and use it in GitHub Desktop.
Save Toktar/20ebfaf0fac1e822563a4c8309750dd0 to your computer and use it in GitHub Desktop.
suggest-chain.md for Keplr
await window.keplr.experimentalSuggestChain({
chainId: "cheqd-mainnet-1",
chainName: "cheqd",
rpc: "https://rpc.cheqd.net",
rest: "https://api.cheqd.net",
bip44: {
coinType: 118,
},
bech32Config: {
bech32PrefixAccAddr: "cheqd",
bech32PrefixAccPub: "cheqd" + "pub",
bech32PrefixValAddr: "cheqd" + "valoper",
bech32PrefixValPub: "cheqd" + "valoperpub",
bech32PrefixConsAddr: "cheqd" + "valcons",
bech32PrefixConsPub: "cheqd" + "valconspub",
},
currencies: [
{
coinDenom: "CHEQ",
coinMinimalDenom: "ncheq",
coinDecimals: 9,
coinGeckoId: "cheqd",
},
],
feeCurrencies: [
{
coinDenom: "CHEQ",
coinMinimalDenom: "ncheq",
coinDecimals: 9,
coinGeckoId: "cheqd",
},
],
stakeCurrency: {
coinDenom: "CHEQ",
coinMinimalDenom: "ncheq",
coinDecimals: 9,
coinGeckoId: "cheqd",
},
coinType: 118,
gasPriceStep: {
low: 25,
average: 50,
high: 100,
},
});
@ankurdotb
Copy link

@Toktar
Copy link
Author

Toktar commented Nov 16, 2021

I suggest the following value for gasPriceStep for 1gas = 25ncheq:
https://gist.github.com/Toktar/20ebfaf0fac1e822563a4c8309750dd0#file-suggest-chain-js-L40-L44

gasPriceStep: {
        low: 0.000000025,
        average: 0.00000005,
        high: 0.0000001,
    },

Because of this piece of Keplr codebase:
https://github.com/chainapsis/keplr-extension/blob/2229367b58076fc6426bf956bd1215d6ab0deb3c/packages/hooks/src/tx/fee.ts#L155-L167

 const gasPriceStep = this.chainInfo.gasPriceStep
      ? this.chainInfo.gasPriceStep
      : DefaultGasPriceStep;

    const gasPrice = new Dec(gasPriceStep[feeType].toString());
    const feeAmount = gasPrice.mul(new Dec(this.gasConfig.gas));

    return {
      denom: this.feeCurrency.coinMinimalDenom,
      amount: feeAmount.truncate().toString(),
    };
  }

But a bit confused because of usual configs, for example, for Secret Network (SCRT) :
https://github.com/chainapsis/keplr-extension/blob/98942684ba47e5a7a411ae12fbc0f15f746c62af/packages/mobile/src/config.ts#L156-L160

    gasPriceStep: {
      low: 0.1,
      average: 0.25,
      high: 0.3,
    },

That means 1gas = 100 000 uscrt and looks too much

@ankurdotb
Copy link

100000 uscrt is not too high btw as gas, I would expect that tbh.

just spoke to Alex and we can express as 25ncheq, 50ncheq, 100ncheq as the gasPriceSteps

@Toktar
Copy link
Author

Toktar commented Nov 16, 2021

Updated gasPriceStep after discussion with Alex

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