diff --git a/.changeset/eight-beans-pay.md b/.changeset/eight-beans-pay.md new file mode 100644 index 00000000..0f0309fd --- /dev/null +++ b/.changeset/eight-beans-pay.md @@ -0,0 +1,12 @@ +--- +'@epics-dao/solv': patch +--- + +fix - auto update solana version notification + +=== ✨ solv updated to the latest version ✨ === +Validator Address: xxxxxxxx +solv Version: 4.6.13 +Solana Version: 2.0.14 +Network: Testnet +isNodeRestartRequired: false diff --git a/packages/solv/src/cli/epochTimer/getSolanaVersion.ts b/packages/solv/src/cli/epochTimer/getSolanaVersion.ts new file mode 100644 index 00000000..90a05fe5 --- /dev/null +++ b/packages/solv/src/cli/epochTimer/getSolanaVersion.ts @@ -0,0 +1,9 @@ +import { spawnSync } from 'node:child_process' + +const getSolanaVersion = (): string => { + const { stdout } = spawnSync('solana --version', { shell: true }) + const version = stdout ? String(stdout) : 'Unknown' + return version.trim() +} + +export default getSolanaVersion diff --git a/packages/solv/src/cli/update/autoUpdate/index.ts b/packages/solv/src/cli/update/autoUpdate/index.ts index 6f0f67f7..7c69519c 100644 --- a/packages/solv/src/cli/update/autoUpdate/index.ts +++ b/packages/solv/src/cli/update/autoUpdate/index.ts @@ -12,6 +12,7 @@ import { getSolanaAddress } from '@/lib/getSolanaAddress' import sleep from '@/lib/sleep' import { DefaultConfigType } from '@/config/types' import { Network } from '@/config/enums' +import getSolanaVersion from '@/cli/epochTimer/getSolanaVersion' // NODE_RESTART_REQUIRED_MAINNET/TESTNET is a boolean // This is a global variable that is not defined in this file @@ -22,7 +23,7 @@ const autoUpdate = async (config: DefaultConfigType) => { const isMainnet = config.NETWORK === Network.MAINNET const { mainnetValidatorKey, testnetValidatorKey } = getAllKeyPaths() const validatorKey = isMainnet ? mainnetValidatorKey : testnetValidatorKey - const solanaVersion = getSolvVersion() + const solanaVersion = getSolanaVersion() // Notify the user about the update let isUpdateRequired = isMainnet ? NODE_RESTART_REQUIRED_MAINNET diff --git a/packages/solv/src/index.ts b/packages/solv/src/index.ts index 7f6cf479..5eeea4be 100644 --- a/packages/solv/src/index.ts +++ b/packages/solv/src/index.ts @@ -34,6 +34,7 @@ import { swapCommand } from './cli/swap' import readConfig from './config/readConfig' import { jupiterCommands } from './cli/jupiter' import chalk from 'chalk' +import getSolanaVersion from './cli/epochTimer/getSolanaVersion' export const program = new Command() program @@ -119,6 +120,14 @@ async function main() { showConfig() }) + program + .command('vv') + .description('Show Solv Version') + .action(() => { + const version = getSolanaVersion() + console.log('version:', version) + }) + await program .addHelpCommand('help [cmd]', 'Display help for command') .parseAsync(process.argv)