Mount custom network config file in container

This commit is contained in:
IshaVenikar 2025-05-27 16:33:18 +05:30
parent 1745842c96
commit 9be0542dd3
3 changed files with 26 additions and 65 deletions

View File

@ -1,45 +0,0 @@
{
"chainId": "laconic-mainnet",
"chainName": "Laconic",
"rpc": "http://localhost:26657",
"rest": "https://localhost:1317",
"bip44": {
"coinType": 118
},
"bech32Config": {
"bech32PrefixAccAddr": "laconic",
"bech32PrefixAccPub": "laconipub",
"bech32PrefixValAddr": "laconicvaloper",
"bech32PrefixValPub": "laconicvaloperpub",
"bech32PrefixConsAddr": "laconicvalcons",
"bech32PrefixConsPub": "laconicvalconspub"
},
"currencies": [
{
"coinDenom": "ALNT",
"coinMinimalDenom": "alnt",
"coinDecimals": 18
}
],
"feeCurrencies": [
{
"coinDenom": "ALNT",
"coinMinimalDenom": "alnt",
"coinDecimals": 18
}
],
"stakeCurrency": {
"coinDenom": "ALNT",
"coinMinimalDenom": "alnt",
"coinDecimals": 18
},
"gasPriceStep": {
"low": 0.01,
"average": 0.01,
"high": 0.02
},
"features": [
"stargate",
"ibc-transfer"
]
}

View File

@ -20,10 +20,12 @@ services:
NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE}
NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX}
NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED:-false}
CHAIN_CONFIG_PATH: ${CHAIN_CONFIG_PATH}
command: ["bash", "/cosmos-script/run.sh"]
volumes:
- ../config/cosmos-multisig-ui/run.sh:/cosmos-script/run.sh
- ../config/cosmos-multisig-ui/db-schema.graphql:/cosmos-script/db-schema.graphql
- ${CHAIN_CONFIG_PATH:-../config/cosmos-multisig-ui/custom-network.json}:/app/public/assets/custom-network.json
ports:
- "3000"
healthcheck:

View File

@ -9,24 +9,28 @@ declare global {
}
export const suggestChainToKeplr = async () => {
try {
if (typeof window === 'undefined') {
console.error('This code must be run in a browser environment.');
return;
}
if (!window.keplr) {
console.error('Keplr wallet not found. Please install the Keplr browser extension: https://www.keplr.app/');
return;
}
const response = await fetch('/assets/laconic-network.json');
const chainConfig = await response.json();
await window.keplr.experimentalSuggestChain(chainConfig);
console.log('Successfully suggested chain to Keplr');
} catch (error) {
console.error('Error suggesting chain to Keplr:', error);
try {
if (typeof window === 'undefined') {
console.error('Method experimentalSuggestChain must be run in a browser environment.');
return;
}
};
if (!window.keplr) {
console.error('Keplr wallet not found. Please install the Keplr browser extension: https://www.keplr.app/');
return;
}
const response = await fetch('/assets/custom-network.json');
if (!response.ok) {
console.warn(`Chain config file not found. Skipping Keplr suggestion.`);
return;
}
const chainConfig = await response.json();
await window.keplr.experimentalSuggestChain(chainConfig);
console.log('Successfully suggested chain to Keplr');
} catch (error) {
console.error('Error suggesting chain to Keplr:', error);
}
};