Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chain versions #277

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion chains/mainnet/andromeda.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
coinType: '118',
baseAsset: 'uandr',
name: 'Andromeda',
version: "0.46",
icon: process.env.CF_PAGES_URL + '/img/chains/Andromeda.png',
channels: {
// 'secret-1': 'channel-2',
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/carbon.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module.exports = {
name: "Carbon",
icon: process.env.CF_PAGES_URL + "/img/chains/Carbon.svg",
alliance: true,
version: "0.46",
channels: {
"phoenix-1": "channel-12",
"axelar-dojo-1": "channel-7",
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/celestia.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
coinType: '118',
baseAsset: 'utia',
name: 'Celestia',
version: "0.46",
icon: process.env.CF_PAGES_URL + '/img/chains/Celestia.svg',
channels: {
'osmosis-1': 'channel-2',
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/cheqd.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
coinType: '118',
baseAsset: 'ncheq',
name: 'Cheqd',
version: "0.46",
icon: process.env.CF_PAGES_URL + '/img/chains/Cheqd.svg',
channels: {
'phoenix-1': 'channel-34',
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/chihuahua.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
coinType: '118',
baseAsset: 'uhuahua',
name: 'Chihuahua',
version: "0.46",
icon: process.env.CF_PAGES_URL + '/img/chains/Huahua.png',
channels: {
'phoenix-1': 'channel-34',
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/comdex.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
coinType: '118',
baseAsset: 'ucmdx',
name: 'Comdex',
version: "0.46",
icon: process.env.CF_PAGES_URL + '/img/chains/Comdex.svg',
channels: {
'phoenix-1': 'channel-51',
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/dydx.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
coinType: '118',
baseAsset: 'adydx',
name: 'dYdX Protocol',
version: "0.46",
icon: process.env.CF_PAGES_URL + '/img/chains/dydx.svg',
channels: {
'kaiyo-1': 'channel-5',
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/injective.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
coinType: '60',
baseAsset: 'inj',
name: 'Injective',
version: '0.46',
icon: process.env.CF_PAGES_URL + '/img/chains/Injective.svg',
channels: {
'phoenix-1': 'channel-151',
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/kujira.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
chainID: 'kaiyo-1',
lcd: 'https://lcd-kujira.tfl.foundation',
gasAdjustment: 1.75,
version: "0.46",
gasPrices: {
ukuji: 0.0051,
'ibc/DA59C009A0B3B95E0549E6BF7B075C8239285989FF457A8EDDBB56F10B2A6986': 0.02243,
Expand Down
2 changes: 0 additions & 2 deletions chains/mainnet/mars.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ module.exports = {
baseAsset: 'umars',
name: 'Mars',
icon: process.env.CF_PAGES_URL + '/img/chains/Mars.svg',
// used by Station to decide which endpoint to use
version: '0.46',
channels: {
'phoenix-1': 'channel-2',
'crescent-1': 'channel-5',
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/migaloo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
coinType: '118',
baseAsset: 'uwhale',
name: 'Migaloo',
version: "0.46",
icon: process.env.CF_PAGES_URL + '/img/chains/Migaloo.svg',
alliance: true,
channels: {
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/osmosis.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
chainID: 'osmosis-1',
lcd: 'https://lcd-osmosis.tfl.foundation',
gasAdjustment: 1.5,
version: '0.46',
gasPrices: {
uosmo: {
type: 'OSMOSIS',
Expand Down
1 change: 0 additions & 1 deletion chains/mainnet/stride.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
coinType: '118',
baseAsset: 'ustrd',
name: 'Stride',
version: '0.46',
icon: process.env.CF_PAGES_URL + '/img/chains/Stride.png',
channels: {
'phoenix-1': 'channel-52',
Expand Down
1 change: 0 additions & 1 deletion chains/testnet/mars.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = {
'pisco-1': 'channel-0',
},
// used by Station to decide which endpoint to use
version: '0.46',
explorer: {
address: 'https://testnet-explorer.marsprotocol.io/accounts/{}',
tx: 'https://testnet-explorer.marsprotocol.io/transactions/{}',
Expand Down
28 changes: 27 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const fs = require('fs').promises
network,
}))
)

const version = await getSDKVersion(chainData.lcd)
if (version) chainData.version = version
delete chainData['tokens']

const gasPrices = Object.fromEntries(
Expand Down Expand Up @@ -208,3 +209,28 @@ function isValidUrl(url) {
return false
}
}

const getSDKVersion = async (lcd) => {
try {
const response = await axios.get(`${lcd}/node_info`);
if (response.status === 200) {
let version = response.data.application_version.cosmos_sdk_version;
version = version.substring(1); // remove the 'v'
version = version.split('.').slice(0, 2).join('.'); // keep only the first two parts
return parseFloat(version);
}
} catch (error) {
console.error(`Failed to get the SDK version from ${lcd} using /node_info, error: ${error.message}`);
// Attempt the second request if the first fails
try {
const response = await axios.get(`${lcd}/cosmos/gov/v1/proposals?pagination.limit=1`);
if (response.status === 200) {
return 0.46; // if supports v1 proposals then at least 0.46
}
} catch (error) {
console.error(`Failed to get the SDK version from ${lcd} using /cosmos/gov/v1/proposals, error: ${error.message}`);;
}
}
}


Loading