Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.
/ elrondjs Public archive

DEPRECATED - Javascript SDK for the Elrond blockchain.

License

Notifications You must be signed in to change notification settings

erdDEVcode/elrondjs

Repository files navigation

DEPRECATED - elrond.js is now deprecated and no longer maintained. Please use @elrondnetwork/erdjs instead.**

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

npm install --save elrondjs

Note: If using with React Native you will need to use a shim.

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,
    sender: wallet.address(),
  })

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

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