chaincode

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: Apache-2.0 Imports: 24 Imported by: 11

Documentation

Index

Constants

View Source
const (
	EventIBC = "ibc"
)

Variables

This section is empty.

Functions

func DecodeString

func DecodeString(s string) ([]byte, error)

func DefaultDBProvider

func DefaultDBProvider(stub shim.ChaincodeStubInterface) dbm.DB

func EncodeToString

func EncodeToString(bz []byte) string

func HandlePacketAcknowledgementEvent

func HandlePacketAcknowledgementEvent(ctx contractapi.TransactionContextInterface, events []abci.Event) (continue_ bool, err error)

HandlePacketAcknowledgementEvent handles events and put acks which are parsed from events on state DB

func HandlePacketEvent

func HandlePacketEvent(ctx contractapi.TransactionContextInterface, events []abci.Event) (continue_ bool, err error)

HandlePacketEvent handles events and put packets which are parsed from events on state DB

Types

type AppProvider

type AppProvider func(appName string, logger log.Logger, db dbm.DB, traceStore io.Writer, seqMgr commitment.SequenceManager, blockProvider app.BlockProvider, anteHandlerProvider app.AnteHandlerProvider) (app.Application, error)

type AppRunner

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

func NewAppRunner

func NewAppRunner(
	appName string,
	logger log.Logger,
	appProvider AppProvider,
	anteHandlerProvider app.AnteHandlerProvider,
	dbProvider DBProvider,
	seqMgr commitment.SequenceManager,
) AppRunner

func (AppRunner) GetBlockProvider

func (r AppRunner) GetBlockProvider(stub shim.ChaincodeStubInterface) app.BlockProvider

func (AppRunner) Init

func (r AppRunner) Init(stub shim.ChaincodeStubInterface, appStateBytes []byte) error

func (AppRunner) Query

func (AppRunner) RunFunc

func (r AppRunner) RunFunc(stub shim.ChaincodeStubInterface, f func(app.Application) error) error

func (AppRunner) RunTx

func (r AppRunner) RunTx(stub shim.ChaincodeStubInterface, txBytes []byte) (*app.ResponseTx, []abci.Event, error)

type DBProvider

type DBProvider func(shim.ChaincodeStubInterface) dbm.DB

type EventHandler

type EventHandler interface {
	Handle(ctx contractapi.TransactionContextInterface, events []abci.Event) (continue_ bool, err error)
}

EventHandler defines the interface of handling the events of application

type EventHandlerFunc

type EventHandlerFunc func(ctx contractapi.TransactionContextInterface, events []abci.Event) (continue_ bool, err error)

EventHandlerFunc is a function type which handles application events

func (EventHandlerFunc) Handle

func (f EventHandlerFunc) Handle(ctx contractapi.TransactionContextInterface, events []abci.Event) (continue_ bool, err error)

Handle implements EventHandler.Handle

type IBCChaincode

type IBCChaincode struct {
	contractapi.Contract
	// contains filtered or unexported fields
}

IBCChaincode provides Cosmos-SDK based Applicatoin which implements IBC

func NewIBCChaincode

func NewIBCChaincode(appName string, logger log.Logger, seqMgr commitment.SequenceManager, appProvider AppProvider, anteHandlerProvider app.AnteHandlerProvider, dbProvider DBProvider, eventHandler MultiEventHandler) *IBCChaincode

NewIBCChaincode returns a new instance of IBCChaincode

func (*IBCChaincode) EndorseChannelState

func (c *IBCChaincode) EndorseChannelState(ctx contractapi.TransactionContextInterface, portID, channelID string) (*commitment.CommitmentEntry, error)

func (*IBCChaincode) EndorseClientState

func (*IBCChaincode) EndorseConnectionState

func (c *IBCChaincode) EndorseConnectionState(ctx contractapi.TransactionContextInterface, connectionID string) (*commitment.CommitmentEntry, error)

func (*IBCChaincode) EndorseConsensusStateCommitment

func (c *IBCChaincode) EndorseConsensusStateCommitment(ctx contractapi.TransactionContextInterface, clientID string, height uint64) (*commitment.CommitmentEntry, error)

func (*IBCChaincode) EndorseNextSequenceRecv

func (c *IBCChaincode) EndorseNextSequenceRecv(ctx contractapi.TransactionContextInterface, portID, channelID string) (*commitment.CommitmentEntry, error)

func (*IBCChaincode) EndorsePacketAcknowledgement

func (c *IBCChaincode) EndorsePacketAcknowledgement(ctx contractapi.TransactionContextInterface, portID, channelID string, sequence uint64) (*commitment.CommitmentEntry, error)

func (*IBCChaincode) EndorsePacketCommitment

func (c *IBCChaincode) EndorsePacketCommitment(ctx contractapi.TransactionContextInterface, portID, channelID string, sequence uint64) (*commitment.CommitmentEntry, error)

func (*IBCChaincode) EndorsePacketReceiptAbsence added in v0.2.1

func (c *IBCChaincode) EndorsePacketReceiptAbsence(ctx contractapi.TransactionContextInterface, portID, channelID string, sequence uint64) (*commitment.CommitmentEntry, error)

func (*IBCChaincode) EndorseSequenceCommitment

func (IBCChaincode) GetAppRunner

func (c IBCChaincode) GetAppRunner() AppRunner

func (*IBCChaincode) GetIgnoredFunctions

func (c *IBCChaincode) GetIgnoredFunctions() []string

func (*IBCChaincode) GetSequence

GetSequence returns current Sequence

func (*IBCChaincode) HandleTx

HandleTx handles a transaction

func (*IBCChaincode) InitChaincode

func (c *IBCChaincode) InitChaincode(ctx contractapi.TransactionContextInterface, appStateJSON string) error

InitChaincode initialize the state of the chaincode This must be called when the chaincode is initialized

func (*IBCChaincode) Query

func (*IBCChaincode) QueryPacket

func (c *IBCChaincode) QueryPacket(ctx contractapi.TransactionContextInterface, portID, channelID string, sequence uint64) (string, error)

QueryPacket returns a packet that matches given arguments

func (*IBCChaincode) QueryPacketAcknowledgement

func (c *IBCChaincode) QueryPacketAcknowledgement(ctx contractapi.TransactionContextInterface, portID, channelID string, sequence uint64) (string, error)

QueryPacketAcknowledgement returns a packet acknowledgement that matches given arguments

func (*IBCChaincode) SetEventHandler

func (c *IBCChaincode) SetEventHandler(handler MultiEventHandler)

SetEventHandler sets IBCChaincode to a given handler

func (*IBCChaincode) UpdateSequence

UpdateSequence updates Sequence

type MultiEventHandler

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

MultiEventHandler is a handler which handles application events by multiple handlers

func DefaultMultiEventHandler

func DefaultMultiEventHandler() MultiEventHandler

DefaultMultiEventHandler returns a handler which satisfies minimum requirements

func NewMultiEventHandler

func NewMultiEventHandler(handlers ...EventHandler) MultiEventHandler

NewMultiEventHandler creates a instance of MultiEventHandler

func (MultiEventHandler) Handle

Handle handles a given events by multiple handlers

Directories

Path Synopsis
tests
x

Jump to

Keyboard shortcuts

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