@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
@@ -38,6 +38,14 @@ export const getListEvmAccountsResponseMock = (): ListEvmAccounts200 => ({
38
38
  ),
39
39
  undefined,
40
40
  ]),
41
+ createdAt: faker.helpers.arrayElement([
42
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
43
+ undefined,
44
+ ]),
45
+ updatedAt: faker.helpers.arrayElement([
46
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
47
+ undefined,
48
+ ]),
41
49
  }),
42
50
  ),
43
51
  },
@@ -60,6 +68,14 @@ export const getCreateEvmAccountResponseMock = (
60
68
  ),
61
69
  undefined,
62
70
  ]),
71
+ createdAt: faker.helpers.arrayElement([
72
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
73
+ undefined,
74
+ ]),
75
+ updatedAt: faker.helpers.arrayElement([
76
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
77
+ undefined,
78
+ ]),
63
79
  ...overrideResponse,
64
80
  });
65
81
 
@@ -79,6 +95,14 @@ export const getGetEvmAccountResponseMock = (
79
95
  ),
80
96
  undefined,
81
97
  ]),
98
+ createdAt: faker.helpers.arrayElement([
99
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
100
+ undefined,
101
+ ]),
102
+ updatedAt: faker.helpers.arrayElement([
103
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
104
+ undefined,
105
+ ]),
82
106
  ...overrideResponse,
83
107
  });
84
108
 
@@ -98,6 +122,14 @@ export const getUpdateEvmAccountResponseMock = (
98
122
  ),
99
123
  undefined,
100
124
  ]),
125
+ createdAt: faker.helpers.arrayElement([
126
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
127
+ undefined,
128
+ ]),
129
+ updatedAt: faker.helpers.arrayElement([
130
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
131
+ undefined,
132
+ ]),
101
133
  ...overrideResponse,
102
134
  });
103
135
 
@@ -117,6 +149,14 @@ export const getGetEvmAccountByNameResponseMock = (
117
149
  ),
118
150
  undefined,
119
151
  ]),
152
+ createdAt: faker.helpers.arrayElement([
153
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
154
+ undefined,
155
+ ]),
156
+ updatedAt: faker.helpers.arrayElement([
157
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
158
+ undefined,
159
+ ]),
120
160
  ...overrideResponse,
121
161
  });
122
162
 
@@ -156,6 +196,14 @@ export const getImportEvmAccountResponseMock = (
156
196
  ),
157
197
  undefined,
158
198
  ]),
199
+ createdAt: faker.helpers.arrayElement([
200
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
201
+ undefined,
202
+ ]),
203
+ updatedAt: faker.helpers.arrayElement([
204
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
205
+ undefined,
206
+ ]),
159
207
  ...overrideResponse,
160
208
  });
161
209
 
@@ -27,6 +27,14 @@ export const getListEvmSmartAccountsResponseMock = (): ListEvmSmartAccounts200 =
27
27
  faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
28
28
  undefined,
29
29
  ]),
30
+ createdAt: faker.helpers.arrayElement([
31
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
32
+ undefined,
33
+ ]),
34
+ updatedAt: faker.helpers.arrayElement([
35
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
36
+ undefined,
37
+ ]),
30
38
  }),
31
39
  ),
32
40
  },
@@ -44,6 +52,14 @@ export const getCreateEvmSmartAccountResponseMock = (
44
52
  faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
45
53
  undefined,
46
54
  ]),
55
+ createdAt: faker.helpers.arrayElement([
56
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
57
+ undefined,
58
+ ]),
59
+ updatedAt: faker.helpers.arrayElement([
60
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
61
+ undefined,
62
+ ]),
47
63
  ...overrideResponse,
48
64
  });
49
65
 
@@ -58,6 +74,14 @@ export const getGetEvmSmartAccountByNameResponseMock = (
58
74
  faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
59
75
  undefined,
60
76
  ]),
77
+ createdAt: faker.helpers.arrayElement([
78
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
79
+ undefined,
80
+ ]),
81
+ updatedAt: faker.helpers.arrayElement([
82
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
83
+ undefined,
84
+ ]),
61
85
  ...overrideResponse,
62
86
  });
63
87
 
@@ -72,6 +96,14 @@ export const getGetEvmSmartAccountResponseMock = (
72
96
  faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
73
97
  undefined,
74
98
  ]),
99
+ createdAt: faker.helpers.arrayElement([
100
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
101
+ undefined,
102
+ ]),
103
+ updatedAt: faker.helpers.arrayElement([
104
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
105
+ undefined,
106
+ ]),
75
107
  ...overrideResponse,
76
108
  });
77
109
 
@@ -90,6 +122,7 @@ export const getPrepareUserOperationResponseMock = (
90
122
  "signed",
91
123
  "broadcast",
92
124
  "complete",
125
+ "dropped",
93
126
  "failed",
94
127
  ] as const),
95
128
  transactionHash: faker.helpers.arrayElement([
@@ -114,6 +147,7 @@ export const getGetUserOperationResponseMock = (
114
147
  "signed",
115
148
  "broadcast",
116
149
  "complete",
150
+ "dropped",
117
151
  "failed",
118
152
  ] as const),
119
153
  transactionHash: faker.helpers.arrayElement([
@@ -138,6 +172,7 @@ export const getSendUserOperationResponseMock = (
138
172
  "signed",
139
173
  "broadcast",
140
174
  "complete",
175
+ "dropped",
141
176
  "failed",
142
177
  ] as const),
143
178
  transactionHash: faker.helpers.arrayElement([
@@ -21,8 +21,8 @@ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
21
21
 
22
22
  Faucets are available for ETH, USDC, EURC, and cbBTC on Base Sepolia and Ethereum Sepolia, and for ETH only on Ethereum Hoodi.
23
23
 
24
- To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
25
- These limits are applied at both the CDP User level and the blockchain address level.
24
+ To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
25
+ These limits are applied at both the CDP User level and the blockchain address level.
26
26
  A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
27
27
 
28
28
  | Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
@@ -53,8 +53,8 @@ export const requestEvmFaucet = (
53
53
 
54
54
  Faucets are available for SOL.
55
55
 
56
- To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
57
- These limits are applied at both the CDP User level and the blockchain address level.
56
+ To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
57
+ These limits are applied at both the CDP User level and the blockchain address level.
58
58
  A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
59
59
 
60
60
  | Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
@@ -1,8 +1,8 @@
1
- export * from "./evm-accounts/evm-accounts.msw.js";
2
- export * from "./evm-swaps/evm-swaps.msw.js";
3
- export * from "./solana-accounts/solana-accounts.msw.js";
4
- export * from "./policy-engine/policy-engine.msw.js";
5
1
  export * from "./evm-token-balances/evm-token-balances.msw.js";
2
+ export * from "./evm-accounts/evm-accounts.msw.js";
3
+ export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
6
4
  export * from "./faucets/faucets.msw.js";
5
+ export * from "./evm-swaps/evm-swaps.msw.js";
7
6
  export * from "./payments-alpha/payments-alpha.msw.js";
8
- export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
7
+ export * from "./policy-engine/policy-engine.msw.js";
8
+ export * from "./solana-accounts/solana-accounts.msw.js";