action

package
v0.0.0-...-917f730 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STRING_IDENTIFIER_REGEX = "^[a-zA-Z0-9_]+$"
	ENTRYPOINT_REGEX        = "^[a-zA-Z0-9_]{1,31}$"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Kind    ActionKind      `json:"kind"`
	Payload json.RawMessage `json:"payload"`
}

type ActionKind

type ActionKind string
const (
	CreateImplicitAccount ActionKind = "create_implicit_account"
	OriginateContract     ActionKind = "originate_contract"
	CallContract          ActionKind = "call_contract"
	AssertAccountBalance  ActionKind = "assert_account_balance"
	AssertContractStorage ActionKind = "assert_contract_storage"
	ModifyBlockLevel      ActionKind = "modify_block_level"
	ModifyBlockTimestamp  ActionKind = "modify_block_timestamp"
	ModifyChainID         ActionKind = "modify_chain_id"
	PackData              ActionKind = "pack_data"
)

type ActionResult

type ActionResult struct {
	Status ActionStatus `json:"status"`
	Action interface{}  `json:"action"`
	Result interface{}  `json:"result,omitempty"`
}

func ApplyActions

func ApplyActions(mockup business.Mockup, actions []IAction) []ActionResult

ApplyActions executes each test action

type ActionStatus

type ActionStatus string
const (
	Failure ActionStatus = "failure"
	Success ActionStatus = "success"
)

type AssertAccountBalanceAction

type AssertAccountBalanceAction struct {
	AccountName string
	Balance     business.Mutez
	// contains filtered or unexported fields
}

func (AssertAccountBalanceAction) Action

func (action AssertAccountBalanceAction) Action() interface{}

Marshal returns the JSON of the action (cached)

func (AssertAccountBalanceAction) Run

func (action AssertAccountBalanceAction) Run(mockup business.Mockup) (interface{}, bool)

Perform the action

func (*AssertAccountBalanceAction) Unmarshal

func (action *AssertAccountBalanceAction) Unmarshal(ac Action) error

Unmarshal action

type AssertContractStorageAction

type AssertContractStorageAction struct {
	ContractName string
	Storage      ast.Node
	// contains filtered or unexported fields
}

func (AssertContractStorageAction) Action

func (action AssertContractStorageAction) Action() interface{}

Marshal returns the JSON of the action (cached)

func (AssertContractStorageAction) Run

func (action AssertContractStorageAction) Run(mockup business.Mockup) (result interface{}, success bool)

Perform the action

func (*AssertContractStorageAction) Unmarshal

func (action *AssertContractStorageAction) Unmarshal(ac Action) error

Unmarshal action

type CallContractAction

type CallContractAction struct {
	Recipient      string
	Sender         string
	Entrypoint     string
	Amount         business.Mutez
	Parameter      ast.Node
	ExpectFailwith ast.Node
	// contains filtered or unexported fields
}

func (CallContractAction) Action

func (action CallContractAction) Action() interface{}

Marshal returns the JSON of the action (cached)

func (CallContractAction) Run

func (action CallContractAction) Run(mockup business.Mockup) (interface{}, bool)

Perform the action

func (*CallContractAction) Unmarshal

func (action *CallContractAction) Unmarshal(ac Action) error

Unmarshal action

type CreateImplicitAccountAction

type CreateImplicitAccountAction struct {
	Name    string
	Balance business.Mutez
	// contains filtered or unexported fields
}

func (CreateImplicitAccountAction) Action

func (action CreateImplicitAccountAction) Action() interface{}

Marshal returns the JSON of the action (cached)

func (CreateImplicitAccountAction) Run

func (action CreateImplicitAccountAction) Run(mockup business.Mockup) (interface{}, bool)

Perform action (Creates an implicit account)

func (*CreateImplicitAccountAction) Unmarshal

func (action *CreateImplicitAccountAction) Unmarshal(ac Action) error

Unmarshal action

type IAction

type IAction interface {
	Run(mockup business.Mockup) (interface{}, bool)
	Unmarshal(action Action) error
	Action() interface{}
}

func GetActions

func GetActions(rawActions []Action) ([]IAction, error)

GetActions unmarshal test actions

type ModifyBlockLevelAction

type ModifyBlockLevelAction struct {
	Level int32
	// contains filtered or unexported fields
}

func (ModifyBlockLevelAction) Action

func (action ModifyBlockLevelAction) Action() interface{}

Marshal returns the JSON of the action (cached)

func (ModifyBlockLevelAction) Run

func (action ModifyBlockLevelAction) Run(mockup business.Mockup) (interface{}, bool)

Perform the action

func (*ModifyBlockLevelAction) Unmarshal

func (action *ModifyBlockLevelAction) Unmarshal(ac Action) error

Unmarshal action

type ModifyBlockTimestampAction

type ModifyBlockTimestampAction struct {
	Timestamp time.Time
	// contains filtered or unexported fields
}

func (ModifyBlockTimestampAction) Action

func (action ModifyBlockTimestampAction) Action() interface{}

Marshal returns the JSON of the action (cached)

func (ModifyBlockTimestampAction) Run

func (action ModifyBlockTimestampAction) Run(mockup business.Mockup) (interface{}, bool)

Perform the action

func (*ModifyBlockTimestampAction) Unmarshal

func (action *ModifyBlockTimestampAction) Unmarshal(ac Action) error

Unmarshal action

type ModifyChainIdAction

type ModifyChainIdAction struct {
	ChainID string
	// contains filtered or unexported fields
}

func (ModifyChainIdAction) Action

func (action ModifyChainIdAction) Action() interface{}

Marshal returns the JSON of the action (cached)

func (ModifyChainIdAction) Run

func (action ModifyChainIdAction) Run(mockup business.Mockup) (interface{}, bool)

Perform the action

func (*ModifyChainIdAction) Unmarshal

func (action *ModifyChainIdAction) Unmarshal(ac Action) error

Unmarshal action

type OriginateContractAction

type OriginateContractAction struct {
	Name    string
	Balance business.Mutez
	Code    ast.Node
	Storage ast.Node
	// contains filtered or unexported fields
}

func (OriginateContractAction) Action

func (action OriginateContractAction) Action() interface{}

Marshal returns the JSON of the action (cached)

func (OriginateContractAction) Run

func (action OriginateContractAction) Run(mockup business.Mockup) (interface{}, bool)

Run performs action (Originates a contract)

func (*OriginateContractAction) Unmarshal

func (action *OriginateContractAction) Unmarshal(ac Action) error

Unmarshal action

type PackDataAction

type PackDataAction struct {
	Data ast.Node
	Type ast.Node
	// contains filtered or unexported fields
}

func (PackDataAction) Action

func (action PackDataAction) Action() interface{}

Marshal returns the JSON of the action (cached)

func (PackDataAction) Run

func (action PackDataAction) Run(mockup business.Mockup) (interface{}, bool)

Run performs action (Serializes a michelson value)

func (*PackDataAction) Unmarshal

func (action *PackDataAction) Unmarshal(ac Action) error

Unmarshal action

Jump to

Keyboard shortcuts

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