@coinbase/cdp-sdk 1.22.0 → 1.24.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 (93) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +2 -0
  3. package/_cjs/accounts/evm/toEvmSmartAccount.js +1 -0
  4. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  5. package/_cjs/actions/evm/getUserOperation.js +2 -1
  6. package/_cjs/actions/evm/getUserOperation.js.map +1 -1
  7. package/_cjs/client/evm/evm.js +23 -1
  8. package/_cjs/client/evm/evm.js.map +1 -1
  9. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +55 -1
  10. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  11. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +14 -1
  12. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  13. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +51 -1
  14. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
  15. package/_cjs/openapi-client/generated/index.msw.js +5 -5
  16. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  17. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +322 -1
  18. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  19. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js +14 -10
  20. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
  21. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js +34 -1
  22. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
  23. package/_cjs/policies/schema.js +210 -1
  24. package/_cjs/policies/schema.js.map +1 -1
  25. package/_cjs/version.js +1 -1
  26. package/_esm/accounts/evm/toEvmSmartAccount.js +1 -0
  27. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  28. package/_esm/actions/evm/getUserOperation.js +2 -1
  29. package/_esm/actions/evm/getUserOperation.js.map +1 -1
  30. package/_esm/client/evm/evm.js +23 -1
  31. package/_esm/client/evm/evm.js.map +1 -1
  32. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +53 -0
  33. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  34. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +12 -0
  35. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  36. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +48 -0
  37. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
  38. package/_esm/openapi-client/generated/index.msw.js +5 -5
  39. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  40. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +300 -0
  41. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  42. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +12 -8
  43. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
  44. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +31 -0
  45. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
  46. package/_esm/policies/schema.js +209 -0
  47. package/_esm/policies/schema.js.map +1 -1
  48. package/_esm/version.js +1 -1
  49. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  50. package/_types/accounts/evm/types.d.ts +2 -0
  51. package/_types/accounts/evm/types.d.ts.map +1 -1
  52. package/_types/actions/evm/getUserOperation.d.ts.map +1 -1
  53. package/_types/actions/evm/types.d.ts +2 -2
  54. package/_types/actions/evm/types.d.ts.map +1 -1
  55. package/_types/client/evm/evm.d.ts +15 -2
  56. package/_types/client/evm/evm.d.ts.map +1 -1
  57. package/_types/client/evm/evm.types.d.ts +19 -5
  58. package/_types/client/evm/evm.types.d.ts.map +1 -1
  59. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +222 -3
  60. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  61. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +7 -1
  62. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
  63. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +2 -0
  64. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
  65. package/_types/openapi-client/generated/index.msw.d.ts +5 -5
  66. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  67. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +21 -1
  68. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -1
  69. package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts +7 -6
  70. package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -1
  71. package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +2 -0
  72. package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -1
  73. package/_types/openapi-client/index.d.ts +4 -10
  74. package/_types/openapi-client/index.d.ts.map +1 -1
  75. package/_types/policies/schema.d.ts +7373 -1437
  76. package/_types/policies/schema.d.ts.map +1 -1
  77. package/_types/version.d.ts +1 -1
  78. package/accounts/evm/toEvmSmartAccount.ts +1 -0
  79. package/accounts/evm/types.ts +2 -0
  80. package/actions/evm/getUserOperation.ts +4 -1
  81. package/actions/evm/types.ts +2 -2
  82. package/client/evm/evm.ts +32 -1
  83. package/client/evm/evm.types.ts +21 -4
  84. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +301 -3
  85. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +86 -0
  86. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +23 -0
  87. package/openapi-client/generated/index.msw.ts +5 -5
  88. package/openapi-client/generated/policy-engine/policy-engine.msw.ts +465 -0
  89. package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +51 -0
  90. package/openapi-client/generated/solana-accounts/solana-accounts.ts +22 -20
  91. package/package.json +1 -1
  92. package/policies/schema.ts +257 -0
  93. package/version.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-sdk",
3
- "version": "1.22.0",
3
+ "version": "1.24.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",
@@ -121,6 +121,152 @@ export const EvmMessageCriterionSchema = z.object({
121
121
  });
122
122
  export type EvmMessageCriterion = z.infer<typeof EvmMessageCriterionSchema>;
123
123
 
124
+ /**
125
+ * Schema for EVM typed address conditions
126
+ */
127
+ export const EvmTypedAddressConditionSchema = z.object({
128
+ /**
129
+ * Array of EVM addresses to compare against.
130
+ * Each address must be a 0x-prefixed 40-character hexadecimal string.
131
+ * Limited to a maximum of 100 addresses per condition.
132
+ */
133
+ addresses: z.array(Address).max(100),
134
+ /**
135
+ * The operator to use for evaluating addresses.
136
+ * "in" checks if an address is in the provided list.
137
+ * "not in" checks if an address is not in the provided list.
138
+ */
139
+ operator: EvmAddressOperatorEnum,
140
+ /**
141
+ * The path to the field to compare against this criterion.
142
+ * To reference deeply nested fields, use dot notation (e.g., "order.buyer").
143
+ */
144
+ path: z.string().min(1),
145
+ });
146
+ export type EvmTypedAddressCondition = z.infer<typeof EvmTypedAddressConditionSchema>;
147
+
148
+ /**
149
+ * Schema for EVM typed numerical conditions
150
+ */
151
+ export const EvmTypedNumericalConditionSchema = z.object({
152
+ /**
153
+ * The numerical value to compare against, as a string.
154
+ * Must contain only digits.
155
+ */
156
+ value: z.string().regex(/^[0-9]+$/),
157
+ /**
158
+ * The comparison operator to use.
159
+ */
160
+ operator: EthValueOperatorEnum,
161
+ /**
162
+ * The path to the field to compare against this criterion.
163
+ * To reference deeply nested fields, use dot notation (e.g., "order.price").
164
+ */
165
+ path: z.string().min(1),
166
+ });
167
+ export type EvmTypedNumericalCondition = z.infer<typeof EvmTypedNumericalConditionSchema>;
168
+
169
+ /**
170
+ * Schema for EVM typed string conditions
171
+ */
172
+ export const EvmTypedStringConditionSchema = z.object({
173
+ /**
174
+ * A regular expression the string field is matched against.
175
+ * Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax).
176
+ */
177
+ match: z.string().min(1),
178
+ /**
179
+ * The path to the field to compare against this criterion.
180
+ * To reference deeply nested fields, use dot notation (e.g., "metadata.description").
181
+ */
182
+ path: z.string().min(1),
183
+ });
184
+ export type EvmTypedStringCondition = z.infer<typeof EvmTypedStringConditionSchema>;
185
+
186
+ /**
187
+ * Schema for SignEvmTypedData field criterion
188
+ */
189
+ export const SignEvmTypedDataFieldCriterionSchema = z.object({
190
+ /** The type of criterion, must be "evmTypedDataField" for typed data field-based rules. */
191
+ type: z.literal("evmTypedDataField"),
192
+ /**
193
+ * The EIP-712 type definitions for the typed data.
194
+ * Must include at minimum the primary type being signed.
195
+ */
196
+ types: z.object({
197
+ /**
198
+ * EIP-712 compliant map of model names to model definitions.
199
+ */
200
+ types: z.record(
201
+ z.array(
202
+ z.object({
203
+ name: z.string(),
204
+ type: z.string(),
205
+ }),
206
+ ),
207
+ ),
208
+ /**
209
+ * The name of the root EIP-712 type. This value must be included in the `types` object.
210
+ */
211
+ primaryType: z.string(),
212
+ }),
213
+ /**
214
+ * Array of conditions to apply against typed data fields.
215
+ * Each condition specifies how to validate a specific field within the typed data.
216
+ */
217
+ conditions: z
218
+ .array(
219
+ z.union([
220
+ EvmTypedAddressConditionSchema,
221
+ EvmTypedNumericalConditionSchema,
222
+ EvmTypedStringConditionSchema,
223
+ ]),
224
+ )
225
+ .min(1),
226
+ });
227
+ export type SignEvmTypedDataFieldCriterion = z.infer<typeof SignEvmTypedDataFieldCriterionSchema>;
228
+
229
+ /**
230
+ * Schema for SignEvmTypedData verifying contract criterion
231
+ */
232
+ export const SignEvmTypedDataVerifyingContractCriterionSchema = z.object({
233
+ /** The type of criterion, must be "evmTypedDataVerifyingContract" for verifying contract-based rules. */
234
+ type: z.literal("evmTypedDataVerifyingContract"),
235
+ /**
236
+ * Array of EVM addresses allowed or disallowed as verifying contracts.
237
+ * Each address must be a 0x-prefixed 40-character hexadecimal string.
238
+ * Limited to a maximum of 100 addresses per criterion.
239
+ */
240
+ addresses: z.array(Address).max(100),
241
+ /**
242
+ * The operator to use for evaluating verifying contract addresses.
243
+ * "in" checks if the verifying contract is in the provided list.
244
+ * "not in" checks if the verifying contract is not in the provided list.
245
+ */
246
+ operator: EvmAddressOperatorEnum,
247
+ });
248
+ export type SignEvmTypedDataVerifyingContractCriterion = z.infer<
249
+ typeof SignEvmTypedDataVerifyingContractCriterionSchema
250
+ >;
251
+
252
+ /**
253
+ * Schema for criteria used in SignEvmTypedData operations
254
+ */
255
+ export const SignEvmTypedDataCriteriaSchema = z
256
+ .array(
257
+ z.discriminatedUnion("type", [
258
+ SignEvmTypedDataFieldCriterionSchema,
259
+ SignEvmTypedDataVerifyingContractCriterionSchema,
260
+ ]),
261
+ )
262
+ .max(10)
263
+ .min(1);
264
+ /**
265
+ * Type representing a set of criteria for the signEvmTypedData operation.
266
+ * Can contain up to 10 individual criterion objects for typed data field or verifying contract checks.
267
+ */
268
+ export type SignEvmTypedDataCriteria = z.infer<typeof SignEvmTypedDataCriteriaSchema>;
269
+
124
270
  /**
125
271
  * A list of comparables to apply against encoded arguments in the transaction's `data` field.
126
272
  */
@@ -288,6 +434,45 @@ export const SignSolTransactionCriteriaSchema = z
288
434
  */
289
435
  export type SignSolTransactionCriteria = z.infer<typeof SignSolTransactionCriteriaSchema>;
290
436
 
437
+ /**
438
+ * Schema for criteria used in PrepareUserOperation operations
439
+ */
440
+ export const PrepareUserOperationCriteriaSchema = z
441
+ .array(
442
+ z.discriminatedUnion("type", [
443
+ EthValueCriterionSchema,
444
+ EvmAddressCriterionSchema,
445
+ EvmNetworkCriterionSchema,
446
+ EvmDataCriterionSchema,
447
+ ]),
448
+ )
449
+ .max(10)
450
+ .min(1);
451
+ /**
452
+ * Type representing a set of criteria for the prepareUserOperation operation.
453
+ * Can contain up to 10 individual criterion objects of ETH value, EVM address, EVM network, or EVM data types.
454
+ */
455
+ export type PrepareUserOperationCriteria = z.infer<typeof PrepareUserOperationCriteriaSchema>;
456
+
457
+ /**
458
+ * Schema for criteria used in SendUserOperation operations
459
+ */
460
+ export const SendUserOperationCriteriaSchema = z
461
+ .array(
462
+ z.discriminatedUnion("type", [
463
+ EthValueCriterionSchema,
464
+ EvmAddressCriterionSchema,
465
+ EvmDataCriterionSchema,
466
+ ]),
467
+ )
468
+ .max(10)
469
+ .min(1);
470
+ /**
471
+ * Type representing a set of criteria for the sendUserOperation operation.
472
+ * Can contain up to 10 individual criterion objects of ETH value, EVM address, or EVM data types.
473
+ */
474
+ export type SendUserOperationCriteria = z.infer<typeof SendUserOperationCriteriaSchema>;
475
+
291
476
  /**
292
477
  * Enum for Solana Operation types
293
478
  */
@@ -382,6 +567,29 @@ export const SignEvmMessageRuleSchema = z.object({
382
567
  });
383
568
  export type SignEvmMessageRule = z.infer<typeof SignEvmMessageRuleSchema>;
384
569
 
570
+ /**
571
+ * Type representing a 'signEvmTypedData' policy rule that can accept or reject specific operations
572
+ * based on a set of criteria.
573
+ */
574
+ export const SignEvmTypedDataRuleSchema = z.object({
575
+ /**
576
+ * Determines whether matching the rule will cause a request to be rejected or accepted.
577
+ * "accept" will allow the signing, "reject" will block it.
578
+ */
579
+ action: ActionEnum,
580
+ /**
581
+ * The operation to which this rule applies.
582
+ * Must be "signEvmTypedData".
583
+ */
584
+ operation: z.literal("signEvmTypedData"),
585
+ /**
586
+ * The set of criteria that must be matched for this rule to apply.
587
+ * Must be compatible with the specified operation type.
588
+ */
589
+ criteria: SignEvmTypedDataCriteriaSchema,
590
+ });
591
+ export type SignEvmTypedDataRule = z.infer<typeof SignEvmTypedDataRuleSchema>;
592
+
385
593
  /**
386
594
  * Type representing a 'sendEvmTransaction' policy rule that can accept or reject specific operations
387
595
  * based on a set of criteria.
@@ -428,6 +636,52 @@ export const SignSolTransactionRuleSchema = z.object({
428
636
  });
429
637
  export type SignSolTransactionRule = z.infer<typeof SignSolTransactionRuleSchema>;
430
638
 
639
+ /**
640
+ * Type representing a 'prepareUserOperation' policy rule that can accept or reject specific operations
641
+ * based on a set of criteria.
642
+ */
643
+ export const PrepareUserOperationRuleSchema = z.object({
644
+ /**
645
+ * Determines whether matching the rule will cause a request to be rejected or accepted.
646
+ * "accept" will allow the operation, "reject" will block it.
647
+ */
648
+ action: ActionEnum,
649
+ /**
650
+ * The operation to which this rule applies.
651
+ * Must be "prepareUserOperation".
652
+ */
653
+ operation: z.literal("prepareUserOperation"),
654
+ /**
655
+ * The set of criteria that must be matched for this rule to apply.
656
+ * Must be compatible with the specified operation type.
657
+ */
658
+ criteria: PrepareUserOperationCriteriaSchema,
659
+ });
660
+ export type PrepareUserOperationRule = z.infer<typeof PrepareUserOperationRuleSchema>;
661
+
662
+ /**
663
+ * Type representing a 'sendUserOperation' policy rule that can accept or reject specific operations
664
+ * based on a set of criteria.
665
+ */
666
+ export const SendUserOperationRuleSchema = z.object({
667
+ /**
668
+ * Determines whether matching the rule will cause a request to be rejected or accepted.
669
+ * "accept" will allow the operation, "reject" will block it.
670
+ */
671
+ action: ActionEnum,
672
+ /**
673
+ * The operation to which this rule applies.
674
+ * Must be "sendUserOperation".
675
+ */
676
+ operation: z.literal("sendUserOperation"),
677
+ /**
678
+ * The set of criteria that must be matched for this rule to apply.
679
+ * Must be compatible with the specified operation type.
680
+ */
681
+ criteria: SendUserOperationCriteriaSchema,
682
+ });
683
+ export type SendUserOperationRule = z.infer<typeof SendUserOperationRuleSchema>;
684
+
431
685
  /**
432
686
  * Schema for policy rules
433
687
  */
@@ -435,8 +689,11 @@ export const RuleSchema = z.discriminatedUnion("operation", [
435
689
  SignEvmTransactionRuleSchema,
436
690
  SignEvmHashRuleSchema,
437
691
  SignEvmMessageRuleSchema,
692
+ SignEvmTypedDataRuleSchema,
438
693
  SendEvmTransactionRuleSchema,
439
694
  SignSolTransactionRuleSchema,
695
+ PrepareUserOperationRuleSchema,
696
+ SendUserOperationRuleSchema,
440
697
  ]);
441
698
 
442
699
  /**
package/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "1.22.0";
1
+ export const version = "1.24.0";