This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Elm SDK for the Stellar Cryptocurrency
version 1.0.1
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.1
Committed At 2018-08-13 23:54:26 UTC
lukewestby/elm-http-builder 5.2.0 <= v < 6.0.0 5.2.0
elm-lang/http 1.0.0 <= v < 2.0.0 1.0.0
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1
elm-community/string-extra 1.5.0 <= v < 2.0.0 1.5.0
elm-community/json-extra 2.7.0 <= v < 3.0.0 2.7.0
NoRedInk/elm-decode-pipeline 3.0.0 <= v < 4.0.0 3.0.1

Modules

README

Stellar Elm SDK / API Examples

This repository started as a proof of concept that the Elm Language could be an excellent candidate as a Stellar SDK with its strong static types and excellent support for Http and Websockets.

This Repository used to host 2 things:

  • A Stellar SDK written in Elm
  • An Example SPA (single page application) written in Elm, that uses the SDK to interact with the Stellar Network.

The Demo SPA has now been extracted to it's own package, leaving only the SDK in this repository.

The live Demo is hosted on GitHub Pages and can be found here.

Usage

To add the SDK to your existing Elm project, run elm package install ryan-senn/stellar-elm-sdk.

The Package follows Stellar's philophy as close as possible. The Package is split in Endpoints (to build and send requests) and Resources (responses from the Server).

The Endpoints have mandatory fields and optional fields. The mandatory fields have to be supplied to build a RequestBuilder instace. The optional fields can then be piped into the RequestBuilder, following a similar approach to Luke's excellent http-builder package or the highly successfull elm-decode-pipeline package by the folks at NoRedInk.

If you wanted to query offers for an account for example, you would start by providing the mandatory fields to the requestBuilder function:

import Stellar.Endpoints.OffersForAccount as OffersForAccount

requestBuilder =
  OffersForAccount.requestBuilder endpoint publicKey

This on itself is a valid RequestBuilder, which can be turned into a Command (Side Effect) using the send function:

cmd =
  OffersForAccount.requestBuilder endpoint publicKey
    |> OffersForAccount.send

However, you can also add any number of optional fields before turning the RequestBuilder into a Cmd:

cmd =
  OffersForAccount.requestBuilder endpoint publicKey
    |> OffersForAccount.setCursor cursor
    |> OffersForAccount.setLimit limit
    |> OffersForAccount.send

Future Plans

Now that the SDK is its own stand alone package hosted on the official elm (http://package.elm-lang.org/packages/ryan-senn/stellar-elm-sdk/latest) package library, I want to focus on stellar (!) documentation.

I also want to split Resource Modules in Public (exposed) and Private (internal), as there is very little reason to expose decoders, the Type Alias is enough (the Endpoint Modules use the decoders internally).

The future plans for the Demo SPA can be foud here.