Skip to content

Commit

Permalink
Add keplr chain info
Browse files Browse the repository at this point in the history
  • Loading branch information
giansalex committed May 18, 2022
1 parent c9fa518 commit f19563d
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion gnoland/website/static/js/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ walletFn.createSignDoc = function(account, msg, chainId, gas) {
};

walletFn.keplr.signAndBroadcast = function(sender, msg) {
return window.keplr.enable(chainId).then(function () {
return window.keplr.experimentalSuggestChain(walletFn.geTestnetKeplrConfig())
.then(function () {
return window.keplr.enable(chainId);
})
.then(function () {
return walletFn.getAccount(sender);
})
.then(function(account) {
Expand All @@ -46,6 +50,37 @@ walletFn.keplr.signAndBroadcast = function(sender, msg) {
});
};

walletFn.geTestnetKeplrConfig = function() {
const addressPrefix = "g";
const gnoToken = {
coinDenom: "GNOT",
coinMinimalDenom: "gnot",
coinDecimals: 6,
// coinGeckoId: ""
};

return {
chainId: chainId,
chainName: "GNO Testnet",
rpc: 'http://gno.land:36657',
rest: 'https://lcd.gno.tools',
bech32Config: {
bech32PrefixAccAddr: `${addressPrefix}`,
bech32PrefixAccPub: `${addressPrefix}pub`,
bech32PrefixValAddr: `${addressPrefix}valoper`,
bech32PrefixValPub: `${addressPrefix}valoperpub`,
bech32PrefixConsAddr: `${addressPrefix}valcons`,
bech32PrefixConsPub: `${addressPrefix}valconspub`,
},
currencies: [gnoToken],
feeCurrencies: [gnoToken],
stakeCurrency: gnoToken,
bip44: { coinType: 118 },
// custom feature for GNO chains.
features: ["gno"]
};
};

walletFn.makeStdTx = function(content, signature) {
const feeAmount = content.fee.amount;

Expand Down

0 comments on commit f19563d

Please sign in to comment.