@coinbase/cdp-sdk 1.11.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +126 -0
  3. package/_cjs/accounts/evm/toEvmServerAccount.js +15 -0
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  5. package/_cjs/actions/evm/swap/createSwapQuote.js +126 -0
  6. package/_cjs/actions/evm/swap/createSwapQuote.js.map +1 -0
  7. package/_cjs/actions/evm/swap/getSwapPrice.js +86 -0
  8. package/_cjs/actions/evm/swap/getSwapPrice.js.map +1 -0
  9. package/_cjs/actions/evm/swap/sendSwapTransaction.js +141 -0
  10. package/_cjs/actions/evm/swap/sendSwapTransaction.js.map +1 -0
  11. package/_cjs/actions/evm/swap/types.js +3 -0
  12. package/_cjs/actions/evm/swap/types.js.map +1 -0
  13. package/_cjs/client/evm/evm.js +46 -1
  14. package/_cjs/client/evm/evm.js.map +1 -1
  15. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +28 -1
  16. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  17. package/_cjs/openapi-client/generated/evm-swaps/evm-swaps.js +26 -0
  18. package/_cjs/openapi-client/generated/evm-swaps/evm-swaps.js.map +1 -0
  19. package/_cjs/openapi-client/generated/evm-swaps/evm-swaps.msw.js +179 -0
  20. package/_cjs/openapi-client/generated/evm-swaps/evm-swaps.msw.js.map +1 -0
  21. package/_cjs/openapi-client/generated/index.msw.js +5 -4
  22. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  23. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +59 -1
  24. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  25. package/_cjs/openapi-client/index.js +4 -0
  26. package/_cjs/openapi-client/index.js.map +1 -1
  27. package/_cjs/policies/schema.js +59 -1
  28. package/_cjs/policies/schema.js.map +1 -1
  29. package/_cjs/version.js +1 -1
  30. package/_esm/accounts/evm/toEvmServerAccount.js +15 -0
  31. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  32. package/_esm/actions/evm/swap/createSwapQuote.js +123 -0
  33. package/_esm/actions/evm/swap/createSwapQuote.js.map +1 -0
  34. package/_esm/actions/evm/swap/getSwapPrice.js +83 -0
  35. package/_esm/actions/evm/swap/getSwapPrice.js.map +1 -0
  36. package/_esm/actions/evm/swap/sendSwapTransaction.js +138 -0
  37. package/_esm/actions/evm/swap/sendSwapTransaction.js.map +1 -0
  38. package/_esm/actions/evm/swap/types.js +2 -0
  39. package/_esm/actions/evm/swap/types.js.map +1 -0
  40. package/_esm/client/evm/evm.js +46 -1
  41. package/_esm/client/evm/evm.js.map +1 -1
  42. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +27 -0
  43. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  44. package/_esm/openapi-client/generated/evm-swaps/evm-swaps.js +21 -0
  45. package/_esm/openapi-client/generated/evm-swaps/evm-swaps.js.map +1 -0
  46. package/_esm/openapi-client/generated/evm-swaps/evm-swaps.msw.js +167 -0
  47. package/_esm/openapi-client/generated/evm-swaps/evm-swaps.msw.js.map +1 -0
  48. package/_esm/openapi-client/generated/index.msw.js +5 -4
  49. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  50. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +54 -0
  51. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  52. package/_esm/openapi-client/index.js +4 -0
  53. package/_esm/openapi-client/index.js.map +1 -1
  54. package/_esm/policies/schema.js +58 -0
  55. package/_esm/policies/schema.js.map +1 -1
  56. package/_esm/version.js +1 -1
  57. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  58. package/_types/actions/evm/swap/createSwapQuote.d.ts +23 -0
  59. package/_types/actions/evm/swap/createSwapQuote.d.ts.map +1 -0
  60. package/_types/actions/evm/swap/getSwapPrice.d.ts +23 -0
  61. package/_types/actions/evm/swap/getSwapPrice.d.ts.map +1 -0
  62. package/_types/actions/evm/swap/sendSwapTransaction.d.ts +64 -0
  63. package/_types/actions/evm/swap/sendSwapTransaction.d.ts.map +1 -0
  64. package/_types/actions/evm/swap/types.d.ts +119 -0
  65. package/_types/actions/evm/swap/types.d.ts.map +1 -0
  66. package/_types/actions/evm/types.d.ts +86 -0
  67. package/_types/actions/evm/types.d.ts.map +1 -1
  68. package/_types/client/evm/evm.d.ts +39 -1
  69. package/_types/client/evm/evm.d.ts.map +1 -1
  70. package/_types/client/evm/evm.types.d.ts +207 -3
  71. package/_types/client/evm/evm.types.d.ts.map +1 -1
  72. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +364 -4
  73. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  74. package/_types/openapi-client/generated/evm-swaps/evm-swaps.d.ts +24 -0
  75. package/_types/openapi-client/generated/evm-swaps/evm-swaps.d.ts.map +1 -0
  76. package/_types/openapi-client/generated/evm-swaps/evm-swaps.msw.d.ts +12 -0
  77. package/_types/openapi-client/generated/evm-swaps/evm-swaps.msw.d.ts.map +1 -0
  78. package/_types/openapi-client/generated/index.msw.d.ts +5 -4
  79. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  80. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +5 -1
  81. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -1
  82. package/_types/openapi-client/index.d.ts +5 -0
  83. package/_types/openapi-client/index.d.ts.map +1 -1
  84. package/_types/policies/schema.d.ts +338 -0
  85. package/_types/policies/schema.d.ts.map +1 -1
  86. package/_types/version.d.ts +1 -1
  87. package/accounts/evm/toEvmServerAccount.ts +21 -0
  88. package/actions/evm/swap/createSwapQuote.ts +148 -0
  89. package/actions/evm/swap/getSwapPrice.ts +95 -0
  90. package/actions/evm/swap/sendSwapTransaction.ts +173 -0
  91. package/actions/evm/swap/types.ts +137 -0
  92. package/actions/evm/types.ts +88 -0
  93. package/client/evm/evm.ts +58 -1
  94. package/client/evm/evm.types.ts +225 -1
  95. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +422 -4
  96. package/openapi-client/generated/evm-swaps/evm-swaps.msw.ts +217 -0
  97. package/openapi-client/generated/evm-swaps/evm-swaps.ts +51 -0
  98. package/openapi-client/generated/index.msw.ts +5 -4
  99. package/openapi-client/generated/policy-engine/policy-engine.msw.ts +87 -0
  100. package/openapi-client/index.ts +4 -0
  101. package/package.json +1 -1
  102. package/policies/schema.ts +70 -0
  103. package/version.ts +1 -1
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Generated by orval v7.6.0 🍺
3
+ * Do not edit manually.
4
+ * Coinbase Developer Platform APIs
5
+ * The Coinbase Developer Platform APIs - leading the world's transition onchain.
6
+ * OpenAPI spec version: 2.0.0
7
+ */
8
+ import type {
9
+ CreateEvmSwapQuoteBody,
10
+ CreateSwapQuoteResponseWrapper,
11
+ GetEvmSwapPriceParams,
12
+ GetSwapPriceResponseWrapper,
13
+ } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
14
+
15
+ import { cdpApiClient } from "../../cdpApiClient.js";
16
+
17
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
18
+
19
+ /**
20
+ * Get a price estimate for a swap between two tokens on an EVM network.
21
+ * @summary Get a price estimate for a swap
22
+ */
23
+ export const getEvmSwapPrice = (
24
+ params: GetEvmSwapPriceParams,
25
+ options?: SecondParameter<typeof cdpApiClient>,
26
+ ) => {
27
+ return cdpApiClient<GetSwapPriceResponseWrapper>(
28
+ { url: `/v2/evm/swaps/quote`, method: "GET", params },
29
+ options,
30
+ );
31
+ };
32
+ /**
33
+ * Create a swap quote, which includes the payload to sign as well as the transaction data needed to execute the swap. The developer is responsible for signing the payload and submitting the transaction to the network in order to execute the swap.
34
+ * @summary Create a swap quote
35
+ */
36
+ export const createEvmSwapQuote = (
37
+ createEvmSwapQuoteBody: CreateEvmSwapQuoteBody,
38
+ options?: SecondParameter<typeof cdpApiClient>,
39
+ ) => {
40
+ return cdpApiClient<CreateSwapQuoteResponseWrapper>(
41
+ {
42
+ url: `/v2/evm/swaps`,
43
+ method: "POST",
44
+ headers: { "Content-Type": "application/json" },
45
+ data: createEvmSwapQuoteBody,
46
+ },
47
+ options,
48
+ );
49
+ };
50
+ export type GetEvmSwapPriceResult = NonNullable<Awaited<ReturnType<typeof getEvmSwapPrice>>>;
51
+ export type CreateEvmSwapQuoteResult = NonNullable<Awaited<ReturnType<typeof createEvmSwapQuote>>>;
@@ -1,7 +1,8 @@
1
- export * from "./evm-token-balances/evm-token-balances.msw.js";
2
- export * from "./evm-accounts/evm-accounts.msw.js";
3
1
  export * from "./faucets/faucets.msw.js";
4
- export * from "./solana-accounts/solana-accounts.msw.js";
5
- export * from "./payments-alpha/payments-alpha.msw.js";
2
+ export * from "./evm-accounts/evm-accounts.msw.js";
3
+ export * from "./evm-token-balances/evm-token-balances.msw.js";
6
4
  export * from "./policy-engine/policy-engine.msw.js";
7
5
  export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
6
+ export * from "./evm-swaps/evm-swaps.msw.js";
7
+ export * from "./solana-accounts/solana-accounts.msw.js";
8
+ export * from "./payments-alpha/payments-alpha.msw.js";
@@ -12,6 +12,7 @@ import { HttpResponse, delay, http } from "msw";
12
12
  import type {
13
13
  EthValueCriterion,
14
14
  EvmAddressCriterion,
15
+ EvmMessageCriterion,
15
16
  EvmNetworkCriterion,
16
17
  ListPolicies200,
17
18
  Policy,
@@ -53,6 +54,13 @@ export const getListPoliciesResponseEvmNetworkCriterionMock = (
53
54
  ...overrideResponse,
54
55
  });
55
56
 
57
+ export const getListPoliciesResponseEvmMessageCriterionMock = (
58
+ overrideResponse: Partial<EvmMessageCriterion> = {},
59
+ ): EvmMessageCriterion => ({
60
+ ...{ type: faker.helpers.arrayElement(["evmMessage"] as const), match: faker.string.alpha(20) },
61
+ ...overrideResponse,
62
+ });
63
+
56
64
  export const getListPoliciesResponseSolAddressCriterionMock = (
57
65
  overrideResponse: Partial<SolAddressCriterion> = {},
58
66
  ): SolAddressCriterion => ({
@@ -108,6 +116,18 @@ export const getListPoliciesResponseMock = (): ListPolicies200 => ({
108
116
  ]),
109
117
  ),
110
118
  },
119
+ {
120
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
121
+ operation: faker.helpers.arrayElement(["signEvmMessage"] as const),
122
+ criteria: Array.from(
123
+ { length: faker.number.int({ min: 1, max: 10 }) },
124
+ (_, i) => i + 1,
125
+ ).map(() =>
126
+ faker.helpers.arrayElement([
127
+ { ...getListPoliciesResponseEvmMessageCriterionMock() },
128
+ ]),
129
+ ),
130
+ },
111
131
  {
112
132
  action: faker.helpers.arrayElement(["reject", "accept"] as const),
113
133
  operation: faker.helpers.arrayElement(["signSolTransaction"] as const),
@@ -120,6 +140,10 @@ export const getListPoliciesResponseMock = (): ListPolicies200 => ({
120
140
  ]),
121
141
  ),
122
142
  },
143
+ {
144
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
145
+ operation: faker.helpers.arrayElement(["signEvmHash"] as const),
146
+ },
123
147
  ]),
124
148
  ),
125
149
  createdAt: faker.string.alpha(20),
@@ -165,6 +189,13 @@ export const getCreatePolicyResponseEvmNetworkCriterionMock = (
165
189
  ...overrideResponse,
166
190
  });
167
191
 
192
+ export const getCreatePolicyResponseEvmMessageCriterionMock = (
193
+ overrideResponse: Partial<EvmMessageCriterion> = {},
194
+ ): EvmMessageCriterion => ({
195
+ ...{ type: faker.helpers.arrayElement(["evmMessage"] as const), match: faker.string.alpha(20) },
196
+ ...overrideResponse,
197
+ });
198
+
168
199
  export const getCreatePolicyResponseSolAddressCriterionMock = (
169
200
  overrideResponse: Partial<SolAddressCriterion> = {},
170
201
  ): SolAddressCriterion => ({
@@ -216,6 +247,16 @@ export const getCreatePolicyResponseMock = (overrideResponse: Partial<Policy> =
216
247
  ]),
217
248
  ),
218
249
  },
250
+ {
251
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
252
+ operation: faker.helpers.arrayElement(["signEvmMessage"] as const),
253
+ criteria: Array.from(
254
+ { length: faker.number.int({ min: 1, max: 10 }) },
255
+ (_, i) => i + 1,
256
+ ).map(() =>
257
+ faker.helpers.arrayElement([{ ...getCreatePolicyResponseEvmMessageCriterionMock() }]),
258
+ ),
259
+ },
219
260
  {
220
261
  action: faker.helpers.arrayElement(["reject", "accept"] as const),
221
262
  operation: faker.helpers.arrayElement(["signSolTransaction"] as const),
@@ -226,6 +267,10 @@ export const getCreatePolicyResponseMock = (overrideResponse: Partial<Policy> =
226
267
  faker.helpers.arrayElement([{ ...getCreatePolicyResponseSolAddressCriterionMock() }]),
227
268
  ),
228
269
  },
270
+ {
271
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
272
+ operation: faker.helpers.arrayElement(["signEvmHash"] as const),
273
+ },
229
274
  ]),
230
275
  ),
231
276
  createdAt: faker.string.alpha(20),
@@ -268,6 +313,13 @@ export const getGetPolicyByIdResponseEvmNetworkCriterionMock = (
268
313
  ...overrideResponse,
269
314
  });
270
315
 
316
+ export const getGetPolicyByIdResponseEvmMessageCriterionMock = (
317
+ overrideResponse: Partial<EvmMessageCriterion> = {},
318
+ ): EvmMessageCriterion => ({
319
+ ...{ type: faker.helpers.arrayElement(["evmMessage"] as const), match: faker.string.alpha(20) },
320
+ ...overrideResponse,
321
+ });
322
+
271
323
  export const getGetPolicyByIdResponseSolAddressCriterionMock = (
272
324
  overrideResponse: Partial<SolAddressCriterion> = {},
273
325
  ): SolAddressCriterion => ({
@@ -319,6 +371,16 @@ export const getGetPolicyByIdResponseMock = (overrideResponse: Partial<Policy> =
319
371
  ]),
320
372
  ),
321
373
  },
374
+ {
375
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
376
+ operation: faker.helpers.arrayElement(["signEvmMessage"] as const),
377
+ criteria: Array.from(
378
+ { length: faker.number.int({ min: 1, max: 10 }) },
379
+ (_, i) => i + 1,
380
+ ).map(() =>
381
+ faker.helpers.arrayElement([{ ...getGetPolicyByIdResponseEvmMessageCriterionMock() }]),
382
+ ),
383
+ },
322
384
  {
323
385
  action: faker.helpers.arrayElement(["reject", "accept"] as const),
324
386
  operation: faker.helpers.arrayElement(["signSolTransaction"] as const),
@@ -329,6 +391,10 @@ export const getGetPolicyByIdResponseMock = (overrideResponse: Partial<Policy> =
329
391
  faker.helpers.arrayElement([{ ...getGetPolicyByIdResponseSolAddressCriterionMock() }]),
330
392
  ),
331
393
  },
394
+ {
395
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
396
+ operation: faker.helpers.arrayElement(["signEvmHash"] as const),
397
+ },
332
398
  ]),
333
399
  ),
334
400
  createdAt: faker.string.alpha(20),
@@ -371,6 +437,13 @@ export const getUpdatePolicyResponseEvmNetworkCriterionMock = (
371
437
  ...overrideResponse,
372
438
  });
373
439
 
440
+ export const getUpdatePolicyResponseEvmMessageCriterionMock = (
441
+ overrideResponse: Partial<EvmMessageCriterion> = {},
442
+ ): EvmMessageCriterion => ({
443
+ ...{ type: faker.helpers.arrayElement(["evmMessage"] as const), match: faker.string.alpha(20) },
444
+ ...overrideResponse,
445
+ });
446
+
374
447
  export const getUpdatePolicyResponseSolAddressCriterionMock = (
375
448
  overrideResponse: Partial<SolAddressCriterion> = {},
376
449
  ): SolAddressCriterion => ({
@@ -422,6 +495,16 @@ export const getUpdatePolicyResponseMock = (overrideResponse: Partial<Policy> =
422
495
  ]),
423
496
  ),
424
497
  },
498
+ {
499
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
500
+ operation: faker.helpers.arrayElement(["signEvmMessage"] as const),
501
+ criteria: Array.from(
502
+ { length: faker.number.int({ min: 1, max: 10 }) },
503
+ (_, i) => i + 1,
504
+ ).map(() =>
505
+ faker.helpers.arrayElement([{ ...getUpdatePolicyResponseEvmMessageCriterionMock() }]),
506
+ ),
507
+ },
425
508
  {
426
509
  action: faker.helpers.arrayElement(["reject", "accept"] as const),
427
510
  operation: faker.helpers.arrayElement(["signSolTransaction"] as const),
@@ -432,6 +515,10 @@ export const getUpdatePolicyResponseMock = (overrideResponse: Partial<Policy> =
432
515
  faker.helpers.arrayElement([{ ...getUpdatePolicyResponseSolAddressCriterionMock() }]),
433
516
  ),
434
517
  },
518
+ {
519
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
520
+ operation: faker.helpers.arrayElement(["signEvmHash"] as const),
521
+ },
435
522
  ]),
436
523
  ),
437
524
  createdAt: faker.string.alpha(20),
@@ -1,6 +1,7 @@
1
1
  export * from "./generated/coinbaseDeveloperPlatformAPIs.schemas.js";
2
2
  export * from "./generated/evm-accounts/evm-accounts.js";
3
3
  export * from "./generated/evm-smart-accounts/evm-smart-accounts.js";
4
+ export * from "./generated/evm-swaps/evm-swaps.js";
4
5
  export * from "./generated/evm-token-balances/evm-token-balances.js";
5
6
  export * from "./generated/solana-accounts/solana-accounts.js";
6
7
  export * from "./generated/faucets/faucets.js";
@@ -10,6 +11,7 @@ export * from "./generated/payments-alpha/payments-alpha.js";
10
11
  import { configure } from "./cdpApiClient.js";
11
12
  import * as evm from "./generated/evm-accounts/evm-accounts.js";
12
13
  import * as evmSmartAccounts from "./generated/evm-smart-accounts/evm-smart-accounts.js";
14
+ import * as evmSwaps from "./generated/evm-swaps/evm-swaps.js";
13
15
  import * as evmTokenBalances from "./generated/evm-token-balances/evm-token-balances.js";
14
16
  import * as faucets from "./generated/faucets/faucets.js";
15
17
  import * as payments from "./generated/payments-alpha/payments-alpha.js";
@@ -19,6 +21,7 @@ import * as solana from "./generated/solana-accounts/solana-accounts.js";
19
21
  export const CdpOpenApiClient = {
20
22
  ...evm,
21
23
  ...evmSmartAccounts,
24
+ ...evmSwaps,
22
25
  ...evmTokenBalances,
23
26
  ...solana,
24
27
  ...faucets,
@@ -30,6 +33,7 @@ export const CdpOpenApiClient = {
30
33
  export const OpenApiEvmMethods = {
31
34
  ...evm,
32
35
  ...evmSmartAccounts,
36
+ ...evmSwaps,
33
37
  ...evmTokenBalances,
34
38
  requestEvmFaucet: faucets.requestEvmFaucet,
35
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-sdk",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "SDK for interacting with the Coinbase Developer Platform Wallet API",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
@@ -107,6 +107,20 @@ export const EvmNetworkCriterionSchema = z.object({
107
107
  });
108
108
  export type EvmNetworkCriterion = z.infer<typeof EvmNetworkCriterionSchema>;
109
109
 
110
+ /**
111
+ * Schema for EVM message criterions
112
+ */
113
+ export const EvmMessageCriterionSchema = z.object({
114
+ /** The type of criterion, must be "evmMessage" for EVM message-based rules. */
115
+ type: z.literal("evmMessage"),
116
+ /**
117
+ * A regular expression the message is matched against.
118
+ * Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax).
119
+ */
120
+ match: z.string().min(1),
121
+ });
122
+ export type EvmMessageCriterion = z.infer<typeof EvmMessageCriterionSchema>;
123
+
110
124
  /**
111
125
  * Schema for Solana address criterions
112
126
  */
@@ -140,6 +154,19 @@ export const SignEvmTransactionCriteriaSchema = z
140
154
  */
141
155
  export type SignEvmTransactionCriteria = z.infer<typeof SignEvmTransactionCriteriaSchema>;
142
156
 
157
+ /**
158
+ * Schema for criteria used in SignEvmMessage operations
159
+ */
160
+ export const SignEvmMessageCriteriaSchema = z
161
+ .array(z.discriminatedUnion("type", [EvmMessageCriterionSchema]))
162
+ .max(10)
163
+ .min(1);
164
+ /**
165
+ * Type representing a set of criteria for the signEvmMessage operation.
166
+ * Can contain up to 10 individual EVM message criterion objects.
167
+ */
168
+ export type SignEvmMessageCriteria = z.infer<typeof SignEvmMessageCriteriaSchema>;
169
+
143
170
  /**
144
171
  * Schema for criteria used in SendEvmTransaction operations
145
172
  */
@@ -226,6 +253,47 @@ export const SignEvmTransactionRuleSchema = z.object({
226
253
  });
227
254
  export type SignEvmTransactionRule = z.infer<typeof SignEvmTransactionRuleSchema>;
228
255
 
256
+ /**
257
+ * Type representing a 'signEvmHash' policy rule that can accept or reject specific operations
258
+ * based on a set of criteria.
259
+ */
260
+ export const SignEvmHashRuleSchema = z.object({
261
+ /**
262
+ * Determines whether matching the rule will cause a request to be rejected or accepted.
263
+ * "accept" will allow the signing, "reject" will block it.
264
+ */
265
+ action: ActionEnum,
266
+ /**
267
+ * The operation to which this rule applies.
268
+ * Must be "signEvmHash".
269
+ */
270
+ operation: z.literal("signEvmHash"),
271
+ });
272
+ export type SignEvmHashRule = z.infer<typeof SignEvmHashRuleSchema>;
273
+
274
+ /**
275
+ * Type representing a 'signEvmMessage' policy rule that can accept or reject specific operations
276
+ * based on a set of criteria.
277
+ */
278
+ export const SignEvmMessageRuleSchema = z.object({
279
+ /**
280
+ * Determines whether matching the rule will cause a request to be rejected or accepted.
281
+ * "accept" will allow the signing, "reject" will block it.
282
+ */
283
+ action: ActionEnum,
284
+ /**
285
+ * The operation to which this rule applies.
286
+ * Must be "signEvmMessage".
287
+ */
288
+ operation: z.literal("signEvmMessage"),
289
+ /**
290
+ * The set of criteria that must be matched for this rule to apply.
291
+ * Must be compatible with the specified operation type.
292
+ */
293
+ criteria: SignEvmMessageCriteriaSchema,
294
+ });
295
+ export type SignEvmMessageRule = z.infer<typeof SignEvmMessageRuleSchema>;
296
+
229
297
  /**
230
298
  * Type representing a 'sendEvmTransaction' policy rule that can accept or reject specific operations
231
299
  * based on a set of criteria.
@@ -277,6 +345,8 @@ export type SignSolTransactionRule = z.infer<typeof SignSolTransactionRuleSchema
277
345
  */
278
346
  export const RuleSchema = z.discriminatedUnion("operation", [
279
347
  SignEvmTransactionRuleSchema,
348
+ SignEvmHashRuleSchema,
349
+ SignEvmMessageRuleSchema,
280
350
  SendEvmTransactionRuleSchema,
281
351
  SignSolTransactionRuleSchema,
282
352
  ]);
package/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "1.11.0";
1
+ export const version = "1.13.0";