(userInput: UserInput, projectPath: string)
| 191 | } |
| 192 | |
| 193 | export function constructDatasourcesTs(userInput: UserInput, projectPath: string): string { |
| 194 | const ethModule = loadDependency(NETWORK_FAMILY.ethereum, projectPath); |
| 195 | const abiName = ethModule.parseContractPath(userInput.abiPath).name; |
| 196 | const formattedHandlers = generateFormattedHandlers(userInput, abiName, (kind) => kind); |
| 197 | const handlersString = tsStringify(formattedHandlers); |
| 198 | |
| 199 | return `{ |
| 200 | kind: EthereumDatasourceKind.Runtime, |
| 201 | startBlock: ${userInput.startBlock}, |
| 202 | options: { |
| 203 | abi: '${abiName}', |
| 204 | ${userInput.address && `address: '${userInput.address}',`} |
| 205 | }, |
| 206 | assets: new Map([['${abiName}', {file: '${userInput.abiPath}'}]]), |
| 207 | mapping: { |
| 208 | file: '${DEFAULT_HANDLER_BUILD_PATH}', |
| 209 | handlers: ${handlersString} |
| 210 | } |
| 211 | }`; |
| 212 | } |
| 213 | |
| 214 | export function constructDatasourcesYaml(userInput: UserInput, projectPath: string): EthereumDs { |
| 215 | const ethModule = loadDependency(NETWORK_FAMILY.ethereum, projectPath); |
no test coverage detected