Multiplatform Stellar SDK
I am currently aiming to support JS, Native and JVM.
I am planning to work on Soroban as soon as I finish basic support for creating, signing and submitting transactions.
The Java library works fine if you are doing server side or android programming. However I would like to share my Kotlin code between server and a web front-end, as Kotlin also targets the Browser.
https://www.youtube.com/watch?v=8z0WXVe3GLI
import me.rahimklaber.stellar.base.*
import me.rahimklaber.stellar.base.Asset
import me.rahimklaber.stellar.base.operations.Payment
import me.rahimklaber.stellar.horizon.Server
import me.rahimklaber.stellar.horizon.toAccount
suspend fun main() {
val horizon = Server("https://horizon-testnet.stellar.org")
val keypair = KeyPair.fromSecretSeed("SBVLLHTZ5ZV3KZWBBBUNMESYIMK7AEPQJY6FYNCG2PL5LZ5IFCWWSUH2")
val account = horizon.accounts().account(keypair.accountId).toAccount()
val tx = transactionBuilder(source = account, network = Network.TESTNET){
addOperation(
Payment(destination = account.accountId, asset = Asset.Native, amount = tokenAmount("1"))
)
}
tx.sign(keypair)
val result = horizon.submitTransaction(tx)
println(result)
}
prints
SubmitTransactionResponse(
id = 35dcdf202d2ce23e50b3cccf5f933f1253a1df5d6d870b2e93618b995b493b7b,
pagingToken = 4289134730424320,
successful = true,
hash = 35dcdf202d2ce23e50b3cccf5f933f1253a1df5d6d870b2e93618b995b493b7b,
ledger = 998642,
createdAt = 2024 - 04 - 07T11 : 26 : 56Z,
sourceAccount = GDYK7S5OPTSRVIP3ZO7VOXKVO3OIOHBY5HC327QQDDHX5AF3YSIJMAOP,
sourceAccountSequence = 149649545494537,
feeAccount = GDYK7S5OPTSRVIP3ZO7VOXKVO3OIOHBY5HC327QQDDHX5AF3YSIJMAOP,
feeAccountSequence = null,
feeCharged = 100,
maxFee = 100,
operationCount = 1,
envelopeXdr = AAAAAgAAAADwr8uufOUaofvLv1ddVXbchxw46cW9fhAYz36Au8SQlgAAAGQAAIgbAAAACQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAPCvy6585Rqh+8u/V11VdtyHHDjpxb1+EBjPfoC7xJCWAAAAAAAAAAAA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ycJ4H/fUsBc5x5oO1xubcKoc8zOxXiVQw11LGn2GiSOAGpR71mDA==],
validAfter = null,
validBefore = null,
memo = null,
memoBytes = null)