Skip to content

Commit

Permalink
fix(examples): check for AirnodeRrp deployment in localhost flow (#1895)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcroote authored Oct 10, 2023
1 parent cefc5e4 commit 7946227
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/curvy-timers-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@api3/airnode-examples': patch
---

Check for AirnodeRrp deployment in localhost flow
19 changes: 18 additions & 1 deletion packages/airnode-examples/src/scripts/create-airnode-config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
import { readIntegrationInfo, runAndHandleErrors } from '../';
import { readIntegrationInfo, runAndHandleErrors, getDeployedContract, cliPrint } from '../';

const main = async () => {
const integrationInfo = readIntegrationInfo();

// If using the localhost network, check that AirnodeRrp was deployed
if (integrationInfo.network === 'localhost') {
try {
await getDeployedContract('@api3/airnode-protocol/contracts/rrp/AirnodeRrpV0.sol');
} catch (e) {
if (e instanceof Error && (e.message.includes('ENOENT') || e.message.includes('invalid contract address'))) {
cliPrint.error(
'AirnodeRrpV0 contract deployment not found. Please follow the RRP deployment ' +
'instructions in the README before running this command.'
);
process.exit(1);
}
throw e;
}
}

// Import the "create-config" file from the chosen integration. See the respective "create-config.ts" file for
// details.
const createConfig = await import(`../../integrations/${integrationInfo.integration}/create-config.ts`);
Expand Down

0 comments on commit 7946227

Please sign in to comment.