fundTestnetAccount

suspend fun fundTestnetAccount(accountId: String): Boolean

Funds a testnet account using FriendBot.

This will create the account if it doesn't exist and fund it with 10,000 XLM (testnet lumens). The operation is idempotent - calling it multiple times on the same account will not fail, but the account will only receive the initial 10,000 XLM funding once.

Network: This only works on Stellar's testnet. For futurenet, use fundFuturenetAccount.

Return

true if funding was successful, false otherwise

Parameters

accountId

The account ID (G... address) to fund

Throws

if the funding request fails with network errors

Example

val keypair = KeyPair.random()
val success = FriendBot.fundTestnetAccount(keypair.getAccountId())
if (success) {
println("Account funded successfully!")
}