core

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const (
	WORLD = "world"
)

Variables

This section is empty.

Functions

func AssetIsValid

func AssetIsValid(v string) bool

func Hash

func Hash(t1 *Transaction, t2 *Transaction) string

func ValidateAddress

func ValidateAddress(addr string) bool

Types

type Account

type Account struct {
	Address  string                      `json:"address" example:"users:001"`
	Type     string                      `json:"type,omitempty" example:"virtual"`
	Balances map[string]int64            `json:"balances,omitempty" example:"COIN:100"`
	Volumes  map[string]map[string]int64 `json:"volumes,omitempty"`
	Metadata Metadata                    `json:"metadata" swaggertype:"object"`
}

type ConstantExpr

type ConstantExpr struct {
	Value interface{}
}

func (ConstantExpr) MarshalJSON

func (e ConstantExpr) MarshalJSON() ([]byte, error)

type Contract

type Contract struct {
	Expr    Expr   `json:"expr"`
	Account string `json:"account"`
}

func (Contract) Match

func (c Contract) Match(addr string) bool

func (*Contract) UnmarshalJSON

func (c *Contract) UnmarshalJSON(data []byte) error

type EvalContext

type EvalContext struct {
	Variables map[string]interface{}
	Metadata  Metadata
	Asset     string
}

type Expr

type Expr interface {
	Eval(EvalContext) bool
}

func ParseRule

func ParseRule(data string) (Expr, error)

func ParseRuleExpr

func ParseRuleExpr(v map[string]interface{}) (Expr, error)

type ExprAnd

type ExprAnd []Expr

func (ExprAnd) Eval

func (o ExprAnd) Eval(ctx EvalContext) bool

func (ExprAnd) MarshalJSON

func (e ExprAnd) MarshalJSON() ([]byte, error)

type ExprEq

type ExprEq struct {
	Op1 Value
	Op2 Value
}

func (*ExprEq) Eval

func (o *ExprEq) Eval(ctx EvalContext) bool

func (ExprEq) MarshalJSON

func (e ExprEq) MarshalJSON() ([]byte, error)

type ExprGt

type ExprGt struct {
	Op1 Value
	Op2 Value
}

func (*ExprGt) Eval

func (o *ExprGt) Eval(ctx EvalContext) bool

func (ExprGt) MarshalJSON

func (e ExprGt) MarshalJSON() ([]byte, error)

type ExprGte

type ExprGte struct {
	Op1 Value
	Op2 Value
}

func (*ExprGte) Eval

func (o *ExprGte) Eval(ctx EvalContext) bool

func (ExprGte) MarshalJSON

func (e ExprGte) MarshalJSON() ([]byte, error)

type ExprLt

type ExprLt struct {
	Op1 Value
	Op2 Value
}

func (*ExprLt) Eval

func (o *ExprLt) Eval(ctx EvalContext) bool

func (ExprLt) MarshalJSON

func (e ExprLt) MarshalJSON() ([]byte, error)

type ExprLte

type ExprLte struct {
	Op1 Value
	Op2 Value
}

func (*ExprLte) Eval

func (o *ExprLte) Eval(ctx EvalContext) bool

func (ExprLte) MarshalJSON

func (e ExprLte) MarshalJSON() ([]byte, error)

type ExprOr

type ExprOr []Expr

func (ExprOr) Eval

func (o ExprOr) Eval(ctx EvalContext) bool

func (ExprOr) MarshalJSON

func (e ExprOr) MarshalJSON() ([]byte, error)

type Mapping

type Mapping struct {
	Contracts []Contract `json:"contracts"`
}

type MetaExpr

type MetaExpr struct {
	Name string
}

func (MetaExpr) MarshalJSON

func (e MetaExpr) MarshalJSON() ([]byte, error)

type Metadata

type Metadata map[string]json.RawMessage

func (Metadata) IsReverted

func (m Metadata) IsReverted() bool

func (Metadata) MarkReverts added in v1.1.0

func (m Metadata) MarkReverts(txID string)

type Posting

type Posting struct {
	Source      string `json:"source"`
	Destination string `json:"destination"`
	Amount      int64  `json:"amount"`
	Asset       string `json:"asset"`
}

type Postings

type Postings []Posting

func (Postings) Reverse

func (ps Postings) Reverse()

type Script

type Script struct {
	Plain string                     `json:"plain"`
	Vars  map[string]json.RawMessage `json:"vars" swaggertype:"object"`
}

type Transaction

type Transaction struct {
	TransactionData
	ID        int64  `json:"txid"`
	Timestamp string `json:"timestamp"`
	Hash      string `json:"hash" swaggerignore:"true"`
}

func (*Transaction) AppendPosting

func (t *Transaction) AppendPosting(p Posting)

func (*Transaction) Reverse

func (t *Transaction) Reverse() TransactionData

type TransactionData

type TransactionData struct {
	Postings  Postings `json:"postings"`
	Reference string   `json:"reference"`
	Metadata  Metadata `json:"metadata" swaggertype:"object"`
}

type Transactions

type Transactions struct {
	Transactions []TransactionData `json:"transactions" binding:"required,dive"`
}

Transactions struct

type Value

type Value interface {
	// contains filtered or unexported methods
}

type VariableExpr

type VariableExpr struct {
	Name string
}

func (VariableExpr) MarshalJSON

func (e VariableExpr) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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