/solana-web3.kotlin

Solana SDK in Kotlin

Primary LanguageKotlinMIT LicenseMIT

SolanaWeb3

Maven Central CircleCI GitHub

This is a open source library on kotlin for Solana protocol.

SolanaWeb3 that is currently under development, alpha builds are available in the Sonatype staging repository.

How to

repositories {
    mavenCentral()
    
    // If you need to get SolanaWeb3 versions that are not uploaded to Maven Central.
    maven { url "https://s01.oss.sonatype.org/content/repositories/staging/" }
}

dependencies {
    implementation 'com.portto.solana:web3:0.1.3'
}

Example

val api = Connection(Cluster.DEVNET)

val account = KeyPair.fromSecretKey(walletPrivateKey.decodeBase58())
val instructions = SystemProgram.transfer(
    fromPublicKey = PublicKey("58ewYwS4XiZo5VuspKDdYkgi82n9carELJ63oGb7AZUq"),
    toPublicKey = PublicKey("ENkttsgNeYUJ1HFVHs77c4tqMqyWE3WeHMMkiZ1hkr7x"),
    lamports = 10000
)

val transaction = Transaction().add(instructions)
val txSignature = api.sendTransaction(
    transaction = transaction,
    signers = listOf(account)
)

println(txSignature)

Developed By

Kihon, kihon@portto.com

License

MIT. Original by Arturo Jamaica, forked and maintained by portto.