viewcontext

package
v1.0.2-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ViewContext added in v0.3.0

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

ViewContext implements the needed infrastructure to run external view calls, its more lightweight than vmcontext

func New

func New(ch chain.ChainCore, stateReader state.State, gasBurnLoggingEnabled bool) (*ViewContext, error)

func (*ViewContext) Call added in v0.3.0

func (ctx *ViewContext) Call(targetContract, epCode isc.Hname, params dict.Dict, _ *isc.Assets) dict.Dict

func (*ViewContext) CallViewExternal added in v0.3.0

func (ctx *ViewContext) CallViewExternal(targetContract, epCode isc.Hname, params dict.Dict) (ret dict.Dict, err error)

CallViewExternal calls a view from outside the VM, for example API call

func (*ViewContext) Caller added in v1.0.3

func (ctx *ViewContext) Caller() isc.AgentID

func (*ViewContext) ChainID added in v0.3.0

func (ctx *ViewContext) ChainID() isc.ChainID

func (*ViewContext) ChainInfo added in v1.0.3

func (ctx *ViewContext) ChainInfo() *isc.ChainInfo

func (*ViewContext) ChainOwnerID added in v0.3.0

func (ctx *ViewContext) ChainOwnerID() isc.AgentID

func (*ViewContext) ContractStateReaderWithGasBurn added in v1.0.3

func (ctx *ViewContext) ContractStateReaderWithGasBurn() kv.KVStoreReader

func (*ViewContext) CurrentContractAccountID added in v1.0.3

func (ctx *ViewContext) CurrentContractAccountID() isc.AgentID

func (*ViewContext) CurrentContractHname added in v0.3.0

func (ctx *ViewContext) CurrentContractHname() isc.Hname

func (*ViewContext) Debugf added in v0.3.0

func (ctx *ViewContext) Debugf(format string, params ...interface{})

func (*ViewContext) GasBudgetLeft added in v0.3.0

func (ctx *ViewContext) GasBudgetLeft() uint64

func (*ViewContext) GasBurn added in v0.3.0

func (ctx *ViewContext) GasBurn(burnCode gas.BurnCode, par ...uint64)

func (*ViewContext) GasBurnEnable added in v0.3.0

func (ctx *ViewContext) GasBurnEnable(enable bool)

func (*ViewContext) GasBurnEnabled added in v1.0.3

func (ctx *ViewContext) GasBurnEnabled() bool

func (*ViewContext) GasBurnLog added in v0.3.0

func (ctx *ViewContext) GasBurnLog() *gas.BurnLog

only for debugging

func (*ViewContext) GasBurned added in v0.3.7

func (ctx *ViewContext) GasBurned() uint64

func (*ViewContext) GasEstimateMode added in v1.0.3

func (ctx *ViewContext) GasEstimateMode() bool

func (*ViewContext) GetAccountNFTs added in v0.3.0

func (ctx *ViewContext) GetAccountNFTs(agentID isc.AgentID) []iotago.NFTID

func (*ViewContext) GetBaseTokensBalance added in v0.3.0

func (ctx *ViewContext) GetBaseTokensBalance(agentID isc.AgentID) uint64

func (*ViewContext) GetBlockProof added in v0.3.0

func (ctx *ViewContext) GetBlockProof(blockIndex uint32) ([]byte, *trie.MerkleProof, error)

GetBlockProof returns: - blockInfo record in serialized form - proof that the blockInfo is stored under the respective key. Useful for proving commitment to the past state, because blockInfo contains commitment to that block

func (*ViewContext) GetContractRecord added in v0.3.0

func (ctx *ViewContext) GetContractRecord(contractHname isc.Hname) (ret *root.ContractRecord)

func (*ViewContext) GetContractStateCommitment added in v0.3.0

func (ctx *ViewContext) GetContractStateCommitment(hn isc.Hname) ([]byte, error)

GetContractStateCommitment returns commitment to the contract's state, if possible. To be able to retrieve state commitment for the contract's state, the state must contain values of contracts hname at its nil key. Otherwise, function returns error

func (*ViewContext) GetMerkleProof added in v0.3.0

func (ctx *ViewContext) GetMerkleProof(key []byte) (ret *trie.MerkleProof, err error)

GetMerkleProof returns proof for the key. It may also contain proof of absence of the key

func (*ViewContext) GetNFTData added in v0.3.0

func (ctx *ViewContext) GetNFTData(nftID iotago.NFTID) *isc.NFT

func (*ViewContext) GetNativeTokenBalance added in v0.3.0

func (ctx *ViewContext) GetNativeTokenBalance(agentID isc.AgentID, nativeTokenID iotago.NativeTokenID) *big.Int

func (*ViewContext) GetNativeTokens added in v1.0.3

func (ctx *ViewContext) GetNativeTokens(agentID isc.AgentID) iotago.NativeTokens

func (*ViewContext) GetRootCommitment added in v0.3.0

func (ctx *ViewContext) GetRootCommitment() trie.Hash

GetRootCommitment calculates root commitment from state. A valid state must return root commitment equal to the L1Commitment from the anchor

func (*ViewContext) Infof added in v0.3.0

func (ctx *ViewContext) Infof(format string, params ...interface{})

func (*ViewContext) LocateProgram added in v0.3.0

func (ctx *ViewContext) LocateProgram(programHash hashing.HashValue) (vmtype string, binary []byte, err error)

func (*ViewContext) Panicf added in v0.3.0

func (ctx *ViewContext) Panicf(format string, params ...interface{})

func (*ViewContext) Params added in v0.3.0

func (ctx *ViewContext) Params() *isc.Params

func (*ViewContext) Processors added in v0.3.0

func (ctx *ViewContext) Processors() *processors.Cache

func (*ViewContext) SchemaVersion added in v1.0.3

func (ctx *ViewContext) SchemaVersion() isc.SchemaVersion

func (*ViewContext) Timestamp added in v0.3.0

func (ctx *ViewContext) Timestamp() time.Time

Jump to

Keyboard shortcuts

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