tx

package
v0.10.8 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CtxTransientKey    = `TransientMap`
	CtxSignerKey       = `SigningIdentity`
	CtxTxWaiterKey     = `TxWaiter`
	CtxEndorserMSPsKey = `EndorserMSPs`
)

Variables

View Source
var (
	ErrSignerNotDefined    = errors.New(`signer not defined`)
	ErrChaincodeNotDefined = errors.New(`chaincode not defined`)
)
View Source
var (
	// ErrSignerNotDefinedInContext msp.SigningIdentity is not defined in context
	ErrSignerNotDefinedInContext = errors.New(`signer is not defined in context`)
)
View Source
var (
	ErrUnknownArgType = errors.New(`unknown arg type`)
)

Functions

func ArgBytes

func ArgBytes(arg interface{}) ([]byte, error)

func ArgsBytes

func ArgsBytes(args ...interface{}) ([][]byte, error)

func ChooseSigner

func ChooseSigner(ctx context.Context, signer, defaultSigner msp.SigningIdentity) msp.SigningIdentity

func ContextWithEndorserMSPs

func ContextWithEndorserMSPs(ctx context.Context, endorserMSPs []string) context.Context

func ContextWithSigner

func ContextWithSigner(ctx context.Context, signer msp.SigningIdentity) context.Context

func ContextWithTransientMap

func ContextWithTransientMap(ctx context.Context, transient map[string][]byte) context.Context

func ContextWithTransientValue

func ContextWithTransientValue(ctx context.Context, key string, value []byte) context.Context

func ContextWithTxWaiter

func ContextWithTxWaiter(ctx context.Context, txWaiterType string) context.Context

func EndorserMSPsFromContext

func EndorserMSPsFromContext(ctx context.Context) []string

func FnArgs

func FnArgs(fn string, args ...[]byte) [][]byte

func GenerateID

func GenerateID(creator msp.SigningIdentity) (id string, nonce []byte, err error)

func GenerateIDForSerializedIdentity

func GenerateIDForSerializedIdentity(creator []byte) (id string, nonce []byte, err error)

func InvokeBytesProto

func InvokeBytesProto(ctx context.Context, invoker api.Invoker, channel, chaincode string, args [][]byte, target proto.Message) (proto.Message, error)

func InvokeProto

func InvokeProto(ctx context.Context, invoker api.Invoker, channel, chaincode string, args []interface{}, target proto.Message) (proto.Message, error)

func InvokeStringsProto

func InvokeStringsProto(ctx context.Context, invoker api.Invoker, channel, chaincode string, args []string, target proto.Message) (proto.Message, error)

func NewEndorsementSignedProposal

func NewEndorsementSignedProposal(
	channel, chaincode string, args [][]byte, signer msp.SigningIdentity, transientMap map[string][]byte) (
	signedProposal *peer.SignedProposal, txID string, err error)

func NewSeekBlockEnvelope

func NewSeekBlockEnvelope(channel string, signer msp.SigningIdentity, start, stop *orderer.SeekPosition, tlsCertHash []byte) (
	*common.Envelope, error)

func NewSeekGenesisEnvelope

func NewSeekGenesisEnvelope(channel string, signer msp.SigningIdentity, tlsCertHash []byte) (*common.Envelope, error)

func QueryBytesProto

func QueryBytesProto(ctx context.Context, querier api.Querier, channel, chaincode string, args [][]byte, target proto.Message) (proto.Message, error)

func QueryProto

func QueryProto(ctx context.Context, querier api.Querier, channel, chaincode string, args []interface{}, target proto.Message) (proto.Message, error)

func QueryStringsProto

func QueryStringsProto(ctx context.Context, querier api.Querier, channel, chaincode string, args []string, target proto.Message) (proto.Message, error)

func SignerFromContext

func SignerFromContext(ctx context.Context) msp.SigningIdentity

func StringArgsBytes

func StringArgsBytes(args ...string) [][]byte

func TimestampNow

func TimestampNow() *timestamp.Timestamp

func TransientFromContext

func TransientFromContext(ctx context.Context) map[string][]byte

func TxWaiterFromContext

func TxWaiterFromContext(ctx context.Context) string

TxWaiterFromContext - fetch 'txWaiterType' param which identify transaction waiting policy what params you'll have depends on your implementation for example, in hlf-sdk: available: 'self'(wait for one peer of endorser org), 'all'(wait for each organizations from endorsement policy) default is 'self'(even if you pass empty string)

Types

type Endorsement

type Endorsement struct {
	Channel      string
	Chaincode    string
	Args         [][]byte
	Signer       msp.SigningIdentity
	TransientMap map[string][]byte
}

func (Endorsement) SignedProposal

func (e Endorsement) SignedProposal() (signedProposal *peer.SignedProposal, txID string, err error)

type Params

type Params struct {
	ID        string
	Nonce     []byte
	Timestamp *timestamp.Timestamp
}

func GenerateParams

func GenerateParams(creator msp.SigningIdentity) (*Params, error)

func GenerateParamsForSerializedIdentity

func GenerateParamsForSerializedIdentity(creator []byte) (*Params, error)

type ProtoInvoker

type ProtoInvoker struct {
	*ProtoQuerier

	Invoker   api.Invoker
	Channel   string
	Chaincode string
}

func NewProtoInvoker

func NewProtoInvoker(invoker api.Invoker, channel, chaincode string) *ProtoInvoker

type ProtoQuerier

type ProtoQuerier struct {
	Querier   api.Querier
	Channel   string
	Chaincode string
}

func NewProtoQuerier

func NewProtoQuerier(querier api.Querier, channel, chaincode string) *ProtoQuerier

func (*ProtoQuerier) Query

func (c *ProtoQuerier) Query(ctx context.Context, args ...interface{}) (*peer.Response, error)

func (*ProtoQuerier) QueryBytes

func (c *ProtoQuerier) QueryBytes(ctx context.Context, args ...[]byte) (*peer.Response, error)

func (*ProtoQuerier) QueryBytesProto

func (c *ProtoQuerier) QueryBytesProto(ctx context.Context, args [][]byte, target proto.Message) (proto.Message, error)

func (*ProtoQuerier) QueryProto

func (c *ProtoQuerier) QueryProto(ctx context.Context, args []interface{}, target proto.Message) (proto.Message, error)

func (*ProtoQuerier) QueryStringsProto

func (c *ProtoQuerier) QueryStringsProto(ctx context.Context, args []string, target proto.Message) (proto.Message, error)

type SeekBlock

type SeekBlock struct {
	Channel string
	Signer  msp.SigningIdentity

	Start *orderer.SeekPosition
	Stop  *orderer.SeekPosition
}

func (SeekBlock) CreateEnvelope

func (sb SeekBlock) CreateEnvelope() (*common.Envelope, error)

Jump to

Keyboard shortcuts

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