From 35c1e54989b6716eb384b4de93ada5d3836b4e4d Mon Sep 17 00:00:00 2001 From: michaelessiet Date: Thu, 26 Dec 2024 16:03:36 +0100 Subject: [PATCH] feat: vercel-ai-sdk --- docs/assets/navigation.js | 2 +- docs/assets/search.js | 2 +- docs/classes/SolanaAgentKit.html | 13 +- docs/functions/createSolanaTools.html | 2 +- docs/functions/createVercelAITools.html | 1 + docs/index.html | 21 +- docs/interfaces/CollectionDeployment.html | 4 +- docs/interfaces/CollectionOptions.html | 4 +- docs/interfaces/Creator.html | 4 +- docs/interfaces/FetchPriceResponse.html | 4 +- docs/interfaces/GibworkCreateTaskReponse.html | 4 + docs/interfaces/JupiterTokenData.html | 4 +- .../LuloAccountDetailsResponse.html | 4 +- .../interfaces/MintCollectionNFTResponse.html | 4 +- docs/interfaces/PumpFunTokenOptions.html | 4 +- docs/interfaces/PumpfunLaunchResponse.html | 4 +- docs/interfaces/PythFetchPriceResponse.html | 4 +- docs/modules.html | 2 + package.json | 136 +- pnpm-lock.yaml | 193 +++ src/index.ts | 3 +- src/vercel-ai/index.ts | 1489 +++++++++++++++++ test/agent_sdks/vercel_ai.ts | 196 +++ 23 files changed, 2003 insertions(+), 101 deletions(-) create mode 100644 docs/functions/createVercelAITools.html create mode 100644 docs/interfaces/GibworkCreateTaskReponse.html create mode 100644 src/vercel-ai/index.ts create mode 100644 test/agent_sdks/vercel_ai.ts diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index bcaae4e..cce3849 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE42TwU7DMAyG3yXniooJJtTbRNUDDJigN8QhCi6JltpR40hMaO+OtiFYWebtkos/f7asP69fiuGTVaVeyGvUsw9AvnesChU0W1Up43WMEMtx/cJy71Whlg7fVXU5uVkXv6Zb8h4MO8IagqdVD7jnc8gwdNpALHPgWDy5nmbFT2HzxhPWH0pUDqCZhrxoV5PaG2BjF4Mz8AwxEEbImg4xSXqXgmMYWloC1pp1VvkfkoTz5GlmDCXkGlg7H8Vtj+PSkAeH/Hf6x6YVZxylpRGL1Icu4VwnNFbUZ8lT6ibh9pxSuDKcqF2xPTMjeVSSm00+YfcvWyK/t3GXcHvYWB5AY+P0av32DUTvPWMEBAAA" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE43TQU+DMBQH8O/S8+LioovZjUgw6tRlEi/GQ1ffpKG0TfsaXYzf3cqMEykPLxzov78/PMrjO0N4Q7Zg90ZxzbMX0HgtkU2Y5VjF+0Jx78FPu+tHFTYqhmqpn9nieHb2MfmRzo1SIFAanYNVZtfELQdPagS35SKSqWAXnp3Ok/Cd/br6EfU7RZIOOBqXhvZr1PYCUFQrJwWswdvYBUmpH6PQC7l5Na5u66Hkvl7DMD0UpgqugpURKE0NOufIk/DfEAUugzKZECZozAG5VJ4cx3CcKrmJwuHb3hYl2TGYpipWobHboJc8aFGRfDI5RhdBt+OkTm8iR7I7rP55CNNRChftodr/+KUx6tcTx3dvB+unvVBXnJ/0wAdwAlR2OUJ2Yj306ROld4uPugQAAA==" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index b0786c5..26b312e 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE7Wd33OcOBLH/xf8OuUEkPjhNyc+V+Uuu0kl3r2HqZQLD/KEMwMsaOKbS+V/vxIwQ/eoGTeD9ylbHnX3V9JHLSGQ9qdTl8+Nc7X86TxlRepcuV60cIpko5wr52uZJ0VyvVaF/lemnYWzrXPnylnlSdOo5g3++fK73uTOYv+rc+U4vxZ7r9L1Dl5XZdHoervSZc1xeYHLA/cLp0pqVWhb6RDYfesJGLlQK52VBTfwUHxO3OckzxWr/S4ORefHu0/StFZNMyEuMJkTv6xUkWT3SZXdP6kdK75lMjG+91YM3Nbqr61q9G2yXSl9uy1SXhuQZnN0pKr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8cyDKQOP5zG5AzsgHGFDnmEdaf8lXNzKTzeaHQCpBlX1elZHDVXt3GfAHnrB8Xr7F/qojf2Ah5DMr3B9nTiqU0wKQggLeANs/CBErblBNl1nN7h7tx/Ye7cfuHm2gDohjumtvhRx5ZgHseTz2en9NmRO1BZ3gMjuhu/7pwVz/VPXXP4FJCzgUPIfmvtDV4b7QZH9fKKgz8Olxfe6PmYOOAE0X8DIVuPMCVBFkPBF2lpI32ewvLnnATz4SMCJ5kHQbc4m5qu4pQxMymG14ib2/LRa0N9zR5A2B/VkNkM9Ap0X97nnMWx/sT7uCaRgoCnkN1B0hBS5Akgh5c8pwARDoKlAtyWOxnZOOJnIgJuKh09588aO7+QIwDRom4LVufy03yAFgXLi8lDLc6Q7cwP1r3nxzuOEJtC+okOSxd/TkI4AHwfOw/59QgMkJzE0TXNxTr0KAHJ6r/b1PoFWAE8nw8m3hVFml8qxQztXy269f/wdrfe1E92QAAA=="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE7Wd23LbOBKG30W+dXlEkOAhd06y3spuZpJKnOyFK+WiRdjhmhI5JBWPN5V3X4CkxG6iKTVFz81kJKH/bgAfjiTgn4syf6oWr25+Lh7TTbJ45YjwfLGJ12rxavE5z+JNfPmgNvW/03pxvtiWmf56lcVVparf8M8X3+t1ptN0v+p0i1/nO1XpiL3qKt9Udbld1XnJkTzD6YH8+aKIS53SjrR37CyFBz1v1KpO8w3XcZ98jt+nOMsUq/zO9knn+7uNk6RUVTXBLzCZ4z8v1CZOb+MivX1Uzyz/lslE/2Lp9dyW6s+tquqreLtS9dV2k/DKgDSbE0eiiix/vs4fFQ84nH6+5ze5rlQ+74TRnBgeVP061glXiuUdJZ/jd51u6j+urllO+7RzPNZlvKnuFa87A4nnMf6QVrUq3+brOOXVr2Uyz3+VZz+UTjwpAstoJmEfy3Qdl88TYiCMZtZ9wgN8l3KOt0xtkkttXfN6NJR8Zklff/zMLd826Vx/pht8G9fx6+fLCQPZmO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WZNUiPQgCLeON5o3CuV4P2JCEQT8UholNLNtkpWKF+gW414LXF3Lca9ws0F1J3k9Xzd0NOOQ2TfDBqPz2s8cDgjtjkkaEuS1x2aO/T6tQxCHjQilwkFEqPyHIE8RzzR7tLDtmXG6/UPD0UJYHF5bQEJrpq7HIEewNjlIYP1ioEeqBKXVyW7ew/iAvVpPphp+LwGtltgETN5kE2Hmc327wrcN39X4L79uwIgOhAcU665JXdkLQTYE0xMWj39HyK3cNLNrIT2nrg7c09c0d0TB3pgEJ/Hi8/cn7za358c7+5PBnkGQQpekP19FKAiQJ/n83oqcCwBZBH0eF7UzWa6WY3Zq2cJd1cd3eGllQTTSckjud1LjM3tmY8pGplBh8LrQ7trtEHBw01dXlvYnWwBQw0gIuqeIET+rriYqt1BeTArBdOOgFdS7elzIAFaZsgrIbN0HQzJcOG/5MHZ30AGah5OzHjtphnrBg8wQJYiXp/fXL3zo716B7QVkC2f1211f/4A9C0gSw4zS/u/nQFk4BMBZp52V8yB8gUZkrw2OlhReUDB4yns/tgPGPTAmDdB4pZ6uATC4UntLp4DpQJ4kYxq/na+KNJCZelGm9x8+/Xr/7GNz7tfagAA"; \ No newline at end of file diff --git a/docs/classes/SolanaAgentKit.html b/docs/classes/SolanaAgentKit.html index eccbc8c..1e9f3b9 100644 --- a/docs/classes/SolanaAgentKit.html +++ b/docs/classes/SolanaAgentKit.html @@ -1,12 +1,13 @@ SolanaAgentKit | solana-agent-kit

Class SolanaAgentKit

Main class for interacting with Solana blockchain Provides a unified interface for token operations, NFT management, trading and more

SolanaAgentKit

-

Constructors

Constructors

Properties

Methods

Methods

createGibworkTask +createOrcaSingleSidedWhirlpool deployCollection deployToken fetchTokenPrice @@ -36,7 +37,7 @@ Provides a unified interface for token operations, NFT management, trading and m stake trade transfer -

Constructors

  • Parameters

    • private_key: string
    • rpc_url: string = "https://api.mainnet-beta.solana.com"
    • openai_api_key: string

    Returns SolanaAgentKit

Properties

connection: Connection

Solana RPC connection

-
openai_api_key: string
wallet: Keypair

Wallet keypair for signing transactions

-
wallet_address: PublicKey

Public key of the wallet

-

Methods

  • Parameters

    • depositTokenAmount: BN
    • depositTokenMint: PublicKey
    • otherTokenMint: PublicKey
    • initialPrice: Decimal
    • maxPrice: Decimal
    • feeTier:
          | 0.01
          | 0.02
          | 0.04
          | 0.05
          | 0.16
          | 0.3
          | 0.65
          | 1
          | 2

    Returns Promise<string>

  • Parameters

    • name: string
    • uri: string
    • symbol: string
    • decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS
    • OptionalinitialSupply: number

    Returns Promise<{
        mint: PublicKey;
    }>

  • Parameters

    • mint: string

    Returns Promise<string>

  • Returns Promise<String[]>

  • Returns Promise<string[]>

  • Parameters

    • Optionaltoken_address: PublicKey

    Returns Promise<number>

  • Parameters

    • owner: PublicKey

    Returns Promise<null | string>

  • Parameters

    • owner: PublicKey

    Returns Promise<string[]>

  • Parameters

    • tld: string

    Returns Promise<string[]>

  • Parameters

    • account: PublicKey

    Returns Promise<string>

  • Parameters

    • amount: number

    Returns Promise<string>

  • Parameters

    • collectionMint: PublicKey
    • metadata: {
          creators?: {
              address: string;
              share: number;
          }[];
          name: string;
          sellerFeeBasisPoints?: number;
          uri: string;
      }
      • Optionalcreators?: {
            address: string;
            share: number;
        }[]
      • name: string
      • OptionalsellerFeeBasisPoints?: number
      • uri: string
    • Optionalrecipient: PublicKey

    Returns Promise<MintCollectionNFTResponse>

  • Parameters

    • baseMint: PublicKey
    • quoteMint: PublicKey
    • lotSize: number = 1
    • tickSize: number = 0.01

    Returns Promise<string[]>

  • Parameters

    • priceFeedID: string

    Returns Promise<string>

  • Parameters

    • marketId: PublicKey
    • baseAmount: BN
    • quoteAmount: BN
    • startTime: BN

    Returns Promise<string>

  • Parameters

    • mint1: PublicKey
    • mint2: PublicKey
    • configId: PublicKey
    • initialPrice: Decimal
    • startTime: BN

    Returns Promise<string>

  • Parameters

    • mint1: PublicKey
    • mint2: PublicKey
    • configId: PublicKey
    • mintAAmount: BN
    • mintBAmount: BN
    • startTime: BN

    Returns Promise<string>

  • Parameters

    • name: string
    • OptionalspaceKB: number

    Returns Promise<string>

  • Returns Promise<string>

  • Parameters

    • domain: string

    Returns Promise<undefined | PublicKey>

  • Parameters

    • domain: string

    Returns Promise<PublicKey>

  • Parameters

    • mintAddress: string
    • amount: number
    • decimals: number
    • recipients: string[]
    • priorityFeeInLamports: number
    • shouldLog: boolean

    Returns Promise<string[]>

  • Parameters

    • amount: number

    Returns Promise<string>

  • Parameters

    • outputMint: PublicKey
    • inputAmount: number
    • OptionalinputMint: PublicKey
    • slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS

    Returns Promise<string>

  • Parameters

    • to: PublicKey
    • amount: number
    • Optionalmint: PublicKey

    Returns Promise<string>

+

Constructors

  • Parameters

    • private_key: string
    • rpc_url: string = "https://api.mainnet-beta.solana.com"
    • openai_api_key: string

    Returns SolanaAgentKit

Properties

connection: Connection

Solana RPC connection

+
openai_api_key: string
wallet: Keypair

Wallet keypair for signing transactions

+
wallet_address: PublicKey

Public key of the wallet

+

Methods

  • Parameters

    • title: string
    • content: string
    • requirements: string
    • tags: string[]
    • tokenMintAddress: string
    • tokenAmount: number
    • Optionalpayer: string

    Returns Promise<GibworkCreateTaskReponse>

  • Parameters

    • depositTokenAmount: BN
    • depositTokenMint: PublicKey
    • otherTokenMint: PublicKey
    • initialPrice: Decimal
    • maxPrice: Decimal
    • feeTier:
          | 0.01
          | 0.02
          | 0.04
          | 0.05
          | 0.16
          | 0.3
          | 0.65
          | 1
          | 2

    Returns Promise<string>

  • Parameters

    • name: string
    • uri: string
    • symbol: string
    • decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS
    • OptionalinitialSupply: number

    Returns Promise<{
        mint: PublicKey;
    }>

  • Parameters

    • mint: string

    Returns Promise<string>

  • Returns Promise<String[]>

  • Returns Promise<string[]>

  • Parameters

    • Optionaltoken_address: PublicKey

    Returns Promise<number>

  • Parameters

    • owner: PublicKey

    Returns Promise<null | string>

  • Parameters

    • owner: PublicKey

    Returns Promise<string[]>

  • Parameters

    • tld: string

    Returns Promise<string[]>

  • Parameters

    • account: PublicKey

    Returns Promise<string>

  • Parameters

    • amount: number

    Returns Promise<string>

  • Parameters

    • collectionMint: PublicKey
    • metadata: {
          creators?: {
              address: string;
              share: number;
          }[];
          name: string;
          sellerFeeBasisPoints?: number;
          uri: string;
      }
      • Optionalcreators?: {
            address: string;
            share: number;
        }[]
      • name: string
      • OptionalsellerFeeBasisPoints?: number
      • uri: string
    • Optionalrecipient: PublicKey

    Returns Promise<MintCollectionNFTResponse>

  • Parameters

    • baseMint: PublicKey
    • quoteMint: PublicKey
    • lotSize: number = 1
    • tickSize: number = 0.01

    Returns Promise<string[]>

  • Parameters

    • priceFeedID: string

    Returns Promise<string>

  • Parameters

    • marketId: PublicKey
    • baseAmount: BN
    • quoteAmount: BN
    • startTime: BN

    Returns Promise<string>

  • Parameters

    • mint1: PublicKey
    • mint2: PublicKey
    • configId: PublicKey
    • initialPrice: Decimal
    • startTime: BN

    Returns Promise<string>

  • Parameters

    • mint1: PublicKey
    • mint2: PublicKey
    • configId: PublicKey
    • mintAAmount: BN
    • mintBAmount: BN
    • startTime: BN

    Returns Promise<string>

  • Parameters

    • name: string
    • OptionalspaceKB: number

    Returns Promise<string>

  • Returns Promise<string>

  • Parameters

    • domain: string

    Returns Promise<undefined | PublicKey>

  • Parameters

    • domain: string

    Returns Promise<PublicKey>

  • Parameters

    • mintAddress: string
    • amount: number
    • decimals: number
    • recipients: string[]
    • priorityFeeInLamports: number
    • shouldLog: boolean

    Returns Promise<string[]>

  • Parameters

    • amount: number

    Returns Promise<string>

  • Parameters

    • outputMint: PublicKey
    • inputAmount: number
    • OptionalinputMint: PublicKey
    • slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS

    Returns Promise<string>

  • Parameters

    • to: PublicKey
    • amount: number
    • Optionalmint: PublicKey

    Returns Promise<string>

diff --git a/docs/functions/createSolanaTools.html b/docs/functions/createSolanaTools.html index e52f87a..522c832 100644 --- a/docs/functions/createSolanaTools.html +++ b/docs/functions/createSolanaTools.html @@ -1 +1 @@ -createSolanaTools | solana-agent-kit

Function createSolanaTools

  • Parameters

    Returns (
        | SolanaBalanceTool
        | SolanaTransferTool
        | SolanaDeployTokenTool
        | SolanaDeployCollectionTool
        | SolanaMintNFTTool
        | SolanaTradeTool
        | SolanaRequestFundsTool
        | SolanaRegisterDomainTool
        | SolanaResolveDomainTool
        | SolanaGetDomainTool
        | SolanaGetWalletAddressTool
        | SolanaPumpfunTokenLaunchTool
        | SolanaCreateImageTool
        | SolanaLendAssetTool
        | SolanaTPSCalculatorTool
        | SolanaStakeTool
        | SolanaFetchPriceTool
        | SolanaTokenDataTool
        | SolanaTokenDataByTickerTool
        | SolanaCompressedAirdropTool
        | SolanaCreateSingleSidedWhirlpoolTool
        | SolanaRaydiumCreateAmmV4
        | SolanaRaydiumCreateClmm
        | SolanaRaydiumCreateCpmm
        | SolanaOpenbookCreateMarket
        | SolanaPythFetchPrice
        | SolanaResolveAllDomainsTool
        | SolanaGetOwnedDomains
        | SolanaGetOwnedTldDomains
        | SolanaGetAllTlds
        | SolanaGetMainDomain)[]

+createSolanaTools | solana-agent-kit

Function createSolanaTools

  • Parameters

    Returns (
        | SolanaBalanceTool
        | SolanaTransferTool
        | SolanaDeployTokenTool
        | SolanaDeployCollectionTool
        | SolanaMintNFTTool
        | SolanaTradeTool
        | SolanaRequestFundsTool
        | SolanaRegisterDomainTool
        | SolanaResolveDomainTool
        | SolanaGetDomainTool
        | SolanaGetWalletAddressTool
        | SolanaPumpfunTokenLaunchTool
        | SolanaCreateImageTool
        | SolanaLendAssetTool
        | SolanaTPSCalculatorTool
        | SolanaStakeTool
        | SolanaFetchPriceTool
        | SolanaTokenDataTool
        | SolanaTokenDataByTickerTool
        | SolanaCompressedAirdropTool
        | SolanaCreateSingleSidedWhirlpoolTool
        | SolanaRaydiumCreateAmmV4
        | SolanaRaydiumCreateClmm
        | SolanaRaydiumCreateCpmm
        | SolanaOpenbookCreateMarket
        | SolanaPythFetchPrice
        | SolanaResolveAllDomainsTool
        | SolanaGetOwnedDomains
        | SolanaGetOwnedTldDomains
        | SolanaGetAllTlds
        | SolanaGetMainDomain
        | SolanaCreateGibworkTask)[]

diff --git a/docs/functions/createVercelAITools.html b/docs/functions/createVercelAITools.html new file mode 100644 index 0000000..1702ff1 --- /dev/null +++ b/docs/functions/createVercelAITools.html @@ -0,0 +1 @@ +createVercelAITools | solana-agent-kit

Function createVercelAITools

  • Parameters

    Returns CoreTool[]

diff --git a/docs/index.html b/docs/index.html index 7dd0878..f76a141 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,6 +1,9 @@ solana-agent-kit

solana-agent-kit

-

Solana Agent Kit

-

Solana Agent Kit Cover 1 (3)

+

Solana Agent Kit

Solana Agent Kit Cover 1 (3)

+

NPM Downloads +GitHub forks +GitHub License

+

An open-source toolkit for connecting AI agents to Solana protocols. Now, any agent, using any model can autonomously perform 15+ Solana actions:

  • Trade tokens
  • @@ -38,21 +41,29 @@
  • Jupiter Exchange swaps
  • Launch on Pump via PumpPortal
  • Raydium pool creation (CPMM, CLMM, AMMv4)
  • -
  • Orca whirlpool integration
  • +
  • Orca Whirlpool integration
  • Meteora Dynamic AMM, DLMM Pool, and Alpga Vault
  • Openbook market creation
  • Register and Resolve SNS
  • Jito Bundles
  • +
  • Pyth Price feeds for fetching Asset Prices
  • +
  • Register/resolve Alldomains
  • Solana Blinks

      -
    • Lending by Lulo
    • +
    • Lending by Lulon (Best APR for USDC)
    • Send Arcade Games
    • JupSOL staking
  • +
  • +

    Non-Financial Actions

    +
      +
    • Gib Work for registering bounties
    • +
    +
    • @@ -123,6 +134,6 @@

    Contributions are welcome! Please feel free to submit a Pull Request. Refer to CONTRIBUTING.md for detailed guidelines on how to contribute to this project.

    -

    MIT License

    +

    Apache-2 License

    This toolkit handles private keys and transactions. Always ensure you're using it in a secure environment and never share your private keys.

    diff --git a/docs/interfaces/CollectionDeployment.html b/docs/interfaces/CollectionDeployment.html index c03b39a..078c9aa 100644 --- a/docs/interfaces/CollectionDeployment.html +++ b/docs/interfaces/CollectionDeployment.html @@ -1,3 +1,3 @@ -CollectionDeployment | solana-agent-kit

    Interface CollectionDeployment

    interface CollectionDeployment {
        collectionAddress: PublicKey;
        signature: Uint8Array<ArrayBufferLike>;
    }

    Properties

    collectionAddress +CollectionDeployment | solana-agent-kit

    Interface CollectionDeployment

    interface CollectionDeployment {
        collectionAddress: PublicKey;
        signature: Uint8Array<ArrayBufferLike>;
    }

    Properties

    collectionAddress: PublicKey
    signature: Uint8Array<ArrayBufferLike>
    +

    Properties

    collectionAddress: PublicKey
    signature: Uint8Array<ArrayBufferLike>
    diff --git a/docs/interfaces/CollectionOptions.html b/docs/interfaces/CollectionOptions.html index 6790105..a30acbc 100644 --- a/docs/interfaces/CollectionOptions.html +++ b/docs/interfaces/CollectionOptions.html @@ -1,5 +1,5 @@ -CollectionOptions | solana-agent-kit

    Interface CollectionOptions

    interface CollectionOptions {
        creators?: Creator[];
        name: string;
        royaltyBasisPoints?: number;
        uri: string;
    }

    Properties

    creators? +CollectionOptions | solana-agent-kit

    Interface CollectionOptions

    interface CollectionOptions {
        creators?: Creator[];
        name: string;
        royaltyBasisPoints?: number;
        uri: string;
    }

    Properties

    creators?: Creator[]
    name: string
    royaltyBasisPoints?: number
    uri: string
    +

    Properties

    creators?: Creator[]
    name: string
    royaltyBasisPoints?: number
    uri: string
    diff --git a/docs/interfaces/Creator.html b/docs/interfaces/Creator.html index 4e33592..c0db0d3 100644 --- a/docs/interfaces/Creator.html +++ b/docs/interfaces/Creator.html @@ -1,3 +1,3 @@ -Creator | solana-agent-kit

    Interface Creator

    interface Creator {
        address: string;
        percentage: number;
    }

    Properties

    address +Creator | solana-agent-kit

    Interface Creator

    interface Creator {
        address: string;
        percentage: number;
    }

    Properties

    Properties

    address: string
    percentage: number
    +

    Properties

    address: string
    percentage: number
    diff --git a/docs/interfaces/FetchPriceResponse.html b/docs/interfaces/FetchPriceResponse.html index defd401..9034730 100644 --- a/docs/interfaces/FetchPriceResponse.html +++ b/docs/interfaces/FetchPriceResponse.html @@ -1,6 +1,6 @@ -FetchPriceResponse | solana-agent-kit

    Interface FetchPriceResponse

    interface FetchPriceResponse {
        code?: string;
        message?: string;
        priceInUSDC?: string;
        status: "success" | "error";
        tokenId?: string;
    }

    Properties

    code? +FetchPriceResponse | solana-agent-kit

    Interface FetchPriceResponse

    interface FetchPriceResponse {
        code?: string;
        message?: string;
        priceInUSDC?: string;
        status: "success" | "error";
        tokenId?: string;
    }

    Properties

    code?: string
    message?: string
    priceInUSDC?: string
    status: "success" | "error"
    tokenId?: string
    +

    Properties

    code?: string
    message?: string
    priceInUSDC?: string
    status: "success" | "error"
    tokenId?: string
    diff --git a/docs/interfaces/GibworkCreateTaskReponse.html b/docs/interfaces/GibworkCreateTaskReponse.html new file mode 100644 index 0000000..5756fef --- /dev/null +++ b/docs/interfaces/GibworkCreateTaskReponse.html @@ -0,0 +1,4 @@ +GibworkCreateTaskReponse | solana-agent-kit

    Interface GibworkCreateTaskReponse

    interface GibworkCreateTaskReponse {
        signature?: string;
        status: "success" | "error";
        taskId?: string;
    }

    Properties

    Properties

    signature?: string
    status: "success" | "error"
    taskId?: string
    diff --git a/docs/interfaces/JupiterTokenData.html b/docs/interfaces/JupiterTokenData.html index 2b23375..e7e78b6 100644 --- a/docs/interfaces/JupiterTokenData.html +++ b/docs/interfaces/JupiterTokenData.html @@ -1,4 +1,4 @@ -JupiterTokenData | solana-agent-kit

    Interface JupiterTokenData

    interface JupiterTokenData {
        address: string;
        daily_volume: number;
        decimals: number;
        extensions: {
            coingeckoId?: string;
        };
        freeze_authority: null | string;
        logoURI: string;
        mint_authority: null | string;
        name: string;
        permanent_delegate: null | string;
        symbol: string;
        tags: string[];
    }

    Properties

    address +JupiterTokenData | solana-agent-kit

    Interface JupiterTokenData

    interface JupiterTokenData {
        address: string;
        daily_volume: number;
        decimals: number;
        extensions: {
            coingeckoId?: string;
        };
        freeze_authority: null | string;
        logoURI: string;
        mint_authority: null | string;
        name: string;
        permanent_delegate: null | string;
        symbol: string;
        tags: string[];
    }

    Properties

    address: string
    daily_volume: number
    decimals: number
    extensions: {
        coingeckoId?: string;
    }
    freeze_authority: null | string
    logoURI: string
    mint_authority: null | string
    name: string
    permanent_delegate: null | string
    symbol: string
    tags: string[]
    +

    Properties

    address: string
    daily_volume: number
    decimals: number
    extensions: {
        coingeckoId?: string;
    }
    freeze_authority: null | string
    logoURI: string
    mint_authority: null | string
    name: string
    permanent_delegate: null | string
    symbol: string
    tags: string[]
    diff --git a/docs/interfaces/LuloAccountDetailsResponse.html b/docs/interfaces/LuloAccountDetailsResponse.html index fa19d62..dd11aee 100644 --- a/docs/interfaces/LuloAccountDetailsResponse.html +++ b/docs/interfaces/LuloAccountDetailsResponse.html @@ -1,6 +1,6 @@ LuloAccountDetailsResponse | solana-agent-kit

    Interface LuloAccountDetailsResponse

    Lulo Account Details response format

    -
    interface LuloAccountDetailsResponse {
        interestEarned: number;
        realtimeApy: number;
        settings: {
            allowedProtocols: null | string;
            homebase: null | string;
            minimumRate: string;
            owner: string;
        };
        totalValue: number;
    }

    Properties

    interface LuloAccountDetailsResponse {
        interestEarned: number;
        realtimeApy: number;
        settings: {
            allowedProtocols: null | string;
            homebase: null | string;
            minimumRate: string;
            owner: string;
        };
        totalValue: number;
    }

    Properties

    interestEarned: number
    realtimeApy: number
    settings: {
        allowedProtocols: null | string;
        homebase: null | string;
        minimumRate: string;
        owner: string;
    }
    totalValue: number
    +

    Properties

    interestEarned: number
    realtimeApy: number
    settings: {
        allowedProtocols: null | string;
        homebase: null | string;
        minimumRate: string;
        owner: string;
    }
    totalValue: number
    diff --git a/docs/interfaces/MintCollectionNFTResponse.html b/docs/interfaces/MintCollectionNFTResponse.html index e2e1479..1289741 100644 --- a/docs/interfaces/MintCollectionNFTResponse.html +++ b/docs/interfaces/MintCollectionNFTResponse.html @@ -1,3 +1,3 @@ -MintCollectionNFTResponse | solana-agent-kit

    Interface MintCollectionNFTResponse

    interface MintCollectionNFTResponse {
        metadata: PublicKey;
        mint: PublicKey;
    }

    Properties

    metadata +MintCollectionNFTResponse | solana-agent-kit

    Interface MintCollectionNFTResponse

    interface MintCollectionNFTResponse {
        metadata: PublicKey;
        mint: PublicKey;
    }

    Properties

    Properties

    metadata: PublicKey
    mint: PublicKey
    +

    Properties

    metadata: PublicKey
    mint: PublicKey
    diff --git a/docs/interfaces/PumpFunTokenOptions.html b/docs/interfaces/PumpFunTokenOptions.html index d1c0142..cb37c94 100644 --- a/docs/interfaces/PumpFunTokenOptions.html +++ b/docs/interfaces/PumpFunTokenOptions.html @@ -1,7 +1,7 @@ -PumpFunTokenOptions | solana-agent-kit

    Interface PumpFunTokenOptions

    interface PumpFunTokenOptions {
        initialLiquiditySOL?: number;
        priorityFee?: number;
        slippageBps?: number;
        telegram?: string;
        twitter?: string;
        website?: string;
    }

    Properties

    initialLiquiditySOL? +PumpFunTokenOptions | solana-agent-kit

    Interface PumpFunTokenOptions

    interface PumpFunTokenOptions {
        initialLiquiditySOL?: number;
        priorityFee?: number;
        slippageBps?: number;
        telegram?: string;
        twitter?: string;
        website?: string;
    }

    Properties

    initialLiquiditySOL?: number
    priorityFee?: number
    slippageBps?: number
    telegram?: string
    twitter?: string
    website?: string
    +

    Properties

    initialLiquiditySOL?: number
    priorityFee?: number
    slippageBps?: number
    telegram?: string
    twitter?: string
    website?: string
    diff --git a/docs/interfaces/PumpfunLaunchResponse.html b/docs/interfaces/PumpfunLaunchResponse.html index f667de7..c98ea41 100644 --- a/docs/interfaces/PumpfunLaunchResponse.html +++ b/docs/interfaces/PumpfunLaunchResponse.html @@ -1,5 +1,5 @@ -PumpfunLaunchResponse | solana-agent-kit

    Interface PumpfunLaunchResponse

    interface PumpfunLaunchResponse {
        error?: string;
        metadataUri?: string;
        mint: string;
        signature: string;
    }

    Properties

    error? +PumpfunLaunchResponse | solana-agent-kit

    Interface PumpfunLaunchResponse

    interface PumpfunLaunchResponse {
        error?: string;
        metadataUri?: string;
        mint: string;
        signature: string;
    }

    Properties

    error?: string
    metadataUri?: string
    mint: string
    signature: string
    +

    Properties

    error?: string
    metadataUri?: string
    mint: string
    signature: string
    diff --git a/docs/interfaces/PythFetchPriceResponse.html b/docs/interfaces/PythFetchPriceResponse.html index fcfb217..a83df74 100644 --- a/docs/interfaces/PythFetchPriceResponse.html +++ b/docs/interfaces/PythFetchPriceResponse.html @@ -1,6 +1,6 @@ -PythFetchPriceResponse | solana-agent-kit

    Interface PythFetchPriceResponse

    interface PythFetchPriceResponse {
        code?: string;
        message?: string;
        price?: string;
        priceFeedID: string;
        status: "success" | "error";
    }

    Properties

    code? +PythFetchPriceResponse | solana-agent-kit

    Interface PythFetchPriceResponse

    interface PythFetchPriceResponse {
        code?: string;
        message?: string;
        price?: string;
        priceFeedID: string;
        status: "success" | "error";
    }

    Properties

    code?: string
    message?: string
    price?: string
    priceFeedID: string
    status: "success" | "error"
    +

    Properties

    code?: string
    message?: string
    price?: string
    priceFeedID: string
    status: "success" | "error"
    diff --git a/docs/modules.html b/docs/modules.html index 29440e3..791b567 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -3,6 +3,7 @@ CollectionOptions Creator FetchPriceResponse +GibworkCreateTaskReponse JupiterTokenData LuloAccountDetailsResponse MintCollectionNFTResponse @@ -10,4 +11,5 @@ PumpFunTokenOptions PythFetchPriceResponse

    Functions

    diff --git a/package.json b/package.json index abd3301..8ba7b4a 100644 --- a/package.json +++ b/package.json @@ -1,68 +1,72 @@ { - "name": "solana-agent-kit", - "version": "1.3.0", - "description": "connect any ai agents to solana protocols", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc", - "docs": "typedoc src --out docs", - "test": "ts-node test/index.ts", - "generate": "ts-node src/utils/keypair.ts", - "lint": "eslint . --ext .ts", - "lint:fix": "eslint . --ext .ts --fix", - "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"" - }, - "engines": { - "node": ">=23.1.0", - "pnpm": ">=8.0.0" - }, - "keywords": [], - "author": "sendaifun", - "license": "Apache-2.0", - "dependencies": { - "@bonfida/spl-name-service": "^3.0.7", - "@coral-xyz/anchor": "0.29", - "@langchain/core": "^0.3.18", - "@langchain/groq": "^0.1.2", - "@langchain/langgraph": "^0.2.27", - "@langchain/openai": "^0.3.13", - "@lightprotocol/compressed-token": "^0.17.1", - "@lightprotocol/stateless.js": "^0.17.1", - "@metaplex-foundation/mpl-core": "^1.1.1", - "@metaplex-foundation/mpl-token-metadata": "^3.3.0", - "@metaplex-foundation/mpl-toolbox": "^0.9.4", - "@metaplex-foundation/umi": "^0.9.2", - "@metaplex-foundation/umi-bundle-defaults": "^0.9.2", - "@metaplex-foundation/umi-web3js-adapters": "^0.9.2", - "@onsol/tldparser": "^0.6.7", - "@orca-so/common-sdk": "0.6.4", - "@orca-so/whirlpools-sdk": "^0.13.12", - "@pythnetwork/price-service-client": "^1.9.0", - "@raydium-io/raydium-sdk-v2": "0.1.95-alpha", - "@solana/spl-token": "^0.4.9", - "@solana/web3.js": "^1.95.4", - "bn.js": "^5.2.1", - "bs58": "^6.0.0", - "chai": "^5.1.2", - "decimal.js": "^10.4.3", - "dotenv": "^16.4.5", - "form-data": "^4.0.1", - "langchain": "^0.3.6", - "openai": "^4.75.0", - "typedoc": "^0.26.11" - }, - "devDependencies": { - "@types/bn.js": "^5.1.5", - "@types/chai": "^5.0.1", - "@types/node": "^22.9.0", - "ts-node": "^10.9.2", - "typescript": "^5.7.2", - "eslint": "^8.56.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-prettier": "^5.1.3", - "@typescript-eslint/eslint-plugin": "^7.0.0", - "@typescript-eslint/parser": "^7.0.0", - "prettier": "^3.2.5" - } + "name": "solana-agent-kit", + "version": "1.3.0", + "description": "connect any ai agents to solana protocols", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "tsc", + "docs": "typedoc src --out docs", + "test": "ts-node test/index.ts", + "test:vercel-ai": "ts-node test/agent_sdks/vercel_ai.ts", + "generate": "ts-node src/utils/keypair.ts", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"" + }, + "engines": { + "node": ">=23.1.0", + "pnpm": ">=8.0.0" + }, + "keywords": [], + "author": "sendaifun", + "license": "Apache-2.0", + "dependencies": { + "@ai-sdk/openai": "^1.0.11", + "@bonfida/spl-name-service": "^3.0.7", + "@coral-xyz/anchor": "0.29", + "@langchain/core": "^0.3.18", + "@langchain/groq": "^0.1.2", + "@langchain/langgraph": "^0.2.27", + "@langchain/openai": "^0.3.13", + "@lightprotocol/compressed-token": "^0.17.1", + "@lightprotocol/stateless.js": "^0.17.1", + "@metaplex-foundation/mpl-core": "^1.1.1", + "@metaplex-foundation/mpl-token-metadata": "^3.3.0", + "@metaplex-foundation/mpl-toolbox": "^0.9.4", + "@metaplex-foundation/umi": "^0.9.2", + "@metaplex-foundation/umi-bundle-defaults": "^0.9.2", + "@metaplex-foundation/umi-web3js-adapters": "^0.9.2", + "@onsol/tldparser": "^0.6.7", + "@orca-so/common-sdk": "0.6.4", + "@orca-so/whirlpools-sdk": "^0.13.12", + "@pythnetwork/price-service-client": "^1.9.0", + "@raydium-io/raydium-sdk-v2": "0.1.95-alpha", + "@solana/spl-token": "^0.4.9", + "@solana/web3.js": "^1.95.4", + "ai": "^4.0.22", + "bn.js": "^5.2.1", + "bs58": "^6.0.0", + "chai": "^5.1.2", + "decimal.js": "^10.4.3", + "dotenv": "^16.4.5", + "form-data": "^4.0.1", + "langchain": "^0.3.6", + "openai": "^4.75.0", + "typedoc": "^0.26.11", + "zod": "^3.24.1" + }, + "devDependencies": { + "@types/bn.js": "^5.1.5", + "@types/chai": "^5.0.1", + "@types/node": "^22.9.0", + "@typescript-eslint/eslint-plugin": "^7.0.0", + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", + "prettier": "^3.2.5", + "ts-node": "^10.9.2", + "typescript": "^5.7.2" + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ddfc583..d5b467a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@ai-sdk/openai': + specifier: ^1.0.11 + version: 1.0.11(zod@3.24.1) '@bonfida/spl-name-service': specifier: ^3.0.7 version: 3.0.7(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10) @@ -71,6 +74,9 @@ importers: '@solana/web3.js': specifier: ^1.95.4 version: 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ai: + specifier: ^4.0.22 + version: 4.0.22(react@19.0.0)(zod@3.24.1) bn.js: specifier: ^5.2.1 version: 5.2.1 @@ -98,6 +104,9 @@ importers: typedoc: specifier: ^0.26.11 version: 0.26.11(typescript@5.7.2) + zod: + specifier: ^3.24.1 + version: 3.24.1 devDependencies: '@types/bn.js': specifier: ^5.1.5 @@ -135,6 +144,46 @@ importers: packages: + '@ai-sdk/openai@1.0.11': + resolution: {integrity: sha512-qI9s7Slma5i5bB4yYVlFdcG3PNDwdqivPT1Dr8adDX92nSSpILjgFIooS5yys9sXjvvcfOi/WXbDvVhLSRRlvg==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + + '@ai-sdk/provider-utils@2.0.5': + resolution: {integrity: sha512-2M7vLhYN0ThGjNlzow7oO/lsL+DyMxvGMIYmVQvEYaCWhDzxH5dOp78VNjJIVwHzVLMbBDigX3rJuzAs853idw==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + peerDependenciesMeta: + zod: + optional: true + + '@ai-sdk/provider@1.0.3': + resolution: {integrity: sha512-WiuJEpHTrltOIzv3x2wx4gwksAHW0h6nK3SoDzjqCOJLu/2OJ1yASESTIX+f07ChFykHElVoP80Ol/fe9dw6tQ==} + engines: {node: '>=18'} + + '@ai-sdk/react@1.0.7': + resolution: {integrity: sha512-j2/of4iCNq+r2Bjx0O9vdRhn5C/02t2Esenis71YtnsoynPz74eQlJ3N0RYYPheThiJes50yHdfdVdH9ulxs1A==} + engines: {node: '>=18'} + peerDependencies: + react: ^18 || ^19 || ^19.0.0-rc + zod: ^3.0.0 + peerDependenciesMeta: + react: + optional: true + zod: + optional: true + + '@ai-sdk/ui-utils@1.0.6': + resolution: {integrity: sha512-ZP6Vjj+VCnSPBIAvWAdKj2olQONJ/f4aZpkVCGkzprdhv8TjHwB6CTlXFS3zypuEGy4asg84dc1dvXKooQXFvg==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + peerDependenciesMeta: + zod: + optional: true + '@babel/runtime@7.26.0': resolution: {integrity: sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==} engines: {node: '>=6.9.0'} @@ -400,6 +449,10 @@ packages: borsh: ^0.7.0 buffer: 6.0.1 + '@opentelemetry/api@1.9.0': + resolution: {integrity: sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==} + engines: {node: '>=8.0.0'} + '@orca-so/common-sdk@0.6.4': resolution: {integrity: sha512-iOiC6exTA9t2CEOaUPoWlNP3soN/1yZFjoz1mSf7NvOqo/PJZeIdWpB7BRXwU0mGGatjxU4SFgMGQ8NrSx+ONw==} peerDependencies: @@ -633,6 +686,9 @@ packages: '@types/deep-eql@4.0.2': resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + '@types/diff-match-patch@1.0.36': + resolution: {integrity: sha512-xFdR6tkm0MWvBfO8xXCSsinYxHcqkQUlcHeSpMC2ukzOb6lwQAfDmW+Qt0AvlGd8HpsS28qKsB+oPeJn9I39jg==} + '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} @@ -759,6 +815,18 @@ packages: resolution: {integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==} engines: {node: '>= 8.0.0'} + ai@4.0.22: + resolution: {integrity: sha512-yvcjWtofI2HZwgT3jMkoNnDUhAY+S9cOvZ6xbbOzrS0ZeFl1/gcbasFnwAqUJ7uL/t72/3a0Vy/pKg6N19A2Mw==} + engines: {node: '>=18'} + peerDependencies: + react: ^18 || ^19 || ^19.0.0-rc + zod: ^3.0.0 + peerDependenciesMeta: + react: + optional: true + zod: + optional: true + ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} @@ -1016,6 +1084,9 @@ packages: devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} + diff-match-patch@1.0.5: + resolution: {integrity: sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==} + diff@4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} @@ -1132,6 +1203,10 @@ packages: eventemitter3@5.0.1: resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + eventsource-parser@3.0.0: + resolution: {integrity: sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA==} + engines: {node: '>=18.0.0'} + eyes@0.1.8: resolution: {integrity: sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==} engines: {node: '> 0.1.90'} @@ -1381,6 +1456,9 @@ packages: json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + json-schema@0.4.0: + resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==} + json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} @@ -1392,6 +1470,11 @@ packages: engines: {node: '>=6'} hasBin: true + jsondiffpatch@0.6.0: + resolution: {integrity: sha512-3QItJOXp2AP1uv7waBkao5nCvhEv+QmJAd38Ybq7wNI74Q+BBmnLn4EDKz6yI9xGAIQoUF87qHt+kc1IVxB4zQ==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} @@ -1554,6 +1637,11 @@ packages: resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==} hasBin: true + nanoid@3.3.8: + resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} @@ -1703,6 +1791,10 @@ packages: queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + react@19.0.0: + resolution: {integrity: sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==} + engines: {node: '>=0.10.0'} + regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} @@ -1741,6 +1833,9 @@ packages: safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + secure-json-parse@2.7.0: + resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==} + semver@7.6.3: resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} engines: {node: '>=10'} @@ -1797,6 +1892,11 @@ packages: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} + swr@2.3.0: + resolution: {integrity: sha512-NyZ76wA4yElZWBHzSgEJc28a0u6QZvhb6w0azeL2k7+Q1gAzVK+IqQYXhVOC/mzi+HZIozrZvBVeSeOZNR2bqA==} + peerDependencies: + react: ^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + synckit@0.9.2: resolution: {integrity: sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==} engines: {node: ^14.18.0 || >=16.0.0} @@ -1807,6 +1907,10 @@ packages: text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + throttleit@2.1.0: + resolution: {integrity: sha512-nt6AMGKW1p/70DF/hGBdJB57B8Tspmbp5gfJ8ilhLnt7kkr2ye7hzD6NVG8GGErk2HWF34igrL2CXmNIkzKqKw==} + engines: {node: '>=18'} + through@2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} @@ -1919,6 +2023,11 @@ packages: uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + use-sync-external-store@1.4.0: + resolution: {integrity: sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + utf-8-validate@5.0.10: resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} engines: {node: '>=6.14.2'} @@ -2027,6 +2136,43 @@ packages: snapshots: + '@ai-sdk/openai@1.0.11(zod@3.24.1)': + dependencies: + '@ai-sdk/provider': 1.0.3 + '@ai-sdk/provider-utils': 2.0.5(zod@3.24.1) + zod: 3.24.1 + + '@ai-sdk/provider-utils@2.0.5(zod@3.24.1)': + dependencies: + '@ai-sdk/provider': 1.0.3 + eventsource-parser: 3.0.0 + nanoid: 3.3.8 + secure-json-parse: 2.7.0 + optionalDependencies: + zod: 3.24.1 + + '@ai-sdk/provider@1.0.3': + dependencies: + json-schema: 0.4.0 + + '@ai-sdk/react@1.0.7(react@19.0.0)(zod@3.24.1)': + dependencies: + '@ai-sdk/provider-utils': 2.0.5(zod@3.24.1) + '@ai-sdk/ui-utils': 1.0.6(zod@3.24.1) + swr: 2.3.0(react@19.0.0) + throttleit: 2.1.0 + optionalDependencies: + react: 19.0.0 + zod: 3.24.1 + + '@ai-sdk/ui-utils@1.0.6(zod@3.24.1)': + dependencies: + '@ai-sdk/provider': 1.0.3 + '@ai-sdk/provider-utils': 2.0.5(zod@3.24.1) + zod-to-json-schema: 3.24.1(zod@3.24.1) + optionalDependencies: + zod: 3.24.1 + '@babel/runtime@7.26.0': dependencies: regenerator-runtime: 0.14.1 @@ -2403,6 +2549,8 @@ snapshots: - supports-color - utf-8-validate + '@opentelemetry/api@1.9.0': {} + '@orca-so/common-sdk@0.6.4(@solana/spl-token@0.4.9(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10))(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(decimal.js@10.4.3)': dependencies: '@solana/spl-token': 0.4.9(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10) @@ -2815,6 +2963,8 @@ snapshots: '@types/deep-eql@4.0.2': {} + '@types/diff-match-patch@1.0.36': {} + '@types/hast@3.0.4': dependencies: '@types/unist': 3.0.3 @@ -2962,6 +3112,19 @@ snapshots: dependencies: humanize-ms: 1.2.1 + ai@4.0.22(react@19.0.0)(zod@3.24.1): + dependencies: + '@ai-sdk/provider': 1.0.3 + '@ai-sdk/provider-utils': 2.0.5(zod@3.24.1) + '@ai-sdk/react': 1.0.7(react@19.0.0)(zod@3.24.1) + '@ai-sdk/ui-utils': 1.0.6(zod@3.24.1) + '@opentelemetry/api': 1.9.0 + jsondiffpatch: 0.6.0 + zod-to-json-schema: 3.24.1(zod@3.24.1) + optionalDependencies: + react: 19.0.0 + zod: 3.24.1 + ajv@6.12.6: dependencies: fast-deep-equal: 3.1.3 @@ -3205,6 +3368,8 @@ snapshots: dependencies: dequal: 2.0.3 + diff-match-patch@1.0.5: {} + diff@4.0.2: {} dir-glob@3.0.1: @@ -3335,6 +3500,8 @@ snapshots: eventemitter3@5.0.1: {} + eventsource-parser@3.0.0: {} + eyes@0.1.8: {} fast-deep-equal@3.1.3: {} @@ -3614,12 +3781,20 @@ snapshots: json-schema-traverse@0.4.1: {} + json-schema@0.4.0: {} + json-stable-stringify-without-jsonify@1.0.1: {} json-stringify-safe@5.0.1: {} json5@2.2.3: {} + jsondiffpatch@0.6.0: + dependencies: + '@types/diff-match-patch': 1.0.36 + chalk: 5.4.0 + diff-match-patch: 1.0.5 + jsonfile@6.1.0: dependencies: universalify: 2.0.1 @@ -3765,6 +3940,8 @@ snapshots: mustache@4.2.0: {} + nanoid@3.3.8: {} + natural-compare@1.4.0: {} no-case@3.0.4: @@ -3896,6 +4073,8 @@ snapshots: queue-microtask@1.2.3: {} + react@19.0.0: {} + regenerator-runtime@0.14.1: {} regex-recursion@5.0.0: @@ -3937,6 +4116,8 @@ snapshots: safe-buffer@5.2.1: {} + secure-json-parse@2.7.0: {} + semver@7.6.3: {} set-function-length@1.2.2: @@ -3993,6 +4174,12 @@ snapshots: dependencies: has-flag: 4.0.0 + swr@2.3.0(react@19.0.0): + dependencies: + dequal: 2.0.3 + react: 19.0.0 + use-sync-external-store: 1.4.0(react@19.0.0) + synckit@0.9.2: dependencies: '@pkgr/core': 0.1.1 @@ -4002,6 +4189,8 @@ snapshots: text-table@0.2.0: {} + throttleit@2.1.0: {} + through@2.3.8: {} tiny-inflate@1.0.3: {} @@ -4111,6 +4300,10 @@ snapshots: dependencies: punycode: 2.3.1 + use-sync-external-store@1.4.0(react@19.0.0): + dependencies: + react: 19.0.0 + utf-8-validate@5.0.10: dependencies: node-gyp-build: 4.8.4 diff --git a/src/index.ts b/src/index.ts index 1b4116f..4a9f3a4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,8 @@ import { SolanaAgentKit } from "./agent"; import { createSolanaTools } from "./langchain"; +import { createSolanaTools as createVercelAITools } from "./vercel-ai"; -export { SolanaAgentKit, createSolanaTools }; +export { SolanaAgentKit, createSolanaTools, createVercelAITools }; // Optional: Export types that users might need export * from "./types"; diff --git a/src/vercel-ai/index.ts b/src/vercel-ai/index.ts new file mode 100644 index 0000000..31c9f25 --- /dev/null +++ b/src/vercel-ai/index.ts @@ -0,0 +1,1489 @@ +import { tool, type CoreTool } from "ai"; +import { SolanaAgentKit } from "../agent"; +import z from "zod"; +import { PublicKey } from "@solana/web3.js"; +import { create_image } from "../tools/create_image"; +import BN from "bn.js"; +import Decimal from "decimal.js"; +import { FEE_TIERS } from "../tools"; +import { GibworkCreateTaskReponse, PythFetchPriceResponse } from "../types"; + +export class VercelAITools { + constructor(private solanaKit: SolanaAgentKit) {} + + solanaBalanceTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.balance", + description: `Get the balance of a Solana wallet or token account. + + If you want to get the balance of your wallet, you don't need to provide the tokenAddress. + If no tokenAddress is provided, the balance will be in SOL. + + Inputs: + tokenAccountAddress: string, eg "So11111111111111111111111111111111111111112" (optional)`, + parameters: z.object({ + tokenAccountAddress: z.string().optional(), + }), + execute: async ({ tokenAccountAddress }) => { + try { + const address = tokenAccountAddress + ? new PublicKey(tokenAccountAddress) + : undefined; + const balance = await this.solanaKit.getBalance(address); + + return { + status: "success", + balance: balance, + token: address ? address.toBase58() : "SOL", + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaTransferTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.transfer", + description: ` + Transfer tokens or SOL to another address ( also called as wallet address ). + + Inputs ( input is a JSON string ): + to: string, eg "8x2dR8Mpzuz2YqyZyZjUbYWKSWesBo5jMx2Q9Y86udVk" (required) + amount: number, eg 1 (required) + mint?: string, eg "So11111111111111111111111111111111111111112" or "SENDdRQtYMWaQrBroBrJ2Q53fgVuq95CV9UPGEvpCxa" (optional) `, + parameters: z.object({ + to: z.string(), + amount: z.number(), + mint: z.string().optional(), + }), + execute: async ({ to, amount, mint }) => { + try { + const recipient = new PublicKey(to); + const mintAddress = mint ? new PublicKey(mint) : undefined; + + const tx = await this.solanaKit.transfer( + recipient, + amount, + mintAddress, + ); + + return { + status: "success", + message: "Transfer completed successfully", + amount: amount, + recipient: to, + token: mint || "SOL", + transaction: tx, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaDeployTokenTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.deployToken", + description: `Deploy a new token on Solana blockchain. + + Inputs (input is a JSON string): + name: string, eg "My Token" (required) + uri: string, eg "https://example.com/token.json" (required) + symbol: string, eg "MTK" (required) + decimals?: number, eg 9 (optional, defaults to 9) + initialSupply?: number, eg 1000000 (optional)`, + parameters: z.object({ + name: z.string(), + uri: z.string(), + symbol: z.string(), + decimals: z.number().optional(), + initialSupply: z.number().optional(), + }), + execute: async ({ + name, + uri, + symbol, + decimals = 9, + initialSupply = 0, + }) => { + try { + const result = await this.solanaKit.deployToken( + name, + uri, + symbol, + decimals, + initialSupply, + ); + + return { + status: "success", + message: "Token deployed successfully", + mintAddress: result.mint.toString(), + decimals: decimals || 9, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaDeployCollectionTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.deployCollection", + description: "Deploy a new NFT collection on Solana blockchain", + parameters: z.object({ + name: z.string(), + uri: z.string(), + royaltyBasisPoints: z.number().optional(), + }), + execute: async ({ name, uri, royaltyBasisPoints = 0 }) => { + try { + const result = await this.solanaKit.deployCollection({ + name, + uri, + royaltyBasisPoints, + }); + return { + status: "success", + message: "Collection deployed successfully", + collectionAddress: result.collectionAddress.toString(), + name, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaMintNFTTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.mintNFT", + description: "Mint a new NFT in a collection on Solana blockchain", + parameters: z.object({ + collectionMint: z.string(), + name: z.string(), + uri: z.string(), + recipient: z.string().optional(), + }), + execute: async ({ collectionMint, name, uri, recipient }) => { + try { + const result = await this.solanaKit.mintNFT( + new PublicKey(collectionMint), + { name, uri }, + recipient + ? new PublicKey(recipient) + : this.solanaKit.wallet_address, + ); + return { + status: "success", + message: "NFT minted successfully", + mintAddress: result.mint.toString(), + metadata: { name, uri }, + recipient: recipient || result.mint.toString(), + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaTradeTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.trade", + description: "Swap tokens using Jupiter Exchange", + parameters: z.object({ + outputMint: z.string(), + inputAmount: z.number(), + inputMint: z.string().optional(), + slippageBps: z.number().optional(), + }), + execute: async ({ outputMint, inputAmount, inputMint, slippageBps }) => { + try { + const tx = await this.solanaKit.trade( + new PublicKey(outputMint), + inputAmount, + inputMint + ? new PublicKey(inputMint) + : new PublicKey("So11111111111111111111111111111111111111112"), + slippageBps, + ); + return { + status: "success", + message: "Trade executed successfully", + transaction: tx, + inputAmount, + inputToken: inputMint || "SOL", + outputToken: outputMint, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaRequestFundsTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.requestFunds", + description: "Request SOL from Solana faucet (devnet/testnet only)", + parameters: z.object({}), + execute: async () => { + try { + await this.solanaKit.requestFaucetFunds(); + return { + status: "success", + message: "Successfully requested faucet funds", + network: this.solanaKit.connection.rpcEndpoint.split("/")[2], + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaRegisterDomainTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.registerDomain", + description: "Register a .sol domain name for your wallet", + parameters: z.object({ + name: z.string().min(1, "Name is required"), + spaceKB: z + .number() + .positive("spaceKB must be a positive number") + .default(1) + .optional(), + }), + execute: async ({ name, spaceKB = 1 }) => { + try { + const tx = await this.solanaKit.registerDomain(name, spaceKB); + return { + status: "success", + message: "Domain registered successfully", + transaction: tx, + domain: `${name}.sol`, + spaceKB, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaResolveDomainTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.resolveDomain", + description: `Resolve ONLY .sol domain names to a Solana PublicKey. + This tool is exclusively for .sol domains. + DO NOT use this for other domain types like .blink, .bonk, etc.`, + parameters: z.object({ + domain: z + .string() + .trim() + .min(1, "Domain name is required") + .regex(/\.sol$/, "Domain must end with .sol"), + }), + execute: async ({ domain }) => { + try { + const publicKey = await this.solanaKit.resolveSolDomain(domain); + return { + status: "success", + message: "Domain resolved successfully", + publicKey: publicKey.toBase58(), + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaGetDomainTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.getDomain", + description: + "Retrieve the .sol domain associated with a given account address", + parameters: z.object({ + account: z + .string() + .trim() + .min(1, "Account address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid Solana account address"), + }), + execute: async ({ account }) => { + try { + const publicKey = new PublicKey(account); + const domain = await this.solanaKit.getPrimaryDomain(publicKey); + return { + status: "success", + message: "Primary domain retrieved successfully", + domain, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaGetWalletAddressTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.getWalletAddress", + description: "Get the wallet address of the agent", + parameters: z.object({}), + execute: async () => { + return { + status: "success", + message: "Wallet address retrieved successfully", + address: this.solanaKit.wallet_address.toString(), + }; + }, + }); + } + + solanaPumpfunTokenLaunchTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.launchPumpfunToken", + description: `Launch a token on Pump.fun. + Do not use this tool for any other purpose, or for creating SPL tokens. + If the user asks you to choose the parameters, you should generate valid values. + For generating the image, you can use the solana_create_image tool.`, + parameters: z.object({ + tokenName: z.string().min(1, "Token name is required"), + tokenTicker: z.string().min(1, "Token ticker is required"), + description: z.string().min(1, "Description is required"), + imageUrl: z.string().url("Invalid image URL"), + twitter: z.string().url("Invalid Twitter URL").optional(), + telegram: z.string().url("Invalid Telegram URL").optional(), + website: z.string().url("Invalid website URL").optional(), + initialLiquiditySOL: z + .number() + .positive("Initial liquidity must be positive") + .optional(), + }), + execute: async ({ + tokenName, + tokenTicker, + description, + imageUrl, + twitter, + telegram, + website, + initialLiquiditySOL, + }) => { + try { + await this.solanaKit.launchPumpFunToken( + tokenName, + tokenTicker, + description, + imageUrl, + // @ts-expect-error Value matches type however TS still shows error + { + twitter, + telegram, + website, + initialLiquiditySOL, + }, + ); + + return { + status: "success", + message: "Token launched successfully on Pump.fun", + tokenName, + tokenTicker, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaCreateImageTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.createImage", + description: + "Create an image using OpenAI's DALL-E. Input should be a string prompt for the image.", + parameters: z.object({ + prompt: z.string().trim().min(1, "Image prompt cannot be empty"), + }), + execute: async ({ prompt }) => { + try { + const result = await create_image(this.solanaKit, prompt); + return { + status: "success", + message: "Image created successfully", + ...result, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaLendAssetTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.lendAsset", + description: + "Lend idle USDC for yield using Lulo (only USDC is supported)", + parameters: z.object({ + amount: z + .number() + .positive("Amount must be positive") + .min(0.000001, "Amount must be at least 0.000001 USDC"), + }), + execute: async ({ amount }) => { + try { + const tx = await this.solanaKit.lendAssets(amount); + return { + status: "success", + message: "Asset lent successfully", + transaction: tx, + amount, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaTPSCalculatorTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.getTPS", + description: + "Get the current TPS (transactions per second) of the Solana network", + parameters: z.object({}), + execute: async () => { + try { + const tps = await this.solanaKit.getTPS(); + return { + status: "success", + message: "TPS fetched successfully", + network: "mainnet-beta", + tps: tps, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaStakeTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.stake", + description: + "Stake your SOL (Solana), also called as SOL staking or liquid staking", + parameters: z.object({ + amount: z + .number() + .positive("Stake amount must be positive") + .min(0.001, "Minimum stake amount is 0.001 SOL"), + }), + execute: async ({ amount }) => { + try { + const tx = await this.solanaKit.stake(amount); + return { + status: "success", + message: "Staked successfully", + transaction: tx, + amount, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaFetchPriceTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.fetchPrice", + description: "Fetch the price of a given token in USDC", + parameters: z.object({ + tokenId: z + .string() + .trim() + .min(1, "Token ID is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid Solana token address"), + }), + execute: async ({ tokenId }) => { + try { + const price = await this.solanaKit.fetchTokenPrice(tokenId); + return { + status: "success", + tokenId, + priceInUSDC: price, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaTokenDataTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.tokenData", + description: "Get the token data for a given token mint address", + parameters: z.object({ + mintAddress: z + .string() + .trim() + .min(1, "Mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid Solana token address"), + }), + execute: async ({ mintAddress }) => { + try { + const tokenData = + await this.solanaKit.getTokenDataByAddress(mintAddress); + return { + status: "success", + tokenData, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaTokenDataByTickerTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.tokenDataByTicker", + description: "Get the token data for a given token ticker", + parameters: z.object({ + ticker: z + .string() + .trim() + .min(1, "Ticker is required") + .max(10, "Ticker too long"), + }), + execute: async ({ ticker }) => { + try { + const tokenData = await this.solanaKit.getTokenDataByTicker(ticker); + return { + status: "success", + tokenData, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaCompressedAirdropTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.compressedAirdrop", + description: "Airdrop SPL tokens with ZK Compression", + parameters: z.object({ + mintAddress: z + .string() + .trim() + .min(1, "Mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid token mint address"), + amount: z.number().positive("Amount must be positive"), + decimals: z + .number() + .int("Decimals must be an integer") + .min(0, "Decimals must be non-negative") + .max(9, "Decimals cannot exceed 9"), + recipients: z + .array(z.string()) + .min(1, "At least one recipient is required") + .refine( + (recipients) => + recipients.every((addr) => { + try { + new PublicKey(addr); + return true; + } catch { + return false; + } + }), + "One or more recipient addresses are invalid", + ), + priorityFeeInLamports: z + .number() + .int("Priority fee must be an integer") + .nonnegative("Priority fee cannot be negative") + .default(30_000), + shouldLog: z.boolean().default(false), + }), + execute: async ({ + mintAddress, + amount, + decimals, + recipients, + priorityFeeInLamports, + shouldLog, + }) => { + try { + const txs = await this.solanaKit.sendCompressedAirdrop( + mintAddress, + amount, + decimals, + recipients, + priorityFeeInLamports, + shouldLog, + ); + return { + status: "success", + message: `Airdropped ${amount} tokens to ${recipients.length} recipients.`, + transactionHashes: txs, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaCreateSingleSidedWhirlpoolTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.createOrcaSingleSidedWhirlpool", + description: "Create a single-sided Whirlpool with liquidity", + parameters: z.object({ + depositTokenAmount: z + .number() + .int("Deposit amount must be an integer") + .positive("Deposit amount must be positive"), + depositTokenMint: z + .string() + .trim() + .min(1, "Deposit token mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid deposit token mint address"), + otherTokenMint: z + .string() + .trim() + .min(1, "Other token mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid other token mint address"), + initialPrice: z.number().positive("Initial price must be positive"), + maxPrice: z + .number() + .positive("Max price must be positive") + .refine((val) => val > 0, "Max price must be greater than 0"), + feeTier: z + .number() + .refine( + (val) => val in FEE_TIERS, + `Invalid fee tier. Available options: ${Object.keys(FEE_TIERS).join(", ")}`, + ), + }), + execute: async ({ + depositTokenAmount, + depositTokenMint, + otherTokenMint, + initialPrice, + maxPrice, + feeTier, + }) => { + try { + const txId = await this.solanaKit.createOrcaSingleSidedWhirlpool( + new BN(depositTokenAmount), + new PublicKey(depositTokenMint), + new PublicKey(otherTokenMint), + new Decimal(initialPrice), + new Decimal(maxPrice), + // @ts-expect-error Value matches type however TS still shows error + feeTier, + ); + + return { + status: "success", + message: "Single-sided Whirlpool created successfully", + transaction: txId, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaRaydiumCreateAmmV4Tool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.raydiumCreateAmmV4", + description: + "Create Raydium's Legacy AMM that requires an OpenBook marketID", + parameters: z.object({ + marketId: z + .string() + .trim() + .min(1, "Market ID is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid market ID"), + baseAmount: z + .number() + .int("Base amount must be an integer") + .positive("Base amount must be positive"), + quoteAmount: z + .number() + .int("Quote amount must be an integer") + .positive("Quote amount must be positive"), + startTime: z + .number() + .int("Start time must be an integer") + .nonnegative("Start time cannot be negative"), + }), + execute: async ({ marketId, baseAmount, quoteAmount, startTime }) => { + try { + const tx = await this.solanaKit.raydiumCreateAmmV4( + new PublicKey(marketId), + new BN(baseAmount), + new BN(quoteAmount), + new BN(startTime), + ); + + return { + status: "success", + message: "Raydium AMM V4 pool created successfully", + transaction: tx, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaRaydiumCreateClmmTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.raydiumCreateClmm", + description: + "Create a Concentrated Liquidity Market Maker (CLMM) pool with custom liquidity ranges", + parameters: z.object({ + mint1: z + .string() + .trim() + .min(1, "First mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid first mint address"), + mint2: z + .string() + .trim() + .min(1, "Second mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid second mint address"), + configId: z + .string() + .trim() + .min(1, "Config ID is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid config ID"), + initialPrice: z.number().positive("Initial price must be positive"), + startTime: z + .number() + .int("Start time must be an integer") + .nonnegative("Start time cannot be negative"), + }), + execute: async ({ mint1, mint2, configId, initialPrice, startTime }) => { + try { + const tx = await this.solanaKit.raydiumCreateClmm( + new PublicKey(mint1), + new PublicKey(mint2), + new PublicKey(configId), + new Decimal(initialPrice), + new BN(startTime), + ); + + return { + status: "success", + message: "Raydium CLMM pool created successfully", + transaction: tx, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaRaydiumCreateCpmmTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.raydiumCreateCpmm", + description: + "Create Raydium's newest CPMM pool (supports Token 2022 standard)", + parameters: z.object({ + mint1: z + .string() + .trim() + .min(1, "First mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid first mint address"), + mint2: z + .string() + .trim() + .min(1, "Second mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid second mint address"), + configId: z + .string() + .trim() + .min(1, "Config ID is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid config ID"), + mintAAmount: z + .number() + .int("Mint A amount must be an integer") + .positive("Mint A amount must be positive"), + mintBAmount: z + .number() + .int("Mint B amount must be an integer") + .positive("Mint B amount must be positive"), + startTime: z + .number() + .int("Start time must be an integer") + .nonnegative("Start time cannot be negative"), + }), + execute: async ({ + mint1, + mint2, + configId, + mintAAmount, + mintBAmount, + startTime, + }) => { + try { + const tx = await this.solanaKit.raydiumCreateCpmm( + new PublicKey(mint1), + new PublicKey(mint2), + new PublicKey(configId), + new BN(mintAAmount), + new BN(mintBAmount), + new BN(startTime), + ); + + return { + status: "success", + message: "Raydium CPMM pool created successfully", + transaction: tx, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaOpenbookCreateMarketTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.openbookCreateMarket", + description: "Create an Openbook market (required for AMM v4)", + parameters: z.object({ + baseMint: z + .string() + .trim() + .min(1, "Base mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid base mint address"), + quoteMint: z + .string() + .trim() + .min(1, "Quote mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid quote mint address"), + lotSize: z.number().positive("Lot size must be positive"), + tickSize: z.number().positive("Tick size must be positive"), + }), + execute: async ({ baseMint, quoteMint, lotSize, tickSize }) => { + try { + const tx = await this.solanaKit.openbookCreateMarket( + new PublicKey(baseMint), + new PublicKey(quoteMint), + lotSize, + tickSize, + ); + + return { + status: "success", + message: "Openbook market created successfully", + transaction: tx, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "UNKNOWN_ERROR", + }; + } + }, + }); + } + + solanaPythFetchPriceTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.pythFetchPrice", + description: + "Fetch the price of a given price feed from Pyth's Hermes service", + parameters: z.object({ + priceFeedID: z + .string() + .trim() + .min(1, "Price feed ID is required") + .regex( + /^0x[a-fA-F0-9]{64}$/, + "Invalid price feed ID format. Must be a 32-byte hex string starting with 0x", + ), + }), + execute: async ({ priceFeedID }) => { + try { + const price = await this.solanaKit.pythFetchPrice(priceFeedID); + return { + status: "success", + priceFeedID, + price, + } as PythFetchPriceResponse; + } catch (e: any) { + return { + status: "error", + priceFeedID, + message: e.message, + code: e.code || "UNKNOWN_ERROR", + } as PythFetchPriceResponse; + } + }, + }); + } + + solanaResolveAllDomainsTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.resolveAllDomains", + description: `Resolve domain names to a public key for ALL domain types EXCEPT .sol domains. + Use this for domains like .blink, .bonk, etc. + DO NOT use this for .sol domains.`, + parameters: z.object({ + domain: z + .string() + .trim() + .min(1, "Domain name is required") + .refine( + (val) => !val.endsWith(".sol"), + "This tool cannot be used for .sol domains. Use solana.resolveDomain instead.", + ) + .refine( + (val) => val.includes("."), + "Invalid domain format. Must include a TLD (e.g., .blink, .bonk)", + ), + }), + execute: async ({ domain }) => { + try { + const owner = await this.solanaKit.resolveAllDomains(domain); + + if (!owner) { + return { + status: "error", + message: "Domain not found", + code: "DOMAIN_NOT_FOUND", + }; + } + + return { + status: "success", + message: "Domain resolved successfully", + owner: owner.toString(), + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "DOMAIN_RESOLUTION_ERROR", + }; + } + }, + }); + } + + solanaGetOwnedDomainsTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.getOwnedDomains", + description: "Get all domains owned by a specific wallet address", + parameters: z.object({ + owner: z + .string() + .trim() + .min(1, "Owner address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid Solana wallet address"), + }), + execute: async ({ owner }) => { + try { + const ownerPubkey = new PublicKey(owner); + const domains = await this.solanaKit.getOwnedAllDomains(ownerPubkey); + return { + status: "success", + message: "Owned domains fetched successfully", + domains, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "FETCH_OWNED_DOMAINS_ERROR", + }; + } + }, + }); + } + + solanaGetOwnedTldDomainsTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.getOwnedTldDomains", + description: + "Get all domains owned by the agent's wallet for a specific TLD", + parameters: z.object({ + tld: z + .string() + .trim() + .min(1, "TLD is required") + .regex( + /^[a-zA-Z0-9]+$/, + "TLD must contain only alphanumeric characters", + ), + }), + execute: async ({ tld }) => { + try { + const domains = await this.solanaKit.getOwnedDomainsForTLD(tld); + return { + status: "success", + message: "TLD domains fetched successfully", + domains, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "FETCH_TLD_DOMAINS_ERROR", + }; + } + }, + }); + } + + solanaGetAllTldsTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.getAllTlds", + description: + "Get all active top-level domains (TLDs) in the AllDomains Name Service", + parameters: z.object({}), + execute: async () => { + try { + const tlds = await this.solanaKit.getAllDomainsTLDs(); + return { + status: "success", + message: "TLDs fetched successfully", + tlds, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "FETCH_TLDS_ERROR", + }; + } + }, + }); + } + + solanaGetMainDomainTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.getMainDomain", + description: "Get the main/favorite domain for a given wallet address", + parameters: z.object({ + owner: z + .string() + .trim() + .min(1, "Owner address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid Solana wallet address"), + }), + execute: async ({ owner }) => { + try { + const ownerPubkey = new PublicKey(owner); + const mainDomain = + await this.solanaKit.getMainAllDomainsDomain(ownerPubkey); + return { + status: "success", + message: "Main domain fetched successfully", + domain: mainDomain, + }; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "FETCH_MAIN_DOMAIN_ERROR", + }; + } + }, + }); + } + + solanaCreateGibworkTaskTool(): CoreTool { + return tool({ + // @ts-expect-error Value matches type however TS still shows error + id: "solana.createGibworkTask", + description: "Create a task on Gibwork", + parameters: z.object({ + title: z + .string() + .trim() + .min(1, "Title is required") + .max(200, "Title too long"), + content: z.string().trim().min(1, "Description is required"), + requirements: z.string().trim().min(1, "Requirements are required"), + tags: z + .array(z.string()) + .min(1, "At least one tag is required") + .max(10, "Maximum 10 tags allowed"), + payer: z + .string() + .trim() + .optional() + .refine((val) => { + if (!val) { + return true; + } + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid payer wallet address"), + tokenMintAddress: z + .string() + .trim() + .min(1, "Token mint address is required") + .refine((val) => { + try { + new PublicKey(val); + return true; + } catch { + return false; + } + }, "Invalid token mint address"), + amount: z + .number() + .positive("Amount must be positive") + .min(0.000001, "Amount must be at least 0.000001"), + }), + execute: async ({ + title, + content, + requirements, + tags, + tokenMintAddress, + amount, + payer, + }) => { + try { + const taskData = await this.solanaKit.createGibworkTask( + title, + content, + requirements, + tags, + tokenMintAddress, + amount, + payer, + ); + + return { + status: "success", + taskId: taskData.taskId, + signature: taskData.signature, + } as GibworkCreateTaskReponse; + } catch (e: any) { + return { + status: "error", + message: e.message, + code: e.code || "CREATE_TASK_ERROR", + }; + } + }, + }); + } +} + +export function createSolanaTools( + solanaKit: SolanaAgentKit, +): Record { + const vercelTools = new VercelAITools(solanaKit); + + return { + solanaBalanceTool: vercelTools.solanaBalanceTool(), + solanaTransferTool: vercelTools.solanaTransferTool(), + solanaDeployTokenTool: vercelTools.solanaDeployTokenTool(), + solanaDeployCollectionTool: vercelTools.solanaDeployCollectionTool(), + solanaMintNFTTool: vercelTools.solanaMintNFTTool(), + solanaTradeTool: vercelTools.solanaTradeTool(), + solanaRequestFundsTool: vercelTools.solanaRequestFundsTool(), + solanaRegisterDomainTool: vercelTools.solanaRegisterDomainTool(), + solanaGetWalletAddressTool: vercelTools.solanaGetWalletAddressTool(), + solanaPumpfunTokenLaunchTool: vercelTools.solanaPumpfunTokenLaunchTool(), + solanaCreateImageTool: vercelTools.solanaCreateImageTool(), + solanaLendAssetTool: vercelTools.solanaLendAssetTool(), + solanaTPSCalculatorTool: vercelTools.solanaTPSCalculatorTool(), + solanaStakeTool: vercelTools.solanaStakeTool(), + solanaFetchPriceTool: vercelTools.solanaFetchPriceTool(), + solanaTokenDataTool: vercelTools.solanaTokenDataTool(), + solanaTokenDataByTickerTool: vercelTools.solanaTokenDataByTickerTool(), + solanaCompressedAirdropTool: vercelTools.solanaCompressedAirdropTool(), + solanaRaydiumCreateAmmV4Tool: vercelTools.solanaRaydiumCreateAmmV4Tool(), + solanaRaydiumCreateClmmTool: vercelTools.solanaRaydiumCreateClmmTool(), + solanaRaydiumCreateCpmmTool: vercelTools.solanaRaydiumCreateCpmmTool(), + solanaOpenbookCreateMarketTool: + vercelTools.solanaOpenbookCreateMarketTool(), + solanaCreateSingleSidedWhirlpoolTool: + vercelTools.solanaCreateSingleSidedWhirlpoolTool(), + solanaPythFetchPriceTool: vercelTools.solanaPythFetchPriceTool(), + solanaResolveDomainTool: vercelTools.solanaResolveDomainTool(), + solanaResolveAllDomainsTool: vercelTools.solanaResolveAllDomainsTool(), + solanaGetDomainTool: vercelTools.solanaGetDomainTool(), + solanaGetOwnedDomainsTool: vercelTools.solanaGetOwnedDomainsTool(), + solanaGetOwnedTldDomainsTool: vercelTools.solanaGetOwnedTldDomainsTool(), + solanaGetAllTldsTool: vercelTools.solanaGetAllTldsTool(), + solanaGetMainDomainTool: vercelTools.solanaGetMainDomainTool(), + solanaCreateGibworkTaskTool: vercelTools.solanaCreateGibworkTaskTool(), + }; +} diff --git a/test/agent_sdks/vercel_ai.ts b/test/agent_sdks/vercel_ai.ts new file mode 100644 index 0000000..789d477 --- /dev/null +++ b/test/agent_sdks/vercel_ai.ts @@ -0,0 +1,196 @@ +import { SolanaAgentKit } from "../../src"; +import { createVercelAITools } from "../../src"; +import { OpenAI } from "openai"; +import * as dotenv from "dotenv"; +import * as fs from "fs"; +import * as readline from "readline"; +import { streamText } from "ai"; +import { createOpenAI } from "@ai-sdk/openai"; +// import { createAI, createStreamableUI, getMutableAIState } from "ai/rsc"; + +dotenv.config(); + +function validateEnvironment(): void { + const missingVars: string[] = []; + const requiredVars = ["OPENAI_API_KEY", "RPC_URL", "SOLANA_PRIVATE_KEY"]; + + requiredVars.forEach((varName) => { + if (!process.env[varName]) { + missingVars.push(varName); + } + }); + + if (missingVars.length > 0) { + console.error("Error: Required environment variables are not set"); + missingVars.forEach((varName) => { + console.error(`${varName}=your_${varName.toLowerCase()}_here`); + }); + process.exit(1); + } +} + +validateEnvironment(); + +async function runAutonomousMode(interval = 10) { + console.log("Starting autonomous mode..."); + const openai = createOpenAI({ + apiKey: process.env.OPENAI_API_KEY as string, + }); + + const solanaAgent = new SolanaAgentKit( + process.env.SOLANA_PRIVATE_KEY!, + process.env.RPC_URL, + process.env.OPENAI_API_KEY!, + ); + + const tools = createVercelAITools(solanaAgent); + + while (true) { + try { + const thought = + "Be creative and do something interesting on the blockchain. " + + "Choose an action or set of actions and execute it that highlights your abilities."; + + const response = streamText({ + prompt: thought, + tools, + model: openai("gpt-4o-mini"), + temperature: 0.7, + system: `You are a helpful agent that can interact onchain using the Solana Agent Kit. You are + empowered to interact onchain using your tools. If you ever need funds, you can request them from the + faucet. If not, you can provide your wallet details and request funds from the user. If there is a 5XX + (internal) HTTP error code, ask the user to try again later. If someone asks you to do something you + can't do with your currently available tools, you must say so, and encourage them to implement it + themselves using the Solana Agent Kit, recommend they go to https://www.solanaagentkit.xyz for more information. Be + concise and helpful with your responses. Refrain from restating your tools' descriptions unless it is explicitly requested.`, + maxSteps: 10, + }); + + for await (const textPart of response.textStream) { + process.stdout.write(textPart); + } + console.log(); + + await new Promise((resolve) => setTimeout(resolve, interval * 1000)); + } catch (error) { + if (error instanceof Error) { + console.error("Error:", error.message); + } + process.exit(1); + } + } +} + +async function runChatMode() { + console.log("Starting chat mode... Type 'exit' to end."); + const openai = createOpenAI({ + apiKey: process.env.OPENAI_API_KEY as string, + }); + + const solanaAgent = new SolanaAgentKit( + process.env.SOLANA_PRIVATE_KEY!, + process.env.RPC_URL, + process.env.OPENAI_API_KEY!, + ); + + const tools = createVercelAITools(solanaAgent); + + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }); + + const question = (prompt: string): Promise => + new Promise((resolve) => rl.question(prompt, resolve)); + + try { + while (true) { + const userInput = await question("\nPrompt: "); + + if (userInput.toLowerCase() === "exit") { + break; + } + + const response = streamText({ + prompt: userInput, + tools, + model: openai("gpt-4o-mini"), + temperature: 0.7, + system: `You are a helpful agent that can interact onchain using the Solana Agent Kit. You are + empowered to interact onchain using your tools. If you ever need funds, you can request them from the + faucet. If not, you can provide your wallet details and request funds from the user. If there is a 5XX + (internal) HTTP error code, ask the user to try again later. If someone asks you to do something you + can't do with your currently available tools, you must say so, and encourage them to implement it + themselves using the Solana Agent Kit, recommend they go to https://www.solanaagentkit.xyz for more information. Be + concise and helpful with your responses. Refrain from restating your tools' descriptions unless it is explicitly requested.`, + maxSteps: 10, + }); + + for await (const textPart of response.textStream) { + process.stdout.write(textPart); + } + console.log(); + } + } catch (error) { + if (error instanceof Error) { + console.error("Error:", error.message); + } + process.exit(1); + } finally { + rl.close(); + } +} + +async function chooseMode(): Promise<"chat" | "auto"> { + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }); + + const question = (prompt: string): Promise => + new Promise((resolve) => rl.question(prompt, resolve)); + + while (true) { + console.log("\nAvailable modes:"); + console.log("1. chat - Interactive chat mode"); + console.log("2. auto - Autonomous action mode"); + + const choice = (await question("\nChoose a mode (enter number or name): ")) + .toLowerCase() + .trim(); + + rl.close(); + + if (choice === "1" || choice === "chat") { + return "chat"; + } else if (choice === "2" || choice === "auto") { + return "auto"; + } + console.log("Invalid choice. Please try again."); + } +} + +async function main() { + try { + console.log("Starting Agent..."); + const mode = await chooseMode(); + + if (mode === "chat") { + await runChatMode(); + } else { + await runAutonomousMode(); + } + } catch (error) { + if (error instanceof Error) { + console.error("Error:", error.message); + } + process.exit(1); + } +} + +if (require.main === module) { + main().catch((error) => { + console.error("Fatal error:", error); + process.exit(1); + }); +}