@coinbase/cdp-sdk 1.15.0 → 1.17.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 (145) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +82 -20
  3. package/_cjs/accounts/evm/toEvmServerAccount.js +20 -7
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  5. package/_cjs/accounts/evm/toEvmSmartAccount.js +26 -0
  6. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  7. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js +28 -0
  8. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -0
  9. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +26 -0
  10. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -0
  11. package/_cjs/actions/evm/signAndWrapTypedDataForSmartAccount.js +186 -0
  12. package/_cjs/actions/evm/signAndWrapTypedDataForSmartAccount.js.map +1 -0
  13. package/_cjs/actions/evm/swap/createSwapQuote.js +26 -8
  14. package/_cjs/actions/evm/swap/createSwapQuote.js.map +1 -1
  15. package/_cjs/actions/evm/swap/getSwapPrice.js +3 -2
  16. package/_cjs/actions/evm/swap/getSwapPrice.js.map +1 -1
  17. package/_cjs/actions/evm/swap/sendSwapOperation.js +153 -0
  18. package/_cjs/actions/evm/swap/sendSwapOperation.js.map +1 -0
  19. package/_cjs/actions/evm/swap/sendSwapTransaction.js +16 -2
  20. package/_cjs/actions/evm/swap/sendSwapTransaction.js.map +1 -1
  21. package/_cjs/client/evm/evm.js +13 -6
  22. package/_cjs/client/evm/evm.js.map +1 -1
  23. package/_cjs/client/policies/policies.js +6 -2
  24. package/_cjs/client/policies/policies.js.map +1 -1
  25. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +45 -1
  26. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  27. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js +48 -0
  28. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
  29. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +35 -0
  30. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
  31. package/_cjs/openapi-client/generated/index.msw.js +5 -5
  32. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  33. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +342 -1
  34. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  35. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js +40 -0
  36. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
  37. package/_cjs/policies/schema.js +83 -2
  38. package/_cjs/policies/schema.js.map +1 -1
  39. package/_cjs/utils/uuidV4.js +26 -0
  40. package/_cjs/utils/uuidV4.js.map +1 -0
  41. package/_cjs/version.js +1 -1
  42. package/_esm/accounts/evm/toEvmServerAccount.js +21 -8
  43. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  44. package/_esm/accounts/evm/toEvmSmartAccount.js +26 -0
  45. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  46. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js +25 -0
  47. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -0
  48. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +23 -0
  49. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -0
  50. package/_esm/actions/evm/signAndWrapTypedDataForSmartAccount.js +181 -0
  51. package/_esm/actions/evm/signAndWrapTypedDataForSmartAccount.js.map +1 -0
  52. package/_esm/actions/evm/swap/createSwapQuote.js +26 -8
  53. package/_esm/actions/evm/swap/createSwapQuote.js.map +1 -1
  54. package/_esm/actions/evm/swap/getSwapPrice.js +3 -2
  55. package/_esm/actions/evm/swap/getSwapPrice.js.map +1 -1
  56. package/_esm/actions/evm/swap/sendSwapOperation.js +150 -0
  57. package/_esm/actions/evm/swap/sendSwapOperation.js.map +1 -0
  58. package/_esm/actions/evm/swap/sendSwapTransaction.js +16 -2
  59. package/_esm/actions/evm/swap/sendSwapTransaction.js.map +1 -1
  60. package/_esm/client/evm/evm.js +14 -7
  61. package/_esm/client/evm/evm.js.map +1 -1
  62. package/_esm/client/policies/policies.js +7 -3
  63. package/_esm/client/policies/policies.js.map +1 -1
  64. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +44 -0
  65. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  66. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js +48 -0
  67. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
  68. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +35 -0
  69. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
  70. package/_esm/openapi-client/generated/index.msw.js +5 -5
  71. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  72. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +321 -0
  73. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  74. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +40 -0
  75. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
  76. package/_esm/policies/schema.js +83 -2
  77. package/_esm/policies/schema.js.map +1 -1
  78. package/_esm/utils/uuidV4.js +23 -0
  79. package/_esm/utils/uuidV4.js.map +1 -0
  80. package/_esm/version.js +1 -1
  81. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  82. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  83. package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts +23 -0
  84. package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts.map +1 -0
  85. package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts +27 -0
  86. package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts.map +1 -0
  87. package/_types/accounts/evm/types.d.ts +26 -9
  88. package/_types/accounts/evm/types.d.ts.map +1 -1
  89. package/_types/actions/evm/signAndWrapTypedDataForSmartAccount.d.ts +133 -0
  90. package/_types/actions/evm/signAndWrapTypedDataForSmartAccount.d.ts.map +1 -0
  91. package/_types/actions/evm/swap/createSwapQuote.d.ts.map +1 -1
  92. package/_types/actions/evm/swap/getSwapPrice.d.ts +2 -1
  93. package/_types/actions/evm/swap/getSwapPrice.d.ts.map +1 -1
  94. package/_types/actions/evm/swap/sendSwapOperation.d.ts +64 -0
  95. package/_types/actions/evm/swap/sendSwapOperation.d.ts.map +1 -0
  96. package/_types/actions/evm/swap/sendSwapTransaction.d.ts.map +1 -1
  97. package/_types/actions/evm/swap/types.d.ts +131 -5
  98. package/_types/actions/evm/swap/types.d.ts.map +1 -1
  99. package/_types/actions/evm/types.d.ts +112 -21
  100. package/_types/actions/evm/types.d.ts.map +1 -1
  101. package/_types/client/evm/evm.d.ts.map +1 -1
  102. package/_types/client/evm/evm.types.d.ts +33 -7
  103. package/_types/client/evm/evm.types.d.ts.map +1 -1
  104. package/_types/client/policies/policies.d.ts.map +1 -1
  105. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +182 -2
  106. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  107. package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts.map +1 -1
  108. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
  109. package/_types/openapi-client/generated/index.msw.d.ts +5 -5
  110. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  111. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +21 -1
  112. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -1
  113. package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -1
  114. package/_types/openapi-client/index.d.ts.map +1 -1
  115. package/_types/policies/schema.d.ts +3780 -7
  116. package/_types/policies/schema.d.ts.map +1 -1
  117. package/_types/utils/uuidV4.d.ts +10 -0
  118. package/_types/utils/uuidV4.d.ts.map +1 -0
  119. package/_types/version.d.ts +1 -1
  120. package/accounts/evm/toEvmServerAccount.ts +40 -15
  121. package/accounts/evm/toEvmSmartAccount.ts +33 -0
  122. package/accounts/evm/toNetworkScopedEvmServerAccount.ts +42 -0
  123. package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +41 -0
  124. package/accounts/evm/types.ts +46 -17
  125. package/actions/evm/signAndWrapTypedDataForSmartAccount.ts +246 -0
  126. package/actions/evm/swap/createSwapQuote.ts +42 -17
  127. package/actions/evm/swap/getSwapPrice.ts +15 -11
  128. package/actions/evm/swap/sendSwapOperation.ts +182 -0
  129. package/actions/evm/swap/sendSwapTransaction.ts +18 -2
  130. package/actions/evm/swap/types.ts +154 -5
  131. package/actions/evm/types.ts +123 -21
  132. package/client/evm/evm.ts +19 -8
  133. package/client/evm/evm.types.ts +34 -7
  134. package/client/policies/policies.ts +12 -3
  135. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +221 -2
  136. package/openapi-client/generated/evm-accounts/evm-accounts.msw.ts +48 -0
  137. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +35 -0
  138. package/openapi-client/generated/faucets/faucets.ts +4 -4
  139. package/openapi-client/generated/index.msw.ts +5 -5
  140. package/openapi-client/generated/policy-engine/policy-engine.msw.ts +434 -0
  141. package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +40 -0
  142. package/package.json +1 -1
  143. package/policies/schema.ts +94 -6
  144. package/utils/uuidV4.ts +23 -0
  145. package/version.ts +1 -1
@@ -9,9 +9,15 @@ import { faker } from "@faker-js/faker";
9
9
 
10
10
  import { HttpResponse, delay, http } from "msw";
11
11
 
12
+ import { AbiStateMutability, KnownAbiType } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
12
13
  import type {
14
+ AbiFunction,
15
+ AbiInput,
13
16
  EthValueCriterion,
14
17
  EvmAddressCriterion,
18
+ EvmDataCriterion,
19
+ EvmDataParameterCondition,
20
+ EvmDataParameterConditionList,
15
21
  EvmMessageCriterion,
16
22
  EvmNetworkCriterion,
17
23
  ListPolicies200,
@@ -43,6 +49,111 @@ export const getListPoliciesResponseEvmAddressCriterionMock = (
43
49
  ...overrideResponse,
44
50
  });
45
51
 
52
+ export const getListPoliciesResponseAbiFunctionMock = (
53
+ overrideResponse: Partial<AbiFunction> = {},
54
+ ): AbiFunction => ({
55
+ ...{
56
+ type: faker.helpers.arrayElement(["function"] as const),
57
+ name: faker.string.alpha(20),
58
+ inputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
59
+ () => ({
60
+ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
61
+ type: faker.string.alpha(20),
62
+ internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
63
+ components: faker.helpers.arrayElement([[], undefined]),
64
+ }),
65
+ ),
66
+ outputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
67
+ () => ({
68
+ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
69
+ type: faker.string.alpha(20),
70
+ internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
71
+ components: faker.helpers.arrayElement([[], undefined]),
72
+ }),
73
+ ),
74
+ constant: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
75
+ payable: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
76
+ stateMutability: faker.helpers.arrayElement(Object.values(AbiStateMutability)),
77
+ gas: faker.helpers.arrayElement([
78
+ faker.number.int({ min: undefined, max: undefined }),
79
+ undefined,
80
+ ]),
81
+ },
82
+ ...overrideResponse,
83
+ });
84
+
85
+ export const getListPoliciesResponseAbiInputMock = (
86
+ overrideResponse: Partial<AbiInput> = {},
87
+ ): AbiInput => ({
88
+ ...{
89
+ type: faker.helpers.arrayElement([
90
+ "constructor",
91
+ "error",
92
+ "event",
93
+ "fallback",
94
+ "receive",
95
+ ] as const),
96
+ additionalProperties: faker.helpers.arrayElement([{}, undefined]),
97
+ },
98
+ ...overrideResponse,
99
+ });
100
+
101
+ export const getListPoliciesResponseEvmDataParameterConditionMock = (
102
+ overrideResponse: Partial<EvmDataParameterCondition> = {},
103
+ ): EvmDataParameterCondition => ({
104
+ ...{
105
+ name: faker.string.alpha(20),
106
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
107
+ value: faker.string.alpha(20),
108
+ },
109
+ ...overrideResponse,
110
+ });
111
+
112
+ export const getListPoliciesResponseEvmDataParameterConditionListMock = (
113
+ overrideResponse: Partial<EvmDataParameterConditionList> = {},
114
+ ): EvmDataParameterConditionList => ({
115
+ ...{
116
+ name: faker.string.alpha(20),
117
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
118
+ values: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
119
+ faker.string.alpha(20),
120
+ ),
121
+ },
122
+ ...overrideResponse,
123
+ });
124
+
125
+ export const getListPoliciesResponseEvmDataCriterionMock = (
126
+ overrideResponse: Partial<EvmDataCriterion> = {},
127
+ ): EvmDataCriterion => ({
128
+ ...{
129
+ type: faker.helpers.arrayElement(["evmData"] as const),
130
+ abi: faker.helpers.arrayElement([
131
+ faker.helpers.arrayElement(Object.values(KnownAbiType)),
132
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
133
+ faker.helpers.arrayElement([
134
+ { ...getListPoliciesResponseAbiFunctionMock() },
135
+ { ...getListPoliciesResponseAbiInputMock() },
136
+ ]),
137
+ ),
138
+ ]),
139
+ conditions: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
140
+ () => ({
141
+ function: faker.string.alpha(20),
142
+ params: faker.helpers.arrayElement([
143
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
144
+ faker.helpers.arrayElement([
145
+ { ...getListPoliciesResponseEvmDataParameterConditionMock() },
146
+ { ...getListPoliciesResponseEvmDataParameterConditionListMock() },
147
+ ]),
148
+ ),
149
+ undefined,
150
+ ]),
151
+ }),
152
+ ),
153
+ },
154
+ ...overrideResponse,
155
+ });
156
+
46
157
  export const getListPoliciesResponseEvmNetworkCriterionMock = (
47
158
  overrideResponse: Partial<EvmNetworkCriterion> = {},
48
159
  ): EvmNetworkCriterion => ({
@@ -99,6 +210,7 @@ export const getListPoliciesResponseMock = (): ListPolicies200 => ({
99
210
  faker.helpers.arrayElement([
100
211
  { ...getListPoliciesResponseEthValueCriterionMock() },
101
212
  { ...getListPoliciesResponseEvmAddressCriterionMock() },
213
+ { ...getListPoliciesResponseEvmDataCriterionMock() },
102
214
  ]),
103
215
  ),
104
216
  },
@@ -113,6 +225,7 @@ export const getListPoliciesResponseMock = (): ListPolicies200 => ({
113
225
  { ...getListPoliciesResponseEthValueCriterionMock() },
114
226
  { ...getListPoliciesResponseEvmAddressCriterionMock() },
115
227
  { ...getListPoliciesResponseEvmNetworkCriterionMock() },
228
+ { ...getListPoliciesResponseEvmDataCriterionMock() },
116
229
  ]),
117
230
  ),
118
231
  },
@@ -178,6 +291,111 @@ export const getCreatePolicyResponseEvmAddressCriterionMock = (
178
291
  ...overrideResponse,
179
292
  });
180
293
 
294
+ export const getCreatePolicyResponseAbiFunctionMock = (
295
+ overrideResponse: Partial<AbiFunction> = {},
296
+ ): AbiFunction => ({
297
+ ...{
298
+ type: faker.helpers.arrayElement(["function"] as const),
299
+ name: faker.string.alpha(20),
300
+ inputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
301
+ () => ({
302
+ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
303
+ type: faker.string.alpha(20),
304
+ internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
305
+ components: faker.helpers.arrayElement([[], undefined]),
306
+ }),
307
+ ),
308
+ outputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
309
+ () => ({
310
+ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
311
+ type: faker.string.alpha(20),
312
+ internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
313
+ components: faker.helpers.arrayElement([[], undefined]),
314
+ }),
315
+ ),
316
+ constant: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
317
+ payable: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
318
+ stateMutability: faker.helpers.arrayElement(Object.values(AbiStateMutability)),
319
+ gas: faker.helpers.arrayElement([
320
+ faker.number.int({ min: undefined, max: undefined }),
321
+ undefined,
322
+ ]),
323
+ },
324
+ ...overrideResponse,
325
+ });
326
+
327
+ export const getCreatePolicyResponseAbiInputMock = (
328
+ overrideResponse: Partial<AbiInput> = {},
329
+ ): AbiInput => ({
330
+ ...{
331
+ type: faker.helpers.arrayElement([
332
+ "constructor",
333
+ "error",
334
+ "event",
335
+ "fallback",
336
+ "receive",
337
+ ] as const),
338
+ additionalProperties: faker.helpers.arrayElement([{}, undefined]),
339
+ },
340
+ ...overrideResponse,
341
+ });
342
+
343
+ export const getCreatePolicyResponseEvmDataParameterConditionMock = (
344
+ overrideResponse: Partial<EvmDataParameterCondition> = {},
345
+ ): EvmDataParameterCondition => ({
346
+ ...{
347
+ name: faker.string.alpha(20),
348
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
349
+ value: faker.string.alpha(20),
350
+ },
351
+ ...overrideResponse,
352
+ });
353
+
354
+ export const getCreatePolicyResponseEvmDataParameterConditionListMock = (
355
+ overrideResponse: Partial<EvmDataParameterConditionList> = {},
356
+ ): EvmDataParameterConditionList => ({
357
+ ...{
358
+ name: faker.string.alpha(20),
359
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
360
+ values: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
361
+ faker.string.alpha(20),
362
+ ),
363
+ },
364
+ ...overrideResponse,
365
+ });
366
+
367
+ export const getCreatePolicyResponseEvmDataCriterionMock = (
368
+ overrideResponse: Partial<EvmDataCriterion> = {},
369
+ ): EvmDataCriterion => ({
370
+ ...{
371
+ type: faker.helpers.arrayElement(["evmData"] as const),
372
+ abi: faker.helpers.arrayElement([
373
+ faker.helpers.arrayElement(Object.values(KnownAbiType)),
374
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
375
+ faker.helpers.arrayElement([
376
+ { ...getCreatePolicyResponseAbiFunctionMock() },
377
+ { ...getCreatePolicyResponseAbiInputMock() },
378
+ ]),
379
+ ),
380
+ ]),
381
+ conditions: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
382
+ () => ({
383
+ function: faker.string.alpha(20),
384
+ params: faker.helpers.arrayElement([
385
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
386
+ faker.helpers.arrayElement([
387
+ { ...getCreatePolicyResponseEvmDataParameterConditionMock() },
388
+ { ...getCreatePolicyResponseEvmDataParameterConditionListMock() },
389
+ ]),
390
+ ),
391
+ undefined,
392
+ ]),
393
+ }),
394
+ ),
395
+ },
396
+ ...overrideResponse,
397
+ });
398
+
181
399
  export const getCreatePolicyResponseEvmNetworkCriterionMock = (
182
400
  overrideResponse: Partial<EvmNetworkCriterion> = {},
183
401
  ): EvmNetworkCriterion => ({
@@ -230,6 +448,7 @@ export const getCreatePolicyResponseMock = (overrideResponse: Partial<Policy> =
230
448
  faker.helpers.arrayElement([
231
449
  { ...getCreatePolicyResponseEthValueCriterionMock() },
232
450
  { ...getCreatePolicyResponseEvmAddressCriterionMock() },
451
+ { ...getCreatePolicyResponseEvmDataCriterionMock() },
233
452
  ]),
234
453
  ),
235
454
  },
@@ -244,6 +463,7 @@ export const getCreatePolicyResponseMock = (overrideResponse: Partial<Policy> =
244
463
  { ...getCreatePolicyResponseEthValueCriterionMock() },
245
464
  { ...getCreatePolicyResponseEvmAddressCriterionMock() },
246
465
  { ...getCreatePolicyResponseEvmNetworkCriterionMock() },
466
+ { ...getCreatePolicyResponseEvmDataCriterionMock() },
247
467
  ]),
248
468
  ),
249
469
  },
@@ -302,6 +522,111 @@ export const getGetPolicyByIdResponseEvmAddressCriterionMock = (
302
522
  ...overrideResponse,
303
523
  });
304
524
 
525
+ export const getGetPolicyByIdResponseAbiFunctionMock = (
526
+ overrideResponse: Partial<AbiFunction> = {},
527
+ ): AbiFunction => ({
528
+ ...{
529
+ type: faker.helpers.arrayElement(["function"] as const),
530
+ name: faker.string.alpha(20),
531
+ inputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
532
+ () => ({
533
+ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
534
+ type: faker.string.alpha(20),
535
+ internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
536
+ components: faker.helpers.arrayElement([[], undefined]),
537
+ }),
538
+ ),
539
+ outputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
540
+ () => ({
541
+ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
542
+ type: faker.string.alpha(20),
543
+ internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
544
+ components: faker.helpers.arrayElement([[], undefined]),
545
+ }),
546
+ ),
547
+ constant: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
548
+ payable: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
549
+ stateMutability: faker.helpers.arrayElement(Object.values(AbiStateMutability)),
550
+ gas: faker.helpers.arrayElement([
551
+ faker.number.int({ min: undefined, max: undefined }),
552
+ undefined,
553
+ ]),
554
+ },
555
+ ...overrideResponse,
556
+ });
557
+
558
+ export const getGetPolicyByIdResponseAbiInputMock = (
559
+ overrideResponse: Partial<AbiInput> = {},
560
+ ): AbiInput => ({
561
+ ...{
562
+ type: faker.helpers.arrayElement([
563
+ "constructor",
564
+ "error",
565
+ "event",
566
+ "fallback",
567
+ "receive",
568
+ ] as const),
569
+ additionalProperties: faker.helpers.arrayElement([{}, undefined]),
570
+ },
571
+ ...overrideResponse,
572
+ });
573
+
574
+ export const getGetPolicyByIdResponseEvmDataParameterConditionMock = (
575
+ overrideResponse: Partial<EvmDataParameterCondition> = {},
576
+ ): EvmDataParameterCondition => ({
577
+ ...{
578
+ name: faker.string.alpha(20),
579
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
580
+ value: faker.string.alpha(20),
581
+ },
582
+ ...overrideResponse,
583
+ });
584
+
585
+ export const getGetPolicyByIdResponseEvmDataParameterConditionListMock = (
586
+ overrideResponse: Partial<EvmDataParameterConditionList> = {},
587
+ ): EvmDataParameterConditionList => ({
588
+ ...{
589
+ name: faker.string.alpha(20),
590
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
591
+ values: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
592
+ faker.string.alpha(20),
593
+ ),
594
+ },
595
+ ...overrideResponse,
596
+ });
597
+
598
+ export const getGetPolicyByIdResponseEvmDataCriterionMock = (
599
+ overrideResponse: Partial<EvmDataCriterion> = {},
600
+ ): EvmDataCriterion => ({
601
+ ...{
602
+ type: faker.helpers.arrayElement(["evmData"] as const),
603
+ abi: faker.helpers.arrayElement([
604
+ faker.helpers.arrayElement(Object.values(KnownAbiType)),
605
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
606
+ faker.helpers.arrayElement([
607
+ { ...getGetPolicyByIdResponseAbiFunctionMock() },
608
+ { ...getGetPolicyByIdResponseAbiInputMock() },
609
+ ]),
610
+ ),
611
+ ]),
612
+ conditions: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
613
+ () => ({
614
+ function: faker.string.alpha(20),
615
+ params: faker.helpers.arrayElement([
616
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
617
+ faker.helpers.arrayElement([
618
+ { ...getGetPolicyByIdResponseEvmDataParameterConditionMock() },
619
+ { ...getGetPolicyByIdResponseEvmDataParameterConditionListMock() },
620
+ ]),
621
+ ),
622
+ undefined,
623
+ ]),
624
+ }),
625
+ ),
626
+ },
627
+ ...overrideResponse,
628
+ });
629
+
305
630
  export const getGetPolicyByIdResponseEvmNetworkCriterionMock = (
306
631
  overrideResponse: Partial<EvmNetworkCriterion> = {},
307
632
  ): EvmNetworkCriterion => ({
@@ -354,6 +679,7 @@ export const getGetPolicyByIdResponseMock = (overrideResponse: Partial<Policy> =
354
679
  faker.helpers.arrayElement([
355
680
  { ...getGetPolicyByIdResponseEthValueCriterionMock() },
356
681
  { ...getGetPolicyByIdResponseEvmAddressCriterionMock() },
682
+ { ...getGetPolicyByIdResponseEvmDataCriterionMock() },
357
683
  ]),
358
684
  ),
359
685
  },
@@ -368,6 +694,7 @@ export const getGetPolicyByIdResponseMock = (overrideResponse: Partial<Policy> =
368
694
  { ...getGetPolicyByIdResponseEthValueCriterionMock() },
369
695
  { ...getGetPolicyByIdResponseEvmAddressCriterionMock() },
370
696
  { ...getGetPolicyByIdResponseEvmNetworkCriterionMock() },
697
+ { ...getGetPolicyByIdResponseEvmDataCriterionMock() },
371
698
  ]),
372
699
  ),
373
700
  },
@@ -426,6 +753,111 @@ export const getUpdatePolicyResponseEvmAddressCriterionMock = (
426
753
  ...overrideResponse,
427
754
  });
428
755
 
756
+ export const getUpdatePolicyResponseAbiFunctionMock = (
757
+ overrideResponse: Partial<AbiFunction> = {},
758
+ ): AbiFunction => ({
759
+ ...{
760
+ type: faker.helpers.arrayElement(["function"] as const),
761
+ name: faker.string.alpha(20),
762
+ inputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
763
+ () => ({
764
+ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
765
+ type: faker.string.alpha(20),
766
+ internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
767
+ components: faker.helpers.arrayElement([[], undefined]),
768
+ }),
769
+ ),
770
+ outputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
771
+ () => ({
772
+ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
773
+ type: faker.string.alpha(20),
774
+ internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
775
+ components: faker.helpers.arrayElement([[], undefined]),
776
+ }),
777
+ ),
778
+ constant: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
779
+ payable: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
780
+ stateMutability: faker.helpers.arrayElement(Object.values(AbiStateMutability)),
781
+ gas: faker.helpers.arrayElement([
782
+ faker.number.int({ min: undefined, max: undefined }),
783
+ undefined,
784
+ ]),
785
+ },
786
+ ...overrideResponse,
787
+ });
788
+
789
+ export const getUpdatePolicyResponseAbiInputMock = (
790
+ overrideResponse: Partial<AbiInput> = {},
791
+ ): AbiInput => ({
792
+ ...{
793
+ type: faker.helpers.arrayElement([
794
+ "constructor",
795
+ "error",
796
+ "event",
797
+ "fallback",
798
+ "receive",
799
+ ] as const),
800
+ additionalProperties: faker.helpers.arrayElement([{}, undefined]),
801
+ },
802
+ ...overrideResponse,
803
+ });
804
+
805
+ export const getUpdatePolicyResponseEvmDataParameterConditionMock = (
806
+ overrideResponse: Partial<EvmDataParameterCondition> = {},
807
+ ): EvmDataParameterCondition => ({
808
+ ...{
809
+ name: faker.string.alpha(20),
810
+ operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="] as const),
811
+ value: faker.string.alpha(20),
812
+ },
813
+ ...overrideResponse,
814
+ });
815
+
816
+ export const getUpdatePolicyResponseEvmDataParameterConditionListMock = (
817
+ overrideResponse: Partial<EvmDataParameterConditionList> = {},
818
+ ): EvmDataParameterConditionList => ({
819
+ ...{
820
+ name: faker.string.alpha(20),
821
+ operator: faker.helpers.arrayElement(["in", "not in"] as const),
822
+ values: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
823
+ faker.string.alpha(20),
824
+ ),
825
+ },
826
+ ...overrideResponse,
827
+ });
828
+
829
+ export const getUpdatePolicyResponseEvmDataCriterionMock = (
830
+ overrideResponse: Partial<EvmDataCriterion> = {},
831
+ ): EvmDataCriterion => ({
832
+ ...{
833
+ type: faker.helpers.arrayElement(["evmData"] as const),
834
+ abi: faker.helpers.arrayElement([
835
+ faker.helpers.arrayElement(Object.values(KnownAbiType)),
836
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
837
+ faker.helpers.arrayElement([
838
+ { ...getUpdatePolicyResponseAbiFunctionMock() },
839
+ { ...getUpdatePolicyResponseAbiInputMock() },
840
+ ]),
841
+ ),
842
+ ]),
843
+ conditions: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
844
+ () => ({
845
+ function: faker.string.alpha(20),
846
+ params: faker.helpers.arrayElement([
847
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
848
+ faker.helpers.arrayElement([
849
+ { ...getUpdatePolicyResponseEvmDataParameterConditionMock() },
850
+ { ...getUpdatePolicyResponseEvmDataParameterConditionListMock() },
851
+ ]),
852
+ ),
853
+ undefined,
854
+ ]),
855
+ }),
856
+ ),
857
+ },
858
+ ...overrideResponse,
859
+ });
860
+
429
861
  export const getUpdatePolicyResponseEvmNetworkCriterionMock = (
430
862
  overrideResponse: Partial<EvmNetworkCriterion> = {},
431
863
  ): EvmNetworkCriterion => ({
@@ -478,6 +910,7 @@ export const getUpdatePolicyResponseMock = (overrideResponse: Partial<Policy> =
478
910
  faker.helpers.arrayElement([
479
911
  { ...getUpdatePolicyResponseEthValueCriterionMock() },
480
912
  { ...getUpdatePolicyResponseEvmAddressCriterionMock() },
913
+ { ...getUpdatePolicyResponseEvmDataCriterionMock() },
481
914
  ]),
482
915
  ),
483
916
  },
@@ -492,6 +925,7 @@ export const getUpdatePolicyResponseMock = (overrideResponse: Partial<Policy> =
492
925
  { ...getUpdatePolicyResponseEthValueCriterionMock() },
493
926
  { ...getUpdatePolicyResponseEvmAddressCriterionMock() },
494
927
  { ...getUpdatePolicyResponseEvmNetworkCriterionMock() },
928
+ { ...getUpdatePolicyResponseEvmDataCriterionMock() },
495
929
  ]),
496
930
  ),
497
931
  },
@@ -35,6 +35,14 @@ export const getListSolanaAccountsResponseMock = (): ListSolanaAccounts200 => ({
35
35
  ),
36
36
  undefined,
37
37
  ]),
38
+ createdAt: faker.helpers.arrayElement([
39
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
40
+ undefined,
41
+ ]),
42
+ updatedAt: faker.helpers.arrayElement([
43
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
44
+ undefined,
45
+ ]),
38
46
  }),
39
47
  ),
40
48
  },
@@ -57,6 +65,14 @@ export const getCreateSolanaAccountResponseMock = (
57
65
  ),
58
66
  undefined,
59
67
  ]),
68
+ createdAt: faker.helpers.arrayElement([
69
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
70
+ undefined,
71
+ ]),
72
+ updatedAt: faker.helpers.arrayElement([
73
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
74
+ undefined,
75
+ ]),
60
76
  ...overrideResponse,
61
77
  });
62
78
 
@@ -76,6 +92,14 @@ export const getGetSolanaAccountResponseMock = (
76
92
  ),
77
93
  undefined,
78
94
  ]),
95
+ createdAt: faker.helpers.arrayElement([
96
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
97
+ undefined,
98
+ ]),
99
+ updatedAt: faker.helpers.arrayElement([
100
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
101
+ undefined,
102
+ ]),
79
103
  ...overrideResponse,
80
104
  });
81
105
 
@@ -95,6 +119,14 @@ export const getUpdateSolanaAccountResponseMock = (
95
119
  ),
96
120
  undefined,
97
121
  ]),
122
+ createdAt: faker.helpers.arrayElement([
123
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
124
+ undefined,
125
+ ]),
126
+ updatedAt: faker.helpers.arrayElement([
127
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
128
+ undefined,
129
+ ]),
98
130
  ...overrideResponse,
99
131
  });
100
132
 
@@ -114,6 +146,14 @@ export const getGetSolanaAccountByNameResponseMock = (
114
146
  ),
115
147
  undefined,
116
148
  ]),
149
+ createdAt: faker.helpers.arrayElement([
150
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
151
+ undefined,
152
+ ]),
153
+ updatedAt: faker.helpers.arrayElement([
154
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
155
+ undefined,
156
+ ]),
117
157
  ...overrideResponse,
118
158
  });
119
159
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-sdk",
3
- "version": "1.15.0",
3
+ "version": "1.17.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",