Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(examples): check for AirnodeRrp deployment in localhost flow #1895

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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