MCPcopy Index your code
hub / github.com/subquery/subql / constructDatasourcesTs

Function constructDatasourcesTs

packages/cli/src/controller/generate-controller.ts:193–212  ·  view source on GitHub ↗
(userInput: UserInput, projectPath: string)

Source from the content-addressed store, hash-verified

191}
192
193export 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
214export function constructDatasourcesYaml(userInput: UserInput, projectPath: string): EthereumDs {
215 const ethModule = loadDependency(NETWORK_FAMILY.ethereum, projectPath);

Callers 2

generateManifestTsFunction · 0.85

Calls 3

loadDependencyFunction · 0.90
tsStringifyFunction · 0.85

Tested by

no test coverage detected