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

Function parseReceiptFile

packages/airnode-deployer/src/utils/files.ts:44–58  ·  view source on GitHub ↗
(receiptFilename: string)

Source from the content-addressed store, hash-verified

42}
43
44export function parseReceiptFile(receiptFilename: string) {
45 logger.debug('Parsing receipt file');
46
47 const goParse = goSync(() => JSON.parse(fs.readFileSync(receiptFilename, 'utf8')));
48 if (!goParse.success) throw logAndReturnError(`Failed to parse receipt file: ${goParse.error}`);
49
50 const receipt = goParse.data;
51
52 const validationResult = parseReceipt(receipt);
53 if (!validationResult.success) {
54 throw logAndReturnError(`Invalid Airnode receipt file: ${validationResult.error}`);
55 }
56
57 return receipt as receipt.Receipt;
58}

Callers 1

removeWithReceiptFunction · 0.90

Calls 2

logAndReturnErrorFunction · 0.90
parseReceiptFunction · 0.90

Tested by

no test coverage detected