Options for creating a Policy.

interface CreatePolicyOptions {
    idempotencyKey?: string;
    policy: {
        description?: string;
        rules: (
            | {
                action: "reject"
                | "accept";
                criteria: (
                    | {
                        ethValue: string;
                        operator: ">"
                        | ">="
                        | "<"
                        | "<="
                        | "==";
                        type: "ethValue";
                    }
                    | {
                        addresses: `0x${string}`[];
                        operator: "in"
                        | "not in";
                        type: "evmAddress";
                    }
                    | {
                        abi: | "erc20"
                        | "erc721"
                        | "erc1155"
                        | readonly (
                            | { inputs: ...; name: ...; type: ... }
                            | { anonymous?: ...; inputs: ...; name: ...; type: ... }
                            | (
                                { payable?: boolean | undefined; constant?: boolean | undefined; gas?: number | undefined; } & ({ inputs: readonly AbiParameter[]; outputs: readonly AbiParameter[]; type: "function"; name: string; stateMutability: "pure" | ... 2 more ... | "payable"; } | { ...; } | { ...; } | { ...; })
                            )
                        )[];
                        conditions: { function: string; params?: (...)[] }[];
                        type: "evmData";
                    }
                )[];
                operation: "signEvmTransaction";
            }
            | { action: "reject"
            | "accept"; operation: "signEvmHash" }
            | {
                action: "reject" | "accept";
                criteria: { match: string; type: "evmMessage" }[];
                operation: "signEvmMessage";
            }
            | {
                action: "reject"
                | "accept";
                criteria: (
                    | {
                        ethValue: string;
                        operator: ">"
                        | ">="
                        | "<"
                        | "<="
                        | "==";
                        type: "ethValue";
                    }
                    | {
                        addresses: `0x${string}`[];
                        operator: "in"
                        | "not in";
                        type: "evmAddress";
                    }
                    | {
                        networks: ("base-sepolia" | "base")[];
                        operator: "in" | "not in";
                        type: "evmNetwork";
                    }
                    | {
                        abi: | "erc20"
                        | "erc721"
                        | "erc1155"
                        | readonly (
                            | { inputs: ...; name: ...; type: ... }
                            | { anonymous?: ...; inputs: ...; name: ...; type: ... }
                            | (
                                { payable?: boolean | undefined; constant?: boolean | undefined; gas?: number | undefined; } & ({ inputs: readonly AbiParameter[]; outputs: readonly AbiParameter[]; type: "function"; name: string; stateMutability: "pure" | ... 2 more ... | "payable"; } | { ...; } | { ...; } | { ...; })
                            )
                        )[];
                        conditions: { function: string; params?: (...)[] }[];
                        type: "evmData";
                    }
                )[];
                operation: "sendEvmTransaction";
            }
            | {
                action: "reject"
                | "accept";
                criteria: {
                    addresses: string[];
                    operator: "in" | "not in";
                    type: "solAddress";
                }[];
                operation: "signSolTransaction";
            }
        )[];
        scope: "project"
        | "account";
    };
}

Properties

idempotencyKey?: string

The idempotency key to ensure the request is processed exactly once. Used to safely retry requests without accidentally performing the same operation twice.

policy: {
    description?: string;
    rules: (
        | {
            action: "reject"
            | "accept";
            criteria: (
                | {
                    ethValue: string;
                    operator: ">"
                    | ">="
                    | "<"
                    | "<="
                    | "==";
                    type: "ethValue";
                }
                | {
                    addresses: `0x${string}`[];
                    operator: "in"
                    | "not in";
                    type: "evmAddress";
                }
                | {
                    abi: | "erc20"
                    | "erc721"
                    | "erc1155"
                    | readonly (
                        | { inputs: ...; name: ...; type: ... }
                        | { anonymous?: ...; inputs: ...; name: ...; type: ... }
                        | (
                            { payable?: boolean | undefined; constant?: boolean | undefined; gas?: number | undefined; } & ({ inputs: readonly AbiParameter[]; outputs: readonly AbiParameter[]; type: "function"; name: string; stateMutability: "pure" | ... 2 more ... | "payable"; } | { ...; } | { ...; } | { ...; })
                        )
                    )[];
                    conditions: { function: string; params?: (...)[] }[];
                    type: "evmData";
                }
            )[];
            operation: "signEvmTransaction";
        }
        | { action: "reject"
        | "accept"; operation: "signEvmHash" }
        | {
            action: "reject" | "accept";
            criteria: { match: string; type: "evmMessage" }[];
            operation: "signEvmMessage";
        }
        | {
            action: "reject"
            | "accept";
            criteria: (
                | {
                    ethValue: string;
                    operator: ">"
                    | ">="
                    | "<"
                    | "<="
                    | "==";
                    type: "ethValue";
                }
                | {
                    addresses: `0x${string}`[];
                    operator: "in"
                    | "not in";
                    type: "evmAddress";
                }
                | {
                    networks: ("base-sepolia" | "base")[];
                    operator: "in" | "not in";
                    type: "evmNetwork";
                }
                | {
                    abi: | "erc20"
                    | "erc721"
                    | "erc1155"
                    | readonly (
                        | { inputs: ...; name: ...; type: ... }
                        | { anonymous?: ...; inputs: ...; name: ...; type: ... }
                        | (
                            { payable?: boolean | undefined; constant?: boolean | undefined; gas?: number | undefined; } & ({ inputs: readonly AbiParameter[]; outputs: readonly AbiParameter[]; type: "function"; name: string; stateMutability: "pure" | ... 2 more ... | "payable"; } | { ...; } | { ...; } | { ...; })
                        )
                    )[];
                    conditions: { function: string; params?: (...)[] }[];
                    type: "evmData";
                }
            )[];
            operation: "sendEvmTransaction";
        }
        | {
            action: "reject"
            | "accept";
            criteria: {
                addresses: string[];
                operator: "in" | "not in";
                type: "solAddress";
            }[];
            operation: "signSolTransaction";
        }
    )[];
    scope: "project"
    | "account";
}

The policy definition to create. Contains the scope, description, and rules for the policy.

Type declaration

  • Optionaldescription?: string

    An optional human-readable description for the policy. Limited to 50 characters of alphanumeric characters, spaces, commas, and periods.

  • rules: (
        | {
            action: "reject"
            | "accept";
            criteria: (
                | {
                    ethValue: string;
                    operator: ">"
                    | ">="
                    | "<"
                    | "<="
                    | "==";
                    type: "ethValue";
                }
                | {
                    addresses: `0x${string}`[];
                    operator: "in"
                    | "not in";
                    type: "evmAddress";
                }
                | {
                    abi: | "erc20"
                    | "erc721"
                    | "erc1155"
                    | readonly (
                        | { inputs: ...; name: ...; type: ... }
                        | { anonymous?: ...; inputs: ...; name: ...; type: ... }
                        | (
                            { payable?: boolean | undefined; constant?: boolean | undefined; gas?: number | undefined; } & ({ inputs: readonly AbiParameter[]; outputs: readonly AbiParameter[]; type: "function"; name: string; stateMutability: "pure" | ... 2 more ... | "payable"; } | { ...; } | { ...; } | { ...; })
                        )
                    )[];
                    conditions: { function: string; params?: (...)[] }[];
                    type: "evmData";
                }
            )[];
            operation: "signEvmTransaction";
        }
        | { action: "reject"
        | "accept"; operation: "signEvmHash" }
        | {
            action: "reject" | "accept";
            criteria: { match: string; type: "evmMessage" }[];
            operation: "signEvmMessage";
        }
        | {
            action: "reject"
            | "accept";
            criteria: (
                | {
                    ethValue: string;
                    operator: ">"
                    | ">="
                    | "<"
                    | "<="
                    | "==";
                    type: "ethValue";
                }
                | {
                    addresses: `0x${string}`[];
                    operator: "in"
                    | "not in";
                    type: "evmAddress";
                }
                | {
                    networks: ("base-sepolia" | "base")[];
                    operator: "in" | "not in";
                    type: "evmNetwork";
                }
                | {
                    abi: | "erc20"
                    | "erc721"
                    | "erc1155"
                    | readonly (
                        | { inputs: ...; name: ...; type: ... }
                        | { anonymous?: ...; inputs: ...; name: ...; type: ... }
                        | (
                            { payable?: boolean | undefined; constant?: boolean | undefined; gas?: number | undefined; } & ({ inputs: readonly AbiParameter[]; outputs: readonly AbiParameter[]; type: "function"; name: string; stateMutability: "pure" | ... 2 more ... | "payable"; } | { ...; } | { ...; } | { ...; })
                        )
                    )[];
                    conditions: { function: string; params?: (...)[] }[];
                    type: "evmData";
                }
            )[];
            operation: "sendEvmTransaction";
        }
        | {
            action: "reject"
            | "accept";
            criteria: {
                addresses: string[];
                operator: "in" | "not in";
                type: "solAddress";
            }[];
            operation: "signSolTransaction";
        }
    )[]

    Array of rules that comprise the policy. Limited to a maximum of 10 rules per policy.

  • scope: "project" | "account"

    The scope of the policy. "project" applies to the entire project, "account" applies to specific accounts.