From 3552ffe41c9e501fce783fcc37ca4060ef0c25f2 Mon Sep 17 00:00:00 2001 From: Lautaro Date: Sun, 29 Dec 2024 06:01:19 -0300 Subject: [PATCH 01/10] Fix: change lamports by getting mintInfo --- src/tools/trade.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tools/trade.ts b/src/tools/trade.ts index b42cc2a..0fc3ff0 100644 --- a/src/tools/trade.ts +++ b/src/tools/trade.ts @@ -1,11 +1,10 @@ import { VersionedTransaction, - PublicKey, - LAMPORTS_PER_SOL, + PublicKey } from "@solana/web3.js"; import { SolanaAgentKit } from "../index"; import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants"; - +import { getMint } from "@solana/spl-token"; /** * Swap tokens using Jupiter Exchange * @param agent SolanaAgentKit instance @@ -23,12 +22,17 @@ export async function trade( slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS, ): Promise { try { + const mintInfo = await getMint(agent.connection, inputMint); + const inputDecimals = mintInfo.decimals; + + // Calculate the correct amount based on actual decimals + const scaledAmount = inputAmount * Math.pow(10, inputDecimals); const quoteResponse = await ( await fetch( `${JUP_API}/quote?` + `inputMint=${inputMint.toString()}` + `&outputMint=${outputMint.toString()}` + - `&amount=${inputAmount * LAMPORTS_PER_SOL}` + + `&amount=${scaledAmount}` + `&slippageBps=${slippageBps}` + `&onlyDirectRoutes=true` + `&maxAccounts=20`, From 984f0390b42da06d08830ab6c550c84645777919 Mon Sep 17 00:00:00 2001 From: aryan Date: Sun, 29 Dec 2024 22:38:10 +0530 Subject: [PATCH 02/10] feat: replit --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 33685e0..4f0831b 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ # Solana Agent Kit - - ![Solana Agent Kit Cover 1 (3)](https://github.com/user-attachments/assets/cfa380f6-79d9-474d-9852-3e1976c6de70) @@ -25,6 +23,10 @@ An open-source toolkit for connecting AI agents to Solana protocols. Now, any ag Anyone - whether an SF-based AI researcher or a crypto-native builder - can bring their AI agents trained with any model and seamlessly integrate with Solana. + +[![Run on Repl.it](https://replit.com/badge/github/sendaifun/solana-agent-kit)](https://replit.com/@sendaifun/Solana-Agent-Kit) +> Replit template created by [Arpit Singh](https://github.com/The-x-35) + ## 🔧 Core Blockchain Features - **Token Operations** From 6b9a347f56dda671aeaeb6841286cf92a6649102 Mon Sep 17 00:00:00 2001 From: Lautaro Date: Sun, 29 Dec 2024 16:03:40 -0300 Subject: [PATCH 03/10] Fix: if token is sol --- src/tools/trade.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/tools/trade.ts b/src/tools/trade.ts index 0fc3ff0..3704308 100644 --- a/src/tools/trade.ts +++ b/src/tools/trade.ts @@ -22,20 +22,26 @@ export async function trade( slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS, ): Promise { try { - const mintInfo = await getMint(agent.connection, inputMint); - const inputDecimals = mintInfo.decimals; + // Check if input token is native SOL + const isNativeSol = inputMint.equals(TOKENS.SOL); + + // For native SOL, we use LAMPORTS_PER_SOL, otherwise fetch mint info + const inputDecimals = isNativeSol + ? 9 // SOL always has 9 decimals + : (await getMint(agent.connection, inputMint)).decimals; // Calculate the correct amount based on actual decimals const scaledAmount = inputAmount * Math.pow(10, inputDecimals); + const quoteResponse = await ( await fetch( `${JUP_API}/quote?` + - `inputMint=${inputMint.toString()}` + - `&outputMint=${outputMint.toString()}` + - `&amount=${scaledAmount}` + - `&slippageBps=${slippageBps}` + - `&onlyDirectRoutes=true` + - `&maxAccounts=20`, + `inputMint=${isNativeSol ? TOKENS.SOL.toString() : inputMint.toString()}` + + `&outputMint=${outputMint.toString()}` + + `&amount=${scaledAmount}` + + `&slippageBps=${slippageBps}` + + `&onlyDirectRoutes=true` + + `&maxAccounts=20`, ) ).json(); From 0138f7de898e95b8c249fbbb11bf260eaa961d7b Mon Sep 17 00:00:00 2001 From: Deepak Date: Mon, 30 Dec 2024 02:29:51 +0530 Subject: [PATCH 04/10] Updated README.md with contributors and star graph --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 4f0831b..c917201 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,17 @@ The toolkit relies on several key Solana and Metaplex libraries: Contributions are welcome! Please feel free to submit a Pull Request. Refer to [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines on how to contribute to this project. +## Contributors + + + + + + +## Star History + +[![Star History Chart](https://api.star-history.com/svg?repos=sendaifun/solana-agent-kit&type=Date)](https://star-history.com/#sendaifun/solana-agent-kit&Date) + ## License Apache-2 License From fab1441a0084376711460daeb91b8337638eff1c Mon Sep 17 00:00:00 2001 From: aryan Date: Mon, 30 Dec 2024 03:26:26 +0530 Subject: [PATCH 05/10] chore: docs --- .eslintrc | 2 +- docs/assets/navigation.js | 2 +- docs/assets/search.js | 2 +- docs/classes/SolanaAgentKit.html | 10 +- docs/functions/createSolanaTools.html | 2 +- docs/index.html | 10 +- 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 +- .../src/agents/readAgent.ts | 1 - examples/persistance-agent/index.ts | 297 +++++++++--------- src/tools/trade.ts | 25 +- 20 files changed, 201 insertions(+), 194 deletions(-) diff --git a/.eslintrc b/.eslintrc index d663169..cfdc5bc 100644 --- a/.eslintrc +++ b/.eslintrc @@ -31,7 +31,7 @@ }, "overrides": [ { - "files": ["test/**/*", "src/utils/keypair.ts"], + "files": ["test/**/*", "src/utils/keypair.ts", "examples/**/*"], "rules": { "no-console": "off" } diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index 54693ba..12dd419 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE42TwU7DMAyG3yXniooJJtTbRFUkGDCN3hCHEFwaNXWixBFMaO+O6BCsLPW45OIv3x/ZzuOHIHgnUYgHayTKxSsg3WgSmXCSWlEIZWQIEPJx/aSl3ohMdBpfRHE6u9hmP6ZLawwo0hZLcMZuesA9n0YC30gFIU+BY/HsfJ4U37uvMxyxflOs0oMk69OiXY27XgGpduW1gjUEZzFA0nSIcdIr/fxmfTfEQy1Dt4Zp9RTMBVxHpwl8bTvAUpJMiv9CnHAZjV0oZSNSCSS1CWw7pnEu5FYj/c72rqrZjEmai1jF3jURlzKiall9kjymriIO7eS2N8Gx2g21/1zCNMrJ1bBUu49fW2v2XtxEHBob8gNobJyfbZ8+AWWuiIJlBAAA" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE42TwU4DIRCG34VzY2OjjemtcbMmWrWpezMeEKcuWZYhMEQb03cXt8a6lp164QAf3w/D8PghCN5JzMQDGmnl/BUs3WgSI+Ek1WleGRkChHF//aSm1iSo0fZFzE4nF9vRj+kSjQFFGm0BzuCmTVv2Pm0J/FqqpMyBffHkfJoV37uvMRyxflOs0oMk9HnRbo3bXgKpeum1ghUEl7IgazrEOOmVfn5D33TxUMnQrGBYPQRzAdfR6SSosAFbSJJZ8V+IEy6iwblSGC0VQFKbwJZjGOdCbpNh/7Z3ZcVmDNJcxDK2bh3tQkaralafJY+py2i7cnLdm+FY7YbqfzZhHuXkqmuq3cevEM2vE6e7d4UN4wOob5yebZ8+AWWuiIJlBAAA" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index 9582149..0e15f57 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -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4Yw30PGglhzdumrlz9C4EVCngdVhzudD39nIhMFZAtVxeXuj+BgXIVbBpeMNi+AMmwA18ucDspv4SPdC+cCHNEzN6QrOBB5vnof+LSyDfgnQ7w8UD9Z4KyOG56q/WA60CeHEY3fx1ZRRJIdMkk8bV5uvPn/8H0gYQhuRrAAA="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE7Wd33OcOBLH/5fxq8s7CMSPvDnJ+Sp32U0q9u49uFIuzMgOZ2ZggYnXl8r/fhIwQzdqZprB+7LZmVF/uyV91BIC5B+LMn+uFm9ufyye0s1q8cYR4fliE6/V4s3iOs/iTXz5qDb1v9N6cb7Ylpn+OsniqlLVL/jni2/1OtNlul91ucXP852qdMReNck3VV1ukzovOZJnuDyQP18UcalL2pH2jp2l8KDnjUrqNN9wHffF5/h9jrNMsdrvbF90vr+7eLUqVVVN8AtM5vjPC7WJ07u4SO+e1AvLv2Uy0b9Yej23pfpzq6r6Kt4mqr7abla8NiDN5sSxUkWWv9zkT4oHHC4/3/O7XHcqn3fCaE4Mj6p+G+uCiWJ5R8Xn+F2nm/q3qxuW077sHI91GW+qB8VLZ6DwPMYf06pW5ft8Hae8/rVM5vmv8uy70oUnRWAZzSTsc5mu4/JlQgyE0cy+X/EA35Wc4y1Tm9Wltq55GQ0Vn9nSN5+vue3bFp3rz6TB93Edv325nDCRjVm+XjQ3afLEHOsjhnNieVB18q0R1RQzU6ttM4vBeLtJvn3ergs9R/InN9JsThxVHT/x6r8rOcubHkrv8nVhcFKry7RclXnB8z5iOSeapFRxrT6VSXydbh4zdZ2u1Oo/39IyK/I8461uj0m8wuxwmXWJnrsAs61mjttPzxvd5tPCIM1eI45O7Sovbz6+nxTK0HJmNH3NtBy7USyr+VF86ZYkp/TRuPnMuH7VMr3etKXFiO2ssRS/rNLt+l0zXi/X6z883mCizF4tjnfZej09jM7q9aIoToqimB2FuVy9z/OnVvDXuHxiXt+PGM6JpXipv12ZGZ6/ILBM5s9F/0zvn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OIdbI/xDreHWIN2hBUWvAq3Z+4AToW5NCAl/nAixcgN4EMKpfd6qhbJZltf5Zwd5jTPb5Wk2B9Knkjo92WjM3xnU8pmulBmMzatmeZg4aH+8O8sbV7dwdMXYCIqLsZEQW75mJ2Z3cUAFiCgHEV8Fqqfb8eSAD2Q17CNdfCgykexGHuGbFU9mesgZ4HrSR546aZOwf3QkCVIl6HNYcLfW8PFwJjBVTL5+WF7m9QgFwFm4Y3LPo/YAJk4M0FZjftDtED7QsX0rxgBldoHlDweAq7v7gE8i1ItxMk7qj7VCAcntTuaD3QKoAXyejmr+eLIi1Ulm60ye3Xnz//D9IGEIbkawAA"; \ No newline at end of file diff --git a/docs/classes/SolanaAgentKit.html b/docs/classes/SolanaAgentKit.html index e510d32..7886a1b 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, trading and more

SolanaAgentKit

-

Constructors

Constructors

Properties

connection openai_api_key wallet @@ -39,7 +39,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

    • 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

    • amount: number
    • OptionalsplmintAddress: PublicKey

    Returns Promise<{
        signature: string;
        url: 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

    • amount: number
    • choice: "rock" | "paper" | "scissors"

    Returns Promise<string>

  • 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

    • amount: number
    • OptionalsplmintAddress: PublicKey

    Returns Promise<{
        signature: string;
        url: 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

    • amount: number
    • choice: "rock" | "paper" | "scissors"

    Returns Promise<string>

  • 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 8527902..920c02c 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
        | SolanaCreateGibworkTask
        | SolanaRockPaperScissorsTool
        | SolanaTipLinkTool)[]

+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
        | SolanaRockPaperScissorsTool
        | SolanaTipLinkTool)[]

diff --git a/docs/index.html b/docs/index.html index 103722a..b165d1c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -15,6 +15,10 @@
  • And more...
  • Anyone - whether an SF-based AI researcher or a crypto-native builder - can bring their AI agents trained with any model and seamlessly integrate with Solana.

    +

    Run on Repl.it

    +
    +

    Replit template created by Arpit Singh

    +
    • Token Operations

      @@ -149,6 +153,10 @@

    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.

    + + + +

    Star History Chart

    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 47a2904..67ac5bb 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 c67eddd..1aed17f 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 14a20c1..628c6c3 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 65a55ee..af9dd93 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 index 321f48a..a2cb5e1 100644 --- a/docs/interfaces/GibworkCreateTaskReponse.html +++ b/docs/interfaces/GibworkCreateTaskReponse.html @@ -1,4 +1,4 @@ -GibworkCreateTaskReponse | solana-agent-kit

    Interface GibworkCreateTaskReponse

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

    Properties

    signature? +GibworkCreateTaskReponse | solana-agent-kit

    Interface GibworkCreateTaskReponse

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

    Properties

    signature?: string
    status: "success" | "error"
    taskId?: string
    +

    Properties

    signature?: string
    status: "success" | "error"
    taskId?: string
    diff --git a/docs/interfaces/JupiterTokenData.html b/docs/interfaces/JupiterTokenData.html index 4528c80..d86a876 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 381c57b..bca23ab 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 c1d93d3..791d8ee 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 ab335a7..b1eefb8 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 3c4f081..0ed5c95 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 7d2c8ff..b01fb14 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/examples/agent-kit-langgraph/src/agents/readAgent.ts b/examples/agent-kit-langgraph/src/agents/readAgent.ts index 7875c54..957434f 100644 --- a/examples/agent-kit-langgraph/src/agents/readAgent.ts +++ b/examples/agent-kit-langgraph/src/agents/readAgent.ts @@ -1,7 +1,6 @@ import { createReactAgent } from "@langchain/langgraph/prebuilt"; import { gpt4o } from "../utils/model"; import { solanaAgentState } from "../utils/state"; -import { HumanMessage } from "@langchain/core/messages"; import { agentKit } from "../utils/solanaAgent"; import { SolanaBalanceTool, diff --git a/examples/persistance-agent/index.ts b/examples/persistance-agent/index.ts index 21badd0..9ea1931 100644 --- a/examples/persistance-agent/index.ts +++ b/examples/persistance-agent/index.ts @@ -8,27 +8,30 @@ import * as readline from "readline"; import { PostgresSaver } from "@langchain/langgraph-checkpoint-postgres"; dotenv.config(); -const checkpointer = PostgresSaver.fromConnString( - process.env.POSTGRES_DB_URL! -); +const checkpointer = PostgresSaver.fromConnString(process.env.POSTGRES_DB_URL!); function validateEnvironment(): void { - const missingVars: string[] = []; - const requiredVars = ["OPENAI_API_KEY", "RPC_URL", "SOLANA_PRIVATE_KEY", "POSTGRES_DB_URL"]; + const missingVars: string[] = []; + const requiredVars = [ + "OPENAI_API_KEY", + "RPC_URL", + "SOLANA_PRIVATE_KEY", + "POSTGRES_DB_URL", + ]; - 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); + 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(); @@ -36,37 +39,37 @@ validateEnvironment(); const WALLET_DATA_FILE = "wallet_data.txt"; async function initializeAgent() { - try { - const llm = new ChatOpenAI({ - modelName: "gpt-4o-mini", - temperature: 0.7, - }); + try { + const llm = new ChatOpenAI({ + modelName: "gpt-4o-mini", + temperature: 0.7, + }); - let walletDataStr: string | null = null; + let walletDataStr: string | null = null; - if (fs.existsSync(WALLET_DATA_FILE)) { - try { - walletDataStr = fs.readFileSync(WALLET_DATA_FILE, "utf8"); - } catch (error) { - console.error("Error reading wallet data:", error); - } - } + if (fs.existsSync(WALLET_DATA_FILE)) { + try { + walletDataStr = fs.readFileSync(WALLET_DATA_FILE, "utf8"); + } catch (error) { + console.error("Error reading wallet data:", error); + } + } - const solanaAgent = new SolanaAgentKit( - process.env.SOLANA_PRIVATE_KEY!, - process.env.RPC_URL, - process.env.OPENAI_API_KEY!, - ); + const solanaAgent = new SolanaAgentKit( + process.env.SOLANA_PRIVATE_KEY!, + process.env.RPC_URL, + process.env.OPENAI_API_KEY!, + ); - const tools = createSolanaTools(solanaAgent); - await checkpointer.setup(); - const config = { configurable: { thread_id: "Solana Agent Kit!" } }; + const tools = createSolanaTools(solanaAgent); + await checkpointer.setup(); + const config = { configurable: { thread_id: "Solana Agent Kit!" } }; - const agent = createReactAgent({ - llm, - tools, - checkpointSaver: checkpointer, - messageModifier: ` + const agent = createReactAgent({ + llm, + tools, + checkpointSaver: checkpointer, + messageModifier: ` 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 @@ -75,146 +78,146 @@ async function initializeAgent() { 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. `, - }); + }); - if (walletDataStr) { - fs.writeFileSync(WALLET_DATA_FILE, walletDataStr); - } - - return { agent, config }; - } catch (error) { - console.error("Failed to initialize agent:", error); - throw error; + if (walletDataStr) { + fs.writeFileSync(WALLET_DATA_FILE, walletDataStr); } + + return { agent, config }; + } catch (error) { + console.error("Failed to initialize agent:", error); + throw error; + } } async function runAutonomousMode(agent: any, config: any, interval = 10) { - console.log("Starting autonomous mode..."); + console.log("Starting autonomous mode..."); - 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."; + 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 stream = await agent.stream( - { messages: [new HumanMessage(thought)] }, - config, - ); + const stream = await agent.stream( + { messages: [new HumanMessage(thought)] }, + config, + ); - for await (const chunk of stream) { - if ("agent" in chunk) { - console.log(chunk.agent.messages[0].content); - } else if ("tools" in chunk) { - console.log(chunk.tools.messages[0].content); - } - console.log("-------------------"); - } - - await new Promise((resolve) => setTimeout(resolve, interval * 1000)); - } catch (error) { - if (error instanceof Error) { - console.error("Error:", error.message); - } - process.exit(1); + for await (const chunk of stream) { + if ("agent" in chunk) { + console.log(chunk.agent.messages[0].content); + } else if ("tools" in chunk) { + console.log(chunk.tools.messages[0].content); } + 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(agent: any, config: any) { - console.log("Starting chat mode... Type 'exit' to end."); + console.log("Starting chat mode... Type 'exit' to end."); - const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - }); + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }); - const question = (prompt: string): Promise => - new Promise((resolve) => rl.question(prompt, resolve)); + const question = (prompt: string): Promise => + new Promise((resolve) => rl.question(prompt, resolve)); - try { - while (true) { - const userInput = await question("\nPrompt: "); + try { + while (true) { + const userInput = await question("\nPrompt: "); - if (userInput.toLowerCase() === "exit") { - break; - } + if (userInput.toLowerCase() === "exit") { + break; + } - const stream = await agent.stream( - { messages: [new HumanMessage(userInput)] }, - config, - ); + const stream = await agent.stream( + { messages: [new HumanMessage(userInput)] }, + config, + ); - for await (const chunk of stream) { - if ("agent" in chunk) { - console.log(chunk.agent.messages[0].content); - } else if ("tools" in chunk) { - console.log(chunk.tools.messages[0].content); - } - console.log("-------------------"); - } + for await (const chunk of stream) { + if ("agent" in chunk) { + console.log(chunk.agent.messages[0].content); + } else if ("tools" in chunk) { + console.log(chunk.tools.messages[0].content); } - } catch (error) { - if (error instanceof Error) { - console.error("Error:", error.message); - } - process.exit(1); - } finally { - rl.close(); + 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 rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }); - const question = (prompt: string): Promise => - new Promise((resolve) => rl.question(prompt, resolve)); + 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"); + 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(); + const choice = (await question("\nChoose a mode (enter number or name): ")) + .toLowerCase() + .trim(); - rl.close(); + rl.close(); - if (choice === "1" || choice === "chat") { - return "chat"; - } else if (choice === "2" || choice === "auto") { - return "auto"; - } - console.log("Invalid choice. Please try again."); + 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 { agent, config } = await initializeAgent(); - const mode = await chooseMode(); + try { + console.log("Starting Agent..."); + const { agent, config } = await initializeAgent(); + const mode = await chooseMode(); - if (mode === "chat") { - await runChatMode(agent, config); - } else { - await runAutonomousMode(agent, config); - } - } catch (error) { - if (error instanceof Error) { - console.error("Error:", error.message); - } - process.exit(1); + if (mode === "chat") { + await runChatMode(agent, config); + } else { + await runAutonomousMode(agent, config); } + } 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); - }); + main().catch((error) => { + console.error("Fatal error:", error); + process.exit(1); + }); } diff --git a/src/tools/trade.ts b/src/tools/trade.ts index 3704308..70a3a45 100644 --- a/src/tools/trade.ts +++ b/src/tools/trade.ts @@ -1,7 +1,4 @@ -import { - VersionedTransaction, - PublicKey -} from "@solana/web3.js"; +import { VersionedTransaction, PublicKey } from "@solana/web3.js"; import { SolanaAgentKit } from "../index"; import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants"; import { getMint } from "@solana/spl-token"; @@ -24,24 +21,24 @@ export async function trade( try { // Check if input token is native SOL const isNativeSol = inputMint.equals(TOKENS.SOL); - + // For native SOL, we use LAMPORTS_PER_SOL, otherwise fetch mint info - const inputDecimals = isNativeSol - ? 9 // SOL always has 9 decimals + const inputDecimals = isNativeSol + ? 9 // SOL always has 9 decimals : (await getMint(agent.connection, inputMint)).decimals; // Calculate the correct amount based on actual decimals const scaledAmount = inputAmount * Math.pow(10, inputDecimals); - + const quoteResponse = await ( await fetch( `${JUP_API}/quote?` + - `inputMint=${isNativeSol ? TOKENS.SOL.toString() : inputMint.toString()}` + - `&outputMint=${outputMint.toString()}` + - `&amount=${scaledAmount}` + - `&slippageBps=${slippageBps}` + - `&onlyDirectRoutes=true` + - `&maxAccounts=20`, + `inputMint=${isNativeSol ? TOKENS.SOL.toString() : inputMint.toString()}` + + `&outputMint=${outputMint.toString()}` + + `&amount=${scaledAmount}` + + `&slippageBps=${slippageBps}` + + `&onlyDirectRoutes=true` + + `&maxAccounts=20`, ) ).json(); From 29a2ab976335ca348c4965ef6477a40570697443 Mon Sep 17 00:00:00 2001 From: aryan Date: Mon, 30 Dec 2024 05:13:33 +0530 Subject: [PATCH 06/10] fix: node requirement --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8ff852f..95e436d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"" }, "engines": { - "node": ">=23.1.0", + "node": ">=22.0.0", "pnpm": ">=8.0.0" }, "keywords": [], From 1dee9478025b3d52fa78c24884205936ddb791fc Mon Sep 17 00:00:00 2001 From: aryan Date: Mon, 30 Dec 2024 05:13:55 +0530 Subject: [PATCH 07/10] fix: pkg version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 95e436d..beda4a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "solana-agent-kit", - "version": "1.3.0", + "version": "1.3.1", "description": "connect any ai agents to solana protocols", "main": "dist/index.js", "types": "dist/index.d.ts", From 01a4efb0ce1878d2aa0cb6b11b4177c986d61351 Mon Sep 17 00:00:00 2001 From: ARYAN <48391385+thearyanag@users.noreply.github.com> Date: Mon, 30 Dec 2024 05:24:29 +0530 Subject: [PATCH 08/10] Create SECURITY.md --- SECURITY.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..b99af49 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,9 @@ +# Security Policy + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. From cd7dc35e7dcaf912ab54a25c73f2061e0f2db3e0 Mon Sep 17 00:00:00 2001 From: ARYAN <48391385+thearyanag@users.noreply.github.com> Date: Mon, 30 Dec 2024 05:25:39 +0530 Subject: [PATCH 09/10] Create SECURITY.md --- SECURITY.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index b99af49..0983319 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,8 +2,4 @@ ## Reporting a Vulnerability -Use this section to tell people how to report a vulnerability. - -Tell them where to go, how often they can expect to get an update on a -reported vulnerability, what to expect if the vulnerability is accepted or -declined, etc. +Report the bug to aryan@sendai.fun and dev@sendai.fun with full details, do not create an issue for it From 5a2a4c1a83497b7a870e74e3238eb7ad2c174591 Mon Sep 17 00:00:00 2001 From: aryan Date: Mon, 30 Dec 2024 06:32:44 +0530 Subject: [PATCH 10/10] feat: SECURITY.md --- SECURITY.md | 60 +++++++++++++++++++++++++++++++++++++++++- src/langchain/index.ts | 5 ++-- src/utils/toJSON.ts | 26 ------------------ 3 files changed, 61 insertions(+), 30 deletions(-) delete mode 100644 src/utils/toJSON.ts diff --git a/SECURITY.md b/SECURITY.md index 0983319..7025253 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,4 +2,62 @@ ## Reporting a Vulnerability -Report the bug to aryan@sendai.fun and dev@sendai.fun with full details, do not create an issue for it +We take the security of our software seriously. If you believe you have found a security vulnerability, please report it to us following these guidelines: + +### Reporting Process + +1. **DO NOT** create a public GitHub issue for the vulnerability +2. Email your findings to: + - Primary: aryan@sendai.fun + - Secondary: dev@sendai.fun + +### What to Include + +Please include the following information in your report: + +- A clear description of the vulnerability +- Steps to reproduce the issue +- Affected versions +- Any potential impacts +- Optional: Suggested fixes or mitigations + +### Response Timeline + +- We will acknowledge receipt of your vulnerability report within 48 hours +- We aim to send a more detailed response within 5 business days +- We will keep you informed of our progress throughout the process + +### Security Updates + +Security updates will be released as soon as possible after we have confirmed and fixed the vulnerability. Updates will be published through: + +- GitHub releases +- Security advisories +- Email notifications to affected parties (if applicable) + +## Supported Versions + +As an open-source project under the Apache 2.0 license, we focus our security updates on the latest stable release. While you're free to use any version as per the Apache 2.0 license terms, we strongly recommend using the most recent version for the best security posture. + +| Version | Security Updates | +| ------- | --------------- | +| Latest Release | ✅ Active | +| Previous Releases | ⚠️ Use at your own risk | + +Note: The Apache 2.0 license comes with NO WARRANTIES or CONDITIONS of any kind, either express or implied. Users are responsible for their own security assessment when using any version of this software. + +## Security Best Practices + +When using this software, please follow these security best practices: +- Keep your private keys secure and never share them +- Regularly update to the latest version +- Review transaction details before signing +- Use appropriate access controls in production environments + +## Bug Bounty Program + +Currently, we do not offer a bug bounty program. However, we greatly appreciate responsible disclosure of security vulnerabilities. + +## License + +This security policy is part of our project licensed under [Apache 2.0](LICENSE). diff --git a/src/langchain/index.ts b/src/langchain/index.ts index 21888bf..b2a8b77 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -9,7 +9,6 @@ import { import { create_image } from "../tools/create_image"; import { BN } from "@coral-xyz/anchor"; import { FEE_TIERS } from "../tools"; -import { toJSON } from "../utils/toJSON"; export class SolanaBalanceTool extends Tool { name = "solana_balance"; @@ -318,7 +317,7 @@ export class SolanaRegisterDomainTool extends Tool { protected async _call(input: string): Promise { try { - const parsedInput = toJSON(input); + const parsedInput = JSON.parse(input); this.validateInput(parsedInput); const tx = await this.solanaKit.registerDomain( @@ -1255,7 +1254,7 @@ export class SolanaRockPaperScissorsTool extends Tool { protected async _call(input: string): Promise { try { - const parsedInput = toJSON(input); + const parsedInput = JSON.parse(input); this.validateInput(parsedInput); const result = await this.solanaKit.rockPaperScissors( Number(parsedInput['"amount"']), diff --git a/src/utils/toJSON.ts b/src/utils/toJSON.ts deleted file mode 100644 index 2581f4d..0000000 --- a/src/utils/toJSON.ts +++ /dev/null @@ -1,26 +0,0 @@ -export const toJSON = (str: string): any => { - try { - // Remove curly braces and split by comma - const pairs = str.trim().slice(1, -1).split(","); - - // Convert to object with explicit type - const obj: Record = {}; - - pairs.forEach((pair) => { - const [key, value] = pair - .trim() - .split(":") - .map((s) => s.trim()); - - if (!key || value === undefined) { - throw new Error("Invalid key-value pair format"); - } - - obj[key] = isNaN(Number(value)) ? value : Number(value); - }); - - return JSON.parse(JSON.stringify(obj)); - } catch (error) { - throw new Error(`Failed to parse string to JSON: ${error}`); - } -};