erd-box

Drop-in widget for connecting Dapps to Elrond and interacting with user wallets

Usage no npm install needed!

<script type="module">
  import erdBox from 'https://cdn.skypack.dev/erd-box';
</script>

README

Join the community Follow on Twitter

erd-box

Drop-in widget for connecting your Elrond dapp to user's wallets.

  • Supports all wallet types: Mnemonic/seedphrase, JSON keyfile, PEM file, Ledger hardware
  • Full transaction signing (including smart contract interactions)
  • Easy and simple API
  • Works with any frontend framework and/or vanilla JS
  • Typescript definitions.
  • Full documentation coming soon!

Usage

Include the following script tag anywhere within your HTML:

<script type="text/javascript">
  const g = window.document.createElement('script');
  g.id = 'erdBoxScript';
  g.type = 'text/javascript';
  g.async = true;
  g.defer = true;
  g.src = 'https://cdn.jsdelivr.net/npm/erd-box@1.2.0/dist/erd-box.js';
  window.document.body.appendChild(g);
</script>

Then in your Javascript code:

window.addEventListener('erdBox:ready', async () => {
  /*
    `window.erdBox` is now available for use!
  */

  // Example: ask user to connect a wallet
  const address = await window.erdBox.getWalletAddress({ mustLoadWallet: true });
  alert(`User wallet address: ${address}`);
}, { once: true });

Full documentation coming soon!

Development

Note: These instructions are for developers who wish to work on Vilya itself.

Start the dev server

yarn dev

The script will now be available at http://localhost:9000/erd-box.js, so replace the embed code URL with this one:

g.src = 'http://localhost:9000/erd-box.js'

License

AGPLv3