Skip to content
On this page
Reference → Airnode → v0.11 → Airnode for dApp Developers

Using Templates (RRP)

A request to an Airnode can have many parameters. It is very common for requester contracts (e.g., a data feed) to make repeated requests with the exact same parameters. In such instances, it is wasteful to pass all of these parameters repeatedly. Templates are used to hold a set of parameter values on-chain that can be used repeatedly when calling themakeTemplateRequest()function in AirnodeRrpV0.sol➚. UnlikemakeFullRequest(), makeTemplateRequest()requires that a requester passtemplateIdwhich identifies a template.

function makeTemplateRequest(
    bytes32 templateId,
    address sponsor,
    address sponsorWallet,
    address fulfillAddress,
    bytes4 fulfillFunctionId,
    bytes calldata parameters
) external override returns (bytes32 requestId) {

When a template is used to make a request, both the parameters encoded in parameters of the template and parameters provided at request-time (if any) will be used by the Airnode. In case the two include a parameter with the same name, the one provided at request-time will be used.

The structure of a template, as shown below, is simple.

  • address of the desired Airnode
  • endpointId from the Airnode
  • endpoint parameters
struct Template {
  address airnode;
  bytes32 endpointId;
  bytes parameters;

See the guide Making RRP Template Requests and learn how to create and use a template. Also visit the coingecko-template➚ monorepo example demonstrates template requests.


Released under the MIT License.