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

# updateRule

> **updateRule**(`config`, `rulesEnginePolicyContract`, `rulesEngineRulesContract`, `rulesEngineComponentContract`, `rulesEngineForeignCallContract`, `policyId`, `ruleId`, `ruleS`, `foreignCallNameToID`, `trackerNameToID`): `Promise`\<`number`>

Updates an existing rule in the Rules Engine Policy Contract.

## Parameters

| Parameter                                | Type                                                   | Description                                                         |
| ---------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------- |
| `config`                                 | `Config`                                               | -                                                                   |
| `rulesEnginePolicyContract`              | `object`                                               | -                                                                   |
| `rulesEnginePolicyContract.abi`          | (`object` \| `object`)\[]                              | -                                                                   |
| `rulesEnginePolicyContract.address`      | \`0x\$\{string}\`                                      | -                                                                   |
| `rulesEngineRulesContract`               | `object`                                               | The contract instance for interacting with the Rules Engine Policy. |
| `rulesEngineRulesContract.abi`           | (`object` \| `object` \| `object`)\[]                  | -                                                                   |
| `rulesEngineRulesContract.address`       | \`0x\$\{string}\`                                      | -                                                                   |
| `rulesEngineComponentContract`           | `object`                                               | -                                                                   |
| `rulesEngineComponentContract.abi`       | (`object` \| `object` \| `object`)\[]                  | -                                                                   |
| `rulesEngineComponentContract.address`   | \`0x\$\{string}\`                                      | -                                                                   |
| `rulesEngineForeignCallContract`         | `object`                                               | -                                                                   |
| `rulesEngineForeignCallContract.abi`     | (`object` \| `object` \| `object`)\[]                  | -                                                                   |
| `rulesEngineForeignCallContract.address` | \`0x\$\{string}\`                                      | -                                                                   |
| `policyId`                               | `number`                                               | The ID of the policy to which the rule belongs.                     |
| `ruleId`                                 | `number`                                               | The ID of the rule to be updated.                                   |
| `ruleS`                                  | `string`                                               | A JSON string representing the rule's structure and logic.          |
| `foreignCallNameToID`                    | [`FCNameToID`](../../types/type-aliases/FCNameToID)\[] | A mapping of foreign call names to their corresponding IDs.         |
| `trackerNameToID`                        | [`FCNameToID`](../../types/type-aliases/FCNameToID)\[] | A mapping of tracker names to their corresponding IDs.              |

## Returns

`Promise`\<`number`>

A promise that resolves to the result of the rule update operation. Returns the result ID if successful, or -1 if the operation fails.

## Throws

Will retry indefinitely if the contract simulation fails, with a 1-second delay between retries.

## Defined in

[src/modules/rules.ts:289](https://github.com/forte-service-company-ltd/forte-rules-engine-sdk/blob/5aad4d7c3c8cc91280e4449c17ac8ea31219fbed/src/modules/rules.ts#L289)
