Documentation ¶
Overview ¶
implements smart contract transaction. smart contract transaction is value transaction with special payload
Index ¶
- func RegisterSemanticAnalyzerConstructor(constr constructorNew)
- type NewStateSectionParams
- type RequestRef
- func (ref *RequestRef) RequestID() *coretypes.RequestID
- func (ref *RequestRef) RequestSection() *RequestSection
- func (ref *RequestRef) SenderAddress() *address.Address
- func (ref *RequestRef) SenderAgentID() coretypes.AgentID
- func (ref *RequestRef) SenderContractHname() coretypes.Hname
- func (ref *RequestRef) SenderContractID() (ret coretypes.ContractID, err error)
- type RequestSection
- func (req *RequestSection) Clone() *RequestSection
- func (req *RequestSection) EntryPointCode() coretypes.Hname
- func (req *RequestSection) Read(r io.Reader) error
- func (req *RequestSection) SenderContractHname() coretypes.Hname
- func (req *RequestSection) SolidArgs() dict.Dict
- func (req *RequestSection) SolidifyArgs(reg coretypes.BlobCache) (bool, error)
- func (req *RequestSection) String() string
- func (req *RequestSection) Target() coretypes.ContractID
- func (req *RequestSection) Timelock() uint32
- func (req *RequestSection) Transfer() coretypes.ColoredBalances
- func (req *RequestSection) WithArgs(args requestargs.RequestArgs) *RequestSection
- func (req *RequestSection) WithTimelock(tl uint32) *RequestSection
- func (req *RequestSection) WithTimelockUntil(deadline time.Time) *RequestSection
- func (req *RequestSection) WithTransfer(transfer coretypes.ColoredBalances) *RequestSection
- func (req *RequestSection) Write(w io.Writer) error
- type StateSection
- func (sb *StateSection) BlockIndex() uint32
- func (sb *StateSection) Clone() *StateSection
- func (sb *StateSection) Color() balance.Color
- func (sb *StateSection) Read(r io.Reader) error
- func (sb *StateSection) StateHash() hashing.HashValue
- func (sb *StateSection) String() string
- func (sb *StateSection) Timestamp() int64
- func (sb *StateSection) WithStateParams(stateIndex uint32, h hashing.HashValue, ts int64) *StateSection
- func (sb *StateSection) Write(w io.Writer) error
- type Transaction
- func (tx *Transaction) MustProperties() coretypes.SCTransactionProperties
- func (tx *Transaction) MustState() *StateSection
- func (tx *Transaction) OutputBalancesByAddress(addr address.Address) ([]*balance.Balance, bool)
- func (tx *Transaction) Properties() (coretypes.SCTransactionProperties, error)
- func (tx *Transaction) Requests() []*RequestSection
- func (tx *Transaction) Sender() *address.Address
- func (tx *Transaction) State() (*StateSection, bool)
- func (tx *Transaction) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterSemanticAnalyzerConstructor ¶ added in v0.1.0
func RegisterSemanticAnalyzerConstructor(constr constructorNew)
Types ¶
type NewStateSectionParams ¶ added in v0.1.0
type RequestRef ¶
type RequestRef struct { Tx *Transaction Index uint16 }
func (*RequestRef) RequestID ¶ added in v0.1.0
func (ref *RequestRef) RequestID() *coretypes.RequestID
func (*RequestRef) RequestSection ¶ added in v0.1.0
func (ref *RequestRef) RequestSection() *RequestSection
func (*RequestRef) SenderAddress ¶ added in v0.1.0
func (ref *RequestRef) SenderAddress() *address.Address
func (*RequestRef) SenderAgentID ¶ added in v0.1.0
func (ref *RequestRef) SenderAgentID() coretypes.AgentID
func (*RequestRef) SenderContractHname ¶ added in v0.1.0
func (ref *RequestRef) SenderContractHname() coretypes.Hname
func (*RequestRef) SenderContractID ¶ added in v0.1.0
func (ref *RequestRef) SenderContractID() (ret coretypes.ContractID, err error)
type RequestSection ¶ added in v0.1.0
type RequestSection struct {
// contains filtered or unexported fields
}
func NewRequestSection ¶ added in v0.1.0
func NewRequestSection(senderContractHname coretypes.Hname, targetContract coretypes.ContractID, entryPointCode coretypes.Hname) *RequestSection
RequestSection creates new request block
func NewRequestSectionByWallet ¶ added in v0.1.0
func NewRequestSectionByWallet(targetContract coretypes.ContractID, entryPointCode coretypes.Hname) *RequestSection
NewRequestSectionByWallet same as NewRequestSection but assumes senderAddress index is 0
func (*RequestSection) Clone ¶ added in v0.1.0
func (req *RequestSection) Clone() *RequestSection
func (*RequestSection) EntryPointCode ¶ added in v0.1.0
func (req *RequestSection) EntryPointCode() coretypes.Hname
func (*RequestSection) SenderContractHname ¶ added in v0.1.0
func (req *RequestSection) SenderContractHname() coretypes.Hname
func (*RequestSection) SolidArgs ¶ added in v0.1.0
func (req *RequestSection) SolidArgs() dict.Dict
SolidArgs returns solid args if decoded already or nil otherwise
func (*RequestSection) SolidifyArgs ¶ added in v0.1.0
func (req *RequestSection) SolidifyArgs(reg coretypes.BlobCache) (bool, error)
SolidifyArgs return true if solidified successfully
func (*RequestSection) String ¶ added in v0.1.0
func (req *RequestSection) String() string
func (*RequestSection) Target ¶ added in v0.1.0
func (req *RequestSection) Target() coretypes.ContractID
func (*RequestSection) Timelock ¶ added in v0.1.0
func (req *RequestSection) Timelock() uint32
func (*RequestSection) Transfer ¶ added in v0.1.0
func (req *RequestSection) Transfer() coretypes.ColoredBalances
func (*RequestSection) WithArgs ¶ added in v0.1.0
func (req *RequestSection) WithArgs(args requestargs.RequestArgs) *RequestSection
WithArgs sets encoded args
func (*RequestSection) WithTimelock ¶ added in v0.1.0
func (req *RequestSection) WithTimelock(tl uint32) *RequestSection
func (*RequestSection) WithTimelockUntil ¶ added in v0.1.0
func (req *RequestSection) WithTimelockUntil(deadline time.Time) *RequestSection
func (*RequestSection) WithTransfer ¶ added in v0.1.0
func (req *RequestSection) WithTransfer(transfer coretypes.ColoredBalances) *RequestSection
type StateSection ¶ added in v0.1.0
type StateSection struct {
// contains filtered or unexported fields
}
StateSection of the SC transaction. Represents SC state update previous state block can be determined by the chain transfer of the SC token in the UTXO part of the transaction
func NewStateSection ¶ added in v0.1.0
func NewStateSection(par NewStateSectionParams) *StateSection
func (*StateSection) BlockIndex ¶ added in v0.1.0
func (sb *StateSection) BlockIndex() uint32
func (*StateSection) Clone ¶ added in v0.1.0
func (sb *StateSection) Clone() *StateSection
func (*StateSection) Color ¶ added in v0.1.0
func (sb *StateSection) Color() balance.Color
func (*StateSection) StateHash ¶ added in v0.1.0
func (sb *StateSection) StateHash() hashing.HashValue
func (*StateSection) String ¶ added in v0.1.0
func (sb *StateSection) String() string
func (*StateSection) Timestamp ¶ added in v0.1.0
func (sb *StateSection) Timestamp() int64
func (*StateSection) WithStateParams ¶ added in v0.1.0
func (sb *StateSection) WithStateParams(stateIndex uint32, h hashing.HashValue, ts int64) *StateSection
type Transaction ¶
type Transaction struct { *valuetransaction.Transaction // contains filtered or unexported fields }
Smart contract transaction wraps value transaction the stateSection and requestSection are parsed from the dataPayload of the value transaction
func NewTransaction ¶
func NewTransaction(vtx *valuetransaction.Transaction, stateBlock *StateSection, requestBlocks []*RequestSection) (*Transaction, error)
creates new sc transaction. It is immutable, i.e. tx hash is stable
func ParseValueTransaction ¶
func ParseValueTransaction(vtx *valuetransaction.Transaction) (*Transaction, error)
parses dataPayload. Error is returned only if pre-parsing succeeded and parsing failed usually this can happen only due to targeted attack or
func (*Transaction) MustProperties ¶
func (tx *Transaction) MustProperties() coretypes.SCTransactionProperties
func (*Transaction) MustState ¶
func (tx *Transaction) MustState() *StateSection
func (*Transaction) OutputBalancesByAddress ¶
func (*Transaction) Properties ¶
func (tx *Transaction) Properties() (coretypes.SCTransactionProperties, error)
Properties returns valid properties if sc transaction is semantically correct
func (*Transaction) Requests ¶
func (tx *Transaction) Requests() []*RequestSection
func (*Transaction) Sender ¶
func (tx *Transaction) Sender() *address.Address
Sender returns first input address. It is the unique address, because ParseValueTransaction doesn't allow other options
func (*Transaction) State ¶
func (tx *Transaction) State() (*StateSection, bool)
func (*Transaction) String ¶
func (tx *Transaction) String() string
Directories ¶
Path | Synopsis |
---|---|
package semantically analyzes parsed smart contract transaction return object with transaction properties or error if semantically incorrect
|
package semantically analyzes parsed smart contract transaction return object with transaction properties or error if semantically incorrect |