Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contract ¶
type Contract struct { Name string Info metadata.InfoMetadata TransactionContextHandler SettableTransactionContextInterface }
func (*Contract) GetInfo ¶
func (c *Contract) GetInfo() metadata.InfoMetadata
GetInfo returns the info about the contract for use in metadata
func (*Contract) GetTransactionContextHandler ¶
func (c *Contract) GetTransactionContextHandler() SettableTransactionContextInterface
GetTransactionContextHandler returns the current transaction context set for the contract. If none has been set then TransactionContext will be returned
type ContractImpl ¶
type ContractImpl struct { DefaultContract string Info metadata.InfoMetadata TransactionSerializer serializer.TransactionSerializer // contains filtered or unexported fields }
func NewContract ¶
func NewContract(contract ContractInterface) (*ContractImpl, error)
func (*ContractImpl) Init ¶
func (ci *ContractImpl) Init(stub shim.ContractStubInterface) *pb.ContractMessage
func (*ContractImpl) Invoke ¶
func (ci *ContractImpl) Invoke(stub shim.ContractStubInterface) *pb.ContractMessage
func (*ContractImpl) Start ¶
func (ci *ContractImpl) Start() error
type ContractInterface ¶
type ContractInterface interface { GetInfo() metadata.InfoMetadata GetName() string GetTransactionContextHandler() SettableTransactionContextInterface }
type SettableTransactionContextInterface ¶
type SettableTransactionContextInterface interface { // SetStub should provide a way to pass the stub from a chaincode transaction // call to the transaction context so that it can be used by contract functions. // This is called by Init/Invoke with the stub passed. SetStub(stubInterface shim.ContractStubInterface) }
SettableTransactionContextInterface defines functions a valid transaction context should have. Transaction context's set for contracts to be used in chaincode must implement this interface.
type TransactionContext ¶
type TransactionContext struct {
// contains filtered or unexported fields
}
func (*TransactionContext) GetStub ¶
func (ctx *TransactionContext) GetStub() shim.ContractStubInterface
func (*TransactionContext) SetStub ¶
func (ctx *TransactionContext) SetStub(stub shim.ContractStubInterface)
type TransactionContextInterface ¶
type TransactionContextInterface interface { // GetStub should provide a way to access the stub set by Init/Invoke GetStub() shim.ContractStubInterface }
TransactionContextInterface defines the interface which TransactionContext meets. This can be taken by transacton functions on a contract which has not set a custom transaction context to allow transaction functions to take an interface to simplify unit testing.