-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
3c4496e
commit 74aa942
Showing
3 changed files
with
48 additions
and
53 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,42 @@ | ||
const fs = require('fs'); | ||
|
||
const TESTNET_CONFIG_PATH = './config/rosetta/vara-testnet.json'; | ||
const MAINNET_CONFIG_PATH = './config/rosetta/vara-mainnet.json'; | ||
|
||
const tag = process.argv[2]; | ||
const version = process.argv[3]; | ||
|
||
const testnet_meta_url = `https://github.com/gear-tech/gear/releases/download/v${tag}/testnet_vara_runtime_v${version}_metadata.scale`; | ||
|
||
const production_meta_url = `https://github.com/gear-tech/gear/releases/download/v${tag}/production_vara_runtime_v${version}_metadata.scale`; | ||
|
||
const main = async () => { | ||
console.log('Downloading testnet metadata from', testnet_meta_url); | ||
const testnetMetadata = await fetch(testnet_meta_url).then((res) => | ||
res.status === 404 ? Promise.reject('Testnet metadata not found') : res.text(), | ||
); | ||
|
||
console.log('Downloading production metadata from', production_meta_url); | ||
const productionMetadata = await fetch(production_meta_url).then((res) => | ||
res.status === 404 ? Promise.reject('Mainnet metadata not found') : res.text(), | ||
); | ||
|
||
console.log('Updating testnet config'); | ||
const testnetConfig = JSON.parse(fs.readFileSync(TESTNET_CONFIG_PATH)); | ||
testnetConfig.metadataRpc = testnetMetadata; | ||
testnetConfig.specVersion = version; | ||
fs.writeFileSync(TESTNET_CONFIG_PATH, JSON.stringify(testnetConfig, null, 2)); | ||
|
||
console.log('Updating mainnet config'); | ||
const productionConfig = JSON.parse(fs.readFileSync(MAINNET_CONFIG_PATH)); | ||
productionConfig.metadataRpc = productionMetadata; | ||
productionConfig.specVersion = version; | ||
fs.writeFileSync(MAINNET_CONFIG_PATH, JSON.stringify(productionConfig, null, 2)); | ||
}; | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.log(error); | ||
process.exit(1); | ||
}); |
This file was deleted.
Oops, something went wrong.