DEPRECATED - elrond.js is now deprecated and no longer maintained. Please use @elrondnetwork/erdjs instead.**
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
npm install --save elrondjs
Note: If using with React Native you will need to use a shim.
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
})
})()
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
ISC