updateForeignCall
updateForeignCall(
config
,rulesEngineComponentContract
,policyId
,foreignCallId
,fcSyntax
):Promise
<number
>
Updates a foreign call in the rules engine component contract.
Parameters
Parameter | Type | Description |
---|---|---|
config | Config | - |
rulesEngineComponentContract | object | The contract instance for interacting with the rules engine component. |
rulesEngineComponentContract.abi | (object | object | object )[] | - |
rulesEngineComponentContract.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 of fcSyntax
fails.