@gala-chain/chaincode ∙ API
API > getObjectByKey
Function: getObjectByKey()
getObjectByKey\<
T>(ctx,constructor,objectId):Promise\<T>
Type parameters
▪ T extends ChainObject
Parameters
▪ ctx: GalaChainContext
▪ constructor: ClassConstructor\<Inferred\<T, ChainObject>>
▪ objectId: string
Returns
Description
Fetch an object from on-chain World State by its key.
The result will be deserialized and returned as an
instantiated class instance using the provided constructor.
Remarks
Reads from GalaChainStub if object has been read
previously during transaction execution.