MCPcopy Create free account
hub / github.com/api3dao/airnode / makeRequest

Function makeRequest

packages/airnode-examples/src/scripts/make-request.ts:32–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30};
31
32const makeRequest = async (): Promise<string> => {
33 const integrationInfo = readIntegrationInfo();
34 const airnodeRrp = await getDeployedContract('@api3/airnode-protocol/contracts/rrp/AirnodeRrpV0.sol');
35
36 // Import the "makeRequest" which triggers the Airnode request.
37 // See the "request-utils.ts" of the specific integration for details.
38 const { makeRequest } = await import(`../../integrations/${integrationInfo.integration}/request-utils.ts`);
39 const receipt = await makeRequest();
40
41 // Wait until the transaction is mined
42 return new Promise((resolve) =>
43 getProvider().once(receipt.hash, (tx) => {
44 const parsedLog = airnodeRrp.interface.parseLog(tx.logs[0]);
45 resolve(parsedLog.args.requestId);
46 })
47 );
48};
49
50const main = async () => {
51 cliPrint.info('Making request...');

Callers 1

mainFunction · 0.70

Calls 3

readIntegrationInfoFunction · 0.85
getDeployedContractFunction · 0.85
getProviderFunction · 0.85

Tested by

no test coverage detected