elrondjsdeprecated

Javascript SDK for the Elrond blockchain with Typescript support.

Usage no npm install needed!

<script type="module">
  import elrondjs from 'https://cdn.skypack.dev/elrondjs';
</script>

README

elrond.js

NPM module Join the community Follow on Twitter

Javascript SDK for the Elrond blockchain.

Features:

  • Generate and load wallets (Ledger wallets too!)
  • Sign and broadcast transactions
  • Query the blockchain and work with smart contracts
  • Cross-platform: Node.js, Browser, Web workers and React Native.
  • Typescript definitions 🔥
  • Full documentation

Installation

Note: Node 12 or above is required to use elrondjs

npm install --save elrondjs

Usage

Example - Claiming rewards from the Mainnet delegation contract

import { Contract, ProxyProvider, BasicWallet } from 'elrondjs'

(async () => {
  // create connection to network
  const proxy = new ProxyProvider('https://api.elrond.com')

  // load wallet
  const wallet = BasicWallet.fromMnemonic('YOUR MNEMONIC HERE'),

  // create contract interface
  // and tell it to use our provider and wallet
  const c = await Contract.at('erd1qqqqqqqqqqqqqpgqxwakt2g7u9atsnr03gqcgmhcv38pt7mkd94q6shuwt', {
    provider: proxy,
    signer: wallet,
  })

  // make the claim!
  await c.invoke('claimRewards', [], {
    gasLimit: 250000000
  })
})()

For usage and full documentation see https://elrondjs.erd.dev.

Contributors guide

To build the lib and watch for changes:

npm run dev

To build the lib for production:

npm run build

To build the docs:

npm run build-docs

To publish a new release:

npm run release

To run the tests, first run npm run devnet in a separate terminal to start a local test network. Then run:

npm test

License

ISC