MCPcopy
hub / github.com/subquery/subql / constructHandlerProps

Function constructHandlerProps

packages/cli/src/controller/generate-controller.ts:434–458  ·  view source on GitHub ↗
(methods: [SelectedMethod[], SelectedMethod[]], abiName: string)

Source from the content-addressed store, hash-verified

432}
433
434export function constructHandlerProps(methods: [SelectedMethod[], SelectedMethod[]], abiName: string): AbiPropType {
435 const handlers: HandlerPropType[] = [];
436 const [events, functions] = methods;
437
438 functions.forEach((fn) => {
439 handlers.push({
440 name: generateHandlerName(fn.name, abiName, 'tx'),
441 argName: 'tx',
442 argType: `${upperFirst(fn.name)}Transaction`,
443 });
444 });
445
446 events.forEach((event) => {
447 handlers.push({
448 name: generateHandlerName(event.name, abiName, 'log'),
449 argName: 'log',
450 argType: `${upperFirst(event.name)}Log`,
451 });
452 });
453
454 return {
455 name: abiName,
456 handlers: handlers,
457 };
458}
459
460export async function generateHandlers(
461 selectedMethods: [SelectedMethod[], SelectedMethod[]],

Callers 2

generateHandlersFunction · 0.85

Calls 1

generateHandlerNameFunction · 0.85

Tested by

no test coverage detected