getKeyPair

suspend fun getKeyPair(index: Int = 0): KeyPair

Derives a Stellar keypair at the specified account index.

Uses the Stellar derivation path: m/44'/148'/index' where:

  • 44' is the BIP-44 purpose (hardened)

  • 148' is the Stellar coin type (hardened)

  • index' is the account index (hardened)

Return

KeyPair for the derived account with signing capability

Parameters

index

Account index (0 to 2^31-1, default: 0)

Throws

if index is negative

Example:

val mnemonic = Mnemonic.from(mnemonic)

// Derive multiple accounts
val account0 = mnemonic.getKeyPair(index = 0)
val account1 = mnemonic.getKeyPair(index = 1)
val account2 = mnemonic.getKeyPair(index = 2)