updateForeignCall(config, rulesEngineComponentContract, policyId, foreignCallId, fcSyntax): Promise<number>

Updates a foreign call in the rules engine component contract.

Parameters

ParameterTypeDescription
configConfig-
rulesEngineComponentContractobjectThe contract instance for interacting with the rules engine component.
rulesEngineComponentContract.abi(object | object | object)[]-
rulesEngineComponentContract.address`0x${string}`-
policyIdnumberThe ID of the policy to associate with the foreign call.
foreignCallIdnumberThe ID of the foreign call to update.
fcSyntaxstringA 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.

Defined in

src/modules/foreign-calls.ts:116