MCPcopy Create free account
hub / github.com/ExtropyIO/SolanaBootcamp / establishEnoughSol

Function establishEnoughSol

utils/utils.ts:103–115  ·  view source on GitHub ↗
(
  connection: Connection,
  payer: Keypair
)

Source from the content-addressed store, hash-verified

101 * @param payer Keypair of the payer
102 */
103export 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

Callers 5

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90

Calls 3

feesEstimateFunction · 0.85
getBalanceFunction · 0.85
topUpFunction · 0.85

Tested by

no test coverage detected