NeoVier/elm-eos/1.0.0

Renamed to henriquecbuss/elm-eos. It is published under that name, and new versions come out there.

Versions published as NeoVier/elm-eos still install under that name. 1 version of 1 come from the new location (see their notes).

Rerouted (renamed, needs approval). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/henriquecbuss/elm-eos.

What we checked: The repo moved to github.com/henriquecbuss/elm-eos and tag 1.0.0 is there; its commit 12b679fbd416 is from 2022-11-04 12:13 UTC, after the version was published (2022-11-04 02:04 UTC); elm.json differs from package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one and nothing else confirms its contents.

We could not verify this copy against what was published, so the Lamdera compiler asks before using it (y/n). Without a terminal, as in CI, it stops with an error unless approved:

  • lamdera make --auto-approve-package-rerouting approves rerouted versions for that run,
  • LAMDERA_AUTO_APPROVE_PACKAGE_REROUTING=1 does the same for every run in that environment,
  • LAMDERA_CACHE=off skips the Lamdera package server altogether: packages come from package.elm-lang.org and GitHub only, as with elm, and a rerouted version then fails to download.

Details · package.elm-lang.org's zip: https://github.com/NeoVier/elm-eos/zipball/1.0.0/

Eos.Query

Perform queries to get data from tables. The CLI gives you functions to perform type-safe queries, and this module helps you actually turn them into Cmds.

type Query response
= Query
{ scope : String
, indexPosition : Maybe Index
, lowerBound : Maybe Cursor
, upperBound : Maybe Cursor
, limit : Maybe Int
, reverse : Bool
, baseUrl : String
, contract : String
, table : String
, decoder : Decoder response
}

The Query type. It's only exposed so that the CLI can have access to it. You shouldn't construct it by hand.

(Result Error (Response response) -> msg)
-> Query response
-> Cmd msg

Send a Query to EOSIO.

You shouldn't need to construct a Query by hand. Instead, use functions generated by the CLI. They live in the Table.Query module.

Some parameters of the query are defined when running the CLI (like baseUrl). Others can be modified with functions like withLimit and withBaseUrl (in case you need to override it).

This returns a Response, since there may be pagination in the result. If you want to paginate, keep the Cursor returned in the Response and use withLowerBound or withUpperBound in the next query.

import Eos.Query
import Http
import Table
import Table.Query


type Msg
    = GotAccountData (Result Http.Error (Eos.Query.Response Table.Accounts))


queryAccounts : Cmd Msg
queryAccounts =
    Table.Query.accounts { scope = "henriquebuss" }
        |> Eos.Query.withLimit 20
        |> Eos.Query.send GotAccountData
type alias Response response =
{ hasMore : Bool
, nextCursor : Cursor
, result : List response
}

A response from a Query. It contains the results, and also pagination data. You can check if there is more data to be fetched with the hasMore field. If there is, you can use the nextCursor field to fetch the next page of data with withLowerBound or withUpperBound.

withBaseUrl : String -> Query response -> Query response

Redefine the base url to send a Query. This is already defined when running the CLI, so you shouldn't need this function often.

withLimit : Int -> Query response -> Query response

Set how many entries to fetch on send.

withLowerBound : Cursor -> Query response -> Query response

Define the lower bound of a Query. This is used to paginate the results. You can get a Cursor from a Response, which you can get with send.

withUpperBound : Cursor -> Query response -> Query response

Define the upper bound of a Query. This is used to paginate the results. You can get a Cursor from a Response, which you can get with send.

withReverse : Bool -> Query response -> Query response

Define if the Query results should be reversed.

type Cursor

Used to set the lower bound or upper bound with withLowerBound or withUpperBound. You can get one of these from send.

type Index
= Primary
| Secondary
| Tertiary
| Fourth
| Fifth
| Sixth
| Seventh
| Eighth
| Ninth
| Tenth

The Index to use when sending a Query.