run

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package run is for parsing run jigs

Index

Constants

View Source
const Prefix string = "run"

Prefix is the run protocol prefix found in the 1st pushdata

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command string

Command is the run command

const (
	DEPLOY  Command = "DEPLOY"
	NEW     Command = "NEW"
	CALL    Command = "CALL"
	UPGRADE Command = "UPGRADE"
)

Commands enum

type Jig

type Jig struct {
	AppID   string
	Version uint64
	Payload Payload // not sure what data format is actually best for this
}

Jig is a RunOnBitcoin object

func NewFromTape

func NewFromTape(tape bpu.Tape) (j *Jig, e error)

NewFromTape will create a new AIP object from a bob.Tape

func NewFromUtxo

func NewFromUtxo(utxo *bt.Output) (jig *Jig, e error)

NewFromUtxo returns a Jig from a bt.Output

func (*Jig) FromTape

func (j *Jig) FromTape(tape *bpu.Tape) error

FromTape sets Jig data from Bob Tape

func (*Jig) IsToken

func (j *Jig) IsToken() bool

IsToken checks this is a NEW Jig and extends the Token class TODO: Make check more strict, occurs befopre first '{' character

type Payload

type Payload struct {
	In   uint64        `json:"in"`
	Ref  []string      `json:"ref"`
	Out  []string      `json:"out"`
	Del  []string      `json:"del"`
	Cre  []interface{} `json:"cre"`
	Exec []Statement   `json:"exec"`
}

Payload contains the following run metadata: in Number of jig and code inputs ref Array of references to jigs and code used by not spent out State hashes of jigs and code in transaction outputs del State hashes of jigs and code deleted cre New owners of jigs and code created exec Statements to execute on the jigs

type Statement

type Statement struct {
	Op   Command
	Data []interface{} // Depends on command
}

Statement is command + data for execution Data depends on the command DEPLOY Upload new code [<src1>, <props1>, <src2>, <props2>, ...] NEW Instantiate a jig [<jig class>, <args>] CALL Call a method on a jig [<jig>, <method>, <args>] UPGRADE Replace code with new code [<code>, <src>, <props>]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL