( connection: Connection, payer: Keypair )
| 101 | * @param payer Keypair of the payer |
| 102 | */ |
| 103 | export async function establishEnoughSol( |
| 104 | connection: Connection, |
| 105 | payer: Keypair |
| 106 | ) { |
| 107 | let fees = 0; |
| 108 | // Calculate the cost of sending transactions |
| 109 | fees += await feesEstimate(connection, payer); |
| 110 | |
| 111 | let [_, lamports] = await getBalance(connection, payer); |
| 112 | if (lamports < fees) { |
| 113 | await topUp(connection, payer, fees - lamports); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * @private |