(dataSources, casedInputAddress)
| 361 | }; |
| 362 | |
| 363 | export const tsExtractor: ManifestExtractor<string> = (dataSources, casedInputAddress) => { |
| 364 | const existingEvents: string[] = []; |
| 365 | const existingFunctions: string[] = []; |
| 366 | |
| 367 | splitArrayString(dataSources) |
| 368 | .filter((d) => { |
| 369 | const match = d.match(ADDRESS_REG); |
| 370 | return match && match.length >= 2 && match[1].toLowerCase() === casedInputAddress; |
| 371 | }) |
| 372 | .forEach((d) => { |
| 373 | const extractedValue = extractFromTs(d, {handlers: undefined}) as {handlers: string}; |
| 374 | |
| 375 | const regResult = extractFromTs(extractedValue.handlers, { |
| 376 | topics: TOPICS_REG, |
| 377 | function: FUNCTION_REG, |
| 378 | }); |
| 379 | if (regResult.topics !== null) { |
| 380 | existingEvents.push(regResult.topics[0]); |
| 381 | } |
| 382 | if (regResult.function !== null) { |
| 383 | existingFunctions.push(regResult.function as string); |
| 384 | } |
| 385 | }); |
| 386 | |
| 387 | return {existingEvents, existingFunctions}; |
| 388 | }; |
| 389 | |
| 390 | export async function getManifestData(manifestPath: string): Promise<Document> { |
| 391 | const existingManifest = await fs.promises.readFile(path.join(manifestPath), 'utf8'); |
no test coverage detected