mockstub

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FnCheckAddress    = "checkAddress"
	FnCheckKeys       = "checkKeys"
	FnGetAccountInfo  = "getAccountInfo"
	FnGetAccountsInfo = "getAccountsInfo"
)

ACL chaincode functions

View Source
const (
	KeyLengthEd25519   = 32
	KeyLengthSecp256k1 = 65
	KeyLengthGOST      = 64

	PrefixUncompressedSecp259k1Key = 0x04
)

Key length

Variables

This section is empty.

Functions

func MockACLCheckAddress

func MockACLCheckAddress(_ *MockStub, parameters ...string) *peer.Response

func MockACLCheckKeys

func MockACLCheckKeys(_ *MockStub, parameters ...string) *peer.Response

func MockACLGetAccountInfo

func MockACLGetAccountInfo(_ *MockStub, _ ...string) *peer.Response

func MockACLGetAccountsInfo

func MockACLGetAccountsInfo(mockStub *MockStub, parameters ...string) *peer.Response

Types

type ExecutorRequest

type ExecutorRequest struct {
	User *mocks.UserFoundation
	Task *pbfound.Task
}

type MockStub

type MockStub struct {
	*mocks.ChaincodeStub
	GetStateCallsMap map[string][]byte
	InvokeACLMap     map[string]func(mockStub *MockStub, parameters ...string) *peer.Response
}

MockStub represents mock stub structure

func NewMockStub

func NewMockStub(t *testing.T) *MockStub

NewMockStub returns new mock stub

func (*MockStub) CreateAndSetConfig

func (ms *MockStub) CreateAndSetConfig(
	name, symbol string,
	decimals uint,
	issuer string,
	feeSetter string,
	feeAddressSetter string,
	admin string,
	tracingCollectorEndpoint *pbfound.CollectorEndpoint,
) string

CreateAndSetConfig creates config for token, based on BaseToken. If feeSetter is not set or empty, Token.FeeSetter will be nil. If feeAddressSetter is not set or empty, Token.FeeAddressSetter will be nil.

func (*MockStub) NbTxInvokeChaincode

func (ms *MockStub) NbTxInvokeChaincode(
	chaincode *core.Chaincode,
	functionName string,
	parameters ...string,
) *peer.Response

NbTxInvokeChaincode returns non batched transaction result

func (*MockStub) NbTxInvokeChaincodeSigned

func (ms *MockStub) NbTxInvokeChaincodeSigned(
	chaincode *core.Chaincode,
	functionName string,
	user *mocks.UserFoundation,
	requestID string,
	chaincodeName string,
	channelName string,
	parameters ...string,
) *peer.Response

NbTxInvokeChaincodeSigned returns non-batched transaction result with signed arguments

func (*MockStub) QueryChaincode

func (ms *MockStub) QueryChaincode(chaincode *core.Chaincode, functionName string, parameters ...string) *peer.Response

QueryChaincode returns query result

func (*MockStub) SetConfig

func (ms *MockStub) SetConfig(config string)

SetConfig sets config to MockStub state

func (*MockStub) TxInvokeChaincode

func (ms *MockStub) TxInvokeChaincode(
	chaincode *core.Chaincode,
	functionName string,
	parameters ...string,
) (string, *peer.Response)

TxInvokeChaincode returns result of batchExecute transaction

func (*MockStub) TxInvokeChaincodeMultisigned

func (ms *MockStub) TxInvokeChaincodeMultisigned(
	chaincode *core.Chaincode,
	functionName string,
	user *mocks.UserFoundationMultisigned,
	requestID string,
	chaincodeName string,
	channelName string,
	parameters ...string,
) (string, *peer.Response)

TxInvokeChaincodeMultisigned returns result of batchExecute transaction with signed arguments

func (*MockStub) TxInvokeChaincodeSigned

func (ms *MockStub) TxInvokeChaincodeSigned(
	chaincode *core.Chaincode,
	functionName string,
	user *mocks.UserFoundation,
	requestID string,
	chaincodeName string,
	channelName string,
	parameters ...string,
) (string, *peer.Response)

TxInvokeChaincodeSigned returns result of batchExecute transaction with signed arguments

func (*MockStub) TxInvokeTaskExecutor

func (ms *MockStub) TxInvokeTaskExecutor(
	chaincode *core.Chaincode,
	requestID string,
	chaincodeName string,
	channelName string,
	tasksReq []*ExecutorRequest,
) (string, *peer.Response)

TxInvokeTaskExecutor returns result of task execute transaction

Jump to

Keyboard shortcuts

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