@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,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,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
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,112 @@
1
+ // eslint-disable-next-line import/no-named-as-default
2
+ import Axios, { HttpStatusCode } from "axios";
3
+ import { APIError, isOpenAPIError, HttpErrorType } from "./errors.js";
4
+ import { withAuth } from "../auth/hooks/axios/index.js";
5
+ import { ERROR_DOCS_PAGE_URL } from "../constants.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
+ if (isOpenAPIError(error.response.data)) {
66
+ throw new APIError(error.response.status, error.response.data.errorType, error.response.data.errorMessage, error.response.data.correlationId, error.response.data.errorLink);
67
+ }
68
+ else {
69
+ const statusCode = error.response.status;
70
+ switch (statusCode) {
71
+ case 401:
72
+ throw new APIError(statusCode, HttpErrorType.unauthorized, "Unauthorized.", undefined, `${ERROR_DOCS_PAGE_URL}#unauthorized`);
73
+ case 404:
74
+ throw new APIError(statusCode, HttpErrorType.not_found, "API not found.", undefined, `${ERROR_DOCS_PAGE_URL}#not_found`);
75
+ case 502:
76
+ throw new APIError(statusCode, HttpErrorType.bad_gateway, "Bad gateway.", undefined, `${ERROR_DOCS_PAGE_URL}`);
77
+ case 503:
78
+ throw new APIError(statusCode, HttpErrorType.service_unavailable, "Service unavailable. Please try again later.", undefined, `${ERROR_DOCS_PAGE_URL}`);
79
+ default:
80
+ throw new APIError(statusCode, HttpErrorType.unexpected_error, "An unexpected error occurred.", undefined, `${ERROR_DOCS_PAGE_URL}`);
81
+ }
82
+ }
83
+ // eslint-disable-next-line import/no-named-as-default-member
84
+ }
85
+ else if (Axios.isAxiosError(error) && error.request) {
86
+ throw new APIError(HttpStatusCode.ServiceUnavailable, HttpErrorType.service_unavailable, "Network error, unable to reach the service.", undefined, `${ERROR_DOCS_PAGE_URL}`);
87
+ }
88
+ else {
89
+ throw new APIError(HttpStatusCode.InternalServerError, HttpErrorType.unexpected_error, error instanceof Error
90
+ ? error.message
91
+ : `An unexpected error occurred: ${JSON.stringify(error, Object.getOwnPropertyNames(error))}`, undefined, `${ERROR_DOCS_PAGE_URL}`);
92
+ }
93
+ }
94
+ };
95
+ /**
96
+ * Validates the call to the cdpApiClient.
97
+ *
98
+ * @param {AxiosRequestConfig} config - The Axios request configuration.
99
+ * @throws {Error} If the call is not valid.
100
+ */
101
+ const validateCall = (config) => {
102
+ if (!axiosInstance.getUri() || axiosInstance.getUri() === "") {
103
+ throw new Error("CDP client URI not configured. Call configure() first.");
104
+ }
105
+ if (!config.url || config.url === "") {
106
+ throw new Error("AxiosRequestConfig URL is empty. This should never happen.");
107
+ }
108
+ if (!config.method || config.method === "") {
109
+ throw new Error("AxiosRequestConfig method is empty. This should never happen.");
110
+ }
111
+ };
112
+ //# 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,KAAK,EAAE,EAAqC,cAAc,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AA2CtD,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,S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YAAY,KAAK;gBACpB,CAAC,CAAC,KAAK,CAAC,OAAO;gBACf,CAAC,CAAC,iCAAiC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,EAAE,EAC/F,SAAS,EACT,GAAG,mBAAmB,EAAE,CACzB,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,MAA0B,EAAE,EAAE;IAClD,IAAI,CAAC,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,71 @@
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
+ };
8
+ /**
9
+ * Extended API error that encompasses both OpenAPI errors and other API-related errors
10
+ */
11
+ export class APIError extends Error {
12
+ statusCode;
13
+ errorType;
14
+ errorMessage;
15
+ correlationId;
16
+ errorLink;
17
+ /**
18
+ * Constructor for the APIError class
19
+ *
20
+ * @param statusCode - The HTTP status code
21
+ * @param errorType - The type of error
22
+ * @param errorMessage - The error message
23
+ * @param correlationId - The correlation ID
24
+ * @param errorLink - URL to documentation about this error
25
+ */
26
+ constructor(statusCode, errorType, errorMessage, correlationId, errorLink) {
27
+ super(errorMessage);
28
+ this.name = "APIError";
29
+ this.statusCode = statusCode;
30
+ this.errorType = errorType;
31
+ this.errorMessage = errorMessage;
32
+ // Only set correlationId if it's defined
33
+ if (correlationId !== undefined) {
34
+ this.correlationId = correlationId;
35
+ }
36
+ // Only set errorLink if it's defined
37
+ if (errorLink !== undefined) {
38
+ this.errorLink = errorLink;
39
+ }
40
+ }
41
+ /**
42
+ * Convert the error to a JSON object, excluding undefined properties
43
+ *
44
+ * @returns The error as a JSON object
45
+ */
46
+ toJSON() {
47
+ return {
48
+ name: this.name,
49
+ statusCode: this.statusCode,
50
+ errorType: this.errorType,
51
+ errorMessage: this.errorMessage,
52
+ ...(this.correlationId && { correlationId: this.correlationId }),
53
+ ...(this.errorLink && { errorLink: this.errorLink }),
54
+ };
55
+ }
56
+ }
57
+ /**
58
+ * Type guard to check if an object is an OpenAPIError
59
+ *
60
+ * @param obj - The object to check
61
+ * @returns True if the object is an OpenAPIError
62
+ */
63
+ export function isOpenAPIError(obj) {
64
+ return (obj !== null &&
65
+ typeof obj === "object" &&
66
+ "errorType" in obj &&
67
+ typeof obj.errorType === "string" &&
68
+ "errorMessage" in obj &&
69
+ typeof obj.errorMessage === "string");
70
+ }
71
+ //# 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,EAAE,aAAa;IAC1B,mBAAmB,EAAE,qBAAqB;CAClC,CAAC;AASX;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,UAAU,CAAS;IACnB,SAAS,CAAe;IACxB,YAAY,CAAS;IACrB,aAAa,CAAU;IACvB,SAAS,CAAU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// 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
+ };
17
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
18
+ export const EvmUserOperationNetwork = {
19
+ "base-sepolia": "base-sepolia",
20
+ base: "base",
21
+ };
22
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
23
+ export const EvmUserOperationStatus = {
24
+ pending: "pending",
25
+ signed: "signed",
26
+ broadcast: "broadcast",
27
+ complete: "complete",
28
+ failed: "failed",
29
+ };
30
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
31
+ export const PrepareUserOperationBodyNetwork = {
32
+ "base-sepolia": "base-sepolia",
33
+ base: "base",
34
+ };
35
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
36
+ export const RequestEvmFaucetBodyNetwork = {
37
+ "base-sepolia": "base-sepolia",
38
+ "ethereum-sepolia": "ethereum-sepolia",
39
+ };
40
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
41
+ export const RequestEvmFaucetBodyToken = {
42
+ eth: "eth",
43
+ usdc: "usdc",
44
+ eurc: "eurc",
45
+ cbbtc: "cbbtc",
46
+ };
47
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
48
+ export const RequestSolanaFaucetBodyToken = {
49
+ sol: "sol",
50
+ usdc: "usdc",
51
+ };
52
+ //# sourceMappingURL=coinbaseDeveloperPlatformAPIs.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coinbaseDeveloperPlatformAPIs.schemas.js","sourceRo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MAAM,4BAA4B,GAAG;IAC1C,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAC"}
@@ -0,0 +1,80 @@
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.
38
+ The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
39
+
40
+ 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.
41
+ * @summary Sign a transaction
42
+ */
43
+ export const signEvmTransaction = (address, signEvmTransactionBody, options) => {
44
+ return cdpApiClient({
45
+ url: `/v2/evm/accounts/${address}/sign/transaction`,
46
+ method: "POST",
47
+ headers: { "Content-Type": "application/json" },
48
+ data: signEvmTransactionBody,
49
+ }, options);
50
+ };
51
+ /**
52
+ * Signs an arbitrary 32 byte hash with the given EVM account.
53
+
54
+
55
+ **WARNING: This API will likely be deprecated in the future.** It is recommended not to depend on it. Never sign a hash that you didn't generate, as it can be an arbitrary transaction. For example, it might send all of your funds to an attacker.
56
+ * @summary Sign a hash
57
+ */
58
+ export const signEvmHash = (address, signEvmHashBody, options) => {
59
+ return cdpApiClient({
60
+ url: `/v2/evm/accounts/${address}/sign`,
61
+ method: "POST",
62
+ headers: { "Content-Type": "application/json" },
63
+ data: signEvmHashBody,
64
+ }, options);
65
+ };
66
+ /**
67
+ * Signs an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) message with the given EVM account.
68
+
69
+ Per the specification, the message in the request body is prepended with `0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)>` before being signed.
70
+ * @summary Sign an EIP-191 message
71
+ */
72
+ export const signEvmMessage = (address, signEvmMessageBody, options) => {
73
+ return cdpApiClient({
74
+ url: `/v2/evm/accounts/${address}/sign/message`,
75
+ method: "POST",
76
+ headers: { "Content-Type": "application/json" },
77
+ data: signEvmMessageBody,
78
+ }, options);
79
+ };
80
+ //# sourceMappingURL=evm-accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm-accounts.js","sourceRoot":"","sources":["../../../../openapi-client/generated/evm-accounts/evm-accounts.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAA8B,EAC9B,OAA8C,EAC9C,EAAE;IACF,OAAO,YAAY,CACjB,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAClD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AACF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,oBAA2C,EAC3C,OAA8C,EAC9C,EAAE;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