ContractContext
Class in @sentio/sdk/eth
Defined in @sentio/sdk/eth
Extends
Type Parameters
| Type Parameter |
|---|
TContract extends BaseContract |
TContractBoundView extends BoundContractView<TContract, ContractView<TContract>> |
Constructors
Constructor
new ContractContext<TContract extends BaseContract, TContractBoundView extends BoundContractView<TContract, ContractView<TContract>>>(
contractName: string,
view: TContractBoundView,
chainId: EthChainId,
timestamp?: Date,
block?: BlockParams,
log?: LogParams,
trace?: Trace,
transaction?: TransactionResponseParams,
transactionReceipt?: TransactionReceiptParams,
baseLabels?: Labels,
preparedData?: PreparedData
): ContractContext<TContract, TContractBoundView>;Parameters
| Parameter | Type |
|---|---|
contractName | string |
view | TContractBoundView |
chainId | EthChainId |
timestamp? | Date |
block? | BlockParams |
log? | LogParams |
trace? | Trace |
transaction? | TransactionResponseParams |
transactionReceipt? | TransactionReceiptParams |
baseLabels? | Labels |
preparedData? | PreparedData |
Returns
ContractContext<TContract, TContractBoundView>
Overrides
Properties
| Property | Modifier | Type | Inherited from |
|---|---|---|---|
address | public | string | EthContext.address |
baseLabels | public | Labels | EthContext.baseLabels |
block? | readonly | BlockParams | EthContext.block |
blockNumber | readonly | number | EthContext.blockNumber |
chainId | readonly | EthChainId | EthContext.chainId |
contract | public | TContractBoundView | - |
contractName | public | string | - |
eventLogger | public | EventLoggerBinding | EthContext.eventLogger |
meter | public | Meter | EthContext.meter |
preparedData? | readonly | PreparedData | EthContext.preparedData |
timestamp | readonly | Date | EthContext.timestamp |
trace? | readonly | Trace | EthContext.trace |
transaction? | readonly | TransactionResponseParams | EthContext.transaction |
transactionHash? | readonly | string | EthContext.transactionHash |
transactionReceipt? | readonly | TransactionReceiptParams | EthContext.transactionReceipt |
Accessors
cache
Get Signature
get cache(): MemoryCache;Access the in-memory key-value cache.
The cache allows storing and retrieving JSON-serializable values that persist across handler invocations. Useful for caching computed results, tracking cumulative state, or storing intermediate processing data.
Example
// Store and retrieve values
await ctx.cache.set('totalVolume', volume)
const cached = await ctx.cache.get<number>('totalVolume')
// Block-scoped values (isolated per block)
await ctx.cache.setInBlock('blockCount', count)See
MemoryCache for full API documentation
Returns
MemoryCache
The MemoryCache instance, or undefined if cache is not available
Inherited from
store
Get Signature
get store(): Store;Returns
Store
Inherited from
Methods
getBlockTag()
getBlockTag(overrides?: Overrides): string;Parameters
| Parameter | Type |
|---|---|
overrides? | Overrides |
Returns
string
Inherited from
getChainId()
getChainId(): EthChainId;Returns
EthChainId
Inherited from
getEthCallContext()
getEthCallContext(): EthCallContext;Returns
Inherited from
getMetaData()
getMetaData(name: string, labels: Labels): RecordMetaData;Parameters
| Parameter | Type |
|---|---|
name | string |
labels | Labels |
Returns
Inherited from
getMetaDataInternal()
getMetaDataInternal(name: string, labels: Labels): RecordMetaData;Parameters
| Parameter | Type |
|---|---|
name | string |
labels | Labels |
Returns
Inherited from
EthContext.getMetaDataInternal
initStore()
initStore(): void;Returns
void
Inherited from
sendTemplateInstance()
sendTemplateInstance(instance: TemplateInstance, unbind?: boolean): void;Parameters
| Parameter | Type | Default value |
|---|---|---|
instance | TemplateInstance | undefined |
unbind | boolean | false |
Returns
void
Inherited from
EthContext.sendTemplateInstance
stopAndGetResult()
stopAndGetResult(): ProcessResult;Returns
Inherited from
update()
update(res: MessageInit<ProcessResult>): void;Parameters
| Parameter | Type |
|---|---|
res | MessageInit<ProcessResult> |
Returns
void