Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Synesso/scala-stellar-sdk

Repository files navigation

Build Coverage Issues Supports Stellar Horizon v2.6.1 Supports Stellar Core v17 Scala Steward badge

November 2021: This project is no longer actively maintained.


With the Stellar SDK for Scala, you can perform Stellar operations from your Scala application. It provides the ability to access Stellar networks via any Horizon instance to build and submit transactions, query the state of the network and stream updates. You'll like this SDK, because it provides a more natural API for Scala developers than the official Java SDK.

You can do what you like with this software, as long as you include the required notices. See the licence for more details.

Getting Started

Add the JitPack & jcenter resolvers and the latest dependency to your build tool. Here's how it might look in build.sbt

resolvers += "jitpack" at "https://jitpack.io"
resolvers += Resolver.jcenterRepo
libraryDependencies += "com.github.synesso" %% "scala-stellar-sdk" % "0.21.1"

From there, it is a simple affair to create and fund a new account on the test network.

import stellar.sdk._
import scala.concurrent.ExecutionContext.Implicits.global
val kp = KeyPair.random
val response = TestNetwork.fund(kp)

You can try this right now in your browser.

Here's the code necessary to fetch an account's sequence number and submit a payment operation to the network.

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

Please see the full SDK documentation for further examples and full API details.

Getting Help

There are a few ways to get help using this SDK.

  1. Post your question to the Stellar StackExchange and tag it with scala-sdk.
  2. Ask in the #dev_discussion channel in Keybase.
  3. Raise an issue on this repository in GitHub.

Contributing

If you'd like to contribute new ideas, bug fixes or help to build out a planned feature, please take a look at the current open issues, or join the gitter channel to discuss your thoughts.

To get started developing on the SDK itself, see the DEV notes.

Ack

_Thanks to the Stellar Development Foundation for their ongoing support.

JetBrains