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

DEPRECATED - Drop-in widget for connecting Elrond dapps to user wallets

License

Notifications You must be signed in to change notification settings

erdDEVcode/erdbox

Repository files navigation

DEPRECATED - erdbox is now deprecated and no longer maintained. Please use the official starter dapp instead.

NPM module Join the community Follow on Twitter

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.
  • Self-hosting and/or IPFS supported.
  • Typescript definitions.
  • Full documentation.

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/erdbox@1.12.0/dist/erdbox.js';
  window.document.body.appendChild(g);
</script>

Note: replace 1.12.0 in the above code with the latest version of erdbox. This can always be found by visiting the erdbox package page at https://www.npmjs.com/package/erdbox

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 });

Contributors guide

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

Start the dev server

yarn dev

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

g.src = 'http://localhost:9000/erdbox.js'

License

AGPLv3