simulatePolicyChain method

Future<TSimulatePolicyChainResponse> simulatePolicyChain({
  1. required TSimulatePolicyChainBody input,
})

Simulate how the organization's policy chain would evaluate a hypothetical activity. Read-only dry-run executed by the enclave Policy Engine: no activity is created, no Ruling is signed, and consensus scenarios are evaluated with declared approvers instead of real signatures.

Sign the provided TSimulatePolicyChainBody with the client's stamp function and submit the request (POST /public/v1/query/simulate_policy_chain).

See also: stampSimulatePolicyChain.

Implementation

Future<TSimulatePolicyChainResponse> simulatePolicyChain({
  required TSimulatePolicyChainBody input,
}) async {
  final body = packActivityBody(
    bodyJson: input.toJson(),
    fallbackOrganizationId: input.organizationId ??
        config.organizationId ??
        (throw Exception(
            "Missing organization ID, please pass in a sub-organizationId or instantiate the client with one.")),
    activityType: 'ACTIVITY_TYPE_SIMULATE_POLICY_CHAIN',
  );
  return await request<Map<String, dynamic>, TSimulatePolicyChainResponse>(
      "/public/v1/query/simulate_policy_chain",
      body,
      (json) => TSimulatePolicyChainResponse.fromJson(
          transformActivityResponse(json, 'SimulatePolicyChain')));
}