-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add getSolanaCLI for agave/solana CLI
- Loading branch information
1 parent
e419d60
commit 1e3e3f0
Showing
14 changed files
with
56 additions
and
195 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 |
---|---|---|
@@ -1,19 +1,10 @@ | ||
import { | ||
AGAVE_VALIDATOR, | ||
LEDGER_PATH, | ||
SOLANA_VALIDATOR, | ||
} from '@/config/constants' | ||
import { Network, NodeType } from '@/config/enums' | ||
import { LEDGER_PATH } from '@/config/constants' | ||
import getSolanaCLI from '@/config/getSolanaCLI' | ||
import { DefaultConfigType } from '@/config/types' | ||
import { spawnSync } from 'node:child_process' | ||
|
||
export const monitorSolana = (config: DefaultConfigType) => { | ||
const isTestnet = config.NETWORK === Network.TESTNET | ||
const isRPC = config.NODE_TYPE === NodeType.RPC | ||
let solanaValidatorClient = isTestnet ? AGAVE_VALIDATOR : SOLANA_VALIDATOR | ||
if (isRPC) { | ||
solanaValidatorClient = AGAVE_VALIDATOR | ||
} | ||
const solanaValidatorClient = getSolanaCLI() | ||
const cmd = `${solanaValidatorClient} --ledger ${LEDGER_PATH} monitor` | ||
spawnSync(cmd, { shell: true, stdio: 'inherit' }) | ||
} |
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
This file was deleted.
Oops, something went wrong.
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
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,24 @@ | ||
import getSolanaVersion from '@/cli/epochTimer/getSolanaVersion' | ||
|
||
const SOLANA_CLI = 'solana-validator' | ||
const AGAVE_CLI = 'agave-validator' | ||
|
||
export type SolanaCLI = typeof SOLANA_CLI | typeof AGAVE_CLI | ||
|
||
const getSolanaCLI = (): SolanaCLI => { | ||
try { | ||
const solanaVersion = getSolanaVersion() | ||
console.log(solanaVersion) | ||
// convert solanaVersion to number. e.g. 1.2.0 to 120 | ||
const hasVersion20 = solanaVersion.includes('2.0') | ||
if (hasVersion20) { | ||
return AGAVE_CLI | ||
} | ||
return SOLANA_CLI | ||
} catch (error) { | ||
console.error(error) | ||
return SOLANA_CLI | ||
} | ||
} | ||
|
||
export default getSolanaCLI |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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