goclient

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ErrMissingFee = internal.Error("invocation fee must be positive")

ErrMissingFee is returned by functions that expect a positive invocation fee, but received non-positive.

View Source
const ErrNilClient = internal.Error("go client is nil")

ErrNilClient is returned by functions that expect a non-nil Client, but received nil.

View Source
const HaltState = "HALT"

HaltState returned if TestInvoke function processed without panic.

Variables

This section is empty.

Functions

func ArrayFromStackParameter

func ArrayFromStackParameter(param sc.Parameter) ([]sc.Parameter, error)

ArrayFromStackParameter returns the slice contract parameters from passed parameter.

If passed parameter carries boolean false value, (nil, nil) returns.

func BoolFromStackParameter

func BoolFromStackParameter(param sc.Parameter) (bool, error)

BoolFromStackParameter receives boolean value from the value of a smart contract parameter.

func BytesFromStackParameter

func BytesFromStackParameter(param sc.Parameter) ([]byte, error)

BytesFromStackParameter receives binary value from the value of a smart contract parameter.

func IntFromStackParameter

func IntFromStackParameter(param sc.Parameter) (int64, error)

IntFromStackParameter receives numerical value from the value of a smart contract parameter.

func ReadStorage

func ReadStorage(c *Client, contract util.Uint160, key []byte) ([]byte, error)

ReadStorage of the contract directly. Use it for debug, try to obtain smart-contract data from contract method with TestInvoke function.

func StringFromStackParameter

func StringFromStackParameter(param sc.Parameter) (string, error)

StringFromStackParameter receives string value from the value of a smart contract parameter.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a neo-go wrapper that provides smart-contract invocation interface.

func New

func New(ctx context.Context, p *Params) (*Client, error)

New is a Client constructor.

func (*Client) Invoke

func (c *Client) Invoke(contract util.Uint160, fee util.Fixed8, method string, args ...interface{}) error

Invoke invokes contract method by sending transaction into blockchain. Supported args types: int64, string, util.Uint160, []byte and bool.

If passed fee is non-positive, ErrMissingFee returns.

func (*Client) TestInvoke

func (c *Client) TestInvoke(contract util.Uint160, method string, args ...interface{}) ([]sc.Parameter, error)

TestInvoke invokes contract method locally in neo-go node. This method should be used to read data from smart-contract.

type Params

type Params struct {
	Log         *zap.Logger
	Key         *ecdsa.PrivateKey
	Endpoint    string
	Magic       netmode.Magic
	DialTimeout time.Duration
}

Params is a group of Client's constructor parameters.

Jump to

Keyboard shortcuts

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