Created
June 20, 2023 17:43
-
-
Save mikedotexe/d64840e25051fbddec5ecd67350219e5 to your computer and use it in GitHub Desktop.
Switching Cosmos networks and printing gas flags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function set_cosmos_cli_config { | |
# If you're using a pretty old shell, might remove "local" | |
local cmd="$1" | |
local chain_id="$2" | |
local node="$3" | |
local gas_prices="$4" | |
local echo_str="$5" | |
"$cmd" config chain-id "$chain_id" | |
"$cmd" config node "$node" | |
# Check if a gas price was provided before setting it | |
if [ -n "$gas_prices" ]; then | |
"$cmd" config gas-prices "$gas_prices" | |
fi | |
# Print the echo string | |
echo "$echo_str" | |
} | |
# Osmosis | |
function om { | |
set_cosmos_cli_config "osmosisd" "osmosis-1" "https://rpc.osmosis.zone:443" "" "--gas auto --gas-prices 0.1uosmo --gas-adjustment 1.7" | |
} | |
function ot { | |
set_cosmos_cli_config "osmosisd" "osmo-test-5" "https://rpc.osmotest5.osmosis.zone:443" "" "--gas auto --gas-prices 0.1uosmo --gas-adjustment 1.7" | |
} | |
# Neutron | |
function nm { | |
set_cosmos_cli_config "neutrond" "neutron-1" "https://neutron-rpc.polkachu.com:443" "" "--gas auto --gas-prices 0.025untrn --gas-adjustment 1.3" | |
} | |
function nt { | |
set_cosmos_cli_config "neutrond" "pion-1" "https://neutron-testnet-rpc.polkachu.com:443" "" "--gas auto --gas-prices 0.025untrn --gas-adjustment 1.3" | |
} | |
# Stargaze | |
function sm { | |
set_cosmos_cli_config "starsd" "stargaze-1" "https://rpc.stargaze-apis.com:443" "" "--gas auto --gas-prices 0.025ustars --gas-adjustment 1.7" | |
} | |
function st { | |
set_cosmos_cli_config "starsd" "elgafar-1" "https://rpc.elgafar-1.stargaze-apis.com:443" "" "--gas auto --gas-prices 0.025ustars --gas-adjustment 1.7" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: we don't need the
gas_prices
. I think I had that in there since before Juno did the cool thing, and juno was the only one that needed it since it'sujuno
andujunox
depending on the network.