context

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 4 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContext

func GetContext() (contextId ContextId, handler SdkHandler, permissionScope PermissionScope)

func PopContext

func PopContext(contextId ContextId)

func PushContext

func PushContext(contextId ContextId, handler SdkHandler, permissionScope PermissionScope)

Types

type ContextId

type ContextId []byte

type ContractInfo

type ContractInfo struct {
	PublicMethods []interface{}
	SystemMethods []interface{}
	EventsMethods []interface{}
	Permission    PermissionScope
}

type PermissionScope

type PermissionScope uint16
const (
	PERMISSION_SCOPE_SYSTEM  PermissionScope = 1
	PERMISSION_SCOPE_SERVICE PermissionScope = 2
)

type SdkHandler

type SdkHandler interface {

	// state
	SdkStateReadBytes(ctx ContextId, permissionScope PermissionScope, key []byte) []byte
	SdkStateWriteBytes(ctx ContextId, permissionScope PermissionScope, key []byte, value []byte)

	// service
	SdkServiceCallMethod(ctx ContextId, permissionScope PermissionScope, serviceName string, methodName string, args ...interface{}) []interface{}

	// events
	SdkEventsEmitEvent(ctx ContextId, permissionScope PermissionScope, eventFunctionSignature interface{}, args ...interface{})

	// ethereum
	SdkEthereumCallMethod(ctx ContextId, permissionScope PermissionScope, ethContractAddress string, jsonAbi string, ethBlockNumber uint64, methodName string, out interface{}, args ...interface{})
	SdkEthereumGetTransactionLog(ctx ContextId, permissionScope PermissionScope, ethContractAddress string, jsonAbi string, ethTxHash string, eventName string, out interface{}) (ethBlockNumber uint64, ethTxIndex uint32)
	SdkEthereumGetBlockNumber(ctx ContextId, permissionScope PermissionScope) (ethBlockNumber uint64)
	SdkEthereumGetBlockNumberByTime(ctx ContextId, permissionScope PermissionScope, ethBlockTimestamp uint64) (ethBlockNumber uint64)
	SdkEthereumGetBlockTime(ctx ContextId, permissionScope PermissionScope) (ethBlockTimestamp uint64)
	SdkEthereumGetBlockTimeByNumber(ctx ContextId, permissionScope PermissionScope, ethBlockNumber uint64) (ethBlockTimestamp uint64)

	// address
	SdkAddressGetSignerAddress(ctx ContextId, permissionScope PermissionScope) []byte
	SdkAddressGetCallerAddress(ctx ContextId, permissionScope PermissionScope) []byte
	SdkAddressGetOwnAddress(ctx ContextId, permissionScope PermissionScope) []byte
	SdkAddressGetContractAddress(ctx ContextId, permissionScope PermissionScope, contractName string) []byte

	// env
	SdkEnvGetBlockHeight(ctx ContextId, permissionScope PermissionScope) uint64
	SdkEnvGetBlockTimestamp(ctx ContextId, permissionScope PermissionScope) uint64
	SdkEnvGetBlockProposerAddress(ctx ContextId, permissionScope PermissionScope) []byte
	SdkEnvGetBlockCommittee(ctx ContextId, permissionScope PermissionScope) [][]byte
	SdkEnvGetNextBlockCommittee(ctx ContextId, permissionScope PermissionScope) [][]byte
	SdkEnvGetVirtualChainId(ctx ContextId, permissionScope PermissionScope) uint32
}

Directories

Path Synopsis
g
Package g exposes goroutine struct g to user space.
Package g exposes goroutine struct g to user space.

Jump to

Keyboard shortcuts

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