@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.
- package/CHANGELOG.md +22 -0
- package/README.md +2 -0
- package/_cjs/accounts/evm/toEvmSmartAccount.js +1 -0
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/actions/evm/getUserOperation.js +2 -1
- package/_cjs/actions/evm/getUserOperation.js.map +1 -1
- package/_cjs/client/evm/evm.js +23 -1
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +55 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +14 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +51 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/index.msw.js +5 -5
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +322 -1
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js +14 -10
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js +34 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
- package/_cjs/policies/schema.js +210 -1
- package/_cjs/policies/schema.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js +1 -0
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/actions/evm/getUserOperation.js +2 -1
- package/_esm/actions/evm/getUserOperation.js.map +1 -1
- package/_esm/client/evm/evm.js +23 -1
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +53 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +12 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +48 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_esm/openapi-client/generated/index.msw.js +5 -5
- package/_esm/openapi-client/generated/index.msw.js.map +1 -1
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +300 -0
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +12 -8
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +31 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
- package/_esm/policies/schema.js +209 -0
- package/_esm/policies/schema.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/evm/types.d.ts +2 -0
- package/_types/accounts/evm/types.d.ts.map +1 -1
- package/_types/actions/evm/getUserOperation.d.ts.map +1 -1
- package/_types/actions/evm/types.d.ts +2 -2
- package/_types/actions/evm/types.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts +15 -2
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +19 -5
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +222 -3
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +7 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +2 -0
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/index.msw.d.ts +5 -5
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +21 -1
- package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts +7 -6
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +2 -0
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/index.d.ts +4 -10
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/policies/schema.d.ts +7373 -1437
- package/_types/policies/schema.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmSmartAccount.ts +1 -0
- package/accounts/evm/types.ts +2 -0
- package/actions/evm/getUserOperation.ts +4 -1
- package/actions/evm/types.ts +2 -2
- package/client/evm/evm.ts +32 -1
- package/client/evm/evm.types.ts +21 -4
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +301 -3
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +86 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +23 -0
- package/openapi-client/generated/index.msw.ts +5 -5
- package/openapi-client/generated/policy-engine/policy-engine.msw.ts +465 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +51 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.ts +22 -20
- package/package.json +1 -1
- package/policies/schema.ts +257 -0
- package/version.ts +1 -1
package/package.json
CHANGED
package/policies/schema.ts
CHANGED
|
@@ -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.
|
|
1
|
+
export const version = "1.24.0";
|