createRule(Asynchronously creates a new rule in the rules engine policy contract.config
,rulesEnginePolicyContract
,rulesEngineRulesContract
,rulesEngineComponentContract
,rulesEngineForeignCallContract
,policyId
,ruleS
,foreignCallNameToID
,trackerNameToID
):Promise
<number
>
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. |
ruleS | string | A JSON string representing the rule to be created. |
foreignCallNameToID | FCNameToID [] | An array mapping foreign call names to their corresponding IDs. |
trackerNameToID | FCNameToID [] | An array mapping tracker names to their corresponding IDs. |
Promise
<number
>
A promise that resolves to the result of the rule creation operation. Returns the rule ID if successful, or -1 if the operation fails.