From 84a9b697a0126e518057f4c819cf79cc0e1d6271 Mon Sep 17 00:00:00 2001 From: aryan Date: Sun, 8 Dec 2024 03:03:17 +0530 Subject: [PATCH] fix: prompts --- docs/assets/search.js | 2 +- docs/classes/SolanaAgentKit.html | 11 +-- docs/functions/createSolanaTools.html | 2 +- docs/interfaces/CollectionDeployment.html | 4 +- docs/interfaces/CollectionOptions.html | 4 +- docs/interfaces/Creator.html | 4 +- .../LuloAccountDetailsResponse.html | 4 +- .../interfaces/MintCollectionNFTResponse.html | 4 +- docs/interfaces/PumpFunTokenOptions.html | 6 +- docs/interfaces/PumpfunLaunchResponse.html | 4 +- docs/types/LuloDepositAssetMint.html | 2 +- src/langchain/index.ts | 90 ++++++++----------- src/tools/trade.ts | 8 +- 13 files changed, 65 insertions(+), 80 deletions(-) diff --git a/docs/assets/search.js b/docs/assets/search.js index 7948610..73c468a 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE7Wb32/bNhDH/xf6VUjMH7Jjv6XrAgzrtmJr92IEASPRrlBZUiWqWRDkfx8oWdbRPDmU1T4lsHl3Xx4/PEok/ULK/Kki680L+ZpkMVlTdhOQTO4VWZN/8lRm8nanMv17oklA6jIlaxKlsqpUdW1/ffVF71MSdN+SNSGvQec1pOzoNcqzSpd1pPPSx+XMbg/cB6SQpcq0q7QPTOdMwMiZinSSZ76B++ZT4j7JNFVe+Zsdm06P9yDjuFRVNSIuMBkZn81Fz02pvtWq0neyjpS+q7PYTwNqNkVHrIo0f/6Uf1V+A263nx75lzxNR/CGGE3RsFP6nUxlFimv6FbzKXH3Sab/vPvkFbRvOyWiLmVWbZVfOQGNpzG+Syqtyvf5XiZ+4+uYTOxz7DewXcsp0VJZZ9GXj/W+uKsz/wmFmo3UsQD1u1RSq7blpzxP+7KyrbNmylTXTpuz6xILF0fvvxhLsCYlmVblVkaquj58ddaVVYFPS++Ar9lb9bbTNBCmUGWkMi136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fYe/O7bfK8sSBJ+7pqZ3S7fzGRoyDbnI/0GGZQJ5AGEg+80t+d0InzQkdGAJQFYVff7tb1PHhFjUYBvgg4jcPDz852DY/Odi2PzkA0xHw4eeuvZ75aK5nFofrmSBtQB/z09cfI4KcgRko/MYT3JsAckD3WNhacr/R7C6/PBaWMg6Ucb/a0D4ESnPt+2tilQiwkPvNzf6yFlAElh/u9zjQHL1/b4/eQdLBAin8YDjcuwd8AjHUU8zxxwrADcgM9UxNd48OZAbAyP1gPFn2GNDB/HR0v24CMoCKES4ekFc3+Ezk56q7XQfkQD0egu4DUiSFSpNMkfXm/vX1f0Ws7S9QNwAA"; \ No newline at end of file +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/boDsDokq9T6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DNta+Th64gWflsIPOsZIMjAzwwsO8nOyhDHhgYR66f9gDZAAVI1w8Ip9dMJWEuerqy4AcqCdA0ENEcp2rRKeKrNYPb2//AMzmTvZLNgAA"; \ No newline at end of file diff --git a/docs/classes/SolanaAgentKit.html b/docs/classes/SolanaAgentKit.html index 552e3a6..3b6a544 100644 --- a/docs/classes/SolanaAgentKit.html +++ b/docs/classes/SolanaAgentKit.html @@ -1,8 +1,9 @@ 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

Methods

deployCollection @@ -14,7 +15,7 @@ Provides a unified interface for token operations, NFT management, and tradingrequestFaucetFunds trade transfer -

Constructors

Properties

connection: Connection

Solana RPC connection

-
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

    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

    • 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>

diff --git a/docs/functions/createSolanaTools.html b/docs/functions/createSolanaTools.html index f921005..0689a13 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)[]

+createSolanaTools | solana-agent-kit

Function createSolanaTools

  • Parameters

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

diff --git a/docs/interfaces/CollectionDeployment.html b/docs/interfaces/CollectionDeployment.html index f964980..56b0948 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 e6ff08c..69c5eab 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 a93a8c0..40ecce7 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 1278cfd..c112461 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 eb8841b..ecc3c1d 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 e74c17f..8c0e69e 100644 --- a/docs/interfaces/PumpFunTokenOptions.html +++ b/docs/interfaces/PumpFunTokenOptions.html @@ -1,9 +1,7 @@ -PumpFunTokenOptions | solana-agent-kit

Interface PumpFunTokenOptions

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

Properties

description? -imageUrl? -initialLiquiditySOL? +PumpFunTokenOptions | solana-agent-kit

Interface PumpFunTokenOptions

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

Properties

description?: string
imageUrl?: string
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 d6968bf..c5b14ca 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/types/LuloDepositAssetMint.html b/docs/types/LuloDepositAssetMint.html index d38defd..1015fda 100644 --- a/docs/types/LuloDepositAssetMint.html +++ b/docs/types/LuloDepositAssetMint.html @@ -1,2 +1,2 @@ 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/langchain/index.ts b/src/langchain/index.ts index e987552..da063c1 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -1,14 +1,18 @@ import { Tool } from "langchain/tools"; import { SolanaAgentKit } from "../index"; import { PublicKey } from "@solana/web3.js"; -import { PumpFunTokenOptions } from "../types"; import { toJSON } from "../utils/toJSON"; import { create_image } from "../tools/create_image"; export class SolanaBalanceTool extends Tool { name = "solana_balance"; - description = - "Get the balance of a Solana wallet or token account. Input can be a token address or empty for SOL 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: + tokenAddress: string, eg "So11111111111111111111111111111111111111112" (optional)`; constructor(private solanaKit: SolanaAgentKit) { super(); @@ -36,36 +40,32 @@ export class SolanaBalanceTool extends Tool { export class SolanaTransferTool extends Tool { name = "solana_transfer"; - description = - "Transfer tokens or SOL to another address. Input should be JSON string with: {to: string, amount: number, mint?: string}"; + 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)`; constructor(private solanaKit: SolanaAgentKit) { super(); } - private validateInput(input: any): void { - if (!input.to || typeof input.to !== "string") { - throw new Error("to address is required and must be a string"); - } - if (typeof input.amount !== "number" || input.amount <= 0) { - throw new Error("amount is required and must be a positive number"); - } - if (input.mint !== undefined && typeof input.mint !== "string") { - throw new Error("mint must be a string when provided"); - } - } - protected async _call(input: string): Promise { try { - const parsedInput = toJSON(input); - this.validateInput(parsedInput); + const parsedInput = JSON.parse(input); + console.log(parsedInput); const recipient = new PublicKey(parsedInput.to); const mintAddress = parsedInput.mint ? new PublicKey(parsedInput.mint) : undefined; - await this.solanaKit.transfer(recipient, parsedInput.amount, mintAddress); + const tx = await this.solanaKit.transfer( + recipient, + parsedInput.amount, + mintAddress + ); return JSON.stringify({ status: "success", @@ -73,6 +73,7 @@ export class SolanaTransferTool extends Tool { amount: parsedInput.amount, recipient: parsedInput.to, token: parsedInput.mint || "SOL", + transaction: tx, }); } catch (error: any) { return JSON.stringify({ @@ -267,46 +268,28 @@ export class SolanaMintNFTTool extends Tool { export class SolanaTradeTool extends Tool { name = "solana_trade"; - description = - "Swap tokens using Jupiter Exchange. Input should be JSON with: {outputMint: string, inputAmount: number, inputMint?: string, slippageBps?: number}"; + description = `This tool can be used to swap tokens to another token ( It uses Jupiter Exchange ). + + Inputs ( input is a JSON string ): + outputMint: string, eg "So11111111111111111111111111111111111111112" or "SENDdRQtYMWaQrBroBrJ2Q53fgVuq95CV9UPGEvpCxa" (required) + inputAmount: number, eg 1 or 0.01 (required) + inputMint?: string, eg "So11111111111111111111111111111111111111112" (optional) + slippageBps?: number, eg 100 (optional)`; constructor(private solanaKit: SolanaAgentKit) { super(); } - private validateInput(input: any): void { - if (!input.outputMint || typeof input.outputMint !== "string") { - throw new Error("outputMint is required and must be a string"); - } - if (typeof input.inputAmount !== "number" || input.inputAmount <= 0) { - throw new Error("inputAmount is required and must be a positive number"); - } - if (input.inputMint !== undefined && typeof input.inputMint !== "string") { - throw new Error("inputMint must be a string when provided"); - } - if ( - input.slippageBps !== undefined && - (typeof input.slippageBps !== "number" || - input.slippageBps < 0 || - input.slippageBps > 10000) - ) { - throw new Error( - "slippageBps must be a number between 0 and 10000 when provided" - ); - } - } - protected async _call(input: string): Promise { try { - const parsedInput = toJSON(input); - this.validateInput(parsedInput); + const parsedInput = JSON.parse(input); const tx = await this.solanaKit.trade( new PublicKey(parsedInput.outputMint), parsedInput.inputAmount, parsedInput.inputMint ? new PublicKey(parsedInput.inputMint) - : undefined, + : new PublicKey("So11111111111111111111111111111111111111112"), parsedInput.slippageBps ); @@ -319,6 +302,7 @@ export class SolanaTradeTool extends Tool { outputToken: parsedInput.outputMint, }); } catch (error: any) { + console.log(error); return JSON.stringify({ status: "error", message: error.message, @@ -357,8 +341,12 @@ export class SolanaRequestFundsTool extends Tool { export class SolanaRegisterDomainTool extends Tool { name = "solana_register_domain"; - description = - "Register a .sol domain name. Input should be JSON with: {name: string, spaceKB?: number}"; + description = `Register a .sol domain name for your wallet. + + Inputs: + name: string, eg "pumpfun.sol" (required) + spaceKB: number, eg 1 (optional, default is 1) + `; constructor(private solanaKit: SolanaAgentKit) { super(); @@ -405,7 +393,7 @@ export class SolanaRegisterDomainTool extends Tool { export class SolanaGetWalletAddressTool extends Tool { name = "solana_get_wallet_address"; - description = "Get the wallet address of the agent"; + description = `Get the wallet address of the agent`; constructor(private solanaKit: SolanaAgentKit) { super(); @@ -418,8 +406,6 @@ export class SolanaGetWalletAddressTool extends Tool { export class SolanaPumpfunTokenLaunchTool extends Tool { name = "solana_launch_pumpfun_token"; - // description = - // "Launch a new token on Pump.fun via Solana Agent Kit. Requires a JSON input with tokenName, tokenTicker, description, imageUrl, and optional fields for twitter, telegram, website, and initialLiquiditySOL."; description = `This tool can be used to launch a token on Pump.fun, do not use this tool for any other purpose, or for creating SPL tokens. diff --git a/src/tools/trade.ts b/src/tools/trade.ts index 75dab8d..d31055d 100644 --- a/src/tools/trade.ts +++ b/src/tools/trade.ts @@ -1,4 +1,4 @@ -import { VersionedTransaction, PublicKey } from "@solana/web3.js"; +import { VersionedTransaction, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js"; import { SolanaAgentKit } from "../index"; import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants"; @@ -20,12 +20,13 @@ export async function trade( ): Promise { try { // Get quote for the swap + console.log(inputMint.toString(), outputMint.toString(), inputAmount, slippageBps); const quoteResponse = await ( await fetch( `${JUP_API}/quote?` + `inputMint=${inputMint.toString()}` + `&outputMint=${outputMint.toString()}` + - `&amount=${inputAmount}` + + `&amount=${inputAmount * LAMPORTS_PER_SOL}` + `&slippageBps=${slippageBps}` + `&onlyDirectRoutes=true` + `&maxAccounts=20`, @@ -48,11 +49,10 @@ export async function trade( }), }) ).json(); - // Deserialize transaction const swapTransactionBuf = Buffer.from(swapTransaction, "base64"); - const transaction = VersionedTransaction.deserialize(swapTransactionBuf); + const transaction = VersionedTransaction.deserialize(swapTransactionBuf); // Sign and send transaction transaction.sign([agent.wallet]); const signature = await agent.connection.sendTransaction(transaction);