Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/elrondex/elrondex

Elrondex is an elixir library that interacts with Elrond Blockchain
https://github.com/elrondex/elrondex

Last synced: about 2 months ago
JSON representation

Elrondex is an elixir library that interacts with Elrond Blockchain

Awesome Lists containing this project

README

        

[![Hex.pm](https://img.shields.io/hexpm/v/elrondex.svg)](https://hex.pm/packages/elrondex)

Welcome to Elrondex.

Elixir libraries to interact with Elrond Blockchain ⚡ and its components $EGLD, Arwen, WASM, DeFI, SC, ESDTs, NFTs, SFTs, $MEX, DEX, AMM

This is **DRAFT** code it will definitely be changed in the near future.

## Installation

Add `elrondex` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:elrondex, "~> 0.1.1"}
]
end
```

## Examples

### Transfer 1 EGLD from Bob account to Alice account on testnet network

```elixir
alias Elrondex.{Account, Transaction, Network, REST}

network = Network.testnet()

# 24 words
bob_mnemonic = "quick alone describe ..."
alice_address = "erd18n5zgmet82jvqag9n8pcvzdzlgqr3jhqxld2z6nwxzekh4cwt6ps87zfmu"

bob_mnemonic
|> Account.from_mnemonic()
|> Transaction.transaction(alice_address, 1_000_000_000_000_000_000)
|> Transaction.prepare(network)
|> Transaction.sign()
|> REST.post_transaction_send()

{:ok, "5e3bd0cc962a1eb2ad68b8610d8ae4ae9255c041e1d73ae4d23caf9956dae9c4"}
```

### Get WEGLD/USDC pair info from Maiar DEX on mainnet

```elixir
mainnet = Elrondex.Network.mainnet()
pair_address = "erd1qqqqqqqqqqqqqpgqeel2kumf0r8ffyhth7pqdujjat9nx0862jpsg2pqaq"

Elrondex.Sc.PairSc.get_pair(pair_address, mainnet)

{:ok,
%Elrondex.Pair{
address: "erd1qqqqqqqqqqqqqpgqeel2kumf0r8ffyhth7pqdujjat9nx0862jpsg2pqaq",
first_decimals: 18,
first_token: "WEGLD-bd4d79",
lp_decimals: 18,
lp_token: "EGLDUSDC-594e5e",
name: nil,
second_decimals: 6,
second_token: "USDC-c76f1f"
}}
```