Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elrondex/elrondex
Elrondex is an elixir library that interacts with Elrond Blockchain
https://github.com/elrondex/elrondex
Last synced: 3 months ago
JSON representation
Elrondex is an elixir library that interacts with Elrond Blockchain
- Host: GitHub
- URL: https://github.com/elrondex/elrondex
- Owner: elrondex
- License: mit
- Created: 2021-09-17T07:23:11.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-10T21:32:15.000Z (almost 2 years ago)
- Last Synced: 2024-09-19T02:59:03.343Z (4 months ago)
- Language: Elixir
- Homepage:
- Size: 146 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-multiversx-dev-resources - Elrondex - Elixir library to interact with Elrond Blockchain (MultiversX community / SDKs and dev tools)
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"
}}
```