Documentation ¶
Index ¶
- type ViewContext
- func (ctx *ViewContext) AccountID() isc.AgentID
- func (ctx *ViewContext) Call(targetContract, epCode isc.Hname, params dict.Dict, _ *isc.Allowance) dict.Dict
- func (ctx *ViewContext) CallViewExternal(targetContract, epCode isc.Hname, params dict.Dict) (ret dict.Dict, err error)
- func (ctx *ViewContext) ChainID() *isc.ChainID
- func (ctx *ViewContext) ChainOwnerID() isc.AgentID
- func (ctx *ViewContext) CurrentContractHname() isc.Hname
- func (ctx *ViewContext) Debugf(format string, params ...interface{})
- func (ctx *ViewContext) GasBudgetLeft() uint64
- func (ctx *ViewContext) GasBurn(burnCode gas.BurnCode, par ...uint64)
- func (ctx *ViewContext) GasBurnEnable(enable bool)
- func (ctx *ViewContext) GasBurnLog() *gas.BurnLog
- func (ctx *ViewContext) GetAccountNFTs(agentID isc.AgentID) []iotago.NFTID
- func (ctx *ViewContext) GetAssets(agentID isc.AgentID) *isc.FungibleTokens
- func (ctx *ViewContext) GetBaseTokensBalance(agentID isc.AgentID) uint64
- func (ctx *ViewContext) GetBlockProof(blockIndex uint32) ([]byte, *trie_blake2b.Proof, error)
- func (ctx *ViewContext) GetContractRecord(contractHname isc.Hname) (ret *root.ContractRecord)
- func (ctx *ViewContext) GetContractStateCommitment(hn isc.Hname) ([]byte, error)
- func (ctx *ViewContext) GetMerkleProof(key []byte) (ret *trie_blake2b.Proof, err error)
- func (ctx *ViewContext) GetNFTData(nftID iotago.NFTID) isc.NFT
- func (ctx *ViewContext) GetNativeTokenBalance(agentID isc.AgentID, tokenID *iotago.NativeTokenID) *big.Int
- func (ctx *ViewContext) GetRootCommitment() (trie.VCommitment, error)
- func (ctx *ViewContext) Infof(format string, params ...interface{})
- func (ctx *ViewContext) LocateProgram(programHash hashing.HashValue) (vmtype string, binary []byte, err error)
- func (ctx *ViewContext) Panicf(format string, params ...interface{})
- func (ctx *ViewContext) Params() *isc.Params
- func (ctx *ViewContext) Processors() *processors.Cache
- func (ctx *ViewContext) StateReader() kv.KVStoreReader
- func (ctx *ViewContext) Timestamp() time.Time
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) *ViewContext
func (*ViewContext) AccountID ¶ added in v0.3.0
func (ctx *ViewContext) AccountID() isc.AgentID
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) ChainID ¶ added in v0.3.0
func (ctx *ViewContext) ChainID() *isc.ChainID
func (*ViewContext) ChainOwnerID ¶ added in v0.3.0
func (ctx *ViewContext) ChainOwnerID() 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) GasBurnLog ¶ added in v0.3.0
func (ctx *ViewContext) GasBurnLog() *gas.BurnLog
only for debugging
func (*ViewContext) GetAccountNFTs ¶ added in v0.3.0
func (ctx *ViewContext) GetAccountNFTs(agentID isc.AgentID) []iotago.NFTID
func (*ViewContext) GetAssets ¶ added in v0.3.0
func (ctx *ViewContext) GetAssets(agentID isc.AgentID) *isc.FungibleTokens
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_blake2b.Proof, 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_blake2b.Proof, 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, tokenID *iotago.NativeTokenID) *big.Int
func (*ViewContext) GetRootCommitment ¶ added in v0.3.0
func (ctx *ViewContext) GetRootCommitment() (trie.VCommitment, error)
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 (*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) StateReader ¶ added in v0.3.0
func (ctx *ViewContext) StateReader() kv.KVStoreReader
func (*ViewContext) Timestamp ¶ added in v0.3.0
func (ctx *ViewContext) Timestamp() time.Time