> ## Documentation Index
> Fetch the complete documentation index at: https://docs.forterulesengine.io/llms.txt
> Use this file to discover all available pages before exploring further.

# createCallingFunction

> v0.20.5

> **createCallingFunction**(`config`, `rulesEngineComponentContract`, `policyId`, `callingFunction`, `name`, `encodedValues`, `confirmationCount`): `Promise`\<\{ `functionId`: `number`; `transactionHash`: `` `0x${string}` ``; }>

Defined in: [src/modules/calling-functions.ts:53](https://github.com/Forte-Service-Company-Ltd/forte-rules-engine-sdk/blob/40cc8388cecd8ee445b00b9df2b681cff8552ece/src/modules/calling-functions.ts#L53)

Creates a Calling Function in the rules engine component contract.

This function parses the provided calling function, maps its arguments to their respective
types, and interacts with the smart contract to create the calling function. If the contract
interaction fails, it retries with a delay until successful.

## Parameters

| Parameter                              | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Description                                                                                        |
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `config`                               | `Config`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | The configuration object containing network and wallet information.                                |
| `rulesEngineComponentContract`         | \{ `abi`: (\{ `anonymous`: `undefined`; `inputs`: (\{ `components`: `undefined`; `internalType`: `string`; `name`: `string`; `type`: `string`; } \| \{ `components`: `object`\[]; `internalType`: `string`; `name`: `string`; `type`: `string`; })\[]; `name`: `string`; `outputs`: `object`\[]; `stateMutability`: `string`; `type`: `string`; } \| \{ `anonymous`: `undefined`; `inputs`: `object`\[]; `name`: `string`; `outputs`: `object`\[]; `stateMutability`: `string`; `type`: `string`; } \| \{ `anonymous`: `boolean`; `inputs`: `object`\[]; `name`: `string`; `outputs`: `undefined`; `stateMutability`: `undefined`; `type`: `string`; })\[]; `address`: `` `0x${string}` ``; } | The contract instance containing the address and ABI                                               |
| `rulesEngineComponentContract.abi`     | (\{ `anonymous`: `undefined`; `inputs`: (\{ `components`: `undefined`; `internalType`: `string`; `name`: `string`; `type`: `string`; } \| \{ `components`: `object`\[]; `internalType`: `string`; `name`: `string`; `type`: `string`; })\[]; `name`: `string`; `outputs`: `object`\[]; `stateMutability`: `string`; `type`: `string`; } \| \{ `anonymous`: `undefined`; `inputs`: `object`\[]; `name`: `string`; `outputs`: `object`\[]; `stateMutability`: `string`; `type`: `string`; } \| \{ `anonymous`: `boolean`; `inputs`: `object`\[]; `name`: `string`; `outputs`: `undefined`; `stateMutability`: `undefined`; `type`: `string`; })\[]                                              | -                                                                                                  |
| `rulesEngineComponentContract.address` | `` `0x${string}` ``                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | -                                                                                                  |
| `policyId`                             | `number`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | The ID of the policy for which the calling function is being created.                              |
| `callingFunction`                      | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | The calling function string to be parsed and added to the contract. of the rules engine component. |
| `name`                                 | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Name of the Calling Function instance                                                              |
| `encodedValues`                        | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | The encoded values string for the calling function.                                                |
| `confirmationCount`                    | `number`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | -                                                                                                  |

## Returns

`Promise`\<\{ `functionId`: `number`; `transactionHash`: `` `0x${string}` ``; }>

A promise that resolves to the result of the contract interaction, or -1 if unsuccessful.

## Throws

Will retry indefinitely on contract interaction failure, with a delay between attempts.
