Giter VIP home page Giter VIP logo

graphene_client_ex's Introduction

Elixir client for Bitshares/Graphene 2.0 websocket API

Provides an interface to Bitshares/ Graphene 2.0 JSONRPC protocol. Graphene_client_ex is a supervised application, so don't forget to add it to applications in mix.exs

Installation

If available in Hex, the package can be installed as:

  1. Add graphene_client_ex to your list of dependencies in mix.exs:
```elixir
def deps do
  [{:graphene_client_ex, "~> 0.4.0"}]
end
```
  1. Ensure graphene_client_ex is started before your application:
```elixir
def application do
  [applications: [:graphene_client_ex]]
end
```

Example

First, add a websockets url for the graphene daemon, for example, wss://bitshares.openledger.info/ws to the config.

    config :graphene_client_ex,
      url: "GRAPHENE_URL",
      activate_stage_sup: true

If you want to activate GenStage blocks producer, use activate_stage_sup: true in the config file.

GenStage

It's easy to subscribe to new blockchain events with consumers that implement GenStage specification for handling and exchanging events among Elixir/Erlang processes.

If activate_stage_sup is enabled, following GenStage processes are started and registered:

  • Graphene.Stage.Blocks.Producer which, perhaps unsurprisingly, produces new block events
  • Graphene.Stage.Ops.ConsumerProducer [planned]
  • Graphene.Stage.TransformedOps.ConsumerProducer [planned]

The main module function is Graphene.call. It will block the calling process and return a success tuple with a "result" data from the JSONRPC call response. JSONRPC call ids are handled automatically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.