-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
243 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env tsx | ||
import fsp from 'node:fs/promises'; | ||
import { ChainRegistryClient } from '@chain-registry/client'; | ||
import type { CosmosChainInfo } from '../src/cosmos-api.js'; | ||
|
||
// XXX script assumes it's run from the package path | ||
// XXX .json would be more apt but Endo bundler can't import that | ||
const outputFile = 'src/fetched-chain-info.js'; | ||
|
||
/** | ||
* Names for which to fetch info | ||
*/ | ||
const chainNames = [ | ||
'celestia', | ||
'cosmoshub', | ||
'dydx', | ||
'juno', | ||
'neutron', | ||
'noble', | ||
'omniflixhub', | ||
'osmosis', | ||
'secretnetwork', | ||
'stargaze', | ||
'stride', | ||
]; | ||
|
||
const client = new ChainRegistryClient({ | ||
chainNames, | ||
}); | ||
|
||
// chain info, assets and ibc data will be downloaded dynamically by invoking fetchUrls method | ||
await client.fetchUrls(); | ||
|
||
const chainInfo = {} as Record<string, CosmosChainInfo>; | ||
|
||
for (const name of chainNames) { | ||
const chain = client.getChain(name); | ||
chainInfo[name] = { | ||
chainId: chain.chain_id, | ||
stakingTokens: chain.staking?.staking_tokens, | ||
}; | ||
} | ||
|
||
await fsp.writeFile( | ||
outputFile, | ||
`export default ${JSON.stringify(chainInfo, null, 2)};`, | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
export default { | ||
"celestia": { | ||
"chainId": "celestia", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "utia" | ||
} | ||
] | ||
}, | ||
"cosmoshub": { | ||
"chainId": "cosmoshub-4", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "uatom" | ||
} | ||
] | ||
}, | ||
"dydx": { | ||
"chainId": "dydx-mainnet-1", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "adydx" | ||
} | ||
] | ||
}, | ||
"juno": { | ||
"chainId": "juno-1", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "ujuno" | ||
} | ||
] | ||
}, | ||
"neutron": { | ||
"chainId": "neutron-1", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "untrn" | ||
} | ||
] | ||
}, | ||
"noble": { | ||
"chainId": "noble-1", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "ustake" | ||
} | ||
] | ||
}, | ||
"omniflixhub": { | ||
"chainId": "omniflixhub-1", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "uflix" | ||
} | ||
] | ||
}, | ||
"osmosis": { | ||
"chainId": "osmosis-1", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "uosmo" | ||
} | ||
] | ||
}, | ||
"secretnetwork": { | ||
"chainId": "secret-4", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "uscrt" | ||
} | ||
] | ||
}, | ||
"stargaze": { | ||
"chainId": "stargaze-1", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "ustars" | ||
} | ||
] | ||
}, | ||
"stride": { | ||
"chainId": "stride-1", | ||
"stakingTokens": [ | ||
{ | ||
"denom": "ustrd" | ||
} | ||
] | ||
} | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
diff --git a/node_modules/@chain-registry/client/fetcher.js b/node_modules/@chain-registry/client/fetcher.js | ||
index 92177df..d4d9883 100644 | ||
--- a/node_modules/@chain-registry/client/fetcher.js | ||
+++ b/node_modules/@chain-registry/client/fetcher.js | ||
@@ -8,6 +8,7 @@ const utils_1 = require("@chain-registry/utils"); | ||
const bfs_path_1 = require("bfs-path"); | ||
const cross_fetch_1 = __importDefault(require("cross-fetch")); | ||
const chain_info_1 = require("./chain-info"); | ||
+const { error } = require("console"); | ||
const fetchUrl = (url) => { | ||
return (0, cross_fetch_1.default)(url).then((res) => { | ||
if (res.status >= 400) { | ||
@@ -152,7 +153,7 @@ class ChainRegistryFetcher { | ||
this.update(data); | ||
} | ||
async fetchUrls() { | ||
- return Promise.all(this.urls.map((url) => this.fetch(url))); | ||
+ return Promise.all(this.urls.map((url) => this.fetch(url).catch(reason => console.error("Failed to fetch", url)))); | ||
} | ||
} | ||
exports.ChainRegistryFetcher = ChainRegistryFetcher; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1096,6 +1096,30 @@ | |
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" | ||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== | ||
|
||
"@chain-registry/client@^1.47.4": | ||
version "1.47.4" | ||
resolved "https://registry.yarnpkg.com/@chain-registry/client/-/client-1.47.4.tgz#886233b5b718ca34c4ea9143fd3478009cd09f3c" | ||
integrity sha512-7e0MEY1xVyRScXTWK2T8u0j0NZn1vXctStdWGZsp9sLee0+2eSvZbW0uYIKdH+7XvwRhx+knkbBtKU29QHKjAA== | ||
dependencies: | ||
"@chain-registry/types" "^0.44.4" | ||
"@chain-registry/utils" "^1.45.4" | ||
bfs-path "^1.0.2" | ||
cross-fetch "^3.1.5" | ||
|
||
"@chain-registry/types@^0.44.4": | ||
version "0.44.4" | ||
resolved "https://registry.yarnpkg.com/@chain-registry/types/-/types-0.44.4.tgz#d903e9c35477da88026807c5cac4caed2235c4dd" | ||
integrity sha512-EHow6xgTM0pe5mfm7kp1ApbJI83Bb0vXaG+LBxLcGXC6VfqCIVcT7Ki5PsdbYfHrfekoH1urXORUJo51F4ihQA== | ||
|
||
"@chain-registry/utils@^1.45.4": | ||
version "1.45.4" | ||
resolved "https://registry.yarnpkg.com/@chain-registry/utils/-/utils-1.45.4.tgz#ab077fa5ee6e204bf7e60adb8f773702330049b9" | ||
integrity sha512-N0702U78CkucKA2e/g19/GFn9wEEJAeFvlDuX+vZ2cMmgAUuSCNXpYLV55crPaPq/s4RTeulJL7DVBb+irQQsg== | ||
dependencies: | ||
"@chain-registry/types" "^0.44.4" | ||
bignumber.js "9.1.2" | ||
sha.js "^2.4.11" | ||
|
||
"@colors/[email protected]": | ||
version "1.5.0" | ||
resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" | ||
|
@@ -3389,11 +3413,16 @@ | |
"@types/estree" "*" | ||
"@types/json-schema" "*" | ||
|
||
"@types/estree@*", "@types/[email protected]", "@types/estree@^1.0.0": | ||
"@types/estree@*": | ||
version "1.0.5" | ||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" | ||
integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== | ||
|
||
"@types/[email protected]": | ||
version "0.0.39" | ||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" | ||
integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== | ||
|
||
"@types/express-serve-static-core@^4.17.33": | ||
version "4.17.35" | ||
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.35.tgz#c95dd4424f0d32e525d23812aa8ab8e4d3906c4f" | ||
|
@@ -3695,7 +3724,7 @@ | |
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.7.1.tgz#f903a651fb004c75add08e4e9e207f169d4b98d7" | ||
integrity sha512-AmPmnGW1ZLTpWa+/2omPrPfR7BcbUU4oha5VIbSbS1a1Tv966bklvLNXxp3mrbc+P2j4MNOTfDffNsk4o0c6/w== | ||
|
||
"@typescript-eslint/[email protected]", "@typescript-eslint/typescript-estree@^7.7.1": | ||
"@typescript-eslint/[email protected]": | ||
version "7.7.1" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.7.1.tgz#5cafde48fe390fe1c1b329b2ce0ba8a73c1e87b2" | ||
integrity sha512-CXe0JHCXru8Fa36dteXqmH2YxngKJjkQLjxzoj6LYwzZ7qZvgsLSc+eqItCrqIop8Vl2UKoAi0StVWu97FQZIQ== | ||
|
@@ -4313,6 +4342,16 @@ better-sqlite3@^9.1.1: | |
bindings "^1.5.0" | ||
prebuild-install "^7.1.1" | ||
|
||
bfs-path@^1.0.2: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/bfs-path/-/bfs-path-1.0.2.tgz#9b5fa4b8c4ad226597fc4d2ee15398bdcc644a07" | ||
integrity sha512-KTKx2JJtAAAT7C/rJYDXXWA2VLPycAS4kwFktKsxUo0hj4UTtw/Gm5PJuY7Uf3xSlIQNo7HRCSWei2ivncVwbQ== | ||
|
||
[email protected]: | ||
version "9.1.2" | ||
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" | ||
integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== | ||
|
||
bin-links@^3.0.0: | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-3.0.3.tgz#3842711ef3db2cd9f16a5f404a996a12db355a6e" | ||
|
@@ -5112,6 +5151,13 @@ cosmjs-types@^0.9.0: | |
resolved "https://registry.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.9.0.tgz#c3bc482d28c7dfa25d1445093fdb2d9da1f6cfcc" | ||
integrity sha512-MN/yUe6mkJwHnCFfsNPeCfXVhyxHYW6c/xDUzrSbBycYzw++XvWDMJArXp2pLdgD6FQ8DW79vkPjeNKVrXaHeQ== | ||
|
||
cross-fetch@^3.1.5: | ||
version "3.1.8" | ||
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" | ||
integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg== | ||
dependencies: | ||
node-fetch "^2.6.12" | ||
|
||
cross-spawn@^6.0.5: | ||
version "6.0.5" | ||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" | ||
|
@@ -7103,7 +7149,7 @@ inflight@^1.0.4: | |
once "^1.3.0" | ||
wrappy "1" | ||
|
||
inherits@2, [email protected], inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: | ||
inherits@2, [email protected], inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: | ||
version "2.0.4" | ||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" | ||
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== | ||
|
@@ -8961,6 +9007,13 @@ node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7: | |
dependencies: | ||
whatwg-url "^5.0.0" | ||
|
||
node-fetch@^2.6.12: | ||
version "2.7.0" | ||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" | ||
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== | ||
dependencies: | ||
whatwg-url "^5.0.0" | ||
|
||
node-gyp-build@<4.0, node-gyp-build@^3.9.0: | ||
version "3.9.0" | ||
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-3.9.0.tgz#53a350187dd4d5276750da21605d1cb681d09e25" | ||
|
@@ -9936,7 +9989,26 @@ proto-list@~1.2.1: | |
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" | ||
integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= | ||
|
||
protobufjs@^6.8.8, protobufjs@^7.2.4, protobufjs@^7.2.6: | ||
protobufjs@^6.8.8: | ||
version "6.11.4" | ||
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.4.tgz#29a412c38bf70d89e537b6d02d904a6f448173aa" | ||
integrity sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw== | ||
dependencies: | ||
"@protobufjs/aspromise" "^1.1.2" | ||
"@protobufjs/base64" "^1.1.2" | ||
"@protobufjs/codegen" "^2.0.4" | ||
"@protobufjs/eventemitter" "^1.1.0" | ||
"@protobufjs/fetch" "^1.1.0" | ||
"@protobufjs/float" "^1.0.2" | ||
"@protobufjs/inquire" "^1.1.0" | ||
"@protobufjs/path" "^1.1.2" | ||
"@protobufjs/pool" "^1.1.0" | ||
"@protobufjs/utf8" "^1.1.0" | ||
"@types/long" "^4.0.1" | ||
"@types/node" ">=13.7.0" | ||
long "^4.0.0" | ||
|
||
protobufjs@^7.2.4: | ||
version "7.2.6" | ||
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.2.6.tgz#4a0ccd79eb292717aacf07530a07e0ed20278215" | ||
integrity sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw== | ||
|
@@ -10538,6 +10610,14 @@ sh-syntax@^0.4.1: | |
dependencies: | ||
tslib "^2.6.2" | ||
|
||
sha.js@^2.4.11: | ||
version "2.4.11" | ||
resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" | ||
integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== | ||
dependencies: | ||
inherits "^2.0.1" | ||
safe-buffer "^5.0.1" | ||
|
||
shallow-clone@^3.0.0: | ||
version "3.0.1" | ||
resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" | ||
|