@coinbase/cdp-sdk 1.34.1 → 1.35.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 (48) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +17 -15
  3. package/_cjs/accounts/evm/networkCapabilities.js +4 -4
  4. package/_cjs/accounts/evm/networkCapabilities.js.map +1 -1
  5. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js +12 -2
  6. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  7. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +8 -2
  8. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  9. package/_cjs/actions/evm/listTokenBalances.js +1 -1
  10. package/_cjs/actions/evm/listTokenBalances.js.map +1 -1
  11. package/_cjs/openapi-client/index.js +2 -0
  12. package/_cjs/openapi-client/index.js.map +1 -1
  13. package/_cjs/policies/evmSchema.js +52 -9
  14. package/_cjs/policies/evmSchema.js.map +1 -1
  15. package/_cjs/version.js +1 -1
  16. package/_esm/accounts/evm/networkCapabilities.js +4 -4
  17. package/_esm/accounts/evm/networkCapabilities.js.map +1 -1
  18. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js +12 -2
  19. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  20. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +8 -2
  21. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  22. package/_esm/actions/evm/listTokenBalances.js +1 -1
  23. package/_esm/actions/evm/listTokenBalances.js.map +1 -1
  24. package/_esm/openapi-client/index.js +2 -0
  25. package/_esm/openapi-client/index.js.map +1 -1
  26. package/_esm/policies/evmSchema.js +51 -8
  27. package/_esm/policies/evmSchema.js.map +1 -1
  28. package/_esm/version.js +1 -1
  29. package/_types/accounts/evm/networkCapabilities.d.ts +4 -4
  30. package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts.map +1 -1
  31. package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts.map +1 -1
  32. package/_types/accounts/evm/types.d.ts +3 -3
  33. package/_types/accounts/evm/types.d.ts.map +1 -1
  34. package/_types/openapi-client/index.d.ts +3 -0
  35. package/_types/openapi-client/index.d.ts.map +1 -1
  36. package/_types/policies/evmSchema.d.ts +180 -101
  37. package/_types/policies/evmSchema.d.ts.map +1 -1
  38. package/_types/policies/types.d.ts +38 -38
  39. package/_types/version.d.ts +1 -1
  40. package/accounts/evm/networkCapabilities.ts +4 -4
  41. package/accounts/evm/toNetworkScopedEvmServerAccount.ts +18 -5
  42. package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +15 -4
  43. package/accounts/evm/types.ts +9 -5
  44. package/actions/evm/listTokenBalances.ts +1 -1
  45. package/openapi-client/index.ts +2 -0
  46. package/package.json +1 -1
  47. package/policies/evmSchema.ts +66 -9
  48. package/version.ts +1 -1
@@ -69,25 +69,71 @@ export const EvmAddressCriterionSchema = z.object({
69
69
  export type EvmAddressCriterion = z.infer<typeof EvmAddressCriterionSchema>;
70
70
 
71
71
  /**
72
- * Enum for EVM Network values
72
+ * Enum for PrepareUserOperation EVM Network values
73
+ */
74
+ export const PrepareUserOperationEvmNetworkEnum = z.enum([
75
+ "base-sepolia",
76
+ "base",
77
+ "arbitrum",
78
+ "optimism",
79
+ "zora",
80
+ "polygon",
81
+ "bnb",
82
+ "avalanche",
83
+ "ethereum",
84
+ "ethereum-sepolia",
85
+ ]);
86
+
87
+ export type PrepareUserOperationEvmNetwork = z.infer<typeof PrepareUserOperationEvmNetworkEnum>;
88
+
89
+ /**
90
+ * Enum for SendEvmTransaction EVM Network values
73
91
  */
74
- export const EvmNetworkEnum = z.enum(["base", "base-sepolia"]);
92
+ export const SendEvmTransactionEvmNetworkEnum = z.enum([
93
+ "base",
94
+ "base-sepolia",
95
+ "ethereum",
96
+ "ethereum-sepolia",
97
+ "avalanche",
98
+ "polygon",
99
+ "optimism",
100
+ "arbitrum",
101
+ ]);
102
+
75
103
  /**
76
104
  * Type representing the valid networks used with CDP transaction API's.
77
105
  */
78
- export type EvmNetwork = z.infer<typeof EvmNetworkEnum>;
106
+ export type EvmNetwork = z.ZodUnion<
107
+ [typeof SendEvmTransactionEvmNetworkEnum, typeof PrepareUserOperationEvmNetworkEnum]
108
+ >;
79
109
 
80
110
  /**
81
111
  * Schema for EVM network criterions
82
112
  */
83
- export const EvmNetworkCriterionSchema = z.object({
113
+ export const SendEvmTransactionEvmNetworkCriterionSchema = z.object({
114
+ /** The type of criterion, must be "evmAddress" for EVM address-based rules. */
115
+ type: z.literal("evmNetwork"),
116
+ /**
117
+ * Array of EVM network identifiers to compare against.
118
+ * Either "base", "base-sepolia", "ethereum", "ethereum-sepolia", "avalanche", "polygon", "optimism", "arbitrum"
119
+ */
120
+ networks: z.array(SendEvmTransactionEvmNetworkEnum),
121
+ /**
122
+ * The operator to use for evaluating transaction network.
123
+ * "in" checks if a network is in the provided list.
124
+ * "not in" checks if a network is not in the provided list.
125
+ */
126
+ operator: EvmNetworkOperatorEnum,
127
+ });
128
+
129
+ export const PrepareUserOperationEvmNetworkCriterionSchema = z.object({
84
130
  /** The type of criterion, must be "evmAddress" for EVM address-based rules. */
85
131
  type: z.literal("evmNetwork"),
86
132
  /**
87
133
  * Array of EVM network identifiers to compare against.
88
- * Either "base" or "base-sepolia"
134
+ * Either "base-sepolia", "base", "arbitrum", "optimism", "zora", "polygon", "bnb", "avalanche", "ethereum", "ethereum-sepolia"
89
135
  */
90
- networks: z.array(EvmNetworkEnum),
136
+ networks: z.array(PrepareUserOperationEvmNetworkEnum),
91
137
  /**
92
138
  * The operator to use for evaluating transaction network.
93
139
  * "in" checks if a network is in the provided list.
@@ -95,7 +141,18 @@ export const EvmNetworkCriterionSchema = z.object({
95
141
  */
96
142
  operator: EvmNetworkOperatorEnum,
97
143
  });
98
- export type EvmNetworkCriterion = z.infer<typeof EvmNetworkCriterionSchema>;
144
+
145
+ export const EvmNetworkCriterionSchema = z.union([
146
+ SendEvmTransactionEvmNetworkCriterionSchema,
147
+ PrepareUserOperationEvmNetworkCriterionSchema,
148
+ ]);
149
+
150
+ export type EvmNetworkCriterion = z.ZodUnion<
151
+ [
152
+ typeof SendEvmTransactionEvmNetworkCriterionSchema,
153
+ typeof PrepareUserOperationEvmNetworkCriterionSchema,
154
+ ]
155
+ >;
99
156
 
100
157
  /**
101
158
  * Schema for EVM message criterions
@@ -399,7 +456,7 @@ export const SendEvmTransactionCriteriaSchema = z
399
456
  z.discriminatedUnion("type", [
400
457
  EthValueCriterionSchema,
401
458
  EvmAddressCriterionSchema,
402
- EvmNetworkCriterionSchema,
459
+ SendEvmTransactionEvmNetworkCriterionSchema,
403
460
  EvmDataCriterionSchema,
404
461
  NetUSDChangeCriterionSchema,
405
462
  ]),
@@ -418,7 +475,7 @@ export const PrepareUserOperationCriteriaSchema = z
418
475
  z.discriminatedUnion("type", [
419
476
  EthValueCriterionSchema,
420
477
  EvmAddressCriterionSchema,
421
- EvmNetworkCriterionSchema,
478
+ PrepareUserOperationEvmNetworkCriterionSchema,
422
479
  EvmDataCriterionSchema,
423
480
  ]),
424
481
  )
package/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "1.34.1";
1
+ export const version = "1.35.0";