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

Commit

Permalink
Update to v0.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Synesso committed Aug 8, 2021
1 parent d085ad0 commit 3460862
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ As this project is pre 1.0, breaking changes may happen for minor version bumps.

## Next Version

## 0.21.1

- Fix [#476](https://github.com/Synesso/scala-stellar-sdk/issues/476): Reinstate cursor for horizon queries

## 0.21.0

- Updated `AssetResponse` to include more detailed information about balances for the specified asset.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Add the JitPack & jcenter resolvers and the [latest dependency](https://jitpack.
```scala
resolvers += "jitpack" at "https://jitpack.io"
resolvers += Resolver.jcenterRepo
libraryDependencies += "com.github.synesso" %% "scala-stellar-sdk" % "0.21.0"
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.
Expand Down
37 changes: 37 additions & 0 deletions src/it/scala/stellar/sdk/HelloWorld.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package stellar.sdk

import stellar.sdk.PublicNetwork
import stellar.sdk.model.{Asc, Desc, Now, Trade}

import java.time.ZonedDateTime
import scala.concurrent.{Await, Future}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.{Duration, DurationInt}

object HelloWorld extends App {
def traverseStream[A, B](in: LazyList[A])(fn: A => Future[B]): Future[LazyList[B]] = {
in match {
case LazyList.cons(head, tail) =>
for {
newHead <- fn(head)
newTail <- traverseStream(tail)(fn)
} yield newHead #:: newTail
case _ =>
Future.successful(LazyList.empty)
}
}

// Works
for {
trades <- PublicNetwork.trades(Now, Asc)
} yield {
val result = traverseStream(trades) {
case Trade(id, time, offerId, baseOfferId, counterOfferId, _, _, _, _, _) => {
Future.successful(System.out.println(s"New trade coming in Trade($id, $time, $offerId)"))
}
}
val stream = Await.result(result, Duration.Inf)
}

val timeWindow = ZonedDateTime.now().minusMinutes(65)
}

0 comments on commit 3460862

Please sign in to comment.