updateForeignCall(Updates a foreign call in the rules engine component contract.config
,rulesEnginePolicyContract
,rulesEngineComponentContract
,rulesEngineForeignCallContract
,policyId
,foreignCallId
,fcSyntax
):Promise
<number
>
Parameters
Parameter | Type | Description |
---|---|---|
config | Config | The configuration object containing network and wallet information. |
rulesEnginePolicyContract | object | - |
rulesEnginePolicyContract.abi | (object | object )[] | - |
rulesEnginePolicyContract.address | `0x${string}` | - |
rulesEngineComponentContract | object | - |
rulesEngineComponentContract.abi | (object | object | object )[] | - |
rulesEngineComponentContract.address | `0x${string}` | - |
rulesEngineForeignCallContract | object | The contract instance for interacting with the rules engine component. |
rulesEngineForeignCallContract.abi | (object | object | object )[] | - |
rulesEngineForeignCallContract.address | `0x${string}` | - |
policyId | number | The ID of the policy to associate with the foreign call. |
foreignCallId | number | The ID of the foreign call to update. |
fcSyntax | string | A JSON string representing the foreign call definition. |
Returns
Promise
<number
>
A promise that resolves to the foreign call index. Returns -1
if the operation fails.
Remarks
- The function retries the contract interaction in case of failure, with a delay of 1 second between attempts.
- The
simulateContract
function is used to simulate the contract interaction before writing to the blockchain. - The
writeContract
function is used to execute the contract interaction on the blockchain. - The function returns the
foreignCallIndex
for an updated foreign call or the result of the newly created foreign call.
Throws
Will throw an error if the JSON parsing offcSyntax
fails.