@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.
Files changed (62) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/_cjs/client/policies/policies.js +72 -5
  3. package/_cjs/client/policies/policies.js.map +1 -1
  4. package/_cjs/index.js +3 -3
  5. package/_cjs/index.js.map +1 -1
  6. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +53 -2
  7. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  8. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +215 -5
  9. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  10. package/_cjs/policies/{schema.js → evmSchema.js} +11 -112
  11. package/_cjs/policies/evmSchema.js.map +1 -0
  12. package/_cjs/policies/solanaSchema.js +183 -0
  13. package/_cjs/policies/solanaSchema.js.map +1 -0
  14. package/_cjs/policies/types.js +60 -0
  15. package/_cjs/policies/types.js.map +1 -1
  16. package/_cjs/version.js +1 -1
  17. package/_esm/client/policies/policies.js +70 -3
  18. package/_esm/client/policies/policies.js.map +1 -1
  19. package/_esm/index.js +1 -1
  20. package/_esm/index.js.map +1 -1
  21. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +51 -0
  22. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  23. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +197 -3
  24. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  25. package/_esm/policies/{schema.js → evmSchema.js} +10 -111
  26. package/_esm/policies/evmSchema.js.map +1 -0
  27. package/_esm/policies/solanaSchema.js +180 -0
  28. package/_esm/policies/solanaSchema.js.map +1 -0
  29. package/_esm/policies/types.js +59 -1
  30. package/_esm/policies/types.js.map +1 -1
  31. package/_esm/version.js +1 -1
  32. package/_types/client/policies/policies.d.ts +69 -2
  33. package/_types/client/policies/policies.d.ts.map +1 -1
  34. package/_types/client/policies/policies.types.d.ts +1 -2
  35. package/_types/client/policies/policies.types.d.ts.map +1 -1
  36. package/_types/index.d.ts +1 -1
  37. package/_types/index.d.ts.map +1 -1
  38. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +140 -2
  39. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  40. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +17 -1
  41. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -1
  42. package/_types/policies/evmSchema.d.ts +4367 -0
  43. package/_types/policies/evmSchema.d.ts.map +1 -0
  44. package/_types/policies/solanaSchema.d.ts +758 -0
  45. package/_types/policies/solanaSchema.d.ts.map +1 -0
  46. package/_types/policies/types.d.ts +6591 -1
  47. package/_types/policies/types.d.ts.map +1 -1
  48. package/_types/version.d.ts +1 -1
  49. package/client/policies/policies.ts +70 -4
  50. package/client/policies/policies.types.ts +1 -2
  51. package/index.ts +1 -1
  52. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +198 -1
  53. package/openapi-client/generated/policy-engine/policy-engine.msw.ts +285 -3
  54. package/package.json +1 -1
  55. package/policies/{schema.ts → evmSchema.ts} +9 -158
  56. package/policies/solanaSchema.ts +251 -0
  57. package/policies/types.ts +94 -1
  58. package/version.ts +1 -1
  59. package/_cjs/policies/schema.js.map +0 -1
  60. package/_esm/policies/schema.js.map +0 -1
  61. package/_types/policies/schema.d.ts +0 -11599
  62. package/_types/policies/schema.d.ts.map +0 -1
@@ -24,10 +24,14 @@ import type {
24
24
  EvmTypedNumericalCondition,
25
25
  EvmTypedStringCondition,
26
26
  ListPolicies200,
27
+ MintAddressCriterion,
27
28
  Policy,
28
29
  SignEvmTypedDataFieldCriterion,
29
30
  SignEvmTypedDataVerifyingContractCriterion,
30
31
  SolAddressCriterion,
32
+ SolValueCriterion,
33
+ SplAddressCriterion,
34
+ SplValueCriterion,
31
35
  } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
32
36
 
33
37
  export const getListPoliciesResponseEthValueCriterionMock = (
@@ -263,6 +267,54 @@ export const getListPoliciesResponseSolAddressCriterionMock = (
263
267
  ...overrideResponse,
264
268
  });
265
269
 
270
+ export const getListPoliciesResponseSolValueCriterionMock = (
271
+ overrideResponse: Partial<SolValueCriterion> = {},
272
+ ): SolValueCriterion => ({
273
+ ...{
274
+ type: faker.helpers.arrayElement(["solValue"] as const),
275
+ solValue: faker.string.alpha(20),
276
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
277
+ },
278
+ ...overrideResponse,
279
+ });
280
+
281
+ export const getListPoliciesResponseSplAddressCriterionMock = (
282
+ overrideResponse: Partial<SplAddressCriterion> = {},
283
+ ): SplAddressCriterion => ({
284
+ ...{
285
+ type: faker.helpers.arrayElement(["splAddress"] as const),
286
+ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
287
+ () => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$"),
288
+ ),
289
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
290
+ },
291
+ ...overrideResponse,
292
+ });
293
+
294
+ export const getListPoliciesResponseSplValueCriterionMock = (
295
+ overrideResponse: Partial<SplValueCriterion> = {},
296
+ ): SplValueCriterion => ({
297
+ ...{
298
+ type: faker.helpers.arrayElement(["splValue"] as const),
299
+ splValue: faker.string.alpha(20),
300
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
301
+ },
302
+ ...overrideResponse,
303
+ });
304
+
305
+ export const getListPoliciesResponseMintAddressCriterionMock = (
306
+ overrideResponse: Partial<MintAddressCriterion> = {},
307
+ ): MintAddressCriterion => ({
308
+ ...{
309
+ type: faker.helpers.arrayElement(["mintAddress"] as const),
310
+ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
311
+ () => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$"),
312
+ ),
313
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
314
+ },
315
+ ...overrideResponse,
316
+ });
317
+
266
318
  export const getListPoliciesResponseMock = (): ListPolicies200 => ({
267
319
  ...{
268
320
  policies: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
@@ -341,6 +393,26 @@ export const getListPoliciesResponseMock = (): ListPolicies200 => ({
341
393
  ).map(() =>
342
394
  faker.helpers.arrayElement([
343
395
  { ...getListPoliciesResponseSolAddressCriterionMock() },
396
+ { ...getListPoliciesResponseSolValueCriterionMock() },
397
+ { ...getListPoliciesResponseSplAddressCriterionMock() },
398
+ { ...getListPoliciesResponseSplValueCriterionMock() },
399
+ { ...getListPoliciesResponseMintAddressCriterionMock() },
400
+ ]),
401
+ ),
402
+ },
403
+ {
404
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
405
+ operation: faker.helpers.arrayElement(["sendSolTransaction"] as const),
406
+ criteria: Array.from(
407
+ { length: faker.number.int({ min: 1, max: 10 }) },
408
+ (_, i) => i + 1,
409
+ ).map(() =>
410
+ faker.helpers.arrayElement([
411
+ { ...getListPoliciesResponseSolAddressCriterionMock() },
412
+ { ...getListPoliciesResponseSolValueCriterionMock() },
413
+ { ...getListPoliciesResponseSplAddressCriterionMock() },
414
+ { ...getListPoliciesResponseSplValueCriterionMock() },
415
+ { ...getListPoliciesResponseMintAddressCriterionMock() },
344
416
  ]),
345
417
  ),
346
418
  },
@@ -620,6 +692,54 @@ export const getCreatePolicyResponseSolAddressCriterionMock = (
620
692
  ...overrideResponse,
621
693
  });
622
694
 
695
+ export const getCreatePolicyResponseSolValueCriterionMock = (
696
+ overrideResponse: Partial<SolValueCriterion> = {},
697
+ ): SolValueCriterion => ({
698
+ ...{
699
+ type: faker.helpers.arrayElement(["solValue"] as const),
700
+ solValue: faker.string.alpha(20),
701
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
702
+ },
703
+ ...overrideResponse,
704
+ });
705
+
706
+ export const getCreatePolicyResponseSplAddressCriterionMock = (
707
+ overrideResponse: Partial<SplAddressCriterion> = {},
708
+ ): SplAddressCriterion => ({
709
+ ...{
710
+ type: faker.helpers.arrayElement(["splAddress"] as const),
711
+ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
712
+ () => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$"),
713
+ ),
714
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
715
+ },
716
+ ...overrideResponse,
717
+ });
718
+
719
+ export const getCreatePolicyResponseSplValueCriterionMock = (
720
+ overrideResponse: Partial<SplValueCriterion> = {},
721
+ ): SplValueCriterion => ({
722
+ ...{
723
+ type: faker.helpers.arrayElement(["splValue"] as const),
724
+ splValue: faker.string.alpha(20),
725
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
726
+ },
727
+ ...overrideResponse,
728
+ });
729
+
730
+ export const getCreatePolicyResponseMintAddressCriterionMock = (
731
+ overrideResponse: Partial<MintAddressCriterion> = {},
732
+ ): MintAddressCriterion => ({
733
+ ...{
734
+ type: faker.helpers.arrayElement(["mintAddress"] as const),
735
+ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
736
+ () => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$"),
737
+ ),
738
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
739
+ },
740
+ ...overrideResponse,
741
+ });
742
+
623
743
  export const getCreatePolicyResponseMock = (overrideResponse: Partial<Policy> = {}): Policy => ({
624
744
  id: faker.helpers.fromRegExp(
625
745
  "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
@@ -690,7 +810,29 @@ export const getCreatePolicyResponseMock = (overrideResponse: Partial<Policy> =
690
810
  { length: faker.number.int({ min: 1, max: 10 }) },
691
811
  (_, i) => i + 1,
692
812
  ).map(() =>
693
- faker.helpers.arrayElement([{ ...getCreatePolicyResponseSolAddressCriterionMock() }]),
813
+ faker.helpers.arrayElement([
814
+ { ...getCreatePolicyResponseSolAddressCriterionMock() },
815
+ { ...getCreatePolicyResponseSolValueCriterionMock() },
816
+ { ...getCreatePolicyResponseSplAddressCriterionMock() },
817
+ { ...getCreatePolicyResponseSplValueCriterionMock() },
818
+ { ...getCreatePolicyResponseMintAddressCriterionMock() },
819
+ ]),
820
+ ),
821
+ },
822
+ {
823
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
824
+ operation: faker.helpers.arrayElement(["sendSolTransaction"] as const),
825
+ criteria: Array.from(
826
+ { length: faker.number.int({ min: 1, max: 10 }) },
827
+ (_, i) => i + 1,
828
+ ).map(() =>
829
+ faker.helpers.arrayElement([
830
+ { ...getCreatePolicyResponseSolAddressCriterionMock() },
831
+ { ...getCreatePolicyResponseSolValueCriterionMock() },
832
+ { ...getCreatePolicyResponseSplAddressCriterionMock() },
833
+ { ...getCreatePolicyResponseSplValueCriterionMock() },
834
+ { ...getCreatePolicyResponseMintAddressCriterionMock() },
835
+ ]),
694
836
  ),
695
837
  },
696
838
  {
@@ -966,6 +1108,54 @@ export const getGetPolicyByIdResponseSolAddressCriterionMock = (
966
1108
  ...overrideResponse,
967
1109
  });
968
1110
 
1111
+ export const getGetPolicyByIdResponseSolValueCriterionMock = (
1112
+ overrideResponse: Partial<SolValueCriterion> = {},
1113
+ ): SolValueCriterion => ({
1114
+ ...{
1115
+ type: faker.helpers.arrayElement(["solValue"] as const),
1116
+ solValue: faker.string.alpha(20),
1117
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
1118
+ },
1119
+ ...overrideResponse,
1120
+ });
1121
+
1122
+ export const getGetPolicyByIdResponseSplAddressCriterionMock = (
1123
+ overrideResponse: Partial<SplAddressCriterion> = {},
1124
+ ): SplAddressCriterion => ({
1125
+ ...{
1126
+ type: faker.helpers.arrayElement(["splAddress"] as const),
1127
+ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
1128
+ () => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$"),
1129
+ ),
1130
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
1131
+ },
1132
+ ...overrideResponse,
1133
+ });
1134
+
1135
+ export const getGetPolicyByIdResponseSplValueCriterionMock = (
1136
+ overrideResponse: Partial<SplValueCriterion> = {},
1137
+ ): SplValueCriterion => ({
1138
+ ...{
1139
+ type: faker.helpers.arrayElement(["splValue"] as const),
1140
+ splValue: faker.string.alpha(20),
1141
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
1142
+ },
1143
+ ...overrideResponse,
1144
+ });
1145
+
1146
+ export const getGetPolicyByIdResponseMintAddressCriterionMock = (
1147
+ overrideResponse: Partial<MintAddressCriterion> = {},
1148
+ ): MintAddressCriterion => ({
1149
+ ...{
1150
+ type: faker.helpers.arrayElement(["mintAddress"] as const),
1151
+ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
1152
+ () => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$"),
1153
+ ),
1154
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
1155
+ },
1156
+ ...overrideResponse,
1157
+ });
1158
+
969
1159
  export const getGetPolicyByIdResponseMock = (overrideResponse: Partial<Policy> = {}): Policy => ({
970
1160
  id: faker.helpers.fromRegExp(
971
1161
  "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
@@ -1036,7 +1226,29 @@ export const getGetPolicyByIdResponseMock = (overrideResponse: Partial<Policy> =
1036
1226
  { length: faker.number.int({ min: 1, max: 10 }) },
1037
1227
  (_, i) => i + 1,
1038
1228
  ).map(() =>
1039
- faker.helpers.arrayElement([{ ...getGetPolicyByIdResponseSolAddressCriterionMock() }]),
1229
+ faker.helpers.arrayElement([
1230
+ { ...getGetPolicyByIdResponseSolAddressCriterionMock() },
1231
+ { ...getGetPolicyByIdResponseSolValueCriterionMock() },
1232
+ { ...getGetPolicyByIdResponseSplAddressCriterionMock() },
1233
+ { ...getGetPolicyByIdResponseSplValueCriterionMock() },
1234
+ { ...getGetPolicyByIdResponseMintAddressCriterionMock() },
1235
+ ]),
1236
+ ),
1237
+ },
1238
+ {
1239
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
1240
+ operation: faker.helpers.arrayElement(["sendSolTransaction"] as const),
1241
+ criteria: Array.from(
1242
+ { length: faker.number.int({ min: 1, max: 10 }) },
1243
+ (_, i) => i + 1,
1244
+ ).map(() =>
1245
+ faker.helpers.arrayElement([
1246
+ { ...getGetPolicyByIdResponseSolAddressCriterionMock() },
1247
+ { ...getGetPolicyByIdResponseSolValueCriterionMock() },
1248
+ { ...getGetPolicyByIdResponseSplAddressCriterionMock() },
1249
+ { ...getGetPolicyByIdResponseSplValueCriterionMock() },
1250
+ { ...getGetPolicyByIdResponseMintAddressCriterionMock() },
1251
+ ]),
1040
1252
  ),
1041
1253
  },
1042
1254
  {
@@ -1312,6 +1524,54 @@ export const getUpdatePolicyResponseSolAddressCriterionMock = (
1312
1524
  ...overrideResponse,
1313
1525
  });
1314
1526
 
1527
+ export const getUpdatePolicyResponseSolValueCriterionMock = (
1528
+ overrideResponse: Partial<SolValueCriterion> = {},
1529
+ ): SolValueCriterion => ({
1530
+ ...{
1531
+ type: faker.helpers.arrayElement(["solValue"] as const),
1532
+ solValue: faker.string.alpha(20),
1533
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
1534
+ },
1535
+ ...overrideResponse,
1536
+ });
1537
+
1538
+ export const getUpdatePolicyResponseSplAddressCriterionMock = (
1539
+ overrideResponse: Partial<SplAddressCriterion> = {},
1540
+ ): SplAddressCriterion => ({
1541
+ ...{
1542
+ type: faker.helpers.arrayElement(["splAddress"] as const),
1543
+ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
1544
+ () => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$"),
1545
+ ),
1546
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
1547
+ },
1548
+ ...overrideResponse,
1549
+ });
1550
+
1551
+ export const getUpdatePolicyResponseSplValueCriterionMock = (
1552
+ overrideResponse: Partial<SplValueCriterion> = {},
1553
+ ): SplValueCriterion => ({
1554
+ ...{
1555
+ type: faker.helpers.arrayElement(["splValue"] as const),
1556
+ splValue: faker.string.alpha(20),
1557
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
1558
+ },
1559
+ ...overrideResponse,
1560
+ });
1561
+
1562
+ export const getUpdatePolicyResponseMintAddressCriterionMock = (
1563
+ overrideResponse: Partial<MintAddressCriterion> = {},
1564
+ ): MintAddressCriterion => ({
1565
+ ...{
1566
+ type: faker.helpers.arrayElement(["mintAddress"] as const),
1567
+ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
1568
+ () => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$"),
1569
+ ),
1570
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
1571
+ },
1572
+ ...overrideResponse,
1573
+ });
1574
+
1315
1575
  export const getUpdatePolicyResponseMock = (overrideResponse: Partial<Policy> = {}): Policy => ({
1316
1576
  id: faker.helpers.fromRegExp(
1317
1577
  "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
@@ -1382,7 +1642,29 @@ export const getUpdatePolicyResponseMock = (overrideResponse: Partial<Policy> =
1382
1642
  { length: faker.number.int({ min: 1, max: 10 }) },
1383
1643
  (_, i) => i + 1,
1384
1644
  ).map(() =>
1385
- faker.helpers.arrayElement([{ ...getUpdatePolicyResponseSolAddressCriterionMock() }]),
1645
+ faker.helpers.arrayElement([
1646
+ { ...getUpdatePolicyResponseSolAddressCriterionMock() },
1647
+ { ...getUpdatePolicyResponseSolValueCriterionMock() },
1648
+ { ...getUpdatePolicyResponseSplAddressCriterionMock() },
1649
+ { ...getUpdatePolicyResponseSplValueCriterionMock() },
1650
+ { ...getUpdatePolicyResponseMintAddressCriterionMock() },
1651
+ ]),
1652
+ ),
1653
+ },
1654
+ {
1655
+ action: faker.helpers.arrayElement(["reject", "accept"] as const),
1656
+ operation: faker.helpers.arrayElement(["sendSolTransaction"] as const),
1657
+ criteria: Array.from(
1658
+ { length: faker.number.int({ min: 1, max: 10 }) },
1659
+ (_, i) => i + 1,
1660
+ ).map(() =>
1661
+ faker.helpers.arrayElement([
1662
+ { ...getUpdatePolicyResponseSolAddressCriterionMock() },
1663
+ { ...getUpdatePolicyResponseSolValueCriterionMock() },
1664
+ { ...getUpdatePolicyResponseSplAddressCriterionMock() },
1665
+ { ...getUpdatePolicyResponseSplValueCriterionMock() },
1666
+ { ...getUpdatePolicyResponseMintAddressCriterionMock() },
1667
+ ]),
1386
1668
  ),
1387
1669
  },
1388
1670
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-sdk",
3
- "version": "1.31.1",
3
+ "version": "1.32.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",
@@ -31,16 +31,6 @@ export const EvmNetworkOperatorEnum = z.enum(["in", "not in"]);
31
31
  */
32
32
  export type EvmNetworkOperator = z.infer<typeof EvmNetworkOperatorEnum>;
33
33
 
34
- /**
35
- * Enum for SolAddressOperator values
36
- */
37
- export const SolAddressOperatorEnum = z.enum(["in", "not in"]);
38
- /**
39
- * Type representing the operators that can be used for Solana address comparisons.
40
- * These operators determine how transaction addresses are evaluated against a list.
41
- */
42
- export type SolAddressOperator = z.infer<typeof SolAddressOperatorEnum>;
43
-
44
34
  /**
45
35
  * Schema for ETH value criterions
46
36
  */
@@ -351,26 +341,6 @@ export const EvmDataCriterionSchema = z.object({
351
341
  });
352
342
  export type EvmDataCriterion = z.infer<typeof EvmDataCriterionSchema>;
353
343
 
354
- /**
355
- * Schema for Solana address criterions
356
- */
357
- export const SolAddressCriterionSchema = z.object({
358
- /** The type of criterion, must be "solAddress" for Solana address-based rules. */
359
- type: z.literal("solAddress"),
360
- /**
361
- * Array of Solana addresses to compare against.
362
- * Each address must be a valid Base58-encoded Solana address (32-44 characters).
363
- */
364
- addresses: z.array(z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/)),
365
- /**
366
- * The operator to use for evaluating transaction addresses.
367
- * "in" checks if an address is in the provided list.
368
- * "not in" checks if an address is not in the provided list.
369
- */
370
- operator: SolAddressOperatorEnum,
371
- });
372
- export type SolAddressCriterion = z.infer<typeof SolAddressCriterionSchema>;
373
-
374
344
  /**
375
345
  * Schema for criteria used in SignEvmTransaction operations
376
346
  */
@@ -421,19 +391,6 @@ export const SendEvmTransactionCriteriaSchema = z
421
391
  // Type representing a set of criteria for the sendEvmTransaction operation. Can contain up to 10 individual criterion objects of ETH value or EVM address types.
422
392
  export type SendEvmTransactionCriteria = z.infer<typeof SendEvmTransactionCriteriaSchema>;
423
393
 
424
- /**
425
- * Schema for criteria used in SignSolTransaction operations
426
- */
427
- export const SignSolTransactionCriteriaSchema = z
428
- .array(z.discriminatedUnion("type", [SolAddressCriterionSchema]))
429
- .max(10)
430
- .min(1);
431
- /**
432
- * Type representing a set of criteria for the signSolTransaction operation.
433
- * Can contain up to 10 individual Solana address criterion objects.
434
- */
435
- export type SignSolTransactionCriteria = z.infer<typeof SignSolTransactionCriteriaSchema>;
436
-
437
394
  /**
438
395
  * Schema for criteria used in PrepareUserOperation operations
439
396
  */
@@ -473,20 +430,18 @@ export const SendUserOperationCriteriaSchema = z
473
430
  */
474
431
  export type SendUserOperationCriteria = z.infer<typeof SendUserOperationCriteriaSchema>;
475
432
 
476
- /**
477
- * Enum for Solana Operation types
478
- */
479
- export const SolOperationEnum = z.enum(["signSolTransaction"]);
480
- /**
481
- * Type representing the operations that can be governed by a policy.
482
- * Defines what Solana operations the policy applies to.
483
- */
484
- export type SolOperation = z.infer<typeof SolOperationEnum>;
485
-
486
433
  /**
487
434
  * Enum for Evm Operation types
488
435
  */
489
- export const EvmOperationEnum = z.enum(["signEvmTransaction"]);
436
+ export const EvmOperationEnum = z.enum([
437
+ "signEvmTransaction",
438
+ "sendEvmTransaction",
439
+ "signEvmMessage",
440
+ "signEvmTypedData",
441
+ "signEvmHash",
442
+ "prepareUserOperation",
443
+ "sendUserOperation",
444
+ ]);
490
445
  /**
491
446
  * Type representing the operations that can be governed by a policy.
492
447
  * Defines what EVM operations the policy applies to.
@@ -613,29 +568,6 @@ export const SendEvmTransactionRuleSchema = z.object({
613
568
  });
614
569
  export type SendEvmTransactionRule = z.infer<typeof SendEvmTransactionRuleSchema>;
615
570
 
616
- /**
617
- * Type representing a 'signSolTransaction' policy rule that can accept or reject specific operations
618
- * based on a set of criteria.
619
- */
620
- export const SignSolTransactionRuleSchema = z.object({
621
- /**
622
- * Determines whether matching the rule will cause a request to be rejected or accepted.
623
- * "accept" will allow the transaction, "reject" will block it.
624
- */
625
- action: ActionEnum,
626
- /**
627
- * The operation to which this rule applies.
628
- * Must be "signSolTransaction".
629
- */
630
- operation: z.literal("signSolTransaction"),
631
- /**
632
- * The set of criteria that must be matched for this rule to apply.
633
- * Must be compatible with the specified operation type.
634
- */
635
- criteria: SignSolTransactionCriteriaSchema,
636
- });
637
- export type SignSolTransactionRule = z.infer<typeof SignSolTransactionRuleSchema>;
638
-
639
571
  /**
640
572
  * Type representing a 'prepareUserOperation' policy rule that can accept or reject specific operations
641
573
  * based on a set of criteria.
@@ -681,84 +613,3 @@ export const SendUserOperationRuleSchema = z.object({
681
613
  criteria: SendUserOperationCriteriaSchema,
682
614
  });
683
615
  export type SendUserOperationRule = z.infer<typeof SendUserOperationRuleSchema>;
684
-
685
- /**
686
- * Schema for policy rules
687
- */
688
- export const RuleSchema = z.discriminatedUnion("operation", [
689
- SignEvmTransactionRuleSchema,
690
- SignEvmHashRuleSchema,
691
- SignEvmMessageRuleSchema,
692
- SignEvmTypedDataRuleSchema,
693
- SendEvmTransactionRuleSchema,
694
- SignSolTransactionRuleSchema,
695
- PrepareUserOperationRuleSchema,
696
- SendUserOperationRuleSchema,
697
- ]);
698
-
699
- /**
700
- * Type representing a policy rule that can accept or reject specific operations
701
- * based on a set of criteria.
702
- */
703
- export type Rule = z.infer<typeof RuleSchema>;
704
-
705
- /**
706
- * Enum for policy scopes
707
- */
708
- export const PolicyScopeEnum = z.enum(["project", "account"]);
709
- /**
710
- * Type representing the scope of a policy.
711
- * Determines whether the policy applies at the project level or account level.
712
- */
713
- export type PolicyScope = z.infer<typeof PolicyScopeEnum>;
714
-
715
- /**
716
- * Schema for creating or updating a Policy.
717
- */
718
- export const CreatePolicyBodySchema = z.object({
719
- /**
720
- * The scope of the policy.
721
- * "project" applies to the entire project, "account" applies to specific accounts.
722
- */
723
- scope: PolicyScopeEnum,
724
- /**
725
- * An optional human-readable description for the policy.
726
- * Limited to 50 characters of alphanumeric characters, spaces, commas, and periods.
727
- */
728
- description: z
729
- .string()
730
- .regex(/^[A-Za-z0-9 ,.]{1,50}$/)
731
- .optional(),
732
- /**
733
- * Array of rules that comprise the policy.
734
- * Limited to a maximum of 10 rules per policy.
735
- */
736
- rules: z.array(RuleSchema).max(10).min(1),
737
- });
738
- /**
739
- * Type representing the request body for creating a new policy.
740
- * Contains the scope, optional description, and rules for the policy.
741
- */
742
- export type CreatePolicyBody = z.infer<typeof CreatePolicyBodySchema>;
743
-
744
- export const UpdatePolicyBodySchema = z.object({
745
- /**
746
- * An optional human-readable description for the policy.
747
- * Limited to 50 characters of alphanumeric characters, spaces, commas, and periods.
748
- */
749
- description: z
750
- .string()
751
- .regex(/^[A-Za-z0-9 ,.]{1,50}$/)
752
- .optional(),
753
- /**
754
- * Array of rules that comprise the policy.
755
- * Limited to a maximum of 10 rules per policy.
756
- */
757
- rules: z.array(RuleSchema).max(10).min(1),
758
- });
759
- /**
760
- * Type representing the request body for updating an existing policy.
761
- * Contains the optional description and rules for the updated policy.
762
- * Note that the scope cannot be changed once a policy is created.
763
- */
764
- export type UpdatePolicyBody = z.infer<typeof UpdatePolicyBodySchema>;