@coinbase/agentkit 0.0.0-nightly-20250328174338

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 (292) hide show
  1. package/README.md +827 -0
  2. package/dist/action-providers/across/acrossActionProvider.d.ts +50 -0
  3. package/dist/action-providers/across/acrossActionProvider.js +333 -0
  4. package/dist/action-providers/across/acrossActionProvider.test.d.ts +1 -0
  5. package/dist/action-providers/across/acrossActionProvider.test.js +391 -0
  6. package/dist/action-providers/across/constants.d.ts +1 -0
  7. package/dist/action-providers/across/constants.js +2 -0
  8. package/dist/action-providers/across/index.d.ts +1 -0
  9. package/dist/action-providers/across/index.js +17 -0
  10. package/dist/action-providers/across/schemas.d.ts +36 -0
  11. package/dist/action-providers/across/schemas.js +46 -0
  12. package/dist/action-providers/across/utils.d.ts +7 -0
  13. package/dist/action-providers/across/utils.js +25 -0
  14. package/dist/action-providers/actionDecorator.d.ts +69 -0
  15. package/dist/action-providers/actionDecorator.js +96 -0
  16. package/dist/action-providers/actionProvider.d.ts +48 -0
  17. package/dist/action-providers/actionProvider.js +62 -0
  18. package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.d.ts +55 -0
  19. package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.js +173 -0
  20. package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.test.d.ts +1 -0
  21. package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.test.js +131 -0
  22. package/dist/action-providers/alchemy/index.d.ts +2 -0
  23. package/dist/action-providers/alchemy/index.js +18 -0
  24. package/dist/action-providers/alchemy/schemas.d.ts +41 -0
  25. package/dist/action-providers/alchemy/schemas.js +34 -0
  26. package/dist/action-providers/allora/alloraActionProvider.d.ts +44 -0
  27. package/dist/action-providers/allora/alloraActionProvider.js +195 -0
  28. package/dist/action-providers/allora/alloraActionProvider.test.d.ts +1 -0
  29. package/dist/action-providers/allora/alloraActionProvider.test.js +109 -0
  30. package/dist/action-providers/allora/index.d.ts +2 -0
  31. package/dist/action-providers/allora/index.js +18 -0
  32. package/dist/action-providers/allora/schemas.d.ts +28 -0
  33. package/dist/action-providers/allora/schemas.js +30 -0
  34. package/dist/action-providers/basename/basenameActionProvider.d.ts +30 -0
  35. package/dist/action-providers/basename/basenameActionProvider.js +109 -0
  36. package/dist/action-providers/basename/basenameActionProvider.test.d.ts +1 -0
  37. package/dist/action-providers/basename/basenameActionProvider.test.js +146 -0
  38. package/dist/action-providers/basename/constants.d.ts +52 -0
  39. package/dist/action-providers/basename/constants.js +81 -0
  40. package/dist/action-providers/basename/index.d.ts +2 -0
  41. package/dist/action-providers/basename/index.js +18 -0
  42. package/dist/action-providers/basename/schemas.d.ts +14 -0
  43. package/dist/action-providers/basename/schemas.js +14 -0
  44. package/dist/action-providers/cdp/cdpApiActionProvider.d.ts +43 -0
  45. package/dist/action-providers/cdp/cdpApiActionProvider.js +128 -0
  46. package/dist/action-providers/cdp/cdpApiActionProvider.test.d.ts +1 -0
  47. package/dist/action-providers/cdp/cdpApiActionProvider.test.js +146 -0
  48. package/dist/action-providers/cdp/cdpWalletActionProvider.d.ts +58 -0
  49. package/dist/action-providers/cdp/cdpWalletActionProvider.js +224 -0
  50. package/dist/action-providers/cdp/cdpWalletActionProvider.test.d.ts +1 -0
  51. package/dist/action-providers/cdp/cdpWalletActionProvider.test.js +267 -0
  52. package/dist/action-providers/cdp/constants.d.ts +31 -0
  53. package/dist/action-providers/cdp/constants.js +34 -0
  54. package/dist/action-providers/cdp/index.d.ts +3 -0
  55. package/dist/action-providers/cdp/index.js +19 -0
  56. package/dist/action-providers/cdp/schemas.d.ts +91 -0
  57. package/dist/action-providers/cdp/schemas.js +77 -0
  58. package/dist/action-providers/compound/compoundActionProvider.d.ts +67 -0
  59. package/dist/action-providers/compound/compoundActionProvider.js +365 -0
  60. package/dist/action-providers/compound/compoundActionProvider.test.d.ts +1 -0
  61. package/dist/action-providers/compound/compoundActionProvider.test.js +353 -0
  62. package/dist/action-providers/compound/constants.d.ts +180 -0
  63. package/dist/action-providers/compound/constants.js +129 -0
  64. package/dist/action-providers/compound/index.d.ts +1 -0
  65. package/dist/action-providers/compound/index.js +17 -0
  66. package/dist/action-providers/compound/schemas.d.ts +57 -0
  67. package/dist/action-providers/compound/schemas.js +58 -0
  68. package/dist/action-providers/compound/utils.d.ts +95 -0
  69. package/dist/action-providers/compound/utils.js +353 -0
  70. package/dist/action-providers/customActionProvider.d.ts +30 -0
  71. package/dist/action-providers/customActionProvider.js +66 -0
  72. package/dist/action-providers/defillama/constants.d.ts +8 -0
  73. package/dist/action-providers/defillama/constants.js +11 -0
  74. package/dist/action-providers/defillama/defillamaActionProvider.d.ts +54 -0
  75. package/dist/action-providers/defillama/defillamaActionProvider.js +180 -0
  76. package/dist/action-providers/defillama/defillamaActionProvider.test.d.ts +1 -0
  77. package/dist/action-providers/defillama/defillamaActionProvider.test.js +114 -0
  78. package/dist/action-providers/defillama/index.d.ts +1 -0
  79. package/dist/action-providers/defillama/index.js +17 -0
  80. package/dist/action-providers/defillama/schemas.d.ts +34 -0
  81. package/dist/action-providers/defillama/schemas.js +34 -0
  82. package/dist/action-providers/defillama/types.d.ts +73 -0
  83. package/dist/action-providers/defillama/types.js +2 -0
  84. package/dist/action-providers/defillama/utils.d.ts +10 -0
  85. package/dist/action-providers/defillama/utils.js +87 -0
  86. package/dist/action-providers/defillama/utils.test.d.ts +1 -0
  87. package/dist/action-providers/defillama/utils.test.js +124 -0
  88. package/dist/action-providers/erc20/constants.d.ts +137 -0
  89. package/dist/action-providers/erc20/constants.js +202 -0
  90. package/dist/action-providers/erc20/erc20ActionProvider.d.ts +38 -0
  91. package/dist/action-providers/erc20/erc20ActionProvider.js +142 -0
  92. package/dist/action-providers/erc20/erc20ActionProvider.test.d.ts +1 -0
  93. package/dist/action-providers/erc20/erc20ActionProvider.test.js +131 -0
  94. package/dist/action-providers/erc20/index.d.ts +1 -0
  95. package/dist/action-providers/erc20/index.js +17 -0
  96. package/dist/action-providers/erc20/schemas.d.ts +27 -0
  97. package/dist/action-providers/erc20/schemas.js +26 -0
  98. package/dist/action-providers/erc721/constants.d.ts +232 -0
  99. package/dist/action-providers/erc721/constants.js +298 -0
  100. package/dist/action-providers/erc721/erc721ActionProvider.d.ts +46 -0
  101. package/dist/action-providers/erc721/erc721ActionProvider.js +164 -0
  102. package/dist/action-providers/erc721/erc721ActionProvider.test.d.ts +1 -0
  103. package/dist/action-providers/erc721/erc721ActionProvider.test.js +137 -0
  104. package/dist/action-providers/erc721/index.d.ts +1 -0
  105. package/dist/action-providers/erc721/index.js +17 -0
  106. package/dist/action-providers/erc721/schemas.d.ts +46 -0
  107. package/dist/action-providers/erc721/schemas.js +44 -0
  108. package/dist/action-providers/farcaster/farcasterActionProvider.d.ts +57 -0
  109. package/dist/action-providers/farcaster/farcasterActionProvider.js +142 -0
  110. package/dist/action-providers/farcaster/farcasterActionProvider.test.d.ts +1 -0
  111. package/dist/action-providers/farcaster/farcasterActionProvider.test.js +151 -0
  112. package/dist/action-providers/farcaster/index.d.ts +2 -0
  113. package/dist/action-providers/farcaster/index.js +18 -0
  114. package/dist/action-providers/farcaster/schemas.d.ts +15 -0
  115. package/dist/action-providers/farcaster/schemas.js +20 -0
  116. package/dist/action-providers/index.d.ts +24 -0
  117. package/dist/action-providers/index.js +40 -0
  118. package/dist/action-providers/jupiter/index.d.ts +1 -0
  119. package/dist/action-providers/jupiter/index.js +17 -0
  120. package/dist/action-providers/jupiter/jupiterActionProvider.d.ts +36 -0
  121. package/dist/action-providers/jupiter/jupiterActionProvider.js +115 -0
  122. package/dist/action-providers/jupiter/jupiterActionProvider.test.d.ts +1 -0
  123. package/dist/action-providers/jupiter/jupiterActionProvider.test.js +146 -0
  124. package/dist/action-providers/jupiter/schemas.d.ts +20 -0
  125. package/dist/action-providers/jupiter/schemas.js +20 -0
  126. package/dist/action-providers/messari/constants.d.ts +17 -0
  127. package/dist/action-providers/messari/constants.js +20 -0
  128. package/dist/action-providers/messari/index.d.ts +5 -0
  129. package/dist/action-providers/messari/index.js +21 -0
  130. package/dist/action-providers/messari/messariActionProvider.d.ts +42 -0
  131. package/dist/action-providers/messari/messariActionProvider.js +128 -0
  132. package/dist/action-providers/messari/messariActionProvider.test.d.ts +1 -0
  133. package/dist/action-providers/messari/messariActionProvider.test.js +152 -0
  134. package/dist/action-providers/messari/schemas.d.ts +11 -0
  135. package/dist/action-providers/messari/schemas.js +16 -0
  136. package/dist/action-providers/messari/types.d.ts +40 -0
  137. package/dist/action-providers/messari/types.js +2 -0
  138. package/dist/action-providers/messari/utils.d.ts +22 -0
  139. package/dist/action-providers/messari/utils.js +65 -0
  140. package/dist/action-providers/moonwell/constants.d.ts +78 -0
  141. package/dist/action-providers/moonwell/constants.js +111 -0
  142. package/dist/action-providers/moonwell/index.d.ts +1 -0
  143. package/dist/action-providers/moonwell/index.js +5 -0
  144. package/dist/action-providers/moonwell/moonwellActionProvider.d.ts +39 -0
  145. package/dist/action-providers/moonwell/moonwellActionProvider.js +249 -0
  146. package/dist/action-providers/moonwell/moonwellActionProvider.test.d.ts +1 -0
  147. package/dist/action-providers/moonwell/moonwellActionProvider.test.js +455 -0
  148. package/dist/action-providers/moonwell/schemas.d.ts +30 -0
  149. package/dist/action-providers/moonwell/schemas.js +39 -0
  150. package/dist/action-providers/morpho/constants.d.ts +16 -0
  151. package/dist/action-providers/morpho/constants.js +27 -0
  152. package/dist/action-providers/morpho/index.d.ts +2 -0
  153. package/dist/action-providers/morpho/index.js +18 -0
  154. package/dist/action-providers/morpho/morphoActionProvider.d.ts +39 -0
  155. package/dist/action-providers/morpho/morphoActionProvider.js +154 -0
  156. package/dist/action-providers/morpho/morphoActionProvider.test.d.ts +1 -0
  157. package/dist/action-providers/morpho/morphoActionProvider.test.js +128 -0
  158. package/dist/action-providers/morpho/schemas.d.ts +36 -0
  159. package/dist/action-providers/morpho/schemas.js +47 -0
  160. package/dist/action-providers/opensea/index.d.ts +1 -0
  161. package/dist/action-providers/opensea/index.js +17 -0
  162. package/dist/action-providers/opensea/openseaActionProvider.d.ts +59 -0
  163. package/dist/action-providers/opensea/openseaActionProvider.js +146 -0
  164. package/dist/action-providers/opensea/openseaActionProvider.test.d.ts +1 -0
  165. package/dist/action-providers/opensea/openseaActionProvider.test.js +201 -0
  166. package/dist/action-providers/opensea/schemas.d.ts +30 -0
  167. package/dist/action-providers/opensea/schemas.js +33 -0
  168. package/dist/action-providers/opensea/utils.d.ts +12 -0
  169. package/dist/action-providers/opensea/utils.js +47 -0
  170. package/dist/action-providers/pyth/index.d.ts +2 -0
  171. package/dist/action-providers/pyth/index.js +18 -0
  172. package/dist/action-providers/pyth/pythActionProvider.d.ts +33 -0
  173. package/dist/action-providers/pyth/pythActionProvider.js +121 -0
  174. package/dist/action-providers/pyth/pythActionProvider.test.d.ts +1 -0
  175. package/dist/action-providers/pyth/pythActionProvider.test.js +113 -0
  176. package/dist/action-providers/pyth/schemas.d.ts +21 -0
  177. package/dist/action-providers/pyth/schemas.js +20 -0
  178. package/dist/action-providers/spl/index.d.ts +1 -0
  179. package/dist/action-providers/spl/index.js +17 -0
  180. package/dist/action-providers/spl/schemas.d.ts +30 -0
  181. package/dist/action-providers/spl/schemas.js +26 -0
  182. package/dist/action-providers/spl/splActionProvider.d.ts +45 -0
  183. package/dist/action-providers/spl/splActionProvider.js +173 -0
  184. package/dist/action-providers/spl/splActionProvider.test.d.ts +1 -0
  185. package/dist/action-providers/spl/splActionProvider.test.js +300 -0
  186. package/dist/action-providers/twitter/index.d.ts +2 -0
  187. package/dist/action-providers/twitter/index.js +18 -0
  188. package/dist/action-providers/twitter/schemas.d.ts +38 -0
  189. package/dist/action-providers/twitter/schemas.js +44 -0
  190. package/dist/action-providers/twitter/twitterActionProvider.d.ts +82 -0
  191. package/dist/action-providers/twitter/twitterActionProvider.js +204 -0
  192. package/dist/action-providers/twitter/twitterActionProvider.test.d.ts +1 -0
  193. package/dist/action-providers/twitter/twitterActionProvider.test.js +185 -0
  194. package/dist/action-providers/wallet/index.d.ts +1 -0
  195. package/dist/action-providers/wallet/index.js +17 -0
  196. package/dist/action-providers/wallet/schemas.d.ts +19 -0
  197. package/dist/action-providers/wallet/schemas.js +19 -0
  198. package/dist/action-providers/wallet/walletActionProvider.d.ts +44 -0
  199. package/dist/action-providers/wallet/walletActionProvider.js +140 -0
  200. package/dist/action-providers/wallet/walletActionProvider.test.d.ts +1 -0
  201. package/dist/action-providers/wallet/walletActionProvider.test.js +194 -0
  202. package/dist/action-providers/weth/constants.d.ts +19 -0
  203. package/dist/action-providers/weth/constants.js +29 -0
  204. package/dist/action-providers/weth/index.d.ts +1 -0
  205. package/dist/action-providers/weth/index.js +17 -0
  206. package/dist/action-providers/weth/schemas.d.ts +8 -0
  207. package/dist/action-providers/weth/schemas.js +10 -0
  208. package/dist/action-providers/weth/wethActionProvider.d.ts +30 -0
  209. package/dist/action-providers/weth/wethActionProvider.js +89 -0
  210. package/dist/action-providers/weth/wethActionProvider.test.d.ts +1 -0
  211. package/dist/action-providers/weth/wethActionProvider.test.js +92 -0
  212. package/dist/action-providers/wow/constants.d.ts +15 -0
  213. package/dist/action-providers/wow/constants.js +844 -0
  214. package/dist/action-providers/wow/index.d.ts +2 -0
  215. package/dist/action-providers/wow/index.js +18 -0
  216. package/dist/action-providers/wow/schemas.d.ts +43 -0
  217. package/dist/action-providers/wow/schemas.js +47 -0
  218. package/dist/action-providers/wow/uniswap/constants.d.ts +3 -0
  219. package/dist/action-providers/wow/uniswap/constants.js +100 -0
  220. package/dist/action-providers/wow/uniswap/utils.d.ts +82 -0
  221. package/dist/action-providers/wow/uniswap/utils.js +226 -0
  222. package/dist/action-providers/wow/utils.d.ts +27 -0
  223. package/dist/action-providers/wow/utils.js +63 -0
  224. package/dist/action-providers/wow/wowActionProvider.d.ts +46 -0
  225. package/dist/action-providers/wow/wowActionProvider.js +223 -0
  226. package/dist/action-providers/wow/wowActionProvider.test.d.ts +1 -0
  227. package/dist/action-providers/wow/wowActionProvider.test.js +291 -0
  228. package/dist/agentkit.d.ts +44 -0
  229. package/dist/agentkit.js +68 -0
  230. package/dist/analytics/index.d.ts +1 -0
  231. package/dist/analytics/index.js +17 -0
  232. package/dist/analytics/sendAnalyticsEvent.d.ts +31 -0
  233. package/dist/analytics/sendAnalyticsEvent.js +52 -0
  234. package/dist/index.d.ts +4 -0
  235. package/dist/index.js +20 -0
  236. package/dist/network/index.d.ts +3 -0
  237. package/dist/network/index.js +19 -0
  238. package/dist/network/network.d.ts +20 -0
  239. package/dist/network/network.js +86 -0
  240. package/dist/network/svm.d.ts +15 -0
  241. package/dist/network/svm.js +38 -0
  242. package/dist/network/types.d.ts +17 -0
  243. package/dist/network/types.js +2 -0
  244. package/dist/utils.d.ts +22 -0
  245. package/dist/utils.js +57 -0
  246. package/dist/utils.test.d.ts +1 -0
  247. package/dist/utils.test.js +50 -0
  248. package/dist/wallet-providers/cdpWalletProvider.d.ts +246 -0
  249. package/dist/wallet-providers/cdpWalletProvider.js +421 -0
  250. package/dist/wallet-providers/cdpWalletProvider.test.d.ts +1 -0
  251. package/dist/wallet-providers/cdpWalletProvider.test.js +701 -0
  252. package/dist/wallet-providers/evmWalletProvider.d.ts +51 -0
  253. package/dist/wallet-providers/evmWalletProvider.js +14 -0
  254. package/dist/wallet-providers/evmWalletProvider.test.d.ts +1 -0
  255. package/dist/wallet-providers/evmWalletProvider.test.js +56 -0
  256. package/dist/wallet-providers/index.d.ts +10 -0
  257. package/dist/wallet-providers/index.js +26 -0
  258. package/dist/wallet-providers/privyEvmWalletProvider.d.ts +55 -0
  259. package/dist/wallet-providers/privyEvmWalletProvider.js +140 -0
  260. package/dist/wallet-providers/privyEvmWalletProvider.test.d.ts +1 -0
  261. package/dist/wallet-providers/privyEvmWalletProvider.test.js +331 -0
  262. package/dist/wallet-providers/privyShared.d.ts +40 -0
  263. package/dist/wallet-providers/privyShared.js +49 -0
  264. package/dist/wallet-providers/privySvmWalletProvider.d.ts +128 -0
  265. package/dist/wallet-providers/privySvmWalletProvider.js +212 -0
  266. package/dist/wallet-providers/privySvmWalletProvider.test.d.ts +1 -0
  267. package/dist/wallet-providers/privySvmWalletProvider.test.js +310 -0
  268. package/dist/wallet-providers/privyWalletProvider.d.ts +35 -0
  269. package/dist/wallet-providers/privyWalletProvider.js +39 -0
  270. package/dist/wallet-providers/privyWalletProvider.test.d.ts +1 -0
  271. package/dist/wallet-providers/privyWalletProvider.test.js +124 -0
  272. package/dist/wallet-providers/smartWalletProvider.d.ts +177 -0
  273. package/dist/wallet-providers/smartWalletProvider.js +303 -0
  274. package/dist/wallet-providers/smartWalletProvider.test.d.ts +1 -0
  275. package/dist/wallet-providers/smartWalletProvider.test.js +388 -0
  276. package/dist/wallet-providers/solanaKeypairWalletProvider.d.ts +143 -0
  277. package/dist/wallet-providers/solanaKeypairWalletProvider.js +280 -0
  278. package/dist/wallet-providers/solanaKeypairWalletProvider.test.d.ts +1 -0
  279. package/dist/wallet-providers/solanaKeypairWalletProvider.test.js +218 -0
  280. package/dist/wallet-providers/svmWalletProvider.d.ts +56 -0
  281. package/dist/wallet-providers/svmWalletProvider.js +13 -0
  282. package/dist/wallet-providers/svmWalletProvider.test.d.ts +1 -0
  283. package/dist/wallet-providers/svmWalletProvider.test.js +55 -0
  284. package/dist/wallet-providers/viemWalletProvider.d.ts +103 -0
  285. package/dist/wallet-providers/viemWalletProvider.js +206 -0
  286. package/dist/wallet-providers/viemWalletProvider.test.d.ts +1 -0
  287. package/dist/wallet-providers/viemWalletProvider.test.js +338 -0
  288. package/dist/wallet-providers/walletProvider.d.ts +48 -0
  289. package/dist/wallet-providers/walletProvider.js +41 -0
  290. package/dist/wallet-providers/walletProvider.test.d.ts +1 -0
  291. package/dist/wallet-providers/walletProvider.test.js +103 -0
  292. package/package.json +83 -0
package/README.md ADDED
@@ -0,0 +1,827 @@
1
+ # Agentkit
2
+
3
+ AgentKit is a framework for easily enabling AI agents to take actions onchain. It is designed to be framework-agnostic, so you can use it with any AI framework, and wallet-agnostic, so you can use it with any wallet.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Agentkit](#agentkit)
8
+ - [Getting Started](#getting-started)
9
+ - [Installation](#installation)
10
+ - [Usage](#usage)
11
+ - [Create an AgentKit instance](#create-an-agentkit-instance)
12
+ - [Create an AgentKit instance with a specified wallet provider](#create-an-agentkit-instance-with-a-specified-wallet-provider)
13
+ - [Create an AgentKit instance with a specified action providers](#create-an-agentkit-instance-with-a-specified-action-providers)
14
+ - [Use the agent's actions with a framework extension. For example, using LangChain + OpenAI](#use-the-agents-actions-with-a-framework-extension-for-example-using-langchain--openai)
15
+ - [Action Providers](#action-providers)
16
+ - [Creating an Action Provider](#creating-an-action-provider)
17
+ - [Adding Actions to your Action Provider](#adding-actions-to-your-action-provider)
18
+ - [Adding Actions to your Action Provider that use a Wallet Provider](#adding-actions-to-your-action-provider-that-use-a-wallet-provider)
19
+ - [Adding an Action Provider to your AgentKit instance](#adding-an-action-provider-to-your-agentkit-instance)
20
+ - [EVM Wallet Providers](#evm-wallet-providers)
21
+ - [CdpWalletProvider](#cdpwalletprovider)
22
+ - [Network Configuration](#network-configuration)
23
+ - [Configuring from an existing CDP API Wallet](#configuring-from-an-existing-cdp-api-wallet)
24
+ - [Configuring from a mnemonic phrase](#configuring-from-a-mnemonic-phrase)
25
+ - [Exporting a wallet](#exporting-a-wallet)
26
+ - [Importing a wallet from WalletData JSON string](#importing-a-wallet-from-walletdata-json-string)
27
+ - [Configuring gas parameters](#configuring-cdpwalletprovider-gas-parameters)
28
+ - [ViemWalletProvider](#viemwalletprovider)
29
+ - [Configuring gas parameters](#configuring-viemwalletprovider-gas-parameters)
30
+ - [PrivyWalletProvider](#privywalletprovider)
31
+ - [Authorization Keys](#authorization-keys)
32
+ - [Exporting Privy Wallet information](#exporting-privy-wallet-information)
33
+ - [SmartWalletProvider](#smartwalletprovider)
34
+ - [SVM Wallet Providers](#svm-wallet-providers)
35
+ - [SolanaKeypairWalletProvider](#solanakeypairwalletprovider)
36
+ - [Network Configuration](#solana-network-configuration)
37
+ - [RPC URL Configuration](#rpc-url-configuration)
38
+ - [PrivyWalletProvider](#privywalletprovider-solana)
39
+ - [Connection Configuration](#connection-configuration)
40
+ - [Authorization Keys](#authorization-keys)
41
+ - [Exporting Privy Wallet information](#exporting-privy-wallet-information)
42
+ - [Contributing](#contributing)
43
+
44
+ ## Getting Started
45
+
46
+ *Prerequisites*:
47
+ - [Node.js 18+](https://nodejs.org/en/download/)
48
+ - [CDP Secret API Key](https://docs.cdp.coinbase.com/get-started/docs/cdp-api-keys#creating-secret-api-keys)
49
+
50
+ ## Installation
51
+
52
+ ```bash
53
+ npm install @coinbase/agentkit
54
+ ```
55
+
56
+ ## Usage
57
+
58
+ ### Create an AgentKit instance. If no wallet or action providers are specified, the agent will use the `CdpWalletProvider` and `WalletProvider` action provider.
59
+
60
+ ```typescript
61
+ const agentKit = await AgentKit.from({
62
+ cdpApiKeyName: "CDP API KEY NAME",
63
+ cdpApiKeyPrivate: "CDP API KEY PRIVATE KEY",
64
+ });
65
+ ```
66
+
67
+ ### Create an AgentKit instance
68
+
69
+ If no wallet or action provider are specified, the agent will use the `CdpWalletProvider` and `WalletActionProvider` action provider by default.
70
+
71
+ ```typescript
72
+ const agentKit = await AgentKit.from({
73
+ cdpApiKeyName: "CDP API KEY NAME",
74
+ cdpApiKeyPrivate: "CDP API KEY PRIVATE KEY",
75
+ });
76
+ ```
77
+
78
+ ### Create an AgentKit instance with a specified wallet provider.
79
+
80
+ ```typescript
81
+ import { CdpWalletProvider } from "@coinbase/agentkit";
82
+
83
+ const walletProvider = await CdpWalletProvider.configureWithWallet({
84
+ apiKeyName: "CDP API KEY NAME",
85
+ apiKeyPrivate: "CDP API KEY PRIVATE KEY",
86
+ networkId: "base-mainnet",
87
+ });
88
+
89
+ const agentKit = await AgentKit.from({
90
+ walletProvider,
91
+ });
92
+ ```
93
+
94
+ ### Create an AgentKit instance with a specified action providers.
95
+
96
+ ```typescript
97
+ import { cdpApiActionProvider, pythActionProvider } from "@coinbase/agentkit";
98
+
99
+ const agentKit = await AgentKit.from({
100
+ walletProvider,
101
+ actionProviders: [
102
+ cdpApiActionProvider({
103
+ apiKeyName: "CDP API KEY NAME",
104
+ apiKeyPrivate: "CDP API KEY PRIVATE KEY",
105
+ }),
106
+ pythActionProvider(),
107
+ ],
108
+ });
109
+ ```
110
+
111
+ ### Use the agent's actions with a framework extension. For example, using LangChain + OpenAI.
112
+
113
+ *Prerequisites*:
114
+ - [OpenAI API Key](https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key)
115
+ - Set `OPENAI_API_KEY` environment variable.
116
+
117
+ ```bash
118
+ npm install @langchain @langchain/langgraph @langchain/openai
119
+ ```
120
+
121
+ ```typescript
122
+ import { getLangChainTools } from "@coinbase/agentkit-langchain";
123
+ import { createReactAgent } from "@langchain/langgraph/prebuilt";
124
+ import { ChatOpenAI } from "@langchain/openai";
125
+
126
+ const tools = await getLangChainTools(agentKit);
127
+
128
+ const llm = new ChatOpenAI({
129
+ model: "gpt-4o-mini",
130
+ });
131
+
132
+ const agent = createReactAgent({
133
+ llm,
134
+ tools,
135
+ });
136
+ ```
137
+
138
+ ## Action Providers
139
+ <details>
140
+ <summary><strong>Across</strong></summary>
141
+ <table width="100%">
142
+ <tr>
143
+ <td width="200"><code>bridge_token</code></td>
144
+ <td width="768">Bridges tokens between supported chains using Across Protocol.</td>
145
+ </tr>
146
+ <tr>
147
+ <td width="200"><code>check_deposit_status</code></td>
148
+ <td width="768">Checks the status of a cross-chain bridge deposit on the Across Protocol (mainnet networks only).</td>
149
+ </tr>
150
+ </table>
151
+ </details>
152
+ <details>
153
+ <summary><strong>Basename</strong></summary>
154
+ <table width="100%">
155
+ <tr>
156
+ <td width="200"><code>register_basename</code></td>
157
+ <td width="768">Registers a custom .base.eth or .basetest.eth domain name for the wallet address.</td>
158
+ </tr>
159
+ </table>
160
+ </details>
161
+ <details>
162
+ <summary><strong>CDP Wallet</strong></summary>
163
+ <table width="100%">
164
+ <tr>
165
+ <td width="200"><code>deploy_contract</code></td>
166
+ <td width="768">Deploys a custom smart contract using specified Solidity version and constructor arguments.</td>
167
+ </tr>
168
+ <tr>
169
+ <td width="200"><code>deploy_nft</code></td>
170
+ <td width="768">Deploys a standard ERC-721 NFT contract with configurable name, symbol, and metadata URI.</td>
171
+ </tr>
172
+ <tr>
173
+ <td width="200"><code>deploy_token</code></td>
174
+ <td width="768">Deploys a standard ERC-20 token contract with configurable name, symbol, and initial supply.</td>
175
+ </tr>
176
+ <tr>
177
+ <td width="200"><code>trade</code></td>
178
+ <td width="768">Executes a token swap between two assets at current market rates on mainnet networks.</td>
179
+ </tr>
180
+ </table>
181
+ </details>
182
+ <details>
183
+ <summary><strong>Compound</strong></summary>
184
+ <table width="100%">
185
+ <tr>
186
+ <td width="200"><code>supply</code></td>
187
+ <td width="768">Supplies collateral assets (WETH, CBETH, CBBTC, WSTETH, or USDC) to Compound.</td>
188
+ </tr>
189
+ <tr>
190
+ <td width="200"><code>withdraw</code></td>
191
+ <td width="768">Withdraws previously supplied collateral assets from Compound.</td>
192
+ </tr>
193
+ <tr>
194
+ <td width="200"><code>borrow</code></td>
195
+ <td width="768">Borrows base assets (WETH or USDC) from Compound using supplied collateral.</td>
196
+ </tr>
197
+ <tr>
198
+ <td width="200"><code>repay</code></td>
199
+ <td width="768">Repays borrowed assets back to Compound.</td>
200
+ </tr>
201
+ <tr>
202
+ <td width="200"><code>get_portfolio</code></td>
203
+ <td width="768">Retrieves portfolio details including collateral balances and borrowed amounts.</td>
204
+ </tr>
205
+ </table>
206
+ </details>
207
+ <details>
208
+ <summary><strong>DefiLlama</strong></summary>
209
+ <table width="100%">
210
+ <tr>
211
+ <td width="200"><code>find_protocol</code></td>
212
+ <td width="768">Searches for DeFi protocols on DefiLlama by name, returning protocol metadata including TVL, chain, and category.</td>
213
+ </tr>
214
+ <tr>
215
+ <td width="200"><code>get_protocol</code></td>
216
+ <td width="768">Fetches detailed information about a specific protocol from DefiLlama, including TVL, description, and historical data.</td>
217
+ </tr>
218
+ <tr>
219
+ <td width="200"><code>get_token_prices</code></td>
220
+ <td width="768">Fetches current token prices from DefiLlama for specified token addresses with chain prefixes.</td>
221
+ </tr>
222
+ </table>
223
+ </details>
224
+ <details>
225
+ <summary><strong>ERC20</strong></summary>
226
+ <table width="100%">
227
+ <tr>
228
+ <td width="200"><code>get_balance</code></td>
229
+ <td width="768">Retrieves the token balance for a specified address and ERC-20 contract.</td>
230
+ </tr>
231
+ <tr>
232
+ <td width="200"><code>transfer</code></td>
233
+ <td width="768">Transfers a specified amount of ERC-20 tokens to a destination address.</td>
234
+ </tr>
235
+ </table>
236
+ </details>
237
+ <details>
238
+ <summary><strong>ERC721</strong></summary>
239
+ <table width="100%">
240
+ <tr>
241
+ <td width="200"><code>get_balance</code></td>
242
+ <td width="768">Retrieves the NFT balance for a specified address and ERC-721 contract.</td>
243
+ </tr>
244
+ <tr>
245
+ <td width="200"><code>mint</code></td>
246
+ <td width="768">Creates a new NFT token and assigns it to a specified destination address.</td>
247
+ </tr>
248
+ <tr>
249
+ <td width="200"><code>transfer</code></td>
250
+ <td width="768">Transfers ownership of a specific NFT token to a destination address.</td>
251
+ </tr>
252
+ </table>
253
+ </details>
254
+ <details>
255
+ <summary><strong>Farcaster</strong></summary>
256
+ <table width="100%">
257
+ <tr>
258
+ <td width="200"><code>account_details</code></td>
259
+ <td width="768">Fetches profile information and metadata for the authenticated Farcaster account.</td>
260
+ </tr>
261
+ <tr>
262
+ <td width="200"><code>post_cast</code></td>
263
+ <td width="768">Creates a new cast (message) on Farcaster with up to 280 characters.</td>
264
+ </tr>
265
+ </table>
266
+ </details>
267
+ <details>
268
+ <summary><strong>Messari</strong></summary>
269
+ <table width="100%">
270
+ <tr>
271
+ <td width="200"><code>research_question</code></td>
272
+ <td width="768">Queries Messari AI for comprehensive crypto research across news, market data, protocol information, and more.</td>
273
+ </tr>
274
+ </table>
275
+ </details>
276
+ <details>
277
+ <summary><strong>Morpho</strong></summary>
278
+ <table width="100%">
279
+ <tr>
280
+ <td width="200"><code>deposit</code></td>
281
+ <td width="768">Deposits a specified amount of assets into a designated Morpho Vault.</td>
282
+ </tr>
283
+ <tr>
284
+ <td width="200"><code>withdraw</code></td>
285
+ <td width="768">Withdraws a specified amount of assets from a designated Morpho Vault.</td>
286
+ </tr>
287
+ </table>
288
+ </details>
289
+ <details>
290
+ <summary><strong>Opensea</strong></summary>
291
+ <table width="100%">
292
+ <tr>
293
+ <td width="200"><code>list_nft</code></td>
294
+ <td width="768">Lists an NFT for sale on OpenSea.</td>
295
+ </tr>
296
+ <tr>
297
+ <td width="200"><code>get_nfts_by_account</code></td>
298
+ <td width="768">Fetches NFTs owned by a specific wallet address on OpenSea.</td>
299
+ </tr>
300
+ </table>
301
+ </details>
302
+ <details>
303
+ <summary><strong>Pyth</strong></summary>
304
+ <table width="100%">
305
+ <tr>
306
+ <td width="200"><code>fetch_price</code></td>
307
+ <td width="768">Retrieves current price data from a specified Pyth price feed.</td>
308
+ </tr>
309
+ <tr>
310
+ <td width="200"><code>fetch_price_feed_id</code></td>
311
+ <td width="768">Retrieves the unique price feed identifier for a given token symbol.</td>
312
+ </tr>
313
+ </table>
314
+ </details>
315
+ <details>
316
+ <summary><strong>Twitter</strong></summary>
317
+ <table width="100%">
318
+ <tr>
319
+ <td width="200"><code>account_details</code></td>
320
+ <td width="768">Fetches profile information and metadata for the authenticated Twitter account.</td>
321
+ </tr>
322
+ <tr>
323
+ <td width="200"><code>account_mentions</code></td>
324
+ <td width="768">Retrieves recent mentions and interactions for the authenticated account.</td>
325
+ </tr>
326
+ <tr>
327
+ <td width="200"><code>post_tweet</code></td>
328
+ <td width="768">Creates a new tweet on the authenticated Twitter account.</td>
329
+ </tr>
330
+ <tr>
331
+ <td width="200"><code>post_tweet_reply</code></td>
332
+ <td width="768">Creates a reply to an existing tweet using the tweet's unique identifier.</td>
333
+ </tr>
334
+ </table>
335
+ </details>
336
+ <details>
337
+ <summary><strong>Wallet</strong></summary>
338
+ <table width="100%">
339
+ <tr>
340
+ <td width="200"><code>get_wallet_details</code></td>
341
+ <td width="768">Retrieves wallet address, network info, balances, and provider details.</td>
342
+ </tr>
343
+ <tr>
344
+ <td width="200"><code>native_transfer</code></td>
345
+ <td width="768">Transfers native blockchain tokens (e.g., ETH) to a destination address.</td>
346
+ </tr>
347
+ </table>
348
+ </details>
349
+ <details>
350
+ <summary><strong>WETH</strong></summary>
351
+ <table width="100%">
352
+ <tr>
353
+ <td width="200"><code>wrap_eth</code></td>
354
+ <td width="768">Converts native ETH to Wrapped ETH (WETH) on Base Sepolia or Base Mainnet.</td>
355
+ </tr>
356
+ </table>
357
+ </details>
358
+ <details>
359
+ <summary><strong>WOW</strong></summary>
360
+ <table width="100%">
361
+ <tr>
362
+ <td width="200"><code>buy_token</code></td>
363
+ <td width="768">Purchases WOW tokens from a contract using ETH based on bonding curve pricing.</td>
364
+ </tr>
365
+ <tr>
366
+ <td width="200"><code>create_token</code></td>
367
+ <td width="768">Creates a new WOW memecoin with bonding curve functionality via Zora factory.</td>
368
+ </tr>
369
+ <tr>
370
+ <td width="200"><code>sell_token</code></td>
371
+ <td width="768">Sells WOW tokens back to the contract for ETH based on bonding curve pricing.</td>
372
+ </tr>
373
+ </table>
374
+ </details>
375
+ <details>
376
+ <summary><strong>Jupiter</strong></summary>
377
+ <table width="100%">
378
+ <tr>
379
+ <td width="200"><code>swap</code></td>
380
+ <td width="768">Swap tokens on Solana using the Jupiter DEX aggregator.</td>
381
+ </tr>
382
+ </table>
383
+ </details>
384
+
385
+ ## Creating an Action Provider
386
+
387
+ Action providers are used to define the actions that an agent can take. They are defined as a class that extends the `ActionProvider` abstract class.
388
+
389
+ ```typescript
390
+ import { ActionProvider, WalletProvider, Network } from "@coinbase/agentkit";
391
+
392
+ // Define an action provider that uses a wallet provider.
393
+ class MyActionProvider extends ActionProvider<WalletProvider> {
394
+ constructor() {
395
+ super("my-action-provider", []);
396
+ }
397
+
398
+ // Define if the action provider supports the given network
399
+ supportsNetwork = (network: Network) => true;
400
+ }
401
+ ```
402
+
403
+ ### Adding Actions to your Action Provider
404
+
405
+ Actions are defined as instance methods on the action provider class with the `@CreateAction` decorator. Actions can use a wallet provider or not and always return a Promise that resolves to a string.
406
+
407
+ #### Required Typescript Compiler Options
408
+
409
+ Creating actions with the `@CreateAction` decorator requires the following compilerOptions to be included in your project's `tsconfig.json`.
410
+
411
+ ```json
412
+ {
413
+ "compilerOptions": {
414
+ "experimentalDecorators": true,
415
+ "emitDecoratorMetadata": true
416
+ }
417
+ }
418
+ ```
419
+
420
+ #### Steps to create an action
421
+
422
+ 1. Define the action schema. Action schemas are defined using the `zod` library.
423
+
424
+ ```typescript
425
+ import { z } from "zod";
426
+
427
+ export const MyActionSchema = z.object({
428
+ myField: z.string(),
429
+ });
430
+ ```
431
+
432
+ 2. Define the action.
433
+
434
+ ```typescript
435
+ import { ActionProvider, WalletProvider, Network, CreateAction } from "@coinbase/agentkit";
436
+
437
+ class MyActionProvider extends ActionProvider<WalletProvider> {
438
+ constructor() {
439
+ super("my-action-provider", []);
440
+ }
441
+
442
+ @CreateAction({
443
+ name: "my-action",
444
+ description: "My action description",
445
+ schema: MyActionSchema,
446
+ })
447
+ async myAction(args: z.infer<typeof MyActionSchema>): Promise<string> {
448
+ return args.myField;
449
+ }
450
+
451
+ supportsNetwork = (network: Network) => true;
452
+ }
453
+
454
+ export const myActionProvider = () => new MyActionProvider();
455
+ ```
456
+
457
+ #### Adding Actions to your Action Provider that use a Wallet Provider
458
+
459
+ Actions that use a wallet provider can be defined as instance methods on the action provider class with the `@CreateAction` decorator that have a `WalletProvider` as the first parameter.
460
+
461
+ ```typescript
462
+ class MyActionProvider extends ActionProvider<WalletProvider> {
463
+ constructor() {
464
+ super("my-action-provider", []);
465
+ }
466
+
467
+ @CreateAction({
468
+ name: "my-action",
469
+ description: "My action description",
470
+ schema: MyActionSchema,
471
+ })
472
+ async myAction(walletProvider: WalletProvider, args: z.infer<typeof MyActionSchema>): Promise<string> {
473
+ return walletProvider.signMessage(args.myField);
474
+ }
475
+
476
+ supportsNetwork = (network: Network) => true;
477
+ }
478
+ ```
479
+
480
+ ### Adding an Action Provider to your AgentKit instance.
481
+
482
+ This gives your agent access to the actions defined in the action provider.
483
+
484
+ ```typescript
485
+ const agentKit = new AgentKit({
486
+ cdpApiKeyName: "CDP API KEY NAME",
487
+ cdpApiKeyPrivate: "CDP API KEY PRIVATE KEY",
488
+ actionProviders: [myActionProvider()],
489
+ });
490
+ ```
491
+
492
+ ## EVM Wallet Providers
493
+
494
+ Wallet providers give an agent access to a wallet. AgentKit currently supports the following wallet providers:
495
+
496
+ EVM:
497
+ - [CdpWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpWalletProvider.ts)
498
+ - [ViemWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/viemWalletProvider.ts)
499
+ - [PrivyWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/privyWalletProvider.ts)
500
+
501
+ ### CdpWalletProvider
502
+
503
+ The `CdpWalletProvider` is a wallet provider that uses the Coinbase Developer Platform (CDP) [API Wallet](https://docs.cdp.coinbase.com/wallet-api/docs/welcome).
504
+
505
+ #### Network Configuration
506
+
507
+ The `CdpWalletProvider` can be configured to use a specific network by passing the `networkId` parameter to the `configureWithWallet` method. The `networkId` is the ID of the network you want to use. You can find a list of [supported networks on the CDP API docs](https://docs.cdp.coinbase.com/cdp-apis/docs/networks).
508
+
509
+ ```typescript
510
+ import { CdpWalletProvider } from "@coinbase/agentkit";
511
+
512
+ const walletProvider = await CdpWalletProvider.configureWithWallet({
513
+ apiKeyName: "CDP API KEY NAME",
514
+ apiKeyPrivate: "CDP API KEY PRIVATE KEY",
515
+ networkId: "base-mainnet",
516
+ });
517
+ ```
518
+
519
+ #### Configuring from an existing CDP API Wallet
520
+
521
+ If you already have a CDP API Wallet, you can configure the `CdpWalletProvider` by passing the `wallet` parameter to the `configureWithWallet` method.
522
+
523
+ ```typescript
524
+ import { CdpWalletProvider } from "@coinbase/agentkit";
525
+ import { Wallet } from "@coinbase/coinbase-sdk";
526
+ const walletProvider = await CdpWalletProvider.configureWithWallet({
527
+ wallet,
528
+ apiKeyName: "CDP API KEY NAME",
529
+ apiKeyPrivate: "CDP API KEY PRIVATE KEY",
530
+ });
531
+ ```
532
+
533
+ #### Configuring from a mnemonic phrase
534
+
535
+ The `CdpWalletProvider` can be configured from a mnemonic phrase by passing the `mnemonicPhrase` and `networkId` parameters to the `configureWithWallet` method. If `networkId` is not defined, the `CdpWalletProvider` will fall back to the env var `NETWORK_ID`, and if that is not defined, it will default to `base-sepolia`.
536
+
537
+ ```typescript
538
+ import { CdpWalletProvider } from "@coinbase/agentkit";
539
+
540
+ const walletProvider = await CdpWalletProvider.configureWithWallet({
541
+ mnemonicPhrase: "MNEMONIC PHRASE",
542
+ networkId: "base-sepolia",
543
+ });
544
+ ```
545
+
546
+ #### Exporting a wallet
547
+
548
+ The `CdpWalletProvider` can export a wallet by calling the `exportWallet` method.
549
+
550
+ ```typescript
551
+ import { CdpWalletProvider } from "@coinbase/agentkit";
552
+
553
+ const walletProvider = await CdpWalletProvider.configureWithWallet({
554
+ mnemonicPhrase: "MNEMONIC PHRASE",
555
+ networkId: "base-sepolia",
556
+ });
557
+
558
+ const walletData = await walletProvider.exportWallet();
559
+ ```
560
+
561
+ #### Importing a wallet from `WalletData` JSON string
562
+
563
+ The `CdpWalletProvider` can import a wallet from a `WalletData` JSON string by passing the `cdpWalletData` parameter to the `configureWithWallet` method.
564
+
565
+ ```typescript
566
+ import { CdpWalletProvider } from "@coinbase/agentkit";
567
+
568
+ const walletProvider = await CdpWalletProvider.configureWithWallet({
569
+ cdpWalletData: "WALLET DATA JSON STRING",
570
+ apiKeyName: "CDP API KEY NAME",
571
+ apiKeyPrivate: "CDP API KEY PRIVATE KEY",
572
+ });
573
+ ```
574
+
575
+ #### Configuring CdpWalletProvider gas parameters
576
+
577
+ The `CdpWalletProvider` also exposes parameters for effecting the gas calculations.
578
+
579
+ ```typescript
580
+ import { CdpWalletProvider } from "@coinbase/agentkit";
581
+
582
+ const walletProvider = await CdpWalletProvider.configureWithWallet({
583
+ cdpWalletData: "WALLET DATA JSON STRING",
584
+ apiKeyName: "CDP API KEY NAME",
585
+ apiKeyPrivate: "CDP API KEY PRIVATE KEY",
586
+ gas: {
587
+ gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
588
+ feePerGasMultiplier: 2.0, // Adjusts max fee per gas
589
+ }
590
+ });
591
+ ```
592
+
593
+ **Note**: Gas parameters only impact the `walletProvider.sendTransaction` behavior. Actions that do not rely on direct transaction calls, such as `deploy_token`, `deploy_contract`, and `native_transfer`, remain unaffected.
594
+
595
+
596
+ ### ViemWalletProvider
597
+
598
+ The `ViemWalletProvider` is a wallet provider that uses the [Viem library](https://viem.sh/docs/getting-started). It is useful for interacting with any EVM-compatible chain.
599
+
600
+ ```typescript
601
+ import { ViemWalletProvider } from "@coinbase/agentkit";
602
+ import { privateKeyToAccount } from "viem/accounts";
603
+ import { baseSepolia } from "viem/chains";
604
+ import { http } from "viem/transports";
605
+ import { createWalletClient } from "viem";
606
+
607
+ const account = privateKeyToAccount(
608
+ "0x4c0883a69102937d6231471b5dbb6208ffd70c02a813d7f2da1c54f2e3be9f38",
609
+ );
610
+
611
+ const client = createWalletClient({
612
+ account,
613
+ chain: baseSepolia,
614
+ transport: http(),
615
+ });
616
+
617
+ const walletProvider = new ViemWalletProvider(client);
618
+ ```
619
+
620
+ #### Configuring ViemWalletProvider gas parameters
621
+
622
+ The `ViemWalletProvider` also exposes parameters for effecting the gas calculations.
623
+
624
+ ```typescript
625
+ import { ViemWalletProvider } from "@coinbase/agentkit";
626
+ import { privateKeyToAccount } from "viem/accounts";
627
+ import { baseSepolia } from "viem/chains";
628
+ import { http } from "viem/transports";
629
+ import { createWalletClient } from "viem";
630
+
631
+ const account = privateKeyToAccount(
632
+ "0x4c0883a69102937d6231471b5dbb6208ffd70c02a813d7f2da1c54f2e3be9f38",
633
+ );
634
+
635
+ const client = createWalletClient({
636
+ account,
637
+ chain: baseSepolia,
638
+ transport: http(),
639
+ });
640
+
641
+ const walletProvider = new ViemWalletProvider(client, {
642
+ gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
643
+ feePerGasMultiplier: 2.0, // Adjusts max fee per gas
644
+ });
645
+ ```
646
+
647
+ ### PrivyWalletProvider
648
+
649
+ The `PrivyWalletProvider` is a wallet provider that uses [Privy Server Wallets](https://docs.privy.io/guide/server-wallets/). This implementation extends the `ViemWalletProvider`.
650
+
651
+ ```typescript
652
+ import { PrivyWalletProvider, PrivyWalletConfig } from "@coinbase/agentkit";
653
+
654
+ // Configure Wallet Provider
655
+ const config: PrivyWalletConfig = {
656
+ appId: "PRIVY_APP_ID",
657
+ appSecret: "PRIVY_APP_SECRET",
658
+ chainId: "84532", // base-sepolia
659
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
660
+ authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
661
+ authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
662
+ };
663
+
664
+ const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
665
+ ```
666
+
667
+ #### Authorization Keys
668
+
669
+ Privy offers the option to use authorization keys to secure your server wallets.
670
+
671
+ You can manage authorization keys from your [Privy dashboard](https://dashboard.privy.io/account).
672
+
673
+ When using authorization keys, you must provide the `authorizationPrivateKey` and `authorizationKeyId` parameters to the `configureWithWallet` method if you are creating a new wallet. Please note that when creating a key, if you enable "Create and modify wallets", you will be required to use that key when creating new wallets via the PrivyWalletProvider.
674
+
675
+ #### Exporting Privy Wallet information
676
+
677
+ The `PrivyWalletProvider` can export wallet information by calling the `exportWallet` method.
678
+
679
+ ```typescript
680
+ const walletData = await walletProvider.exportWallet();
681
+
682
+ // walletData will be in the following format:
683
+ {
684
+ walletId: string;
685
+ authorizationKey: string | undefined;
686
+ chainId: string | undefined;
687
+ }
688
+ ```
689
+
690
+ ### SmartWalletProvider
691
+
692
+ The `SmartWalletProvider` is a wallet provider that uses [CDP Smart Wallets](https://docs.cdp.coinbase.com/wallet-api/docs/smart-wallets).
693
+
694
+ ```typescript
695
+ import { SmartWalletProvider, SmartWalletConfig } from "@coinbase/agentkit";
696
+ import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
697
+
698
+ const networkId = process.env.NETWORK_ID || "base-sepolia";
699
+
700
+ const privateKey = process.env.PRIVATE_KEY || generatePrivateKey();
701
+ const signer = privateKeyToAccount(privateKey);
702
+
703
+ // Configure Wallet Provider
704
+ const walletProvider = await SmartWalletProvider.configureWithWallet({
705
+ networkId,
706
+ signer,
707
+ smartWalletAddress: undefined, // If not provided a new smart wallet will be created
708
+ paymasterUrl: undefined, // Sponsor transactions: https://docs.cdp.coinbase.com/paymaster/docs/welcome
709
+ });
710
+ ```
711
+
712
+ ## SVM Wallet Providers
713
+
714
+ SVM:
715
+ - [SolanaKeypairWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/solanaKeypairWalletProvider.ts)
716
+ - [PrivyWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/privySvmWalletProvider.ts)
717
+
718
+ ### SolanaKeypairWalletProvider
719
+
720
+ The `SolanaKeypairWalletProvider` is a wallet provider that uses the API [Solana web3.js](https://solana-labs.github.io/solana-web3.js/).
721
+
722
+ NOTE: It is highly recommended to use a dedicated RPC provider. See [here](https://solana.com/rpc) for more info on Solana RPC infrastructure, and see [here](#rpc-url-configuration) for instructions on configuring `SolanaKeypairWalletProvider` with a custom RPC URL.
723
+
724
+ #### Solana Network Configuration
725
+
726
+ The `SolanaKeypairWalletProvider` can be configured to use a specific network by passing the `networkId` parameter to the `fromNetwork` method. The `networkId` is the ID of the Solana network you want to use. Valid values are `solana-mainnet`, `solana-devnet` and `solana-testnet`.
727
+
728
+ The default RPC endpoints for each network are as follows:
729
+ - `solana-mainnet`: `https://api.mainnet-beta.solana.com`
730
+ - `solana-devnet`: `https://api.devnet.solana.com`
731
+ - `solana-testnet`: `https://api.testnet.solana.com`
732
+
733
+ ```typescript
734
+ import { SOLANA_NETWORK_ID, SolanaKeypairWalletProvider } from "@coinbase/agentkit";
735
+
736
+ // Configure Solana Keypair Wallet Provider
737
+ const privateKey = process.env.SOLANA_PRIVATE_KEY;
738
+ const network = process.env.NETWORK_ID as SOLANA_NETWORK_ID;
739
+ const walletProvider = await SolanaKeypairWalletProvider.fromNetwork(network, privateKey);
740
+ ```
741
+
742
+ #### RPC URL Configuration
743
+
744
+ The `SolanaKeypairWalletProvider` can be configured to use a specific RPC url by passing the `rpcUrl` parameter to the `fromRpcUrl` method. The `rpcUrl` will determine the network you are using.
745
+
746
+ ```typescript
747
+ import { SOLANA_NETWORK_ID, SolanaKeypairWalletProvider } from "@coinbase/agentkit";
748
+
749
+ // Configure Solana Keypair Wallet Provider
750
+ const privateKey = process.env.SOLANA_PRIVATE_KEY;
751
+ const rpcUrl = process.env.SOLANA_RPC_URL;
752
+ const walletProvider = await SolanaKeypairWalletProvider.fromRpcUrl(network, privateKey);
753
+ ```
754
+
755
+ ### PrivyWalletProvider (Solana)
756
+
757
+ The `PrivyWalletProvider` is a wallet provider that uses [Privy Server Wallets](https://docs.privy.io/guide/server-wallets/).
758
+
759
+ NOTE: It is highly recommended to use a dedicated RPC provider. See [here](https://solana.com/rpc) for more info on Solana RPC infrastructure, and see [here](#connection-configuration) for instructions on configuring `PrivyWalletProvider` with a custom RPC URL.
760
+
761
+ ```typescript
762
+ import { PrivyWalletProvider, PrivyWalletConfig } from "@coinbase/agentkit";
763
+
764
+ // Configure Wallet Provider
765
+ const config: PrivyWalletConfig = {
766
+ appId: "PRIVY_APP_ID",
767
+ appSecret: "PRIVY_APP_SECRET",
768
+ chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
769
+ networkId: "solana-devnet", // optional, defaults to "solana-devnet"
770
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
771
+ authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
772
+ authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
773
+ };
774
+
775
+ const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
776
+ ```
777
+
778
+ #### Connection Configuration
779
+
780
+ Optionally, you can configure your own `@solana/web3.js` connection by passing the `connection` parameter to the `configureWithWallet` method.
781
+
782
+ ```typescript
783
+ import { PrivyWalletProvider, PrivyWalletConfig } from "@coinbase/agentkit";
784
+
785
+ const connection = new Connection("YOUR_RPC_URL");
786
+
787
+ // Configure Wallet Provider
788
+ const config: PrivyWalletConfig = {
789
+ appId: "PRIVY_APP_ID",
790
+ appSecret: "PRIVY_APP_SECRET",
791
+ connection,
792
+ chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
793
+ networkId: "solana-devnet", // optional, defaults to "solana-devnet"
794
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
795
+ authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
796
+ authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
797
+ };
798
+
799
+ const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
800
+ ```
801
+
802
+ #### Authorization Keys
803
+
804
+ Privy offers the option to use authorization keys to secure your server wallets.
805
+
806
+ You can manage authorization keys from your [Privy dashboard](https://dashboard.privy.io/account).
807
+
808
+ When using authorization keys, you must provide the `authorizationPrivateKey` and `authorizationKeyId` parameters to the `configureWithWallet` method if you are creating a new wallet. Please note that when creating a key, if you enable "Create and modify wallets", you will be required to use that key when creating new wallets via the PrivyWalletProvider.
809
+
810
+ #### Exporting Privy Wallet information
811
+
812
+ The `PrivyWalletProvider` can export wallet information by calling the `exportWallet` method.
813
+
814
+ ```typescript
815
+ const walletData = await walletProvider.exportWallet();
816
+
817
+ // walletData will be in the following format:
818
+ {
819
+ walletId: string;
820
+ authorizationKey: string | undefined;
821
+ networkId: string | undefined;
822
+ }
823
+ ```
824
+
825
+ ## Contributing
826
+
827
+ See [CONTRIBUTING.md](../../CONTRIBUTING.md) for more information.