context

package
v0.98.5 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Script     []byte                    `json:"script"`
	Parameters []smartcontract.Parameter `json:"parameters"`
	Signatures map[string][]byte         `json:"signatures"`
}

Item represents a transaction context item.

func (*Item) AddSignature

func (it *Item) AddSignature(pub *keys.PublicKey, sig []byte)

AddSignature adds a signature for pub.

func (*Item) GetSignature

func (it *Item) GetSignature(pub *keys.PublicKey) []byte

GetSignature returns signature for pub if present.

type ParameterContext

type ParameterContext struct {
	// Type is a type of a verifiable item.
	Type string
	// Network is a network this context belongs to.
	Network netmode.Magic
	// Verifiable is an object which can be (de-)serialized.
	Verifiable crypto.VerifiableDecodable
	// Items is a map from script hashes to context items.
	Items map[util.Uint160]*Item
}

ParameterContext represents smartcontract parameter's context.

func NewParameterContext

func NewParameterContext(typ string, network netmode.Magic, verif crypto.VerifiableDecodable) *ParameterContext

NewParameterContext returns ParameterContext with the specified type and item to sign.

func (*ParameterContext) AddSignature

func (c *ParameterContext) AddSignature(h util.Uint160, ctr *wallet.Contract, pub *keys.PublicKey, sig []byte) error

AddSignature adds a signature for the specified contract and public key.

func (*ParameterContext) GetWitness

func (c *ParameterContext) GetWitness(h util.Uint160) (*transaction.Witness, error)

GetWitness returns invocation and verification scripts for the specified contract.

func (ParameterContext) MarshalJSON

func (c ParameterContext) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*ParameterContext) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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