@coinbase/cdp-sdk 1.1.1 → 1.2.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 (311) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/LICENSE +21 -0
  3. package/{dist → _cjs}/accounts/evm/toEvmServerAccount.js +1 -0
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -0
  5. package/{dist → _cjs}/accounts/evm/toEvmSmartAccount.js +1 -0
  6. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -0
  7. package/{dist → _cjs}/accounts/types.js +1 -0
  8. package/_cjs/accounts/types.js.map +1 -0
  9. package/{dist → _cjs}/actions/evm/sendUserOperation.js +1 -0
  10. package/_cjs/actions/evm/sendUserOperation.js.map +1 -0
  11. package/{dist → _cjs}/actions/evm/waitForUserOperation.js +10 -9
  12. package/_cjs/actions/evm/waitForUserOperation.js.map +1 -0
  13. package/{dist → _cjs}/analytics.js +7 -6
  14. package/_cjs/analytics.js.map +1 -0
  15. package/{dist → _cjs}/auth/errors.js +1 -0
  16. package/_cjs/auth/errors.js.map +1 -0
  17. package/{dist → _cjs}/auth/hooks/axios/index.js +2 -1
  18. package/_cjs/auth/hooks/axios/index.js.map +1 -0
  19. package/{dist → _cjs}/auth/hooks/axios/withAuth.js +3 -2
  20. package/_cjs/auth/hooks/axios/withAuth.js.map +1 -0
  21. package/{dist → _cjs}/auth/index.js +4 -3
  22. package/_cjs/auth/index.js.map +1 -0
  23. package/{dist → _cjs}/auth/utils/http.js +6 -5
  24. package/_cjs/auth/utils/http.js.map +1 -0
  25. package/{dist → _cjs}/auth/utils/index.js +3 -2
  26. package/_cjs/auth/utils/index.js.map +1 -0
  27. package/{dist → _cjs}/auth/utils/jwt.js +4 -3
  28. package/_cjs/auth/utils/jwt.js.map +1 -0
  29. package/{dist → _cjs}/client/cdp.js +13 -8
  30. package/_cjs/client/cdp.js.map +1 -0
  31. package/{dist → _cjs}/client/evm/evm.js +30 -28
  32. package/_cjs/client/evm/evm.js.map +1 -0
  33. package/{dist → _cjs}/client/evm/evm.types.js +1 -0
  34. package/_cjs/client/evm/evm.types.js.map +1 -0
  35. package/{dist → _cjs}/client/solana/index.js +3 -2
  36. package/_cjs/client/solana/index.js.map +1 -0
  37. package/{dist → _cjs}/client/solana/solana.js +9 -8
  38. package/_cjs/client/solana/solana.js.map +1 -0
  39. package/{dist → _cjs}/client/solana/solana.types.js +1 -0
  40. package/_cjs/client/solana/solana.types.js.map +1 -0
  41. package/{dist → _cjs}/constants.js +1 -0
  42. package/_cjs/constants.js.map +1 -0
  43. package/{dist → _cjs}/errors.js +1 -0
  44. package/_cjs/errors.js.map +1 -0
  45. package/{dist → _cjs}/index.js +4 -3
  46. package/_cjs/index.js.map +1 -0
  47. package/{dist → _cjs}/openapi-client/cdpApiClient.js +18 -14
  48. package/_cjs/openapi-client/cdpApiClient.js.map +1 -0
  49. package/{dist → _cjs}/openapi-client/errors.js +6 -0
  50. package/_cjs/openapi-client/errors.js.map +1 -0
  51. package/{dist → _cjs}/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +31 -30
  52. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -0
  53. package/{dist → _cjs}/openapi-client/generated/evm-accounts/evm-accounts.js +46 -41
  54. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -0
  55. package/{dist → _cjs}/openapi-client/generated/evm-accounts/evm-accounts.msw.js +73 -40
  56. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -0
  57. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +69 -0
  58. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -0
  59. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +188 -0
  60. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -0
  61. package/{dist → _cjs}/openapi-client/generated/faucets/faucets.js +18 -13
  62. package/_cjs/openapi-client/generated/faucets/faucets.js.map +1 -0
  63. package/{dist → _cjs}/openapi-client/generated/faucets/faucets.msw.js +16 -12
  64. package/_cjs/openapi-client/generated/faucets/faucets.msw.js.map +1 -0
  65. package/{dist → _cjs}/openapi-client/generated/index.msw.js +5 -4
  66. package/_cjs/openapi-client/generated/index.msw.js.map +1 -0
  67. package/{dist → _cjs}/openapi-client/generated/solana-accounts/solana-accounts.js +38 -35
  68. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -0
  69. package/{dist → _cjs}/openapi-client/generated/solana-accounts/solana-accounts.msw.js +68 -35
  70. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -0
  71. package/{dist → _cjs}/openapi-client/index.js +12 -11
  72. package/_cjs/openapi-client/index.js.map +1 -0
  73. package/_cjs/package.json +1 -0
  74. package/{dist → _cjs}/types/calls.js +1 -0
  75. package/_cjs/types/calls.js.map +1 -0
  76. package/{dist → _cjs}/types/contract.js +1 -0
  77. package/_cjs/types/contract.js.map +1 -0
  78. package/{dist → _cjs}/types/misc.js +1 -0
  79. package/_cjs/types/misc.js.map +1 -0
  80. package/{dist → _cjs}/types/multicall.js +1 -0
  81. package/_cjs/types/multicall.js.map +1 -0
  82. package/{dist → _cjs}/types/utils.js +1 -0
  83. package/_cjs/types/utils.js.map +1 -0
  84. package/{dist → _cjs}/utils/wait.js +3 -2
  85. package/_cjs/utils/wait.js.map +1 -0
  86. package/_cjs/version.js +5 -0
  87. package/_cjs/version.js.map +1 -0
  88. package/_esm/accounts/evm/toEvmServerAccount.js +40 -0
  89. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -0
  90. package/_esm/accounts/evm/toEvmSmartAccount.js +22 -0
  91. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -0
  92. package/_esm/accounts/types.js +2 -0
  93. package/_esm/accounts/types.js.map +1 -0
  94. package/_esm/actions/evm/sendUserOperation.js +85 -0
  95. package/_esm/actions/evm/sendUserOperation.js.map +1 -0
  96. package/_esm/actions/evm/waitForUserOperation.js +58 -0
  97. package/_esm/actions/evm/waitForUserOperation.js.map +1 -0
  98. package/_esm/analytics.js +84 -0
  99. package/_esm/analytics.js.map +1 -0
  100. package/_esm/auth/errors.js +57 -0
  101. package/_esm/auth/errors.js.map +1 -0
  102. package/_esm/auth/hooks/axios/index.js +2 -0
  103. package/_esm/auth/hooks/axios/index.js.map +1 -0
  104. package/_esm/auth/hooks/axios/withAuth.js +71 -0
  105. package/_esm/auth/hooks/axios/withAuth.js.map +1 -0
  106. package/_esm/auth/index.js +5 -0
  107. package/_esm/auth/index.js.map +1 -0
  108. package/_esm/auth/utils/http.js +70 -0
  109. package/_esm/auth/utils/http.js.map +1 -0
  110. package/_esm/auth/utils/index.js +3 -0
  111. package/_esm/auth/utils/index.js.map +1 -0
  112. package/_esm/auth/utils/jwt.js +199 -0
  113. package/_esm/auth/utils/jwt.js.map +1 -0
  114. package/_esm/client/cdp.js +95 -0
  115. package/_esm/client/cdp.js.map +1 -0
  116. package/_esm/client/evm/evm.js +518 -0
  117. package/_esm/client/evm/evm.js.map +1 -0
  118. package/_esm/client/evm/evm.types.js +2 -0
  119. package/_esm/client/evm/evm.types.js.map +1 -0
  120. package/_esm/client/solana/index.js +2 -0
  121. package/_esm/client/solana/index.js.map +1 -0
  122. package/_esm/client/solana/solana.js +204 -0
  123. package/_esm/client/solana/solana.js.map +1 -0
  124. package/_esm/client/solana/solana.types.js +2 -0
  125. package/_esm/client/solana/solana.types.js.map +1 -0
  126. package/_esm/constants.js +5 -0
  127. package/_esm/constants.js.map +1 -0
  128. package/_esm/errors.js +18 -0
  129. package/_esm/errors.js.map +1 -0
  130. package/_esm/index.js +3 -0
  131. package/_esm/index.js.map +1 -0
  132. package/_esm/openapi-client/cdpApiClient.js +112 -0
  133. package/_esm/openapi-client/cdpApiClient.js.map +1 -0
  134. package/_esm/openapi-client/errors.js +71 -0
  135. package/_esm/openapi-client/errors.js.map +1 -0
  136. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +52 -0
  137. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -0
  138. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js +80 -0
  139. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -0
  140. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js +128 -0
  141. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -0
  142. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +60 -0
  143. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -0
  144. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +172 -0
  145. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -0
  146. package/_esm/openapi-client/generated/faucets/faucets.js +51 -0
  147. package/_esm/openapi-client/generated/faucets/faucets.js.map +1 -0
  148. package/_esm/openapi-client/generated/faucets/faucets.msw.js +39 -0
  149. package/_esm/openapi-client/generated/faucets/faucets.msw.js.map +1 -0
  150. package/_esm/openapi-client/generated/index.msw.js +5 -0
  151. package/_esm/openapi-client/generated/index.msw.js.map +1 -0
  152. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +73 -0
  153. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -0
  154. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +116 -0
  155. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -0
  156. package/_esm/openapi-client/index.js +27 -0
  157. package/_esm/openapi-client/index.js.map +1 -0
  158. package/_esm/package.json +1 -0
  159. package/_esm/types/calls.js +4 -0
  160. package/_esm/types/calls.js.map +1 -0
  161. package/_esm/types/contract.js +4 -0
  162. package/_esm/types/contract.js.map +1 -0
  163. package/_esm/types/misc.js +3 -0
  164. package/_esm/types/misc.js.map +1 -0
  165. package/_esm/types/multicall.js +2 -0
  166. package/_esm/types/multicall.js.map +1 -0
  167. package/_esm/types/utils.js +4 -0
  168. package/_esm/types/utils.js.map +1 -0
  169. package/_esm/utils/wait.js +32 -0
  170. package/_esm/utils/wait.js.map +1 -0
  171. package/_esm/version.js +2 -0
  172. package/_esm/version.js.map +1 -0
  173. package/{dist → _types}/accounts/evm/toEvmServerAccount.d.ts +3 -2
  174. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -0
  175. package/{dist → _types}/accounts/evm/toEvmSmartAccount.d.ts +3 -2
  176. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -0
  177. package/{dist → _types}/accounts/types.d.ts +3 -2
  178. package/_types/accounts/types.d.ts.map +1 -0
  179. package/{dist → _types}/actions/evm/sendUserOperation.d.ts +5 -5
  180. package/_types/actions/evm/sendUserOperation.d.ts.map +1 -0
  181. package/{dist → _types}/actions/evm/waitForUserOperation.d.ts +4 -3
  182. package/_types/actions/evm/waitForUserOperation.d.ts.map +1 -0
  183. package/{dist → _types}/analytics.d.ts +1 -0
  184. package/_types/analytics.d.ts.map +1 -0
  185. package/{dist → _types}/auth/errors.d.ts +1 -0
  186. package/_types/auth/errors.d.ts.map +1 -0
  187. package/_types/auth/hooks/axios/index.d.ts +2 -0
  188. package/_types/auth/hooks/axios/index.d.ts.map +1 -0
  189. package/{dist → _types}/auth/hooks/axios/withAuth.d.ts +1 -0
  190. package/_types/auth/hooks/axios/withAuth.d.ts.map +1 -0
  191. package/_types/auth/index.d.ts +5 -0
  192. package/_types/auth/index.d.ts.map +1 -0
  193. package/{dist → _types}/auth/utils/http.d.ts +1 -0
  194. package/_types/auth/utils/http.d.ts.map +1 -0
  195. package/_types/auth/utils/index.d.ts +3 -0
  196. package/_types/auth/utils/index.d.ts.map +1 -0
  197. package/{dist → _types}/auth/utils/jwt.d.ts +1 -0
  198. package/_types/auth/utils/jwt.d.ts.map +1 -0
  199. package/{dist → _types}/client/cdp.d.ts +3 -2
  200. package/_types/client/cdp.d.ts.map +1 -0
  201. package/{dist → _types}/client/evm/evm.d.ts +4 -3
  202. package/_types/client/evm/evm.d.ts.map +1 -0
  203. package/{dist → _types}/client/evm/evm.types.d.ts +7 -6
  204. package/_types/client/evm/evm.types.d.ts.map +1 -0
  205. package/_types/client/solana/index.d.ts +2 -0
  206. package/_types/client/solana/index.d.ts.map +1 -0
  207. package/{dist → _types}/client/solana/solana.d.ts +2 -1
  208. package/_types/client/solana/solana.d.ts.map +1 -0
  209. package/{dist → _types}/client/solana/solana.types.d.ts +2 -1
  210. package/_types/client/solana/solana.types.d.ts.map +1 -0
  211. package/{dist → _types}/constants.d.ts +1 -0
  212. package/_types/constants.d.ts.map +1 -0
  213. package/{dist → _types}/errors.d.ts +1 -0
  214. package/_types/errors.d.ts.map +1 -0
  215. package/_types/index.d.ts +4 -0
  216. package/_types/index.d.ts.map +1 -0
  217. package/{dist → _types}/openapi-client/cdpApiClient.d.ts +1 -0
  218. package/_types/openapi-client/cdpApiClient.d.ts.map +1 -0
  219. package/{dist → _types}/openapi-client/errors.d.ts +2 -1
  220. package/_types/openapi-client/errors.d.ts.map +1 -0
  221. package/{dist → _types}/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +13 -12
  222. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -0
  223. package/{dist → _types}/openapi-client/generated/evm-accounts/evm-accounts.d.ts +24 -23
  224. package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts.map +1 -0
  225. package/{dist → _types}/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts +3 -2
  226. package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts.map +1 -0
  227. package/{dist → _types}/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +21 -20
  228. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -0
  229. package/{dist → _types}/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +3 -2
  230. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -0
  231. package/{dist → _types}/openapi-client/generated/faucets/faucets.d.ts +9 -8
  232. package/_types/openapi-client/generated/faucets/faucets.d.ts.map +1 -0
  233. package/{dist → _types}/openapi-client/generated/faucets/faucets.msw.d.ts +3 -2
  234. package/_types/openapi-client/generated/faucets/faucets.msw.d.ts.map +1 -0
  235. package/_types/openapi-client/generated/index.msw.d.ts +5 -0
  236. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -0
  237. package/{dist → _types}/openapi-client/generated/solana-accounts/solana-accounts.d.ts +21 -20
  238. package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -0
  239. package/{dist → _types}/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +3 -2
  240. package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -0
  241. package/_types/openapi-client/index.d.ts +56 -0
  242. package/_types/openapi-client/index.d.ts.map +1 -0
  243. package/{dist → _types}/types/calls.d.ts +4 -3
  244. package/_types/types/calls.d.ts.map +1 -0
  245. package/{dist → _types}/types/contract.d.ts +3 -2
  246. package/_types/types/contract.d.ts.map +1 -0
  247. package/{dist → _types}/types/misc.d.ts +1 -0
  248. package/_types/types/misc.d.ts.map +1 -0
  249. package/{dist → _types}/types/multicall.d.ts +2 -1
  250. package/_types/types/multicall.d.ts.map +1 -0
  251. package/{dist → _types}/types/utils.d.ts +1 -0
  252. package/_types/types/utils.d.ts.map +1 -0
  253. package/{dist → _types}/utils/wait.d.ts +1 -0
  254. package/_types/utils/wait.d.ts.map +1 -0
  255. package/_types/version.d.ts +2 -0
  256. package/_types/version.d.ts.map +1 -0
  257. package/accounts/evm/toEvmServerAccount.ts +60 -0
  258. package/accounts/evm/toEvmSmartAccount.ts +37 -0
  259. package/accounts/types.ts +53 -0
  260. package/actions/evm/sendUserOperation.ts +163 -0
  261. package/actions/evm/waitForUserOperation.ts +115 -0
  262. package/analytics.ts +123 -0
  263. package/auth/README.md +145 -0
  264. package/auth/errors.ts +59 -0
  265. package/auth/hooks/axios/index.ts +1 -0
  266. package/auth/hooks/axios/withAuth.ts +120 -0
  267. package/auth/index.ts +5 -0
  268. package/auth/utils/http.ts +146 -0
  269. package/auth/utils/index.ts +2 -0
  270. package/auth/utils/jwt.ts +324 -0
  271. package/client/cdp.ts +113 -0
  272. package/client/evm/evm.ts +606 -0
  273. package/client/evm/evm.types.ts +303 -0
  274. package/client/solana/index.ts +1 -0
  275. package/client/solana/solana.ts +237 -0
  276. package/client/solana/solana.types.ts +114 -0
  277. package/constants.ts +4 -0
  278. package/errors.ts +17 -0
  279. package/index.ts +4 -0
  280. package/openapi-client/cdpApiClient.ts +214 -0
  281. package/openapi-client/errors.ts +96 -0
  282. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +411 -0
  283. package/openapi-client/generated/evm-accounts/evm-accounts.msw.ts +242 -0
  284. package/openapi-client/generated/evm-accounts/evm-accounts.ts +150 -0
  285. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +283 -0
  286. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +131 -0
  287. package/openapi-client/generated/faucets/faucets.msw.ts +76 -0
  288. package/openapi-client/generated/faucets/faucets.ts +83 -0
  289. package/openapi-client/generated/index.msw.ts +4 -0
  290. package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +219 -0
  291. package/openapi-client/generated/solana-accounts/solana-accounts.ts +143 -0
  292. package/openapi-client/index.ts +32 -0
  293. package/package.json +31 -66
  294. package/types/calls.ts +40 -0
  295. package/types/contract.ts +126 -0
  296. package/types/misc.ts +5 -0
  297. package/types/multicall.ts +29 -0
  298. package/types/utils.ts +288 -0
  299. package/utils/wait.ts +52 -0
  300. package/version.ts +1 -0
  301. package/dist/auth/hooks/axios/index.d.ts +0 -1
  302. package/dist/auth/index.d.ts +0 -4
  303. package/dist/auth/utils/index.d.ts +0 -2
  304. package/dist/client/evm/index.d.ts +0 -1
  305. package/dist/client/evm/index.js +0 -5
  306. package/dist/client/solana/index.d.ts +0 -1
  307. package/dist/index.d.ts +0 -3
  308. package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +0 -66
  309. package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +0 -99
  310. package/dist/openapi-client/generated/index.msw.d.ts +0 -4
  311. package/dist/openapi-client/index.d.ts +0 -55
@@ -0,0 +1,411 @@
1
+ /**
2
+ * Generated by orval v7.6.0 🍺
3
+ * Do not edit manually.
4
+ * Coinbase Developer Platform APIs
5
+ * The Coinbase Developer Platform APIs - leading the world's transition onchain.
6
+ * OpenAPI spec version: 2.0.0
7
+ */
8
+ export interface EvmAccount {
9
+ /**
10
+ * The 0x-prefixed, checksum EVM address.
11
+ * @pattern ^0x[0-9a-fA-F]{40}$
12
+ */
13
+ address: string;
14
+ /**
15
+ * An optional name for the account.
16
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
17
+ Account names are guaranteed to be unique across all EVM accounts in the developer's CDP Project.
18
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
19
+ */
20
+ name?: string;
21
+ }
22
+
23
+ export interface ListResponse {
24
+ /** The token for the next page of items, if any. */
25
+ nextPageToken?: string;
26
+ }
27
+
28
+ /**
29
+ * The code that indicates the type of error that occurred. These error codes can be used to determine how to handle the error.
30
+ */
31
+ export type ErrorType = (typeof ErrorType)[keyof typeof ErrorType];
32
+
33
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
34
+ export const ErrorType = {
35
+ already_exists: "already_exists",
36
+ faucet_limit_exceeded: "faucet_limit_exceeded",
37
+ forbidden: "forbidden",
38
+ idempotency_error: "idempotency_error",
39
+ internal_server_error: "internal_server_error",
40
+ invalid_request: "invalid_request",
41
+ invalid_signature: "invalid_signature",
42
+ malformed_transaction: "malformed_transaction",
43
+ not_found: "not_found",
44
+ rate_limit_exceeded: "rate_limit_exceeded",
45
+ request_canceled: "request_canceled",
46
+ timed_out: "timed_out",
47
+ unauthorized: "unauthorized",
48
+ } as const;
49
+
50
+ /**
51
+ * An error response including the code for the type of error and a human-readable message describing the error.
52
+ */
53
+ export interface Error {
54
+ errorType: ErrorType;
55
+ /** The error message. */
56
+ errorMessage: string;
57
+ /** A unique identifier for the request that generated the error. This can be used to help debug issues with the API. */
58
+ correlationId?: string;
59
+ /** A link to the corresponding error documentation. */
60
+ errorLink?: string;
61
+ }
62
+
63
+ export interface EvmSmartAccount {
64
+ /**
65
+ * The 0x-prefixed, checksum address of the Smart Account.
66
+ * @pattern ^0x[0-9a-fA-F]{40}$
67
+ */
68
+ address: string;
69
+ /** Today, only a single owner can be set for a Smart Account, but this is an array to allow having multiple owners in the future. The address is a 0x-prefixed, checksum address. */
70
+ owners: string[];
71
+ /**
72
+ * An optional name for the account.
73
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
74
+ Account names are guaranteed to be unique across all Smart Accounts in the developer's CDP Project.
75
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
76
+ */
77
+ name?: string;
78
+ }
79
+
80
+ export interface EvmCall {
81
+ /**
82
+ * The address the call is directed to.
83
+ * @pattern ^0x[0-9a-fA-F]{40}$
84
+ */
85
+ to: string;
86
+ /** The amount of ETH to send with the call, in wei. */
87
+ value: string;
88
+ /**
89
+ * The call data to send. This is the hex-encoded data of the function call consisting of the method selector and the function arguments.
90
+ * @pattern ^0x[0-9a-fA-F]*$
91
+ */
92
+ data: string;
93
+ }
94
+
95
+ /**
96
+ * The network the user operation is for.
97
+ */
98
+ export type EvmUserOperationNetwork =
99
+ (typeof EvmUserOperationNetwork)[keyof typeof EvmUserOperationNetwork];
100
+
101
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
102
+ export const EvmUserOperationNetwork = {
103
+ "base-sepolia": "base-sepolia",
104
+ base: "base",
105
+ } as const;
106
+
107
+ /**
108
+ * The status of the user operation.
109
+ */
110
+ export type EvmUserOperationStatus =
111
+ (typeof EvmUserOperationStatus)[keyof typeof EvmUserOperationStatus];
112
+
113
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
114
+ export const EvmUserOperationStatus = {
115
+ pending: "pending",
116
+ signed: "signed",
117
+ broadcast: "broadcast",
118
+ complete: "complete",
119
+ failed: "failed",
120
+ } as const;
121
+
122
+ export interface EvmUserOperation {
123
+ /** The network the user operation is for. */
124
+ network: EvmUserOperationNetwork;
125
+ /**
126
+ * The hash of the user operation. This is not the transaction hash, as a transaction consists of multiple user operations. The user operation hash is the hash of this particular user operation which gets signed by the owner of the Smart Account.
127
+ * @pattern ^0x[0-9a-fA-F]{64}$
128
+ */
129
+ userOpHash: string;
130
+ /** The list of calls in the user operation. */
131
+ calls: EvmCall[];
132
+ /** The status of the user operation. */
133
+ status: EvmUserOperationStatus;
134
+ /**
135
+ * The hash of the transaction that included this particular user operation. This gets set after the user operation is broadcasted and the transaction is included in a block.
136
+ * @pattern ^0x[0-9a-fA-F]{64}$|^$
137
+ */
138
+ transactionHash?: string;
139
+ }
140
+
141
+ export interface SolanaAccount {
142
+ /**
143
+ * The base58 encoded Solana address.
144
+ * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
145
+ */
146
+ address: string;
147
+ /**
148
+ * An optional name for the account.
149
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
150
+ Account names are guaranteed to be unique across all Solana accounts in the developer's CDP Project.
151
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
152
+ */
153
+ name?: string;
154
+ }
155
+
156
+ /**
157
+ * Internal server error.
158
+ */
159
+ export type InternalServerErrorResponse = Error;
160
+
161
+ /**
162
+ * Idempotency key conflict.
163
+ */
164
+ export type IdempotencyErrorResponse = Error;
165
+
166
+ /**
167
+ * The resource already exists.
168
+ */
169
+ export type AlreadyExistsErrorResponse = Error;
170
+
171
+ /**
172
+ * A JWT signed using your Wallet Secret, encoded in base64. Refer to the
173
+ [Generate a Wallet Token](https://docs.cdp.coinbase.com/api-v2/docs/authentication#3-generate-a-wallet-token)
174
+ section of our Authentication docs for more details on how to generate your Wallet Token.
175
+
176
+ */
177
+ export type XWalletAuthParameter = string;
178
+
179
+ /**
180
+ * An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
181
+ When included, duplicate requests with the same key will return identical responses.
182
+ Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-v2/docs/idempotency) for more information on using idempotency keys.
183
+
184
+ */
185
+ export type IdempotencyKeyParameter = string;
186
+
187
+ export type ListEvmAccountsParams = {
188
+ /**
189
+ * The number of accounts to return per page.
190
+ */
191
+ pageSize?: number;
192
+ /**
193
+ * The token for the next page of accounts, if any.
194
+ */
195
+ pageToken?: string;
196
+ };
197
+
198
+ export type ListEvmAccounts200AllOf = {
199
+ /** The list of EVM accounts. */
200
+ accounts: EvmAccount[];
201
+ };
202
+
203
+ export type ListEvmAccounts200 = ListEvmAccounts200AllOf & ListResponse;
204
+
205
+ export type CreateEvmAccountBody = {
206
+ /**
207
+ * An optional name for the account.
208
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
209
+ Account names must be unique across all EVM accounts in the developer's CDP Project.
210
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
211
+ */
212
+ name?: string;
213
+ };
214
+
215
+ export type SignEvmTransactionBody = {
216
+ /** The RLP-encoded transaction to sign, as a 0x-prefixed hex string. */
217
+ transaction: string;
218
+ };
219
+
220
+ export type SignEvmTransaction200 = {
221
+ /** The RLP-encoded signed transaction, as a 0x-prefixed hex string. */
222
+ signedTransaction: string;
223
+ };
224
+
225
+ export type SignEvmHashBody = {
226
+ /** The arbitrary 32 byte hash to sign. */
227
+ hash: string;
228
+ };
229
+
230
+ export type SignEvmHash200 = {
231
+ /** The signature of the hash, as a 0x-prefixed hex string. */
232
+ signature: string;
233
+ };
234
+
235
+ export type SignEvmMessageBody = {
236
+ /** The message to sign. */
237
+ message: string;
238
+ };
239
+
240
+ export type SignEvmMessage200 = {
241
+ /** The signature of the message, as a 0x-prefixed hex string. */
242
+ signature: string;
243
+ };
244
+
245
+ export type ListEvmSmartAccountsParams = {
246
+ /**
247
+ * The number of accounts to return per page.
248
+ */
249
+ pageSize?: number;
250
+ /**
251
+ * The token for the next page of accounts, if any.
252
+ */
253
+ pageToken?: string;
254
+ };
255
+
256
+ export type ListEvmSmartAccounts200AllOf = {
257
+ /** The list of Smart Accounts. */
258
+ accounts: EvmSmartAccount[];
259
+ };
260
+
261
+ export type ListEvmSmartAccounts200 = ListEvmSmartAccounts200AllOf & ListResponse;
262
+
263
+ export type CreateEvmSmartAccountBody = {
264
+ /** Today, only a single owner can be set for a Smart Account, but this is an array to allow setting multiple owners in the future. */
265
+ owners: string[];
266
+ };
267
+
268
+ /**
269
+ * The network to prepare the user operation for.
270
+ */
271
+ export type PrepareUserOperationBodyNetwork =
272
+ (typeof PrepareUserOperationBodyNetwork)[keyof typeof PrepareUserOperationBodyNetwork];
273
+
274
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
275
+ export const PrepareUserOperationBodyNetwork = {
276
+ "base-sepolia": "base-sepolia",
277
+ base: "base",
278
+ } as const;
279
+
280
+ export type PrepareUserOperationBody = {
281
+ /** The network to prepare the user operation for. */
282
+ network: PrepareUserOperationBodyNetwork;
283
+ /** The list of calls to make from the Smart Account. */
284
+ calls: EvmCall[];
285
+ /** The URL of the paymaster to use for the user operation. */
286
+ paymasterUrl?: string;
287
+ };
288
+
289
+ export type SendUserOperationBody = {
290
+ /** The hex-encoded signature of the user operation. */
291
+ signature: string;
292
+ };
293
+
294
+ /**
295
+ * The network to request funds from.
296
+ */
297
+ export type RequestEvmFaucetBodyNetwork =
298
+ (typeof RequestEvmFaucetBodyNetwork)[keyof typeof RequestEvmFaucetBodyNetwork];
299
+
300
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
301
+ export const RequestEvmFaucetBodyNetwork = {
302
+ "base-sepolia": "base-sepolia",
303
+ "ethereum-sepolia": "ethereum-sepolia",
304
+ } as const;
305
+
306
+ /**
307
+ * The token to request funds for.
308
+ */
309
+ export type RequestEvmFaucetBodyToken =
310
+ (typeof RequestEvmFaucetBodyToken)[keyof typeof RequestEvmFaucetBodyToken];
311
+
312
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
313
+ export const RequestEvmFaucetBodyToken = {
314
+ eth: "eth",
315
+ usdc: "usdc",
316
+ eurc: "eurc",
317
+ cbbtc: "cbbtc",
318
+ } as const;
319
+
320
+ export type RequestEvmFaucetBody = {
321
+ /** The network to request funds from. */
322
+ network: RequestEvmFaucetBodyNetwork;
323
+ /**
324
+ * The address to request funds to, which is a 0x-prefixed hexadecimal string.
325
+ * @pattern ^0x[0-9a-fA-F]{40}$
326
+ */
327
+ address: string;
328
+ /** The token to request funds for. */
329
+ token: RequestEvmFaucetBodyToken;
330
+ };
331
+
332
+ export type RequestEvmFaucet200 = {
333
+ /** The hash of the transaction that requested the funds.
334
+ **Note:** In rare cases, when gas conditions are unusually high, the transaction may not confirm, and the system may issue a replacement transaction to complete the faucet request. In these rare cases, the `transactionHash` will be out of sync with the actual faucet transaction that was confirmed onchain. */
335
+ transactionHash: string;
336
+ };
337
+
338
+ export type ListSolanaAccountsParams = {
339
+ /**
340
+ * The number of accounts to return per page.
341
+ */
342
+ pageSize?: number;
343
+ /**
344
+ * The token for the next page of accounts, if any.
345
+ */
346
+ pageToken?: string;
347
+ };
348
+
349
+ export type ListSolanaAccounts200AllOf = {
350
+ /** The list of Solana accounts. */
351
+ accounts: SolanaAccount[];
352
+ };
353
+
354
+ export type ListSolanaAccounts200 = ListSolanaAccounts200AllOf & ListResponse;
355
+
356
+ export type CreateSolanaAccountBody = {
357
+ /**
358
+ * An optional name for the account.
359
+ Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
360
+ Account names must be unique across all Solana accounts in the developer's CDP Project.
361
+ * @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
362
+ */
363
+ name?: string;
364
+ };
365
+
366
+ export type SignSolanaTransactionBody = {
367
+ /** The base64 encoded transaction to sign. */
368
+ transaction: string;
369
+ };
370
+
371
+ export type SignSolanaTransaction200 = {
372
+ /** The base64 encoded signed transaction. */
373
+ signedTransaction: string;
374
+ };
375
+
376
+ export type SignSolanaMessageBody = {
377
+ /** The arbitrary message to sign. */
378
+ message: string;
379
+ };
380
+
381
+ export type SignSolanaMessage200 = {
382
+ /** The signature of the message, as a base58 encoded string. */
383
+ signature: string;
384
+ };
385
+
386
+ /**
387
+ * The token to request funds for.
388
+ */
389
+ export type RequestSolanaFaucetBodyToken =
390
+ (typeof RequestSolanaFaucetBodyToken)[keyof typeof RequestSolanaFaucetBodyToken];
391
+
392
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
393
+ export const RequestSolanaFaucetBodyToken = {
394
+ sol: "sol",
395
+ usdc: "usdc",
396
+ } as const;
397
+
398
+ export type RequestSolanaFaucetBody = {
399
+ /**
400
+ * The address to request funds to, which is a base58-encoded string.
401
+ * @pattern ^[1-9A-HJ-NP-Za-km-z]{32,44}$
402
+ */
403
+ address: string;
404
+ /** The token to request funds for. */
405
+ token: RequestSolanaFaucetBodyToken;
406
+ };
407
+
408
+ export type RequestSolanaFaucet200 = {
409
+ /** The signature identifying the transaction that requested the funds. */
410
+ transactionSignature: string;
411
+ };
@@ -0,0 +1,242 @@
1
+ /**
2
+ * Generated by orval v7.6.0 🍺
3
+ * Do not edit manually.
4
+ * Coinbase Developer Platform APIs
5
+ * The Coinbase Developer Platform APIs - leading the world's transition onchain.
6
+ * OpenAPI spec version: 2.0.0
7
+ */
8
+ import { faker } from "@faker-js/faker";
9
+
10
+ import { HttpResponse, delay, http } from "msw";
11
+
12
+ import type {
13
+ EvmAccount,
14
+ ListEvmAccounts200,
15
+ SignEvmHash200,
16
+ SignEvmMessage200,
17
+ SignEvmTransaction200,
18
+ } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
19
+
20
+ export const getListEvmAccountsResponseMock = (): ListEvmAccounts200 => ({
21
+ ...{
22
+ accounts: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
23
+ () => ({
24
+ address: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
25
+ name: faker.helpers.arrayElement([
26
+ faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
27
+ undefined,
28
+ ]),
29
+ }),
30
+ ),
31
+ },
32
+ ...{ nextPageToken: faker.helpers.arrayElement([faker.string.alpha(20), undefined]) },
33
+ });
34
+
35
+ export const getCreateEvmAccountResponseMock = (
36
+ overrideResponse: Partial<EvmAccount> = {},
37
+ ): EvmAccount => ({
38
+ address: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
39
+ name: faker.helpers.arrayElement([
40
+ faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
41
+ undefined,
42
+ ]),
43
+ ...overrideResponse,
44
+ });
45
+
46
+ export const getGetEvmAccountResponseMock = (
47
+ overrideResponse: Partial<EvmAccount> = {},
48
+ ): EvmAccount => ({
49
+ address: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
50
+ name: faker.helpers.arrayElement([
51
+ faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
52
+ undefined,
53
+ ]),
54
+ ...overrideResponse,
55
+ });
56
+
57
+ export const getGetEvmAccountByNameResponseMock = (
58
+ overrideResponse: Partial<EvmAccount> = {},
59
+ ): EvmAccount => ({
60
+ address: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
61
+ name: faker.helpers.arrayElement([
62
+ faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
63
+ undefined,
64
+ ]),
65
+ ...overrideResponse,
66
+ });
67
+
68
+ export const getSignEvmTransactionResponseMock = (
69
+ overrideResponse: Partial<SignEvmTransaction200> = {},
70
+ ): SignEvmTransaction200 => ({ signedTransaction: faker.string.alpha(20), ...overrideResponse });
71
+
72
+ export const getSignEvmHashResponseMock = (
73
+ overrideResponse: Partial<SignEvmHash200> = {},
74
+ ): SignEvmHash200 => ({ signature: faker.string.alpha(20), ...overrideResponse });
75
+
76
+ export const getSignEvmMessageResponseMock = (
77
+ overrideResponse: Partial<SignEvmMessage200> = {},
78
+ ): SignEvmMessage200 => ({ signature: faker.string.alpha(20), ...overrideResponse });
79
+
80
+ export const getListEvmAccountsMockHandler = (
81
+ overrideResponse?:
82
+ | ListEvmAccounts200
83
+ | ((
84
+ info: Parameters<Parameters<typeof http.get>[1]>[0],
85
+ ) => Promise<ListEvmAccounts200> | ListEvmAccounts200),
86
+ ) => {
87
+ return http.get("*/v2/evm/accounts", async info => {
88
+ await delay(0);
89
+
90
+ return new HttpResponse(
91
+ JSON.stringify(
92
+ overrideResponse !== undefined
93
+ ? typeof overrideResponse === "function"
94
+ ? await overrideResponse(info)
95
+ : overrideResponse
96
+ : getListEvmAccountsResponseMock(),
97
+ ),
98
+ { status: 200, headers: { "Content-Type": "application/json" } },
99
+ );
100
+ });
101
+ };
102
+
103
+ export const getCreateEvmAccountMockHandler = (
104
+ overrideResponse?:
105
+ | EvmAccount
106
+ | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<EvmAccount> | EvmAccount),
107
+ ) => {
108
+ return http.post("*/v2/evm/accounts", async info => {
109
+ await delay(0);
110
+
111
+ return new HttpResponse(
112
+ JSON.stringify(
113
+ overrideResponse !== undefined
114
+ ? typeof overrideResponse === "function"
115
+ ? await overrideResponse(info)
116
+ : overrideResponse
117
+ : getCreateEvmAccountResponseMock(),
118
+ ),
119
+ { status: 201, headers: { "Content-Type": "application/json" } },
120
+ );
121
+ });
122
+ };
123
+
124
+ export const getGetEvmAccountMockHandler = (
125
+ overrideResponse?:
126
+ | EvmAccount
127
+ | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<EvmAccount> | EvmAccount),
128
+ ) => {
129
+ return http.get("*/v2/evm/accounts/:address", async info => {
130
+ await delay(0);
131
+
132
+ return new HttpResponse(
133
+ JSON.stringify(
134
+ overrideResponse !== undefined
135
+ ? typeof overrideResponse === "function"
136
+ ? await overrideResponse(info)
137
+ : overrideResponse
138
+ : getGetEvmAccountResponseMock(),
139
+ ),
140
+ { status: 200, headers: { "Content-Type": "application/json" } },
141
+ );
142
+ });
143
+ };
144
+
145
+ export const getGetEvmAccountByNameMockHandler = (
146
+ overrideResponse?:
147
+ | EvmAccount
148
+ | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<EvmAccount> | EvmAccount),
149
+ ) => {
150
+ return http.get("*/v2/evm/accounts/by-name/:name", async info => {
151
+ await delay(0);
152
+
153
+ return new HttpResponse(
154
+ JSON.stringify(
155
+ overrideResponse !== undefined
156
+ ? typeof overrideResponse === "function"
157
+ ? await overrideResponse(info)
158
+ : overrideResponse
159
+ : getGetEvmAccountByNameResponseMock(),
160
+ ),
161
+ { status: 200, headers: { "Content-Type": "application/json" } },
162
+ );
163
+ });
164
+ };
165
+
166
+ export const getSignEvmTransactionMockHandler = (
167
+ overrideResponse?:
168
+ | SignEvmTransaction200
169
+ | ((
170
+ info: Parameters<Parameters<typeof http.post>[1]>[0],
171
+ ) => Promise<SignEvmTransaction200> | SignEvmTransaction200),
172
+ ) => {
173
+ return http.post("*/v2/evm/accounts/:address/sign/transaction", async info => {
174
+ await delay(0);
175
+
176
+ return new HttpResponse(
177
+ JSON.stringify(
178
+ overrideResponse !== undefined
179
+ ? typeof overrideResponse === "function"
180
+ ? await overrideResponse(info)
181
+ : overrideResponse
182
+ : getSignEvmTransactionResponseMock(),
183
+ ),
184
+ { status: 200, headers: { "Content-Type": "application/json" } },
185
+ );
186
+ });
187
+ };
188
+
189
+ export const getSignEvmHashMockHandler = (
190
+ overrideResponse?:
191
+ | SignEvmHash200
192
+ | ((
193
+ info: Parameters<Parameters<typeof http.post>[1]>[0],
194
+ ) => Promise<SignEvmHash200> | SignEvmHash200),
195
+ ) => {
196
+ return http.post("*/v2/evm/accounts/:address/sign", async info => {
197
+ await delay(0);
198
+
199
+ return new HttpResponse(
200
+ JSON.stringify(
201
+ overrideResponse !== undefined
202
+ ? typeof overrideResponse === "function"
203
+ ? await overrideResponse(info)
204
+ : overrideResponse
205
+ : getSignEvmHashResponseMock(),
206
+ ),
207
+ { status: 200, headers: { "Content-Type": "application/json" } },
208
+ );
209
+ });
210
+ };
211
+
212
+ export const getSignEvmMessageMockHandler = (
213
+ overrideResponse?:
214
+ | SignEvmMessage200
215
+ | ((
216
+ info: Parameters<Parameters<typeof http.post>[1]>[0],
217
+ ) => Promise<SignEvmMessage200> | SignEvmMessage200),
218
+ ) => {
219
+ return http.post("*/v2/evm/accounts/:address/sign/message", async info => {
220
+ await delay(0);
221
+
222
+ return new HttpResponse(
223
+ JSON.stringify(
224
+ overrideResponse !== undefined
225
+ ? typeof overrideResponse === "function"
226
+ ? await overrideResponse(info)
227
+ : overrideResponse
228
+ : getSignEvmMessageResponseMock(),
229
+ ),
230
+ { status: 200, headers: { "Content-Type": "application/json" } },
231
+ );
232
+ });
233
+ };
234
+ export const getEvmAccountsMock = () => [
235
+ getListEvmAccountsMockHandler(),
236
+ getCreateEvmAccountMockHandler(),
237
+ getGetEvmAccountMockHandler(),
238
+ getGetEvmAccountByNameMockHandler(),
239
+ getSignEvmTransactionMockHandler(),
240
+ getSignEvmHashMockHandler(),
241
+ getSignEvmMessageMockHandler(),
242
+ ];