(workflowAction: WorkflowAction, allActions: WorkflowAction[], usedVars: VarEvm[])
| 103 | } |
| 104 | |
| 105 | private async getTemplate(workflowAction: WorkflowAction, allActions: WorkflowAction[], usedVars: VarEvm[]) { |
| 106 | const integrationAction = await this.integrationActionService.findById( |
| 107 | workflowAction.integrationAction._id.toString(), |
| 108 | ) |
| 109 | if (!integrationAction) { |
| 110 | throw new InternalServerErrorException(`Integration action ${workflowAction.integrationAction.id} not found`) |
| 111 | } |
| 112 | const integration = await this.integrationService.findById(integrationAction.integration._id.toString()) |
| 113 | if (!integration) { |
| 114 | throw new InternalServerErrorException(`Integration ${integrationAction.integration.id} not found`) |
| 115 | } |
| 116 | const definition = this.integrationDefinitionFactory.getDefinition(integration.parentKey ?? integration.key) |
| 117 | const operationAction = definition.actions.find((action) => action.key === integrationAction.key) as OperationEvm |
| 118 | |
| 119 | // interpolate solidity variables |
| 120 | const inputs = { ...workflowAction.inputs } |
| 121 | for (const [key, value] of Object.entries(inputs)) { |
| 122 | const interpolated = getInterpolatedValue(value) |
| 123 | if (interpolated && interpolated.split('.').length === 2) { |
| 124 | const id = interpolated.split('.')[0] |
| 125 | const action = allActions.find((action) => action._id.toString() === id) |
| 126 | if (action) { |
| 127 | const varKey = interpolated.split('.')[1] |
| 128 | inputs[key] = `{{solidity:${varKey}}}` |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | return operationAction.template(inputs, usedVars) |
| 134 | } |
| 135 | |
| 136 | private async compileSourceCode(workflowId: string, sourcecode: string) { |
| 137 | const fileName = `workflow-${workflowId}.sol` |
no test coverage detected