Download the SDK
(or npm install run-sdk)
v0.6.26
jigs // interactive objects
                        
class Dragon extends Jig {
    init(name) {
        this.name = name
    }
}


class DragonHouse extends Jig {
    init(dragon) {
        this.dragon = dragon
    }

    clean() {
        this.dirty = false
    }
}
                        
                    
                        
class Weapon extends Jig {
    init(damage) {
        this.damage = damage
    }
}


class Axe extends Weapon {
    init() {
        super.init(9001)
    }
}


new Axe() instanceof Weapon // true
                        
                    
                        
class LoyaltyCard extends Jig {
    init() {
        this.stamps = 0
    }

    stamp() {
        this.stamps += 1
    }
}
                        
                    
                        
class Product extends Jig {
    init(model, serial, date) {
        this.model = model
        this.serial = serial
        this.creation = date
    }

    transfer(to) {
        this.owner = to
    }
}
                        
                    
                        
class Vote extends Jig {
    vote(candidate) {
        this.candidate = candidate
    }
}


class Election extends Jig {
    // ...

    tally() {
        const counts = { 'Alice': 0, 'Bob': 0, 'Carol': 0 }
        this.voters.forEach((name, vote) => {
            counts[vote.candidate] += 1
        })
        return counts
    }
}
                        
                    
                        
class Dollar extends Token { }

Dollar.decimals = 2
Dollar.currency = 'USD'
Dollar.backingBank = 'HSBC'
Dollar.accountNumber = '#103947000'

run.deploy(Dollar)

const coin = Dollar.mint(100000)

coin.send(address, 1000)
                        
                    
                        
class User extends Jig { }


class UserGroup extends Jig {
    init() {
        this.users = []
    }

    addUser(user) {
        if (!this.users.includes(user)) {
            this.users.push(user)
        }
    }

    removeUser(user) {
        this.users = this.users.filter(u => user !== u)
    }
}
                        
                    
Dragon
When one company makes a digital pet dragon, another can make a house to live in. Jigs interact with each other.
Axe
The base class is the parent of all weapons in the game. Each weapon subclass independently sets the damage it delivers. Then you check whether a particular weapon is the correct type to allow in the game.
Loyalty Card
Any card you’d have in your iOS or Android wallet: boarding passes, prepaid cards.
Product
Track a physical good from manufacturing through delivery to the customer. Store both the unique serial number and the shared model number. When you transfer ownership, the official record is on-chain.
Vote
For any recorded decision, you can build a graphical user interface with a dropdown selection. Then, after a milestone, tally up the votes and set in motion the transition of power.
Dollar
Directly or indirectly link backing to a token. Send numerical amounts and provide the functionality of SLP and ERC20 tokens.
Permissions
Allow several people edit access to a website or raise a digital pet together with your friends. Also updates to the permissions are as easy as a cheap bitcoin transaction.