Stellar SDK for Scala

This is the SDK for performing Stellar operations via Scala. It provides the ability to access the Stellar network via Horizon instances to build and submit transactions, query the state of the network and stream updates.

Scala developers may prefer to use this SDK because because it provides a more natural API for Scala developers than the official Java SDK

The code throughout this documentation is compiled against Scala 2.12.

Quick-start

Add the jitpack resolver.

resolvers += "jitpack" at "https://jitpack.io"

Then, add the SDK via your dependency management tool.

sbt
libraryDependencies += "io.github.synesso" %% "scala-stellar-sdk" % "0.10.1"
Maven
<dependency>
  <groupId>io.github.synesso</groupId>
  <artifactId>scala-stellar-sdk_2.12</artifactId>
  <version>0.10.1</version>
</dependency>
Gradle
dependencies {
  compile group: 'io.github.synesso', name: 'scala-stellar-sdk_2.12', version: '0.10.1'
}

Creating an account on the public test network.

val kp = KeyPair.random
val response = TestNetwork.fund(kp)

Fetching the details of an account.

val account: Future[Account] = network.account(kp).map(_.toAccount)
val nextSeqNo: Future[Long] = account.map(_.sequenceNumber)

Submitting a payment.

for {
  sourceAccount <- network.account(payerKeyPair)
  response <- model.Transaction(sourceAccount, timeBounds = Unbounded, maxFee = NativeAmount(100))
    .add(PaymentOperation(payeePublicKey, lumens(5000)))
    .sign(payerKeyPair)
    .submit()
} yield response

For more detailed coverage, continue by reading about KeyPairs.

API

Please enjoy the scaladoc for this release.

Deprecation warning

At this stage, classes and interfaces are likely to be refined. Minor releases may break backwards compatibility with minimal notice until v1.0.0.

Check the CHANGELOG for details of breaking changes.

Contributing

Contributions are warmly welcomed. Please feel free to contribute by reporting issues you find, or by suggesting changes to the code. Or feel free to add your own features/issues to that list.

Let’s chat about any of this on the Stellar KeyBase channel #dev channel. My username is @jem.