Infernet
SDK
Reference
Consumers
CallbackConsumer

CallbackConsumer

Git Source (opens in a new tab)

Inherits: BaseConsumer

Allows creating one-time requests for off-chain container compute, delivered via callback

Inherits BaseConsumer to inherit functions to receive container compute responses

Functions

constructor

Initialize new CallbackConsumer

constructor(address coordinator) BaseConsumer(coordinator);

Parameters

NameTypeDescription
coordinatoraddresscoordinator address

_requestCompute

Creates a one-time request for off-chain container compute via callback

Under the hood, creates a new subscription at the Infernet coordinator, with period == 0 and frequency == 1, effectively initializing a subscription valid immediately and only for 1 interval

function _requestCompute(
    string memory containerId,
    bytes memory inputs,
    uint48 maxGasPrice,
    uint32 maxGasLimit,
    uint16 redundancy
) internal returns (uint32);

Parameters

NameTypeDescription
containerIdstringcompute container identifier(s) used by off-chain Infernet node
inputsbytesoptional container inputs
maxGasPriceuint48max gas price in wei paid by Infernet node when fulfilling callback
maxGasLimituint32max gas limit in wei used by Infernet node in callback tx
redundancyuint16number of unique responding Infernet nodes

Returns

NameTypeDescription
<none>uint32subscription ID of newly-created one-time subscription