@coinbase/cdp-sdk 1.1.2 → 1.3.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 (332) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/LICENSE +21 -0
  3. package/README.md +88 -1
  4. package/{dist → _cjs}/accounts/evm/toEvmServerAccount.js +1 -0
  5. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -0
  6. package/{dist → _cjs}/accounts/evm/toEvmSmartAccount.js +1 -0
  7. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -0
  8. package/{dist → _cjs}/accounts/types.js +1 -0
  9. package/_cjs/accounts/types.js.map +1 -0
  10. package/{dist → _cjs}/actions/evm/sendUserOperation.js +1 -0
  11. package/_cjs/actions/evm/sendUserOperation.js.map +1 -0
  12. package/{dist → _cjs}/actions/evm/waitForUserOperation.js +10 -9
  13. package/_cjs/actions/evm/waitForUserOperation.js.map +1 -0
  14. package/{dist → _cjs}/analytics.js +32 -12
  15. package/_cjs/analytics.js.map +1 -0
  16. package/{dist → _cjs}/auth/errors.js +1 -0
  17. package/_cjs/auth/errors.js.map +1 -0
  18. package/{dist → _cjs}/auth/hooks/axios/index.js +2 -1
  19. package/_cjs/auth/hooks/axios/index.js.map +1 -0
  20. package/{dist → _cjs}/auth/hooks/axios/withAuth.js +4 -2
  21. package/_cjs/auth/hooks/axios/withAuth.js.map +1 -0
  22. package/{dist → _cjs}/auth/index.js +4 -3
  23. package/_cjs/auth/index.js.map +1 -0
  24. package/{dist → _cjs}/auth/utils/http.js +6 -5
  25. package/_cjs/auth/utils/http.js.map +1 -0
  26. package/{dist → _cjs}/auth/utils/index.js +3 -2
  27. package/_cjs/auth/utils/index.js.map +1 -0
  28. package/{dist → _cjs}/auth/utils/jwt.js +4 -3
  29. package/_cjs/auth/utils/jwt.js.map +1 -0
  30. package/_cjs/client/cdp.js +101 -0
  31. package/_cjs/client/cdp.js.map +1 -0
  32. package/_cjs/client/evm/evm.js +641 -0
  33. package/_cjs/client/evm/evm.js.map +1 -0
  34. package/{dist → _cjs}/client/evm/evm.types.js +1 -0
  35. package/_cjs/client/evm/evm.types.js.map +1 -0
  36. package/{dist → _cjs}/client/solana/index.js +3 -2
  37. package/_cjs/client/solana/index.js.map +1 -0
  38. package/{dist → _cjs}/client/solana/solana.js +9 -8
  39. package/_cjs/client/solana/solana.js.map +1 -0
  40. package/{dist → _cjs}/client/solana/solana.types.js +1 -0
  41. package/_cjs/client/solana/solana.types.js.map +1 -0
  42. package/{dist → _cjs}/constants.js +1 -0
  43. package/_cjs/constants.js.map +1 -0
  44. package/{dist → _cjs}/errors.js +1 -0
  45. package/_cjs/errors.js.map +1 -0
  46. package/{dist → _cjs}/index.js +4 -3
  47. package/_cjs/index.js.map +1 -0
  48. package/_cjs/openapi-client/cdpApiClient.js +116 -0
  49. package/_cjs/openapi-client/cdpApiClient.js.map +1 -0
  50. package/{dist → _cjs}/openapi-client/errors.js +44 -3
  51. package/_cjs/openapi-client/errors.js.map +1 -0
  52. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +66 -0
  53. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -0
  54. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js +125 -0
  55. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -0
  56. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js +160 -0
  57. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -0
  58. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +70 -0
  59. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -0
  60. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +188 -0
  61. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -0
  62. package/_cjs/openapi-client/generated/evm-token-balances/evm-token-balances.js +15 -0
  63. package/_cjs/openapi-client/generated/evm-token-balances/evm-token-balances.js.map +1 -0
  64. package/_cjs/openapi-client/generated/evm-token-balances/evm-token-balances.msw.js +45 -0
  65. package/_cjs/openapi-client/generated/evm-token-balances/evm-token-balances.msw.js.map +1 -0
  66. package/{dist → _cjs}/openapi-client/generated/faucets/faucets.js +20 -14
  67. package/_cjs/openapi-client/generated/faucets/faucets.js.map +1 -0
  68. package/{dist → _cjs}/openapi-client/generated/faucets/faucets.msw.js +16 -12
  69. package/_cjs/openapi-client/generated/faucets/faucets.msw.js.map +1 -0
  70. package/{dist → _cjs}/openapi-client/generated/index.msw.js +6 -4
  71. package/_cjs/openapi-client/generated/index.msw.js.map +1 -0
  72. package/{dist → _cjs}/openapi-client/generated/solana-accounts/solana-accounts.js +38 -35
  73. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -0
  74. package/{dist → _cjs}/openapi-client/generated/solana-accounts/solana-accounts.msw.js +68 -35
  75. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -0
  76. package/{dist → _cjs}/openapi-client/index.js +16 -11
  77. package/_cjs/openapi-client/index.js.map +1 -0
  78. package/_cjs/package.json +1 -0
  79. package/{dist → _cjs}/types/calls.js +1 -0
  80. package/_cjs/types/calls.js.map +1 -0
  81. package/{dist → _cjs}/types/contract.js +1 -0
  82. package/_cjs/types/contract.js.map +1 -0
  83. package/{dist → _cjs}/types/misc.js +1 -0
  84. package/_cjs/types/misc.js.map +1 -0
  85. package/{dist → _cjs}/types/multicall.js +1 -0
  86. package/_cjs/types/multicall.js.map +1 -0
  87. package/{dist → _cjs}/types/utils.js +1 -0
  88. package/_cjs/types/utils.js.map +1 -0
  89. package/{dist → _cjs}/utils/wait.js +3 -2
  90. package/_cjs/utils/wait.js.map +1 -0
  91. package/_cjs/version.js +5 -0
  92. package/_cjs/version.js.map +1 -0
  93. package/_esm/accounts/evm/toEvmServerAccount.js +40 -0
  94. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -0
  95. package/_esm/accounts/evm/toEvmSmartAccount.js +22 -0
  96. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -0
  97. package/_esm/accounts/types.js +2 -0
  98. package/_esm/accounts/types.js.map +1 -0
  99. package/_esm/actions/evm/sendUserOperation.js +85 -0
  100. package/_esm/actions/evm/sendUserOperation.js.map +1 -0
  101. package/_esm/actions/evm/waitForUserOperation.js +58 -0
  102. package/_esm/actions/evm/waitForUserOperation.js.map +1 -0
  103. package/_esm/analytics.js +101 -0
  104. package/_esm/analytics.js.map +1 -0
  105. package/_esm/auth/errors.js +57 -0
  106. package/_esm/auth/errors.js.map +1 -0
  107. package/_esm/auth/hooks/axios/index.js +2 -0
  108. package/_esm/auth/hooks/axios/index.js.map +1 -0
  109. package/_esm/auth/hooks/axios/withAuth.js +72 -0
  110. package/_esm/auth/hooks/axios/withAuth.js.map +1 -0
  111. package/_esm/auth/index.js +5 -0
  112. package/_esm/auth/index.js.map +1 -0
  113. package/_esm/auth/utils/http.js +70 -0
  114. package/_esm/auth/utils/http.js.map +1 -0
  115. package/_esm/auth/utils/index.js +3 -0
  116. package/_esm/auth/utils/index.js.map +1 -0
  117. package/_esm/auth/utils/jwt.js +199 -0
  118. package/_esm/auth/utils/jwt.js.map +1 -0
  119. package/{dist → _esm}/client/cdp.js +16 -13
  120. package/_esm/client/cdp.js.map +1 -0
  121. package/{dist → _esm}/client/evm/evm.js +146 -30
  122. package/_esm/client/evm/evm.js.map +1 -0
  123. package/_esm/client/evm/evm.types.js +2 -0
  124. package/_esm/client/evm/evm.types.js.map +1 -0
  125. package/_esm/client/solana/index.js +2 -0
  126. package/_esm/client/solana/index.js.map +1 -0
  127. package/_esm/client/solana/solana.js +204 -0
  128. package/_esm/client/solana/solana.js.map +1 -0
  129. package/_esm/client/solana/solana.types.js +2 -0
  130. package/_esm/client/solana/solana.types.js.map +1 -0
  131. package/_esm/constants.js +5 -0
  132. package/_esm/constants.js.map +1 -0
  133. package/_esm/errors.js +18 -0
  134. package/_esm/errors.js.map +1 -0
  135. package/_esm/index.js +3 -0
  136. package/_esm/index.js.map +1 -0
  137. package/_esm/openapi-client/cdpApiClient.js +108 -0
  138. package/_esm/openapi-client/cdpApiClient.js.map +1 -0
  139. package/_esm/openapi-client/errors.js +104 -0
  140. package/_esm/openapi-client/errors.js.map +1 -0
  141. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +63 -0
  142. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -0
  143. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js +114 -0
  144. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -0
  145. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js +140 -0
  146. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -0
  147. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +61 -0
  148. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -0
  149. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +172 -0
  150. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -0
  151. package/_esm/openapi-client/generated/evm-token-balances/evm-token-balances.js +11 -0
  152. package/_esm/openapi-client/generated/evm-token-balances/evm-token-balances.js.map +1 -0
  153. package/_esm/openapi-client/generated/evm-token-balances/evm-token-balances.msw.js +39 -0
  154. package/_esm/openapi-client/generated/evm-token-balances/evm-token-balances.msw.js.map +1 -0
  155. package/_esm/openapi-client/generated/faucets/faucets.js +52 -0
  156. package/_esm/openapi-client/generated/faucets/faucets.js.map +1 -0
  157. package/_esm/openapi-client/generated/faucets/faucets.msw.js +39 -0
  158. package/_esm/openapi-client/generated/faucets/faucets.msw.js.map +1 -0
  159. package/_esm/openapi-client/generated/index.msw.js +6 -0
  160. package/_esm/openapi-client/generated/index.msw.js.map +1 -0
  161. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +73 -0
  162. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -0
  163. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +116 -0
  164. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -0
  165. package/_esm/openapi-client/index.js +31 -0
  166. package/_esm/openapi-client/index.js.map +1 -0
  167. package/_esm/package.json +1 -0
  168. package/_esm/types/calls.js +4 -0
  169. package/_esm/types/calls.js.map +1 -0
  170. package/_esm/types/contract.js +4 -0
  171. package/_esm/types/contract.js.map +1 -0
  172. package/_esm/types/misc.js +3 -0
  173. package/_esm/types/misc.js.map +1 -0
  174. package/_esm/types/multicall.js +2 -0
  175. package/_esm/types/multicall.js.map +1 -0
  176. package/_esm/types/utils.js +4 -0
  177. package/_esm/types/utils.js.map +1 -0
  178. package/_esm/utils/wait.js +32 -0
  179. package/_esm/utils/wait.js.map +1 -0
  180. package/_esm/version.js +2 -0
  181. package/_esm/version.js.map +1 -0
  182. package/{dist → _types}/accounts/evm/toEvmServerAccount.d.ts +3 -2
  183. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -0
  184. package/{dist → _types}/accounts/evm/toEvmSmartAccount.d.ts +3 -2
  185. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -0
  186. package/{dist → _types}/accounts/types.d.ts +3 -2
  187. package/_types/accounts/types.d.ts.map +1 -0
  188. package/{dist → _types}/actions/evm/sendUserOperation.d.ts +5 -5
  189. package/_types/actions/evm/sendUserOperation.d.ts.map +1 -0
  190. package/{dist → _types}/actions/evm/waitForUserOperation.d.ts +4 -3
  191. package/_types/actions/evm/waitForUserOperation.d.ts.map +1 -0
  192. package/{dist → _types}/analytics.d.ts +16 -0
  193. package/_types/analytics.d.ts.map +1 -0
  194. package/{dist → _types}/auth/errors.d.ts +1 -0
  195. package/_types/auth/errors.d.ts.map +1 -0
  196. package/_types/auth/hooks/axios/index.d.ts +2 -0
  197. package/_types/auth/hooks/axios/index.d.ts.map +1 -0
  198. package/{dist → _types}/auth/hooks/axios/withAuth.d.ts +1 -0
  199. package/_types/auth/hooks/axios/withAuth.d.ts.map +1 -0
  200. package/_types/auth/index.d.ts +5 -0
  201. package/_types/auth/index.d.ts.map +1 -0
  202. package/{dist → _types}/auth/utils/http.d.ts +1 -0
  203. package/_types/auth/utils/http.d.ts.map +1 -0
  204. package/_types/auth/utils/index.d.ts +3 -0
  205. package/_types/auth/utils/index.d.ts.map +1 -0
  206. package/{dist → _types}/auth/utils/jwt.d.ts +1 -0
  207. package/_types/auth/utils/jwt.d.ts.map +1 -0
  208. package/{dist → _types}/client/cdp.d.ts +3 -2
  209. package/_types/client/cdp.d.ts.map +1 -0
  210. package/{dist → _types}/client/evm/evm.d.ts +86 -3
  211. package/_types/client/evm/evm.d.ts.map +1 -0
  212. package/{dist → _types}/client/evm/evm.types.d.ts +104 -7
  213. package/_types/client/evm/evm.types.d.ts.map +1 -0
  214. package/_types/client/solana/index.d.ts +2 -0
  215. package/_types/client/solana/index.d.ts.map +1 -0
  216. package/{dist → _types}/client/solana/solana.d.ts +2 -1
  217. package/_types/client/solana/solana.d.ts.map +1 -0
  218. package/{dist → _types}/client/solana/solana.types.d.ts +2 -1
  219. package/_types/client/solana/solana.types.d.ts.map +1 -0
  220. package/{dist → _types}/constants.d.ts +1 -0
  221. package/_types/constants.d.ts.map +1 -0
  222. package/{dist → _types}/errors.d.ts +1 -0
  223. package/_types/errors.d.ts.map +1 -0
  224. package/_types/index.d.ts +4 -0
  225. package/_types/index.d.ts.map +1 -0
  226. package/{dist → _types}/openapi-client/cdpApiClient.d.ts +1 -0
  227. package/_types/openapi-client/cdpApiClient.d.ts.map +1 -0
  228. package/{dist → _types}/openapi-client/errors.d.ts +30 -2
  229. package/_types/openapi-client/errors.d.ts.map +1 -0
  230. package/{dist → _types}/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +100 -14
  231. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -0
  232. package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts +91 -0
  233. package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts.map +1 -0
  234. package/{dist → _types}/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts +5 -2
  235. package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts.map +1 -0
  236. package/{dist → _types}/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +22 -20
  237. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -0
  238. package/{dist → _types}/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +3 -2
  239. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -0
  240. package/_types/openapi-client/generated/evm-token-balances/evm-token-balances.d.ts +20 -0
  241. package/_types/openapi-client/generated/evm-token-balances/evm-token-balances.d.ts.map +1 -0
  242. package/_types/openapi-client/generated/evm-token-balances/evm-token-balances.msw.d.ts +6 -0
  243. package/_types/openapi-client/generated/evm-token-balances/evm-token-balances.msw.d.ts.map +1 -0
  244. package/{dist → _types}/openapi-client/generated/faucets/faucets.d.ts +11 -9
  245. package/_types/openapi-client/generated/faucets/faucets.d.ts.map +1 -0
  246. package/{dist → _types}/openapi-client/generated/faucets/faucets.msw.d.ts +3 -2
  247. package/_types/openapi-client/generated/faucets/faucets.msw.d.ts.map +1 -0
  248. package/_types/openapi-client/generated/index.msw.d.ts +6 -0
  249. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -0
  250. package/{dist → _types}/openapi-client/generated/solana-accounts/solana-accounts.d.ts +21 -20
  251. package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -0
  252. package/{dist → _types}/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +3 -2
  253. package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -0
  254. package/_types/openapi-client/index.d.ts +61 -0
  255. package/_types/openapi-client/index.d.ts.map +1 -0
  256. package/{dist → _types}/types/calls.d.ts +4 -3
  257. package/_types/types/calls.d.ts.map +1 -0
  258. package/{dist → _types}/types/contract.d.ts +3 -2
  259. package/_types/types/contract.d.ts.map +1 -0
  260. package/_types/types/misc.d.ts +41 -0
  261. package/_types/types/misc.d.ts.map +1 -0
  262. package/{dist → _types}/types/multicall.d.ts +2 -1
  263. package/_types/types/multicall.d.ts.map +1 -0
  264. package/{dist → _types}/types/utils.d.ts +1 -0
  265. package/_types/types/utils.d.ts.map +1 -0
  266. package/{dist → _types}/utils/wait.d.ts +1 -0
  267. package/_types/utils/wait.d.ts.map +1 -0
  268. package/_types/version.d.ts +2 -0
  269. package/_types/version.d.ts.map +1 -0
  270. package/accounts/evm/toEvmServerAccount.ts +60 -0
  271. package/accounts/evm/toEvmSmartAccount.ts +37 -0
  272. package/accounts/types.ts +53 -0
  273. package/actions/evm/sendUserOperation.ts +163 -0
  274. package/actions/evm/waitForUserOperation.ts +115 -0
  275. package/analytics.ts +142 -0
  276. package/auth/README.md +145 -0
  277. package/auth/errors.ts +59 -0
  278. package/auth/hooks/axios/index.ts +1 -0
  279. package/auth/hooks/axios/withAuth.ts +121 -0
  280. package/auth/index.ts +5 -0
  281. package/auth/utils/http.ts +146 -0
  282. package/auth/utils/index.ts +2 -0
  283. package/auth/utils/jwt.ts +324 -0
  284. package/client/cdp.ts +116 -0
  285. package/client/evm/evm.ts +739 -0
  286. package/client/evm/evm.types.ts +408 -0
  287. package/client/solana/index.ts +1 -0
  288. package/client/solana/solana.ts +237 -0
  289. package/client/solana/solana.types.ts +114 -0
  290. package/constants.ts +4 -0
  291. package/errors.ts +17 -0
  292. package/index.ts +4 -0
  293. package/openapi-client/cdpApiClient.ts +221 -0
  294. package/openapi-client/errors.ts +132 -0
  295. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +512 -0
  296. package/openapi-client/generated/evm-accounts/evm-accounts.msw.ts +271 -0
  297. package/openapi-client/generated/evm-accounts/evm-accounts.ts +194 -0
  298. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +283 -0
  299. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +132 -0
  300. package/openapi-client/generated/evm-token-balances/evm-token-balances.msw.ts +57 -0
  301. package/openapi-client/generated/evm-token-balances/evm-token-balances.ts +37 -0
  302. package/openapi-client/generated/faucets/faucets.msw.ts +76 -0
  303. package/openapi-client/generated/faucets/faucets.ts +84 -0
  304. package/openapi-client/generated/index.msw.ts +5 -0
  305. package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +219 -0
  306. package/openapi-client/generated/solana-accounts/solana-accounts.ts +143 -0
  307. package/openapi-client/index.ts +36 -0
  308. package/package.json +31 -66
  309. package/types/calls.ts +40 -0
  310. package/types/contract.ts +126 -0
  311. package/types/misc.ts +44 -0
  312. package/types/multicall.ts +29 -0
  313. package/types/utils.ts +288 -0
  314. package/utils/wait.ts +52 -0
  315. package/version.ts +1 -0
  316. package/dist/auth/hooks/axios/index.d.ts +0 -1
  317. package/dist/auth/index.d.ts +0 -4
  318. package/dist/auth/utils/index.d.ts +0 -2
  319. package/dist/client/evm/index.d.ts +0 -1
  320. package/dist/client/evm/index.js +0 -5
  321. package/dist/client/solana/index.d.ts +0 -1
  322. package/dist/index.d.ts +0 -3
  323. package/dist/openapi-client/cdpApiClient.js +0 -146
  324. package/dist/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +0 -54
  325. package/dist/openapi-client/generated/evm-accounts/evm-accounts.d.ts +0 -62
  326. package/dist/openapi-client/generated/evm-accounts/evm-accounts.js +0 -85
  327. package/dist/openapi-client/generated/evm-accounts/evm-accounts.msw.js +0 -113
  328. package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +0 -66
  329. package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +0 -99
  330. package/dist/openapi-client/generated/index.msw.d.ts +0 -4
  331. package/dist/openapi-client/index.d.ts +0 -55
  332. package/dist/types/misc.d.ts +0 -3
@@ -0,0 +1,204 @@
1
+ import { CdpOpenApiClient } from "../../openapi-client/index.js";
2
+ /**
3
+ * The namespace containing all Solana methods.
4
+ */
5
+ export class SolanaClient {
6
+ /**
7
+ * Creates a new Solana account.
8
+ *
9
+ * @param {CreateAccountOptions} options - Parameters for creating the Solana account.
10
+ * @param {string} [options.name] - The name of the account.
11
+ * @param {string} [options.idempotencyKey] - An idempotency key.
12
+ *
13
+ * @returns A promise that resolves to the newly created account.
14
+ *
15
+ * @example **Without arguments**
16
+ * ```ts
17
+ * const account = await cdp.solana.createAccount();
18
+ * ```
19
+ *
20
+ * @example **With a name**
21
+ * ```ts
22
+ * const account = await cdp.solana.createAccount({ name: "MyAccount" });
23
+ * ```
24
+ *
25
+ * @example **With an idempotency key**
26
+ * ```ts
27
+ * const idempotencyKey = uuidv4();
28
+ *
29
+ * // First call
30
+ * await cdp.solana.createAccount({ idempotencyKey });
31
+ *
32
+ * // Second call with the same idempotency key will return the same account
33
+ * await cdp.solana.createAccount({ idempotencyKey });
34
+ * ```
35
+ */
36
+ async createAccount(options = {}) {
37
+ return CdpOpenApiClient.createSolanaAccount(options, options.idempotencyKey);
38
+ }
39
+ /**
40
+ * Gets a Solana account by its address.
41
+ *
42
+ * @param {GetAccountOptions} options - Parameters for getting the Solana account.
43
+ * Either `address` or `name` must be provided.
44
+ * If both are provided, lookup will be done by `address` and `name` will be ignored.
45
+ * @param {string} [options.address] - The address of the account.
46
+ * @param {string} [options.name] - The name of the account.
47
+ *
48
+ * @returns A promise that resolves to the account.
49
+ *
50
+ * @example **Get an account by address**
51
+ * ```ts
52
+ * const account = await cdp.solana.getAccount({
53
+ * address: "1234567890123456789012345678901234567890",
54
+ * });
55
+ * ```
56
+ *
57
+ * @example **Get an account by name**
58
+ * ```ts
59
+ * const account = await cdp.solana.getAccount({
60
+ * name: "MyAccount",
61
+ * });
62
+ * ```
63
+ */
64
+ async getAccount(options) {
65
+ if (options.address) {
66
+ return CdpOpenApiClient.getSolanaAccount(options.address);
67
+ }
68
+ if (options.name) {
69
+ return CdpOpenApiClient.getSolanaAccountByName(options.name);
70
+ }
71
+ throw new Error("Either address or name must be provided");
72
+ }
73
+ /**
74
+ * Lists all Solana accounts.
75
+ *
76
+ * @param {ListAccountsOptions} options - Parameters for listing the Solana accounts.
77
+ * @param {number} [options.pageSize] - The number of accounts to return.
78
+ * @param {string} [options.pageToken] - The page token to begin listing from.
79
+ * This is obtained by previous calls to this method.
80
+ *
81
+ * @returns A promise that resolves to an array of Solana account instances.
82
+ *
83
+ * @example **Without arguments**
84
+ * ```ts
85
+ * const accounts = await cdp.solana.listAccounts();
86
+ * ```
87
+ *
88
+ * @example **With pagination**
89
+ * ```ts
90
+ * let page = await cdp.solana.listAccounts();
91
+ *
92
+ * while (page.nextPageToken) {
93
+ * page = await cdp.solana.listAccounts({ pageToken: page.nextPageToken });
94
+ * }
95
+ *
96
+ * page.accounts.forEach(account => console.log(account));
97
+ * ```
98
+ * }
99
+ * ```
100
+ */
101
+ async listAccounts(options = {}) {
102
+ const solAccounts = await CdpOpenApiClient.listSolanaAccounts({
103
+ pageSize: options.pageSize,
104
+ pageToken: options.pageToken,
105
+ });
106
+ return {
107
+ accounts: solAccounts.accounts,
108
+ nextPageToken: solAccounts.nextPageToken,
109
+ };
110
+ }
111
+ /**
112
+ * Requests funds from a Solana faucet.
113
+ *
114
+ * @param {RequestFaucetOptions} options - Parameters for requesting funds from the Solana faucet.
115
+ * @param {string} options.address - The address to request funds for.
116
+ * @param {string} options.token - The token to request funds for.
117
+ * @param {string} [options.idempotencyKey] - An idempotency key.
118
+ *
119
+ * @returns A promise that resolves to the transaction signature.
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * const signature = await cdp.solana.requestFaucet({
124
+ * address: "1234567890123456789012345678901234567890",
125
+ * token: "sol",
126
+ * });
127
+ * ```
128
+ */
129
+ async requestFaucet(options) {
130
+ const signature = await CdpOpenApiClient.requestSolanaFaucet({ address: options.address, token: options.token }, options.idempotencyKey);
131
+ return {
132
+ signature: signature.transactionSignature,
133
+ };
134
+ }
135
+ /**
136
+ * Signs a message.
137
+ *
138
+ * @param {SignMessageOptions} options - Parameters for signing the message.
139
+ * @param {string} options.address - The address to sign the message for.
140
+ * @param {string} options.message - The message to sign.
141
+ * @param {string} [options.idempotencyKey] - An idempotency key.
142
+ *
143
+ * @returns A promise that resolves to the signature.
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * // Create a Solana account
148
+ * const account = await cdp.solana.createAccount();
149
+ *
150
+ * // When you want to sign a message, you can do so by address
151
+ * const signature = await cdp.solana.signMessage({
152
+ * address: account.address,
153
+ * message: "Hello, world!",
154
+ * });
155
+ * ```
156
+ */
157
+ async signMessage(options) {
158
+ return CdpOpenApiClient.signSolanaMessage(options.address, {
159
+ message: options.message,
160
+ }, options.idempotencyKey);
161
+ }
162
+ /**
163
+ * Signs a transaction.
164
+ *
165
+ * @param {SignTransactionOptions} options - Parameters for signing the transaction.
166
+ * @param {string} options.address - The address to sign the transaction for.
167
+ * @param {string} options.transaction - The transaction to sign.
168
+ * @param {string} [options.idempotencyKey] - An idempotency key.
169
+ *
170
+ * @returns A promise that resolves to the signature.
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * // Create a Solana account
175
+ * const account = await cdp.solana.createAccount();
176
+ *
177
+ * // Add your transaction instructions here
178
+ * const transaction = new Transaction()
179
+ *
180
+ * // Make sure to set requireAllSignatures to false, since signing will be done through the API
181
+ * const serializedTransaction = transaction.serialize({
182
+ * requireAllSignatures: false,
183
+ * });
184
+ *
185
+ * // Base64 encode the serialized transaction
186
+ * const transaction = Buffer.from(serializedTransaction).toString("base64");
187
+ *
188
+ * // When you want to sign a transaction, you can do so by address and base64 encoded transaction
189
+ * const signature = await cdp.solana.signTransaction({
190
+ * address: account.address,
191
+ * transaction,
192
+ * });
193
+ * ```
194
+ */
195
+ async signTransaction(options) {
196
+ const signature = await CdpOpenApiClient.signSolanaTransaction(options.address, {
197
+ transaction: options.transaction,
198
+ }, options.idempotencyKey);
199
+ return {
200
+ signature: signature.signedTransaction,
201
+ };
202
+ }
203
+ }
204
+ //# sourceMappingURL=solana.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../client/solana/solana.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,aAAa,CAAC,UAAgC,EAAE;QACpD,OAAO,gBAAgB,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,KAAK,CAAC,UAAU,CAAC,OAA0B;QACzC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5D,CAAC;QAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO,gBAAgB,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,CAAC,YAAY,CAAC,UAA+B,EAAE;QAClD,MAAM,WAAW,GAAG,MAAM,gBAAgB,CAAC,kBAAkB,CAAC;YAC5D,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC,CAAC;QAEH,OAAO;YACL,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,aAAa,EAAE,WAAW,CAAC,aAAa;SACzC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,aAAa,CAAC,OAA6B;QAC/C,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,mBAAmB,CAC1D,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAClD,OAAO,CAAC,cAAc,CACvB,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,SAAS,CAAC,oBAAoB;SAC1C,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,WAAW,CAAC,OAA2B;QAC3C,OAAO,gBAAgB,CAAC,iBAAiB,CACvC,OAAO,CAAC,OAAO,EACf;YACE,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,EACD,OAAO,CAAC,cAAc,CACvB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CAAC,eAAe,CAAC,OAA+B;QACnD,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,qBAAqB,CAC5D,OAAO,CAAC,OAAO,EACf;YACE,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,EACD,OAAO,CAAC,cAAc,CACvB,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,SAAS,CAAC,iBAAiB;SACvC,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=solana.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solana.types.js","sourceRoot":"","sources":["../../../client/solana/solana.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The URL to the Coinbase CDP API error docs page.
3
+ */
4
+ export const ERROR_DOCS_PAGE_URL = "https://docs.cdp.coinbase.com/api-v2/docs/errors";
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,kDAAkD,CAAC"}
package/_esm/errors.js ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * TimeoutError is thrown when an operation times out.
3
+ */
4
+ export class TimeoutError extends Error {
5
+ /**
6
+ * Initializes a new TimeoutError instance.
7
+ *
8
+ * @param message - The error message.
9
+ */
10
+ constructor(message = "Timeout Error") {
11
+ super(message);
12
+ this.name = "TimeoutError";
13
+ if (Error.captureStackTrace) {
14
+ Error.captureStackTrace(this, TimeoutError);
15
+ }
16
+ }
17
+ }
18
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC;;;;OAIG;IACH,YAAY,UAAkB,eAAe;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF"}
package/_esm/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import "./analytics.js";
2
+ export { CdpClient } from "./client/cdp.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,108 @@
1
+ // eslint-disable-next-line import/no-named-as-default
2
+ import Axios from "axios";
3
+ import { withAuth } from "../auth/hooks/axios/index.js";
4
+ import { ERROR_DOCS_PAGE_URL } from "../constants.js";
5
+ import { isOpenAPIError, APIError, HttpErrorType, UnknownApiError, UnknownError, } from "./errors.js";
6
+ let axiosInstance;
7
+ /**
8
+ * Configures the CDP client with the given options.
9
+ *
10
+ * @param {CdpOptions} options - The CDP options.
11
+ */
12
+ export const configure = (options) => {
13
+ axiosInstance = Axios.create({
14
+ baseURL: options.basePath || "https://api.cdp.coinbase.com/platform",
15
+ });
16
+ axiosInstance = withAuth(axiosInstance, {
17
+ apiKeyId: options.apiKeyId,
18
+ apiKeySecret: options.apiKeySecret,
19
+ source: options.source || "sdk-openapi-client",
20
+ sourceVersion: options.sourceVersion,
21
+ walletSecret: options.walletSecret,
22
+ expiresIn: options.expiresIn,
23
+ debug: options.debugging,
24
+ });
25
+ };
26
+ /**
27
+ * Adds an idempotency key to request config if provided
28
+ *
29
+ * @param config - The Axios request configuration.
30
+ * @param idempotencyKey - The idempotency key.
31
+ * @returns The Axios request configuration with the idempotency key.
32
+ */
33
+ const addIdempotencyKey = (config, idempotencyKey) => {
34
+ if (!idempotencyKey) {
35
+ return config;
36
+ }
37
+ return {
38
+ ...config,
39
+ headers: {
40
+ ...(config.headers || {}),
41
+ "X-Idempotency-Key": idempotencyKey,
42
+ },
43
+ };
44
+ };
45
+ /**
46
+ * Mutates the given Axios request configuration to add the CDP API key signature
47
+ * to the request headers.
48
+ *
49
+ * @param {AxiosRequestConfig} config - The Axios request configuration.
50
+ * @param idempotencyKey - The idempotency key.
51
+ * @returns {Promise<T>} A promise that resolves to the response data.
52
+ * @throws {APIError} If the request fails.
53
+ */
54
+ export const cdpApiClient = async (config, idempotencyKey) => {
55
+ validateCall(config);
56
+ // Add idempotency key to the request headers if provided
57
+ const configWithIdempotencyKey = addIdempotencyKey(config, idempotencyKey);
58
+ try {
59
+ const response = await axiosInstance(configWithIdempotencyKey);
60
+ return response.data;
61
+ }
62
+ catch (error) {
63
+ // eslint-disable-next-line import/no-named-as-default-member
64
+ if (Axios.isAxiosError(error) && !error.response) {
65
+ throw new UnknownApiError(HttpErrorType.unknown, error.cause instanceof Error ? error.cause.message : error.message, error.cause);
66
+ }
67
+ // eslint-disable-next-line import/no-named-as-default-member
68
+ if (Axios.isAxiosError(error) && error.response) {
69
+ if (isOpenAPIError(error.response.data)) {
70
+ throw new APIError(error.response.status, error.response.data.errorType, error.response.data.errorMessage, error.response.data.correlationId, error.response.data.errorLink, error.cause);
71
+ }
72
+ else {
73
+ const statusCode = error.response.status;
74
+ switch (statusCode) {
75
+ case 401:
76
+ throw new APIError(statusCode, HttpErrorType.unauthorized, "Unauthorized.", undefined, `${ERROR_DOCS_PAGE_URL}#unauthorized`, error.cause);
77
+ case 404:
78
+ throw new APIError(statusCode, HttpErrorType.not_found, "API not found.", undefined, `${ERROR_DOCS_PAGE_URL}#not_found`, error.cause);
79
+ case 502:
80
+ throw new APIError(statusCode, HttpErrorType.bad_gateway, "Bad gateway.", undefined, `${ERROR_DOCS_PAGE_URL}`, error.cause);
81
+ case 503:
82
+ throw new APIError(statusCode, HttpErrorType.service_unavailable, "Service unavailable. Please try again later.", undefined, `${ERROR_DOCS_PAGE_URL}`, error.cause);
83
+ default:
84
+ throw new APIError(statusCode, HttpErrorType.unexpected_error, "An unexpected error occurred.", undefined, `${ERROR_DOCS_PAGE_URL}`, error.cause);
85
+ }
86
+ }
87
+ }
88
+ throw new UnknownError("Something went wrong. Please reach out at https://discord.com/channels/1220414409550336183/1271495764580896789 for help.", error instanceof Error ? error : undefined);
89
+ }
90
+ };
91
+ /**
92
+ * Validates the call to the cdpApiClient.
93
+ *
94
+ * @param {AxiosRequestConfig} config - The Axios request configuration.
95
+ * @throws {Error} If the call is not valid.
96
+ */
97
+ const validateCall = (config) => {
98
+ if (!axiosInstance.getUri() || axiosInstance.getUri() === "") {
99
+ throw new Error("CDP client URI not configured. Call configure() first.");
100
+ }
101
+ if (!config.url || config.url === "") {
102
+ throw new Error("AxiosRequestConfig URL is empty. This should never happen.");
103
+ }
104
+ if (!config.method || config.method === "") {
105
+ throw new Error("AxiosRequestConfig method is empty. This should never happen.");
106
+ }
107
+ };
108
+ //# sourceMappingURL=cdpApiClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cdpApiClient.js","sourceRoot":"","sources":["../../openapi-client/cdpApiClient.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACL,cAAc,EACd,QAAQ,EACR,aAAa,EACb,eAAe,EACf,YAAY,GACb,MAAM,aAAa,CAAC;AA2CrB,IAAI,aAA4B,CAAC;AAEjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAmB,EAAE,EAAE;IAC/C,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,OAAO,EAAE,OAAO,CAAC,QAAQ,IAAI,uCAAuC;KACrE,CAAC,CAAC;IAEH,aAAa,GAAG,QAAQ,CAAC,aAAa,EAAE;QACtC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,oBAAoB;QAC9C,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,KAAK,EAAE,OAAO,CAAC,SAAS;KACzB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CACxB,MAA0B,EAC1B,cAAuB,EACH,EAAE;IACtB,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO;QACL,GAAG,MAAM;QACT,OAAO,EAAE;YACP,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EA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C,aAAa,CAAC,MAAM,EAAE,IAAI,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,104 @@
1
+ export const HttpErrorType = {
2
+ unexpected_error: "unexpected_error",
3
+ unauthorized: "unauthorized",
4
+ not_found: "not_found",
5
+ bad_gateway: "bad_gateway",
6
+ service_unavailable: "service_unavailable",
7
+ unknown: "unknown",
8
+ };
9
+ /**
10
+ * Extended API error that encompasses both OpenAPI errors and other API-related errors
11
+ */
12
+ export class APIError extends Error {
13
+ statusCode;
14
+ errorType;
15
+ errorMessage;
16
+ correlationId;
17
+ errorLink;
18
+ /**
19
+ * Constructor for the APIError class
20
+ *
21
+ * @param statusCode - The HTTP status code
22
+ * @param errorType - The type of error
23
+ * @param errorMessage - The error message
24
+ * @param correlationId - The correlation ID
25
+ * @param errorLink - URL to documentation about this error
26
+ * @param cause - The cause of the error
27
+ */
28
+ constructor(statusCode, errorType, errorMessage, correlationId, errorLink, cause) {
29
+ super(errorMessage, { cause });
30
+ this.name = "APIError";
31
+ this.statusCode = statusCode;
32
+ this.errorType = errorType;
33
+ this.errorMessage = errorMessage;
34
+ // Only set correlationId if it's defined
35
+ if (correlationId !== undefined) {
36
+ this.correlationId = correlationId;
37
+ }
38
+ // Only set errorLink if it's defined
39
+ if (errorLink !== undefined) {
40
+ this.errorLink = errorLink;
41
+ }
42
+ }
43
+ /**
44
+ * Convert the error to a JSON object, excluding undefined properties
45
+ *
46
+ * @returns The error as a JSON object
47
+ */
48
+ toJSON() {
49
+ return {
50
+ name: this.name,
51
+ statusCode: this.statusCode,
52
+ errorType: this.errorType,
53
+ errorMessage: this.errorMessage,
54
+ ...(this.correlationId && { correlationId: this.correlationId }),
55
+ ...(this.errorLink && { errorLink: this.errorLink }),
56
+ };
57
+ }
58
+ }
59
+ /**
60
+ * Error thrown when an Axios request is made but no response is received
61
+ */
62
+ export class UnknownApiError extends APIError {
63
+ /**
64
+ * Constructor for the UnknownApiError class
65
+ *
66
+ * @param errorType - The type of error
67
+ * @param errorMessage - The error message
68
+ * @param cause - The cause of the error
69
+ */
70
+ constructor(errorType, errorMessage, cause) {
71
+ super(0, errorType, errorMessage, undefined, undefined, cause);
72
+ this.name = "UnknownApiError";
73
+ }
74
+ }
75
+ /**
76
+ * Error thrown when an error is not known
77
+ */
78
+ export class UnknownError extends Error {
79
+ /**
80
+ * Constructor for the UnknownError class
81
+ *
82
+ * @param message - The error message
83
+ * @param cause - The cause of the error
84
+ */
85
+ constructor(message, cause) {
86
+ super(message, { cause });
87
+ this.name = "UnknownError";
88
+ }
89
+ }
90
+ /**
91
+ * Type guard to check if an object is an OpenAPIError
92
+ *
93
+ * @param obj - The object to check
94
+ * @returns True if the object is an OpenAPIError
95
+ */
96
+ export function isOpenAPIError(obj) {
97
+ return (obj !== null &&
98
+ typeof obj === "object" &&
99
+ "errorType" in obj &&
100
+ typeof obj.errorType === "string" &&
101
+ "errorMessage" in obj &&
102
+ typeof obj.errorMessage === "string");
103
+ }
104
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../openapi-client/errors.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,gBAAgB,EAAE,kBAAkB;IACpC,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IACtB,WAAW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C3C;;;;;;OAMG;IACH,YAAY,SAAuB,EAAE,YAAoB,EAAE,KAAa;QACtE,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC/D,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC;;;;;OAKG;IACH,YAAY,OAAe,EAAE,KAAa;QACxC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAY;IACzC,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,WAAW,IAAI,GAAG;QAClB,OAAQ,GAAoB,CAAC,SAAS,KAAK,QAAQ;QACnD,cAAc,IAAI,GAAG;QACrB,OAAQ,GAAoB,CAAC,YAAY,KAAK,QAAQ,CACvD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,63 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
2
+ export const ErrorType = {
3
+ already_exists: "already_exists",
4
+ faucet_limit_exceeded: "faucet_limit_exceeded",
5
+ forbidden: "forbidden",
6
+ idempotency_error: "idempotency_error",
7
+ internal_server_error: "internal_server_error",
8
+ invalid_request: "invalid_request",
9
+ invalid_signature: "invalid_signature",
10
+ malformed_transaction: "malformed_transaction",
11
+ not_found: "not_found",
12
+ rate_limit_exceeded: "rate_limit_exceeded",
13
+ request_canceled: "request_canceled",
14
+ timed_out: "timed_out",
15
+ unauthorized: "unauthorized",
16
+ policy_violation: "policy_violation",
17
+ };
18
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
19
+ export const EvmUserOperationNetwork = {
20
+ "base-sepolia": "base-sepolia",
21
+ base: "base",
22
+ };
23
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
24
+ export const EvmUserOperationStatus = {
25
+ pending: "pending",
26
+ signed: "signed",
27
+ broadcast: "broadcast",
28
+ complete: "complete",
29
+ failed: "failed",
30
+ };
31
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
32
+ export const ListEvmTokenBalancesNetwork = {
33
+ base: "base",
34
+ "base-sepolia": "base-sepolia",
35
+ };
36
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
37
+ export const SendEvmTransactionBodyNetwork = {
38
+ base: "base",
39
+ "base-sepolia": "base-sepolia",
40
+ };
41
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
42
+ export const PrepareUserOperationBodyNetwork = {
43
+ "base-sepolia": "base-sepolia",
44
+ base: "base",
45
+ };
46
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
47
+ export const RequestEvmFaucetBodyNetwork = {
48
+ "base-sepolia": "base-sepolia",
49
+ "ethereum-sepolia": "ethereum-sepolia",
50
+ };
51
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
52
+ export const RequestEvmFaucetBodyToken = {
53
+ eth: "eth",
54
+ usdc: "usdc",
55
+ eurc: "eurc",
56
+ cbbtc: "cbbtc",
57
+ };
58
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
59
+ export const RequestSolanaFaucetBodyToken = {
60
+ sol: "sol",
61
+ usdc: "usdc",
62
+ };
63
+ //# sourceMappingURL=coinbaseDeveloperPlatformAPIs.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coinbaseDeveloperPlatformAPIs.schemas.js","sourceRoot":"","sources":["../../../openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts"],"names":[],"mappings":"AAgCA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,cAAc,EAAE,gBAAgB;IAChC,qBAAqB,EAAE,uBAAuB;IAC9C,SAAS,EAAE,WAAW;IACtB,iBAAiB,EAAE,mBAAmB;IACtC,qBAAqB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AC3D,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAC"}
@@ -0,0 +1,114 @@
1
+ import { cdpApiClient } from "../../cdpApiClient.js";
2
+ /**
3
+ * Lists the EVM accounts belonging to the developer's CDP Project.
4
+ The response is paginated, and by default, returns 20 accounts per page.
5
+ * @summary List EVM accounts
6
+ */
7
+ export const listEvmAccounts = (params, options) => {
8
+ return cdpApiClient({ url: `/v2/evm/accounts`, method: "GET", params }, options);
9
+ };
10
+ /**
11
+ * Creates a new EVM account.
12
+ * @summary Create an EVM account
13
+ */
14
+ export const createEvmAccount = (createEvmAccountBody, options) => {
15
+ return cdpApiClient({
16
+ url: `/v2/evm/accounts`,
17
+ method: "POST",
18
+ headers: { "Content-Type": "application/json" },
19
+ data: createEvmAccountBody,
20
+ }, options);
21
+ };
22
+ /**
23
+ * Gets an EVM account by its address.
24
+ * @summary Get an EVM account by address
25
+ */
26
+ export const getEvmAccount = (address, options) => {
27
+ return cdpApiClient({ url: `/v2/evm/accounts/${address}`, method: "GET" }, options);
28
+ };
29
+ /**
30
+ * Gets an EVM account by its name.
31
+ * @summary Get an EVM account by name
32
+ */
33
+ export const getEvmAccountByName = (name, options) => {
34
+ return cdpApiClient({ url: `/v2/evm/accounts/by-name/${name}`, method: "GET" }, options);
35
+ };
36
+ /**
37
+ * Signs a transaction with the given EVM account and sends it to the indicated supported network. This API handles nonce management and gas estimation, leaving the developer to provide only the minimal set of fields necessary to send the transaction. The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
38
+
39
+ The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md).
40
+
41
+
42
+ **Transaction fields and API behavior**
43
+
44
+ - `to` *(Required)*: The address of the contract or account to send the transaction to.
45
+ - `chainId` *(Ignored)*: The value of the `chainId` field in the transaction is ignored.
46
+ The transaction will be sent to the network indicated by the `network` field in the request body.
47
+
48
+ - `nonce` *(Optional)*: The nonce to use for the transaction. If not provided, the API will assign
49
+ a nonce to the transaction based on the current state of the account.
50
+
51
+ - `maxPriorityFeePerGas` *(Optional)*: The maximum priority fee per gas to use for the transaction.
52
+ If not provided, the API will estimate a value based on current network conditions.
53
+
54
+ - `maxFeePerGas` *(Optional)*: The maximum fee per gas to use for the transaction.
55
+ If not provided, the API will estimate a value based on current network conditions.
56
+
57
+ - `gasLimit` *(Optional)*: The gas limit to use for the transaction. If not provided, the API will estimate a value
58
+ based on the `to` and `data` fields of the transaction.
59
+
60
+ - `value` *(Optional)*: The amount of ETH, in wei, to send with the transaction.
61
+ - `data` *(Optional)*: The data to send with the transaction; only used for contract calls.
62
+ - `accessList` *(Optional)*: The access list to use for the transaction.
63
+ * @summary Send a transaction
64
+ */
65
+ export const sendEvmTransaction = (address, sendEvmTransactionBody, options) => {
66
+ return cdpApiClient({
67
+ url: `/v2/evm/accounts/${address}/send/transaction`,
68
+ method: "POST",
69
+ headers: { "Content-Type": "application/json" },
70
+ data: sendEvmTransactionBody,
71
+ }, options);
72
+ };
73
+ /**
74
+ * Signs a transaction with the given EVM account.
75
+ The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
76
+
77
+ The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md). The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
78
+ * @summary Sign a transaction
79
+ */
80
+ export const signEvmTransaction = (address, signEvmTransactionBody, options) => {
81
+ return cdpApiClient({
82
+ url: `/v2/evm/accounts/${address}/sign/transaction`,
83
+ method: "POST",
84
+ headers: { "Content-Type": "application/json" },
85
+ data: signEvmTransactionBody,
86
+ }, options);
87
+ };
88
+ /**
89
+ * Signs an arbitrary 32 byte hash with the given EVM account.
90
+ * @summary Sign a hash
91
+ */
92
+ export const signEvmHash = (address, signEvmHashBody, options) => {
93
+ return cdpApiClient({
94
+ url: `/v2/evm/accounts/${address}/sign`,
95
+ method: "POST",
96
+ headers: { "Content-Type": "application/json" },
97
+ data: signEvmHashBody,
98
+ }, options);
99
+ };
100
+ /**
101
+ * Signs an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) message with the given EVM account.
102
+
103
+ Per the specification, the message in the request body is prepended with `0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)>` before being signed.
104
+ * @summary Sign an EIP-191 message
105
+ */
106
+ export const signEvmMessage = (address, signEvmMessageBody, options) => {
107
+ return cdpApiClient({
108
+ url: `/v2/evm/accounts/${address}/sign/message`,
109
+ method: "POST",
110
+ headers: { "Content-Type": "application/json" },
111
+ data: signEvmMessageBody,
112
+ }, options);
113
+ };
114
+ //# sourceMappingURL=evm-accounts.js.map