@coinbase/cdp-sdk 1.31.0 → 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 (104) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js +61 -0
  3. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  4. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +21 -0
  5. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  6. package/_cjs/actions/evm/listSpendPermissions.js +18 -0
  7. package/_cjs/actions/evm/listSpendPermissions.js.map +1 -0
  8. package/_cjs/actions/evm/listTokenBalances.js +2 -0
  9. package/_cjs/actions/evm/listTokenBalances.js.map +1 -1
  10. package/_cjs/client/evm/evm.js +157 -60
  11. package/_cjs/client/evm/evm.js.map +1 -1
  12. package/_cjs/client/policies/policies.js +72 -5
  13. package/_cjs/client/policies/policies.js.map +1 -1
  14. package/_cjs/client/solana/solana.js +47 -27
  15. package/_cjs/client/solana/solana.js.map +1 -1
  16. package/_cjs/index.js +3 -3
  17. package/_cjs/index.js.map +1 -1
  18. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +53 -2
  19. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  20. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +215 -5
  21. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  22. package/_cjs/policies/{schema.js → evmSchema.js} +11 -112
  23. package/_cjs/policies/evmSchema.js.map +1 -0
  24. package/_cjs/policies/solanaSchema.js +183 -0
  25. package/_cjs/policies/solanaSchema.js.map +1 -0
  26. package/_cjs/policies/types.js +60 -0
  27. package/_cjs/policies/types.js.map +1 -1
  28. package/_cjs/version.js +1 -1
  29. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js +61 -0
  30. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  31. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +21 -0
  32. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  33. package/_esm/actions/evm/listSpendPermissions.js +15 -0
  34. package/_esm/actions/evm/listSpendPermissions.js.map +1 -0
  35. package/_esm/actions/evm/listTokenBalances.js +2 -0
  36. package/_esm/actions/evm/listTokenBalances.js.map +1 -1
  37. package/_esm/client/evm/evm.js +157 -60
  38. package/_esm/client/evm/evm.js.map +1 -1
  39. package/_esm/client/policies/policies.js +70 -3
  40. package/_esm/client/policies/policies.js.map +1 -1
  41. package/_esm/client/solana/solana.js +47 -27
  42. package/_esm/client/solana/solana.js.map +1 -1
  43. package/_esm/index.js +1 -1
  44. package/_esm/index.js.map +1 -1
  45. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +51 -0
  46. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  47. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +197 -3
  48. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  49. package/_esm/policies/{schema.js → evmSchema.js} +10 -111
  50. package/_esm/policies/evmSchema.js.map +1 -0
  51. package/_esm/policies/solanaSchema.js +180 -0
  52. package/_esm/policies/solanaSchema.js.map +1 -0
  53. package/_esm/policies/types.js +59 -1
  54. package/_esm/policies/types.js.map +1 -1
  55. package/_esm/version.js +1 -1
  56. package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts.map +1 -1
  57. package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts.map +1 -1
  58. package/_types/actions/evm/listSpendPermissions.d.ts +12 -0
  59. package/_types/actions/evm/listSpendPermissions.d.ts.map +1 -0
  60. package/_types/actions/evm/listTokenBalances.d.ts.map +1 -1
  61. package/_types/client/evm/evm.d.ts +66 -1
  62. package/_types/client/evm/evm.d.ts.map +1 -1
  63. package/_types/client/evm/evm.types.d.ts +2 -1
  64. package/_types/client/evm/evm.types.d.ts.map +1 -1
  65. package/_types/client/policies/policies.d.ts +69 -2
  66. package/_types/client/policies/policies.d.ts.map +1 -1
  67. package/_types/client/policies/policies.types.d.ts +1 -2
  68. package/_types/client/policies/policies.types.d.ts.map +1 -1
  69. package/_types/client/solana/solana.d.ts +16 -0
  70. package/_types/client/solana/solana.d.ts.map +1 -1
  71. package/_types/index.d.ts +1 -1
  72. package/_types/index.d.ts.map +1 -1
  73. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +140 -2
  74. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  75. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +17 -1
  76. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -1
  77. package/_types/policies/evmSchema.d.ts +4367 -0
  78. package/_types/policies/evmSchema.d.ts.map +1 -0
  79. package/_types/policies/solanaSchema.d.ts +758 -0
  80. package/_types/policies/solanaSchema.d.ts.map +1 -0
  81. package/_types/policies/types.d.ts +6591 -1
  82. package/_types/policies/types.d.ts.map +1 -1
  83. package/_types/version.d.ts +1 -1
  84. package/accounts/evm/toNetworkScopedEvmServerAccount.ts +69 -0
  85. package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +22 -0
  86. package/actions/evm/listSpendPermissions.ts +20 -0
  87. package/actions/evm/listTokenBalances.ts +2 -0
  88. package/client/evm/evm.ts +200 -81
  89. package/client/evm/evm.types.ts +4 -0
  90. package/client/policies/policies.ts +70 -4
  91. package/client/policies/policies.types.ts +1 -2
  92. package/client/solana/solana.ts +60 -38
  93. package/index.ts +1 -1
  94. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +198 -1
  95. package/openapi-client/generated/policy-engine/policy-engine.msw.ts +285 -3
  96. package/package.json +1 -1
  97. package/policies/{schema.ts → evmSchema.ts} +9 -158
  98. package/policies/solanaSchema.ts +251 -0
  99. package/policies/types.ts +94 -1
  100. package/version.ts +1 -1
  101. package/_cjs/policies/schema.js.map +0 -1
  102. package/_esm/policies/schema.js.map +0 -1
  103. package/_types/policies/schema.d.ts +0 -11599
  104. package/_types/policies/schema.d.ts.map +0 -1
@@ -1341,10 +1341,163 @@ export interface SolAddressCriterion {
1341
1341
  operator: SolAddressCriterionOperator;
1342
1342
  }
1343
1343
 
1344
+ /**
1345
+ * The type of criterion to use. This should be `solValue`.
1346
+ */
1347
+ export type SolValueCriterionType =
1348
+ (typeof SolValueCriterionType)[keyof typeof SolValueCriterionType];
1349
+
1350
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1351
+ export const SolValueCriterionType = {
1352
+ solValue: "solValue",
1353
+ } as const;
1354
+
1355
+ /**
1356
+ * The operator to use for the comparison. The transaction instruction's `value` field will be on the left-hand side of the operator, and the `solValue` field will be on the right-hand side.
1357
+ */
1358
+ export type SolValueCriterionOperator =
1359
+ (typeof SolValueCriterionOperator)[keyof typeof SolValueCriterionOperator];
1360
+
1361
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1362
+ export const SolValueCriterionOperator = {
1363
+ ">": ">",
1364
+ ">=": ">=",
1365
+ "<": "<",
1366
+ "<=": "<=",
1367
+ "==": "==",
1368
+ } as const;
1369
+
1370
+ /**
1371
+ * The criterion for the SOL value in lamports of a native transfer instruction in a Solana transaction.
1372
+ */
1373
+ export interface SolValueCriterion {
1374
+ /** The type of criterion to use. This should be `solValue`. */
1375
+ type: SolValueCriterionType;
1376
+ /** The amount of SOL in lamports that the transaction instruction's `value` field should be compared to. */
1377
+ solValue: string;
1378
+ /** The operator to use for the comparison. The transaction instruction's `value` field will be on the left-hand side of the operator, and the `solValue` field will be on the right-hand side. */
1379
+ operator: SolValueCriterionOperator;
1380
+ }
1381
+
1382
+ /**
1383
+ * The type of criterion to use. This should be `splAddress`.
1384
+ */
1385
+ export type SplAddressCriterionType =
1386
+ (typeof SplAddressCriterionType)[keyof typeof SplAddressCriterionType];
1387
+
1388
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1389
+ export const SplAddressCriterionType = {
1390
+ splAddress: "splAddress",
1391
+ } as const;
1392
+
1393
+ /**
1394
+ * The operator to use for the comparison. Each of the SPL token transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
1395
+ */
1396
+ export type SplAddressCriterionOperator =
1397
+ (typeof SplAddressCriterionOperator)[keyof typeof SplAddressCriterionOperator];
1398
+
1399
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1400
+ export const SplAddressCriterionOperator = {
1401
+ in: "in",
1402
+ not_in: "not in",
1403
+ } as const;
1404
+
1405
+ /**
1406
+ * The criterion for the recipient addresses of a Solana transaction's SPL token transfer instructions.
1407
+ */
1408
+ export interface SplAddressCriterion {
1409
+ /** The type of criterion to use. This should be `splAddress`. */
1410
+ type: SplAddressCriterionType;
1411
+ /** The Solana addresses that are compared to the list of SPL token transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array. */
1412
+ addresses: string[];
1413
+ /** The operator to use for the comparison. Each of the SPL token transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
1414
+ operator: SplAddressCriterionOperator;
1415
+ }
1416
+
1417
+ /**
1418
+ * The type of criterion to use. This should be `splValue`.
1419
+ */
1420
+ export type SplValueCriterionType =
1421
+ (typeof SplValueCriterionType)[keyof typeof SplValueCriterionType];
1422
+
1423
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1424
+ export const SplValueCriterionType = {
1425
+ splValue: "splValue",
1426
+ } as const;
1427
+
1428
+ /**
1429
+ * The operator to use for the comparison. The transaction instruction's `value` field will be on the left-hand side of the operator, and the `splValue` field will be on the right-hand side.
1430
+ */
1431
+ export type SplValueCriterionOperator =
1432
+ (typeof SplValueCriterionOperator)[keyof typeof SplValueCriterionOperator];
1433
+
1434
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1435
+ export const SplValueCriterionOperator = {
1436
+ ">": ">",
1437
+ ">=": ">=",
1438
+ "<": "<",
1439
+ "<=": "<=",
1440
+ "==": "==",
1441
+ } as const;
1442
+
1443
+ /**
1444
+ * The criterion for the SPL token value of a SPL token transfer instruction in a Solana transaction.
1445
+ */
1446
+ export interface SplValueCriterion {
1447
+ /** The type of criterion to use. This should be `splValue`. */
1448
+ type: SplValueCriterionType;
1449
+ /** The amount of the SPL token that the transaction instruction's `value` field should be compared to. */
1450
+ splValue: string;
1451
+ /** The operator to use for the comparison. The transaction instruction's `value` field will be on the left-hand side of the operator, and the `splValue` field will be on the right-hand side. */
1452
+ operator: SplValueCriterionOperator;
1453
+ }
1454
+
1455
+ /**
1456
+ * The type of criterion to use. This should be `mintAddress`.
1457
+ */
1458
+ export type MintAddressCriterionType =
1459
+ (typeof MintAddressCriterionType)[keyof typeof MintAddressCriterionType];
1460
+
1461
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1462
+ export const MintAddressCriterionType = {
1463
+ mintAddress: "mintAddress",
1464
+ } as const;
1465
+
1466
+ /**
1467
+ * The operator to use for the comparison. Each of the token mint addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
1468
+ */
1469
+ export type MintAddressCriterionOperator =
1470
+ (typeof MintAddressCriterionOperator)[keyof typeof MintAddressCriterionOperator];
1471
+
1472
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1473
+ export const MintAddressCriterionOperator = {
1474
+ in: "in",
1475
+ not_in: "not in",
1476
+ } as const;
1477
+
1478
+ /**
1479
+ * The criterion for the token mint addresses of a Solana transaction's SPL token transfer instructions.
1480
+ */
1481
+ export interface MintAddressCriterion {
1482
+ /** The type of criterion to use. This should be `mintAddress`. */
1483
+ type: MintAddressCriterionType;
1484
+ /** The Solana addresses that are compared to the list of token mint addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array. */
1485
+ addresses: string[];
1486
+ /** The operator to use for the comparison. Each of the token mint addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
1487
+ operator: MintAddressCriterionOperator;
1488
+ }
1489
+
1490
+ export type SignSolTransactionCriteriaItem =
1491
+ | SolAddressCriterion
1492
+ | SolValueCriterion
1493
+ | SplAddressCriterion
1494
+ | SplValueCriterion
1495
+ | MintAddressCriterion;
1496
+
1344
1497
  /**
1345
1498
  * A schema for specifying criteria for the SignSolTransaction operation.
1346
1499
  */
1347
- export type SignSolTransactionCriteria = SolAddressCriterion[];
1500
+ export type SignSolTransactionCriteria = SignSolTransactionCriteriaItem[];
1348
1501
 
1349
1502
  /**
1350
1503
  * Whether matching the rule will cause the request to be rejected or accepted.
@@ -1377,6 +1530,49 @@ export interface SignSolTransactionRule {
1377
1530
  criteria: SignSolTransactionCriteria;
1378
1531
  }
1379
1532
 
1533
+ export type SendSolTransactionCriteriaItem =
1534
+ | SolAddressCriterion
1535
+ | SolValueCriterion
1536
+ | SplAddressCriterion
1537
+ | SplValueCriterion
1538
+ | MintAddressCriterion;
1539
+
1540
+ /**
1541
+ * A schema for specifying criteria for the SendSolTransaction operation.
1542
+ */
1543
+ export type SendSolTransactionCriteria = SendSolTransactionCriteriaItem[];
1544
+
1545
+ /**
1546
+ * Whether matching the rule will cause the request to be rejected or accepted.
1547
+ */
1548
+ export type SendSolTransactionRuleAction =
1549
+ (typeof SendSolTransactionRuleAction)[keyof typeof SendSolTransactionRuleAction];
1550
+
1551
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1552
+ export const SendSolTransactionRuleAction = {
1553
+ reject: "reject",
1554
+ accept: "accept",
1555
+ } as const;
1556
+
1557
+ /**
1558
+ * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
1559
+ */
1560
+ export type SendSolTransactionRuleOperation =
1561
+ (typeof SendSolTransactionRuleOperation)[keyof typeof SendSolTransactionRuleOperation];
1562
+
1563
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1564
+ export const SendSolTransactionRuleOperation = {
1565
+ sendSolTransaction: "sendSolTransaction",
1566
+ } as const;
1567
+
1568
+ export interface SendSolTransactionRule {
1569
+ /** Whether matching the rule will cause the request to be rejected or accepted. */
1570
+ action: SendSolTransactionRuleAction;
1571
+ /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
1572
+ operation: SendSolTransactionRuleOperation;
1573
+ criteria: SendSolTransactionCriteria;
1574
+ }
1575
+
1380
1576
  /**
1381
1577
  * Whether any attempts to sign a hash will be accepted or rejected. This rule does not accept any criteria.
1382
1578
  */
@@ -1499,6 +1695,7 @@ export type Rule =
1499
1695
  | SignEvmMessageRule
1500
1696
  | SignEvmTypedDataRule
1501
1697
  | SignSolTransactionRule
1698
+ | SendSolTransactionRule
1502
1699
  | SignEvmHashRule
1503
1700
  | PrepareUserOperationRule
1504
1701
  | SendUserOperationRule;
@@ -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.0",
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",