Skip to content

@gala-chain/testReadme | API


@gala-chain/test / TestChaincodeStub

Class: TestChaincodeStub

Extends

  • ChaincodeStub

Constructors

new TestChaincodeStub(args, state, writes)

new TestChaincodeStub(args, state, writes): TestChaincodeStub

Parameters

args: string[]

state: undefined | Record\<string, string>

writes: undefined | Record\<string, string>

Returns

TestChaincodeStub

Overrides

ChaincodeStub.constructor

Source

chain-test/src/unit/TestChaincodeStub.ts:78


new TestChaincodeStub(client, channel_id, txId, chaincodeInput, signedProposal)

new TestChaincodeStub(client, channel_id, txId, chaincodeInput, signedProposal): ChaincodeStubClassType

Parameters

client: any

channel_id: any

txId: any

chaincodeInput: any

signedProposal: any

Returns

ChaincodeStubClassType

Overrides

ChaincodeStub.constructor

Source

chain-test/src/unit/TestChaincodeStub.ts:73

Properties

creator

creator: unknown

Inherited from

ChaincodeStub.creator

Source

chain-test/src/unit/TestChaincodeStub.ts:25


deleteState()

deleteState: (key) => Promise\<void>

Parameters

key: string

Returns

Promise\<void>

Overrides

ChaincodeStub.deleteState

Source

chain-test/src/unit/TestChaincodeStub.ts:126


getState()

getState: (key) => Promise\<Uint8Array>

Parameters

key: string

Returns

Promise\<Uint8Array>

Overrides

ChaincodeStub.getState

Source

chain-test/src/unit/TestChaincodeStub.ts:133


getStateByPartialCompositeKey()

getStateByPartialCompositeKey: (objectType, attributes) => FabricIterable\<KV>

Parameters

objectType: string

attributes: string[]

Returns

FabricIterable\<KV>

Overrides

ChaincodeStub.getStateByPartialCompositeKey

Source

chain-test/src/unit/TestChaincodeStub.ts:139


putState()

putState: (key, value) => Promise\<void>

Parameters

key: string

value: Uint8Array

Returns

Promise\<void>

Overrides

ChaincodeStub.putState

Source

chain-test/src/unit/TestChaincodeStub.ts:118


state

readonly state: Record\<string, string>

Source

chain-test/src/unit/TestChaincodeStub.ts:75


writes

readonly writes: Record\<string, string>

Source

chain-test/src/unit/TestChaincodeStub.ts:76


creator

static creator: unknown

Inherited from

ChaincodeStub.creator

Source

chain-test/src/unit/TestChaincodeStub.ts:25


epoch

static private epoch: number = 0

Source

chain-test/src/unit/TestChaincodeStub.ts:74

Methods

createCompositeKey()

createCompositeKey(objectType, attributes): string

Parameters

objectType: string

attributes: string[]

Returns

string

Inherited from

ChaincodeStub.createCompositeKey

Source

chain-test/src/unit/TestChaincodeStub.ts:27


deletePrivateData()

deletePrivateData(collection, key): Promise\<void>

Parameters

collection: string

key: string

Returns

Promise\<void>

Inherited from

ChaincodeStub.deletePrivateData

Source

node_modules/fabric-shim/types/index.d.ts:128


getArgs()

getArgs(): string[]

Returns

string[]

Inherited from

ChaincodeStub.getArgs

Source

node_modules/fabric-shim/types/index.d.ts:90


getBinding()

getBinding(): string

Returns

string

Inherited from

ChaincodeStub.getBinding

Source

node_modules/fabric-shim/types/index.d.ts:103


getChannelID()

getChannelID(): string

Returns

string

Inherited from

ChaincodeStub.getChannelID

Source

node_modules/fabric-shim/types/index.d.ts:95


getClientIdentity()

getClientIdentity(caUser, mspId): ClientIdentity

Parameters

caUser: string

mspId: string

Returns

ClientIdentity

Source

chain-test/src/unit/TestChaincodeStub.ts:110


getCreator()

getCreator(): SerializedIdentity

Returns

SerializedIdentity

Inherited from

ChaincodeStub.getCreator

Source

node_modules/fabric-shim/types/index.d.ts:96


getDateTimestamp()

getDateTimestamp(): Date

Returns

Date

Inherited from

ChaincodeStub.getDateTimestamp

Source

node_modules/fabric-shim/types/index.d.ts:102


getFunctionAndParameters()

getFunctionAndParameters(): object

Returns

object

fcn

fcn: string

params

params: string[]

Inherited from

ChaincodeStub.getFunctionAndParameters

Source

node_modules/fabric-shim/types/index.d.ts:92


getHistoryForKey()

getHistoryForKey(key): Promise\<HistoryQueryIterator> & AsyncIterable\<KeyModification>

Parameters

key: string

Returns

Promise\<HistoryQueryIterator> & AsyncIterable\<KeyModification>

Inherited from

ChaincodeStub.getHistoryForKey

Source

node_modules/fabric-shim/types/index.d.ts:117


getMspID()

getMspID(): string

Returns

string

Inherited from

ChaincodeStub.getMspID

Source

node_modules/fabric-shim/types/index.d.ts:97


getPrivateData()

getPrivateData(collection, key): Promise\<Uint8Array>

Parameters

collection: string

key: string

Returns

Promise\<Uint8Array>

Inherited from

ChaincodeStub.getPrivateData

Source

node_modules/fabric-shim/types/index.d.ts:125


getPrivateDataByPartialCompositeKey()

getPrivateDataByPartialCompositeKey(collection, objectType, attributes): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

collection: string

objectType: string

attributes: string[]

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getPrivateDataByPartialCompositeKey

Source

node_modules/fabric-shim/types/index.d.ts:132


getPrivateDataByRange()

getPrivateDataByRange(collection, startKey, endKey): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

collection: string

startKey: string

endKey: string

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getPrivateDataByRange

Source

node_modules/fabric-shim/types/index.d.ts:131


getPrivateDataHash()

getPrivateDataHash(collection, key): Promise\<Uint8Array>

Parameters

collection: string

key: string

Returns

Promise\<Uint8Array>

Inherited from

ChaincodeStub.getPrivateDataHash

Source

node_modules/fabric-shim/types/index.d.ts:126


getPrivateDataQueryResult()

getPrivateDataQueryResult(collection, query): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

collection: string

query: string

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getPrivateDataQueryResult

Source

node_modules/fabric-shim/types/index.d.ts:133


getPrivateDataValidationParameter()

getPrivateDataValidationParameter(collection, key): Promise\<Uint8Array>

Parameters

collection: string

key: string

Returns

Promise\<Uint8Array>

Inherited from

ChaincodeStub.getPrivateDataValidationParameter

Source

node_modules/fabric-shim/types/index.d.ts:130


getQueryResult()

getQueryResult(query): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

query: string

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getQueryResult

Source

node_modules/fabric-shim/types/index.d.ts:115


getQueryResultWithPagination()

getQueryResultWithPagination(query, pageSize, bookmark?): Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Parameters

query: string

pageSize: number

bookmark?: string

Returns

Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getQueryResultWithPagination

Source

node_modules/fabric-shim/types/index.d.ts:116


getSignedProposal()

getSignedProposal(): SignedProposal

Returns

SignedProposal

Inherited from

ChaincodeStub.getSignedProposal

Source

node_modules/fabric-shim/types/index.d.ts:100


getStateByPartialCompositeKeyWithPagination()

getStateByPartialCompositeKeyWithPagination(indexKey, keyParts): Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Parameters

indexKey: string

keyParts: string[]

Returns

Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Overrides

ChaincodeStub.getStateByPartialCompositeKeyWithPagination

Source

chain-test/src/unit/TestChaincodeStub.ts:150


getStateByRange()

getStateByRange(start, end): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

start: string

end: string

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Overrides

ChaincodeStub.getStateByRange

Source

chain-test/src/unit/TestChaincodeStub.ts:179


getStateByRangeWithPagination()

getStateByRangeWithPagination(startKey, endKey, pageSize, bookmark?): Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Parameters

startKey: string

endKey: string

pageSize: number

bookmark?: string

Returns

Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getStateByRangeWithPagination

Source

node_modules/fabric-shim/types/index.d.ts:111


getStateValidationParameter()

getStateValidationParameter(key): Promise\<Uint8Array>

Parameters

key: string

Returns

Promise\<Uint8Array>

Inherited from

ChaincodeStub.getStateValidationParameter

Source

node_modules/fabric-shim/types/index.d.ts:109


getStringArgs()

getStringArgs(): string[]

Returns

string[]

Inherited from

ChaincodeStub.getStringArgs

Source

node_modules/fabric-shim/types/index.d.ts:91


getTransient()

getTransient(): Map\<string, Uint8Array>

Returns

Map\<string, Uint8Array>

Inherited from

ChaincodeStub.getTransient

Source

node_modules/fabric-shim/types/index.d.ts:98


getTxID()

getTxID(): string

Returns

string

Inherited from

ChaincodeStub.getTxID

Source

node_modules/fabric-shim/types/index.d.ts:94


getTxTimestamp()

getTxTimestamp(): Timestamp

Returns

Timestamp

Inherited from

ChaincodeStub.getTxTimestamp

Source

node_modules/fabric-shim/types/index.d.ts:101


invokeChaincode()

invokeChaincode(chaincodeName, args, channel): Promise\<ChaincodeResponse>

Parameters

chaincodeName: string

args: string[]

channel: string

Returns

Promise\<ChaincodeResponse>

Inherited from

ChaincodeStub.invokeChaincode

Source

node_modules/fabric-shim/types/index.d.ts:119


mockState()

mockState(key, value): void

Parameters

key: string

value: string

Returns

void

Source

chain-test/src/unit/TestChaincodeStub.ts:114


putPrivateData()

putPrivateData(collection, key, value): Promise\<void>

Parameters

collection: string

key: string

value: Uint8Array

Returns

Promise\<void>

Inherited from

ChaincodeStub.putPrivateData

Source

node_modules/fabric-shim/types/index.d.ts:127


setEvent()

setEvent(name, payload): void

Parameters

name: string

payload: Uint8Array

Returns

void

Inherited from

ChaincodeStub.setEvent

Source

node_modules/fabric-shim/types/index.d.ts:120


setPrivateDataValidationParameter()

setPrivateDataValidationParameter(collection, key, ep): Promise\<void>

Parameters

collection: string

key: string

ep: Uint8Array

Returns

Promise\<void>

Inherited from

ChaincodeStub.setPrivateDataValidationParameter

Source

node_modules/fabric-shim/types/index.d.ts:129


setStateValidationParameter()

setStateValidationParameter(key, ep): Promise\<void>

Parameters

key: string

ep: Uint8Array

Returns

Promise\<void>

Inherited from

ChaincodeStub.setStateValidationParameter

Source

node_modules/fabric-shim/types/index.d.ts:108


splitCompositeKey()

splitCompositeKey(compositeKey): SplitCompositekey

Parameters

compositeKey: string

Returns

SplitCompositekey

Inherited from

ChaincodeStub.splitCompositeKey

Source

node_modules/fabric-shim/types/index.d.ts:123


createCompositeKey()

static createCompositeKey(objectType, attributes): string

Parameters

objectType: string

attributes: string[]

Returns

string

Inherited from

ChaincodeStub.createCompositeKey

Source

chain-test/src/unit/TestChaincodeStub.ts:27


deletePrivateData()

static deletePrivateData(collection, key): Promise\<void>

Parameters

collection: string

key: string

Returns

Promise\<void>

Inherited from

ChaincodeStub.deletePrivateData

Source

node_modules/fabric-shim/types/index.d.ts:128


deleteState()

static deleteState(key): Promise\<void>

Parameters

key: string

Returns

Promise\<void>

Inherited from

ChaincodeStub.deleteState

Source

node_modules/fabric-shim/types/index.d.ts:107


getArgs()

static getArgs(): string[]

Returns

string[]

Inherited from

ChaincodeStub.getArgs

Source

node_modules/fabric-shim/types/index.d.ts:90


getBinding()

static getBinding(): string

Returns

string

Inherited from

ChaincodeStub.getBinding

Source

node_modules/fabric-shim/types/index.d.ts:103


getChannelID()

static getChannelID(): string

Returns

string

Inherited from

ChaincodeStub.getChannelID

Source

node_modules/fabric-shim/types/index.d.ts:95


getCreator()

static getCreator(): SerializedIdentity

Returns

SerializedIdentity

Inherited from

ChaincodeStub.getCreator

Source

node_modules/fabric-shim/types/index.d.ts:96


getDateTimestamp()

static getDateTimestamp(): Date

Returns

Date

Inherited from

ChaincodeStub.getDateTimestamp

Source

node_modules/fabric-shim/types/index.d.ts:102


getFunctionAndParameters()

static getFunctionAndParameters(): object

Returns

object

fcn

fcn: string

params

params: string[]

Inherited from

ChaincodeStub.getFunctionAndParameters

Source

node_modules/fabric-shim/types/index.d.ts:92


getHistoryForKey()

static getHistoryForKey(key): Promise\<HistoryQueryIterator> & AsyncIterable\<KeyModification>

Parameters

key: string

Returns

Promise\<HistoryQueryIterator> & AsyncIterable\<KeyModification>

Inherited from

ChaincodeStub.getHistoryForKey

Source

node_modules/fabric-shim/types/index.d.ts:117


getMspID()

static getMspID(): string

Returns

string

Inherited from

ChaincodeStub.getMspID

Source

node_modules/fabric-shim/types/index.d.ts:97


getPrivateData()

static getPrivateData(collection, key): Promise\<Uint8Array>

Parameters

collection: string

key: string

Returns

Promise\<Uint8Array>

Inherited from

ChaincodeStub.getPrivateData

Source

node_modules/fabric-shim/types/index.d.ts:125


getPrivateDataByPartialCompositeKey()

static getPrivateDataByPartialCompositeKey(collection, objectType, attributes): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

collection: string

objectType: string

attributes: string[]

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getPrivateDataByPartialCompositeKey

Source

node_modules/fabric-shim/types/index.d.ts:132


getPrivateDataByRange()

static getPrivateDataByRange(collection, startKey, endKey): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

collection: string

startKey: string

endKey: string

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getPrivateDataByRange

Source

node_modules/fabric-shim/types/index.d.ts:131


getPrivateDataHash()

static getPrivateDataHash(collection, key): Promise\<Uint8Array>

Parameters

collection: string

key: string

Returns

Promise\<Uint8Array>

Inherited from

ChaincodeStub.getPrivateDataHash

Source

node_modules/fabric-shim/types/index.d.ts:126


getPrivateDataQueryResult()

static getPrivateDataQueryResult(collection, query): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

collection: string

query: string

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getPrivateDataQueryResult

Source

node_modules/fabric-shim/types/index.d.ts:133


getPrivateDataValidationParameter()

static getPrivateDataValidationParameter(collection, key): Promise\<Uint8Array>

Parameters

collection: string

key: string

Returns

Promise\<Uint8Array>

Inherited from

ChaincodeStub.getPrivateDataValidationParameter

Source

node_modules/fabric-shim/types/index.d.ts:130


getQueryResult()

static getQueryResult(query): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

query: string

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getQueryResult

Source

node_modules/fabric-shim/types/index.d.ts:115


getQueryResultWithPagination()

static getQueryResultWithPagination(query, pageSize, bookmark?): Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Parameters

query: string

pageSize: number

bookmark?: string

Returns

Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getQueryResultWithPagination

Source

node_modules/fabric-shim/types/index.d.ts:116


getSignedProposal()

static getSignedProposal(): SignedProposal

Returns

SignedProposal

Inherited from

ChaincodeStub.getSignedProposal

Source

node_modules/fabric-shim/types/index.d.ts:100


getState()

static getState(key): Promise\<Uint8Array>

Parameters

key: string

Returns

Promise\<Uint8Array>

Inherited from

ChaincodeStub.getState

Source

node_modules/fabric-shim/types/index.d.ts:105


getStateByPartialCompositeKey()

static getStateByPartialCompositeKey(objectType, attributes): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

objectType: string

attributes: string[]

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getStateByPartialCompositeKey

Source

node_modules/fabric-shim/types/index.d.ts:112


getStateByPartialCompositeKeyWithPagination()

static getStateByPartialCompositeKeyWithPagination(objectType, attributes, pageSize, bookmark?): Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Parameters

objectType: string

attributes: string[]

pageSize: number

bookmark?: string

Returns

Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getStateByPartialCompositeKeyWithPagination

Source

node_modules/fabric-shim/types/index.d.ts:113


getStateByRange()

static getStateByRange(startKey, endKey): Promise\<StateQueryIterator> & AsyncIterable\<KV>

Parameters

startKey: string

endKey: string

Returns

Promise\<StateQueryIterator> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getStateByRange

Source

node_modules/fabric-shim/types/index.d.ts:110


getStateByRangeWithPagination()

static getStateByRangeWithPagination(startKey, endKey, pageSize, bookmark?): Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Parameters

startKey: string

endKey: string

pageSize: number

bookmark?: string

Returns

Promise\<StateQueryResponse\<StateQueryIterator>> & AsyncIterable\<KV>

Inherited from

ChaincodeStub.getStateByRangeWithPagination

Source

node_modules/fabric-shim/types/index.d.ts:111


getStateValidationParameter()

static getStateValidationParameter(key): Promise\<Uint8Array>

Parameters

key: string

Returns

Promise\<Uint8Array>

Inherited from

ChaincodeStub.getStateValidationParameter

Source

node_modules/fabric-shim/types/index.d.ts:109


getStringArgs()

static getStringArgs(): string[]

Returns

string[]

Inherited from

ChaincodeStub.getStringArgs

Source

node_modules/fabric-shim/types/index.d.ts:91


getTransient()

static getTransient(): Map\<string, Uint8Array>

Returns

Map\<string, Uint8Array>

Inherited from

ChaincodeStub.getTransient

Source

node_modules/fabric-shim/types/index.d.ts:98


getTxID()

static getTxID(): string

Returns

string

Inherited from

ChaincodeStub.getTxID

Source

node_modules/fabric-shim/types/index.d.ts:94


getTxTimestamp()

static getTxTimestamp(): Timestamp

Returns

Timestamp

Inherited from

ChaincodeStub.getTxTimestamp

Source

node_modules/fabric-shim/types/index.d.ts:101


invokeChaincode()

static invokeChaincode(chaincodeName, args, channel): Promise\<ChaincodeResponse>

Parameters

chaincodeName: string

args: string[]

channel: string

Returns

Promise\<ChaincodeResponse>

Inherited from

ChaincodeStub.invokeChaincode

Source

node_modules/fabric-shim/types/index.d.ts:119


putPrivateData()

static putPrivateData(collection, key, value): Promise\<void>

Parameters

collection: string

key: string

value: Uint8Array

Returns

Promise\<void>

Inherited from

ChaincodeStub.putPrivateData

Source

node_modules/fabric-shim/types/index.d.ts:127


putState()

static putState(key, value): Promise\<void>

Parameters

key: string

value: Uint8Array

Returns

Promise\<void>

Inherited from

ChaincodeStub.putState

Source

node_modules/fabric-shim/types/index.d.ts:106


setEvent()

static setEvent(name, payload): void

Parameters

name: string

payload: Uint8Array

Returns

void

Inherited from

ChaincodeStub.setEvent

Source

node_modules/fabric-shim/types/index.d.ts:120


setPrivateDataValidationParameter()

static setPrivateDataValidationParameter(collection, key, ep): Promise\<void>

Parameters

collection: string

key: string

ep: Uint8Array

Returns

Promise\<void>

Inherited from

ChaincodeStub.setPrivateDataValidationParameter

Source

node_modules/fabric-shim/types/index.d.ts:129


setStateValidationParameter()

static setStateValidationParameter(key, ep): Promise\<void>

Parameters

key: string

ep: Uint8Array

Returns

Promise\<void>

Inherited from

ChaincodeStub.setStateValidationParameter

Source

node_modules/fabric-shim/types/index.d.ts:108


splitCompositeKey()

static splitCompositeKey(compositeKey): SplitCompositekey

Parameters

compositeKey: string

Returns

SplitCompositekey

Inherited from

ChaincodeStub.splitCompositeKey

Source

node_modules/fabric-shim/types/index.d.ts:123