@coinbase/agentkit 0.1.2 → 0.2.1

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 (46) hide show
  1. package/README.md +388 -5
  2. package/dist/action-providers/erc20/schemas.d.ts +2 -2
  3. package/dist/action-providers/index.d.ts +8 -7
  4. package/dist/action-providers/index.js +8 -7
  5. package/dist/action-providers/morpho/schemas.d.ts +4 -4
  6. package/dist/action-providers/spl/index.d.ts +1 -0
  7. package/dist/action-providers/spl/index.js +17 -0
  8. package/dist/action-providers/spl/schemas.d.ts +30 -0
  9. package/dist/action-providers/spl/schemas.js +26 -0
  10. package/dist/action-providers/spl/splActionProvider.d.ts +45 -0
  11. package/dist/action-providers/spl/splActionProvider.js +160 -0
  12. package/dist/action-providers/spl/splActionProvider.test.d.ts +1 -0
  13. package/dist/action-providers/spl/splActionProvider.test.js +263 -0
  14. package/dist/action-providers/wallet/walletActionProvider.d.ts +1 -1
  15. package/dist/action-providers/wallet/walletActionProvider.js +31 -18
  16. package/dist/action-providers/wallet/walletActionProvider.test.js +101 -23
  17. package/dist/network/index.d.ts +2 -1
  18. package/dist/network/index.js +2 -1
  19. package/dist/network/network.d.ts +7 -0
  20. package/dist/network/network.js +46 -1
  21. package/dist/network/svm.d.ts +15 -0
  22. package/dist/network/svm.js +38 -0
  23. package/dist/utils.d.ts +11 -0
  24. package/dist/utils.js +14 -0
  25. package/dist/wallet-providers/cdpWalletProvider.d.ts +13 -0
  26. package/dist/wallet-providers/cdpWalletProvider.js +14 -7
  27. package/dist/wallet-providers/index.d.ts +5 -0
  28. package/dist/wallet-providers/index.js +5 -0
  29. package/dist/wallet-providers/privyEvmWalletProvider.d.ts +55 -0
  30. package/dist/wallet-providers/privyEvmWalletProvider.js +140 -0
  31. package/dist/wallet-providers/privyShared.d.ts +40 -0
  32. package/dist/wallet-providers/privyShared.js +49 -0
  33. package/dist/wallet-providers/privySvmWalletProvider.d.ts +128 -0
  34. package/dist/wallet-providers/privySvmWalletProvider.js +212 -0
  35. package/dist/wallet-providers/privyWalletProvider.d.ts +35 -0
  36. package/dist/wallet-providers/privyWalletProvider.js +39 -0
  37. package/dist/wallet-providers/solanaKeypairWalletProvider.d.ts +143 -0
  38. package/dist/wallet-providers/solanaKeypairWalletProvider.js +280 -0
  39. package/dist/wallet-providers/solanaKeypairWalletProvider.test.d.ts +1 -0
  40. package/dist/wallet-providers/solanaKeypairWalletProvider.test.js +24 -0
  41. package/dist/wallet-providers/svmWalletProvider.d.ts +56 -0
  42. package/dist/wallet-providers/svmWalletProvider.js +13 -0
  43. package/dist/wallet-providers/viemWalletProvider.d.ts +15 -1
  44. package/dist/wallet-providers/viemWalletProvider.js +22 -3
  45. package/dist/wallet-providers/walletProvider.d.ts +1 -1
  46. package/package.json +4 -1
package/README.md CHANGED
@@ -8,22 +8,35 @@ AgentKit is a framework for easily enabling AI agents to take actions onchain. I
8
8
  - [Getting Started](#getting-started)
9
9
  - [Installation](#installation)
10
10
  - [Usage](#usage)
11
- - [Create an AgentKit instance](##create-an-agentkit-instance-if-no-wallet-or-action-providers-are-specified-the-agent-will-use-the-cdpwalletprovider-and-walletprovider-action-provider)
11
+ - [Create an AgentKit instance](#create-an-agentkit-instance)
12
12
  - [Create an AgentKit instance with a specified wallet provider](#create-an-agentkit-instance-with-a-specified-wallet-provider)
13
13
  - [Create an AgentKit instance with a specified action providers](#create-an-agentkit-instance-with-a-specified-action-providers)
14
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)
15
16
  - [Creating an Action Provider](#creating-an-action-provider)
16
17
  - [Adding Actions to your Action Provider](#adding-actions-to-your-action-provider)
17
18
  - [Adding Actions to your Action Provider that use a Wallet Provider](#adding-actions-to-your-action-provider-that-use-a-wallet-provider)
18
19
  - [Adding an Action Provider to your AgentKit instance](#adding-an-action-provider-to-your-agentkit-instance)
19
- - [Wallet Providers](#wallet-providers)
20
+ - [EVM Wallet Providers](#evm-wallet-providers)
20
21
  - [CdpWalletProvider](#cdpwalletprovider)
21
22
  - [Network Configuration](#network-configuration)
22
23
  - [Configuring from an existing CDP API Wallet](#configuring-from-an-existing-cdp-api-wallet)
23
24
  - [Configuring from a mnemonic phrase](#configuring-from-a-mnemonic-phrase)
24
25
  - [Exporting a wallet](#exporting-a-wallet)
25
26
  - [Importing a wallet from WalletData JSON string](#importing-a-wallet-from-walletdata-json-string)
27
+ - [Configuring gas parameters](#configuring-cdpwalletprovider-gas-parameters)
26
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
+ - [SVM Wallet Providers](#svm-wallet-providers)
34
+ - [SolanaKeypairWalletProvider](#solanakeypairwalletprovider)
35
+ - [Network Configuration](#solana-network-configuration)
36
+ - [RPC URL Configuration](#rpc-url-configuration)
37
+ - [PrivyWalletProvider](#privywalletprovider-solana)
38
+ - [Authorization Keys](#authorization-keys)
39
+ - [Exporting Privy Wallet information](#exporting-privy-wallet-information)
27
40
  - [Contributing](#contributing)
28
41
 
29
42
  ## Getting Started
@@ -49,6 +62,17 @@ const agentKit = await AgentKit.from({
49
62
  });
50
63
  ```
51
64
 
65
+ ### Create an AgentKit instance
66
+
67
+ If no wallet or action provider are specified, the agent will use the `CdpWalletProvider` and `WalletActionProvider` action provider by default.
68
+
69
+ ```typescript
70
+ const agentKit = await AgentKit.from({
71
+ cdpApiKeyName: "CDP API KEY NAME",
72
+ cdpApiKeyPrivate: "CDP API KEY PRIVATE KEY",
73
+ });
74
+ ```
75
+
52
76
  ### Create an AgentKit instance with a specified wallet provider.
53
77
 
54
78
  ```typescript
@@ -109,6 +133,167 @@ const agent = createReactAgent({
109
133
  });
110
134
  ```
111
135
 
136
+ ## Action Providers
137
+ <details>
138
+ <summary><strong>Basename</strong></summary>
139
+ <table width="100%">
140
+ <tr>
141
+ <td width="200"><code>register_basename</code></td>
142
+ <td width="768">Registers a custom .base.eth or .basetest.eth domain name for the wallet address.</td>
143
+ </tr>
144
+ </table>
145
+ </details>
146
+ <details>
147
+ <summary><strong>CDP Wallet</strong></summary>
148
+ <table width="100%">
149
+ <tr>
150
+ <td width="200"><code>deploy_contract</code></td>
151
+ <td width="768">Deploys a custom smart contract using specified Solidity version and constructor arguments.</td>
152
+ </tr>
153
+ <tr>
154
+ <td width="200"><code>deploy_nft</code></td>
155
+ <td width="768">Deploys a standard ERC-721 NFT contract with configurable name, symbol, and metadata URI.</td>
156
+ </tr>
157
+ <tr>
158
+ <td width="200"><code>deploy_token</code></td>
159
+ <td width="768">Deploys a standard ERC-20 token contract with configurable name, symbol, and initial supply.</td>
160
+ </tr>
161
+ <tr>
162
+ <td width="200"><code>trade</code></td>
163
+ <td width="768">Executes a token swap between two assets at current market rates on mainnet networks.</td>
164
+ </tr>
165
+ </table>
166
+ </details>
167
+ <details>
168
+ <summary><strong>ERC20</strong></summary>
169
+ <table width="100%">
170
+ <tr>
171
+ <td width="200"><code>get_balance</code></td>
172
+ <td width="768">Retrieves the token balance for a specified address and ERC-20 contract.</td>
173
+ </tr>
174
+ <tr>
175
+ <td width="200"><code>transfer</code></td>
176
+ <td width="768">Transfers a specified amount of ERC-20 tokens to a destination address.</td>
177
+ </tr>
178
+ </table>
179
+ </details>
180
+ <details>
181
+ <summary><strong>ERC721</strong></summary>
182
+ <table width="100%">
183
+ <tr>
184
+ <td width="200"><code>get_balance</code></td>
185
+ <td width="768">Retrieves the NFT balance for a specified address and ERC-721 contract.</td>
186
+ </tr>
187
+ <tr>
188
+ <td width="200"><code>mint</code></td>
189
+ <td width="768">Creates a new NFT token and assigns it to a specified destination address.</td>
190
+ </tr>
191
+ <tr>
192
+ <td width="200"><code>transfer</code></td>
193
+ <td width="768">Transfers ownership of a specific NFT token to a destination address.</td>
194
+ </tr>
195
+ </table>
196
+ </details>
197
+ <details>
198
+ <summary><strong>Farcaster</strong></summary>
199
+ <table width="100%">
200
+ <tr>
201
+ <td width="200"><code>account_details</code></td>
202
+ <td width="768">Fetches profile information and metadata for the authenticated Farcaster account.</td>
203
+ </tr>
204
+ <tr>
205
+ <td width="200"><code>post_cast</code></td>
206
+ <td width="768">Creates a new cast (message) on Farcaster with up to 280 characters.</td>
207
+ </tr>
208
+ </table>
209
+ </details>
210
+ <details>
211
+ <summary><strong>Morpho</strong></summary>
212
+ <table width="100%">
213
+ <tr>
214
+ <td width="200"><code>deposit</code></td>
215
+ <td width="768">Deposits a specified amount of assets into a designated Morpho Vault.</td>
216
+ </tr>
217
+ <tr>
218
+ <td width="200"><code>withdraw</code></td>
219
+ <td width="768">Withdraws a specified amount of assets from a designated Morpho Vault.</td>
220
+ </tr>
221
+ </table>
222
+ </details>
223
+ <details>
224
+ <summary><strong>Pyth</strong></summary>
225
+ <table width="100%">
226
+ <tr>
227
+ <td width="200"><code>fetch_price</code></td>
228
+ <td width="768">Retrieves current price data from a specified Pyth price feed.</td>
229
+ </tr>
230
+ <tr>
231
+ <td width="200"><code>fetch_price_feed_id</code></td>
232
+ <td width="768">Retrieves the unique price feed identifier for a given token symbol.</td>
233
+ </tr>
234
+ </table>
235
+ </details>
236
+ <details>
237
+ <summary><strong>Twitter</strong></summary>
238
+ <table width="100%">
239
+ <tr>
240
+ <td width="200"><code>account_details</code></td>
241
+ <td width="768">Fetches profile information and metadata for the authenticated Twitter account.</td>
242
+ </tr>
243
+ <tr>
244
+ <td width="200"><code>account_mentions</code></td>
245
+ <td width="768">Retrieves recent mentions and interactions for the authenticated account.</td>
246
+ </tr>
247
+ <tr>
248
+ <td width="200"><code>post_tweet</code></td>
249
+ <td width="768">Creates a new tweet on the authenticated Twitter account.</td>
250
+ </tr>
251
+ <tr>
252
+ <td width="200"><code>post_tweet_reply</code></td>
253
+ <td width="768">Creates a reply to an existing tweet using the tweet's unique identifier.</td>
254
+ </tr>
255
+ </table>
256
+ </details>
257
+ <details>
258
+ <summary><strong>Wallet</strong></summary>
259
+ <table width="100%">
260
+ <tr>
261
+ <td width="200"><code>get_wallet_details</code></td>
262
+ <td width="768">Retrieves wallet address, network info, balances, and provider details.</td>
263
+ </tr>
264
+ <tr>
265
+ <td width="200"><code>native_transfer</code></td>
266
+ <td width="768">Transfers native blockchain tokens (e.g., ETH) to a destination address.</td>
267
+ </tr>
268
+ </table>
269
+ </details>
270
+ <details>
271
+ <summary><strong>WETH</strong></summary>
272
+ <table width="100%">
273
+ <tr>
274
+ <td width="200"><code>wrap_eth</code></td>
275
+ <td width="768">Converts native ETH to Wrapped ETH (WETH) on Base Sepolia or Base Mainnet.</td>
276
+ </tr>
277
+ </table>
278
+ </details>
279
+ <details>
280
+ <summary><strong>WOW</strong></summary>
281
+ <table width="100%">
282
+ <tr>
283
+ <td width="200"><code>buy_token</code></td>
284
+ <td width="768">Purchases WOW tokens from a contract using ETH based on bonding curve pricing.</td>
285
+ </tr>
286
+ <tr>
287
+ <td width="200"><code>create_token</code></td>
288
+ <td width="768">Creates a new WOW memecoin with bonding curve functionality via Zora factory.</td>
289
+ </tr>
290
+ <tr>
291
+ <td width="200"><code>sell_token</code></td>
292
+ <td width="768">Sells WOW tokens back to the contract for ETH based on bonding curve pricing.</td>
293
+ </tr>
294
+ </table>
295
+ </details>
296
+
112
297
  ## Creating an Action Provider
113
298
 
114
299
  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.
@@ -216,13 +401,14 @@ const agentKit = new AgentKit({
216
401
  });
217
402
  ```
218
403
 
219
- ## Wallet Providers
404
+ ## EVM Wallet Providers
220
405
 
221
406
  Wallet providers give an agent access to a wallet. AgentKit currently supports the following wallet providers:
222
407
 
223
408
  EVM:
224
- - [CdpWalletProvider](./src/wallet-providers/cdpWalletProvider.ts)
225
- - [ViemWalletProvider](./src/wallet-providers/viemWalletProvider.ts)
409
+ - [CdpWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/cdpWalletProvider.ts)
410
+ - [ViemWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/viemWalletProvider.ts)
411
+ - [PrivyWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/privyWalletProvider.ts)
226
412
 
227
413
  ### CdpWalletProvider
228
414
 
@@ -296,6 +482,27 @@ const walletProvider = await CdpWalletProvider.configureWithWallet({
296
482
  });
297
483
  ```
298
484
 
485
+ #### Configuring CdpWalletProvider gas parameters
486
+
487
+ The `CdpWalletProvider` also exposes parameters for effecting the gas calculations.
488
+
489
+ ```typescript
490
+ import { CdpWalletProvider } from "@coinbase/agentkit";
491
+
492
+ const walletProvider = await CdpWalletProvider.configureWithWallet({
493
+ cdpWalletData: "WALLET DATA JSON STRING",
494
+ apiKeyName: "CDP API KEY NAME",
495
+ apiKeyPrivate: "CDP API KEY PRIVATE KEY",
496
+ gas: {
497
+ gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
498
+ feePerGasMultiplier: 2.0, // Adjusts max fee per gas
499
+ }
500
+ });
501
+ ```
502
+
503
+ **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.
504
+
505
+
299
506
  ### ViemWalletProvider
300
507
 
301
508
  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.
@@ -320,6 +527,182 @@ const client = createWalletClient({
320
527
  const walletProvider = new ViemWalletProvider(client);
321
528
  ```
322
529
 
530
+ #### Configuring ViemWalletProvider gas parameters
531
+
532
+ The `ViemWalletProvider` also exposes parameters for effecting the gas calculations.
533
+
534
+ ```typescript
535
+ import { ViemWalletProvider } from "@coinbase/agentkit";
536
+ import { privateKeyToAccount } from "viem/accounts";
537
+ import { baseSepolia } from "viem/chains";
538
+ import { http } from "viem/transports";
539
+ import { createWalletClient } from "viem";
540
+
541
+ const account = privateKeyToAccount(
542
+ "0x4c0883a69102937d6231471b5dbb6208ffd70c02a813d7f2da1c54f2e3be9f38",
543
+ );
544
+
545
+ const client = createWalletClient({
546
+ account,
547
+ chain: baseSepolia,
548
+ transport: http(),
549
+ });
550
+
551
+ const walletProvider = new ViemWalletProvider(client, {
552
+ gasLimitMultiplier: 2.0, // Adjusts gas limit estimation
553
+ feePerGasMultiplier: 2.0, // Adjusts max fee per gas
554
+ });
555
+ ```
556
+
557
+ ### PrivyWalletProvider
558
+
559
+ The `PrivyWalletProvider` is a wallet provider that uses [Privy Server Wallets](https://docs.privy.io/guide/server-wallets/). This implementation extends the `ViemWalletProvider`.
560
+
561
+ ```typescript
562
+ import { PrivyWalletProvider } from "@coinbase/agentkit";
563
+
564
+ // Configure Wallet Provider
565
+ const config = {
566
+ appId: "PRIVY_APP_ID",
567
+ appSecret: "PRIVY_APP_SECRET",
568
+ chainId: "84532", // base-sepolia
569
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
570
+ authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
571
+ authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
572
+ };
573
+
574
+ const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
575
+ ```
576
+
577
+ #### Authorization Keys
578
+
579
+ Privy offers the option to use authorization keys to secure your server wallets.
580
+
581
+ You can manage authorization keys from your [Privy dashboard](https://dashboard.privy.io/account) or programmatically [using the API](https://docs.privy.io/guide/server-wallets/authorization/signatures).
582
+
583
+ 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.
584
+
585
+ #### Exporting Privy Wallet information
586
+
587
+ The `PrivyWalletProvider` can export wallet information by calling the `exportWallet` method.
588
+
589
+ ```typescript
590
+ const walletData = await walletProvider.exportWallet();
591
+
592
+ // walletData will be in the following format:
593
+ {
594
+ walletId: string;
595
+ authorizationKey: string | undefined;
596
+ chainId: string | undefined;
597
+ }
598
+ ```
599
+
600
+ ## SVM Wallet Providers
601
+
602
+ SVM:
603
+ - [SolanaKeypairWalletProvider](https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/wallet-providers/solanaKeypairWalletProvider.ts)
604
+
605
+ ### SolanaKeypairWalletProvider
606
+
607
+ The `SolanaKeypairWalletProvider` is a wallet provider that uses the API [Solana web3.js](https://solana-labs.github.io/solana-web3.js/).
608
+
609
+ #### Solana Network Configuration
610
+
611
+ 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`.
612
+
613
+ The default RPC endpoints for each network are as follows:
614
+ - `solana-mainnet`: `https://api.mainnet-beta.solana.com`
615
+ - `solana-devnet`: `https://api.devnet.solana.com`
616
+ - `solana-testnet`: `https://api.testnet.solana.com`
617
+
618
+ ```typescript
619
+ import { SOLANA_NETWORK_ID, SolanaKeypairWalletProvider } from "@coinbase/agentkit";
620
+
621
+ // Configure Solana Keypair Wallet Provider
622
+ const privateKey = process.env.SOLANA_PRIVATE_KEY;
623
+ const network = process.env.NETWORK_ID as SOLANA_NETWORK_ID;
624
+ const walletProvider = await SolanaKeypairWalletProvider.fromNetwork(network, privateKey);
625
+ ```
626
+
627
+ #### RPC URL Configuration
628
+
629
+ 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.
630
+
631
+ ```typescript
632
+ import { SOLANA_NETWORK_ID, SolanaKeypairWalletProvider } from "@coinbase/agentkit";
633
+
634
+ // Configure Solana Keypair Wallet Provider
635
+ const privateKey = process.env.SOLANA_PRIVATE_KEY;
636
+ const rpcUrl = process.env.SOLANA_RPC_URL;
637
+ const walletProvider = await SolanaKeypairWalletProvider.fromRpcUrl(network, privateKey);
638
+ ```
639
+
640
+ ### PrivyWalletProvider (Solana)
641
+
642
+ The `PrivyWalletProvider` is a wallet provider that uses [Privy Server Wallets](https://docs.privy.io/guide/server-wallets/).
643
+
644
+ ```typescript
645
+ import { PrivyWalletProvider } from "@coinbase/agentkit";
646
+
647
+ // Configure Wallet Provider
648
+ const config = {
649
+ appId: "PRIVY_APP_ID",
650
+ appSecret: "PRIVY_APP_SECRET",
651
+ chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
652
+ networkId: "solana-devnet", // optional, defaults to "solana-devnet"
653
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
654
+ authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
655
+ authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
656
+ };
657
+
658
+ const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
659
+ ```
660
+
661
+ Optionally, you can configure your own `@solana/web3.js` connection by passing the `connection` parameter to the `configureWithWallet` method.
662
+
663
+ ```typescript
664
+ import { PrivyWalletProvider } from "@coinbase/agentkit";
665
+
666
+ const connection = new Connection("YOUR_RPC_URL");
667
+
668
+ // Configure Wallet Provider
669
+ const config = {
670
+ appId: "PRIVY_APP_ID",
671
+ appSecret: "PRIVY_APP_SECRET",
672
+ connection,
673
+ chainType: "solana", // optional, defaults to "evm". Make sure to set this to "solana" if you want to use Solana!
674
+ networkId: "solana-devnet", // optional, defaults to "solana-devnet"
675
+ walletId: "PRIVY_WALLET_ID", // optional, otherwise a new wallet will be created
676
+ authorizationPrivateKey: PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY, // optional, required if your account is using authorization keys
677
+ authorizationKeyId: PRIVY_WALLET_AUTHORIZATION_KEY_ID, // optional, only required to create a new wallet if walletId is not provided
678
+ };
679
+
680
+ const walletProvider = await PrivyWalletProvider.configureWithWallet(config);
681
+ ```
682
+
683
+ #### Authorization Keys
684
+
685
+ Privy offers the option to use authorization keys to secure your server wallets.
686
+
687
+ You can manage authorization keys from your [Privy dashboard](https://dashboard.privy.io/account) or programmatically [using the API](https://docs.privy.io/guide/server-wallets/authorization/signatures).
688
+
689
+ 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.
690
+
691
+ #### Exporting Privy Wallet information
692
+
693
+ The `PrivyWalletProvider` can export wallet information by calling the `exportWallet` method.
694
+
695
+ ```typescript
696
+ const walletData = await walletProvider.exportWallet();
697
+
698
+ // walletData will be in the following format:
699
+ {
700
+ walletId: string;
701
+ authorizationKey: string | undefined;
702
+ networkId: string | undefined;
703
+ }
704
+ ```
705
+
323
706
  ## Contributing
324
707
 
325
708
  See [CONTRIBUTING.md](../../CONTRIBUTING.md) for more information.
@@ -7,12 +7,12 @@ export declare const TransferSchema: z.ZodObject<{
7
7
  contractAddress: z.ZodString;
8
8
  destination: z.ZodString;
9
9
  }, "strip", z.ZodTypeAny, {
10
- amount: bigint;
11
10
  contractAddress: string;
11
+ amount: bigint;
12
12
  destination: string;
13
13
  }, {
14
- amount: bigint;
15
14
  contractAddress: string;
15
+ amount: bigint;
16
16
  destination: string;
17
17
  }>;
18
18
  /**
@@ -1,15 +1,16 @@
1
1
  export * from "./actionDecorator";
2
2
  export * from "./actionProvider";
3
- export * from "./pyth";
3
+ export * from "./customActionProvider";
4
+ export * from "./alchemy";
5
+ export * from "./basename";
4
6
  export * from "./cdp";
5
- export * from "./weth";
6
7
  export * from "./erc20";
7
8
  export * from "./erc721";
8
- export * from "./morpho";
9
- export * from "./basename";
10
9
  export * from "./farcaster";
10
+ export * from "./pyth";
11
+ export * from "./moonwell";
12
+ export * from "./morpho";
13
+ export * from "./spl";
11
14
  export * from "./twitter";
12
15
  export * from "./wallet";
13
- export * from "./customActionProvider";
14
- export * from "./alchemy";
15
- export * from "./moonwell";
16
+ export * from "./weth";
@@ -16,16 +16,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./actionDecorator"), exports);
18
18
  __exportStar(require("./actionProvider"), exports);
19
- __exportStar(require("./pyth"), exports);
19
+ __exportStar(require("./customActionProvider"), exports);
20
+ __exportStar(require("./alchemy"), exports);
21
+ __exportStar(require("./basename"), exports);
20
22
  __exportStar(require("./cdp"), exports);
21
- __exportStar(require("./weth"), exports);
22
23
  __exportStar(require("./erc20"), exports);
23
24
  __exportStar(require("./erc721"), exports);
24
- __exportStar(require("./morpho"), exports);
25
- __exportStar(require("./basename"), exports);
26
25
  __exportStar(require("./farcaster"), exports);
26
+ __exportStar(require("./pyth"), exports);
27
+ __exportStar(require("./moonwell"), exports);
28
+ __exportStar(require("./morpho"), exports);
29
+ __exportStar(require("./spl"), exports);
27
30
  __exportStar(require("./twitter"), exports);
28
31
  __exportStar(require("./wallet"), exports);
29
- __exportStar(require("./customActionProvider"), exports);
30
- __exportStar(require("./alchemy"), exports);
31
- __exportStar(require("./moonwell"), exports);
32
+ __exportStar(require("./weth"), exports);
@@ -8,13 +8,13 @@ export declare const DepositSchema: z.ZodObject<{
8
8
  tokenAddress: z.ZodString;
9
9
  vaultAddress: z.ZodString;
10
10
  }, "strip", z.ZodTypeAny, {
11
- assets: string;
12
11
  receiver: string;
12
+ assets: string;
13
13
  tokenAddress: string;
14
14
  vaultAddress: string;
15
15
  }, {
16
- assets: string;
17
16
  receiver: string;
17
+ assets: string;
18
18
  tokenAddress: string;
19
19
  vaultAddress: string;
20
20
  }>;
@@ -26,11 +26,11 @@ export declare const WithdrawSchema: z.ZodObject<{
26
26
  assets: z.ZodString;
27
27
  receiver: z.ZodString;
28
28
  }, "strip", z.ZodTypeAny, {
29
- assets: string;
30
29
  receiver: string;
30
+ assets: string;
31
31
  vaultAddress: string;
32
32
  }, {
33
- assets: string;
34
33
  receiver: string;
34
+ assets: string;
35
35
  vaultAddress: string;
36
36
  }>;
@@ -0,0 +1 @@
1
+ export * from "./splActionProvider";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./splActionProvider"), exports);
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Schema for transferring SPL tokens to another address.
4
+ */
5
+ export declare const TransferTokenSchema: z.ZodObject<{
6
+ recipient: z.ZodString;
7
+ mintAddress: z.ZodString;
8
+ amount: z.ZodNumber;
9
+ }, "strip", z.ZodTypeAny, {
10
+ amount: number;
11
+ recipient: string;
12
+ mintAddress: string;
13
+ }, {
14
+ amount: number;
15
+ recipient: string;
16
+ mintAddress: string;
17
+ }>;
18
+ /**
19
+ * Schema for getting SPL token balance.
20
+ */
21
+ export declare const GetBalanceSchema: z.ZodObject<{
22
+ mintAddress: z.ZodString;
23
+ address: z.ZodOptional<z.ZodString>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ mintAddress: string;
26
+ address?: string | undefined;
27
+ }, {
28
+ mintAddress: string;
29
+ address?: string | undefined;
30
+ }>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetBalanceSchema = exports.TransferTokenSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Schema for transferring SPL tokens to another address.
7
+ */
8
+ exports.TransferTokenSchema = zod_1.z
9
+ .object({
10
+ recipient: zod_1.z.string().describe("The recipient's Solana address"),
11
+ mintAddress: zod_1.z.string().describe("The SPL token's mint address"),
12
+ amount: zod_1.z.number().positive().describe("Amount of tokens to transfer"),
13
+ })
14
+ .describe("Transfer SPL tokens to another Solana address");
15
+ /**
16
+ * Schema for getting SPL token balance.
17
+ */
18
+ exports.GetBalanceSchema = zod_1.z
19
+ .object({
20
+ mintAddress: zod_1.z.string().describe("The SPL token's mint address"),
21
+ address: zod_1.z
22
+ .string()
23
+ .optional()
24
+ .describe("Optional address to check balance for. If not provided, uses the wallet's address"),
25
+ })
26
+ .describe("Get SPL token balance for an address");
@@ -0,0 +1,45 @@
1
+ import { ActionProvider } from "../actionProvider";
2
+ import { Network } from "../../network";
3
+ import { SvmWalletProvider } from "../../wallet-providers/svmWalletProvider";
4
+ import { z } from "zod";
5
+ import { TransferTokenSchema, GetBalanceSchema } from "./schemas";
6
+ /**
7
+ * SplActionProvider serves as a provider for SPL token actions.
8
+ * It provides SPL token transfer functionality.
9
+ */
10
+ export declare class SplActionProvider extends ActionProvider<SvmWalletProvider> {
11
+ /**
12
+ * Creates a new SplActionProvider instance.
13
+ */
14
+ constructor();
15
+ /**
16
+ * Get the balance of SPL tokens for an address.
17
+ *
18
+ * @param walletProvider - The wallet provider to use
19
+ * @param args - Parameters including mint address and optional target address
20
+ * @returns A message indicating the token balance
21
+ */
22
+ getBalance(walletProvider: SvmWalletProvider, args: z.infer<typeof GetBalanceSchema>): Promise<string>;
23
+ /**
24
+ * Transfer SPL tokens to another address.
25
+ *
26
+ * @param walletProvider - The wallet provider to use for the transfer
27
+ * @param args - Transfer parameters including recipient address, mint address, and amount
28
+ * @returns A message indicating success or failure with transaction details
29
+ */
30
+ transfer(walletProvider: SvmWalletProvider, args: z.infer<typeof TransferTokenSchema>): Promise<string>;
31
+ /**
32
+ * Checks if the action provider supports the given network.
33
+ * Only supports Solana networks.
34
+ *
35
+ * @param network - The network to check support for
36
+ * @returns True if the network is a Solana network
37
+ */
38
+ supportsNetwork(network: Network): boolean;
39
+ }
40
+ /**
41
+ * Factory function to create a new SplActionProvider instance.
42
+ *
43
+ * @returns A new SplActionProvider instance
44
+ */
45
+ export declare const splActionProvider: () => SplActionProvider;