ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - mcvnh/tradehub-elixir: Elixir client library for the Tradehub blockchain
Elixir client library for the Tradehub blockchain. Contribute to mcvnh/tradehub-elixir development by creating an account on GitHub.
Visit Site

GitHub - mcvnh/tradehub-elixir: Elixir client library for the Tradehub blockchain

GitHub - mcvnh/tradehub-elixir: Elixir client library for the Tradehub blockchain

Tradehub

License: MIT .github/workflows/main.yml Coverage Status Hex pm hex.pm downloads


Tradehub Elixir is an API wrapper package written for the Elixir language. Its purpose is to provide an easy way to help Elixir developers can interact with all aspects of the Tradehub blockchain

The code found in this repository is unaudited and incomplete. I do not responsible for any losses incurred when using this code.

General

Switcheo Tradehub is a blockchain protocol built on top of Tendermint which allows for fair, efficient, and transparent trading on platforms such as Demex. The protocol designed to allow anyone to create a market for any underlying. Head over to its landing page, and its official API documetation for more details.

Go to Tradehub Faucet get receive free Testnet tokens.

Installation

The package can be installed by adding tradehub to your dependencies in mix.exs.

def deps do
  [
    {:tradehub, "~> 0.1.16"}
  ]
end

Basic Usage

Configure Tradehub network in your config.exs.

config :tradehub,
  network: :testnet # :mainnet
  wallet: '[YOUR_MNEMONIC]'

Make a simple REST call to get the block time of the chain.

iex(1)> Tradehub.Protocol.block_time

Get information of a wallet.

iex(1)> wallet = Tradehub.Wallet.from_mnemonic! Application.fetch_env!(:tradehub, :wallet)
iex(2)> wallet
...(2)> |> Map.get(:address)
...(2)> |> Tradehub.Account.account!
%{
  height: "468693",
  result: %{
    type: "cosmos-sdk/Account",
    value: %{
      account_number: "24",
      address: "tswth17y4r3p4dvzrvml3fqe5p05l7y077e4cy8s7ruj",
      coins: [
        %{amount: "100000000", denom: "btc"},
        %{amount: "100000000000000000000", denom: "eth"},
        %{amount: "1000000000000", denom: "iusd"},
        %{amount: "99997200000000", denom: "swth"}
      ],
      public_key: %{
        type: "tendermint/PubKeySecp256k1",
        value: "AnYEQWwhUipTNb6ivNbW1E7SVnmndkC4DHf9UzozeEPx"
      },
      sequence: "28"
    }
  }
}

Websocket

This example will do a subscription onto the channel market_stats, and print out the received messages.

defmodule MarketStatsObserver do
  use Tradehub.Stream,
  topics: [
    "market_stats" # Subscribe the topic `market_stats`
  ]

  # Handle recent messages from the topic
  def handle_info(message, state) do
    IO.puts("#{message}")
    {:noreply, state}
  end
end
iex(1)> MarketStatsObserver.start_link

Full documentation can be found at https://hexdocs.pm/tradehub.

Features

  • Implementation of all general information endpoints
    • Public endpoints
    • Websocket
    • Handling of authentication
    • Private endpoints
    • Cover code coverage <- doing
    • Documentationn

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory