This feature requires the Ownership permission.

What is Run?

Run is a modular token protocol for which Handcash has implemented the Owner and Purse plugins to fund and sign Run transactions.

To get a full understanding of Run, you will need to familiarize yourself with RUN and it's documentation.

How to use Run with the HandCash SDK

The below example illustrates how to integrate HandCash with Run.

  • Define a Jig
  • Initialize HandCashPurse and HandCashOwner
  • Initialize RUN using these two components
  • Deploy a Jig
  • Send a Jig from one user to another
const Run = require('run-sdk');
const { HandCashPurse, HandCashOwner, Environments, } = require('@handcash/handcash-connect');
const appSecret = '<app-secret>'
const player1AuthToken = '<player1-auth-token>'
const player2AuthToken = '<player2-auth-token>';

// Define a Jig
class Weapon extends Run.Jig {
  upgrade() { this.upgrades = (this.upgrades || 0) + 1; }
  send(address) { this.owner = address; }

(async ()=> {

  // Initialize HandCashPurse and HandCashOwner
  const handcashPurse = HandCashPurse.fromAuthToken(player1AuthToken, Environments.prod, appSecret);
  const handcashOwner = HandCashOwner.fromAuthToken(player1AuthToken, Environments.prod, appSecret);

  // Initialize RUN using these two components
  const run = new Run({
    purse: handcashPurse,
    owner: handcashOwner,

  // Deploy a Jig
  const Weapon = run.deploy(Weapon)
  const sword = new Weapon();
  await run.sync();

  // Send a Jig from one user to another
  player2Owner = HandCashOwner.fromAuthToken(player2AuthToken, Environments.prod, appSecret);
  const nextOwner = await play2Owner.nextOwner()
  await run.sync()