diff --git a/README.md b/README.md index d098bf6..568297f 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,7 @@ import { PublicKey } from '@solana/web3.js'; const signature = await lendAsset( agent, - new PublicKey('asset-mint'), 100, // amount - "lulo-api-key" ); ``` diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 2708636..0000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -solanaagentkit.xyz \ No newline at end of file diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index 1fbea8f..42ae6d9 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE4WSTU/DMAyG/0vOFWUVG9DbRLUL40PQG+IQBZdGS+2odiQmtP+OyibWji695OInj+PXeftWAl+icvVKTqNefgLKvRWVKK+lVrkyTjMDp8P6RS2NU4naWPxQ+Sy72SV/pjtyDoxYwgK8o20D2PNZFGgrbYDTMXAozuaLUfGT706esB6oqLIFLdSOi/a12PV1cLQ0hgJKAaKt4xdgT8gwajyPx5o8WJTjUI+rMtrjLB1r8RwaXwVc64CmjupHySn1KmBJG4iubYSbSr4AT2xlyQzSjX30ytYf4j5lTpyXt9ezedbzmm7psP/sJZHrPbYK+Jspp/+goXVxtXv/ATHeAoJZAwAA" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE4XSTUsDQQwG4P+S8+Ji0SJ7K5ZerB/o3sTDMGbdodlk2GRAkf53qRXt4nR6mUveeUJInj/B8N2ggSchx27xhmw3waCC6KyHBjw5VdR6Wj/rbSCoYBP4FZrz2dW2+pWuhQi9BeElRpKPAfnAC2w4ds6j1rngFJ5dzrPwfdy9ekL9SRXJEZ3JmIf2tdL3dSJZeC+JbYnmAukjahRWzIrH46Umt4Htb6i7VVvscTRdavGQhtglXrvEvi/y2eQpepW4lQ0W15bJlVi/Ww7uj7IVoQO0S/w9u9b/QlNxfrF9+QJeMbLbAQMAAA==" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index 73c468a..ba76e21 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE7WbXW/jthKG/wt9KyThh2zHd9nuCXBwtu2i3e6NEQSMTXuJlSVVojYnCPLfC+rDGpojh7K2Vy1izsxL8uGQImdfSZE9l2S1fiXfdbolK8qWEUnlQZEV+TNLZCrv9io1/9OGRKQqErIim0SWpSqv3Z+vvplDQqLuV7Ii5C3qvMaUHb1usrQ0RbUxWRHicua2B+4jkstCpcZX2gemN0zAyKnaGJ2loYH75lPiPsskUUHjNzs2nR7vUW63hSrLEXGByZT4Wa5SqR9lrh+/q5eg+J7JyPjsRvTcFurvSpXmXlYbZe6rdBs2BqjZFB1blSfZy5fsuwoDzm0/PfIvWZKM4B0xmqJhr8wHmch0o4KiO82nxD3o1Px2/yUoaN92SkRTyLTcqbB0BhpPY3yvS6OKj9lB6rD59Uwm9nkbNrFdyynRElmlm2+fq0N+X6XhCwo1G6ljDvaPQkmjmpZfsizp08quSuslU157bc7uiyyeH73/Yi3BnqhTo4qd3Kjyuv3prCsnA5+m/gFfs/fyfadpIEyuio1KjdyrdyM5TUODOcNzzEu/5/VQoyFPG4UPWf2fYJeztvlATzytA0GrQo+I2bSeGLLIXmRiXj7IUpefM52aEQM5Q40nCto00z5GBjAZHxyH6mO9+R2s+VkdfbtwtDZH67sz63IoxAwzf6/boDsDokq9T6WpinegPxUDzS4SAYf/V52avvlv91/+UGWepSWqabBx+ETY7X6861lrhnd3uA9DIpSRW2nkJUJ608vFwAmAW+OZtIo0Cx9086yNUei+NuR31tvg/cR0D4VXidoX8jAufm80WcCzeiq1QZEejN/bTA6vU220TD7pvyu91eblz98/jZKC20+WVSY6z+VefchHETdz7SbLyAudFdq83KtxE+TaXSLjdBnuqvRTfVw9lwPRhuFL8WzOH/YdkPTxHoxMw2cUnE3B44K3OfQv/Oh1ToNj+ROkqK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4hMWWGYESFvuExS5hsWVGoITFPmGxS1hsmYlRwmKfsPZP9bfMD1UYtf1v802zXh/vDF7JY/uhI44XCq9ELMnq9e2t/7BZvb6Bbxv7m410fJ3vvdBF74Uuwrw0H8l5/5EMRC17d/FNkLv+NRKRx+LeH4tH+tuCJ1jgUgCXYqTLrHvTAiN4C0bwNtBfXwgIhAFdoW76QkYgCOgJ81OXmJR1iYnJTmaUghmggTPQFZ4ALwBWOh/jxcWBgzHiQW4aCDagCK13B2ANW0CNM9MU/vR+wBoKW0LtpXvvgQOIRNis7ZV56urbekfATxiL/d0RWMXASxympn3VS7pXvTJLnP6BRcfDFl13R63aO2ogD1AgwpBsCrfy5jXDmz8K1NEwdUmVZLK5nNo2l1PF8SECKAVrUYTxah1vm+cReylmmocq4PIGuAzLE/0rP1hJYIpZGCmdm7pqCEwtWEUiLOW3t39FffvXe4pB1+LArp2MDgNi2LIx4oHd06np00S6M9iEMrDUWdhat37TnaOSgo7SsCFrLi6BEOCChbk4LYkGAw/GPcxVc7cPqATjIsLGGxbwgaEBE0jDknL3dL5TjicOthwetuW0+aFJFtj0c9BNHjb9MOcgpwcO5pGHzWP3SCZzZxIFSGIirL9dAe+2LeAF0wAOIzRsKbbV7ru62n3XVLv3DsFkBGprKgOfbGVg3lYGAvzhYSlMX/+SB8YMkC/C5hOULgA5oHts3qadMHq7+pOn3OUCKONhi7I5wElbcfxdO/kGMBaGWF+uBBSBIedhQ16/fv9oXr/BoANHImy3bUu+AZ/gCEDDNta+Th64gWflsIPOsZIMjAzwwsO8nOyhDHhgYR66f9gDZAAVI1w8Ip9dMJWEuerqy4AcqCdA0ENEcp2rRKeKrNYPb2//AMzmTvZLNgAA"; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE7Wb227jNhCG34W+FbLhQU7su2y3AYpu20U37Y0RBIxEe4XIkipRmwZB3r2gDtbQHDmUtb1KYHP+GXI+DSmSfiVl/lyR9eaVPCVZTNaUXQckk3tF1uRrnsp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w8qZqLJzo/yigFGaCeGeivowCVFVBZTVGxx3oJxmjpJdNCEIELf4Mc6Jpfz1ox3V4+GnQAUX5AdVvx4GEGyRfCS2On9GN/l3AQAuPsN8w7pXVhZzwEuQq9RIatL1AKAIch95LpDgzT/sCwylOoyME4c7+B7rfYVbfFDkYc9FL4ibU30Ir2oMSBgAI2qR+b5gqf7K7wASEBhPxYSOs0l+0mXdxu0pWHAxnQZQ667JfY4doASANglftVql6muYYEAgKICD9Eui3LstmyBLCBmEK/MWvPBUG3QDCctkbCs3tJpocKk201NvocTI3cb6Y1utnWipICFeqn0u62giIKMGB+o358cx0MPBh3P6n2QAJAAEpW6DdhwRuBoF8ggcxTqDuL3yo7VSAk7ldGu6rQlgj04QOJE36Jg5UGWXhwkEful8f+ZE8WVhIFKF3Cbybs71nH3T1rQCh4FKnf89P9KGHb/Chh2/4oYRAEwfmV1e6q4aO5alh0Vw0BJgBZ5sfscPwIxgxMRsKPEXAXAoQDWGOrruz40dtfaHm0528OljXcL5vt2k+aK8xPiVVvALV+0HZ3pQEPYKCo30Q73KECvQJp435pa479v7fH/iBxYHoVfkB1t/tBn8CjR/0eveEnEUAGLtX9cn643gZGBnSI+819R/MwAwrMT6H/DRcIA0QxQeIBeeuDGfKT6i+9gXBA2eAeab4PSJEUKk0yRdab+7e3/wDIrU8JNjgAAA=="; \ No newline at end of file diff --git a/docs/classes/SolanaAgentKit.html b/docs/classes/SolanaAgentKit.html index 3b6a544..554183d 100644 --- a/docs/classes/SolanaAgentKit.html +++ b/docs/classes/SolanaAgentKit.html @@ -1,7 +1,7 @@ SolanaAgentKit | solana-agent-kit

Class SolanaAgentKit

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

SolanaAgentKit

-

Constructors

Constructors

Properties

connection openai_api_key wallet @@ -9,13 +9,16 @@ Provides a unified interface for token operations, NFT management, and trading

Methods

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

    • decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS

    Returns Promise<{
        mint: PublicKey;
    }>

  • Parameters

    • Optionaltoken_address: PublicKey

    Returns Promise<null | number>

  • Parameters

    • tokenName: string
    • tokenTicker: string
    • description: string
    • imageUrl: string
    • Optionaloptions: PumpFunTokenOptions

    Returns Promise<{
        metadataUri: any;
        mint: string;
        signature: string;
    }>

  • Parameters

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

    Returns Promise<MintCollectionNFTResponse>

  • Parameters

    • name: string
    • OptionalspaceKB: number

    Returns Promise<string>

  • 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

    • decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS

    Returns Promise<{
        mint: PublicKey;
    }>

  • Parameters

    • Optionaltoken_address: PublicKey

    Returns Promise<null | number>

  • Parameters

    • tokenName: string
    • tokenTicker: string
    • description: string
    • imageUrl: string
    • Optionaloptions: PumpFunTokenOptions

    Returns Promise<{
        metadataUri: any;
        mint: string;
        signature: string;
    }>

  • Parameters

    • amount: number

    Returns Promise<string>

  • Parameters

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

    Returns Promise<MintCollectionNFTResponse>

  • Parameters

    • name: string
    • OptionalspaceKB: number

    Returns Promise<string>

  • 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 0689a13..371d646 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
        | SolanaGetWalletAddressTool
        | SolanaPumpfunTokenLaunchTool
        | SolanaCreateImageTool)[]

+createSolanaTools | solana-agent-kit

Function createSolanaTools

  • Parameters

    Returns (
        | SolanaBalanceTool
        | SolanaTransferTool
        | SolanaDeployTokenTool
        | SolanaDeployCollectionTool
        | SolanaMintNFTTool
        | SolanaTradeTool
        | SolanaRequestFundsTool
        | SolanaRegisterDomainTool
        | SolanaGetWalletAddressTool
        | SolanaPumpfunTokenLaunchTool
        | SolanaCreateImageTool
        | SolanaLendAssetTool
        | SolanaTPSCalculatorTool
        | SolanaStakeTool)[]

diff --git a/docs/index.html b/docs/index.html index 021597b..d3bb75a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,6 +6,7 @@
  • Deploy new SPL tokens
  • Transfer SOL and SPL tokens
  • Check token balances
  • +
  • Stake SOL
  • @@ -53,7 +54,10 @@
    import { trade } from 'solana-agent-kit';
    import { PublicKey } from '@solana/web3.js';

    const signature = await trade(
    agent,
    new PublicKey('target-token-mint'),
    100, // amount
    new PublicKey('source-token-mint'),
    300 // 3% slippage
    );
    -
    import { lendAsset } from 'solana-agent-kit';
    import { PublicKey } from '@solana/web3.js';

    const signature = await lendAsset(
    agent,
    new PublicKey('asset-mint'),
    100, // amount
    "lulo-api-key"
    ); +
    import { lendAsset } from 'solana-agent-kit';
    import { PublicKey } from '@solana/web3.js';

    const signature = await lendAsset(
    agent,
    100, // amount
    ); +
    + +
    import { stakeWithJup } from 'solana-agent-kit';

    const signature = await stakeWithJup(
    agent,
    1 // amount in SOL
    );

    Deploy a new SPL token with optional initial supply.

    @@ -63,6 +67,7 @@

    Swap tokens using Jupiter Exchange integration.

    Check SOL or token balance for the agent's wallet.

    Lend idle assets to earn interest with Lulo.

    +

    Stake SOL with Jupiter to earn rewards.

    The toolkit relies on several key Solana and Metaplex libraries:

    • @solana/web3.js
    • @@ -73,4 +78,4 @@

      Contributions are welcome! Please feel free to submit a Pull Request.

      ISC 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 56b0948..61bc317 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;
      }

      Properties

      collectionAddress +CollectionDeployment | solana-agent-kit

      Interface CollectionDeployment

      interface CollectionDeployment {
          collectionAddress: PublicKey;
          signature: Uint8Array;
      }

      Properties

      collectionAddress: PublicKey
      signature: Uint8Array
      +

      Properties

      collectionAddress: PublicKey
      signature: Uint8Array
      diff --git a/docs/interfaces/CollectionOptions.html b/docs/interfaces/CollectionOptions.html index 69c5eab..84fe09b 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 40ecce7..5eb7aad 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/LuloAccountDetailsResponse.html b/docs/interfaces/LuloAccountDetailsResponse.html index c112461..d276b4c 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 ecc3c1d..d007719 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 8c0e69e..f9246b3 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 c5b14ca..ebf722d 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/modules.html b/docs/modules.html index bffe782..4d1e321 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -6,6 +6,5 @@ MintCollectionNFTResponse PumpfunLaunchResponse PumpFunTokenOptions -

      Type Aliases

      Functions

      diff --git a/docs/types/LuloDepositAssetMint.html b/docs/types/LuloDepositAssetMint.html deleted file mode 100644 index 1015fda..0000000 --- a/docs/types/LuloDepositAssetMint.html +++ /dev/null @@ -1,2 +0,0 @@ -LuloDepositAssetMint | solana-agent-kit

      Type Alias LuloDepositAssetMint

      LuloDepositAssetMint: typeof TOKENS[keyof typeof TOKENS]

      Mint addresses of supported tokens for lending on Lulo

      -
      diff --git a/src/agent/index.ts b/src/agent/index.ts index b7c0ade..23af3ad 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -10,6 +10,8 @@ import { trade, registerDomain, launchPumpFunToken, + lendAsset, + getTPS, stakeWithJup, } from "../tools"; import { CollectionOptions, PumpFunTokenOptions } from "../types"; @@ -33,7 +35,7 @@ export class SolanaAgentKit { constructor( private_key: string, rpc_url = "https://api.mainnet-beta.solana.com", - openai_api_key: string + openai_api_key: string, ) { this.connection = new Connection(rpc_url); this.wallet = Keypair.fromSecretKey(bs58.decode(private_key)); @@ -47,7 +49,7 @@ export class SolanaAgentKit { } async deployToken( - decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS + decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS, // initialSupply?: number ) { return deploy_token(this, decimals); @@ -64,7 +66,7 @@ export class SolanaAgentKit { async mintNFT( collectionMint: PublicKey, metadata: Parameters[2], - recipient?: PublicKey + recipient?: PublicKey, ) { return mintCollectionNFT(this, collectionMint, metadata, recipient); } @@ -81,17 +83,25 @@ export class SolanaAgentKit { outputMint: PublicKey, inputAmount: number, inputMint?: PublicKey, - slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS + slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS, ) { return trade(this, outputMint, inputAmount, inputMint, slippageBps); } + async lendAssets(amount: number) { + return lendAsset(this, amount); + } + + async getTPS() { + return getTPS(this); + } + async launchPumpFunToken( tokenName: string, tokenTicker: string, description: string, imageUrl: string, - options?: PumpFunTokenOptions + options?: PumpFunTokenOptions, ) { return launchPumpFunToken( this, @@ -99,7 +109,7 @@ export class SolanaAgentKit { tokenTicker, description, imageUrl, - options + options, ); } diff --git a/src/constants/index.ts b/src/constants/index.ts index dfcc9f6..7c1d9c5 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -28,8 +28,3 @@ export const DEFAULT_OPTIONS = { * Jupiter API URL */ export const JUP_API = "https://quote-api.jup.ag/v6"; - -/** - * LULO (fka Flexlend) API URL - */ -export const LULO_API = "https://api.flexlend.fi"; diff --git a/src/langchain/index.ts b/src/langchain/index.ts index a406c61..a69568e 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -516,6 +516,57 @@ export class SolanaCreateImageTool extends Tool { } } +export class SolanaLendAssetTool extends Tool { + name = "solana_lend_asset"; + description = `Lend idle USDC for yield using Lulo. ( only USDC is supported ) + + Inputs (input is a json string): + amount: number, eg 1, 0.01 (required)`; + + constructor(private solanaKit: SolanaAgentKit) { + super(); + } + + async _call(input: string): Promise { + try { + let amount = JSON.parse(input).amount || input; + + const tx = await this.solanaKit.lendAssets(amount); + + return JSON.stringify({ + status: "success", + message: "Asset lent successfully", + transaction: tx, + amount: amount, + }); + } catch (error: any) { + return JSON.stringify({ + status: "error", + message: error.message, + code: error.code || "UNKNOWN_ERROR", + }); + } + } +} + +export class SolanaTPSCalculatorTool extends Tool { + name = "solana_get_tps"; + description = "Get the current TPS of the Solana network"; + + constructor(private solanaKit: SolanaAgentKit) { + super(); + } + + async _call(_input: string): Promise { + try { + const tps = await this.solanaKit.getTPS(); + return `Solana (mainnet-beta) current transactions per second: ${tps}`; + } catch (error: any) { + return `Error fetching TPS: ${error.message}`; + } + } +} + export class SolanaStakeTool extends Tool { name = "solana_stake"; description = `This tool can be used to stake your SOL (Solana), also called as SOL staking or liquid staking. @@ -562,6 +613,8 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) { new SolanaGetWalletAddressTool(solanaKit), new SolanaPumpfunTokenLaunchTool(solanaKit), new SolanaCreateImageTool(solanaKit), + new SolanaLendAssetTool(solanaKit), + new SolanaTPSCalculatorTool(solanaKit), new SolanaStakeTool(solanaKit), ]; } diff --git a/src/tools/create_image.ts b/src/tools/create_image.ts index e2c4bd4..7fbb2cf 100644 --- a/src/tools/create_image.ts +++ b/src/tools/create_image.ts @@ -13,7 +13,7 @@ export async function create_image( agent: SolanaAgentKit, prompt: string, size: "256x256" | "512x512" | "1024x1024" = "1024x1024", - n: number = 1 + n: number = 1, ) { try { if (!agent.openai_api_key) { @@ -21,7 +21,7 @@ export async function create_image( } const openai = new OpenAI({ - apiKey: agent.openai_api_key + apiKey: agent.openai_api_key, }); const response = await openai.images.generate({ @@ -31,9 +31,8 @@ export async function create_image( }); return { - images: response.data.map((img) => img.url), + images: response.data.map((img: any) => img.url), }; - } catch (error: any) { throw new Error(`Image generation failed: ${error.message}`); } diff --git a/src/tools/index.ts b/src/tools/index.ts index 5eb38ca..f6ef508 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -1,10 +1,12 @@ -export * from './request_faucet_funds'; -export * from './deploy_token'; -export * from './deploy_collection'; -export * from './get_balance'; -export * from './mint_nft'; -export * from './transfer'; -export * from './trade'; -export * from './register_domain'; -export * from './launch_pumpfun_token'; +export * from "./request_faucet_funds"; +export * from "./deploy_token"; +export * from "./deploy_collection"; +export * from "./get_balance"; +export * from "./mint_nft"; +export * from "./transfer"; +export * from "./trade"; +export * from "./register_domain"; +export * from "./launch_pumpfun_token"; +export * from "./lend"; +export * from "./get_tps"; export * from './stake_with_jup'; \ No newline at end of file diff --git a/src/tools/lend.ts b/src/tools/lend.ts index 5fd85b7..7889343 100644 --- a/src/tools/lend.ts +++ b/src/tools/lend.ts @@ -1,94 +1,60 @@ import { VersionedTransaction } from "@solana/web3.js"; -import { SolanaAgentKit } from "../index"; -import { LuloAccountDetailsResponse, LuloDepositAssetMint } from "../types"; -import { getPriorityFees } from "../utils/send_tx"; -import { LULO_API } from "../constants"; +import { LuloAccountDetailsResponse } from "../types"; +import { SolanaAgentKit } from "../agent"; /** * Lend tokens for yields using Lulo * @param agent SolanaAgentKit instance - * @param asset Mint address of the token to lend (as supported by Lulo) - * @param amount Amount to lend (in token decimals) - * @param LULO_API_KEY Valid API key for Lulo + * @param amount Amount of USDC to lend * @returns Transaction signature */ export async function lendAsset( agent: SolanaAgentKit, - asset: LuloDepositAssetMint, - amount: number, - LULO_API_KEY = "", + amount: number ): Promise { try { - if (!LULO_API_KEY) { - throw new Error("Missing Lulo API key"); - } - - const request = { - owner: agent.wallet.publicKey.toBase58(), - mintAddress: asset.toBase58(), - depositAmount: amount.toString(), - }; - - const priorityFees = await getPriorityFees(agent.connection); - const priority = `?priorityFee=${priorityFees.median}`; - const response = await fetch( - `${LULO_API}/generate/account/deposit${priority}`, + `https://blink.lulo.fi/actions?amount=${amount}&symbol=USDC`, { method: "POST", headers: { "Content-Type": "application/json", - "x-wallet-pubkey": agent.wallet.publicKey.toBase58(), - "x-api-key": LULO_API_KEY, }, - body: JSON.stringify(request), - }, + body: JSON.stringify({ + account: agent.wallet.publicKey.toBase58(), + }), + } ); - const { - data: { transactionMeta }, - } = await response.json(); + const data = await response.json(); + // Deserialize the transaction const luloTxn = VersionedTransaction.deserialize( - Buffer.from(transactionMeta[0].transaction, "base64"), + Buffer.from(data.transaction, "base64") ); + // Get a recent blockhash and set it + const { blockhash } = await agent.connection.getLatestBlockhash(); + luloTxn.message.recentBlockhash = blockhash; + // Sign and send transaction luloTxn.sign([agent.wallet]); - const signature = await agent.connection.sendTransaction(luloTxn); + + const signature = await agent.connection.sendTransaction(luloTxn, { + preflightCommitment: "confirmed", + maxRetries: 3, + }); + + // Wait for confirmation using the latest strategy + const latestBlockhash = await agent.connection.getLatestBlockhash(); + await agent.connection.confirmTransaction({ + signature, + blockhash: latestBlockhash.blockhash, + lastValidBlockHeight: latestBlockhash.lastValidBlockHeight, + }); return signature; } catch (error: any) { throw new Error(`Lending failed: ${error.message}`); } } - -/** - * Fetch lending details for agent - * @param agent SolanaAgentKit instance - * @param LULO_API_KEY Valid API key for Lulo - * @returns Lending account details - */ -export async function getLendingDetails( - agent: SolanaAgentKit, - LULO_API_KEY = "", -): Promise { - try { - if (!LULO_API_KEY) { - throw new Error("Missing Lulo API key"); - } - - const response = await fetch(`${LULO_API}/account`, { - headers: { - "x-wallet-pubkey": agent.wallet.publicKey.toBase58(), - "x-api-key": LULO_API_KEY, - }, - }); - - const { data } = await response.json(); - - return data as LuloAccountDetailsResponse; - } catch (error: any) { - throw new Error(`Failed to fetch lending details: ${error.message}`); - } -} diff --git a/src/types/index.ts b/src/types/index.ts index 10c2cfc..e5c591e 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,5 +1,4 @@ import { PublicKey } from "@solana/web3.js"; -import { TOKENS } from "../constants"; export interface Creator { address: string; @@ -41,11 +40,6 @@ export interface PumpfunLaunchResponse { } -/** - * Mint addresses of supported tokens for lending on Lulo - */ -export type LuloDepositAssetMint = (typeof TOKENS)[keyof typeof TOKENS]; - /** * Lulo Account Details response format */