WaxJS Demo

Below is a basic example of WaxJS functionality. To use this demo, click WAX Login, then click Sign Transaction.


WaxJS Response (real-time messages displayed below)

Copy the Code

To run this code locally:

  1. Download and save WaxJS from GitHub.

  2. Copy the following code into index.html.

    <!DOCTYPE html>
    <script src='waxjs.js'></script>
    <h1>wax signing lib example.</h1>
    <p>this is a library test.</p>
    <p>Click the buttons</p>
    <button id="login" onclick=login() >WAX Login</button>
    <button id="sign" onclick=sign() >Sign transaction</button>
    <h2 id="response"></h2>
    <p id="demo"></p>
      const wax = new waxjs.WaxJS('https://wax.greymass.com');
      async function login() {
        try {
          const userAccount = await wax.login();
        } catch(e) {
      async function sign() {
        if(!wax.api) {
          return document.getElementById('response').append('* Login first *');
        try {
          const result = await wax.api.transact({
            actions: [{
              account: 'eosio',
              name: 'delegatebw',
              authorization: [{
                actor: wax.userAccount,
                permission: 'active',
              data: {
                from: wax.userAccount,
                receiver: wax.userAccount,
                stake_net_quantity: '0.00000001 WAX',
                stake_cpu_quantity: '0.00000000 WAX',
                transfer: false,
                memo: 'This is a WaxJS/Cloud Wallet Demo.'
          }, {
            blocksBehind: 3,
            expireSeconds: 30
        } catch(e) {

What's Next