# new FabricContractContext(argsopt) → {void}
Provides access to Fabric-specific context elements like stub, identity, and logger to be used by repositories and adapters during contract execution.
Context class for Fabric chaincode operations
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
args |
object
|
<optional> |
Optional initialization arguments passed to the base Context |
void
Example
```typescript
// In a Fabric chaincode contract method
const context = new FabricContractContext();
// Optionally set values via the base Context API
context.set('stub', ctx.stub);
context.set('clientIdentity', ctx.clientIdentity);
context.set('logger', contractLogger);
// Access context properties
const timestamp = context.timestamp;
const creator = context.identity.getID();
```
Classes
- FabricContractContext
Initializes the context with Fabric-specific flags
- FabricContractContext
Initializes the context with Fabric-specific flags
Members
# identity
Returns the ClientIdentity instance for the transaction submitter
Gets the client identity
# timestamp
Overrides the base timestamp getter to use the stub's timestamp
Gets the transaction timestamp
Methods
# identity() → {ClientIdentity}
Returns the ClientIdentity instance for the transaction submitter
Gets the client identity
The client identity
ClientIdentity
# stub() → {ChaincodeStub}
Returns the ChaincodeStub instance for interacting with the ledger
Gets the chaincode stub
The chaincode stub
ChaincodeStub
# timestamp() → {Date}
Overrides the base timestamp getter to use the stub's timestamp
Gets the transaction timestamp
The transaction timestamp
Date