Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions typescript/.changeset/spicy-clouds-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@coinbase/cdp-sdk": minor
---

Added SignEvmHashRule to policies schema
18 changes: 18 additions & 0 deletions typescript/src/policies/evmSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -855,3 +855,21 @@ export const SignEndUserEvmTypedDataRuleSchema = z.object({
criteria: SignEndUserEvmTypedDataCriteriaSchema,
});
export type SignEndUserEvmTypedDataRule = z.infer<typeof SignEndUserEvmTypedDataRuleSchema>;

/**
* Type representing a 'signEndUserEvmHash' policy rule that can accept or reject
* end-user EVM hash signing operations.
*/
export const SignEndUserEvmHashRuleSchema = z.object({
/**
* Determines whether matching the rule will cause a request to be rejected or accepted.
* "accept" will allow the signing, "reject" will block it.
*/
action: ActionEnum,
/**
* The operation to which this rule applies.
* Must be "signEndUserEvmHash".
*/
operation: z.literal("signEndUserEvmHash"),
});
export type SignEndUserEvmHashRule = z.infer<typeof SignEndUserEvmHashRuleSchema>;
2 changes: 2 additions & 0 deletions typescript/src/policies/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
SendEndUserEvmTransactionRuleSchema,
SignEndUserEvmMessageRuleSchema,
SignEndUserEvmTypedDataRuleSchema,
SignEndUserEvmHashRuleSchema,
} from "./evmSchema.js";
import {
SendSolTransactionRuleSchema,
Expand Down Expand Up @@ -68,6 +69,7 @@ export const RuleSchema = z.discriminatedUnion("operation", [
SendEndUserEvmTransactionRuleSchema,
SignEndUserEvmMessageRuleSchema,
SignEndUserEvmTypedDataRuleSchema,
SignEndUserEvmHashRuleSchema,
SignEndUserSolTransactionRuleSchema,
SendEndUserSolTransactionRuleSchema,
SignEndUserSolMessageRuleSchema,
Expand Down
Loading