@coinbase/cdp-sdk 1.31.1 → 1.32.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 +6 -0
- package/_cjs/client/policies/policies.js +72 -5
- package/_cjs/client/policies/policies.js.map +1 -1
- package/_cjs/index.js +3 -3
- package/_cjs/index.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +53 -2
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +215 -5
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
- package/_cjs/policies/{schema.js → evmSchema.js} +11 -112
- package/_cjs/policies/evmSchema.js.map +1 -0
- package/_cjs/policies/solanaSchema.js +183 -0
- package/_cjs/policies/solanaSchema.js.map +1 -0
- package/_cjs/policies/types.js +60 -0
- package/_cjs/policies/types.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/client/policies/policies.js +70 -3
- package/_esm/client/policies/policies.js.map +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +51 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +197 -3
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
- package/_esm/policies/{schema.js → evmSchema.js} +10 -111
- package/_esm/policies/evmSchema.js.map +1 -0
- package/_esm/policies/solanaSchema.js +180 -0
- package/_esm/policies/solanaSchema.js.map +1 -0
- package/_esm/policies/types.js +59 -1
- package/_esm/policies/types.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/client/policies/policies.d.ts +69 -2
- package/_types/client/policies/policies.d.ts.map +1 -1
- package/_types/client/policies/policies.types.d.ts +1 -2
- package/_types/client/policies/policies.types.d.ts.map +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +140 -2
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +17 -1
- package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -1
- package/_types/policies/evmSchema.d.ts +4367 -0
- package/_types/policies/evmSchema.d.ts.map +1 -0
- package/_types/policies/solanaSchema.d.ts +758 -0
- package/_types/policies/solanaSchema.d.ts.map +1 -0
- package/_types/policies/types.d.ts +6591 -1
- package/_types/policies/types.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/client/policies/policies.ts +70 -4
- package/client/policies/policies.types.ts +1 -2
- package/index.ts +1 -1
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +198 -1
- package/openapi-client/generated/policy-engine/policy-engine.msw.ts +285 -3
- package/package.json +1 -1
- package/policies/{schema.ts → evmSchema.ts} +9 -158
- package/policies/solanaSchema.ts +251 -0
- package/policies/types.ts +94 -1
- package/version.ts +1 -1
- package/_cjs/policies/schema.js.map +0 -1
- package/_esm/policies/schema.js.map +0 -1
- package/_types/policies/schema.d.ts +0 -11599
- package/_types/policies/schema.d.ts.map +0 -1
|
@@ -12,10 +12,6 @@ export const EvmAddressOperatorEnum = z.enum(["in", "not in"]);
|
|
|
12
12
|
* Enum for EvmNetworkOperator values
|
|
13
13
|
*/
|
|
14
14
|
export const EvmNetworkOperatorEnum = z.enum(["in", "not in"]);
|
|
15
|
-
/**
|
|
16
|
-
* Enum for SolAddressOperator values
|
|
17
|
-
*/
|
|
18
|
-
export const SolAddressOperatorEnum = z.enum(["in", "not in"]);
|
|
19
15
|
/**
|
|
20
16
|
* Schema for ETH value criterions
|
|
21
17
|
*/
|
|
@@ -279,24 +275,6 @@ export const EvmDataCriterionSchema = z.object({
|
|
|
279
275
|
*/
|
|
280
276
|
conditions: z.array(EvmDataConditionSchema).min(1),
|
|
281
277
|
});
|
|
282
|
-
/**
|
|
283
|
-
* Schema for Solana address criterions
|
|
284
|
-
*/
|
|
285
|
-
export const SolAddressCriterionSchema = z.object({
|
|
286
|
-
/** The type of criterion, must be "solAddress" for Solana address-based rules. */
|
|
287
|
-
type: z.literal("solAddress"),
|
|
288
|
-
/**
|
|
289
|
-
* Array of Solana addresses to compare against.
|
|
290
|
-
* Each address must be a valid Base58-encoded Solana address (32-44 characters).
|
|
291
|
-
*/
|
|
292
|
-
addresses: z.array(z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/)),
|
|
293
|
-
/**
|
|
294
|
-
* The operator to use for evaluating transaction addresses.
|
|
295
|
-
* "in" checks if an address is in the provided list.
|
|
296
|
-
* "not in" checks if an address is not in the provided list.
|
|
297
|
-
*/
|
|
298
|
-
operator: SolAddressOperatorEnum,
|
|
299
|
-
});
|
|
300
278
|
/**
|
|
301
279
|
* Schema for criteria used in SignEvmTransaction operations
|
|
302
280
|
*/
|
|
@@ -327,13 +305,6 @@ export const SendEvmTransactionCriteriaSchema = z
|
|
|
327
305
|
]))
|
|
328
306
|
.max(10)
|
|
329
307
|
.min(1);
|
|
330
|
-
/**
|
|
331
|
-
* Schema for criteria used in SignSolTransaction operations
|
|
332
|
-
*/
|
|
333
|
-
export const SignSolTransactionCriteriaSchema = z
|
|
334
|
-
.array(z.discriminatedUnion("type", [SolAddressCriterionSchema]))
|
|
335
|
-
.max(10)
|
|
336
|
-
.min(1);
|
|
337
308
|
/**
|
|
338
309
|
* Schema for criteria used in PrepareUserOperation operations
|
|
339
310
|
*/
|
|
@@ -357,14 +328,18 @@ export const SendUserOperationCriteriaSchema = z
|
|
|
357
328
|
]))
|
|
358
329
|
.max(10)
|
|
359
330
|
.min(1);
|
|
360
|
-
/**
|
|
361
|
-
* Enum for Solana Operation types
|
|
362
|
-
*/
|
|
363
|
-
export const SolOperationEnum = z.enum(["signSolTransaction"]);
|
|
364
331
|
/**
|
|
365
332
|
* Enum for Evm Operation types
|
|
366
333
|
*/
|
|
367
|
-
export const EvmOperationEnum = z.enum([
|
|
334
|
+
export const EvmOperationEnum = z.enum([
|
|
335
|
+
"signEvmTransaction",
|
|
336
|
+
"sendEvmTransaction",
|
|
337
|
+
"signEvmMessage",
|
|
338
|
+
"signEvmTypedData",
|
|
339
|
+
"signEvmHash",
|
|
340
|
+
"prepareUserOperation",
|
|
341
|
+
"sendUserOperation",
|
|
342
|
+
]);
|
|
368
343
|
/**
|
|
369
344
|
* Enum for Action types
|
|
370
345
|
*/
|
|
@@ -469,27 +444,6 @@ export const SendEvmTransactionRuleSchema = z.object({
|
|
|
469
444
|
*/
|
|
470
445
|
criteria: SendEvmTransactionCriteriaSchema,
|
|
471
446
|
});
|
|
472
|
-
/**
|
|
473
|
-
* Type representing a 'signSolTransaction' policy rule that can accept or reject specific operations
|
|
474
|
-
* based on a set of criteria.
|
|
475
|
-
*/
|
|
476
|
-
export const SignSolTransactionRuleSchema = z.object({
|
|
477
|
-
/**
|
|
478
|
-
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
479
|
-
* "accept" will allow the transaction, "reject" will block it.
|
|
480
|
-
*/
|
|
481
|
-
action: ActionEnum,
|
|
482
|
-
/**
|
|
483
|
-
* The operation to which this rule applies.
|
|
484
|
-
* Must be "signSolTransaction".
|
|
485
|
-
*/
|
|
486
|
-
operation: z.literal("signSolTransaction"),
|
|
487
|
-
/**
|
|
488
|
-
* The set of criteria that must be matched for this rule to apply.
|
|
489
|
-
* Must be compatible with the specified operation type.
|
|
490
|
-
*/
|
|
491
|
-
criteria: SignSolTransactionCriteriaSchema,
|
|
492
|
-
});
|
|
493
447
|
/**
|
|
494
448
|
* Type representing a 'prepareUserOperation' policy rule that can accept or reject specific operations
|
|
495
449
|
* based on a set of criteria.
|
|
@@ -532,59 +486,4 @@ export const SendUserOperationRuleSchema = z.object({
|
|
|
532
486
|
*/
|
|
533
487
|
criteria: SendUserOperationCriteriaSchema,
|
|
534
488
|
});
|
|
535
|
-
|
|
536
|
-
* Schema for policy rules
|
|
537
|
-
*/
|
|
538
|
-
export const RuleSchema = z.discriminatedUnion("operation", [
|
|
539
|
-
SignEvmTransactionRuleSchema,
|
|
540
|
-
SignEvmHashRuleSchema,
|
|
541
|
-
SignEvmMessageRuleSchema,
|
|
542
|
-
SignEvmTypedDataRuleSchema,
|
|
543
|
-
SendEvmTransactionRuleSchema,
|
|
544
|
-
SignSolTransactionRuleSchema,
|
|
545
|
-
PrepareUserOperationRuleSchema,
|
|
546
|
-
SendUserOperationRuleSchema,
|
|
547
|
-
]);
|
|
548
|
-
/**
|
|
549
|
-
* Enum for policy scopes
|
|
550
|
-
*/
|
|
551
|
-
export const PolicyScopeEnum = z.enum(["project", "account"]);
|
|
552
|
-
/**
|
|
553
|
-
* Schema for creating or updating a Policy.
|
|
554
|
-
*/
|
|
555
|
-
export const CreatePolicyBodySchema = z.object({
|
|
556
|
-
/**
|
|
557
|
-
* The scope of the policy.
|
|
558
|
-
* "project" applies to the entire project, "account" applies to specific accounts.
|
|
559
|
-
*/
|
|
560
|
-
scope: PolicyScopeEnum,
|
|
561
|
-
/**
|
|
562
|
-
* An optional human-readable description for the policy.
|
|
563
|
-
* Limited to 50 characters of alphanumeric characters, spaces, commas, and periods.
|
|
564
|
-
*/
|
|
565
|
-
description: z
|
|
566
|
-
.string()
|
|
567
|
-
.regex(/^[A-Za-z0-9 ,.]{1,50}$/)
|
|
568
|
-
.optional(),
|
|
569
|
-
/**
|
|
570
|
-
* Array of rules that comprise the policy.
|
|
571
|
-
* Limited to a maximum of 10 rules per policy.
|
|
572
|
-
*/
|
|
573
|
-
rules: z.array(RuleSchema).max(10).min(1),
|
|
574
|
-
});
|
|
575
|
-
export const UpdatePolicyBodySchema = z.object({
|
|
576
|
-
/**
|
|
577
|
-
* An optional human-readable description for the policy.
|
|
578
|
-
* Limited to 50 characters of alphanumeric characters, spaces, commas, and periods.
|
|
579
|
-
*/
|
|
580
|
-
description: z
|
|
581
|
-
.string()
|
|
582
|
-
.regex(/^[A-Za-z0-9 ,.]{1,50}$/)
|
|
583
|
-
.optional(),
|
|
584
|
-
/**
|
|
585
|
-
* Array of rules that comprise the policy.
|
|
586
|
-
* Limited to a maximum of 10 rules per policy.
|
|
587
|
-
*/
|
|
588
|
-
rules: z.array(RuleSchema).max(10).min(1),
|
|
589
|
-
});
|
|
590
|
-
//# sourceMappingURL=schema.js.map
|
|
489
|
+
//# sourceMappingURL=evmSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evmSchema.js","sourceRoot":"","sources":["../../policies/evmSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAOzE;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAO/D;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAO/D;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,gFAAgF;IAChF,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAC3B;;;OAGG;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC;IACtC,8FAA8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AAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD;;;OAGG;IACH,MAAM,EAAE,UAAU;IAClB;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC5C;;;OAGG;IACH,QAAQ,EAAE,kCAAkC;CAC7C,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD;;;OAGG;IACH,MAAM,EAAE,UAAU;IAClB;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC;IACzC;;;OAGG;IACH,QAAQ,EAAE,+BAA+B;CAC1C,CAAC,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Enum for Action types
|
|
4
|
+
*/
|
|
5
|
+
export const ActionEnum = z.enum(["reject", "accept"]);
|
|
6
|
+
/**
|
|
7
|
+
* Enum for SolAddressOperator values
|
|
8
|
+
*/
|
|
9
|
+
export const SolAddressOperatorEnum = z.enum(["in", "not in"]);
|
|
10
|
+
/**
|
|
11
|
+
* Enum for SolValueOperator values
|
|
12
|
+
*/
|
|
13
|
+
export const SolValueOperatorEnum = z.enum([">", ">=", "<", "<=", "=="]);
|
|
14
|
+
/**
|
|
15
|
+
* Enum for SplAddressOperator values
|
|
16
|
+
*/
|
|
17
|
+
export const SplAddressOperatorEnum = z.enum(["in", "not in"]);
|
|
18
|
+
/**
|
|
19
|
+
* Enum for SplValueOperator values
|
|
20
|
+
*/
|
|
21
|
+
export const SplValueOperatorEnum = z.enum([">", ">=", "<", "<=", "=="]);
|
|
22
|
+
/**
|
|
23
|
+
* Enum for MintAddressOperator values
|
|
24
|
+
*/
|
|
25
|
+
export const MintAddressOperatorEnum = z.enum(["in", "not in"]);
|
|
26
|
+
/**
|
|
27
|
+
* Schema for Solana address criterions
|
|
28
|
+
*/
|
|
29
|
+
export const SolAddressCriterionSchema = z.object({
|
|
30
|
+
/** The type of criterion, must be "solAddress" for Solana address-based rules. */
|
|
31
|
+
type: z.literal("solAddress"),
|
|
32
|
+
/**
|
|
33
|
+
* Array of Solana addresses to compare against.
|
|
34
|
+
* Each address must be a valid Base58-encoded Solana address (32-44 characters).
|
|
35
|
+
*/
|
|
36
|
+
addresses: z.array(z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/)),
|
|
37
|
+
/**
|
|
38
|
+
* The operator to use for evaluating transaction addresses.
|
|
39
|
+
* "in" checks if an address is in the provided list.
|
|
40
|
+
* "not in" checks if an address is not in the provided list.
|
|
41
|
+
*/
|
|
42
|
+
operator: SolAddressOperatorEnum,
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Schema for SOL value criterions
|
|
46
|
+
*/
|
|
47
|
+
export const SolValueCriterionSchema = z.object({
|
|
48
|
+
/** The type of criterion, must be "solValue" for SOL value-based rules. */
|
|
49
|
+
type: z.literal("solValue"),
|
|
50
|
+
/**
|
|
51
|
+
* The SOL value amount in lamports to compare against, as a string.
|
|
52
|
+
* Must contain only digits.
|
|
53
|
+
*/
|
|
54
|
+
solValue: z.string().regex(/^[0-9]+$/),
|
|
55
|
+
/** The comparison operator to use for evaluating transaction SOL values against the threshold. */
|
|
56
|
+
operator: SolValueOperatorEnum,
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Schema for SPL address criterions
|
|
60
|
+
*/
|
|
61
|
+
export const SplAddressCriterionSchema = z.object({
|
|
62
|
+
/** The type of criterion, must be "splAddress" for SPL address-based rules. */
|
|
63
|
+
type: z.literal("splAddress"),
|
|
64
|
+
/**
|
|
65
|
+
* Array of Solana addresses to compare against for SPL token transfer recipients.
|
|
66
|
+
* Each address must be a valid Base58-encoded Solana address (32-44 characters).
|
|
67
|
+
*/
|
|
68
|
+
addresses: z.array(z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/)),
|
|
69
|
+
/**
|
|
70
|
+
* The operator to use for evaluating SPL token transfer recipient addresses.
|
|
71
|
+
* "in" checks if an address is in the provided list.
|
|
72
|
+
* "not in" checks if an address is not in the provided list.
|
|
73
|
+
*/
|
|
74
|
+
operator: SplAddressOperatorEnum,
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* Schema for SPL value criterions
|
|
78
|
+
*/
|
|
79
|
+
export const SplValueCriterionSchema = z.object({
|
|
80
|
+
/** The type of criterion, must be "splValue" for SPL token value-based rules. */
|
|
81
|
+
type: z.literal("splValue"),
|
|
82
|
+
/**
|
|
83
|
+
* The SPL token value amount to compare against, as a string.
|
|
84
|
+
* Must contain only digits.
|
|
85
|
+
*/
|
|
86
|
+
splValue: z.string().regex(/^[0-9]+$/),
|
|
87
|
+
/** The comparison operator to use for evaluating SPL token values against the threshold. */
|
|
88
|
+
operator: SplValueOperatorEnum,
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* Schema for mint address criterions
|
|
92
|
+
*/
|
|
93
|
+
export const MintAddressCriterionSchema = z.object({
|
|
94
|
+
/** The type of criterion, must be "mintAddress" for token mint address-based rules. */
|
|
95
|
+
type: z.literal("mintAddress"),
|
|
96
|
+
/**
|
|
97
|
+
* Array of Solana addresses to compare against for token mint addresses.
|
|
98
|
+
* Each address must be a valid Base58-encoded Solana address (32-44 characters).
|
|
99
|
+
*/
|
|
100
|
+
addresses: z.array(z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/)),
|
|
101
|
+
/**
|
|
102
|
+
* The operator to use for evaluating token mint addresses.
|
|
103
|
+
* "in" checks if an address is in the provided list.
|
|
104
|
+
* "not in" checks if an address is not in the provided list.
|
|
105
|
+
*/
|
|
106
|
+
operator: MintAddressOperatorEnum,
|
|
107
|
+
});
|
|
108
|
+
/**
|
|
109
|
+
* Schema for criteria used in SignSolTransaction operations
|
|
110
|
+
*/
|
|
111
|
+
export const SignSolTransactionCriteriaSchema = z
|
|
112
|
+
.array(z.discriminatedUnion("type", [
|
|
113
|
+
SolAddressCriterionSchema,
|
|
114
|
+
SolValueCriterionSchema,
|
|
115
|
+
SplAddressCriterionSchema,
|
|
116
|
+
SplValueCriterionSchema,
|
|
117
|
+
MintAddressCriterionSchema,
|
|
118
|
+
]))
|
|
119
|
+
.max(10)
|
|
120
|
+
.min(1);
|
|
121
|
+
/**
|
|
122
|
+
* Schema for criteria used in SendSolTransaction operations
|
|
123
|
+
*/
|
|
124
|
+
export const SendSolTransactionCriteriaSchema = z
|
|
125
|
+
.array(z.discriminatedUnion("type", [
|
|
126
|
+
SolAddressCriterionSchema,
|
|
127
|
+
SolValueCriterionSchema,
|
|
128
|
+
SplAddressCriterionSchema,
|
|
129
|
+
SplValueCriterionSchema,
|
|
130
|
+
MintAddressCriterionSchema,
|
|
131
|
+
]))
|
|
132
|
+
.max(10)
|
|
133
|
+
.min(1);
|
|
134
|
+
/**
|
|
135
|
+
* Enum for Solana Operation types
|
|
136
|
+
*/
|
|
137
|
+
export const SolOperationEnum = z.enum(["signSolTransaction", "sendSolTransaction"]);
|
|
138
|
+
/**
|
|
139
|
+
* Type representing a 'signSolTransaction' policy rule that can accept or reject specific operations
|
|
140
|
+
* based on a set of criteria.
|
|
141
|
+
*/
|
|
142
|
+
export const SignSolTransactionRuleSchema = z.object({
|
|
143
|
+
/**
|
|
144
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
145
|
+
* "accept" will allow the transaction, "reject" will block it.
|
|
146
|
+
*/
|
|
147
|
+
action: ActionEnum,
|
|
148
|
+
/**
|
|
149
|
+
* The operation to which this rule applies.
|
|
150
|
+
* Must be "signSolTransaction".
|
|
151
|
+
*/
|
|
152
|
+
operation: z.literal("signSolTransaction"),
|
|
153
|
+
/**
|
|
154
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
155
|
+
* Must be compatible with the specified operation type.
|
|
156
|
+
*/
|
|
157
|
+
criteria: SignSolTransactionCriteriaSchema,
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* Type representing a 'sendSolTransaction' policy rule that can accept or reject specific operations
|
|
161
|
+
* based on a set of criteria.
|
|
162
|
+
*/
|
|
163
|
+
export const SendSolTransactionRuleSchema = z.object({
|
|
164
|
+
/**
|
|
165
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
166
|
+
* "accept" will allow the transaction, "reject" will block it.
|
|
167
|
+
*/
|
|
168
|
+
action: ActionEnum,
|
|
169
|
+
/**
|
|
170
|
+
* The operation to which this rule applies.
|
|
171
|
+
* Must be "sendSolTransaction".
|
|
172
|
+
*/
|
|
173
|
+
operation: z.literal("sendSolTransaction"),
|
|
174
|
+
/**
|
|
175
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
176
|
+
* Must be compatible with the specified operation type.
|
|
177
|
+
*/
|
|
178
|
+
criteria: SendSolTransactionCriteriaSchema,
|
|
179
|
+
});
|
|
180
|
+
//# sourceMappingURL=solanaSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solanaSchema.js","sourceRoot":"","sources":["../../policies/solanaSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAOvD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAO/D;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAOzE;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EA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AAI,CAAC,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC,CAAC;AAOrF;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD;;;OAGG;IACH,MAAM,EAAE,UAAU;IAClB;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAC1C;;;OAGG;IACH,QAAQ,EAAE,gCAAgC;CAC3C,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD;;;OAGG;IACH,MAAM,EAAE,UAAU;IAClB;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAC1C;;;OAGG;IACH,QAAQ,EAAE,gCAAgC;CAC3C,CAAC,CAAC"}
|
package/_esm/policies/types.js
CHANGED
|
@@ -1,2 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PrepareUserOperationRuleSchema, SendEvmTransactionRuleSchema, SignEvmHashRuleSchema, SignEvmMessageRuleSchema, SignEvmTransactionRuleSchema, SignEvmTypedDataRuleSchema, SendUserOperationRuleSchema, } from "./evmSchema.js";
|
|
3
|
+
import { SendSolTransactionRuleSchema, SignSolTransactionRuleSchema } from "./solanaSchema.js";
|
|
4
|
+
/**
|
|
5
|
+
* Enum for policy scopes
|
|
6
|
+
*/
|
|
7
|
+
export const PolicyScopeEnum = z.enum(["project", "account"]);
|
|
8
|
+
/**
|
|
9
|
+
* Schema for policy rules
|
|
10
|
+
*/
|
|
11
|
+
export const RuleSchema = z.discriminatedUnion("operation", [
|
|
12
|
+
SignEvmTransactionRuleSchema,
|
|
13
|
+
SignEvmHashRuleSchema,
|
|
14
|
+
SignEvmMessageRuleSchema,
|
|
15
|
+
SignEvmTypedDataRuleSchema,
|
|
16
|
+
SendEvmTransactionRuleSchema,
|
|
17
|
+
SignSolTransactionRuleSchema,
|
|
18
|
+
SendSolTransactionRuleSchema,
|
|
19
|
+
PrepareUserOperationRuleSchema,
|
|
20
|
+
SendUserOperationRuleSchema,
|
|
21
|
+
]);
|
|
22
|
+
/**
|
|
23
|
+
* Schema for creating or updating a Policy.
|
|
24
|
+
*/
|
|
25
|
+
export const CreatePolicyBodySchema = z.object({
|
|
26
|
+
/**
|
|
27
|
+
* The scope of the policy.
|
|
28
|
+
* "project" applies to the entire project, "account" applies to specific accounts.
|
|
29
|
+
*/
|
|
30
|
+
scope: PolicyScopeEnum,
|
|
31
|
+
/**
|
|
32
|
+
* An optional human-readable description for the policy.
|
|
33
|
+
* Limited to 50 characters of alphanumeric characters, spaces, commas, and periods.
|
|
34
|
+
*/
|
|
35
|
+
description: z
|
|
36
|
+
.string()
|
|
37
|
+
.regex(/^[A-Za-z0-9 ,.]{1,50}$/)
|
|
38
|
+
.optional(),
|
|
39
|
+
/**
|
|
40
|
+
* Array of rules that comprise the policy.
|
|
41
|
+
* Limited to a maximum of 10 rules per policy.
|
|
42
|
+
*/
|
|
43
|
+
rules: z.array(RuleSchema).max(10).min(1),
|
|
44
|
+
});
|
|
45
|
+
export const UpdatePolicyBodySchema = z.object({
|
|
46
|
+
/**
|
|
47
|
+
* An optional human-readable description for the policy.
|
|
48
|
+
* Limited to 50 characters of alphanumeric characters, spaces, commas, and periods.
|
|
49
|
+
*/
|
|
50
|
+
description: z
|
|
51
|
+
.string()
|
|
52
|
+
.regex(/^[A-Za-z0-9 ,.]{1,50}$/)
|
|
53
|
+
.optional(),
|
|
54
|
+
/**
|
|
55
|
+
* Array of rules that comprise the policy.
|
|
56
|
+
* Limited to a maximum of 10 rules per policy.
|
|
57
|
+
*/
|
|
58
|
+
rules: z.array(RuleSchema).max(10).min(1),
|
|
59
|
+
});
|
|
2
60
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../policies/types.ts"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AAQ,EAAE;IACb;;;OAGG;IACH,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1C,CAAC,CAAC"}
|
package/_esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.32.0";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -54,7 +54,7 @@ export declare class PoliciesClient implements PoliciesClientInterface {
|
|
|
54
54
|
* @returns {Promise<Policy>} The created policy
|
|
55
55
|
* @throws {ZodError<typeof CreatePolicyBodySchema>} When the policy is invalid
|
|
56
56
|
*
|
|
57
|
-
* @example **Creating a new policy**
|
|
57
|
+
* @example **Creating a new EVM policy**
|
|
58
58
|
* ```ts
|
|
59
59
|
* const policy = await cdp.policies.createPolicy({
|
|
60
60
|
* policy: {
|
|
@@ -77,6 +77,45 @@ export declare class PoliciesClient implements PoliciesClientInterface {
|
|
|
77
77
|
* });
|
|
78
78
|
* ```
|
|
79
79
|
*
|
|
80
|
+
* @example **Creating a new Solana policy**
|
|
81
|
+
* ```ts
|
|
82
|
+
* const policy = await cdp.policies.createPolicy({
|
|
83
|
+
* policy: {
|
|
84
|
+
* scope: "account",
|
|
85
|
+
* description: "Limits SOL transfers and SPL token operations",
|
|
86
|
+
* rules: [
|
|
87
|
+
* {
|
|
88
|
+
* action: "reject",
|
|
89
|
+
* operation: "signSolTransaction",
|
|
90
|
+
* criteria: [
|
|
91
|
+
* {
|
|
92
|
+
* type: "solValue",
|
|
93
|
+
* solValue: "1000000000", // 1 SOL in lamports
|
|
94
|
+
* operator: ">",
|
|
95
|
+
* },
|
|
96
|
+
* {
|
|
97
|
+
* type: "solAddress",
|
|
98
|
+
* addresses: ["9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"],
|
|
99
|
+
* operator: "in",
|
|
100
|
+
* },
|
|
101
|
+
* ],
|
|
102
|
+
* },
|
|
103
|
+
* {
|
|
104
|
+
* action: "accept",
|
|
105
|
+
* operation: "sendSolTransaction",
|
|
106
|
+
* criteria: [
|
|
107
|
+
* {
|
|
108
|
+
* type: "mintAddress",
|
|
109
|
+
* addresses: ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"], // USDC mint
|
|
110
|
+
* operator: "in",
|
|
111
|
+
* },
|
|
112
|
+
* ],
|
|
113
|
+
* },
|
|
114
|
+
* ],
|
|
115
|
+
* }
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
80
119
|
* @example **With idempotency key**
|
|
81
120
|
* ```ts
|
|
82
121
|
* const idempotencyKey = uuidv4();
|
|
@@ -173,7 +212,7 @@ export declare class PoliciesClient implements PoliciesClientInterface {
|
|
|
173
212
|
* @returns {Promise<Policy>} The updated policy
|
|
174
213
|
* @throws {ZodError<typeof UpdatePolicyBodySchema>} When the updated policy is invalid
|
|
175
214
|
*
|
|
176
|
-
* @example **Updating
|
|
215
|
+
* @example **Updating an EVM policy**
|
|
177
216
|
* ```ts
|
|
178
217
|
* const updatedPolicy = await cdp.policies.updatePolicy({
|
|
179
218
|
* id: "__ID__",
|
|
@@ -196,6 +235,34 @@ export declare class PoliciesClient implements PoliciesClientInterface {
|
|
|
196
235
|
* });
|
|
197
236
|
* ```
|
|
198
237
|
*
|
|
238
|
+
* @example **Updating a Solana policy**
|
|
239
|
+
* ```ts
|
|
240
|
+
* const updatedPolicy = await cdp.policies.updatePolicy({
|
|
241
|
+
* id: "__ID__",
|
|
242
|
+
* policy: {
|
|
243
|
+
* description: "Updated Solana transaction limits",
|
|
244
|
+
* rules: [
|
|
245
|
+
* {
|
|
246
|
+
* action: "reject",
|
|
247
|
+
* operation: "signSolTransaction",
|
|
248
|
+
* criteria: [
|
|
249
|
+
* {
|
|
250
|
+
* type: "splValue",
|
|
251
|
+
* splValue: "1000000", // SPL token amount
|
|
252
|
+
* operator: ">=",
|
|
253
|
+
* },
|
|
254
|
+
* {
|
|
255
|
+
* type: "mintAddress",
|
|
256
|
+
* addresses: ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"], // USDC mint
|
|
257
|
+
* operator: "in",
|
|
258
|
+
* },
|
|
259
|
+
* ],
|
|
260
|
+
* },
|
|
261
|
+
* ],
|
|
262
|
+
* },
|
|
263
|
+
* });
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
199
266
|
* @example **With idempotency key**
|
|
200
267
|
* ```ts
|
|
201
268
|
* const idempotencyKey = uuidv4();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../client/policies/policies.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../client/policies/policies.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAAE,MAAM,EAAkD,MAAM,yBAAyB,CAAC;AAEjG;;GAEG;AACH,qBAAa,cAAe,YAAW,uBAAuB;IAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACG,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAWlF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0GG;IACG,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBjE;;;;;;;;;;;;;;;;;OAiBG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC;IAQnE;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+EG;IACG,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAalE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OpenApiPoliciesMethods } from "../../openapi-client/index.js";
|
|
2
|
-
import { CreatePolicyBody, PolicyScope, UpdatePolicyBody } from "../../policies/
|
|
3
|
-
import { Policy } from "../../policies/types.js";
|
|
2
|
+
import { CreatePolicyBody, Policy, PolicyScope, UpdatePolicyBody } from "../../policies/types.js";
|
|
4
3
|
/**
|
|
5
4
|
* The PoliciesClient type, where all OpenApiPoliciesMethods methods are wrapped.
|
|
6
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.types.d.ts","sourceRoot":"","sources":["../../../client/policies/policies.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"policies.types.d.ts","sourceRoot":"","sources":["../../../client/policies/policies.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAElG;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,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C;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,MAAM,EAAE,gBAAgB,CAAC;IACzB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
package/_types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CdpClient } from "./client/cdp.js";
|
|
2
2
|
export type { EvmServerAccount, EvmSmartAccount } from "./accounts/evm/types.js";
|
|
3
3
|
export type { Policy } from "./policies/types.js";
|
|
4
|
-
export { CreatePolicyBodySchema, UpdatePolicyBodySchema, type CreatePolicyBody, type UpdatePolicyBody, } from "./policies/
|
|
4
|
+
export { CreatePolicyBodySchema, UpdatePolicyBodySchema, type CreatePolicyBody, type UpdatePolicyBody, } from "./policies/types.js";
|
|
5
5
|
export { NetworkError } from "./openapi-client/errors.js";
|
|
6
6
|
export type { SpendPermission } from "./spend-permissions/types.js";
|
|
7
7
|
export { SPEND_PERMISSION_MANAGER_ABI as spendPermissionManagerAbi, SPEND_PERMISSION_MANAGER_ADDRESS as spendPermissionManagerAddress, } from "./spend-permissions/constants.js";
|
package/_types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACjF,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACjF,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,4BAA4B,IAAI,yBAAyB,EACzD,gCAAgC,IAAI,6BAA6B,GAClE,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC"}
|