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

Function atLeastSol

utils/utils.ts:74–85  ·  view source on GitHub ↗
(
  connection: Connection,
  account: Keypair,
  min: number
)

Source from the content-addressed store, hash-verified

72}
73
74export async function atLeastSol(
75 connection: Connection,
76 account: Keypair,
77 min: number
78) {
79 const minLampBalance = min * LAMPORTS_PER_SOL;
80
81 let [_, lamports] = await getBalance(connection, account);
82 if (lamports < minLampBalance) {
83 await topUp(connection, account, minLampBalance - lamports);
84 }
85}
86
87export async function topUpAccounts(
88 connection: Connection,

Callers 1

topUpAccountsFunction · 0.85

Calls 2

getBalanceFunction · 0.85
topUpFunction · 0.85

Tested by

no test coverage detected