std

package
v0.0.0-...-aa68697 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const REGION_HEAD_SIZE uint32 = 12

Variables

View Source
var ErrIteratorDone = errors.New("iterator is done")

This is a special, placeholder to signal iteration is finished

Functions

func Deallocate

func Deallocate(pointer unsafe.Pointer)

func Package_message

func Package_message(msg []byte) unsafe.Pointer

func TranslateToRegion

func TranslateToRegion(b []byte, ptr uintptr) uintptr

func TranslateToSlice

func TranslateToSlice(ptr uintptr) []byte

func TranslateToString

func TranslateToString(ptr uintptr) string

func Translate_range_custom

func Translate_range_custom(ptr uintptr) []byte

Types

type Api

type Api interface {
	// CanonicalAddress converts the human-readable address to a canonical representation.
	CanonicalAddress(human types.HumanAddress) (types.CanonicalAddress, error)

	// HumanAddress converts the canonical address to a human-readable representation.
	HumanAddress(canonical types.CanonicalAddress) (types.HumanAddress, error)

	// ValidateAddress validates the human-readable address performing CanonicalAddress and HumanAddress conversions.
	ValidateAddress(human types.HumanAddress) error

	// Debug sends the debug log message to the host which can either process or ignore it.
	Debug(msg string)

	// VerifySecp256k1Signature verifies the given message hash against the signature with the public key, using the secp256k1 ECDSA parametrization.
	// Returns true if the signature is valid, false otherwise.
	VerifySecp256k1Signature(hash, signature, publicKey []byte) (bool, error)

	// RecoverSecp256k1PubKey recovers a public key from the message hash agains the signature, using the secp256k1 ECDSA parametrization and recovery param (0/1).
	RecoverSecp256k1PubKey(hash, signature []byte, recoveryParam Secp256k1RecoveryParam) ([]byte, error)

	// VerifyEd25519Signature verifies the given message against the signature with the public key, using the ed25519 parametrization.
	// Returns true if the signature is valid, false otherwise.
	VerifyEd25519Signature(message, signature, publicKey []byte) (bool, error)

	// VerifyEd25519Signatures verifies given messages against signatures with the public keys, using the ed25519 parametrization.
	// Returns true if all signature are valid, false otherwise.
	VerifyEd25519Signatures(messages, signatures, publicKeys [][]byte) (bool, error)
}

type Deps

type Deps struct {
	// Storage provides access to the data persistence layer at write and read level.
	Storage Storage
	// Api provides access to common utilities such as address
	// parsing and verification.
	Api Api
	// Querier is used to query information from other contracts.
	Querier Querier
}

Deps contains the dependencies passed to a contract's mutating entrypoints.

type Iterator

type Iterator interface {
	Next() (key, value []byte, err error)
}

type JSONType

type JSONType interface {
	MarshalJSON() ([]byte, error)
	UnmarshalJSON([]byte) error
}

type MemRegion

type MemRegion struct {
	Offset   uint32
	Capacity uint32
	Length   uint32
}

func BuildSectionsRegion

func BuildSectionsRegion(bs [][]byte) (unsafe.Pointer, *MemRegion)

BuildSectionsRegion creates a new MemRegion with sections. Section format: data [uint8...] | size [uint32, big endian]

func Build_region

func Build_region(size uint32, len uint32) (unsafe.Pointer, *MemRegion)

type Order

type Order uint32

Order defines how keys are ordered during iteration.

const (
	// Ascending orders ranged keys from smallest to biggest.
	Ascending Order = 1
	// Descending orders ranged keys from biggest to smallest.
	Descending Order = 2
)

type Querier

type Querier interface {
	RawQuery(request []byte) ([]byte, error)
}

type QuerierWrapper

type QuerierWrapper struct {
	Querier
}

func (QuerierWrapper) Query

func (q QuerierWrapper) Query(query types.ToQuery, result JSONType) error

func (QuerierWrapper) QueryAllBalances

func (q QuerierWrapper) QueryAllBalances(addr string) ([]types.Coin, error)

func (QuerierWrapper) QueryBalance

func (q QuerierWrapper) QueryBalance(addr string, denom string) (types.Coin, error)

func (QuerierWrapper) QueryContractInfo

func (q QuerierWrapper) QueryContractInfo(addr string) (*types.ContractInfo, error)

func (QuerierWrapper) QueryRaw

func (q QuerierWrapper) QueryRaw(addr string, key []byte, resp JSONType) error

func (QuerierWrapper) QuerySmart

func (q QuerierWrapper) QuerySmart(addr string, msg JSONType, resp JSONType) error

type ReadonlyStorage

type ReadonlyStorage interface {
	// Get gets the value of the provided key. If value is nil then the key does not exist.
	Get(key []byte) (value []byte)
	// Range ranges from start to end byte prefixes with the provided Order flag.
	Range(start, end []byte, order Order) (iterator Iterator)
}

ReadonlyStorage defines the behaviour of a KV with only read capabilities.

type Secp256k1RecoveryParam

type Secp256k1RecoveryParam uint8

Secp256k1RecoveryParam is used by the RecoverSecp256k1PubKey and indicates whether or not the y-coordinate of the original VerifyingKey is odd.

const (
	Secp256k1RecoveryParamYCoordIsOdd  Secp256k1RecoveryParam = 0
	Secp256k1RecoveryParamYCoordNotOdd Secp256k1RecoveryParam = 1
)

type SliceHeader_Go

type SliceHeader_Go struct {
	Data uintptr
	Len  int
	Cap  int
}

type SliceHeader_tinyGo

type SliceHeader_tinyGo struct {
	Data uintptr
	Len  uintptr
	Cap  uintptr
}

type Storage

type Storage interface {
	ReadonlyStorage

	// Set sets the key and value.
	Set(key, value []byte)
	// Remove removes the value from the db.
	Remove(key []byte)
}

Storage defines the behaviour of a KV with read and write capabilities.

Directories

Path Synopsis
Package math contains some human-readable mathematical primitives.
Package math contains some human-readable mathematical primitives.

Jump to

Keyboard shortcuts

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