()
| 137 | * Load and parse the Solana CLI config file to determine which RPC url to use |
| 138 | */ |
| 139 | export async function getRpcUrl(): Promise<string> { |
| 140 | try { |
| 141 | const config = await getConfig(); |
| 142 | if (!config.json_rpc_url) throw new Error("Missing RPC URL"); |
| 143 | return config.json_rpc_url; |
| 144 | } catch (err) { |
| 145 | console.warn( |
| 146 | "Failed to read RPC url from CLI config file, falling back to localhost" |
| 147 | ); |
| 148 | return "http://localhost:8899"; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * Checks if provided account is executable and returns the public key |
no test coverage detected