()
| 20 | * Establish a connection to the cluster |
| 21 | */ |
| 22 | export async function establishConnection(): Promise<Connection> { |
| 23 | const rpcUrl = await getRpcUrl(); |
| 24 | let connection = new Connection(rpcUrl, "confirmed"); |
| 25 | const version = await connection.getVersion(); |
| 26 | console.log("Connection to cluster established:", rpcUrl, version); |
| 27 | return connection; |
| 28 | } |
| 29 | |
| 30 | export async function getBalance( |
| 31 | connection: Connection, |