CDP SDK TypeScript - v1.31.0
    Preparing search index...

    Options for creating a Policy.

    interface CreatePolicyOptions {
        idempotencyKey?: string;
        policy: {
            scope: "project" | "account";
            description?: string;
            rules: (
                | {
                    action: "reject"
                    | "accept";
                    operation: "signEvmTransaction";
                    criteria: (
                        | {
                            type: "ethValue";
                            ethValue: string;
                            operator: ">"
                            | ">="
                            | "<"
                            | "<="
                            | "==";
                        }
                        | {
                            type: "evmAddress";
                            addresses: `0x${string}`[];
                            operator: "in"
                            | "not in";
                        }
                        | {
                            type: "evmData";
                            abi: | "erc20"
                            | "erc721"
                            | "erc1155"
                            | readonly (
                                | {}
                                | {}
                                | (
                                    { 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?: (...)[] }[];
                        }
                    )[];
                }
                | { action: "reject"
                | "accept"; operation: "signEvmHash" }
                | {
                    action: "reject" | "accept";
                    operation: "signEvmMessage";
                    criteria: { type: "evmMessage"; match: string }[];
                }
                | {
                    action: "reject"
                    | "accept";
                    operation: "signEvmTypedData";
                    criteria: (
                        | {
                            type: "evmTypedDataField";
                            types: {
                                types: Record<string, { name: ...; type: ... }[]>;
                                primaryType: string;
                            };
                            conditions: (
                                | { addresses: (...)[]; operator: (...) | (...); path: string }
                                | {
                                    value: string;
                                    operator: (...) | (...) | (...) | (...) | (...);
                                    path: string;
                                }
                                | { match: string; path: string }
                            )[];
                        }
                        | {
                            type: "evmTypedDataVerifyingContract";
                            addresses: `0x${string}`[];
                            operator: "in"
                            | "not in";
                        }
                    )[];
                }
                | {
                    action: "reject"
                    | "accept";
                    operation: "sendEvmTransaction";
                    criteria: (
                        | {
                            type: "ethValue";
                            ethValue: string;
                            operator: ">"
                            | ">="
                            | "<"
                            | "<="
                            | "==";
                        }
                        | {
                            type: "evmAddress";
                            addresses: `0x${string}`[];
                            operator: "in"
                            | "not in";
                        }
                        | {
                            type: "evmNetwork";
                            networks: ("base-sepolia" | "base")[];
                            operator: "in" | "not in";
                        }
                        | {
                            type: "evmData";
                            abi: | "erc20"
                            | "erc721"
                            | "erc1155"
                            | readonly (
                                | {}
                                | {}
                                | (
                                    { 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?: (...)[] }[];
                        }
                    )[];
                }
                | {
                    action: "reject"
                    | "accept";
                    operation: "signSolTransaction";
                    criteria: {
                        type: "solAddress";
                        addresses: string[];
                        operator: "in" | "not in";
                    }[];
                }
                | {
                    action: "reject"
                    | "accept";
                    operation: "prepareUserOperation";
                    criteria: (
                        | {
                            type: "ethValue";
                            ethValue: string;
                            operator: ">"
                            | ">="
                            | "<"
                            | "<="
                            | "==";
                        }
                        | {
                            type: "evmAddress";
                            addresses: `0x${string}`[];
                            operator: "in"
                            | "not in";
                        }
                        | {
                            type: "evmNetwork";
                            networks: ("base-sepolia" | "base")[];
                            operator: "in" | "not in";
                        }
                        | {
                            type: "evmData";
                            abi: | "erc20"
                            | "erc721"
                            | "erc1155"
                            | readonly (
                                | {}
                                | {}
                                | (
                                    { 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?: (...)[] }[];
                        }
                    )[];
                }
                | {
                    action: "reject"
                    | "accept";
                    operation: "sendUserOperation";
                    criteria: (
                        | {
                            type: "ethValue";
                            ethValue: string;
                            operator: ">"
                            | ">="
                            | "<"
                            | "<="
                            | "==";
                        }
                        | {
                            type: "evmAddress";
                            addresses: `0x${string}`[];
                            operator: "in"
                            | "not in";
                        }
                        | {
                            type: "evmData";
                            abi: | "erc20"
                            | "erc721"
                            | "erc1155"
                            | readonly (
                                | {}
                                | {}
                                | (
                                    { 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?: (...)[] }[];
                        }
                    )[];
                }
            )[];
        };
    }
    Index

    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: {
        scope: "project" | "account";
        description?: string;
        rules: (
            | {
                action: "reject"
                | "accept";
                operation: "signEvmTransaction";
                criteria: (
                    | {
                        type: "ethValue";
                        ethValue: string;
                        operator: ">"
                        | ">="
                        | "<"
                        | "<="
                        | "==";
                    }
                    | {
                        type: "evmAddress";
                        addresses: `0x${string}`[];
                        operator: "in"
                        | "not in";
                    }
                    | {
                        type: "evmData";
                        abi: | "erc20"
                        | "erc721"
                        | "erc1155"
                        | readonly (
                            | {}
                            | {}
                            | (
                                { 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?: (...)[] }[];
                    }
                )[];
            }
            | { action: "reject"
            | "accept"; operation: "signEvmHash" }
            | {
                action: "reject" | "accept";
                operation: "signEvmMessage";
                criteria: { type: "evmMessage"; match: string }[];
            }
            | {
                action: "reject"
                | "accept";
                operation: "signEvmTypedData";
                criteria: (
                    | {
                        type: "evmTypedDataField";
                        types: {
                            types: Record<string, { name: ...; type: ... }[]>;
                            primaryType: string;
                        };
                        conditions: (
                            | { addresses: (...)[]; operator: (...) | (...); path: string }
                            | {
                                value: string;
                                operator: (...) | (...) | (...) | (...) | (...);
                                path: string;
                            }
                            | { match: string; path: string }
                        )[];
                    }
                    | {
                        type: "evmTypedDataVerifyingContract";
                        addresses: `0x${string}`[];
                        operator: "in"
                        | "not in";
                    }
                )[];
            }
            | {
                action: "reject"
                | "accept";
                operation: "sendEvmTransaction";
                criteria: (
                    | {
                        type: "ethValue";
                        ethValue: string;
                        operator: ">"
                        | ">="
                        | "<"
                        | "<="
                        | "==";
                    }
                    | {
                        type: "evmAddress";
                        addresses: `0x${string}`[];
                        operator: "in"
                        | "not in";
                    }
                    | {
                        type: "evmNetwork";
                        networks: ("base-sepolia" | "base")[];
                        operator: "in" | "not in";
                    }
                    | {
                        type: "evmData";
                        abi: | "erc20"
                        | "erc721"
                        | "erc1155"
                        | readonly (
                            | {}
                            | {}
                            | (
                                { 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?: (...)[] }[];
                    }
                )[];
            }
            | {
                action: "reject"
                | "accept";
                operation: "signSolTransaction";
                criteria: {
                    type: "solAddress";
                    addresses: string[];
                    operator: "in" | "not in";
                }[];
            }
            | {
                action: "reject"
                | "accept";
                operation: "prepareUserOperation";
                criteria: (
                    | {
                        type: "ethValue";
                        ethValue: string;
                        operator: ">"
                        | ">="
                        | "<"
                        | "<="
                        | "==";
                    }
                    | {
                        type: "evmAddress";
                        addresses: `0x${string}`[];
                        operator: "in"
                        | "not in";
                    }
                    | {
                        type: "evmNetwork";
                        networks: ("base-sepolia" | "base")[];
                        operator: "in" | "not in";
                    }
                    | {
                        type: "evmData";
                        abi: | "erc20"
                        | "erc721"
                        | "erc1155"
                        | readonly (
                            | {}
                            | {}
                            | (
                                { 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?: (...)[] }[];
                    }
                )[];
            }
            | {
                action: "reject"
                | "accept";
                operation: "sendUserOperation";
                criteria: (
                    | {
                        type: "ethValue";
                        ethValue: string;
                        operator: ">"
                        | ">="
                        | "<"
                        | "<="
                        | "==";
                    }
                    | {
                        type: "evmAddress";
                        addresses: `0x${string}`[];
                        operator: "in"
                        | "not in";
                    }
                    | {
                        type: "evmData";
                        abi: | "erc20"
                        | "erc721"
                        | "erc1155"
                        | readonly (
                            | {}
                            | {}
                            | (
                                { 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?: (...)[] }[];
                    }
                )[];
            }
        )[];
    }

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

    Type declaration

    • scope: "project" | "account"

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

    • 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";
              operation: "signEvmTransaction";
              criteria: (
                  | {
                      type: "ethValue";
                      ethValue: string;
                      operator: ">"
                      | ">="
                      | "<"
                      | "<="
                      | "==";
                  }
                  | {
                      type: "evmAddress";
                      addresses: `0x${string}`[];
                      operator: "in"
                      | "not in";
                  }
                  | {
                      type: "evmData";
                      abi: | "erc20"
                      | "erc721"
                      | "erc1155"
                      | readonly (
                          | {}
                          | {}
                          | (
                              { 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?: (...)[] }[];
                  }
              )[];
          }
          | { action: "reject"
          | "accept"; operation: "signEvmHash" }
          | {
              action: "reject" | "accept";
              operation: "signEvmMessage";
              criteria: { type: "evmMessage"; match: string }[];
          }
          | {
              action: "reject"
              | "accept";
              operation: "signEvmTypedData";
              criteria: (
                  | {
                      type: "evmTypedDataField";
                      types: {
                          types: Record<string, { name: ...; type: ... }[]>;
                          primaryType: string;
                      };
                      conditions: (
                          | { addresses: (...)[]; operator: (...) | (...); path: string }
                          | {
                              value: string;
                              operator: (...) | (...) | (...) | (...) | (...);
                              path: string;
                          }
                          | { match: string; path: string }
                      )[];
                  }
                  | {
                      type: "evmTypedDataVerifyingContract";
                      addresses: `0x${string}`[];
                      operator: "in"
                      | "not in";
                  }
              )[];
          }
          | {
              action: "reject"
              | "accept";
              operation: "sendEvmTransaction";
              criteria: (
                  | {
                      type: "ethValue";
                      ethValue: string;
                      operator: ">"
                      | ">="
                      | "<"
                      | "<="
                      | "==";
                  }
                  | {
                      type: "evmAddress";
                      addresses: `0x${string}`[];
                      operator: "in"
                      | "not in";
                  }
                  | {
                      type: "evmNetwork";
                      networks: ("base-sepolia" | "base")[];
                      operator: "in" | "not in";
                  }
                  | {
                      type: "evmData";
                      abi: | "erc20"
                      | "erc721"
                      | "erc1155"
                      | readonly (
                          | {}
                          | {}
                          | (
                              { 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?: (...)[] }[];
                  }
              )[];
          }
          | {
              action: "reject"
              | "accept";
              operation: "signSolTransaction";
              criteria: {
                  type: "solAddress";
                  addresses: string[];
                  operator: "in" | "not in";
              }[];
          }
          | {
              action: "reject"
              | "accept";
              operation: "prepareUserOperation";
              criteria: (
                  | {
                      type: "ethValue";
                      ethValue: string;
                      operator: ">"
                      | ">="
                      | "<"
                      | "<="
                      | "==";
                  }
                  | {
                      type: "evmAddress";
                      addresses: `0x${string}`[];
                      operator: "in"
                      | "not in";
                  }
                  | {
                      type: "evmNetwork";
                      networks: ("base-sepolia" | "base")[];
                      operator: "in" | "not in";
                  }
                  | {
                      type: "evmData";
                      abi: | "erc20"
                      | "erc721"
                      | "erc1155"
                      | readonly (
                          | {}
                          | {}
                          | (
                              { 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?: (...)[] }[];
                  }
              )[];
          }
          | {
              action: "reject"
              | "accept";
              operation: "sendUserOperation";
              criteria: (
                  | {
                      type: "ethValue";
                      ethValue: string;
                      operator: ">"
                      | ">="
                      | "<"
                      | "<="
                      | "==";
                  }
                  | {
                      type: "evmAddress";
                      addresses: `0x${string}`[];
                      operator: "in"
                      | "not in";
                  }
                  | {
                      type: "evmData";
                      abi: | "erc20"
                      | "erc721"
                      | "erc1155"
                      | readonly (
                          | {}
                          | {}
                          | (
                              { 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?: (...)[] }[];
                  }
              )[];
          }
      )[]

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