Skip to content

Instantly share code, notes, and snippets.

@octalmage
Created February 7, 2020 19:54
Show Gist options
  • Save octalmage/d3e39e9508514e2c37fdf66c2f0c6717 to your computer and use it in GitHub Desktop.
Save octalmage/d3e39e9508514e2c37fdf66c2f0c6717 to your computer and use it in GitHub Desktop.

Revisions

  1. octalmage created this gist Feb 7, 2020.
    28 changes: 28 additions & 0 deletions wax.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    const tx = await theWallet.transact({
    actions: [{
    account: 'blockarcade1',
    name: 'result',
    authorization: [{
    actor: theAccount,
    permission: 'active',
    }],
    data: {
    customer_string: userID,
    result: !!result,
    jackpot: !!jackpotScored,
    row,
    score,
    },
    }],
    }, {
    blocksBehind: 10,
    expireSeconds: 30,
    });

    // Pull the inline call to the reciept method and use that for the response.
    let state = tx.processed.action_traces[0].inline_traces[0].act.data;

    // When the user wins the reciept call with be after paying the user, so we want the second action.
    if (typeof state.from !== 'undefined') {
    state = tx.processed.action_traces[0].inline_traces[1].act.data;
    }