createPolicy(config, rulesEnginePolicyContract, rulesEngineRulesContract, rulesEngineComponentContract, rulesEngineForeignCallContract, confirmationCount, policySyntax?): Promise<{ policyId: number; }>
Defined in: src/modules/policy.ts:87 Creates a policy in the Rules Engine, including rules, trackers, and foreign calls.

Parameters

ParameterTypeDescription
configConfig-
rulesEnginePolicyContract{ abi: ({ anonymous: undefined; inputs: object[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: undefined; inputs: object[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: boolean; inputs: object[]; name: string; outputs: undefined; stateMutability: undefined; type: string; })[]; address: `0x${string}`; }The contract instance for interacting with the Rules Engine Policy.
rulesEnginePolicyContract.abi({ anonymous: undefined; inputs: object[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: undefined; inputs: object[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: boolean; inputs: object[]; name: string; outputs: undefined; stateMutability: undefined; type: string; })[]-
rulesEnginePolicyContract.address`0x${string}`-
rulesEngineRulesContract{ abi: ({ anonymous: undefined; inputs: ({ components: undefined; internalType: string; name: string; type: string; } | { components: ({ components: undefined; internalType: string; name: string; type: string; } | { components: …[]; internalType: string; name: string; type: string; })[]; internalType: string; name: string; type: string; })[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: undefined; inputs: object[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: boolean; inputs: object[]; name: string; outputs: undefined; stateMutability: undefined; type: string; })[]; address: `0x${string}`; }The contract instance for interacting with the Rules Engine Rules.
rulesEngineRulesContract.abi({ anonymous: undefined; inputs: ({ components: undefined; internalType: string; name: string; type: string; } | { components: ({ components: undefined; internalType: string; name: string; type: string; } | { components: …[]; internalType: string; name: string; type: string; })[]; internalType: string; name: string; type: string; })[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: undefined; inputs: object[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: boolean; inputs: object[]; name: string; outputs: undefined; stateMutability: undefined; type: string; })[]-
rulesEngineRulesContract.address`0x${string}`-
rulesEngineComponentContract?{ abi: ({ anonymous: undefined; inputs: ({ components: undefined; internalType: string; name: string; type: string; } | { components: object[]; internalType: string; name: string; type: string; })[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: undefined; inputs: object[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: boolean; inputs: object[]; name: string; outputs: undefined; stateMutability: undefined; type: string; })[]; address: `0x${string}`; }The contract instance for interacting with the Rules Engine Component.
rulesEngineComponentContract.abi?({ anonymous: undefined; inputs: ({ components: undefined; internalType: string; name: string; type: string; } | { components: object[]; internalType: string; name: string; type: string; })[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: undefined; inputs: object[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: boolean; inputs: object[]; name: string; outputs: undefined; stateMutability: undefined; type: string; })[]-
rulesEngineComponentContract.address?`0x${string}`-
rulesEngineForeignCallContract?{ abi: ({ anonymous: undefined; inputs: ({ components: undefined; internalType: string; name: string; type: string; } | { components: ({ components: undefined; internalType: string; name: string; type: string; } | { components: …[]; internalType: string; name: string; type: string; })[]; internalType: string; name: string; type: string; })[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: undefined; inputs: ({ components: undefined; internalType: string; name: string; type: string; } | { components: ({ components: undefined; internalType: string; name: string; type: string; } | { components: …[]; internalType: string; name: string; type: string; })[]; internalType: string; name: string; type: string; })[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: boolean; inputs: object[]; name: string; outputs: undefined; stateMutability: undefined; type: string; })[]; address: `0x${string}`; }-
rulesEngineForeignCallContract.abi?({ anonymous: undefined; inputs: ({ components: undefined; internalType: string; name: string; type: string; } | { components: ({ components: undefined; internalType: string; name: string; type: string; } | { components: …[]; internalType: string; name: string; type: string; })[]; internalType: string; name: string; type: string; })[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: undefined; inputs: ({ components: undefined; internalType: string; name: string; type: string; } | { components: ({ components: undefined; internalType: string; name: string; type: string; } | { components: …[]; internalType: string; name: string; type: string; })[]; internalType: string; name: string; type: string; })[]; name: string; outputs: object[]; stateMutability: string; type: string; } | { anonymous: boolean; inputs: object[]; name: string; outputs: undefined; stateMutability: undefined; type: string; })[]-
rulesEngineForeignCallContract.address?`0x${string}`-
confirmationCount?number-
policySyntax?stringThe JSON string representing the policy syntax.

Returns

Promise<{ policyId: number; }> The ID of the newly created policy.