From ed689f5efdee2b9f172d1f78d8e595e478d79e8a Mon Sep 17 00:00:00 2001 From: Arihant Bansal <17180950+arihantbansal@users.noreply.github.com> Date: Sun, 22 Dec 2024 01:20:29 +0530 Subject: [PATCH 01/31] fixes and renames --- README.md | 4 +- guides/add_your_own_tool.md | 20 +- package.json | 8 +- src/agent/index.ts | 11 +- src/index.ts | 8 +- src/langchain/index.ts | 197 +++++++++--------- src/tools/create_image.ts | 6 +- .../create_orca_single_sided_whirlpool.ts | 140 ++++++++----- src/tools/deploy_collection.ts | 33 ++- src/tools/deploy_token.ts | 26 ++- src/tools/fetch_price.ts | 21 +- src/tools/get_balance.ts | 6 +- src/tools/get_primary_domain.ts | 14 +- src/tools/get_tps.ts | 2 +- src/tools/index.ts | 6 +- src/tools/launch_pumpfun_token.ts | 6 +- src/tools/lend.ts | 13 +- src/tools/mint_nft.ts | 30 +-- src/tools/openbook_create_market.ts | 29 +-- src/tools/raydium_create_ammV4.ts | 59 ++++-- src/tools/raydium_create_clmm.ts | 61 +++--- src/tools/raydium_create_cpmm.ts | 58 +++--- src/tools/register_domain.ts | 6 +- src/tools/request_faucet_funds.ts | 6 +- src/tools/resolve_sol_domain.ts | 8 +- src/tools/send_compressed_airdrop.ts | 48 ++--- src/tools/stake_with_jup.ts | 6 +- src/tools/trade.ts | 12 +- src/tools/transfer.ts | 47 ++--- src/utils/send_tx.ts | 15 +- test/index.ts | 44 ++-- 31 files changed, 510 insertions(+), 440 deletions(-) diff --git a/README.md b/README.md index a4a0093..6e2df64 100644 --- a/README.md +++ b/README.md @@ -78,10 +78,10 @@ npm install solana-agent-kit ## Quick Start ```typescript -import { SolanaAgentKit, createSolanaTools } from "solana-agent-kit"; +import { SolanaAgent, createSolanaTools } from "solana-agent-kit"; // Initialize with private key and optional RPC URL -const agent = new SolanaAgentKit( +const agent = new SolanaAgent( "your-wallet-private-key-as-base58", "https://api.mainnet-beta.solana.com", "your-openai-api-key" diff --git a/guides/add_your_own_tool.md b/guides/add_your_own_tool.md index 63d1172..71bfb7c 100644 --- a/guides/add_your_own_tool.md +++ b/guides/add_your_own_tool.md @@ -21,19 +21,19 @@ Create a new TypeScript file in the `src/tools/` directory for your tool (e.g., ```typescript:src/tools/custom_tool.ts import { Tool } from "langchain/tools"; -import { SolanaAgentKit } from "../agent"; +import { SolanaAgent } from "../agent"; export class CustomTool extends Tool { name = "custom_tool"; description = "Description of what the custom tool does."; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } protected async _call(input: string): Promise { try { - const result = await this.solanaKit.customFunction(input); + const result = await this.solanaAgent.customFunction(input); return JSON.stringify({ status: "success", message: "Custom tool executed successfully", @@ -53,7 +53,7 @@ export class CustomTool extends Tool { ### 3. Add Supporting Functions to SolanaAgentKit ```typescript:src/agent/index.ts -export class SolanaAgentKit { +export class SolanaAgent { // ... existing code ... async customFunction(input: string): Promise { @@ -87,9 +87,9 @@ export function createSolanaTools(agent: SolanaAgentKit) { ### 6. Usage Example ```typescript -import { SolanaAgentKit, createSolanaTools } from "solana-agent-kit"; +import { SolanaAgent, createSolanaTools } from "solana-agent-kit"; -const agent = new SolanaAgentKit( +const agent = new SolanaAgent( "your-wallet-private-key-as-base58", "https://api.mainnet-beta.solana.com", "your-openai-api-key" @@ -118,19 +118,19 @@ Here's a complete example of implementing a tool to fetch token prices: ```typescript:src/tools/fetch_token_price.ts import { Tool } from "langchain/tools"; -import { SolanaAgentKit } from "../agent"; +import { SolanaAgent } from "../agent"; export class FetchTokenPriceTool extends Tool { name = "fetch_token_price"; description = "Fetches the current price of a specified token."; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } protected async _call(tokenSymbol: string): Promise { try { - const price = await this.solanaKit.getTokenPrice(tokenSymbol); + const price = await this.solanaAgent.getTokenPrice(tokenSymbol); return JSON.stringify({ status: "success", message: `Price fetched successfully for ${tokenSymbol}.`, @@ -176,4 +176,4 @@ If you encounter any issues while implementing your custom tool: - Contact the maintainer - Check existing tools for implementation examples ---- \ No newline at end of file +--- diff --git a/package.json b/package.json index 53165fb..ebf8984 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,9 @@ "pnpm": ">=8.0.0" }, "keywords": [], - "author": "", + "author": "sendaifun", "license": "ISC", "dependencies": { - "@raydium-io/raydium-sdk-v2": "0.1.95-alpha", "@bonfida/spl-name-service": "^3.0.7", "@coral-xyz/anchor": "0.29", "@langchain/core": "^0.3.18", @@ -34,11 +33,12 @@ "@metaplex-foundation/umi-web3js-adapters": "^0.9.2", "@orca-so/common-sdk": "0.6.4", "@orca-so/whirlpools-sdk": "^0.13.12", + "@raydium-io/raydium-sdk-v2": "0.1.95-alpha", "@solana/spl-token": "^0.4.9", "@solana/web3.js": "^1.95.4", + "bn.js": "^5.2.1", "bs58": "^6.0.0", "decimal.js": "^10.4.3", - "bn.js": "^5.2.1", "dotenv": "^16.4.5", "form-data": "^4.0.1", "langchain": "^0.3.6", @@ -51,4 +51,4 @@ "ts-node": "^10.9.2", "typescript": "^5.7.2" } -} \ No newline at end of file +} diff --git a/src/agent/index.ts b/src/agent/index.ts index 90e47ef..f40e18d 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -26,6 +26,7 @@ import { sendCompressedAirdrop, createOrcaSingleSidedWhirlpool, FEE_TIERS, + fetchPrice, } from "../tools"; import { CollectionDeployment, @@ -39,14 +40,14 @@ import { BN } from "@coral-xyz/anchor"; /** * Main class for interacting with Solana blockchain - * Provides a unified interface for token operations, NFT management, and trading + * Provides a unified interface for token operations, NFT management, trading and more * - * @class SolanaAgentKit + * @class SolanaAgent * @property {Connection} connection - Solana RPC connection * @property {Keypair} wallet - Wallet keypair for signing transactions * @property {PublicKey} wallet_address - Public key of the wallet */ -export class SolanaAgentKit { +export class SolanaAgent { public connection: Connection; public wallet: Keypair; public wallet_address: PublicKey; @@ -145,6 +146,10 @@ export class SolanaAgentKit { return getTokenDataByTicker(ticker); } + async fetchTokenPrice(mint: string) { + return fetchPrice(new PublicKey(mint)); + } + async launchPumpFunToken( tokenName: string, tokenTicker: string, diff --git a/src/index.ts b/src/index.ts index a1fd258..8c267a1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ -import { SolanaAgentKit } from './agent'; // Move the SolanaAgentKit class to src/agent.ts -import { createSolanaTools } from './langchain'; +import { SolanaAgent } from "./agent"; +import { createSolanaTools } from "./langchain"; -export { SolanaAgentKit, createSolanaTools }; +export { SolanaAgent, createSolanaTools }; // Optional: Export types that users might need -export * from './types'; \ No newline at end of file +export * from "./types"; diff --git a/src/langchain/index.ts b/src/langchain/index.ts index 930b0bf..11a0ff1 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -1,9 +1,8 @@ import { PublicKey } from "@solana/web3.js"; import Decimal from "decimal.js"; import { Tool } from "langchain/tools"; -import { SolanaAgentKit } from "../index"; +import { SolanaAgent } from "../index"; import { create_image } from "../tools/create_image"; -import { fetchPrice } from "../tools/fetch_price"; import { BN } from "@coral-xyz/anchor"; import { FEE_TIERS } from "../tools"; import { toJSON } from "../utils/toJSON"; @@ -18,14 +17,14 @@ export class SolanaBalanceTool extends Tool { Inputs: tokenAddress: string, eg "So11111111111111111111111111111111111111112" (optional)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } protected async _call(input: string): Promise { try { const tokenAddress = input ? new PublicKey(input) : undefined; - const balance = await this.solanaKit.getBalance(tokenAddress); + const balance = await this.solanaAgent.getBalance(tokenAddress); return JSON.stringify({ status: "success", @@ -51,7 +50,7 @@ export class SolanaTransferTool extends Tool { amount: number, eg 1 (required) mint?: string, eg "So11111111111111111111111111111111111111112" or "SENDdRQtYMWaQrBroBrJ2Q53fgVuq95CV9UPGEvpCxa" (optional)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -64,10 +63,10 @@ export class SolanaTransferTool extends Tool { ? new PublicKey(parsedInput.mint) : undefined; - const tx = await this.solanaKit.transfer( + const tx = await this.solanaAgent.transfer( recipient, parsedInput.amount, - mintAddress + mintAddress, ); return JSON.stringify({ @@ -94,12 +93,12 @@ export class SolanaDeployTokenTool extends Tool { Inputs (input is a JSON string): name: string, eg "My Token" (required) - uri: string, eg "https://example.com/token.json" (required) + uri: string, eg "https://example.com/token.json" (required) symbol: string, eg "MTK" (required) decimals?: number, eg 9 (optional, defaults to 9) initialSupply?: number, eg 1000000 (optional)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -107,12 +106,12 @@ export class SolanaDeployTokenTool extends Tool { try { const parsedInput = JSON.parse(input); - const result = await this.solanaKit.deployToken( + const result = await this.solanaAgent.deployToken( parsedInput.name, parsedInput.uri, parsedInput.symbol, parsedInput.decimals, - parsedInput.initialSupply + parsedInput.initialSupply, ); return JSON.stringify({ @@ -140,7 +139,7 @@ export class SolanaDeployCollectionTool extends Tool { uri: string, eg "https://example.com/collection.json" (required) royaltyBasisPoints?: number, eg 500 for 5% (optional)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -148,7 +147,7 @@ export class SolanaDeployCollectionTool extends Tool { try { const parsedInput = JSON.parse(input); - const result = await this.solanaKit.deployCollection(parsedInput); + const result = await this.solanaAgent.deployCollection(parsedInput); return JSON.stringify({ status: "success", @@ -174,9 +173,9 @@ export class SolanaMintNFTTool extends Tool { collectionMint: string, eg "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w" (required) - The address of the collection to mint into name: string, eg "My NFT" (required) uri: string, eg "https://example.com/nft.json" (required) - recipient?: string, eg "9aUn5swQzUTRanaaTwmszxiv89cvFwUCjEBv1vZCoT1u" (optional) - The wallet to receive the NFT, defaults to agent's wallet which is ${this.solanaKit.wallet_address.toString()}`; + recipient?: string, eg "9aUn5swQzUTRanaaTwmszxiv89cvFwUCjEBv1vZCoT1u" (optional) - The wallet to receive the NFT, defaults to agent's wallet which is ${this.solanaAgent.wallet_address.toString()}`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -184,7 +183,7 @@ export class SolanaMintNFTTool extends Tool { try { const parsedInput = JSON.parse(input); - const result = await this.solanaKit.mintNFT( + const result = await this.solanaAgent.mintNFT( new PublicKey(parsedInput.collectionMint), { name: parsedInput.name, @@ -192,7 +191,7 @@ export class SolanaMintNFTTool extends Tool { }, parsedInput.recipient ? new PublicKey(parsedInput.recipient) - : this.solanaKit.wallet_address + : this.solanaAgent.wallet_address, ); return JSON.stringify({ @@ -226,7 +225,7 @@ export class SolanaTradeTool extends Tool { inputMint?: string, eg "So11111111111111111111111111111111111111112" (optional) slippageBps?: number, eg 100 (optional)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -234,13 +233,13 @@ export class SolanaTradeTool extends Tool { try { const parsedInput = JSON.parse(input); - const tx = await this.solanaKit.trade( + const tx = await this.solanaAgent.trade( new PublicKey(parsedInput.outputMint), parsedInput.inputAmount, parsedInput.inputMint ? new PublicKey(parsedInput.inputMint) : new PublicKey("So11111111111111111111111111111111111111112"), - parsedInput.slippageBps + parsedInput.slippageBps, ); return JSON.stringify({ @@ -265,18 +264,18 @@ export class SolanaRequestFundsTool extends Tool { name = "solana_request_funds"; description = "Request SOL from Solana faucet (devnet/testnet only)"; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } protected async _call(_input: string): Promise { try { - await this.solanaKit.requestFaucetFunds(); + await this.solanaAgent.requestFaucetFunds(); return JSON.stringify({ status: "success", message: "Successfully requested faucet funds", - network: this.solanaKit.connection.rpcEndpoint.split("/")[2], + network: this.solanaAgent.connection.rpcEndpoint.split("/")[2], }); } catch (error: any) { return JSON.stringify({ @@ -297,7 +296,7 @@ export class SolanaRegisterDomainTool extends Tool { spaceKB: number, eg 1 (optional, default is 1) `; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -318,9 +317,9 @@ export class SolanaRegisterDomainTool extends Tool { const parsedInput = toJSON(input); this.validateInput(parsedInput); - const tx = await this.solanaKit.registerDomain( + const tx = await this.solanaAgent.registerDomain( parsedInput.name, - parsedInput.spaceKB || 1 + parsedInput.spaceKB || 1, ); return JSON.stringify({ @@ -348,14 +347,14 @@ export class SolanaResolveDomainTool extends Tool { domain: string, eg "pumpfun.sol" or "pumpfun"(required) `; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } protected async _call(input: string): Promise { try { const domain = input.trim(); - const publicKey = await this.solanaKit.resolveSolDomain(domain); + const publicKey = await this.solanaAgent.resolveSolDomain(domain); return JSON.stringify({ status: "success", @@ -380,14 +379,14 @@ export class SolanaGetDomainTool extends Tool { account: string, eg "4Be9CvxqHW6BYiRAxW9Q3xu1ycTMWaL5z8NX4HR3ha7t" (required) `; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } protected async _call(input: string): Promise { try { const account = new PublicKey(input.trim()); - const domain = await this.solanaKit.getPrimaryDomain(account); + const domain = await this.solanaAgent.getPrimaryDomain(account); return JSON.stringify({ status: "success", @@ -408,12 +407,12 @@ export class SolanaGetWalletAddressTool extends Tool { name = "solana_get_wallet_address"; description = `Get the wallet address of the agent`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } async _call(_input: string): Promise { - return this.solanaKit.wallet_address.toString(); + return this.solanaAgent.wallet_address.toString(); } } @@ -431,7 +430,7 @@ export class SolanaPumpfunTokenLaunchTool extends Tool { description: string, eg "PumpFun Token is a token on the Solana blockchain", imageUrl: string, eg "https://i.imgur.com/UFm07Np_d.png`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -465,7 +464,7 @@ export class SolanaPumpfunTokenLaunchTool extends Tool { this.validateInput(parsedInput); // Launch token with validated input - await this.solanaKit.launchPumpFunToken( + await this.solanaAgent.launchPumpFunToken( parsedInput.tokenName, parsedInput.tokenTicker, parsedInput.description, @@ -475,7 +474,7 @@ export class SolanaPumpfunTokenLaunchTool extends Tool { telegram: parsedInput.telegram, website: parsedInput.website, initialLiquiditySOL: parsedInput.initialLiquiditySOL, - } + }, ); return JSON.stringify({ @@ -499,7 +498,7 @@ export class SolanaCreateImageTool extends Tool { description = "Create an image using OpenAI's DALL-E. Input should be a string prompt for the image."; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -512,7 +511,7 @@ export class SolanaCreateImageTool extends Tool { protected async _call(input: string): Promise { try { this.validateInput(input); - const result = await create_image(this.solanaKit, input.trim()); + const result = await create_image(this.solanaAgent, input.trim()); return JSON.stringify({ status: "success", @@ -536,7 +535,7 @@ export class SolanaLendAssetTool extends Tool { Inputs (input is a json string): amount: number, eg 1, 0.01 (required)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -544,7 +543,7 @@ export class SolanaLendAssetTool extends Tool { try { let amount = JSON.parse(input).amount || input; - const tx = await this.solanaKit.lendAssets(amount); + const tx = await this.solanaAgent.lendAssets(amount); return JSON.stringify({ status: "success", @@ -566,13 +565,13 @@ export class SolanaTPSCalculatorTool extends Tool { name = "solana_get_tps"; description = "Get the current TPS of the Solana network"; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } async _call(_input: string): Promise { try { - const tps = await this.solanaKit.getTPS(); + const tps = await this.solanaAgent.getTPS(); return `Solana (mainnet-beta) current transactions per second: ${tps}`; } catch (error: any) { return `Error fetching TPS: ${error.message}`; @@ -587,7 +586,7 @@ export class SolanaStakeTool extends Tool { Inputs ( input is a JSON string ): amount: number, eg 1 or 0.01 (required)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -595,7 +594,7 @@ export class SolanaStakeTool extends Tool { try { const parsedInput = JSON.parse(input) || Number(input); - const tx = await this.solanaKit.stake(parsedInput.amount); + const tx = await this.solanaAgent.stake(parsedInput.amount); return JSON.stringify({ status: "success", @@ -619,17 +618,17 @@ export class SolanaStakeTool extends Tool { export class SolanaFetchPriceTool extends Tool { name = "solana_fetch_price"; description = `Fetch the price of a given token in USDC. - + Inputs: - tokenId: string, the mint address of the token, e.g., "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } async _call(input: string): Promise { try { - const price = await fetchPrice(this.solanaKit, input.trim()); + const price = await this.solanaAgent.fetchTokenPrice(input.trim()); return JSON.stringify({ status: "success", tokenId: input.trim(), @@ -652,7 +651,7 @@ export class SolanaTokenDataTool extends Tool { Inputs: mintAddress is required. mintAddress: string, eg "So11111111111111111111111111111111111111112" (required)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -660,7 +659,8 @@ export class SolanaTokenDataTool extends Tool { try { const parsedInput = input.trim(); - const tokenData = await this.solanaKit.getTokenDataByAddress(parsedInput); + const tokenData = + await this.solanaAgent.getTokenDataByAddress(parsedInput); return JSON.stringify({ status: "success", @@ -683,14 +683,14 @@ export class SolanaTokenDataByTickerTool extends Tool { Inputs: ticker is required. ticker: string, eg "USDC" (required)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } protected async _call(input: string): Promise { try { const ticker = input.trim(); - const tokenData = await this.solanaKit.getTokenDataByTicker(ticker); + const tokenData = await this.solanaAgent.getTokenDataByTicker(ticker); return JSON.stringify({ status: "success", tokenData: tokenData, @@ -708,7 +708,7 @@ export class SolanaTokenDataByTickerTool extends Tool { export class SolanaCompressedAirdropTool extends Tool { name = "solana_compressed_airdrop"; description = `Airdrop SPL tokens with ZK Compression (also called as airdropping tokens) - + Inputs (input is a JSON string): mintAddress: string, the mint address of the token, e.g., "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN" (required) amount: number, the amount of tokens to airdrop per recipient, e.g., 42 (required) @@ -717,7 +717,7 @@ export class SolanaCompressedAirdropTool extends Tool { priorityFeeInLamports: number, the priority fee in lamports. Default is 30_000. (optional) shouldLog: boolean, whether to log progress to stdout. Default is false. (optional)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -725,13 +725,13 @@ export class SolanaCompressedAirdropTool extends Tool { try { const parsedInput = JSON.parse(input); - const txs = await this.solanaKit.sendCompressedAirdrop( + const txs = await this.solanaAgent.sendCompressedAirdrop( parsedInput.mintAddress, parsedInput.amount, parsedInput.decimals, parsedInput.recipients, parsedInput.priorityFeeInLamports || 30_000, - parsedInput.shouldLog || false + parsedInput.shouldLog || false, ); return JSON.stringify({ @@ -761,7 +761,7 @@ export class SolanaCreateSingleSidedWhirlpoolTool extends Tool { - maxPrice: number, eg: 5.0 (required, maximum price at which liquidity is added) - feeTier: number, eg: 0.30 (required, fee tier for the pool)`; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } @@ -776,10 +776,12 @@ export class SolanaCreateSingleSidedWhirlpoolTool extends Tool { const feeTier = inputFormat.feeTier; if (!feeTier || !(feeTier in FEE_TIERS)) { - throw new Error(`Invalid feeTier. Available options: ${Object.keys(FEE_TIERS).join(", ")}`); + throw new Error( + `Invalid feeTier. Available options: ${Object.keys(FEE_TIERS).join(", ")}`, + ); } - const txId = await this.solanaKit.createOrcaSingleSidedWhirlpool( + const txId = await this.solanaAgent.createOrcaSingleSidedWhirlpool( depositTokenAmount, depositTokenMint, otherTokenMint, @@ -803,7 +805,6 @@ export class SolanaCreateSingleSidedWhirlpoolTool extends Tool { } } - export class SolanaRaydiumCreateAmmV4 extends Tool { name = "raydium_create_ammV4"; description = `Raydium's Legacy AMM that requiers an OpenBook marketID @@ -815,15 +816,15 @@ export class SolanaRaydiumCreateAmmV4 extends Tool { startTime: number(seconds), eg: now number or zero (required) `; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input) + let inputFormat = JSON.parse(input); - const tx = await this.solanaKit.raydiumCreateAmmV4( + const tx = await this.solanaAgent.raydiumCreateAmmV4( new PublicKey(inputFormat.marketId), new BN(inputFormat.baseAmount), new BN(inputFormat.quoteAmount), @@ -857,15 +858,15 @@ export class SolanaRaydiumCreateClmm extends Tool { startTime: number(seconds), eg: now number or zero (required) `; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input) + let inputFormat = JSON.parse(input); - const tx = await this.solanaKit.raydiumCreateClmm( + const tx = await this.solanaAgent.raydiumCreateClmm( new PublicKey(inputFormat.mint1), new PublicKey(inputFormat.mint2), @@ -892,7 +893,7 @@ export class SolanaRaydiumCreateClmm extends Tool { export class SolanaRaydiumCreateCpmm extends Tool { name = "raydium_create_cpmm"; - description = `Raydium's newest CPMM, does not require marketID, supports Token 2022 standard + description = `Raydium's newest CPMM, does not require marketID, supports Token 2022 standard Inputs (input is a json string): mint1: string (required) @@ -903,15 +904,15 @@ export class SolanaRaydiumCreateCpmm extends Tool { startTime: number(seconds), eg: now number or zero (required) `; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input) + let inputFormat = JSON.parse(input); - const tx = await this.solanaKit.raydiumCreateCpmm( + const tx = await this.solanaAgent.raydiumCreateCpmm( new PublicKey(inputFormat.mint1), new PublicKey(inputFormat.mint2), @@ -940,7 +941,7 @@ export class SolanaRaydiumCreateCpmm extends Tool { export class SolanaOpenbookCreateMarket extends Tool { name = "solana_openbook_create_market"; - description = `Openbook marketId, required for ammv4 + description = `Openbook marketId, required for ammv4 Inputs (input is a json string): baseMint: string (required) @@ -949,15 +950,15 @@ export class SolanaOpenbookCreateMarket extends Tool { tickSize: number (required) `; - constructor(private solanaKit: SolanaAgentKit) { + constructor(private solanaAgent: SolanaAgent) { super(); } async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input) + let inputFormat = JSON.parse(input); - const tx = await this.solanaKit.openbookCreateMarket( + const tx = await this.solanaAgent.openbookCreateMarket( new PublicKey(inputFormat.baseMint), new PublicKey(inputFormat.quoteMint), @@ -980,32 +981,32 @@ export class SolanaOpenbookCreateMarket extends Tool { } } -export function createSolanaTools(solanaKit: SolanaAgentKit) { +export function createSolanaTools(solanaAgent: SolanaAgent) { return [ - new SolanaBalanceTool(solanaKit), - new SolanaTransferTool(solanaKit), - new SolanaDeployTokenTool(solanaKit), - new SolanaDeployCollectionTool(solanaKit), - new SolanaMintNFTTool(solanaKit), - new SolanaTradeTool(solanaKit), - new SolanaRequestFundsTool(solanaKit), - new SolanaRegisterDomainTool(solanaKit), - new SolanaGetWalletAddressTool(solanaKit), - new SolanaPumpfunTokenLaunchTool(solanaKit), - new SolanaCreateImageTool(solanaKit), - new SolanaLendAssetTool(solanaKit), - new SolanaTPSCalculatorTool(solanaKit), - new SolanaStakeTool(solanaKit), - new SolanaFetchPriceTool(solanaKit), - new SolanaResolveDomainTool(solanaKit), - new SolanaGetDomainTool(solanaKit), - new SolanaTokenDataTool(solanaKit), - new SolanaTokenDataByTickerTool(solanaKit), - new SolanaCompressedAirdropTool(solanaKit), - new SolanaRaydiumCreateAmmV4(solanaKit), - new SolanaRaydiumCreateClmm(solanaKit), - new SolanaRaydiumCreateCpmm(solanaKit), - new SolanaOpenbookCreateMarket(solanaKit), - new SolanaCreateSingleSidedWhirlpoolTool(solanaKit), + new SolanaBalanceTool(solanaAgent), + new SolanaTransferTool(solanaAgent), + new SolanaDeployTokenTool(solanaAgent), + new SolanaDeployCollectionTool(solanaAgent), + new SolanaMintNFTTool(solanaAgent), + new SolanaTradeTool(solanaAgent), + new SolanaRequestFundsTool(solanaAgent), + new SolanaRegisterDomainTool(solanaAgent), + new SolanaGetWalletAddressTool(solanaAgent), + new SolanaPumpfunTokenLaunchTool(solanaAgent), + new SolanaCreateImageTool(solanaAgent), + new SolanaLendAssetTool(solanaAgent), + new SolanaTPSCalculatorTool(solanaAgent), + new SolanaStakeTool(solanaAgent), + new SolanaFetchPriceTool(solanaAgent), + new SolanaResolveDomainTool(solanaAgent), + new SolanaGetDomainTool(solanaAgent), + new SolanaTokenDataTool(solanaAgent), + new SolanaTokenDataByTickerTool(solanaAgent), + new SolanaCompressedAirdropTool(solanaAgent), + new SolanaRaydiumCreateAmmV4(solanaAgent), + new SolanaRaydiumCreateClmm(solanaAgent), + new SolanaRaydiumCreateCpmm(solanaAgent), + new SolanaOpenbookCreateMarket(solanaAgent), + new SolanaCreateSingleSidedWhirlpoolTool(solanaAgent), ]; } diff --git a/src/tools/create_image.ts b/src/tools/create_image.ts index 7fbb2cf..c5660ae 100644 --- a/src/tools/create_image.ts +++ b/src/tools/create_image.ts @@ -1,16 +1,16 @@ -import { SolanaAgentKit } from "../index"; +import { SolanaAgent } from "../index"; import OpenAI from "openai"; /** * Generate an image using OpenAI's DALL-E - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param prompt Text description of the image to generate * @param size Image size ('256x256', '512x512', or '1024x1024') (default: '1024x1024') * @param n Number of images to generate (default: 1) * @returns Object containing the generated image URLs */ export async function create_image( - agent: SolanaAgentKit, + agent: SolanaAgent, prompt: string, size: "256x256" | "512x512" | "1024x1024" = "1024x1024", n: number = 1, diff --git a/src/tools/create_orca_single_sided_whirlpool.ts b/src/tools/create_orca_single_sided_whirlpool.ts index aefc93c..095d8fc 100644 --- a/src/tools/create_orca_single_sided_whirlpool.ts +++ b/src/tools/create_orca_single_sided_whirlpool.ts @@ -1,5 +1,5 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; -import { SolanaAgentKit } from "../agent"; +import { SolanaAgent } from "../index"; import { BN, Wallet } from "@coral-xyz/anchor"; import { Decimal } from "decimal.js"; import { @@ -40,7 +40,7 @@ import { sendTx } from "../utils/send_tx"; * @remarks * Fee tiers determine the percentage of fees collected on swaps, while tick spacing affects * the granularity of price ranges for liquidity positions. - * + * * For more details, refer to: * - [Whirlpool Fees](https://orca-so.github.io/whirlpools/Architecture%20Overview/Whirlpool%20Fees) * - [Whirlpool Parameters](https://orca-so.github.io/whirlpools/Architecture%20Overview/Whirlpool%20Parameters) @@ -54,17 +54,17 @@ export const FEE_TIERS = { 0.04: 4, 0.05: 8, 0.16: 16, - 0.30: 64, + 0.3: 64, 0.65: 96, - 1.00: 128, - 2.00: 256, + 1.0: 128, + 2.0: 256, } as const; /** * # Creates a single-sided Whirlpool. * * This function initializes a new Whirlpool (liquidity pool) on Orca and seeds it with liquidity from a single token. - * + * * ## Example Usage: * You created a new token called SHARK, and you want to set the initial price to 0.001 USDC. * You set `depositTokenMint` to SHARK's mint address and `otherTokenMint` to USDC's mint address. @@ -72,7 +72,7 @@ export const FEE_TIERS = { * 1. Increase the amount of tokens you deposit * 2. Set the initial price very low * 3. Set the maximum price closer to the initial price - * + * * ### Note for experts: * The Wrhirlpool program initializes the Whirlpool with the in a specific order. This might not be * the order you expect, so the function checks the order and adjusts the inverts the prices. This means that @@ -86,13 +86,13 @@ export const FEE_TIERS = { * @param initialPrice - The initial price of the deposit token in terms of the other token. * @param maxPrice - The maximum price at which liquidity is added. * @param feeTier - The fee tier percentage for the pool, determining tick spacing and fee collection rates. - * + * * @returns A promise that resolves to a transaction ID (`string`) of the transaction creating the pool. - * + * * @throws Will throw an error if: * - Mint accounts for the tokens cannot be fetched. * - Prices are out of bounds. - * + * * @remarks * This function is designed for single-sided deposits where users only contribute one type of token, * and the function manages mint order and necessary calculations. @@ -103,7 +103,7 @@ export const FEE_TIERS = { * import { PublicKey } from "@solana/web3.js"; * import { BN } from "@coral-xyz/anchor"; * import Decimal from "decimal.js"; - * + * * const agent = new SolanaAgentKit(wallet, connection); * const depositAmount = new BN(1_000_000_000_000); // 1 million SHARK if SHARK has 6 decimals * const depositTokenMint = new PublicKey("DEPOSTI_TOKEN_ADDRESS"); @@ -111,7 +111,7 @@ export const FEE_TIERS = { * const initialPrice = new Decimal(0.001); * const maxPrice = new Decimal(5.0); * const feeTier = 0.30; - * + * * const txId = await createOrcaSingleSidedWhirlpool( * agent, * depositAmount, @@ -125,7 +125,7 @@ export const FEE_TIERS = { * ``` */ export async function createOrcaSingleSidedWhirlpool( - agent: SolanaAgentKit, + agent: SolanaAgent, depositTokenAmount: BN, depositTokenMint: PublicKey, otherTokenMint: PublicKey, @@ -134,13 +134,19 @@ export async function createOrcaSingleSidedWhirlpool( feeTier: keyof typeof FEE_TIERS, ): Promise { const wallet = new Wallet(agent.wallet); - const ctx = WhirlpoolContext.from(agent.connection, wallet, ORCA_WHIRLPOOL_PROGRAM_ID); + const ctx = WhirlpoolContext.from( + agent.connection, + wallet, + ORCA_WHIRLPOOL_PROGRAM_ID, + ); const fetcher = ctx.fetcher; - const correctTokenOrder = PoolUtil.orderMints(otherTokenMint, depositTokenMint).map( - (addr) => addr.toString(), - ); - const isCorrectMintOrder = correctTokenOrder[0] === depositTokenMint.toString(); + const correctTokenOrder = PoolUtil.orderMints( + otherTokenMint, + depositTokenMint, + ).map((addr) => addr.toString()); + const isCorrectMintOrder = + correctTokenOrder[0] === depositTokenMint.toString(); let mintA, mintB; if (isCorrectMintOrder) { [mintA, mintB] = [depositTokenMint, otherTokenMint]; @@ -151,10 +157,18 @@ export async function createOrcaSingleSidedWhirlpool( } const mintAAccount = await fetcher.getMintInfo(mintA); const mintBAccount = await fetcher.getMintInfo(mintB); - if (mintAAccount === null || mintBAccount === null) throw Error('Mint account not found'); + if (mintAAccount === null || mintBAccount === null) + throw Error("Mint account not found"); const tickSpacing = FEE_TIERS[feeTier]; - const tickIndex = PriceMath.priceToTickIndex(initialPrice, mintAAccount.decimals, mintBAccount.decimals); - const initialTick = TickUtil.getInitializableTickIndex(tickIndex, tickSpacing); + const tickIndex = PriceMath.priceToTickIndex( + initialPrice, + mintAAccount.decimals, + mintBAccount.decimals, + ); + const initialTick = TickUtil.getInitializableTickIndex( + tickIndex, + tickSpacing, + ); const tokenExtensionCtx: TokenExtensionContextForPool = { ...NO_TOKEN_EXTENSION_CONTEXT, @@ -196,17 +210,17 @@ export async function createOrcaSingleSidedWhirlpool( tokenVaultBKeypair, feeTierKey, tickSpacing: tickSpacing, - funder: wallet.publicKey + funder: wallet.publicKey, }; const initPoolIx = !TokenExtensionUtil.isV2IxRequiredPool(tokenExtensionCtx) ? WhirlpoolIx.initializePoolIx(ctx.program, baseParamsPool) : WhirlpoolIx.initializePoolV2Ix(ctx.program, { - ...baseParamsPool, - tokenProgramA: tokenExtensionCtx.tokenMintWithProgramA.tokenProgram, - tokenProgramB: tokenExtensionCtx.tokenMintWithProgramB.tokenProgram, - tokenBadgeA, - tokenBadgeB, - }); + ...baseParamsPool, + tokenProgramA: tokenExtensionCtx.tokenMintWithProgramA.tokenProgram, + tokenProgramB: tokenExtensionCtx.tokenMintWithProgramB.tokenProgram, + tokenBadgeA, + tokenBadgeB, + }); const initialTickArrayStartTick = TickUtil.getStartTickIndex( initialTick, tickSpacing, @@ -235,14 +249,32 @@ export async function createOrcaSingleSidedWhirlpool( let tickLowerIndex, tickUpperIndex; if (isCorrectMintOrder) { tickLowerIndex = initialTick; - tickUpperIndex = PriceMath.priceToTickIndex(maxPrice, mintAAccount.decimals, mintBAccount.decimals); + tickUpperIndex = PriceMath.priceToTickIndex( + maxPrice, + mintAAccount.decimals, + mintBAccount.decimals, + ); } else { - tickLowerIndex = PriceMath.priceToTickIndex(maxPrice, mintAAccount.decimals, mintBAccount.decimals); + tickLowerIndex = PriceMath.priceToTickIndex( + maxPrice, + mintAAccount.decimals, + mintBAccount.decimals, + ); tickUpperIndex = initialTick; } - const tickLowerInitializableIndex = TickUtil.getInitializableTickIndex(tickLowerIndex, tickSpacing); - const tickUpperInitializableIndex = TickUtil.getInitializableTickIndex(tickUpperIndex, tickSpacing); - if (!TickUtil.checkTickInBounds(tickLowerInitializableIndex) || !TickUtil.checkTickInBounds(tickUpperInitializableIndex)) throw Error('Prices out of bounds'); + const tickLowerInitializableIndex = TickUtil.getInitializableTickIndex( + tickLowerIndex, + tickSpacing, + ); + const tickUpperInitializableIndex = TickUtil.getInitializableTickIndex( + tickUpperIndex, + tickSpacing, + ); + if ( + !TickUtil.checkTickInBounds(tickLowerInitializableIndex) || + !TickUtil.checkTickInBounds(tickUpperInitializableIndex) + ) + throw Error("Prices out of bounds"); const increasLiquidityQuoteParam: IncreaseLiquidityQuoteParam = { inputTokenAmount: new BN(depositTokenAmount), inputTokenMint: depositTokenMint, @@ -253,11 +285,11 @@ export async function createOrcaSingleSidedWhirlpool( tickLowerIndex: tickLowerInitializableIndex, tickUpperIndex: tickUpperInitializableIndex, tokenExtensionCtx: tokenExtensionCtx, - slippageTolerance: Percentage.fromFraction(0, 100) - } + slippageTolerance: Percentage.fromFraction(0, 100), + }; const liquidityInput = increaseLiquidityQuoteByInputTokenWithParams( - increasLiquidityQuoteParam - ) + increasLiquidityQuoteParam, + ); const { liquidityAmount: liquidity, tokenMaxA, tokenMaxB } = liquidityInput; const positionMintKeypair = Keypair.generate(); @@ -285,7 +317,7 @@ export async function createOrcaSingleSidedWhirlpool( ...params, positionMint: positionMintPubkey, withTokenMetadataExtension: true, - }) + }); txBuilder.addInstruction(positionIx); txBuilder.addSigner(positionMintKeypair); @@ -365,35 +397,33 @@ export async function createOrcaSingleSidedWhirlpool( tickArrayUpper: tickArrayUpperPda.publicKey, }; - const liquidityIx = !TokenExtensionUtil.isV2IxRequiredPool( - tokenExtensionCtx, - ) + const liquidityIx = !TokenExtensionUtil.isV2IxRequiredPool(tokenExtensionCtx) ? increaseLiquidityIx(ctx.program, baseParamsLiquidity) : increaseLiquidityV2Ix(ctx.program, { - ...baseParamsLiquidity, - tokenMintA: mintA, - tokenMintB: mintB, - tokenProgramA: tokenExtensionCtx.tokenMintWithProgramA.tokenProgram, - tokenProgramB: tokenExtensionCtx.tokenMintWithProgramB.tokenProgram, - }); + ...baseParamsLiquidity, + tokenMintA: mintA, + tokenMintB: mintB, + tokenProgramA: tokenExtensionCtx.tokenMintWithProgramA.tokenProgram, + tokenProgramB: tokenExtensionCtx.tokenMintWithProgramB.tokenProgram, + }); txBuilder.addInstruction(liquidityIx); const txPayload = await txBuilder.build({ - maxSupportedTransactionVersion: "legacy" + maxSupportedTransactionVersion: "legacy", }); if (txPayload.transaction instanceof Transaction) { try { - const txId = await sendTx( - agent, - txPayload.transaction, - [positionMintKeypair, tokenVaultAKeypair, tokenVaultBKeypair], - ); + const txId = await sendTx(agent, txPayload.transaction, [ + positionMintKeypair, + tokenVaultAKeypair, + tokenVaultBKeypair, + ]); return txId; } catch (error) { - throw new Error(`Failed to create pool: ${JSON.stringify(error)}`); + throw new Error(`Failed to create pool: ${JSON.stringify(error)}`); } } else { - throw new Error('Failed to create pool: Transaction not created'); + throw new Error("Failed to create pool: Transaction not created"); } } diff --git a/src/tools/deploy_collection.ts b/src/tools/deploy_collection.ts index 4528b92..086d736 100644 --- a/src/tools/deploy_collection.ts +++ b/src/tools/deploy_collection.ts @@ -1,18 +1,29 @@ -import { SolanaAgentKit } from "../index"; -import { generateSigner, keypairIdentity, publicKey } from "@metaplex-foundation/umi"; -import { createCollection, mplCore, ruleSet } from "@metaplex-foundation/mpl-core"; +import { SolanaAgent } from "../index"; +import { + generateSigner, + keypairIdentity, + publicKey, +} from "@metaplex-foundation/umi"; +import { + createCollection, + mplCore, + ruleSet, +} from "@metaplex-foundation/mpl-core"; import { CollectionOptions, CollectionDeployment } from "../types"; -import { fromWeb3JsKeypair, toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters"; +import { + fromWeb3JsKeypair, + toWeb3JsPublicKey, +} from "@metaplex-foundation/umi-web3js-adapters"; import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; /** * Deploy a new NFT collection - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param options Collection options including name, URI, royalties, and creators * @returns Object containing collection address and metadata */ export async function deploy_collection( - agent: SolanaAgentKit, + agent: SolanaAgent, options: CollectionOptions, ): Promise { try { @@ -28,11 +39,11 @@ export async function deploy_collection( address: publicKey(creator.address), percentage: creator.percentage, })) || [ - { - address: publicKey(agent.wallet_address.toString()), - percentage: 100, - }, - ]; + { + address: publicKey(agent.wallet_address.toString()), + percentage: 100, + }, + ]; // Create collection const tx = await createCollection(umi, { diff --git a/src/tools/deploy_token.ts b/src/tools/deploy_token.ts index a36d5de..5940141 100644 --- a/src/tools/deploy_token.ts +++ b/src/tools/deploy_token.ts @@ -1,13 +1,21 @@ -import { SolanaAgentKit } from "../index"; +import { SolanaAgent } from "../index"; import { PublicKey } from "@solana/web3.js"; import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; import { generateSigner, keypairIdentity } from "@metaplex-foundation/umi"; -import { createFungible, mintV1, TokenStandard } from "@metaplex-foundation/mpl-token-metadata"; -import { fromWeb3JsKeypair, fromWeb3JsPublicKey, toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters"; +import { + createFungible, + mintV1, + TokenStandard, +} from "@metaplex-foundation/mpl-token-metadata"; +import { + fromWeb3JsKeypair, + fromWeb3JsPublicKey, + toWeb3JsPublicKey, +} from "@metaplex-foundation/umi-web3js-adapters"; /** * Deploy a new SPL token - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param name Name of the token * @param uri URI for the token metadata * @param symbol Symbol of the token @@ -16,16 +24,16 @@ import { fromWeb3JsKeypair, fromWeb3JsPublicKey, toWeb3JsPublicKey } from "@meta * @returns Object containing token mint address and initial account (if supply was minted) */ export async function deploy_token( - agent: SolanaAgentKit, + agent: SolanaAgent, name: string, uri: string, symbol: string, decimals: number = 9, - initialSupply?: number + initialSupply?: number, ): Promise<{ mint: PublicKey }> { try { // Create UMI instance from agent - const umi = createUmi(agent.connection.rpcEndpoint) + const umi = createUmi(agent.connection.rpcEndpoint); umi.use(keypairIdentity(fromWeb3JsKeypair(agent.wallet))); // Create new token mint @@ -51,11 +59,11 @@ export async function deploy_token( tokenStandard: TokenStandard.Fungible, tokenOwner: fromWeb3JsPublicKey(agent.wallet_address), amount: initialSupply, - }) + }), ); } - builder.sendAndConfirm(umi, { confirm: { commitment: 'finalized' } }); + builder.sendAndConfirm(umi, { confirm: { commitment: "finalized" } }); return { mint: toWeb3JsPublicKey(mint.publicKey), diff --git a/src/tools/fetch_price.ts b/src/tools/fetch_price.ts index 764e8e6..cca1925 100644 --- a/src/tools/fetch_price.ts +++ b/src/tools/fetch_price.ts @@ -1,20 +1,13 @@ -import { SolanaAgentKit } from "../index"; -import { Tool } from "langchain/tools"; +import { PublicKey } from "@solana/web3.js"; /** - * Fetch the price of a given token in USDC using Jupiter API - * @param agent SolanaAgentKit instance + * Fetch the price of a given token quoted in USDC using Jupiter API * @param tokenId The token mint address - * @returns The price of the token in USDC + * @returns The price of the token quoted in USDC */ -export async function fetchPrice( - agent: SolanaAgentKit, - tokenId: string -): Promise { +export async function fetchPrice(tokenId: PublicKey): Promise { try { - const response = await fetch( - `https://api.jup.ag/price/v2?ids=${tokenId}` - ); + const response = await fetch(`https://api.jup.ag/price/v2?ids=${tokenId}`); if (!response.ok) { throw new Error(`Failed to fetch price: ${response.statusText}`); @@ -22,7 +15,7 @@ export async function fetchPrice( const data = await response.json(); - const price = data.data[tokenId]?.price; + const price = data.data[tokenId.toBase58()]?.price; if (!price) { throw new Error("Price data not available for the given token."); @@ -32,4 +25,4 @@ export async function fetchPrice( } catch (error: any) { throw new Error(`Price fetch failed: ${error.message}`); } -} \ No newline at end of file +} diff --git a/src/tools/get_balance.ts b/src/tools/get_balance.ts index 36cdfef..fb70699 100644 --- a/src/tools/get_balance.ts +++ b/src/tools/get_balance.ts @@ -1,14 +1,14 @@ import { LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js"; -import { SolanaAgentKit } from "../index"; +import { SolanaAgent } from "../index"; /** * Get the balance of SOL or an SPL token for the agent's wallet - * @param agent - SolanaAgentKit instance + * @param agent - SolanaAgent instance * @param token_address - Optional SPL token mint address. If not provided, returns SOL balance * @returns Promise resolving to the balance as a number (in UI units) or null if account doesn't exist */ export async function get_balance( - agent: SolanaAgentKit, + agent: SolanaAgent, token_address?: PublicKey, ): Promise { if (!token_address) diff --git a/src/tools/get_primary_domain.ts b/src/tools/get_primary_domain.ts index 775af4b..01f19b6 100644 --- a/src/tools/get_primary_domain.ts +++ b/src/tools/get_primary_domain.ts @@ -1,6 +1,6 @@ import { getPrimaryDomain as _getPrimaryDomain } from "@bonfida/spl-name-service"; import { PublicKey } from "@solana/web3.js"; -import { SolanaAgentKit } from "../index"; +import { SolanaAgent } from "../index"; /** * Retrieves the primary .sol domain associated with a given Solana public key. @@ -9,29 +9,29 @@ import { SolanaAgentKit } from "../index"; * a specified Solana public key. If the primary domain is stale or an error occurs during * the resolution, it throws an error. * - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param account The Solana public key for which to retrieve the primary domain * @returns A promise that resolves to the primary .sol domain as a string * @throws Error if the domain is stale or if the domain resolution fails */ export async function getPrimaryDomain( - agent: SolanaAgentKit, - account: PublicKey + agent: SolanaAgent, + account: PublicKey, ): Promise { try { const { reverse, stale } = await _getPrimaryDomain( agent.connection, - account + account, ); if (stale) { throw new Error( - `Primary domain is stale for account: ${account.toBase58()}` + `Primary domain is stale for account: ${account.toBase58()}`, ); } return reverse; } catch (error) { throw new Error( - `Failed to get primary domain for account: ${account.toBase58()}` + `Failed to get primary domain for account: ${account.toBase58()}`, ); } } diff --git a/src/tools/get_tps.ts b/src/tools/get_tps.ts index 7314ce3..38eb356 100644 --- a/src/tools/get_tps.ts +++ b/src/tools/get_tps.ts @@ -1,4 +1,4 @@ -import { SolanaAgentKit } from "../index"; +import { SolanaAgent } from "../index"; export async function getTPS(agent: SolanaAgentKit): Promise { const perfSamples = await agent.connection.getRecentPerformanceSamples(); diff --git a/src/tools/index.ts b/src/tools/index.ts index 303cde2..32a3c53 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -15,8 +15,8 @@ export * from "./get_token_data"; export * from "./stake_with_jup"; export * from "./fetch_price"; export * from "./send_compressed_airdrop"; - -export * from "./create_orca_single_sided_whirlpool";export * from "./raydium_create_ammV4"; +export * from "./create_orca_single_sided_whirlpool"; +export * from "./raydium_create_ammV4"; export * from "./raydium_create_clmm"; export * from "./raydium_create_cpmm"; -export * from "./openbook_create_market"; \ No newline at end of file +export * from "./openbook_create_market"; diff --git a/src/tools/launch_pumpfun_token.ts b/src/tools/launch_pumpfun_token.ts index 0c3e6f5..ce997b4 100644 --- a/src/tools/launch_pumpfun_token.ts +++ b/src/tools/launch_pumpfun_token.ts @@ -55,7 +55,7 @@ async function uploadMetadata( } async function createTokenTransaction( - agent: SolanaAgentKit, + agent: SolanaAgent, mintKeypair: Keypair, metadataResponse: any, options?: PumpFunTokenOptions, @@ -140,7 +140,7 @@ async function signAndSendTransaction( /** * Launch a token on Pump.fun - * @param agent - SolanaAgentKit instance + * @param agent - SolanaAgent instance * @param tokenName - Name of the token * @param tokenTicker - Ticker of the token * @param description - Description of the token @@ -149,7 +149,7 @@ async function signAndSendTransaction( * @returns - Signature of the transaction, mint address and metadata URI, if successful, else error */ export async function launchPumpFunToken( - agent: SolanaAgentKit, + agent: SolanaAgent, tokenName: string, tokenTicker: string, description: string, diff --git a/src/tools/lend.ts b/src/tools/lend.ts index 7889343..f036aa7 100644 --- a/src/tools/lend.ts +++ b/src/tools/lend.ts @@ -1,16 +1,15 @@ import { VersionedTransaction } from "@solana/web3.js"; -import { LuloAccountDetailsResponse } from "../types"; -import { SolanaAgentKit } from "../agent"; +import { SolanaAgent } from "../index"; /** * Lend tokens for yields using Lulo - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param amount Amount of USDC to lend * @returns Transaction signature */ export async function lendAsset( - agent: SolanaAgentKit, - amount: number + agent: SolanaAgent, + amount: number, ): Promise { try { const response = await fetch( @@ -23,14 +22,14 @@ export async function lendAsset( body: JSON.stringify({ account: agent.wallet.publicKey.toBase58(), }), - } + }, ); const data = await response.json(); // Deserialize the transaction const luloTxn = VersionedTransaction.deserialize( - Buffer.from(data.transaction, "base64") + Buffer.from(data.transaction, "base64"), ); // Get a recent blockhash and set it diff --git a/src/tools/mint_nft.ts b/src/tools/mint_nft.ts index 09bfe32..97e5fd2 100644 --- a/src/tools/mint_nft.ts +++ b/src/tools/mint_nft.ts @@ -1,22 +1,26 @@ -import { SolanaAgentKit } from "../index"; -import { generateSigner, keypairIdentity } from '@metaplex-foundation/umi'; -import { create, mplCore } from '@metaplex-foundation/mpl-core'; -import { fetchCollection } from '@metaplex-foundation/mpl-core'; +import { SolanaAgent } from "../index"; +import { generateSigner, keypairIdentity } from "@metaplex-foundation/umi"; +import { create, mplCore } from "@metaplex-foundation/mpl-core"; +import { fetchCollection } from "@metaplex-foundation/mpl-core"; import { PublicKey } from "@solana/web3.js"; -import { fromWeb3JsKeypair, fromWeb3JsPublicKey, toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters"; -import { createUmi } from '@metaplex-foundation/umi-bundle-defaults'; -import { MintCollectionNFTResponse } from '../types'; +import { + fromWeb3JsKeypair, + fromWeb3JsPublicKey, + toWeb3JsPublicKey, +} from "@metaplex-foundation/umi-web3js-adapters"; +import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; +import { MintCollectionNFTResponse } from "../types"; /** * Mint a new NFT as part of an existing collection - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param collectionMint Address of the collection's master NFT * @param metadata NFT metadata object * @param recipient Optional recipient address (defaults to wallet address) * @returns Object containing NFT mint address and token account */ export async function mintCollectionNFT( - agent: SolanaAgentKit, + agent: SolanaAgent, collectionMint: PublicKey, metadata: { name: string; @@ -27,7 +31,7 @@ export async function mintCollectionNFT( share: number; }>; }, - recipient?: PublicKey + recipient?: PublicKey, ): Promise { try { // Create UMI instance from agent @@ -49,15 +53,15 @@ export async function mintCollectionNFT( collection: collection, name: metadata.name, uri: metadata.uri, - owner: fromWeb3JsPublicKey(recipient ?? agent.wallet.publicKey) + owner: fromWeb3JsPublicKey(recipient ?? agent.wallet.publicKey), }).sendAndConfirm(umi); return { mint: toWeb3JsPublicKey(assetSigner.publicKey), // Note: Token account is now handled automatically by the create instruction - metadata: toWeb3JsPublicKey(assetSigner.publicKey) + metadata: toWeb3JsPublicKey(assetSigner.publicKey), }; } catch (error: any) { throw new Error(`Collection NFT minting failed: ${error.message}`); } -} \ No newline at end of file +} diff --git a/src/tools/openbook_create_market.ts b/src/tools/openbook_create_market.ts index 4e9c592..29dd829 100644 --- a/src/tools/openbook_create_market.ts +++ b/src/tools/openbook_create_market.ts @@ -1,33 +1,34 @@ -import { OPEN_BOOK_PROGRAM, Raydium, TxVersion } from "@raydium-io/raydium-sdk-v2"; +import { + OPEN_BOOK_PROGRAM, + Raydium, + TxVersion, +} from "@raydium-io/raydium-sdk-v2"; import { MintLayout, TOKEN_PROGRAM_ID } from "@solana/spl-token"; import { PublicKey } from "@solana/web3.js"; -import { SolanaAgentKit } from "../agent"; +import { SolanaAgent } from "../index"; export async function openbookCreateMarket( - agent: SolanaAgentKit, - + agent: SolanaAgent, baseMint: PublicKey, quoteMint: PublicKey, - lotSize: number = 1, tickSize: number = 0.01, ): Promise { - const raydium = await Raydium.load({ owner: agent.wallet, connection: agent.connection, - }) + }); - const baseMintInfo = await agent.connection.getAccountInfo(baseMint) - const quoteMintInfo = await agent.connection.getAccountInfo(quoteMint) + const baseMintInfo = await agent.connection.getAccountInfo(baseMint); + const quoteMintInfo = await agent.connection.getAccountInfo(quoteMint); if ( baseMintInfo?.owner.toString() !== TOKEN_PROGRAM_ID.toBase58() || quoteMintInfo?.owner.toString() !== TOKEN_PROGRAM_ID.toBase58() ) { throw new Error( - 'openbook market only support TOKEN_PROGRAM_ID mints, if you want to create pool with token-2022, please create raydium cpmm pool instead' - ) + "openbook market only support TOKEN_PROGRAM_ID mints, if you want to create pool with token-2022, please create raydium cpmm pool instead", + ); } const { execute } = await raydium.marketV2.create({ @@ -44,9 +45,9 @@ export async function openbookCreateMarket( dexProgramId: OPEN_BOOK_PROGRAM, txVersion: TxVersion.V0, - }) + }); - const { txIds } = await execute({ sequentially: true, }) + const { txIds } = await execute({ sequentially: true }); - return txIds + return txIds; } diff --git a/src/tools/raydium_create_ammV4.ts b/src/tools/raydium_create_ammV4.ts index 53d78b3..cc06431 100644 --- a/src/tools/raydium_create_ammV4.ts +++ b/src/tools/raydium_create_ammV4.ts @@ -1,42 +1,59 @@ -import { AMM_V4, FEE_DESTINATION_ID, MARKET_STATE_LAYOUT_V3, OPEN_BOOK_PROGRAM, Raydium, TxVersion } from "@raydium-io/raydium-sdk-v2"; +import { + AMM_V4, + FEE_DESTINATION_ID, + MARKET_STATE_LAYOUT_V3, + OPEN_BOOK_PROGRAM, + Raydium, + TxVersion, +} from "@raydium-io/raydium-sdk-v2"; import { MintLayout, TOKEN_PROGRAM_ID } from "@solana/spl-token"; import { PublicKey } from "@solana/web3.js"; -import BN from 'bn.js'; -import { SolanaAgentKit } from "../agent"; +import BN from "bn.js"; +import { SolanaAgent } from "../index"; export async function raydiumCreateAmmV4( - agent: SolanaAgentKit, - + agent: SolanaAgent, marketId: PublicKey, - baseAmount: BN, quoteAmount: BN, - startTime: BN, ): Promise { - const raydium = await Raydium.load({ owner: agent.wallet, connection: agent.connection, - }) + }); - const marketBufferInfo = await agent.connection.getAccountInfo(new PublicKey(marketId)) - const { baseMint, quoteMint } = MARKET_STATE_LAYOUT_V3.decode(marketBufferInfo!.data) + const marketBufferInfo = await agent.connection.getAccountInfo( + new PublicKey(marketId), + ); + const { baseMint, quoteMint } = MARKET_STATE_LAYOUT_V3.decode( + marketBufferInfo!.data, + ); - const baseMintInfo = await agent.connection.getAccountInfo(baseMint) - const quoteMintInfo = await agent.connection.getAccountInfo(quoteMint) + const baseMintInfo = await agent.connection.getAccountInfo(baseMint); + const quoteMintInfo = await agent.connection.getAccountInfo(quoteMint); if ( baseMintInfo?.owner.toString() !== TOKEN_PROGRAM_ID.toBase58() || quoteMintInfo?.owner.toString() !== TOKEN_PROGRAM_ID.toBase58() ) { throw new Error( - 'amm pools with openbook market only support TOKEN_PROGRAM_ID mints, if you want to create pool with token-2022, please create cpmm pool instead' - ) + "amm pools with openbook market only support TOKEN_PROGRAM_ID mints, if you want to create pool with token-2022, please create cpmm pool instead", + ); } - if (baseAmount.mul(quoteAmount).lte(new BN(1).mul(new BN(10 ** MintLayout.decode(baseMintInfo.data).decimals)).pow(new BN(2)))) { - throw new Error('initial liquidity too low, try adding more baseAmount/quoteAmount') + if ( + baseAmount + .mul(quoteAmount) + .lte( + new BN(1) + .mul(new BN(10 ** MintLayout.decode(baseMintInfo.data).decimals)) + .pow(new BN(2)), + ) + ) { + throw new Error( + "initial liquidity too low, try adding more baseAmount/quoteAmount", + ); } const { execute } = await raydium.liquidity.createPoolV4({ @@ -63,9 +80,9 @@ export async function raydiumCreateAmmV4( associatedOnly: false, txVersion: TxVersion.V0, feeDestinationId: FEE_DESTINATION_ID, - }) + }); - const { txId } = await execute({ sendAndConfirm: true }) + const { txId } = await execute({ sendAndConfirm: true }); - return txId -} \ No newline at end of file + return txId; +} diff --git a/src/tools/raydium_create_clmm.ts b/src/tools/raydium_create_clmm.ts index 8dbd5e6..2ce62f1 100644 --- a/src/tools/raydium_create_clmm.ts +++ b/src/tools/raydium_create_clmm.ts @@ -1,55 +1,58 @@ -import { CLMM_PROGRAM_ID, Raydium, TxVersion } from '@raydium-io/raydium-sdk-v2' -import { MintLayout } from '@solana/spl-token' -import { PublicKey } from '@solana/web3.js' -import BN from 'bn.js' -import Decimal from 'decimal.js' -import { SolanaAgentKit } from '../agent' +import { + CLMM_PROGRAM_ID, + Raydium, + TxVersion, +} from "@raydium-io/raydium-sdk-v2"; +import { MintLayout } from "@solana/spl-token"; +import { PublicKey } from "@solana/web3.js"; +import BN from "bn.js"; +import Decimal from "decimal.js"; +import { SolanaAgent } from "../index"; export async function raydiumCreateClmm( - agent: SolanaAgentKit, - + agent: SolanaAgent, mint1: PublicKey, mint2: PublicKey, - configId: PublicKey, - initialPrice: Decimal, startTime: BN, ): Promise { - const raydium = await Raydium.load({ owner: agent.wallet, connection: agent.connection, - }) + }); - const [mintInfo1, mintInfo2] = await agent.connection.getMultipleAccountsInfo([mint1, mint2]) - if (mintInfo1 === null || mintInfo2 === null) throw Error('fetch mint info error') + const [mintInfo1, mintInfo2] = await agent.connection.getMultipleAccountsInfo( + [mint1, mint2], + ); + if (mintInfo1 === null || mintInfo2 === null) + throw Error("fetch mint info error"); - const mintDecodeInfo1 = MintLayout.decode(mintInfo1.data) - const mintDecodeInfo2 = MintLayout.decode(mintInfo2.data) + const mintDecodeInfo1 = MintLayout.decode(mintInfo1.data); + const mintDecodeInfo2 = MintLayout.decode(mintInfo2.data); const mintFormatInfo1 = { chainId: 101, address: mint1.toString(), programId: mintInfo1.owner.toString(), - logoURI: '', - symbol: '', - name: '', + logoURI: "", + symbol: "", + name: "", decimals: mintDecodeInfo1.decimals, tags: [], - extensions: {} - } + extensions: {}, + }; const mintFormatInfo2 = { chainId: 101, address: mint2.toString(), programId: mintInfo2.owner.toString(), - logoURI: '', - symbol: '', - name: '', + logoURI: "", + symbol: "", + name: "", decimals: mintDecodeInfo2.decimals, tags: [], - extensions: {} - } + extensions: {}, + }; const { execute } = await raydium.clmm.createPool({ programId: CLMM_PROGRAM_ID, @@ -65,9 +68,9 @@ export async function raydiumCreateClmm( // units: 600000, // microLamports: 46591500, // }, - }) + }); - const { txId } = await execute({ sendAndConfirm: true }) + const { txId } = await execute({ sendAndConfirm: true }); - return txId + return txId; } diff --git a/src/tools/raydium_create_cpmm.ts b/src/tools/raydium_create_cpmm.ts index 4a520e2..6e129c6 100644 --- a/src/tools/raydium_create_cpmm.ts +++ b/src/tools/raydium_create_cpmm.ts @@ -2,60 +2,58 @@ import { CREATE_CPMM_POOL_FEE_ACC, CREATE_CPMM_POOL_PROGRAM, Raydium, - TxVersion -} from '@raydium-io/raydium-sdk-v2' -import { MintLayout } from '@solana/spl-token' -import { PublicKey } from '@solana/web3.js' -import BN from 'bn.js' -import { SolanaAgentKit } from '../agent' + TxVersion, +} from "@raydium-io/raydium-sdk-v2"; +import { MintLayout } from "@solana/spl-token"; +import { PublicKey } from "@solana/web3.js"; +import BN from "bn.js"; +import { SolanaAgent } from "../index"; export async function raydiumCreateCpmm( - agent: SolanaAgentKit, - + agent: SolanaAgent, mintA: PublicKey, mintB: PublicKey, - configId: PublicKey, - mintAAmount: BN, mintBAmount: BN, - startTime: BN, ): Promise { - const raydium = await Raydium.load({ owner: agent.wallet, connection: agent.connection, - }) + }); - const [mintInfoA, mintInfoB] = await agent.connection.getMultipleAccountsInfo([mintA, mintB]) - if (mintInfoA === null || mintInfoB === null) throw Error('fetch mint info error') + const [mintInfoA, mintInfoB] = await agent.connection.getMultipleAccountsInfo( + [mintA, mintB], + ); + if (mintInfoA === null || mintInfoB === null) + throw Error("fetch mint info error"); - const mintDecodeInfoA = MintLayout.decode(mintInfoA.data) - const mintDecodeInfoB = MintLayout.decode(mintInfoB.data) + const mintDecodeInfoA = MintLayout.decode(mintInfoA.data); + const mintDecodeInfoB = MintLayout.decode(mintInfoB.data); const mintFormatInfoA = { chainId: 101, address: mintA.toString(), programId: mintInfoA.owner.toString(), - logoURI: '', - symbol: '', - name: '', + logoURI: "", + symbol: "", + name: "", decimals: mintDecodeInfoA.decimals, tags: [], - extensions: {} - } + extensions: {}, + }; const mintFormatInfoB = { chainId: 101, address: mintB.toString(), programId: mintInfoB.owner.toString(), - logoURI: '', - symbol: '', - name: '', + logoURI: "", + symbol: "", + name: "", decimals: mintDecodeInfoB.decimals, tags: [], - extensions: {} - } + extensions: {}, + }; const { execute, extInfo } = await raydium.cpmm.createPool({ programId: CREATE_CPMM_POOL_PROGRAM, @@ -76,9 +74,9 @@ export async function raydiumCreateCpmm( // units: 600000, // microLamports: 46591500, // }, - }) + }); - const { txId } = await execute({ sendAndConfirm: true }) + const { txId } = await execute({ sendAndConfirm: true }); - return txId + return txId; } diff --git a/src/tools/register_domain.ts b/src/tools/register_domain.ts index 1348001..20bcf79 100644 --- a/src/tools/register_domain.ts +++ b/src/tools/register_domain.ts @@ -1,18 +1,18 @@ import { registerDomainNameV2 } from "@bonfida/spl-name-service"; import { Transaction } from "@solana/web3.js"; -import { SolanaAgentKit } from "../index"; +import { SolanaAgent } from "../index"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { TOKENS } from "../constants"; /** * Register a .sol domain name using Bonfida Name Service - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param name Domain name to register (without .sol) * @param spaceKB Space allocation in KB (max 10KB) * @returns Transaction signature */ export async function registerDomain( - agent: SolanaAgentKit, + agent: SolanaAgent, name: string, spaceKB: number = 1, ): Promise { diff --git a/src/tools/request_faucet_funds.ts b/src/tools/request_faucet_funds.ts index bde8eed..dd44cb3 100644 --- a/src/tools/request_faucet_funds.ts +++ b/src/tools/request_faucet_funds.ts @@ -1,14 +1,14 @@ -import { SolanaAgentKit } from "../index"; +import { SolanaAgent } from "../index"; import { LAMPORTS_PER_SOL } from "@solana/web3.js"; /** * Request SOL from the Solana faucet (devnet/testnet only) - * @param agent - SolanaAgentKit instance + * @param agent - SolanaAgent instance * @returns Transaction signature * @throws Error if the request fails or times out */ export async function request_faucet_funds( - agent: SolanaAgentKit, + agent: SolanaAgent, ): Promise { const tx = await agent.connection.requestAirdrop( agent.wallet_address, diff --git a/src/tools/resolve_sol_domain.ts b/src/tools/resolve_sol_domain.ts index d8764cc..e5c87a5 100644 --- a/src/tools/resolve_sol_domain.ts +++ b/src/tools/resolve_sol_domain.ts @@ -1,6 +1,6 @@ import { resolve } from "@bonfida/spl-name-service"; import { PublicKey } from "@solana/web3.js"; -import { SolanaAgentKit } from "../index"; +import { SolanaAgent } from "../index"; /** * Resolves a .sol domain to a Solana PublicKey. @@ -9,14 +9,14 @@ import { SolanaAgentKit } from "../index"; * to the corresponding Solana PublicKey. The domain can be provided with or without * the .sol suffix. * - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param domain The .sol domain to resolve. This can be provided with or without the .sol TLD suffix * @returns A promise that resolves to the corresponding Solana PublicKey * @throws Error if the domain resolution fails */ export async function resolveSolDomain( - agent: SolanaAgentKit, - domain: string + agent: SolanaAgent, + domain: string, ): Promise { if (!domain || typeof domain !== "string") { throw new Error("Invalid domain. Expected a non-empty string."); diff --git a/src/tools/send_compressed_airdrop.ts b/src/tools/send_compressed_airdrop.ts index 313bbdb..3a80f42 100644 --- a/src/tools/send_compressed_airdrop.ts +++ b/src/tools/send_compressed_airdrop.ts @@ -1,12 +1,11 @@ import { AddressLookupTableAccount, ComputeBudgetProgram, - Connection, Keypair, PublicKey, TransactionInstruction, } from "@solana/web3.js"; -import { SolanaAgentKit } from "../agent/index.js"; +import { SolanaAgent } from "../index"; import { buildAndSignTx, calculateComputeUnitPrice, @@ -33,7 +32,7 @@ const MAX_CONCURRENT_TXS = 30; */ export const getAirdropCostEstimate = ( numberOfRecipients: number, - priorityFeeInLamports: number + priorityFeeInLamports: number, ) => { const baseFee = 5000; const perRecipientCompressedStateFee = 300; @@ -57,28 +56,27 @@ export const getAirdropCostEstimate = ( * @param shouldLog Whether to log progress to stdout. Defaults to false. */ export async function sendCompressedAirdrop( - agent: SolanaAgentKit, + agent: SolanaAgent, mintAddress: PublicKey, amount: number, decimals: number, recipients: PublicKey[], priorityFeeInLamports: number, - shouldLog: boolean = false + shouldLog: boolean = false, ): Promise { if (recipients.length > MAX_AIRDROP_RECIPIENTS) { throw new Error( - `Max airdrop can be ${MAX_AIRDROP_RECIPIENTS} recipients at a time. For more scale, use open source ZK Compression airdrop tools such as https://github.com/helius-labs/airship.` + `Max airdrop can be ${MAX_AIRDROP_RECIPIENTS} recipients at a time. For more scale, use open source ZK Compression airdrop tools such as https://github.com/helius-labs/airship.`, ); } - const url = agent.connection.rpcEndpoint; if (url.includes("devnet")) { throw new Error("Devnet is not supported for airdrop. Please use mainnet."); } if (!url.includes("helius")) { console.warn( - "Warning: Must use RPC with ZK Compression support. Double check with your RPC provider if in doubt." + "Warning: Must use RPC with ZK Compression support. Double check with your RPC provider if in doubt.", ); } @@ -88,11 +86,11 @@ export async function sendCompressedAirdrop( agent.connection, agent.wallet, mintAddress, - agent.wallet.publicKey + agent.wallet.publicKey, ); } catch (error) { throw new Error( - "Source token account not found and failed to create it. Please add funds to your wallet and try again." + "Source token account not found and failed to create it. Please add funds to your wallet and try again.", ); } @@ -100,7 +98,7 @@ export async function sendCompressedAirdrop( await createTokenPool( agent.connection as unknown as Rpc, agent.wallet, - mintAddress + mintAddress, ); } catch (error: any) { if (error.message.includes("already in use")) { @@ -116,17 +114,17 @@ export async function sendCompressedAirdrop( mintAddress, recipients, priorityFeeInLamports, - shouldLog + shouldLog, ); } async function processAll( - agent: SolanaAgentKit, + agent: SolanaAgent, amount: number, mint: PublicKey, recipients: PublicKey[], priorityFeeInLamports: number, - shouldLog: boolean + shouldLog: boolean, ): Promise { const mintAddress = mint; const payer = agent.wallet; @@ -135,13 +133,13 @@ async function processAll( agent.connection, agent.wallet, mintAddress, - agent.wallet.publicKey + agent.wallet.publicKey, ); const maxRecipientsPerInstruction = 5; const maxIxs = 3; // empirically determined (as of 12/15/2024) const lookupTableAddress = new PublicKey( - "9NYFyEqPkyXUhkerbGHXUXkvb4qpzeEdHuGpgbgpH1NJ" + "9NYFyEqPkyXUhkerbGHXUXkvb4qpzeEdHuGpgbgpH1NJ", ); const lookupTableAccount = ( @@ -164,7 +162,7 @@ async function processAll( ComputeBudgetProgram.setComputeUnitPrice({ microLamports: calculateComputeUnitPrice( priorityFeeInLamports, - 500_000 + 500_000, ), }), ]; @@ -184,13 +182,13 @@ async function processAll( toAddress: batch, amount: batch.map(() => amount), mint: mintAddress, - }) + }), ); } const compressIxs = await Promise.all(compressIxPromises); return [...instructions, ...compressIxs]; - }) + }), ); const url = agent.connection.rpcEndpoint; @@ -225,12 +223,12 @@ async function processAll( instructions, payer, lookupTableAccount, - i + idx + i + idx, ).then((signature) => { confirmedCount++; log("\r" + renderProgressBar(confirmedCount, totalBatches)); return signature; - }) + }), ); const batchResults = await Promise.allSettled(batchPromises); @@ -250,7 +248,7 @@ async function processAll( throw new Error( `Failed to process ${failures.length} batches: ${failures .map((f) => f.error) - .join(", ")}` + .join(", ")}`, ); } @@ -262,7 +260,7 @@ async function sendTransactionWithRetry( instructions: TransactionInstruction[], payer: Keypair, lookupTableAccount: AddressLookupTableAccount, - batchIndex: number + batchIndex: number, ): Promise { const MAX_RETRIES = 3; const INITIAL_BACKOFF = 500; // ms @@ -275,7 +273,7 @@ async function sendTransactionWithRetry( payer, blockhash, [], - [lookupTableAccount] + [lookupTableAccount], ); const signature = await sendAndConfirmTx(connection, tx); @@ -292,7 +290,7 @@ async function sendTransactionWithRetry( throw new Error( `Batch ${batchIndex} failed after ${attempt + 1} attempts: ${ error.message - }` + }`, ); } diff --git a/src/tools/stake_with_jup.ts b/src/tools/stake_with_jup.ts index e152532..981dd64 100644 --- a/src/tools/stake_with_jup.ts +++ b/src/tools/stake_with_jup.ts @@ -1,14 +1,14 @@ import { VersionedTransaction } from "@solana/web3.js"; -import { SolanaAgentKit } from "../agent"; +import { SolanaAgent } from "../index"; /** * Stake SOL with Jup validator - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param amount Amount of SOL to stake * @returns Transaction signature */ export async function stakeWithJup( - agent: SolanaAgentKit, + agent: SolanaAgent, amount: number, ): Promise { try { diff --git a/src/tools/trade.ts b/src/tools/trade.ts index b17bc41..4c9b713 100644 --- a/src/tools/trade.ts +++ b/src/tools/trade.ts @@ -1,10 +1,14 @@ -import { VersionedTransaction, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js"; -import { SolanaAgentKit } from "../index"; +import { + VersionedTransaction, + PublicKey, + LAMPORTS_PER_SOL, +} from "@solana/web3.js"; +import { SolanaAgent } from "../index"; import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants"; /** * Swap tokens using Jupiter Exchange - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param outputMint Target token mint address * @param inputAmount Amount to swap (in token decimals) * @param inputMint Source token mint address (defaults to USDC) @@ -12,7 +16,7 @@ import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants"; * @returns Transaction signature */ export async function trade( - agent: SolanaAgentKit, + agent: SolanaAgent, outputMint: PublicKey, inputAmount: number, inputMint: PublicKey = TOKENS.USDC, diff --git a/src/tools/transfer.ts b/src/tools/transfer.ts index acfec82..93607de 100644 --- a/src/tools/transfer.ts +++ b/src/tools/transfer.ts @@ -1,29 +1,25 @@ -import { SolanaAgentKit } from "../index"; -import { - PublicKey, - SystemProgram, - Transaction -} from "@solana/web3.js"; +import { SolanaAgent } from "../index"; +import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; import { LAMPORTS_PER_SOL } from "@solana/web3.js"; -import { - getAssociatedTokenAddress, +import { + getAssociatedTokenAddress, createTransferInstruction, - getMint + getMint, } from "@solana/spl-token"; /** * Transfer SOL or SPL tokens to a recipient - * @param agent SolanaAgentKit instance + * @param agent SolanaAgent instance * @param to Recipient's public key * @param amount Amount to transfer * @param mint Optional mint address for SPL tokens * @returns Transaction signature */ export async function transfer( - agent: SolanaAgentKit, + agent: SolanaAgent, to: PublicKey, amount: number, - mint?: PublicKey + mint?: PublicKey, ): Promise { try { let tx: string; @@ -34,19 +30,19 @@ export async function transfer( SystemProgram.transfer({ fromPubkey: agent.wallet_address, toPubkey: to, - lamports: amount * LAMPORTS_PER_SOL - }) + lamports: amount * LAMPORTS_PER_SOL, + }), ); - tx = await agent.connection.sendTransaction( - transaction, - [agent.wallet] - ); + tx = await agent.connection.sendTransaction(transaction, [agent.wallet]); } else { // Transfer SPL token - const fromAta = await getAssociatedTokenAddress(mint, agent.wallet_address); + const fromAta = await getAssociatedTokenAddress( + mint, + agent.wallet_address, + ); const toAta = await getAssociatedTokenAddress(mint, to); - + // Get mint info to determine decimals const mintInfo = await getMint(agent.connection, mint); const adjustedAmount = amount * Math.pow(10, mintInfo.decimals); @@ -56,18 +52,15 @@ export async function transfer( fromAta, toAta, agent.wallet_address, - adjustedAmount - ) + adjustedAmount, + ), ); - tx = await agent.connection.sendTransaction( - transaction, - [agent.wallet] - ); + tx = await agent.connection.sendTransaction(transaction, [agent.wallet]); } return tx; } catch (error: any) { throw new Error(`Transfer failed: ${error.message}`); } -} \ No newline at end of file +} diff --git a/src/utils/send_tx.ts b/src/utils/send_tx.ts index 903ddd5..65fafe4 100644 --- a/src/utils/send_tx.ts +++ b/src/utils/send_tx.ts @@ -1,4 +1,4 @@ -import { SolanaAgentKit } from "../agent"; +import { SolanaAgent } from "../agent"; import { Transaction, Keypair, TransactionInstruction } from "@solana/web3.js"; import { Connection, ComputeBudgetProgram } from "@solana/web3.js"; @@ -41,7 +41,7 @@ export async function getPriorityFees(connection: Connection): Promise<{ const median = sortedFees.length % 2 === 0 ? ((sortedFees[mid - 1] ?? 0) + (sortedFees[mid] ?? 0)) / 2 - : sortedFees[mid] ?? 0; + : (sortedFees[mid] ?? 0); // Helper to create priority fee IX based on chosen strategy const createPriorityFeeIx = (fee: number) => { @@ -69,14 +69,14 @@ export async function getPriorityFees(connection: Connection): Promise<{ /** * Send a transaction with priority fees - * @param agent - SolanaAgentKit instance + * @param agent - SolanaAgent instance * @param tx - Transaction to send * @returns Transaction ID */ export async function sendTx( - agent: SolanaAgentKit, + agent: SolanaAgent, tx: Transaction, - otherKeypairs?: Keypair[] + otherKeypairs?: Keypair[], ) { tx.recentBlockhash = (await agent.connection.getLatestBlockhash()).blockhash; tx.feePayer = agent.wallet_address; @@ -90,9 +90,8 @@ export async function sendTx( await agent.connection.confirmTransaction({ signature: txid, blockhash: (await agent.connection.getLatestBlockhash()).blockhash, - lastValidBlockHeight: ( - await agent.connection.getLatestBlockhash() - ).lastValidBlockHeight, + lastValidBlockHeight: (await agent.connection.getLatestBlockhash()) + .lastValidBlockHeight, }); return txid; } diff --git a/test/index.ts b/test/index.ts index 9522c23..b226ce4 100644 --- a/test/index.ts +++ b/test/index.ts @@ -1,4 +1,4 @@ -import { SolanaAgentKit } from "../src"; +import { SolanaAgent } from "../src"; import { createSolanaTools } from "../src/langchain"; import { HumanMessage } from "@langchain/core/messages"; import { MemorySaver } from "@langchain/langgraph"; @@ -14,7 +14,7 @@ function validateEnvironment(): void { const missingVars: string[] = []; const requiredVars = ["OPENAI_API_KEY", "RPC_URL", "SOLANA_PRIVATE_KEY"]; - requiredVars.forEach(varName => { + requiredVars.forEach((varName) => { if (!process.env[varName]) { missingVars.push(varName); } @@ -22,7 +22,7 @@ function validateEnvironment(): void { if (missingVars.length > 0) { console.error("Error: Required environment variables are not set"); - missingVars.forEach(varName => { + missingVars.forEach((varName) => { console.error(`${varName}=your_${varName.toLowerCase()}_here`); }); process.exit(1); @@ -50,13 +50,13 @@ async function initializeAgent() { } } - const solanaKit = new SolanaAgentKit( + const solanaAgent = new SolanaAgent( process.env.SOLANA_PRIVATE_KEY!, process.env.RPC_URL, - process.env.OPENAI_API_KEY! + process.env.OPENAI_API_KEY!, ); - const tools = createSolanaTools(solanaKit); + const tools = createSolanaTools(solanaAgent); const memory = new MemorySaver(); const config = { configurable: { thread_id: "Solana Agent Kit!" } }; @@ -65,13 +65,13 @@ async function initializeAgent() { tools, checkpointSaver: memory, 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 - (internal) HTTP error code, ask the user to try again later. If someone asks you to do something you - can't do with your currently available tools, you must say so, and encourage them to implement it - themselves using the Solana Agent Kit, recommend they go to https://sendai.fun/kit for more information. Be - concise and helpful with your responses. Refrain from restating your tools' descriptions unless it is + You are a helpful agent that can interact onchain using the Solana Agent Kit. You are + empowered to interact onchain using your tools. If you ever need funds, you can request them from the + faucet. If not, you can provide your wallet details and request funds from the user. If there is a 5XX + (internal) HTTP error code, ask the user to try again later. If someone asks you to do something you + can't do with your currently available tools, you must say so, and encourage them to implement it + themselves using the Solana Agent Kit, recommend they go to https://sendai.fun/kit for more information. Be + concise and helpful with your responses. Refrain from restating your tools' descriptions unless it is explicitly requested. `, }); @@ -96,7 +96,10 @@ async function runAutonomousMode(agent: any, config: any, interval = 10) { "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) { @@ -107,7 +110,7 @@ async function runAutonomousMode(agent: any, config: any, interval = 10) { console.log("-------------------"); } - await new Promise(resolve => setTimeout(resolve, interval * 1000)); + await new Promise((resolve) => setTimeout(resolve, interval * 1000)); } catch (error) { if (error instanceof Error) { console.error("Error:", error.message); @@ -126,7 +129,7 @@ async function runChatMode(agent: any, config: any) { }); const question = (prompt: string): Promise => - new Promise(resolve => rl.question(prompt, resolve)); + new Promise((resolve) => rl.question(prompt, resolve)); try { while (true) { @@ -136,7 +139,10 @@ async function runChatMode(agent: any, config: any) { 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) { @@ -164,7 +170,7 @@ async function chooseMode(): Promise<"chat" | "auto"> { }); const question = (prompt: string): Promise => - new Promise(resolve => rl.question(prompt, resolve)); + new Promise((resolve) => rl.question(prompt, resolve)); while (true) { console.log("\nAvailable modes:"); @@ -206,7 +212,7 @@ async function main() { } if (require.main === module) { - main().catch(error => { + main().catch((error) => { console.error("Fatal error:", error); process.exit(1); }); From 6d4f468fb3f35a3e39e1db37f73f10f9a7cb33fa Mon Sep 17 00:00:00 2001 From: Arihant Bansal <17180950+arihantbansal@users.noreply.github.com> Date: Sun, 22 Dec 2024 01:30:29 +0530 Subject: [PATCH 02/31] fix --- README.md | 4 +- docs/assets/highlight.css | 15 +- docs/assets/search.js | 2 +- docs/classes/SolanaAgentKit.html | 13 +- docs/functions/createSolanaTools.html | 2 +- docs/index.html | 119 ++++++++----- docs/interfaces/CollectionDeployment.html | 4 +- docs/interfaces/CollectionOptions.html | 4 +- docs/interfaces/Creator.html | 4 +- docs/interfaces/FetchPriceResponse.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/media/CONTRIBUTING.md | 154 +++++++++++++++++ guides/add_your_own_tool.md | 14 +- src/agent/index.ts | 4 +- src/index.ts | 4 +- src/langchain/index.ts | 161 +++++++++--------- src/tools/create_image.ts | 4 +- .../create_orca_single_sided_whirlpool.ts | 6 +- src/tools/deploy_collection.ts | 4 +- src/tools/deploy_token.ts | 4 +- src/tools/get_balance.ts | 4 +- src/tools/get_primary_domain.ts | 4 +- src/tools/get_tps.ts | 2 +- src/tools/launch_pumpfun_token.ts | 4 +- src/tools/lend.ts | 4 +- src/tools/mint_nft.ts | 4 +- src/tools/openbook_create_market.ts | 4 +- src/tools/raydium_create_ammV4.ts | 4 +- src/tools/raydium_create_clmm.ts | 4 +- src/tools/raydium_create_cpmm.ts | 4 +- src/tools/register_domain.ts | 4 +- src/tools/request_faucet_funds.ts | 4 +- src/tools/resolve_sol_domain.ts | 4 +- src/tools/send_compressed_airdrop.ts | 6 +- src/tools/stake_with_jup.ts | 4 +- src/tools/trade.ts | 4 +- src/tools/transfer.ts | 4 +- src/utils/send_tx.ts | 4 +- test/index.ts | 2 +- 43 files changed, 407 insertions(+), 213 deletions(-) create mode 100644 docs/media/CONTRIBUTING.md diff --git a/README.md b/README.md index 6e2df64..93c262c 100644 --- a/README.md +++ b/README.md @@ -78,10 +78,10 @@ npm install solana-agent-kit ## Quick Start ```typescript -import { SolanaAgent, createSolanaTools } from "solana-agent-kit"; +agent: SolanaAgentKit, createSolanaTools } from "solana-agent-kit"; // Initialize with private key and optional RPC URL -const agent = new SolanaAgent( +const agent = new SolanaAgentKit( "your-wallet-private-key-as-base58", "https://api.mainnet-beta.solana.com", "your-openai-api-key" diff --git a/docs/assets/highlight.css b/docs/assets/highlight.css index 63010a9..fd488bf 100644 --- a/docs/assets/highlight.css +++ b/docs/assets/highlight.css @@ -5,8 +5,8 @@ --dark-hl-1: #D4D4D4; --light-hl-2: #A31515; --dark-hl-2: #CE9178; - --light-hl-3: #AF00DB; - --dark-hl-3: #C586C0; + --light-hl-3: #000000; + --dark-hl-3: #C8C8C8; --light-hl-4: #001080; --dark-hl-4: #9CDCFE; --light-hl-5: #008000; @@ -15,8 +15,10 @@ --dark-hl-6: #569CD6; --light-hl-7: #0070C1; --dark-hl-7: #4FC1FF; - --light-hl-8: #098658; - --dark-hl-8: #B5CEA8; + --light-hl-8: #AF00DB; + --dark-hl-8: #C586C0; + --light-hl-9: #098658; + --dark-hl-9: #B5CEA8; --light-code-background: #FFFFFF; --dark-code-background: #1E1E1E; } @@ -31,6 +33,7 @@ --hl-6: var(--light-hl-6); --hl-7: var(--light-hl-7); --hl-8: var(--light-hl-8); + --hl-9: var(--light-hl-9); --code-background: var(--light-code-background); } } @@ -44,6 +47,7 @@ --hl-6: var(--dark-hl-6); --hl-7: var(--dark-hl-7); --hl-8: var(--dark-hl-8); + --hl-9: var(--dark-hl-9); --code-background: var(--dark-code-background); } } @@ -57,6 +61,7 @@ --hl-6: var(--light-hl-6); --hl-7: var(--light-hl-7); --hl-8: var(--light-hl-8); + --hl-9: var(--light-hl-9); --code-background: var(--light-code-background); } @@ -70,6 +75,7 @@ --hl-6: var(--dark-hl-6); --hl-7: var(--dark-hl-7); --hl-8: var(--dark-hl-8); + --hl-9: var(--dark-hl-9); --code-background: var(--dark-code-background); } @@ -82,4 +88,5 @@ .hl-6 { color: var(--hl-6); } .hl-7 { color: var(--hl-7); } .hl-8 { color: var(--hl-8); } +.hl-9 { color: var(--hl-9); } pre, code { background: var(--code-background); } diff --git a/docs/assets/search.js b/docs/assets/search.js index 0bcb10d..8b3e63a 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,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"; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,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"; \ No newline at end of file diff --git a/docs/classes/SolanaAgentKit.html b/docs/classes/SolanaAgentKit.html index b767597..8179e3b 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

+Provides a unified interface for token operations, NFT management, trading and more

SolanaAgentKit

-

Constructors

Constructors

Properties

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

Methods

createOrcaSingleSidedWhirlpool deployCollection deployToken +fetchTokenPrice getBalance getPrimaryDomain getTokenDataByAddress @@ -28,7 +29,7 @@ Provides a unified interface for token operations, NFT management, and tradingstake trade transfer -

Constructors

  • Parameters

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

    Returns SolanaAgentKit

Properties

connection: Connection

Solana RPC connection

-
openai_api_key: string
wallet: Keypair

Wallet keypair for signing transactions

-
wallet_address: PublicKey

Public key of the wallet

-

Methods

  • Parameters

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

    Returns Promise<string>

  • Parameters

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

    Returns Promise<{
        mint: PublicKey;
    }>

  • Parameters

    • Optionaltoken_address: PublicKey

    Returns Promise<null | number>

  • Parameters

    • account: PublicKey

    Returns Promise<string>

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

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

  • Parameters

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

    Returns Promise<string[]>

  • Parameters

    • amount: number

    Returns Promise<string>

  • Parameters

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

    Returns Promise<string>

  • Parameters

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

    Returns Promise<string>

+

Constructors

  • Parameters

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

    Returns SolanaAgentKit

Properties

connection: Connection

Solana RPC connection

+
openai_api_key: string
wallet: Keypair

Wallet keypair for signing transactions

+
wallet_address: PublicKey

Public key of the wallet

+

Methods

  • Parameters

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

    Returns Promise<string>

  • Parameters

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

    Returns Promise<{
        mint: PublicKey;
    }>

  • Parameters

    • mint: string

    Returns Promise<string>

  • Parameters

    • Optionaltoken_address: PublicKey

    Returns Promise<null | number>

  • 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

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

  • Parameters

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

    Returns Promise<string[]>

  • Parameters

    • amount: number

    Returns Promise<string>

  • Parameters

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

    Returns Promise<string>

  • Parameters

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

    Returns Promise<string>

diff --git a/docs/functions/createSolanaTools.html b/docs/functions/createSolanaTools.html index ca5e484..1f177c1 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)[]

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

diff --git a/docs/index.html b/docs/index.html index e7acd0e..c39a52f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,80 +1,112 @@ -solana-agent-kit

solana-agent-kit

Solana Agent Kit

A powerful toolkit for interacting with the Solana blockchain, providing easy-to-use functions for token operations, NFT management, and trading. Now integrated with LangChain for enhanced functionality.

-
    -
  • -

    🪙 Token Operations

    +solana-agent-kit

    solana-agent-kit

    +

    Solana Agent Kit

    +

    Solana Agent Kit Cover 1 (3)

    +

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

      -
    • Deploy new SPL tokens
    • -
    • Transfer SOL and SPL tokens
    • -
    • Check token balances
    • +
    • Trade tokens
    • +
    • Launch new tokens
    • +
    • Lend assets
    • +
    • Send compressed airdrops
    • +
    • Execute blinks
    • +
    • Launch tokens on AMMs
    • +
    • 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.

    +
      +
    • +

      Token Operations

      +
        +
      • Deploy SPL tokens by Metaplex
      • +
      • Transfer assets
      • +
      • Balance checks
      • Stake SOL
      • +
      • Zk compressed Airdrop by Light Protocol and Helius
    • -

      🖼️ NFT Management

      +

      NFT Management via Metaplex

        -
      • Deploy NFT collections
      • -
      • Mint NFTs to collections
      • -
      • Manage metadata and royalties
      • +
      • Collection deployment
      • +
      • NFT minting
      • +
      • Metadata management
      • +
      • Royalty configuration
    • -

      💱 Trading

      +

      DeFi Integration

        -
      • Integrated Jupiter Exchange support
      • -
      • Token swaps with customizable slippage
      • -
      • Direct routing options
      • +
      • Jupiter Exchange swaps
      • +
      • Launch on Pump via PumpPortal
      • +
      • Raydium pool creation (CPMM, CLMM, AMMv4)
      • +
      • Orca whirlpool integration
      • +
      • Meteora Dynamic AMM, DLMM Pool, and Alpga Vault
      • +
      • Openbook market creation
      • +
      • Register and Resolve SNS
      • +
      • Jito Bundles
    • -

      🏦 Yield Farming

      +

      Solana Blinks

        -
      • Lend idle assets to earn interest with Lulo
      • +
      • Lending by Lulo
      • +
      • Send Arcade Games
      • +
      • JupSOL staking
      • +
      +
    • +
    +
      +
    • +

      LangChain Integration

      +
        +
      • Ready-to-use LangChain tools for blockchain operations
      • +
      • Autonomous agent support with React framework
      • +
      • Memory management for persistent interactions
      • +
      • Streaming responses for real-time feedback
    • -

      🔗 LangChain Integration

      +

      Autonomous Modes

        -
      • Utilize LangChain tools for enhanced blockchain interactions
      • -
      • Access a suite of tools for balance checks, transfers, token deployments, and more
      • +
      • Interactive chat mode for guided operations
      • +
      • Autonomous mode for independent agent actions
      • +
      • Configurable action intervals
      • +
      • Built-in error handling and recovery
      • +
      +
    • +
    • +

      AI Tools

      +
        +
      • DALL-E integration for NFT artwork generation
      • +
      • Natural language processing for blockchain commands
      • +
      • Price feed integration for market analysis
      • +
      • Automated decision-making capabilities
    -
    npm install solana-agent-kit
    +
    npm install solana-agent-kit
     
    -
    import { SolanaAgentKit, createSolanaTools } from "solana-agent-kit";

    // Initialize with private key and optional RPC URL
    const agent = new SolanaAgentKit(
    "your-wallet-private-key-as-base58",
    "https://api.mainnet-beta.solana.com",
    "your-openai-api-key"
    );

    // Create LangChain tools
    const tools = createSolanaTools(agent); +
    agent: SolanaAgentKit, createSolanaTools } from "solana-agent-kit";

    // Initialize with private key and optional RPC URL
    const agent = new SolanaAgentKit(
    "your-wallet-private-key-as-base58",
    "https://api.mainnet-beta.solana.com",
    "your-openai-api-key"
    );

    // Create LangChain tools
    const tools = createSolanaTools(agent);
    -
    import { deploy_token } from "solana-agent-kit";

    const result = await deploy_token(
    agent,
    9, // decimals
    1000000 // initial supply
    );

    console.log("Token Mint Address:", result.mint.toString()); +
    const result = await agent.deployToken(
    "my ai token", // name
    "uri", // uri
    "token", // symbol
    9, // decimals
    1000000 // initial supply
    );

    console.log("Token Mint Address:", result.mint.toString());
    -
    import { deploy_collection } from "solana-agent-kit";

    const collection = await deploy_collection(agent, {
    name: "My NFT Collection",
    uri: "https://arweave.net/metadata.json",
    royaltyBasisPoints: 500, // 5%
    creators: [
    {
    address: "creator-wallet-address",
    percentage: 100,
    },
    ],
    }); +
    const collection = await agent.deployCollection({
    name: "My NFT Collection",
    uri: "https://arweave.net/metadata.json",
    royaltyBasisPoints: 500, // 5%
    creators: [
    {
    address: "creator-wallet-address",
    percentage: 100,
    },
    ],
    });
    -
    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 { PublicKey } from "@solana/web3.js";

    const signature = await agent.trade(
    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,
    100 // amount
    ); +
    import { PublicKey } from "@solana/web3.js";

    const signature = await agent.lendAssets(
    100 // amount of USDC to lend
    );
    -
    import { stakeWithJup } from "solana-agent-kit";

    const signature = await stakeWithJup(
    agent,
    1 // amount in SOL
    ); +
    const signature = await agent.stake(
    1 // amount in SOL to stake
    );
    -
    import { fetchPrice } from "solana-agent-kit";

    const price = await fetchPrice(
    agent,
    "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN" // Token mint address
    );

    console.log("Price in USDC:", price); +
    import { PublicKey } from "@solana/web3.js";

    (async () => {
    console.log(
    "~Airdrop cost estimate:",
    getAirdropCostEstimate(
    1000, // recipients
    30_000 // priority fee in lamports
    )
    );

    const signature = await agent.sendCompressedAirdrop(
    new PublicKey("JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"), // mint
    42, // amount per recipient
    [
    new PublicKey("1nc1nerator11111111111111111111111111111111"),
    // ... add more recipients
    ],
    30_000 // priority fee in lamports
    );
    })();
    -
    import {
    sendCompressedAirdrop,
    getAirdropCostEstimate,
    } from "solana-agent-kit";
    import { PublicKey } from "@solana/web3.js";

    (async () => {
    console.log(
    "~Airdrop cost estimate:",
    getAirdropCostEstimate(
    1000, // recipients
    30_000 // priority fee in lamports
    )
    );

    const signature = await sendCompressedAirdrop(
    agent,
    new PublicKey("JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"), // mint
    42, // amount per recipient
    [
    new PublicKey("1nc1nerator11111111111111111111111111111111"),
    // ... add more recipients
    ],
    30_000 // priority fee in lamports
    );
    })(); -
    - -

    Deploy a new SPL token with optional initial supply. If not specified, decimals default to 9.

    -

    Create a new NFT collection with customizable metadata and royalties.

    -

    Mint a new NFT as part of an existing collection.

    -

    Transfer SOL or SPL tokens to a recipient.

    -

    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.

    -

    Send an SPL token airdrop to many recipients at low cost via ZK Compression.

    The toolkit relies on several key Solana and Metaplex libraries:

    • @solana/web3.js
    • @@ -85,7 +117,8 @@
    • @lightprotocol/compressed-token
    • @lightprotocol/stateless.js
    -

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

    -

    ISC License

    +

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

    +

    MIT License

    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 0438e92..6999f92 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 997e32b..29b5bfc 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 72a3136..38c524a 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 f2ffea8..37c020c 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/JupiterTokenData.html b/docs/interfaces/JupiterTokenData.html index 1fbabda..a162800 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 0aafae9..f80d34c 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 4c85a86..f5a840f 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 d904b0c..fd2a37f 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 7e65f2a..da5a287 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/media/CONTRIBUTING.md b/docs/media/CONTRIBUTING.md new file mode 100644 index 0000000..9cc1837 --- /dev/null +++ b/docs/media/CONTRIBUTING.md @@ -0,0 +1,154 @@ +# Contributing to Solana Agent Kit + +First off, thank you for considering contributing to Solana Agent Kit! 🎉 Your contributions are **greatly appreciated**. + +## Table of Contents + +- [Contributing to Solana Agent Kit](#contributing-to-solana-agent-kit) + - [Table of Contents](#table-of-contents) + - [Code of Conduct](#code-of-conduct) + - [How Can I Contribute?](#how-can-i-contribute) + - [Reporting Bugs](#reporting-bugs) + - [Suggesting Enhancements](#suggesting-enhancements) + - [Your First Code Contribution](#your-first-code-contribution) + - [Pull Requests](#pull-requests) + - [Style Guides](#style-guides) + - [Code Style](#code-style) + - [Commit Messages](#commit-messages) + - [Naming Conventions](#naming-conventions) + - [Development Setup](#development-setup) + - [Prerequisites](#prerequisites) + - [Installation](#installation) + - [Building the Project](#building-the-project) + - [Running Tests](#running-tests) + - [Generating Documentation](#generating-documentation) + - [Security](#security) + - [License](#license) + +## Code of Conduct + +This project adheres to the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/). By participating, you are expected to uphold this code. Please report unacceptable behavior to [aryan@sendai.fun](mailto:aryan@sendai.fun). + +## How Can I Contribute? + +### Reporting Bugs + +**Great**! Opening an issue is the best way to help us improve. Here's how you can report a bug: + +1. **Search** the [existing issues](https://github.com/sendaifun/solana-agent-kit/issues) to make sure it hasn't been reported. +2. **Open a new issue** and fill out the template with as much information as possible. +3. **Provide reproduction steps** if applicable. + +### Suggesting Enhancements + +We welcome your ideas for improving Solana Agent Kit! To suggest an enhancement: + +1. **Search** the [existing issues](https://github.com/sendaifun/solana-agent-kit/issues) to see if it's already been suggested. +2. **Open a new issue** and describe your idea in detail. + +### Your First Code Contribution + +Unsure where to start? You can help out by: + +- Fixing simple bugs. +- Improving documentation. +- Adding tests. + +Check out the [Good First Issues](https://github.com/sendaifun/solana-agent-kit/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) to get started! + +### Pull Requests + +1. **Fork** the repository. +2. **Create** a new branch for your feature or bugfix. + ```bash + git checkout -b feature/your-feature-name + ``` +3. **Commit** your changes with clear and descriptive messages. +4. **Push** to your fork. + ```bash + git push origin feature/your-feature-name + ``` +5. **Open a Pull Request** against the `main` branch of this repository. + +## Style Guides + +### Code Style + +- **Language**: TypeScript +- **Formatting**: Follow the existing codebase formatting. Consider using [Prettier](https://prettier.io/) for consistent code formatting. +- **Code Quality**: Adhere to the code quality rules defined in `.eslintrc`. Ensure all checks pass before submitting a PR. + +### Commit Messages + +Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for your commit messages. Examples: + +- `feat: add ability to deploy new SPL token` +- `fix: handle edge case when deploying collection` +- `docs: update README with new usage examples` + +### Naming Conventions + +- **Variables and Functions**: `camelCase` +- **Classes and Types**: `PascalCase` +- **Constants**: `UPPER_SNAKE_CASE` + +## Development Setup + +### Prerequisites + +- **Node.js**: v23.x or higher +- **npm**: v10.x or higher +- **Git**: Installed and configured + +### Installation + +1. **Clone** the repository: + ```bash + git clone https://github.com/yourusername/solana-agent-kit.git + ``` +2. **Navigate** to the project directory: + ```bash + cd solana-agent-kit + ``` +3. **Install** dependencies: + ```bash + pnpm install + ``` + +### Building the Project + +To compile the TypeScript code: + +```bash +pnpm run build +``` + +### Running Tests + +To execute the test suite: + +```bash +pnpm run test +``` + +### Generating Documentation + +To generate the project documentation using TypeDoc: + +```bash +npm run docs +``` + +The documentation will be available in the `docs/` directory. + +## Security + +This toolkit handles sensitive information such as private keys and API keys. **Ensure you never commit `.env` files or any sensitive data**. Review the `.gitignore` to confirm that sensitive files are excluded. + +For security vulnerabilities, please follow the [responsible disclosure](mailto:aryan@sendai.fun) process. + +## License + +This project is licensed under the [ISC License](LICENSE). + +--- diff --git a/guides/add_your_own_tool.md b/guides/add_your_own_tool.md index 71bfb7c..47782cb 100644 --- a/guides/add_your_own_tool.md +++ b/guides/add_your_own_tool.md @@ -21,19 +21,19 @@ Create a new TypeScript file in the `src/tools/` directory for your tool (e.g., ```typescript:src/tools/custom_tool.ts import { Tool } from "langchain/tools"; -import { SolanaAgent } from "../agent"; +import { SolanaAgentKit } from "../agent"; export class CustomTool extends Tool { name = "custom_tool"; description = "Description of what the custom tool does."; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } protected async _call(input: string): Promise { try { - const result = await this.solanaAgent.customFunction(input); + const result = await this.solanaKit.customFunction(input); return JSON.stringify({ status: "success", message: "Custom tool executed successfully", @@ -87,7 +87,7 @@ export function createSolanaTools(agent: SolanaAgentKit) { ### 6. Usage Example ```typescript -import { SolanaAgent, createSolanaTools } from "solana-agent-kit"; +agent: SolanaAgentKit, createSolanaTools } from "solana-agent-kit"; const agent = new SolanaAgent( "your-wallet-private-key-as-base58", @@ -118,19 +118,19 @@ Here's a complete example of implementing a tool to fetch token prices: ```typescript:src/tools/fetch_token_price.ts import { Tool } from "langchain/tools"; -import { SolanaAgent } from "../agent"; +import { SolanaAgentKit } from "../agent"; export class FetchTokenPriceTool extends Tool { name = "fetch_token_price"; description = "Fetches the current price of a specified token."; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } protected async _call(tokenSymbol: string): Promise { try { - const price = await this.solanaAgent.getTokenPrice(tokenSymbol); + const price = await this.solanaKit.getTokenPrice(tokenSymbol); return JSON.stringify({ status: "success", message: `Price fetched successfully for ${tokenSymbol}.`, diff --git a/src/agent/index.ts b/src/agent/index.ts index f40e18d..44eae4f 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -42,12 +42,12 @@ import { BN } from "@coral-xyz/anchor"; * Main class for interacting with Solana blockchain * Provides a unified interface for token operations, NFT management, trading and more * - * @class SolanaAgent + * @class SolanaAgentKit * @property {Connection} connection - Solana RPC connection * @property {Keypair} wallet - Wallet keypair for signing transactions * @property {PublicKey} wallet_address - Public key of the wallet */ -export class SolanaAgent { +export class SolanaAgentKit { public connection: Connection; public wallet: Keypair; public wallet_address: PublicKey; diff --git a/src/index.ts b/src/index.ts index 8c267a1..1b4116f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ -import { SolanaAgent } from "./agent"; +import { SolanaAgentKit } from "./agent"; import { createSolanaTools } from "./langchain"; -export { SolanaAgent, createSolanaTools }; +export { SolanaAgentKit, createSolanaTools }; // Optional: Export types that users might need export * from "./types"; diff --git a/src/langchain/index.ts b/src/langchain/index.ts index 11a0ff1..c5db27c 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -1,7 +1,7 @@ import { PublicKey } from "@solana/web3.js"; import Decimal from "decimal.js"; import { Tool } from "langchain/tools"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import { create_image } from "../tools/create_image"; import { BN } from "@coral-xyz/anchor"; import { FEE_TIERS } from "../tools"; @@ -17,14 +17,14 @@ export class SolanaBalanceTool extends Tool { Inputs: tokenAddress: string, eg "So11111111111111111111111111111111111111112" (optional)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } protected async _call(input: string): Promise { try { const tokenAddress = input ? new PublicKey(input) : undefined; - const balance = await this.solanaAgent.getBalance(tokenAddress); + const balance = await this.solanaKit.getBalance(tokenAddress); return JSON.stringify({ status: "success", @@ -50,7 +50,7 @@ export class SolanaTransferTool extends Tool { amount: number, eg 1 (required) mint?: string, eg "So11111111111111111111111111111111111111112" or "SENDdRQtYMWaQrBroBrJ2Q53fgVuq95CV9UPGEvpCxa" (optional)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -63,7 +63,7 @@ export class SolanaTransferTool extends Tool { ? new PublicKey(parsedInput.mint) : undefined; - const tx = await this.solanaAgent.transfer( + const tx = await this.solanaKit.transfer( recipient, parsedInput.amount, mintAddress, @@ -98,7 +98,7 @@ export class SolanaDeployTokenTool extends Tool { decimals?: number, eg 9 (optional, defaults to 9) initialSupply?: number, eg 1000000 (optional)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -106,7 +106,7 @@ export class SolanaDeployTokenTool extends Tool { try { const parsedInput = JSON.parse(input); - const result = await this.solanaAgent.deployToken( + const result = await this.solanaKit.deployToken( parsedInput.name, parsedInput.uri, parsedInput.symbol, @@ -139,7 +139,7 @@ export class SolanaDeployCollectionTool extends Tool { uri: string, eg "https://example.com/collection.json" (required) royaltyBasisPoints?: number, eg 500 for 5% (optional)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -147,7 +147,7 @@ export class SolanaDeployCollectionTool extends Tool { try { const parsedInput = JSON.parse(input); - const result = await this.solanaAgent.deployCollection(parsedInput); + const result = await this.solanaKit.deployCollection(parsedInput); return JSON.stringify({ status: "success", @@ -173,9 +173,9 @@ export class SolanaMintNFTTool extends Tool { collectionMint: string, eg "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w" (required) - The address of the collection to mint into name: string, eg "My NFT" (required) uri: string, eg "https://example.com/nft.json" (required) - recipient?: string, eg "9aUn5swQzUTRanaaTwmszxiv89cvFwUCjEBv1vZCoT1u" (optional) - The wallet to receive the NFT, defaults to agent's wallet which is ${this.solanaAgent.wallet_address.toString()}`; + recipient?: string, eg "9aUn5swQzUTRanaaTwmszxiv89cvFwUCjEBv1vZCoT1u" (optional) - The wallet to receive the NFT, defaults to agent's wallet which is ${this.solanaKit.wallet_address.toString()}`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -183,7 +183,7 @@ export class SolanaMintNFTTool extends Tool { try { const parsedInput = JSON.parse(input); - const result = await this.solanaAgent.mintNFT( + const result = await this.solanaKit.mintNFT( new PublicKey(parsedInput.collectionMint), { name: parsedInput.name, @@ -191,7 +191,7 @@ export class SolanaMintNFTTool extends Tool { }, parsedInput.recipient ? new PublicKey(parsedInput.recipient) - : this.solanaAgent.wallet_address, + : this.solanaKit.wallet_address, ); return JSON.stringify({ @@ -225,7 +225,7 @@ export class SolanaTradeTool extends Tool { inputMint?: string, eg "So11111111111111111111111111111111111111112" (optional) slippageBps?: number, eg 100 (optional)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -233,7 +233,7 @@ export class SolanaTradeTool extends Tool { try { const parsedInput = JSON.parse(input); - const tx = await this.solanaAgent.trade( + const tx = await this.solanaKit.trade( new PublicKey(parsedInput.outputMint), parsedInput.inputAmount, parsedInput.inputMint @@ -264,18 +264,18 @@ export class SolanaRequestFundsTool extends Tool { name = "solana_request_funds"; description = "Request SOL from Solana faucet (devnet/testnet only)"; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } protected async _call(_input: string): Promise { try { - await this.solanaAgent.requestFaucetFunds(); + await this.solanaKit.requestFaucetFunds(); return JSON.stringify({ status: "success", message: "Successfully requested faucet funds", - network: this.solanaAgent.connection.rpcEndpoint.split("/")[2], + network: this.solanaKit.connection.rpcEndpoint.split("/")[2], }); } catch (error: any) { return JSON.stringify({ @@ -296,7 +296,7 @@ export class SolanaRegisterDomainTool extends Tool { spaceKB: number, eg 1 (optional, default is 1) `; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -317,7 +317,7 @@ export class SolanaRegisterDomainTool extends Tool { const parsedInput = toJSON(input); this.validateInput(parsedInput); - const tx = await this.solanaAgent.registerDomain( + const tx = await this.solanaKit.registerDomain( parsedInput.name, parsedInput.spaceKB || 1, ); @@ -347,14 +347,14 @@ export class SolanaResolveDomainTool extends Tool { domain: string, eg "pumpfun.sol" or "pumpfun"(required) `; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } protected async _call(input: string): Promise { try { const domain = input.trim(); - const publicKey = await this.solanaAgent.resolveSolDomain(domain); + const publicKey = await this.solanaKit.resolveSolDomain(domain); return JSON.stringify({ status: "success", @@ -379,14 +379,14 @@ export class SolanaGetDomainTool extends Tool { account: string, eg "4Be9CvxqHW6BYiRAxW9Q3xu1ycTMWaL5z8NX4HR3ha7t" (required) `; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } protected async _call(input: string): Promise { try { const account = new PublicKey(input.trim()); - const domain = await this.solanaAgent.getPrimaryDomain(account); + const domain = await this.solanaKit.getPrimaryDomain(account); return JSON.stringify({ status: "success", @@ -407,12 +407,12 @@ export class SolanaGetWalletAddressTool extends Tool { name = "solana_get_wallet_address"; description = `Get the wallet address of the agent`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } async _call(_input: string): Promise { - return this.solanaAgent.wallet_address.toString(); + return this.solanaKit.wallet_address.toString(); } } @@ -430,7 +430,7 @@ export class SolanaPumpfunTokenLaunchTool extends Tool { description: string, eg "PumpFun Token is a token on the Solana blockchain", imageUrl: string, eg "https://i.imgur.com/UFm07Np_d.png`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -464,7 +464,7 @@ export class SolanaPumpfunTokenLaunchTool extends Tool { this.validateInput(parsedInput); // Launch token with validated input - await this.solanaAgent.launchPumpFunToken( + await this.solanaKit.launchPumpFunToken( parsedInput.tokenName, parsedInput.tokenTicker, parsedInput.description, @@ -498,7 +498,7 @@ export class SolanaCreateImageTool extends Tool { description = "Create an image using OpenAI's DALL-E. Input should be a string prompt for the image."; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -511,7 +511,7 @@ export class SolanaCreateImageTool extends Tool { protected async _call(input: string): Promise { try { this.validateInput(input); - const result = await create_image(this.solanaAgent, input.trim()); + const result = await create_image(this.solanaKit, input.trim()); return JSON.stringify({ status: "success", @@ -535,7 +535,7 @@ export class SolanaLendAssetTool extends Tool { Inputs (input is a json string): amount: number, eg 1, 0.01 (required)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -543,7 +543,7 @@ export class SolanaLendAssetTool extends Tool { try { let amount = JSON.parse(input).amount || input; - const tx = await this.solanaAgent.lendAssets(amount); + const tx = await this.solanaKit.lendAssets(amount); return JSON.stringify({ status: "success", @@ -565,13 +565,13 @@ export class SolanaTPSCalculatorTool extends Tool { name = "solana_get_tps"; description = "Get the current TPS of the Solana network"; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } async _call(_input: string): Promise { try { - const tps = await this.solanaAgent.getTPS(); + const tps = await this.solanaKit.getTPS(); return `Solana (mainnet-beta) current transactions per second: ${tps}`; } catch (error: any) { return `Error fetching TPS: ${error.message}`; @@ -586,7 +586,7 @@ export class SolanaStakeTool extends Tool { Inputs ( input is a JSON string ): amount: number, eg 1 or 0.01 (required)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -594,7 +594,7 @@ export class SolanaStakeTool extends Tool { try { const parsedInput = JSON.parse(input) || Number(input); - const tx = await this.solanaAgent.stake(parsedInput.amount); + const tx = await this.solanaKit.stake(parsedInput.amount); return JSON.stringify({ status: "success", @@ -622,13 +622,13 @@ export class SolanaFetchPriceTool extends Tool { Inputs: - tokenId: string, the mint address of the token, e.g., "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } async _call(input: string): Promise { try { - const price = await this.solanaAgent.fetchTokenPrice(input.trim()); + const price = await this.solanaKit.fetchTokenPrice(input.trim()); return JSON.stringify({ status: "success", tokenId: input.trim(), @@ -651,7 +651,7 @@ export class SolanaTokenDataTool extends Tool { Inputs: mintAddress is required. mintAddress: string, eg "So11111111111111111111111111111111111111112" (required)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -659,8 +659,7 @@ export class SolanaTokenDataTool extends Tool { try { const parsedInput = input.trim(); - const tokenData = - await this.solanaAgent.getTokenDataByAddress(parsedInput); + const tokenData = await this.solanaKit.getTokenDataByAddress(parsedInput); return JSON.stringify({ status: "success", @@ -683,14 +682,14 @@ export class SolanaTokenDataByTickerTool extends Tool { Inputs: ticker is required. ticker: string, eg "USDC" (required)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } protected async _call(input: string): Promise { try { const ticker = input.trim(); - const tokenData = await this.solanaAgent.getTokenDataByTicker(ticker); + const tokenData = await this.solanaKit.getTokenDataByTicker(ticker); return JSON.stringify({ status: "success", tokenData: tokenData, @@ -717,7 +716,7 @@ export class SolanaCompressedAirdropTool extends Tool { priorityFeeInLamports: number, the priority fee in lamports. Default is 30_000. (optional) shouldLog: boolean, whether to log progress to stdout. Default is false. (optional)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -725,7 +724,7 @@ export class SolanaCompressedAirdropTool extends Tool { try { const parsedInput = JSON.parse(input); - const txs = await this.solanaAgent.sendCompressedAirdrop( + const txs = await this.solanaKit.sendCompressedAirdrop( parsedInput.mintAddress, parsedInput.amount, parsedInput.decimals, @@ -761,7 +760,7 @@ export class SolanaCreateSingleSidedWhirlpoolTool extends Tool { - maxPrice: number, eg: 5.0 (required, maximum price at which liquidity is added) - feeTier: number, eg: 0.30 (required, fee tier for the pool)`; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -781,7 +780,7 @@ export class SolanaCreateSingleSidedWhirlpoolTool extends Tool { ); } - const txId = await this.solanaAgent.createOrcaSingleSidedWhirlpool( + const txId = await this.solanaKit.createOrcaSingleSidedWhirlpool( depositTokenAmount, depositTokenMint, otherTokenMint, @@ -816,7 +815,7 @@ export class SolanaRaydiumCreateAmmV4 extends Tool { startTime: number(seconds), eg: now number or zero (required) `; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -824,7 +823,7 @@ export class SolanaRaydiumCreateAmmV4 extends Tool { try { let inputFormat = JSON.parse(input); - const tx = await this.solanaAgent.raydiumCreateAmmV4( + const tx = await this.solanaKit.raydiumCreateAmmV4( new PublicKey(inputFormat.marketId), new BN(inputFormat.baseAmount), new BN(inputFormat.quoteAmount), @@ -858,7 +857,7 @@ export class SolanaRaydiumCreateClmm extends Tool { startTime: number(seconds), eg: now number or zero (required) `; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -866,7 +865,7 @@ export class SolanaRaydiumCreateClmm extends Tool { try { let inputFormat = JSON.parse(input); - const tx = await this.solanaAgent.raydiumCreateClmm( + const tx = await this.solanaKit.raydiumCreateClmm( new PublicKey(inputFormat.mint1), new PublicKey(inputFormat.mint2), @@ -904,7 +903,7 @@ export class SolanaRaydiumCreateCpmm extends Tool { startTime: number(seconds), eg: now number or zero (required) `; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -912,7 +911,7 @@ export class SolanaRaydiumCreateCpmm extends Tool { try { let inputFormat = JSON.parse(input); - const tx = await this.solanaAgent.raydiumCreateCpmm( + const tx = await this.solanaKit.raydiumCreateCpmm( new PublicKey(inputFormat.mint1), new PublicKey(inputFormat.mint2), @@ -950,7 +949,7 @@ export class SolanaOpenbookCreateMarket extends Tool { tickSize: number (required) `; - constructor(private solanaAgent: SolanaAgent) { + constructor(private solanaKit: SolanaAgentKit) { super(); } @@ -958,7 +957,7 @@ export class SolanaOpenbookCreateMarket extends Tool { try { let inputFormat = JSON.parse(input); - const tx = await this.solanaAgent.openbookCreateMarket( + const tx = await this.solanaKit.openbookCreateMarket( new PublicKey(inputFormat.baseMint), new PublicKey(inputFormat.quoteMint), @@ -981,32 +980,32 @@ export class SolanaOpenbookCreateMarket extends Tool { } } -export function createSolanaTools(solanaAgent: SolanaAgent) { +export function createSolanaTools(solanaKit: SolanaAgentKit) { return [ - new SolanaBalanceTool(solanaAgent), - new SolanaTransferTool(solanaAgent), - new SolanaDeployTokenTool(solanaAgent), - new SolanaDeployCollectionTool(solanaAgent), - new SolanaMintNFTTool(solanaAgent), - new SolanaTradeTool(solanaAgent), - new SolanaRequestFundsTool(solanaAgent), - new SolanaRegisterDomainTool(solanaAgent), - new SolanaGetWalletAddressTool(solanaAgent), - new SolanaPumpfunTokenLaunchTool(solanaAgent), - new SolanaCreateImageTool(solanaAgent), - new SolanaLendAssetTool(solanaAgent), - new SolanaTPSCalculatorTool(solanaAgent), - new SolanaStakeTool(solanaAgent), - new SolanaFetchPriceTool(solanaAgent), - new SolanaResolveDomainTool(solanaAgent), - new SolanaGetDomainTool(solanaAgent), - new SolanaTokenDataTool(solanaAgent), - new SolanaTokenDataByTickerTool(solanaAgent), - new SolanaCompressedAirdropTool(solanaAgent), - new SolanaRaydiumCreateAmmV4(solanaAgent), - new SolanaRaydiumCreateClmm(solanaAgent), - new SolanaRaydiumCreateCpmm(solanaAgent), - new SolanaOpenbookCreateMarket(solanaAgent), - new SolanaCreateSingleSidedWhirlpoolTool(solanaAgent), + new SolanaBalanceTool(solanaKit), + new SolanaTransferTool(solanaKit), + new SolanaDeployTokenTool(solanaKit), + new SolanaDeployCollectionTool(solanaKit), + new SolanaMintNFTTool(solanaKit), + new SolanaTradeTool(solanaKit), + new SolanaRequestFundsTool(solanaKit), + new SolanaRegisterDomainTool(solanaKit), + new SolanaGetWalletAddressTool(solanaKit), + new SolanaPumpfunTokenLaunchTool(solanaKit), + new SolanaCreateImageTool(solanaKit), + new SolanaLendAssetTool(solanaKit), + new SolanaTPSCalculatorTool(solanaKit), + new SolanaStakeTool(solanaKit), + new SolanaFetchPriceTool(solanaKit), + new SolanaResolveDomainTool(solanaKit), + new SolanaGetDomainTool(solanaKit), + new SolanaTokenDataTool(solanaKit), + new SolanaTokenDataByTickerTool(solanaKit), + new SolanaCompressedAirdropTool(solanaKit), + new SolanaRaydiumCreateAmmV4(solanaKit), + new SolanaRaydiumCreateClmm(solanaKit), + new SolanaRaydiumCreateCpmm(solanaKit), + new SolanaOpenbookCreateMarket(solanaKit), + new SolanaCreateSingleSidedWhirlpoolTool(solanaKit), ]; } diff --git a/src/tools/create_image.ts b/src/tools/create_image.ts index c5660ae..b1b085d 100644 --- a/src/tools/create_image.ts +++ b/src/tools/create_image.ts @@ -1,4 +1,4 @@ -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import OpenAI from "openai"; /** @@ -10,7 +10,7 @@ import OpenAI from "openai"; * @returns Object containing the generated image URLs */ export async function create_image( - agent: SolanaAgent, + agent: SolanaAgentKit, prompt: string, size: "256x256" | "512x512" | "1024x1024" = "1024x1024", n: number = 1, diff --git a/src/tools/create_orca_single_sided_whirlpool.ts b/src/tools/create_orca_single_sided_whirlpool.ts index 095d8fc..bed5870 100644 --- a/src/tools/create_orca_single_sided_whirlpool.ts +++ b/src/tools/create_orca_single_sided_whirlpool.ts @@ -1,5 +1,5 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import { BN, Wallet } from "@coral-xyz/anchor"; import { Decimal } from "decimal.js"; import { @@ -99,7 +99,7 @@ export const FEE_TIERS = { * * @example * ```typescript - * import { SolanaAgentKit } from "your-sdk"; + * agent: SolanaAgentKitKit } from "your-sdk"; * import { PublicKey } from "@solana/web3.js"; * import { BN } from "@coral-xyz/anchor"; * import Decimal from "decimal.js"; @@ -125,7 +125,7 @@ export const FEE_TIERS = { * ``` */ export async function createOrcaSingleSidedWhirlpool( - agent: SolanaAgent, + agent: SolanaAgentKit, depositTokenAmount: BN, depositTokenMint: PublicKey, otherTokenMint: PublicKey, diff --git a/src/tools/deploy_collection.ts b/src/tools/deploy_collection.ts index 086d736..91e951c 100644 --- a/src/tools/deploy_collection.ts +++ b/src/tools/deploy_collection.ts @@ -1,4 +1,4 @@ -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import { generateSigner, keypairIdentity, @@ -23,7 +23,7 @@ import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; * @returns Object containing collection address and metadata */ export async function deploy_collection( - agent: SolanaAgent, + agent: SolanaAgentKit, options: CollectionOptions, ): Promise { try { diff --git a/src/tools/deploy_token.ts b/src/tools/deploy_token.ts index 5940141..812d4b4 100644 --- a/src/tools/deploy_token.ts +++ b/src/tools/deploy_token.ts @@ -1,4 +1,4 @@ -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import { PublicKey } from "@solana/web3.js"; import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; import { generateSigner, keypairIdentity } from "@metaplex-foundation/umi"; @@ -24,7 +24,7 @@ import { * @returns Object containing token mint address and initial account (if supply was minted) */ export async function deploy_token( - agent: SolanaAgent, + agent: SolanaAgentKit, name: string, uri: string, symbol: string, diff --git a/src/tools/get_balance.ts b/src/tools/get_balance.ts index fb70699..9e75daf 100644 --- a/src/tools/get_balance.ts +++ b/src/tools/get_balance.ts @@ -1,5 +1,5 @@ import { LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; /** * Get the balance of SOL or an SPL token for the agent's wallet @@ -8,7 +8,7 @@ import { SolanaAgent } from "../index"; * @returns Promise resolving to the balance as a number (in UI units) or null if account doesn't exist */ export async function get_balance( - agent: SolanaAgent, + agent: SolanaAgentKit, token_address?: PublicKey, ): Promise { if (!token_address) diff --git a/src/tools/get_primary_domain.ts b/src/tools/get_primary_domain.ts index 01f19b6..d54f294 100644 --- a/src/tools/get_primary_domain.ts +++ b/src/tools/get_primary_domain.ts @@ -1,6 +1,6 @@ import { getPrimaryDomain as _getPrimaryDomain } from "@bonfida/spl-name-service"; import { PublicKey } from "@solana/web3.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; /** * Retrieves the primary .sol domain associated with a given Solana public key. @@ -15,7 +15,7 @@ import { SolanaAgent } from "../index"; * @throws Error if the domain is stale or if the domain resolution fails */ export async function getPrimaryDomain( - agent: SolanaAgent, + agent: SolanaAgentKit, account: PublicKey, ): Promise { try { diff --git a/src/tools/get_tps.ts b/src/tools/get_tps.ts index 38eb356..7314ce3 100644 --- a/src/tools/get_tps.ts +++ b/src/tools/get_tps.ts @@ -1,4 +1,4 @@ -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; export async function getTPS(agent: SolanaAgentKit): Promise { const perfSamples = await agent.connection.getRecentPerformanceSamples(); diff --git a/src/tools/launch_pumpfun_token.ts b/src/tools/launch_pumpfun_token.ts index ce997b4..7cb22cf 100644 --- a/src/tools/launch_pumpfun_token.ts +++ b/src/tools/launch_pumpfun_token.ts @@ -55,7 +55,7 @@ async function uploadMetadata( } async function createTokenTransaction( - agent: SolanaAgent, + agent: SolanaAgentKit, mintKeypair: Keypair, metadataResponse: any, options?: PumpFunTokenOptions, @@ -149,7 +149,7 @@ async function signAndSendTransaction( * @returns - Signature of the transaction, mint address and metadata URI, if successful, else error */ export async function launchPumpFunToken( - agent: SolanaAgent, + agent: SolanaAgentKit, tokenName: string, tokenTicker: string, description: string, diff --git a/src/tools/lend.ts b/src/tools/lend.ts index f036aa7..41107cf 100644 --- a/src/tools/lend.ts +++ b/src/tools/lend.ts @@ -1,5 +1,5 @@ import { VersionedTransaction } from "@solana/web3.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; /** * Lend tokens for yields using Lulo @@ -8,7 +8,7 @@ import { SolanaAgent } from "../index"; * @returns Transaction signature */ export async function lendAsset( - agent: SolanaAgent, + agent: SolanaAgentKit, amount: number, ): Promise { try { diff --git a/src/tools/mint_nft.ts b/src/tools/mint_nft.ts index 97e5fd2..88b37e4 100644 --- a/src/tools/mint_nft.ts +++ b/src/tools/mint_nft.ts @@ -1,4 +1,4 @@ -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import { generateSigner, keypairIdentity } from "@metaplex-foundation/umi"; import { create, mplCore } from "@metaplex-foundation/mpl-core"; import { fetchCollection } from "@metaplex-foundation/mpl-core"; @@ -20,7 +20,7 @@ import { MintCollectionNFTResponse } from "../types"; * @returns Object containing NFT mint address and token account */ export async function mintCollectionNFT( - agent: SolanaAgent, + agent: SolanaAgentKit, collectionMint: PublicKey, metadata: { name: string; diff --git a/src/tools/openbook_create_market.ts b/src/tools/openbook_create_market.ts index 29dd829..c7c12aa 100644 --- a/src/tools/openbook_create_market.ts +++ b/src/tools/openbook_create_market.ts @@ -5,10 +5,10 @@ import { } from "@raydium-io/raydium-sdk-v2"; import { MintLayout, TOKEN_PROGRAM_ID } from "@solana/spl-token"; import { PublicKey } from "@solana/web3.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; export async function openbookCreateMarket( - agent: SolanaAgent, + agent: SolanaAgentKit, baseMint: PublicKey, quoteMint: PublicKey, lotSize: number = 1, diff --git a/src/tools/raydium_create_ammV4.ts b/src/tools/raydium_create_ammV4.ts index cc06431..98f641e 100644 --- a/src/tools/raydium_create_ammV4.ts +++ b/src/tools/raydium_create_ammV4.ts @@ -9,10 +9,10 @@ import { import { MintLayout, TOKEN_PROGRAM_ID } from "@solana/spl-token"; import { PublicKey } from "@solana/web3.js"; import BN from "bn.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; export async function raydiumCreateAmmV4( - agent: SolanaAgent, + agent: SolanaAgentKit, marketId: PublicKey, baseAmount: BN, quoteAmount: BN, diff --git a/src/tools/raydium_create_clmm.ts b/src/tools/raydium_create_clmm.ts index 2ce62f1..b77ab74 100644 --- a/src/tools/raydium_create_clmm.ts +++ b/src/tools/raydium_create_clmm.ts @@ -7,10 +7,10 @@ import { MintLayout } from "@solana/spl-token"; import { PublicKey } from "@solana/web3.js"; import BN from "bn.js"; import Decimal from "decimal.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; export async function raydiumCreateClmm( - agent: SolanaAgent, + agent: SolanaAgentKit, mint1: PublicKey, mint2: PublicKey, configId: PublicKey, diff --git a/src/tools/raydium_create_cpmm.ts b/src/tools/raydium_create_cpmm.ts index 6e129c6..d1c4dbd 100644 --- a/src/tools/raydium_create_cpmm.ts +++ b/src/tools/raydium_create_cpmm.ts @@ -7,10 +7,10 @@ import { import { MintLayout } from "@solana/spl-token"; import { PublicKey } from "@solana/web3.js"; import BN from "bn.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; export async function raydiumCreateCpmm( - agent: SolanaAgent, + agent: SolanaAgentKit, mintA: PublicKey, mintB: PublicKey, configId: PublicKey, diff --git a/src/tools/register_domain.ts b/src/tools/register_domain.ts index 20bcf79..6140ceb 100644 --- a/src/tools/register_domain.ts +++ b/src/tools/register_domain.ts @@ -1,6 +1,6 @@ import { registerDomainNameV2 } from "@bonfida/spl-name-service"; import { Transaction } from "@solana/web3.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { TOKENS } from "../constants"; @@ -12,7 +12,7 @@ import { TOKENS } from "../constants"; * @returns Transaction signature */ export async function registerDomain( - agent: SolanaAgent, + agent: SolanaAgentKit, name: string, spaceKB: number = 1, ): Promise { diff --git a/src/tools/request_faucet_funds.ts b/src/tools/request_faucet_funds.ts index dd44cb3..40e6f09 100644 --- a/src/tools/request_faucet_funds.ts +++ b/src/tools/request_faucet_funds.ts @@ -1,4 +1,4 @@ -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import { LAMPORTS_PER_SOL } from "@solana/web3.js"; /** @@ -8,7 +8,7 @@ import { LAMPORTS_PER_SOL } from "@solana/web3.js"; * @throws Error if the request fails or times out */ export async function request_faucet_funds( - agent: SolanaAgent, + agent: SolanaAgentKit, ): Promise { const tx = await agent.connection.requestAirdrop( agent.wallet_address, diff --git a/src/tools/resolve_sol_domain.ts b/src/tools/resolve_sol_domain.ts index e5c87a5..47a3419 100644 --- a/src/tools/resolve_sol_domain.ts +++ b/src/tools/resolve_sol_domain.ts @@ -1,6 +1,6 @@ import { resolve } from "@bonfida/spl-name-service"; import { PublicKey } from "@solana/web3.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; /** * Resolves a .sol domain to a Solana PublicKey. @@ -15,7 +15,7 @@ import { SolanaAgent } from "../index"; * @throws Error if the domain resolution fails */ export async function resolveSolDomain( - agent: SolanaAgent, + agent: SolanaAgentKit, domain: string, ): Promise { if (!domain || typeof domain !== "string") { diff --git a/src/tools/send_compressed_airdrop.ts b/src/tools/send_compressed_airdrop.ts index 3a80f42..2a66e47 100644 --- a/src/tools/send_compressed_airdrop.ts +++ b/src/tools/send_compressed_airdrop.ts @@ -5,7 +5,7 @@ import { PublicKey, TransactionInstruction, } from "@solana/web3.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import { buildAndSignTx, calculateComputeUnitPrice, @@ -56,7 +56,7 @@ export const getAirdropCostEstimate = ( * @param shouldLog Whether to log progress to stdout. Defaults to false. */ export async function sendCompressedAirdrop( - agent: SolanaAgent, + agent: SolanaAgentKit, mintAddress: PublicKey, amount: number, decimals: number, @@ -119,7 +119,7 @@ export async function sendCompressedAirdrop( } async function processAll( - agent: SolanaAgent, + agent: SolanaAgentKit, amount: number, mint: PublicKey, recipients: PublicKey[], diff --git a/src/tools/stake_with_jup.ts b/src/tools/stake_with_jup.ts index 981dd64..5f41788 100644 --- a/src/tools/stake_with_jup.ts +++ b/src/tools/stake_with_jup.ts @@ -1,5 +1,5 @@ import { VersionedTransaction } from "@solana/web3.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; /** * Stake SOL with Jup validator @@ -8,7 +8,7 @@ import { SolanaAgent } from "../index"; * @returns Transaction signature */ export async function stakeWithJup( - agent: SolanaAgent, + agent: SolanaAgentKit, amount: number, ): Promise { try { diff --git a/src/tools/trade.ts b/src/tools/trade.ts index 4c9b713..b391df0 100644 --- a/src/tools/trade.ts +++ b/src/tools/trade.ts @@ -3,7 +3,7 @@ import { PublicKey, LAMPORTS_PER_SOL, } from "@solana/web3.js"; -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants"; /** @@ -16,7 +16,7 @@ import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants"; * @returns Transaction signature */ export async function trade( - agent: SolanaAgent, + agent: SolanaAgentKit, outputMint: PublicKey, inputAmount: number, inputMint: PublicKey = TOKENS.USDC, diff --git a/src/tools/transfer.ts b/src/tools/transfer.ts index 93607de..1f31f50 100644 --- a/src/tools/transfer.ts +++ b/src/tools/transfer.ts @@ -1,4 +1,4 @@ -import { SolanaAgent } from "../index"; +import { SolanaAgentKit } from "../index"; import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; import { LAMPORTS_PER_SOL } from "@solana/web3.js"; import { @@ -16,7 +16,7 @@ import { * @returns Transaction signature */ export async function transfer( - agent: SolanaAgent, + agent: SolanaAgentKit, to: PublicKey, amount: number, mint?: PublicKey, diff --git a/src/utils/send_tx.ts b/src/utils/send_tx.ts index 65fafe4..bb232c0 100644 --- a/src/utils/send_tx.ts +++ b/src/utils/send_tx.ts @@ -1,4 +1,4 @@ -import { SolanaAgent } from "../agent"; +import { SolanaAgentKit } from "../agent"; import { Transaction, Keypair, TransactionInstruction } from "@solana/web3.js"; import { Connection, ComputeBudgetProgram } from "@solana/web3.js"; @@ -74,7 +74,7 @@ export async function getPriorityFees(connection: Connection): Promise<{ * @returns Transaction ID */ export async function sendTx( - agent: SolanaAgent, + agent: SolanaAgentKit, tx: Transaction, otherKeypairs?: Keypair[], ) { diff --git a/test/index.ts b/test/index.ts index b226ce4..cacded6 100644 --- a/test/index.ts +++ b/test/index.ts @@ -1,4 +1,4 @@ -import { SolanaAgent } from "../src"; +agent: SolanaAgentKit } from "../src"; import { createSolanaTools } from "../src/langchain"; import { HumanMessage } from "@langchain/core/messages"; import { MemorySaver } from "@langchain/langgraph"; From f76cc9cf8ec317389bfe9f733729b4e8d7767e1d Mon Sep 17 00:00:00 2001 From: Arihant Bansal <17180950+arihantbansal@users.noreply.github.com> Date: Sun, 22 Dec 2024 01:33:49 +0530 Subject: [PATCH 03/31] fix --- guides/add_your_own_tool.md | 2 +- src/tools/create_image.ts | 2 +- src/tools/create_orca_single_sided_whirlpool.ts | 2 +- src/tools/deploy_collection.ts | 2 +- src/tools/deploy_token.ts | 2 +- src/tools/get_balance.ts | 2 +- src/tools/get_primary_domain.ts | 2 +- src/tools/launch_pumpfun_token.ts | 2 +- src/tools/lend.ts | 2 +- src/tools/mint_nft.ts | 2 +- src/tools/register_domain.ts | 2 +- src/tools/request_faucet_funds.ts | 2 +- src/tools/resolve_sol_domain.ts | 2 +- src/tools/stake_with_jup.ts | 2 +- src/tools/trade.ts | 2 +- src/tools/transfer.ts | 2 +- src/utils/send_tx.ts | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/guides/add_your_own_tool.md b/guides/add_your_own_tool.md index 47782cb..1bcb200 100644 --- a/guides/add_your_own_tool.md +++ b/guides/add_your_own_tool.md @@ -53,7 +53,7 @@ export class CustomTool extends Tool { ### 3. Add Supporting Functions to SolanaAgentKit ```typescript:src/agent/index.ts -export class SolanaAgent { +export class SolanaAgentKit { // ... existing code ... async customFunction(input: string): Promise { diff --git a/src/tools/create_image.ts b/src/tools/create_image.ts index b1b085d..7fbb2cf 100644 --- a/src/tools/create_image.ts +++ b/src/tools/create_image.ts @@ -3,7 +3,7 @@ import OpenAI from "openai"; /** * Generate an image using OpenAI's DALL-E - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param prompt Text description of the image to generate * @param size Image size ('256x256', '512x512', or '1024x1024') (default: '1024x1024') * @param n Number of images to generate (default: 1) diff --git a/src/tools/create_orca_single_sided_whirlpool.ts b/src/tools/create_orca_single_sided_whirlpool.ts index bed5870..7f3c4a9 100644 --- a/src/tools/create_orca_single_sided_whirlpool.ts +++ b/src/tools/create_orca_single_sided_whirlpool.ts @@ -99,7 +99,7 @@ export const FEE_TIERS = { * * @example * ```typescript - * agent: SolanaAgentKitKit } from "your-sdk"; + * import { SolanaAgentKit } from "your-sdk"; * import { PublicKey } from "@solana/web3.js"; * import { BN } from "@coral-xyz/anchor"; * import Decimal from "decimal.js"; diff --git a/src/tools/deploy_collection.ts b/src/tools/deploy_collection.ts index 91e951c..10fef9d 100644 --- a/src/tools/deploy_collection.ts +++ b/src/tools/deploy_collection.ts @@ -18,7 +18,7 @@ import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; /** * Deploy a new NFT collection - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param options Collection options including name, URI, royalties, and creators * @returns Object containing collection address and metadata */ diff --git a/src/tools/deploy_token.ts b/src/tools/deploy_token.ts index 812d4b4..5b33a12 100644 --- a/src/tools/deploy_token.ts +++ b/src/tools/deploy_token.ts @@ -15,7 +15,7 @@ import { /** * Deploy a new SPL token - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param name Name of the token * @param uri URI for the token metadata * @param symbol Symbol of the token diff --git a/src/tools/get_balance.ts b/src/tools/get_balance.ts index 9e75daf..36cdfef 100644 --- a/src/tools/get_balance.ts +++ b/src/tools/get_balance.ts @@ -3,7 +3,7 @@ import { SolanaAgentKit } from "../index"; /** * Get the balance of SOL or an SPL token for the agent's wallet - * @param agent - SolanaAgent instance + * @param agent - SolanaAgentKit instance * @param token_address - Optional SPL token mint address. If not provided, returns SOL balance * @returns Promise resolving to the balance as a number (in UI units) or null if account doesn't exist */ diff --git a/src/tools/get_primary_domain.ts b/src/tools/get_primary_domain.ts index d54f294..1a2bd8c 100644 --- a/src/tools/get_primary_domain.ts +++ b/src/tools/get_primary_domain.ts @@ -9,7 +9,7 @@ import { SolanaAgentKit } from "../index"; * a specified Solana public key. If the primary domain is stale or an error occurs during * the resolution, it throws an error. * - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param account The Solana public key for which to retrieve the primary domain * @returns A promise that resolves to the primary .sol domain as a string * @throws Error if the domain is stale or if the domain resolution fails diff --git a/src/tools/launch_pumpfun_token.ts b/src/tools/launch_pumpfun_token.ts index 7cb22cf..0c3e6f5 100644 --- a/src/tools/launch_pumpfun_token.ts +++ b/src/tools/launch_pumpfun_token.ts @@ -140,7 +140,7 @@ async function signAndSendTransaction( /** * Launch a token on Pump.fun - * @param agent - SolanaAgent instance + * @param agent - SolanaAgentKit instance * @param tokenName - Name of the token * @param tokenTicker - Ticker of the token * @param description - Description of the token diff --git a/src/tools/lend.ts b/src/tools/lend.ts index 41107cf..732f00c 100644 --- a/src/tools/lend.ts +++ b/src/tools/lend.ts @@ -3,7 +3,7 @@ import { SolanaAgentKit } from "../index"; /** * Lend tokens for yields using Lulo - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param amount Amount of USDC to lend * @returns Transaction signature */ diff --git a/src/tools/mint_nft.ts b/src/tools/mint_nft.ts index 88b37e4..4c25b91 100644 --- a/src/tools/mint_nft.ts +++ b/src/tools/mint_nft.ts @@ -13,7 +13,7 @@ import { MintCollectionNFTResponse } from "../types"; /** * Mint a new NFT as part of an existing collection - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param collectionMint Address of the collection's master NFT * @param metadata NFT metadata object * @param recipient Optional recipient address (defaults to wallet address) diff --git a/src/tools/register_domain.ts b/src/tools/register_domain.ts index 6140ceb..1348001 100644 --- a/src/tools/register_domain.ts +++ b/src/tools/register_domain.ts @@ -6,7 +6,7 @@ import { TOKENS } from "../constants"; /** * Register a .sol domain name using Bonfida Name Service - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param name Domain name to register (without .sol) * @param spaceKB Space allocation in KB (max 10KB) * @returns Transaction signature diff --git a/src/tools/request_faucet_funds.ts b/src/tools/request_faucet_funds.ts index 40e6f09..bde8eed 100644 --- a/src/tools/request_faucet_funds.ts +++ b/src/tools/request_faucet_funds.ts @@ -3,7 +3,7 @@ import { LAMPORTS_PER_SOL } from "@solana/web3.js"; /** * Request SOL from the Solana faucet (devnet/testnet only) - * @param agent - SolanaAgent instance + * @param agent - SolanaAgentKit instance * @returns Transaction signature * @throws Error if the request fails or times out */ diff --git a/src/tools/resolve_sol_domain.ts b/src/tools/resolve_sol_domain.ts index 47a3419..6969a4c 100644 --- a/src/tools/resolve_sol_domain.ts +++ b/src/tools/resolve_sol_domain.ts @@ -9,7 +9,7 @@ import { SolanaAgentKit } from "../index"; * to the corresponding Solana PublicKey. The domain can be provided with or without * the .sol suffix. * - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param domain The .sol domain to resolve. This can be provided with or without the .sol TLD suffix * @returns A promise that resolves to the corresponding Solana PublicKey * @throws Error if the domain resolution fails diff --git a/src/tools/stake_with_jup.ts b/src/tools/stake_with_jup.ts index 5f41788..c05915b 100644 --- a/src/tools/stake_with_jup.ts +++ b/src/tools/stake_with_jup.ts @@ -3,7 +3,7 @@ import { SolanaAgentKit } from "../index"; /** * Stake SOL with Jup validator - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param amount Amount of SOL to stake * @returns Transaction signature */ diff --git a/src/tools/trade.ts b/src/tools/trade.ts index b391df0..b42cc2a 100644 --- a/src/tools/trade.ts +++ b/src/tools/trade.ts @@ -8,7 +8,7 @@ import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants"; /** * Swap tokens using Jupiter Exchange - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param outputMint Target token mint address * @param inputAmount Amount to swap (in token decimals) * @param inputMint Source token mint address (defaults to USDC) diff --git a/src/tools/transfer.ts b/src/tools/transfer.ts index 1f31f50..9e11dd7 100644 --- a/src/tools/transfer.ts +++ b/src/tools/transfer.ts @@ -9,7 +9,7 @@ import { /** * Transfer SOL or SPL tokens to a recipient - * @param agent SolanaAgent instance + * @param agent SolanaAgentKit instance * @param to Recipient's public key * @param amount Amount to transfer * @param mint Optional mint address for SPL tokens diff --git a/src/utils/send_tx.ts b/src/utils/send_tx.ts index bb232c0..593cbc8 100644 --- a/src/utils/send_tx.ts +++ b/src/utils/send_tx.ts @@ -69,7 +69,7 @@ export async function getPriorityFees(connection: Connection): Promise<{ /** * Send a transaction with priority fees - * @param agent - SolanaAgent instance + * @param agent - SolanaAgentKit instance * @param tx - Transaction to send * @returns Transaction ID */ From 81e70da0101b551ed0ab5b19776986cf4090f7c3 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 19:25:30 +0100 Subject: [PATCH 04/31] added domain methods --- src/tools/get_all_active_tlds.ts | 0 src/tools/get_all_registered_all_domains.ts | 0 src/tools/get_domains_on_tld.ts | 23 +++++++++++ src/tools/get_main_domain.ts | 21 +++++++++++ src/tools/lookup_owner.ts | 21 +++++++++++ src/tools/resolve_domain.ts | 42 +++++++++++++++++++++ 6 files changed, 107 insertions(+) create mode 100644 src/tools/get_all_active_tlds.ts create mode 100644 src/tools/get_all_registered_all_domains.ts create mode 100644 src/tools/get_domains_on_tld.ts create mode 100644 src/tools/get_main_domain.ts create mode 100644 src/tools/lookup_owner.ts create mode 100644 src/tools/resolve_domain.ts diff --git a/src/tools/get_all_active_tlds.ts b/src/tools/get_all_active_tlds.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/tools/get_all_registered_all_domains.ts b/src/tools/get_all_registered_all_domains.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/tools/get_domains_on_tld.ts b/src/tools/get_domains_on_tld.ts new file mode 100644 index 0000000..045f44a --- /dev/null +++ b/src/tools/get_domains_on_tld.ts @@ -0,0 +1,23 @@ +import { SolanaAgentKit } from "../agent"; +import { getOwnedAllDomains } from "./lookup_owner"; +import { PublicKey } from "@solana/web3.js"; + +/** + * Get all domains owned by an address for a specific TLD + * @param agent SolanaAgentKit instance + * @param owner Owner's public key + * @param tld Top-level domain (e.g., "sol") + * @returns Array of owned domain names for the specified TLD + */ +export async function getOwnedDomainsForTLD( + agent: SolanaAgentKit, + owner: PublicKey, + tld: string +): Promise { + try { + const allDomains = await getOwnedAllDomains(agent, owner); + return allDomains.filter(domain => domain.endsWith(`.${tld}`)); + } catch (error: any) { + throw new Error(`Failed to fetch domains for TLD: ${error.message}`); + } +} diff --git a/src/tools/get_main_domain.ts b/src/tools/get_main_domain.ts new file mode 100644 index 0000000..775c343 --- /dev/null +++ b/src/tools/get_main_domain.ts @@ -0,0 +1,21 @@ +import { getFavoriteDomain as _getFavoriteDomain } from "@bonfida/spl-name-service"; +import { PublicKey } from "@solana/web3.js"; + + +/** + * Get the user's main/favorite domain for a SolanaAgentKit instance + * @param agent SolanaAgentKit instance + * @param owner Owner's public key + * @returns Promise resolving to the main domain name or null if not set + */ +export async function getMainAllDomainsDomain( + agent: any, + owner: PublicKey +): Promise { + try { + const favDomain = await _getFavoriteDomain(agent.connection, owner); + return favDomain.stale ? null : favDomain.reverse; + } catch (error: any) { + throw new Error(`Failed to fetch main domain: ${error.message}`); + } +} \ No newline at end of file diff --git a/src/tools/lookup_owner.ts b/src/tools/lookup_owner.ts new file mode 100644 index 0000000..9243467 --- /dev/null +++ b/src/tools/lookup_owner.ts @@ -0,0 +1,21 @@ +import { getAllDomains } from "@bonfida/spl-name-service"; +import { SolanaAgentKit } from "../agent"; +import { PublicKey } from "@solana/web3.js"; + +/** + * Get all domains owned by a specific address + * @param agent SolanaAgentKit instance + * @param owner Owner's public key + * @returns Array of owned domain names + */ +export async function getOwnedAllDomains( + agent: SolanaAgentKit, + owner: PublicKey +): Promise { + try { + const domains = await getAllDomains(agent.connection, owner); + return domains.map(domain => domain.name); + } catch (error: any) { + throw new Error(`Failed to fetch owned domains: ${error.message}`); + } +} diff --git a/src/tools/resolve_domain.ts b/src/tools/resolve_domain.ts new file mode 100644 index 0000000..3ea5e41 --- /dev/null +++ b/src/tools/resolve_domain.ts @@ -0,0 +1,42 @@ +import { Buffer } from "buffer"; +import { PublicKey } from "@solana/web3.js"; +import { + getNameAccountKeySync, + NAME_PROGRAM_ID, +} from "@bonfida/spl-name-service"; +import { SolanaAgentKit } from "../index"; + +/** + * Resolve a domain to its public key + * @param agent SolanaAgentKit instance + * @param domain Domain name to resolve + * @returns Associated public key or null if not found + */ +export async function resolveAllDomains( + agent: SolanaAgentKit, + domain: string +): Promise { + try { + // Convert domain name to buffer for hashing + const hashedDomain = Buffer.from(domain); + + // Get the name account key using the new sync method + const nameAccountKey = getNameAccountKeySync( + hashedDomain, + undefined, // nameClass + undefined // nameParent + ); + + // Get the account info to retrieve the owner + const owner = await agent.connection.getAccountInfo(nameAccountKey); + + if (!owner) { + return null; + } + + // The owner's public key is stored in the data buffer starting at offset 32 + return new PublicKey(owner.data.slice(32, 64)); + } catch (error: any) { + throw new Error(`Domain resolution failed: ${error.message}`); + } +} From 3a29794ea90dd2b00a3d4aaa18c21b91a5cd650c Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 19:35:13 +0100 Subject: [PATCH 05/31] modified package lock --- package-lock.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..e69de29 From 32fef1da8f87eddaaa68723a865ba56f47dbaa39 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 20:12:16 +0100 Subject: [PATCH 06/31] feat:updated domains methods, added fixes --- src/tools/get_all_active_tlds.ts | 65 +++++++++++++++++++++ src/tools/get_all_registered_all_domains.ts | 36 ++++++++++++ src/tools/lookup_owner.ts | 2 +- 3 files changed, 102 insertions(+), 1 deletion(-) diff --git a/src/tools/get_all_active_tlds.ts b/src/tools/get_all_active_tlds.ts index e69de29..929fbfc 100644 --- a/src/tools/get_all_active_tlds.ts +++ b/src/tools/get_all_active_tlds.ts @@ -0,0 +1,65 @@ +import { + NameRegistryState, + getAllDomains, + ROOT_DOMAIN_ACCOUNT, +} from "@bonfida/spl-name-service"; +import { Connection, PublicKey } from "@solana/web3.js"; +import { SolanaAgentKit } from "../index"; + +/** + * Get all active top-level domains (TLDs) in the Solana name service + * @param agent SolanaAgentKit instance + * @returns Array of active TLD strings + */ +export async function getAllDomainsTLDs( + agent: SolanaAgentKit +): Promise { + try { + // Get the root domain record + const rootAccount = await NameRegistryState.retrieve( + agent.connection, + ROOT_DOMAIN_ACCOUNT + ); + + if (!rootAccount) { + throw new Error("Root domain account not found"); + } + + // Fetch all TLD records under the root domain + const tldAccounts = await agent.connection.getProgramAccounts( + new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"), + { + filters: [ + { + memcmp: { + offset: 0, + bytes: rootAccount.registry.owner.toBase58(), + }, + }, + ], + } + ); + + // Parse the TLD names from the accounts + const tlds: string[] = []; + for (const account of tldAccounts) { + const registry = await NameRegistryState.retrieve( + agent.connection, + account.pubkey + ); + + if (registry && registry.registry.data) { + const tldName = Buffer.from(registry.registry.data) + .toString() + .replace(/\0/g, ""); + if (tldName) { + tlds.push(tldName); + } + } + } + + return tlds; + } catch (error: any) { + throw new Error(`Failed to fetch TLDs: ${error.message}`); + } +} diff --git a/src/tools/get_all_registered_all_domains.ts b/src/tools/get_all_registered_all_domains.ts index e69de29..dc0f0a4 100644 --- a/src/tools/get_all_registered_all_domains.ts +++ b/src/tools/get_all_registered_all_domains.ts @@ -0,0 +1,36 @@ +import { getAllDomains } from "@bonfida/spl-name-service"; +import { SolanaAgentKit } from "../agent"; +import { PublicKey } from "@solana/web3.js"; +import { getAllDomainsTLDs } from "./get_all_active_tlds"; + +/** + * Get all registered domains across all TLDs + * @param agent SolanaAgentKit instance + * @returns Array of all registered domain names with their TLDs + */ +export async function getAllRegisteredAllDomains( + agent: SolanaAgentKit +): Promise { + try { + // First get all TLDs + const tlds = await getAllDomainsTLDs(agent); + const allDomains: string[] = []; + + // For each TLD, fetch all registered domains + for (const tld of tlds) { + const domains = await getAllDomains( + agent.connection, + new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"), + ); + + // Add domains with TLD suffix + domains.forEach((domain) => { + allDomains.push(`${domain}.${tld}`); + }); + } + + return allDomains; + } catch (error: any) { + throw new Error(`Failed to fetch all registered domains: ${error.message}`); + } +} diff --git a/src/tools/lookup_owner.ts b/src/tools/lookup_owner.ts index 9243467..cffd264 100644 --- a/src/tools/lookup_owner.ts +++ b/src/tools/lookup_owner.ts @@ -14,7 +14,7 @@ export async function getOwnedAllDomains( ): Promise { try { const domains = await getAllDomains(agent.connection, owner); - return domains.map(domain => domain.name); + return domains.map(domain => domain.toString()); } catch (error: any) { throw new Error(`Failed to fetch owned domains: ${error.message}`); } From 670ba08cf31b0c4dbcf8860863f9653d4435beb4 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 20:22:34 +0100 Subject: [PATCH 07/31] feat : added domain methods to solana agent kit --- src/agent/index.ts | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/agent/index.ts b/src/agent/index.ts index 721e464..13260b2 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -29,6 +29,12 @@ import { } from "../tools"; import { CollectionOptions, PumpFunTokenOptions } from "../types"; import { BN } from "@coral-xyz/anchor"; +import { getAllDomainsTLDs } from "../tools/get_all_active_tlds"; +import { getAllRegisteredAllDomains } from "../tools/get_all_registered_all_domains"; +import { getOwnedDomainsForTLD } from "../tools/get_domains_on_tld"; +import { getMainAllDomainsDomain } from "../tools/get_main_domain"; +import { getOwnedAllDomains } from "../tools/lookup_owner"; +import { resolveAllDomains } from "../tools/resolve_domain"; /** * Main class for interacting with Solana blockchain @@ -174,7 +180,7 @@ export class SolanaAgentKit { otherTokenMint: PublicKey, initialPrice: Decimal, maxPrice: Decimal, - feeTier: keyof typeof FEE_TIERS, + feeTier: keyof typeof FEE_TIERS ) { return createOrcaSingleSidedWhirlpool( this, @@ -184,7 +190,35 @@ export class SolanaAgentKit { initialPrice, maxPrice, feeTier - ) + ); + } + + // New domain-related methods + async resolveAllDomains(domain: string): Promise { + return resolveAllDomains(this, domain); + } + + async getOwnedAllDomains(owner: PublicKey): Promise { + return getOwnedAllDomains(this, owner); + } + + async getOwnedDomainsForTLD( + owner: PublicKey, + tld: string + ): Promise { + return getOwnedDomainsForTLD(this, owner, tld); + } + + async getAllDomainsTLDs(): Promise { + return getAllDomainsTLDs(this); + } + + async getAllRegisteredAllDomains(): Promise { + return getAllRegisteredAllDomains(this); + } + + async getMainAllDomainsDomain(owner: PublicKey): Promise { + return getMainAllDomainsDomain(this, owner); } async raydiumCreateAmmV4( From c21d340fb8a9eadf46019e808cc1d31e79c83015 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 21:03:58 +0100 Subject: [PATCH 08/31] feat:removed package-lock update pnpm lock, modified agent/index.ts --- src/agent/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/agent/index.ts b/src/agent/index.ts index 13260b2..b06947e 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -193,7 +193,6 @@ export class SolanaAgentKit { ); } - // New domain-related methods async resolveAllDomains(domain: string): Promise { return resolveAllDomains(this, domain); } From 8d96ca0eccfda36398c360d989dea082cd10ad5e Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 21:12:33 +0100 Subject: [PATCH 09/31] updated imports for methods --- src/agent/index.ts | 15 ++++++++------- src/tools/index.ts | 8 +++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/agent/index.ts b/src/agent/index.ts index b06947e..b6fa57d 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -25,16 +25,17 @@ import { stakeWithJup, sendCompressedAirdrop, createOrcaSingleSidedWhirlpool, - FEE_TIERS + FEE_TIERS, + getAllDomainsTLDs, + getAllRegisteredAllDomains, + getOwnedDomainsForTLD, + getMainAllDomainsDomain, + getOwnedAllDomains, + resolveAllDomains, } from "../tools"; import { CollectionOptions, PumpFunTokenOptions } from "../types"; import { BN } from "@coral-xyz/anchor"; -import { getAllDomainsTLDs } from "../tools/get_all_active_tlds"; -import { getAllRegisteredAllDomains } from "../tools/get_all_registered_all_domains"; -import { getOwnedDomainsForTLD } from "../tools/get_domains_on_tld"; -import { getMainAllDomainsDomain } from "../tools/get_main_domain"; -import { getOwnedAllDomains } from "../tools/lookup_owner"; -import { resolveAllDomains } from "../tools/resolve_domain"; +import Decimal from "decimal.js"; /** * Main class for interacting with Solana blockchain diff --git a/src/tools/index.ts b/src/tools/index.ts index 303cde2..ef12932 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -16,7 +16,13 @@ export * from "./stake_with_jup"; export * from "./fetch_price"; export * from "./send_compressed_airdrop"; -export * from "./create_orca_single_sided_whirlpool";export * from "./raydium_create_ammV4"; +export * from "./create_orca_single_sided_whirlpool"; +export * from "../tools/get_all_active_tlds"; +export * from "../tools/get_all_registered_all_domains"; +export * from "../tools/get_domains_on_tld"; +export * from "../tools/get_main_domain"; +export * from "../tools/lookup_owner"; +export * from "../tools/resolve_domain";export * from "./raydium_create_ammV4"; export * from "./raydium_create_clmm"; export * from "./raydium_create_cpmm"; export * from "./openbook_create_market"; \ No newline at end of file From beaf06192922a151c91b8eb21935ba6c1b7c785d Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 21:26:06 +0100 Subject: [PATCH 10/31] feat: update imports in index.ts --- src/tools/index.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tools/index.ts b/src/tools/index.ts index ef12932..be1f9d3 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -17,12 +17,14 @@ export * from "./fetch_price"; export * from "./send_compressed_airdrop"; export * from "./create_orca_single_sided_whirlpool"; -export * from "../tools/get_all_active_tlds"; -export * from "../tools/get_all_registered_all_domains"; -export * from "../tools/get_domains_on_tld"; -export * from "../tools/get_main_domain"; -export * from "../tools/lookup_owner"; -export * from "../tools/resolve_domain";export * from "./raydium_create_ammV4"; +export * from "./get_all_active_tlds"; +export * from "./get_all_registered_all_domains"; +export * from "./get_domains_on_tld"; +export * from "./get_main_domain"; +export * from "./lookup_owner"; +export * from "./resolve_domain"; + +export * from "./raydium_create_ammV4"; export * from "./raydium_create_clmm"; export * from "./raydium_create_cpmm"; export * from "./openbook_create_market"; \ No newline at end of file From cdec8ed32d6a1522f6670dfcbfd594531e043f93 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Sat, 21 Dec 2024 20:53:00 +0100 Subject: [PATCH 11/31] feat: added langchain class, refactored methods to use tlb parser, wrote and ran tests --- package-lock.json | 0 package.json | 5 +- pnpm-lock.yaml | 448 ++++++++++++++++++ src/agent/index.ts | 42 +- src/langchain/index.ts | 189 ++++++++ src/tools/get_all_active_tlds.ts | 65 --- src/tools/get_all_domains_tlds.ts | 21 + src/tools/get_all_registered_all_domains.ts | 4 +- ...main.ts => get_main_all_domains_domain.ts} | 13 +- src/tools/get_owned_all_domains.ts | 20 + ...on_tld.ts => get_owned_domains_for_tld.ts} | 18 +- src/tools/index.ts | 10 +- src/tools/lookup_owner.ts | 21 - src/tools/resolve_domain.ts | 36 +- test/domain_methods.test.ts | 146 ++++++ 15 files changed, 884 insertions(+), 154 deletions(-) delete mode 100644 package-lock.json delete mode 100644 src/tools/get_all_active_tlds.ts create mode 100644 src/tools/get_all_domains_tlds.ts rename src/tools/{get_main_domain.ts => get_main_all_domains_domain.ts} (68%) create mode 100644 src/tools/get_owned_all_domains.ts rename src/tools/{get_domains_on_tld.ts => get_owned_domains_for_tld.ts} (54%) delete mode 100644 src/tools/lookup_owner.ts create mode 100644 test/domain_methods.test.ts diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index e69de29..0000000 diff --git a/package.json b/package.json index 5c085fe..147688f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "build": "tsc", "docs": "typedoc src --out docs", - "test": "ts-node test/index.ts", + "test": "ts-node test/**/*.ts", "generate": "ts-node src/utils/keypair.ts" }, "engines": { @@ -32,6 +32,7 @@ "@metaplex-foundation/umi": "^0.9.2", "@metaplex-foundation/umi-bundle-defaults": "^0.9.2", "@metaplex-foundation/umi-web3js-adapters": "^0.9.2", + "@onsol/tldparser": "^0.6.7", "@orca-so/common-sdk": "0.6.4", "@orca-so/whirlpools-sdk": "^0.13.12", "@raydium-io/raydium-sdk-v2": "0.1.95-alpha", @@ -39,6 +40,7 @@ "@solana/web3.js": "^1.95.4", "bn.js": "^5.2.1", "bs58": "^6.0.0", + "chai": "^5.1.2", "decimal.js": "^10.4.3", "dotenv": "^16.4.5", "form-data": "^4.0.1", @@ -48,6 +50,7 @@ }, "devDependencies": { "@types/bn.js": "^5.1.5", + "@types/chai": "^5.0.1", "@types/node": "^22.9.0", "ts-node": "^10.9.2", "typescript": "^5.7.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7aa38c3..cb9472e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,6 +47,9 @@ importers: '@metaplex-foundation/umi-web3js-adapters': specifier: ^0.9.2 version: 0.9.2(@metaplex-foundation/umi@0.9.2)(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + '@onsol/tldparser': + specifier: ^0.6.7 + version: 0.6.7(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bn.js@5.2.1)(borsh@2.0.0)(buffer@6.0.3)(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@orca-so/common-sdk': specifier: 0.6.4 version: 0.6.4(@solana/spl-token@0.4.9(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10))(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(decimal.js@10.4.3) @@ -68,6 +71,9 @@ importers: bs58: specifier: ^6.0.0 version: 6.0.0 + chai: + specifier: ^5.1.2 + version: 5.1.2 decimal.js: specifier: ^10.4.3 version: 10.4.3 @@ -90,6 +96,9 @@ importers: '@types/bn.js': specifier: ^5.1.5 version: 5.1.6 + '@types/chai': + specifier: ^5.0.1 + version: 5.0.1 '@types/node': specifier: ^22.9.0 version: 22.10.2 @@ -133,6 +142,15 @@ packages: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} + '@ethersproject/bytes@5.7.0': + resolution: {integrity: sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==} + + '@ethersproject/logger@5.7.0': + resolution: {integrity: sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==} + + '@ethersproject/sha2@5.7.0': + resolution: {integrity: sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==} + '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} @@ -188,6 +206,12 @@ packages: '@lightprotocol/stateless.js@0.17.1': resolution: {integrity: sha512-EjId1n33A6dBwpce33Wsa/fs/CDKtMtRrkxbApH0alXrnEXmbW6QhIViXOrKYXjZ4uJQM1xsBtsKe0vqJ4nbtQ==} + '@metaplex-foundation/beet-solana@0.4.1': + resolution: {integrity: sha512-/6o32FNUtwK8tjhotrvU/vorP7umBuRFvBZrC6XCk51aKidBHe5LPVPA5AjGPbV3oftMfRuXPNd9yAGeEqeCDQ==} + + '@metaplex-foundation/beet@0.7.2': + resolution: {integrity: sha512-K+g3WhyFxKPc0xIvcIjNyV1eaTVJTiuaHZpig7Xx0MuYRMoJLLvhLTnUXhFdR5Tu2l2QSyKwfyXDgZlzhULqFg==} + '@metaplex-foundation/mpl-core@1.1.1': resolution: {integrity: sha512-h1kLw+cGaV8SiykoHDb1/G01+VYqtJXAt0uGuO5+2Towsdtc6ET4M62iqUnh4EacTVMIW1yYHsKsG/LYWBCKaA==} peerDependencies: @@ -300,6 +324,15 @@ packages: resolution: {integrity: sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==} engines: {node: ^14.21.3 || >=16} + '@onsol/tldparser@0.6.7': + resolution: {integrity: sha512-QwkRDLyC514pxeplCCXZ2kTiRcJSeUrpp+9o2XqLbePy/qzZGGG8I0UbXUKuWVD/bUL1zAm21+D+Eu30OKwcQg==} + engines: {node: '>=14'} + peerDependencies: + '@solana/web3.js': ^1.95.3 + bn.js: ^5.2.1 + borsh: ^0.7.0 + buffer: 6.0.1 + '@orca-so/common-sdk@0.6.4': resolution: {integrity: sha512-iOiC6exTA9t2CEOaUPoWlNP3soN/1yZFjoz1mSf7NvOqo/PJZeIdWpB7BRXwU0mGGatjxU4SFgMGQ8NrSx+ONw==} peerDependencies: @@ -513,9 +546,15 @@ packages: '@types/bn.js@5.1.6': resolution: {integrity: sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w==} + '@types/chai@5.0.1': + resolution: {integrity: sha512-5T8ajsg3M/FOncpLYW7sdOcD6yf4+722sze/tc4KQV0P8Z2rAr3SAuHCIkYmYpt8VbcQlnz8SxlOlPQYefe4cA==} + '@types/connect@3.4.38': resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} @@ -583,15 +622,29 @@ packages: resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} engines: {node: '>=10'} + ansicolors@0.3.2: + resolution: {integrity: sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==} + arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + assert@2.1.0: + resolution: {integrity: sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==} + + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + available-typed-arrays@1.0.7: + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} + engines: {node: '>= 0.4'} + axios@1.7.9: resolution: {integrity: sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==} @@ -658,6 +711,18 @@ packages: resolution: {integrity: sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==} engines: {node: '>=6.14.2'} + call-bind-apply-helpers@1.0.1: + resolution: {integrity: sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==} + engines: {node: '>= 0.4'} + + call-bind@1.0.8: + resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==} + engines: {node: '>= 0.4'} + + call-bound@1.0.3: + resolution: {integrity: sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==} + engines: {node: '>= 0.4'} + camelcase@6.3.0: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} @@ -665,6 +730,10 @@ packages: ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} + chai@5.1.2: + resolution: {integrity: sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==} + engines: {node: '>=12'} + chalk@5.4.0: resolution: {integrity: sha512-ZkD35Mx92acjB2yNJgziGqT9oKHEOxjTBTDRpOsRWtdecL/0jM3z5kM/CTzHWvHIen1GvkM85p6TuFfDGfc8/Q==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} @@ -675,6 +744,10 @@ packages: character-entities-legacy@3.0.0: resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==} + check-error@2.1.1: + resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} + engines: {node: '>= 16'} + combined-stream@1.0.8: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} @@ -706,6 +779,15 @@ packages: dayjs@1.11.13: resolution: {integrity: sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==} + debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + decamelize@1.2.0: resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} engines: {node: '>=0.10.0'} @@ -716,6 +798,18 @@ packages: decimal.js@10.4.3: resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + + define-data-property@1.1.4: + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} + engines: {node: '>= 0.4'} + + define-properties@1.2.1: + resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} + engines: {node: '>= 0.4'} + delay@5.0.0: resolution: {integrity: sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==} engines: {node: '>=10'} @@ -742,6 +836,10 @@ packages: resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} engines: {node: '>=12'} + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + emoji-regex-xs@1.0.0: resolution: {integrity: sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==} @@ -749,6 +847,18 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + + es-object-atoms@1.0.0: + resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} + engines: {node: '>= 0.4'} + es6-promise@4.2.8: resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} @@ -787,6 +897,9 @@ packages: debug: optional: true + for-each@0.3.3: + resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + form-data-encoder@1.7.2: resolution: {integrity: sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==} @@ -798,6 +911,17 @@ packages: resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==} engines: {node: '>= 12.20'} + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + get-intrinsic@1.2.6: + resolution: {integrity: sha512-qxsEs+9A+u85HhllWJJFicJfPDhRmjzoYdl64aMWW9yRIJmSyxdn8IEkuIM530/7T+lv0TIHd8L6Q/ra0tEoeA==} + engines: {node: '>= 0.4'} + + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -807,6 +931,24 @@ packages: groq-sdk@0.5.0: resolution: {integrity: sha512-RVmhW7qZ+XZoy5fIuSdx/LGQJONpL8MHgZEW7dFwTdgkzStub2XQx6OKv28CHogijdwH41J+Npj/z2jBPu3vmw==} + has-property-descriptors@1.0.2: + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} + + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + + hash.js@1.1.7: + resolution: {integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==} + + hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} + hast-util-to-html@9.0.4: resolution: {integrity: sha512-wxQzXtdbhiwGAUKrnQJXlOPmHnEehzphwkK7aluUPQ+lEc1xefC8pblMgpp2w5ldBTEfveRIrADcrhGIWrlTDA==} @@ -822,10 +964,33 @@ packages: ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + ipaddr.js@2.2.0: resolution: {integrity: sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==} engines: {node: '>= 10'} + is-arguments@1.2.0: + resolution: {integrity: sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==} + engines: {node: '>= 0.4'} + + is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + + is-generator-function@1.0.10: + resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} + engines: {node: '>= 0.4'} + + is-nan@1.3.2: + resolution: {integrity: sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==} + engines: {node: '>= 0.4'} + + is-typed-array@1.1.15: + resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} + engines: {node: '>= 0.4'} + isomorphic-ws@4.0.1: resolution: {integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==} peerDependencies: @@ -925,6 +1090,9 @@ packages: lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + loupe@3.1.2: + resolution: {integrity: sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==} + lower-case@2.0.2: resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} @@ -938,6 +1106,10 @@ packages: resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==} hasBin: true + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + mdast-util-to-hast@13.2.0: resolution: {integrity: sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==} @@ -967,6 +1139,9 @@ packages: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} + minimalistic-assert@1.0.1: + resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} + minimatch@9.0.5: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} @@ -1001,6 +1176,18 @@ packages: resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==} hasBin: true + object-is@1.1.6: + resolution: {integrity: sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==} + engines: {node: '>= 0.4'} + + object-keys@1.1.1: + resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} + engines: {node: '>= 0.4'} + + object.assign@4.1.7: + resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==} + engines: {node: '>= 0.4'} + oniguruma-to-es@0.8.0: resolution: {integrity: sha512-rY+/a6b+uCgoYIL9itjY0x99UUDHXmGaw7Jjk5ZvM/3cxDJifyxFr/Zm4tTmF6Tre18gAakJo7AzhKUeMNLgHA==} @@ -1038,6 +1225,14 @@ packages: pako@2.1.0: resolution: {integrity: sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==} + pathval@2.0.0: + resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} + engines: {node: '>= 14.16'} + + possible-typed-array-names@1.0.0: + resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} + engines: {node: '>= 0.4'} + property-information@6.5.0: resolution: {integrity: sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==} @@ -1079,6 +1274,10 @@ packages: engines: {node: '>=10'} hasBin: true + set-function-length@1.2.2: + resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} + engines: {node: '>= 0.4'} + shiki@1.24.3: resolution: {integrity: sha512-eMeX/ehE2IDKVs71kB4zVcDHjutNcOtm+yIRuR4sA6ThBbdFI0DffGJiyoKCodj0xRGxIoWC3pk/Anmm5mzHmA==} @@ -1197,6 +1396,9 @@ packages: resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} engines: {node: '>=6.14.2'} + util@0.12.5: + resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + uuid@10.0.0: resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} hasBin: true @@ -1232,6 +1434,10 @@ packages: whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + which-typed-array@1.1.18: + resolution: {integrity: sha512-qEcY+KJYlWyLH9vNbsr6/5j59AXk5ni5aakf8ldzBvGde6Iz4sxZGkJyWSAueTG7QhOvNRYb1lDdFmL5Td0QKA==} + engines: {node: '>= 0.4'} + ws@7.5.10: resolution: {integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==} engines: {node: '>=8.3.0'} @@ -1341,6 +1547,18 @@ snapshots: dependencies: '@jridgewell/trace-mapping': 0.3.9 + '@ethersproject/bytes@5.7.0': + dependencies: + '@ethersproject/logger': 5.7.0 + + '@ethersproject/logger@5.7.0': {} + + '@ethersproject/sha2@5.7.0': + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + hash.js: 1.1.7 + '@jridgewell/resolve-uri@3.1.2': {} '@jridgewell/sourcemap-codec@1.5.0': {} @@ -1440,6 +1658,27 @@ snapshots: - encoding - utf-8-validate + '@metaplex-foundation/beet-solana@0.4.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@metaplex-foundation/beet': 0.7.2 + '@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bs58: 5.0.0 + debug: 4.4.0 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + + '@metaplex-foundation/beet@0.7.2': + dependencies: + ansicolors: 0.3.2 + assert: 2.1.0 + bn.js: 5.2.1 + debug: 4.4.0 + transitivePeerDependencies: + - supports-color + '@metaplex-foundation/mpl-core@1.1.1(@metaplex-foundation/umi@0.9.2)(@noble/hashes@1.6.1)': dependencies: '@metaplex-foundation/umi': 0.9.2 @@ -1560,6 +1799,20 @@ snapshots: '@noble/hashes@1.6.1': {} + '@onsol/tldparser@0.6.7(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bn.js@5.2.1)(borsh@2.0.0)(buffer@6.0.3)(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@ethersproject/sha2': 5.7.0 + '@metaplex-foundation/beet-solana': 0.4.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bn.js: 5.2.1 + borsh: 2.0.0 + buffer: 6.0.3 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + '@orca-so/common-sdk@0.6.4(@solana/spl-token@0.4.9(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10))(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(decimal.js@10.4.3)': dependencies: '@solana/spl-token': 0.4.9(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10) @@ -1942,10 +2195,16 @@ snapshots: dependencies: '@types/node': 22.10.2 + '@types/chai@5.0.1': + dependencies: + '@types/deep-eql': 4.0.2 + '@types/connect@3.4.38': dependencies: '@types/node': 22.10.2 + '@types/deep-eql@4.0.2': {} + '@types/hast@3.0.4': dependencies: '@types/unist': 3.0.3 @@ -2010,12 +2269,28 @@ snapshots: ansi-styles@5.2.0: {} + ansicolors@0.3.2: {} + arg@4.1.3: {} argparse@2.0.1: {} + assert@2.1.0: + dependencies: + call-bind: 1.0.8 + is-nan: 1.3.2 + object-is: 1.1.6 + object.assign: 4.1.7 + util: 0.12.5 + + assertion-error@2.0.1: {} + asynckit@0.4.0: {} + available-typed-arrays@1.0.7: + dependencies: + possible-typed-array-names: 1.0.0 + axios@1.7.9: dependencies: follow-redirects: 1.15.9 @@ -2088,16 +2363,43 @@ snapshots: node-gyp-build: 4.8.4 optional: true + call-bind-apply-helpers@1.0.1: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + + call-bind@1.0.8: + dependencies: + call-bind-apply-helpers: 1.0.1 + es-define-property: 1.0.1 + get-intrinsic: 1.2.6 + set-function-length: 1.2.2 + + call-bound@1.0.3: + dependencies: + call-bind-apply-helpers: 1.0.1 + get-intrinsic: 1.2.6 + camelcase@6.3.0: {} ccount@2.0.1: {} + chai@5.1.2: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.1 + deep-eql: 5.0.2 + loupe: 3.1.2 + pathval: 2.0.0 + chalk@5.4.0: {} character-entities-html4@2.1.0: {} character-entities-legacy@3.0.0: {} + check-error@2.1.1: {} + combined-stream@1.0.8: dependencies: delayed-stream: 1.0.0 @@ -2122,12 +2424,30 @@ snapshots: dayjs@1.11.13: {} + debug@4.4.0: + dependencies: + ms: 2.1.3 + decamelize@1.2.0: {} decimal.js-light@2.5.1: {} decimal.js@10.4.3: {} + deep-eql@5.0.2: {} + + define-data-property@1.1.4: + dependencies: + es-define-property: 1.0.1 + es-errors: 1.3.0 + gopd: 1.2.0 + + define-properties@1.2.1: + dependencies: + define-data-property: 1.1.4 + has-property-descriptors: 1.0.2 + object-keys: 1.1.1 + delay@5.0.0: {} delayed-stream@1.0.0: {} @@ -2147,10 +2467,24 @@ snapshots: dotenv@16.4.7: {} + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.1 + es-errors: 1.3.0 + gopd: 1.2.0 + emoji-regex-xs@1.0.0: {} entities@4.5.0: {} + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + + es-object-atoms@1.0.0: + dependencies: + es-errors: 1.3.0 + es6-promise@4.2.8: {} es6-promisify@5.0.0: @@ -2173,6 +2507,10 @@ snapshots: follow-redirects@1.15.9: {} + for-each@0.3.3: + dependencies: + is-callable: 1.2.7 + form-data-encoder@1.7.2: {} form-data@4.0.1: @@ -2186,6 +2524,23 @@ snapshots: node-domexception: 1.0.0 web-streams-polyfill: 4.0.0-beta.3 + function-bind@1.1.2: {} + + get-intrinsic@1.2.6: + dependencies: + call-bind-apply-helpers: 1.0.1 + dunder-proto: 1.0.1 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.0.0 + function-bind: 1.1.2 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.2 + math-intrinsics: 1.1.0 + + gopd@1.2.0: {} + graceful-fs@4.2.11: optional: true @@ -2207,6 +2562,25 @@ snapshots: transitivePeerDependencies: - encoding + has-property-descriptors@1.0.2: + dependencies: + es-define-property: 1.0.1 + + has-symbols@1.1.0: {} + + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 + + hash.js@1.1.7: + dependencies: + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + + hasown@2.0.2: + dependencies: + function-bind: 1.1.2 + hast-util-to-html@9.0.4: dependencies: '@types/hast': 3.0.4 @@ -2233,8 +2607,30 @@ snapshots: ieee754@1.2.1: {} + inherits@2.0.4: {} + ipaddr.js@2.2.0: {} + is-arguments@1.2.0: + dependencies: + call-bound: 1.0.3 + has-tostringtag: 1.0.2 + + is-callable@1.2.7: {} + + is-generator-function@1.0.10: + dependencies: + has-tostringtag: 1.0.2 + + is-nan@1.3.2: + dependencies: + call-bind: 1.0.8 + define-properties: 1.2.1 + + is-typed-array@1.1.15: + dependencies: + which-typed-array: 1.1.18 + isomorphic-ws@4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)): dependencies: ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) @@ -2320,6 +2716,8 @@ snapshots: lodash@4.17.21: {} + loupe@3.1.2: {} + lower-case@2.0.2: dependencies: tslib: 2.8.1 @@ -2337,6 +2735,8 @@ snapshots: punycode.js: 2.3.1 uc.micro: 2.1.0 + math-intrinsics@1.1.0: {} + mdast-util-to-hast@13.2.0: dependencies: '@types/hast': 3.0.4 @@ -2374,6 +2774,8 @@ snapshots: dependencies: mime-db: 1.52.0 + minimalistic-assert@1.0.1: {} + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 @@ -2398,6 +2800,22 @@ snapshots: node-gyp-build@4.8.4: optional: true + object-is@1.1.6: + dependencies: + call-bind: 1.0.8 + define-properties: 1.2.1 + + object-keys@1.1.1: {} + + object.assign@4.1.7: + dependencies: + call-bind: 1.0.8 + call-bound: 1.0.3 + define-properties: 1.2.1 + es-object-atoms: 1.0.0 + has-symbols: 1.1.0 + object-keys: 1.1.1 + oniguruma-to-es@0.8.0: dependencies: emoji-regex-xs: 1.0.0 @@ -2440,6 +2858,10 @@ snapshots: pako@2.1.0: {} + pathval@2.0.0: {} + + possible-typed-array-names@1.0.0: {} + property-information@6.5.0: {} proxy-from-env@1.1.0: {} @@ -2479,6 +2901,15 @@ snapshots: semver@7.6.3: {} + set-function-length@1.2.2: + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.2.6 + gopd: 1.2.0 + has-property-descriptors: 1.0.2 + shiki@1.24.3: dependencies: '@shikijs/core': 1.24.3 @@ -2602,6 +3033,14 @@ snapshots: node-gyp-build: 4.8.4 optional: true + util@0.12.5: + dependencies: + inherits: 2.0.4 + is-arguments: 1.2.0 + is-generator-function: 1.0.10 + is-typed-array: 1.1.15 + which-typed-array: 1.1.18 + uuid@10.0.0: {} uuid@8.3.2: {} @@ -2631,6 +3070,15 @@ snapshots: tr46: 0.0.3 webidl-conversions: 3.0.1 + which-typed-array@1.1.18: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.3 + for-each: 0.3.3 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10): optionalDependencies: bufferutil: 4.0.8 diff --git a/src/agent/index.ts b/src/agent/index.ts index b6fa57d..b4b7f80 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -35,7 +35,7 @@ import { } from "../tools"; import { CollectionOptions, PumpFunTokenOptions } from "../types"; import { BN } from "@coral-xyz/anchor"; -import Decimal from "decimal.js"; +import { NameAccountAndDomain } from "@onsol/tldparser"; /** * Main class for interacting with Solana blockchain @@ -194,22 +194,26 @@ export class SolanaAgentKit { ); } - async resolveAllDomains(domain: string): Promise { + async resolveAllDomains(domain: string): Promise { return resolveAllDomains(this, domain); } - async getOwnedAllDomains(owner: PublicKey): Promise { + async getOwnedAllDomains( + owner: PublicKey + ): Promise { return getOwnedAllDomains(this, owner); } async getOwnedDomainsForTLD( - owner: PublicKey, tld: string - ): Promise { - return getOwnedDomainsForTLD(this, owner, tld); + ):Promise { + return getOwnedDomainsForTLD(this, tld); } - async getAllDomainsTLDs(): Promise { + async getAllDomainsTLDs(): Promise> { return getAllDomainsTLDs(this); } @@ -227,7 +231,7 @@ export class SolanaAgentKit { baseAmount: BN, quoteAmount: BN, - startTime: BN, + startTime: BN ) { return raydiumCreateAmmV4( this, @@ -236,8 +240,8 @@ export class SolanaAgentKit { baseAmount, quoteAmount, - startTime, - ) + startTime + ); } async raydiumCreateClmm( @@ -247,7 +251,7 @@ export class SolanaAgentKit { configId: PublicKey, initialPrice: Decimal, - startTime: BN, + startTime: BN ) { return raydiumCreateClmm( this, @@ -258,8 +262,8 @@ export class SolanaAgentKit { configId, initialPrice, - startTime, - ) + startTime + ); } async raydiumCreateCpmm( @@ -271,7 +275,7 @@ export class SolanaAgentKit { mintAAmount: BN, mintBAmount: BN, - startTime: BN, + startTime: BN ) { return raydiumCreateCpmm( this, @@ -284,8 +288,8 @@ export class SolanaAgentKit { mintAAmount, mintBAmount, - startTime, - ) + startTime + ); } async openbookCreateMarket( @@ -293,7 +297,7 @@ export class SolanaAgentKit { quoteMint: PublicKey, lotSize: number = 1, - tickSize: number = 0.01, + tickSize: number = 0.01 ) { return openbookCreateMarket( this, @@ -301,7 +305,7 @@ export class SolanaAgentKit { quoteMint, lotSize, - tickSize, - ) + tickSize + ); } } diff --git a/src/langchain/index.ts b/src/langchain/index.ts index 930b0bf..a4bfe2a 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -980,6 +980,189 @@ export class SolanaOpenbookCreateMarket extends Tool { } } +export class SolanaResolveDomain extends Tool { + name = "solana_resolve_domain"; + description = `Resolve a Solana domain name to its owner's public key + Inputs (input is a json string): + domain: string (required) - The domain name to resolve (e.g., "mydomain.sol") + `; + + constructor(private solanaKit: SolanaAgentKit) { + super(); + } + + async _call(input: string): Promise { + try { + let inputFormat = JSON.parse(input); + const owner = await this.solanaKit.resolveAllDomains(inputFormat.domain); + + return JSON.stringify({ + status: "success", + message: "Domain resolved successfully", + owner: owner?.toString(), + }); + } catch (error: any) { + return JSON.stringify({ + status: "error", + message: error.message, + code: error.code || "DOMAIN_RESOLUTION_ERROR", + }); + } + } +} +export class SolanaGetOwnedDomains extends Tool { + name = "solana_get_owned_domains"; + description = `Get all domains owned by a specific wallet address + Inputs (input is a json string): + owner: string (required) - The public key of the domain owner + `; + + constructor(private solanaKit: SolanaAgentKit) { + super(); + } + + async _call(input: string): Promise { + try { + let inputFormat = JSON.parse(input); + const ownerPubkey = new PublicKey(inputFormat.owner); + const domains = await this.solanaKit.getOwnedAllDomains(ownerPubkey); + + return JSON.stringify({ + status: "success", + message: "Owned domains fetched successfully", + domains: domains, + }); + } catch (error: any) { + return JSON.stringify({ + status: "error", + message: error.message, + code: error.code || "FETCH_OWNED_DOMAINS_ERROR", + }); + } + } +} + +export class SolanaGetOwnedTldDomains extends Tool { + name = "solana_get_owned_tld_domains"; + description = `Get all domains owned by the agent's wallet for a specific TLD + Inputs (input is a json string): + tld: string (required) - The top-level domain to search (e.g., "sol") + `; + + constructor(private solanaKit: SolanaAgentKit) { + super(); + } + + async _call(input: string): Promise { + try { + let inputFormat = JSON.parse(input); + const domains = await this.solanaKit.getOwnedDomainsForTLD( + inputFormat.tld + ); + + return JSON.stringify({ + status: "success", + message: "TLD domains fetched successfully", + domains: domains, + }); + } catch (error: any) { + return JSON.stringify({ + status: "error", + message: error.message, + code: error.code || "FETCH_TLD_DOMAINS_ERROR", + }); + } + } +} +export class SolanaGetAllTlds extends Tool { + name = "solana_get_all_tlds"; + description = `Get all active top-level domains (TLDs) in the Solana name service + Inputs (input is a json string): {} + No additional parameters required`; + + constructor(private solanaKit: SolanaAgentKit) { + super(); + } + + async _call(input: string): Promise { + try { + const tlds = await this.solanaKit.getAllDomainsTLDs(); + + return JSON.stringify({ + status: "success", + message: "TLDs fetched successfully", + tlds: tlds, + }); + } catch (error: any) { + return JSON.stringify({ + status: "error", + message: error.message, + code: error.code || "FETCH_TLDS_ERROR", + }); + } + } +} +export class SolanaGetAllRegisteredDomains extends Tool { + name = "solana_get_all_registered_domains"; + description = `Get all registered domains across all TLDs in the Solana name service + Inputs (input is a json string): {} + No additional parameters required`; + + constructor(private solanaKit: SolanaAgentKit) { + super(); + } + + async _call(input: string): Promise { + try { + const domains = await this.solanaKit.getAllRegisteredAllDomains(); + + return JSON.stringify({ + status: "success", + message: "All registered domains fetched successfully", + domains: domains, + }); + } catch (error: any) { + return JSON.stringify({ + status: "error", + message: error.message, + code: error.code || "FETCH_ALL_DOMAINS_ERROR", + }); + } + } +} +export class SolanaGetMainDomain extends Tool { + name = "solana_get_main_domain"; + description = `Get the user's main/favorite domain + Inputs (input is a json string): + owner: string (required) - The public key of the domain owner + `; + + constructor(private solanaKit: SolanaAgentKit) { + super(); + } + + async _call(input: string): Promise { + try { + let inputFormat = JSON.parse(input); + const ownerPubkey = new PublicKey(inputFormat.owner); + const mainDomain = await this.solanaKit.getMainAllDomainsDomain( + ownerPubkey + ); + + return JSON.stringify({ + status: "success", + message: "Main domain fetched successfully", + domain: mainDomain, + }); + } catch (error: any) { + return JSON.stringify({ + status: "error", + message: error.message, + code: error.code || "FETCH_MAIN_DOMAIN_ERROR", + }); + } + } +} export function createSolanaTools(solanaKit: SolanaAgentKit) { return [ new SolanaBalanceTool(solanaKit), @@ -1007,5 +1190,11 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) { new SolanaRaydiumCreateCpmm(solanaKit), new SolanaOpenbookCreateMarket(solanaKit), new SolanaCreateSingleSidedWhirlpoolTool(solanaKit), + new SolanaResolveDomain(solanaKit), + new SolanaGetOwnedDomains(solanaKit), + new SolanaGetOwnedTldDomains(solanaKit), + new SolanaGetAllTlds(solanaKit), + new SolanaGetAllRegisteredDomains(solanaKit), + new SolanaGetMainDomain(solanaKit), ]; } diff --git a/src/tools/get_all_active_tlds.ts b/src/tools/get_all_active_tlds.ts deleted file mode 100644 index 929fbfc..0000000 --- a/src/tools/get_all_active_tlds.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - NameRegistryState, - getAllDomains, - ROOT_DOMAIN_ACCOUNT, -} from "@bonfida/spl-name-service"; -import { Connection, PublicKey } from "@solana/web3.js"; -import { SolanaAgentKit } from "../index"; - -/** - * Get all active top-level domains (TLDs) in the Solana name service - * @param agent SolanaAgentKit instance - * @returns Array of active TLD strings - */ -export async function getAllDomainsTLDs( - agent: SolanaAgentKit -): Promise { - try { - // Get the root domain record - const rootAccount = await NameRegistryState.retrieve( - agent.connection, - ROOT_DOMAIN_ACCOUNT - ); - - if (!rootAccount) { - throw new Error("Root domain account not found"); - } - - // Fetch all TLD records under the root domain - const tldAccounts = await agent.connection.getProgramAccounts( - new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"), - { - filters: [ - { - memcmp: { - offset: 0, - bytes: rootAccount.registry.owner.toBase58(), - }, - }, - ], - } - ); - - // Parse the TLD names from the accounts - const tlds: string[] = []; - for (const account of tldAccounts) { - const registry = await NameRegistryState.retrieve( - agent.connection, - account.pubkey - ); - - if (registry && registry.registry.data) { - const tldName = Buffer.from(registry.registry.data) - .toString() - .replace(/\0/g, ""); - if (tldName) { - tlds.push(tldName); - } - } - } - - return tlds; - } catch (error: any) { - throw new Error(`Failed to fetch TLDs: ${error.message}`); - } -} diff --git a/src/tools/get_all_domains_tlds.ts b/src/tools/get_all_domains_tlds.ts new file mode 100644 index 0000000..d46fdba --- /dev/null +++ b/src/tools/get_all_domains_tlds.ts @@ -0,0 +1,21 @@ +import { Connection, PublicKey } from "@solana/web3.js"; +import { SolanaAgentKit } from "../index"; +import { getAllTld } from "@onsol/tldparser"; + +/** + * Get all active top-level domains (TLDs) in the Solana name service + * @param agent SolanaAgentKit instance + * @returns Array of active TLD strings + */ +export async function getAllDomainsTLDs( + agent: SolanaAgentKit +): Promise> { + try { + return getAllTld(agent.connection) + } catch (error: any) { + throw new Error(`Failed to fetch TLDs: ${error.message}`); + } +} \ No newline at end of file diff --git a/src/tools/get_all_registered_all_domains.ts b/src/tools/get_all_registered_all_domains.ts index dc0f0a4..5520a48 100644 --- a/src/tools/get_all_registered_all_domains.ts +++ b/src/tools/get_all_registered_all_domains.ts @@ -1,7 +1,7 @@ import { getAllDomains } from "@bonfida/spl-name-service"; import { SolanaAgentKit } from "../agent"; import { PublicKey } from "@solana/web3.js"; -import { getAllDomainsTLDs } from "./get_all_active_tlds"; +import { getAllDomainsTLDs } from "./get_all_domains_tlds"; /** * Get all registered domains across all TLDs @@ -20,7 +20,7 @@ export async function getAllRegisteredAllDomains( for (const tld of tlds) { const domains = await getAllDomains( agent.connection, - new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"), + new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX") ); // Add domains with TLD suffix diff --git a/src/tools/get_main_domain.ts b/src/tools/get_main_all_domains_domain.ts similarity index 68% rename from src/tools/get_main_domain.ts rename to src/tools/get_main_all_domains_domain.ts index 775c343..98f0dcd 100644 --- a/src/tools/get_main_domain.ts +++ b/src/tools/get_main_all_domains_domain.ts @@ -6,16 +6,19 @@ import { PublicKey } from "@solana/web3.js"; * Get the user's main/favorite domain for a SolanaAgentKit instance * @param agent SolanaAgentKit instance * @param owner Owner's public key - * @returns Promise resolving to the main domain name or null if not set + * @returns Promise resolving to the main domain name or null if not found */ export async function getMainAllDomainsDomain( agent: any, owner: PublicKey ): Promise { + let mainDomain = null; try { - const favDomain = await _getFavoriteDomain(agent.connection, owner); - return favDomain.stale ? null : favDomain.reverse; + mainDomain = await _getFavoriteDomain(agent.connection, owner); + return mainDomain.stale ? null : mainDomain.reverse; } catch (error: any) { - throw new Error(`Failed to fetch main domain: ${error.message}`); + console.log("No main/favorite domain found"); } -} \ No newline at end of file + return null +} + diff --git a/src/tools/get_owned_all_domains.ts b/src/tools/get_owned_all_domains.ts new file mode 100644 index 0000000..c626658 --- /dev/null +++ b/src/tools/get_owned_all_domains.ts @@ -0,0 +1,20 @@ +import { SolanaAgentKit } from "../agent"; +import { PublicKey } from "@solana/web3.js"; +import { NameAccountAndDomain, TldParser } from "@onsol/tldparser"; + +/** + * Get all domains owned domains for a specific TLD for the agent's wallet + * @param agent SolanaAgentKit instance + * @param owner - PublicKey of the owner + * @returns Promise resolving to an array of owned domains or an empty array if none are found + */ +export async function getOwnedAllDomains( + agent: SolanaAgentKit, + owner:PublicKey +): Promise { + try { + return new TldParser(agent.connection).getParsedAllUserDomains(owner); + } catch (error: any) { + throw new Error(`Failed to fetch owned domains: ${error.message}`); + } +} diff --git a/src/tools/get_domains_on_tld.ts b/src/tools/get_owned_domains_for_tld.ts similarity index 54% rename from src/tools/get_domains_on_tld.ts rename to src/tools/get_owned_domains_for_tld.ts index 045f44a..16c3cb9 100644 --- a/src/tools/get_domains_on_tld.ts +++ b/src/tools/get_owned_domains_for_tld.ts @@ -1,23 +1,25 @@ +import { NameAccountAndDomain, TldParser } from "@onsol/tldparser"; import { SolanaAgentKit } from "../agent"; -import { getOwnedAllDomains } from "./lookup_owner"; import { PublicKey } from "@solana/web3.js"; - /** * Get all domains owned by an address for a specific TLD * @param agent SolanaAgentKit instance - * @param owner Owner's public key * @param tld Top-level domain (e.g., "sol") - * @returns Array of owned domain names for the specified TLD + * @returns Promise resolving to an array of owned domain names for the specified TLD or an empty array if none are found */ export async function getOwnedDomainsForTLD( agent: SolanaAgentKit, - owner: PublicKey, tld: string -): Promise { +): Promise { try { - const allDomains = await getOwnedAllDomains(agent, owner); - return allDomains.filter(domain => domain.endsWith(`.${tld}`)); + return new TldParser(agent.connection) + .getParsedAllUserDomainsFromTld( + agent.wallet_address, + tld + ) } catch (error: any) { throw new Error(`Failed to fetch domains for TLD: ${error.message}`); } } + + diff --git a/src/tools/index.ts b/src/tools/index.ts index be1f9d3..e009086 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -17,14 +17,14 @@ export * from "./fetch_price"; export * from "./send_compressed_airdrop"; export * from "./create_orca_single_sided_whirlpool"; -export * from "./get_all_active_tlds"; +export * from "./get_all_domains_tlds"; export * from "./get_all_registered_all_domains"; -export * from "./get_domains_on_tld"; -export * from "./get_main_domain"; -export * from "./lookup_owner"; +export * from "./get_owned_domains_for_tld"; +export * from "./get_main_all_domains_domain"; +export * from "./get_owned_all_domains"; export * from "./resolve_domain"; export * from "./raydium_create_ammV4"; export * from "./raydium_create_clmm"; export * from "./raydium_create_cpmm"; -export * from "./openbook_create_market"; \ No newline at end of file +export * from "./openbook_create_market"; diff --git a/src/tools/lookup_owner.ts b/src/tools/lookup_owner.ts deleted file mode 100644 index cffd264..0000000 --- a/src/tools/lookup_owner.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { getAllDomains } from "@bonfida/spl-name-service"; -import { SolanaAgentKit } from "../agent"; -import { PublicKey } from "@solana/web3.js"; - -/** - * Get all domains owned by a specific address - * @param agent SolanaAgentKit instance - * @param owner Owner's public key - * @returns Array of owned domain names - */ -export async function getOwnedAllDomains( - agent: SolanaAgentKit, - owner: PublicKey -): Promise { - try { - const domains = await getAllDomains(agent.connection, owner); - return domains.map(domain => domain.toString()); - } catch (error: any) { - throw new Error(`Failed to fetch owned domains: ${error.message}`); - } -} diff --git a/src/tools/resolve_domain.ts b/src/tools/resolve_domain.ts index 3ea5e41..2ba5f4d 100644 --- a/src/tools/resolve_domain.ts +++ b/src/tools/resolve_domain.ts @@ -1,42 +1,22 @@ -import { Buffer } from "buffer"; -import { PublicKey } from "@solana/web3.js"; -import { - getNameAccountKeySync, - NAME_PROGRAM_ID, -} from "@bonfida/spl-name-service"; +import { TldParser } from "@onsol/tldparser"; import { SolanaAgentKit } from "../index"; +import { PublicKey } from "@solana/web3.js"; /** - * Resolve a domain to its public key + * Resolve all domains for a given agent and domain * @param agent SolanaAgentKit instance * @param domain Domain name to resolve - * @returns Associated public key or null if not found + * @returns Promise resolving to the domain or undefined if not found */ export async function resolveAllDomains( agent: SolanaAgentKit, domain: string -): Promise { +): Promise { try { - // Convert domain name to buffer for hashing - const hashedDomain = Buffer.from(domain); - - // Get the name account key using the new sync method - const nameAccountKey = getNameAccountKeySync( - hashedDomain, - undefined, // nameClass - undefined // nameParent - ); - - // Get the account info to retrieve the owner - const owner = await agent.connection.getAccountInfo(nameAccountKey); - - if (!owner) { - return null; - } - - // The owner's public key is stored in the data buffer starting at offset 32 - return new PublicKey(owner.data.slice(32, 64)); + let tld = new TldParser(agent.connection).getOwnerFromDomainTld(domain) + return tld; } catch (error: any) { throw new Error(`Domain resolution failed: ${error.message}`); } } + diff --git a/test/domain_methods.test.ts b/test/domain_methods.test.ts new file mode 100644 index 0000000..2485ed7 --- /dev/null +++ b/test/domain_methods.test.ts @@ -0,0 +1,146 @@ + +import { SolanaAgentKit } from "../src"; +import { PublicKey } from "@solana/web3.js"; +import * as dotenv from "dotenv"; +import { expect } from "chai"; +import { before, describe, it } from "node:test"; +import { TldParser } from "@onsol/tldparser"; + +dotenv.config(); + +describe("Solana Domain Methods Tests", () => { + let agent: SolanaAgentKit; + + before(() => { + // Initialize the agent before running tests + if ( + !process.env.SOLANA_PRIVATE_KEY || + !process.env.RPC_URL || + !process.env.OPENAI_API_KEY + ) { + throw new Error("Required environment variables are not set"); + } + + agent = new SolanaAgentKit( + process.env.SOLANA_PRIVATE_KEY, + process.env.RPC_URL, + process.env.OPENAI_API_KEY + ); + }); + + describe("resolveAllDomains", () => { + it("should resolve a valid domain to a public key", async () => { + const testDomain = "hero.sol"; + const result = await agent.resolveAllDomains(testDomain); + expect(result).to.be.instanceof(PublicKey); + }); + it("should perform fetching of an owner an nft domain", async () => { + const parser = new TldParser(agent.connection); + const domanTld = "miester.sol"; + const ownerReceived = await parser.getOwnerFromDomainTld(domanTld); + const owner = new PublicKey( + "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67" + ); + expect(ownerReceived).to.be(owner.toString()); + }); + it("should return null for non-existent domain", async () => { + const nonExistentDomain = "nonexistent123456789.sol"; + const result = await agent.resolveAllDomains(nonExistentDomain); + expect(result).to.be.null; + }); + + it("should handle invalid domain format", async () => { + const invalidDomain = ""; + try { + await agent.resolveAllDomains(invalidDomain); + expect.fail("Should have thrown an error"); + } catch (error) { + expect(error).to.be.instanceof(Error); + } + }); + }); + + describe("getOwnedAllDomains", () => { + it("should return array of domains for an owner", async () => { + const owner = new PublicKey( + "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67" + ); + const domains = await agent.getOwnedAllDomains(owner); + expect(domains).to.be.an("array").that.includes("miester.sol"); + domains.forEach((domain) => { + expect(domain).to.be.a("string"); + }); + }); + it("should return array of domains for an owner", async () => { + const owner = new PublicKey(agent.wallet_address); + const domains = await agent.getOwnedAllDomains(owner); + expect(domains).to.be.an("array"); + domains.forEach((domain) => { + expect(domain).to.be.a("string"); + }); + }); + + it("should handle owner with no domains", async () => { + // Create a new random public key that likely owns no domains + const emptyOwner = PublicKey.unique(); + const domains = await agent.getOwnedAllDomains(emptyOwner); + expect(domains).to.be.an("array"); + expect(domains).to.have.lengthOf(0); + }); + }); + + describe("getOwnedDomainsForTLD", () => { + it("should return domains for specific TLD", async () => { + const tld = "sol"; + const domains = await agent.getOwnedDomainsForTLD(tld); + expect(domains).to.be.an("array"); + domains.forEach((domain) => { + console.log(`these are the domains ${domain.domain}`) + }); + }); + + it("should return empty array for non-existent TLD", async () => { + const nonExistentTLD = "nonexistent"; + const domains = await agent.getOwnedDomainsForTLD(nonExistentTLD); + expect(domains).to.be.an("array"); + expect(domains).to.have.lengthOf(0); + }); + }); + + describe("getAllDomainsTLDs", () => { + it("should return array of TLDs", async () => { + const tlds = await agent.getAllDomainsTLDs(); + expect(tlds).to.be.an("array"); + }); + }); + + describe("getAllRegisteredAllDomains", () => { + it("should return array of all registered domains", async () => { + const domains = await agent.getAllRegisteredAllDomains(); + expect(domains).to.be.an("array"); + domains.forEach((domain) => { + expect(domain).to.be.a("string"); + expect(domain).to.include("."); + }); + }); + }); + + describe("getMainAllDomainsDomain", () => { + it("should return main domain or null for an owner", async () => { + const owner = new PublicKey( + "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67" + ); + const mainDomain = await agent.getMainAllDomainsDomain(owner); + expect(mainDomain).to.satisfy((domain: string | null) => { + return domain === null || typeof domain === "string"; + }); + }); + + it("should return null for address without main domain", async () => { + const emptyOwner = PublicKey.unique(); + const mainDomain = await agent.getMainAllDomainsDomain(emptyOwner); + expect(mainDomain).to.be.null; + }); + }); +}); + From ed036e83aaec47254405b2db4aed95988be6429f Mon Sep 17 00:00:00 2001 From: Arihant Bansal <17180950+arihantbansal@users.noreply.github.com> Date: Sun, 22 Dec 2024 14:55:47 +0530 Subject: [PATCH 12/31] change broken link --- test/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.ts b/test/index.ts index cacded6..7a543fa 100644 --- a/test/index.ts +++ b/test/index.ts @@ -70,7 +70,7 @@ async function initializeAgent() { faucet. If not, you can provide your wallet details and request funds from the user. If there is a 5XX (internal) HTTP error code, ask the user to try again later. If someone asks you to do something you can't do with your currently available tools, you must say so, and encourage them to implement it - themselves using the Solana Agent Kit, recommend they go to https://sendai.fun/kit for more information. Be + themselves using the Solana Agent Kit, recommend they go to https://solanaagentkit.xyz/ for more information. Be concise and helpful with your responses. Refrain from restating your tools' descriptions unless it is explicitly requested. `, From d3d4b5f2fda4049feff545c8e40fb77710026be1 Mon Sep 17 00:00:00 2001 From: Arihant Bansal <17180950+arihantbansal@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:25:25 +0530 Subject: [PATCH 13/31] fix --- test/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/index.ts b/test/index.ts index 7a543fa..d0b72be 100644 --- a/test/index.ts +++ b/test/index.ts @@ -1,4 +1,4 @@ -agent: SolanaAgentKit } from "../src"; +import { SolanaAgentKit } from "../src"; import { createSolanaTools } from "../src/langchain"; import { HumanMessage } from "@langchain/core/messages"; import { MemorySaver } from "@langchain/langgraph"; @@ -50,7 +50,7 @@ async function initializeAgent() { } } - const solanaAgent = new SolanaAgent( + const solanaAgent = new SolanaAgentKit( process.env.SOLANA_PRIVATE_KEY!, process.env.RPC_URL, process.env.OPENAI_API_KEY!, From 836ddb120536c0cca68239090b8ec9fd90d3f9f5 Mon Sep 17 00:00:00 2001 From: Arihant Bansal <17180950+arihantbansal@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:26:26 +0530 Subject: [PATCH 14/31] fix --- guides/add_your_own_tool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/add_your_own_tool.md b/guides/add_your_own_tool.md index 1bcb200..a02aa60 100644 --- a/guides/add_your_own_tool.md +++ b/guides/add_your_own_tool.md @@ -87,9 +87,9 @@ export function createSolanaTools(agent: SolanaAgentKit) { ### 6. Usage Example ```typescript -agent: SolanaAgentKit, createSolanaTools } from "solana-agent-kit"; +import { SolanaAgentKit, createSolanaTools } from "solana-agent-kit"; -const agent = new SolanaAgent( +const agent = new SolanaAgentKit( "your-wallet-private-key-as-base58", "https://api.mainnet-beta.solana.com", "your-openai-api-key" From ad1e8e3f2aa2d2a2fed22a898daa9088b5c6c824 Mon Sep 17 00:00:00 2001 From: Arihant Bansal <17180950+arihantbansal@users.noreply.github.com> Date: Mon, 23 Dec 2024 11:52:28 +0530 Subject: [PATCH 15/31] fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 99dae4d..f56e1f3 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ npm install solana-agent-kit ## Quick Start ```typescript -agent: SolanaAgentKit, createSolanaTools } from "solana-agent-kit"; +import { SolanaAgentKit, createSolanaTools } from "solana-agent-kit"; // Initialize with private key and optional RPC URL const agent = new SolanaAgentKit( From 055ec1613d2636ec18445f6ceb5dbdec06b0ae01 Mon Sep 17 00:00:00 2001 From: Arihant Bansal <17180950+arihantbansal@users.noreply.github.com> Date: Mon, 23 Dec 2024 11:52:53 +0530 Subject: [PATCH 16/31] update docs --- docs/assets/highlight.css | 15 ++++---------- docs/assets/navigation.js | 2 +- docs/assets/search.js | 2 +- docs/classes/SolanaAgentKit.html | 11 +++++----- docs/functions/createSolanaTools.html | 2 +- docs/index.html | 20 +++++++++++-------- docs/interfaces/CollectionDeployment.html | 4 ++-- docs/interfaces/CollectionOptions.html | 4 ++-- docs/interfaces/Creator.html | 4 ++-- docs/interfaces/FetchPriceResponse.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 | 6 ++++++ docs/modules.html | 1 + 17 files changed, 50 insertions(+), 45 deletions(-) create mode 100644 docs/interfaces/PythFetchPriceResponse.html diff --git a/docs/assets/highlight.css b/docs/assets/highlight.css index fd488bf..63010a9 100644 --- a/docs/assets/highlight.css +++ b/docs/assets/highlight.css @@ -5,8 +5,8 @@ --dark-hl-1: #D4D4D4; --light-hl-2: #A31515; --dark-hl-2: #CE9178; - --light-hl-3: #000000; - --dark-hl-3: #C8C8C8; + --light-hl-3: #AF00DB; + --dark-hl-3: #C586C0; --light-hl-4: #001080; --dark-hl-4: #9CDCFE; --light-hl-5: #008000; @@ -15,10 +15,8 @@ --dark-hl-6: #569CD6; --light-hl-7: #0070C1; --dark-hl-7: #4FC1FF; - --light-hl-8: #AF00DB; - --dark-hl-8: #C586C0; - --light-hl-9: #098658; - --dark-hl-9: #B5CEA8; + --light-hl-8: #098658; + --dark-hl-8: #B5CEA8; --light-code-background: #FFFFFF; --dark-code-background: #1E1E1E; } @@ -33,7 +31,6 @@ --hl-6: var(--light-hl-6); --hl-7: var(--light-hl-7); --hl-8: var(--light-hl-8); - --hl-9: var(--light-hl-9); --code-background: var(--light-code-background); } } @@ -47,7 +44,6 @@ --hl-6: var(--dark-hl-6); --hl-7: var(--dark-hl-7); --hl-8: var(--dark-hl-8); - --hl-9: var(--dark-hl-9); --code-background: var(--dark-code-background); } } @@ -61,7 +57,6 @@ --hl-6: var(--light-hl-6); --hl-7: var(--light-hl-7); --hl-8: var(--light-hl-8); - --hl-9: var(--light-hl-9); --code-background: var(--light-code-background); } @@ -75,7 +70,6 @@ --hl-6: var(--dark-hl-6); --hl-7: var(--dark-hl-7); --hl-8: var(--dark-hl-8); - --hl-9: var(--dark-hl-9); --code-background: var(--dark-code-background); } @@ -88,5 +82,4 @@ .hl-6 { color: var(--hl-6); } .hl-7 { color: var(--hl-7); } .hl-8 { color: var(--hl-8); } -.hl-9 { color: var(--hl-9); } pre, code { background: var(--code-background); } diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index 73cf8f1..bcaae4e 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE4XTQUvDMBTA8e+Sc7E4dEhvw9KDzm1ob+IhxNc1LH0vJC+gyL67bBNdXfZ26SX//l4T0tcvxfDBqlIv5DTq2RqQHy2rQnnNvaqUcTpGiOV4/arnwalCbSy+q+p6crctfqV7cg4MW8IavKPPAfDIs8gQOm0glrlwDE9up1l46XfPeEH9qUQygGYKeeiwJr3eAJt+FayBZ4ieMEJWOs0k9CF5yxBa2gDWmnWW/B9J4Dw5mhlDCbkG1tZF8WvP59KQJ4v8d/SLphVnnK2lEas0+C7hXCc0vchny0t0k3B/nNLlynQSa3ZXCA6/TkvkjtAu4X7vsTyJxuL0Zvv2DYU9ByOnAwAA" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE42TwU7DMAyG3yXniooJJtTbRNUDDJigN8QhCi6JltpR40hMaO+OtiFYWebtkos/f7asP69fiuGTVaVeyGvUsw9AvnesChU0W1Up43WMEMtx/cJy71Whlg7fVXU5uVkXv6Zb8h4MO8IagqdVD7jnc8gwdNpALHPgWDy5nmbFT2HzxhPWH0pUDqCZhrxoV5PaG2BjF4Mz8AwxEEbImg4xSXqXgmMYWloC1pp1VvkfkoTz5GlmDCXkGlg7H8Vtj+PSkAeH/Hf6x6YVZxylpRGL1Icu4VwnNFbUZ8lT6ibh9pxSuDKcqF2xPTMjeVSSm00+YfcvWyK/t3GXcHvYWB5AY+P0av32DUTvPWMEBAAA" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index 8b3e63a..d5f491b 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE7WcUXOcOBLHvwt+nXIsIQnsNyc5V+Uuu5taZ/ceplIuDLLDmQEWNMnNpfLdrwTD0Bo148Z4n5LyqLv/Ej+1hJD0I2iq721wtf4RPOVlFlwxHq+CMtno4Cq4rYqkTK4fdWn+lZtgFWybIrgK0iJpW92+cX8+/2o2RbAafg2uguDnavAqGT94TauyNc02NVVDcXnmlgfuV0GdNLo0vtIxMLvgAkYudWryqqQGHosvifs9KQpNar+zQ9Hl8e6SLGt0286IC0yWxK9qXSb5XVLnd096R4rvmcyMzy/EyG2j/9rq1twk21Sbm22Z0doANVuiI9N1Ue0+V0+aBpxbfnnkd1VRzOAdMVqi4VGbt0mRlKkmRXeKL4m7yUvz681nUtCx7JKIpknK9kHT0hkovIzxx7w1unlfbZKc9nw9k2Xx26r4pm+rYpYCz2ghYZ+afJM0uxkaEKOFzz6jAT6UXBKt0GV23bba0DKaU3xhS3/+dEtt377o0ng2Db5PTPJ2dz1jIJuyfD01n/P0idjXJwyXaHnQJv3aOf3U5MTU6tssYjDZlunXT9tNfbMt6YMbarZER2uSJ1r9h5KLoukye1dtaouTzq7zJmuqmhZ9wnKJmrTRidG/NWlym5ePhb7NM539+2veFHVVFbTZ7XMuFo0OyS7Lt5t3XYzrzeZPQRsfMLNX0/Gu2Gzmy9hbvZ6K+kUq6sUq7BT7vqqeeoe/JM0T8Z1kwnCmFiWO6O1Lfq6qYszsD9uym3q2b7wyJ98vuVQH751M8G6Zl0Y3D0mq2zf7n066ct5kjl+hJnydPffeNGiaCFPrJtWlSR71s5GcotRgTvMc5ve/1V1ToyGPC9GbrPuH7PJsX3yiJp7WiaDbJp8Rsy+9MGRT7ZLC7N4mbd5+qvLSzGjIM9R4oaC0f+xzZACT+cFxqN53L5Eba35Sx1iOjlZ6sD6eEVJCnGHmz1UbVGdCVJs/lonZNs9AfywGmr1IBGz+X/LSjMV/vfn8u27rqmxRTZOF6Q/CvjbPd322N8OrO12HKRHaJFlikpcIGU1fLgY+ADitPZFWkWL0Rjffc2M0Oq5N+T0bbfB6YrqnwutCPzbJZl780WixgO/6vs0NivRk/NFmcfi8zE2eFB/zv7Z5lpvd7W8fZ0nB7RfLaou8rpNH/baeRdyZa7dYRt3kVZOb3Y2e94Bcu5fIOO6GD9vyY/eqeSoHogXpXfFkzp/2TUj6eA1mpuETCk6m4HnB9zn0D3zqdUqDY/kKUnTT4PP9EyIGm5eFh9B93BbVdZpW29K81ybJi/YUedOlZ4wElUmKP5Ni+5IIZ441Xv0TVZrMjkY3ujX/SJpSZy+R5Xl4LWmNTgqTb/R1vXuJLtf8tUS12pi8fERz9nOKgO0COUrKcIT47s7s6hfhNKg5P7iYK+r8UKGp74nfS3zeM1Pb+eDoxQqHSk4tFxRF9V1nn5rKVClc11igGfH5d8n/Wm30ffKivOXJBr7+LrmbvMw3283vCT4pnKvYdfeKouFg8c9tnRvdHL4KYMKPy7zKchXq9Nl1K0/uzEUfPOrJNR9qyHa3uQdL3c8GPZRfFjbTab5J8K6NBwYWy0KbBB8v8LD70stCFtVj9cfvH+hRR4OFzZzkxe7uW1Vs54B1ZLVMwkOj9f/0XbI1X7tXFLoMxHKZFDtrf4kQz26ZjFo3m6TUpbnL7Hv9RN7FpaC2y+To/xpdtlNrLbgMx2Z2eOqc6bnYz82VPHsge3JtNC8fdfpUfUBn30RF566b2epOD3439jt09wn61BuSX2rGi7lJzBbFYcLr2cECrysiefKl7EmXeONPxR5NlgavbaEP5R+379/NEeCaLRWx0W078QlrSsBosjR4WmWzIu/L08N+WQV5men/Blc/gm+6sbgHVwE/D88vg1XwkOsis/toh6lQWm32H0GyKt12//2yL/anTruPLlfrvvSbi2C1vliJi3N1Ib58Wa0H4+6H7g+Dj/EvnSELVmuGGTLPkDmGPFitOWbIPUPuGIbBah1ihqFnGDqGIlitBWYoPEPhGMpgtZaYofQMpWOogtVaYYbKM1SOYRSs1hFmGHmGkWMYB6t1jBnGnmHsGF4Gq/UlZnjpGV66AFgeGMoO8+FhR/R0+OD8IAC5BDHLBUMZYj5EzKWIWTYYyhHzQWIuSczywVCWmA8Tc2lilhGG8sR8oJhLFLOcMJQp5kPFXKqYZYWhXDEfLOaSxSwvDGWL+XAxly5mmWEoX8wHjLmEccsMRwnjPmHcJYxbZjhKGPcJ40c5qktSeJZC0pRLGLfMcJQw7hPGXcK4ZYajhHGfMO4Sxi0zHCWM+4RxlzBumeEoYdwnjLuEccsMRwnjPmHcJYxbZjhKGPcJ4y5h3DLDUcK4Txh3CQstMyFKWOgTFrqEhZaZkK1CeS4ulWvsExa6hIWWmRAlLPQJC49Gwm4oxMdCZDB0CQstM6FAZfuEhS5hoWUmRAkLfcJCl7DQMhOihIU+YaFLWGiZCVHCQp+w0CUstMyEKGGhT1joEhZaZkKUsNAnLHQJE5YZcYG1tvAJEy5hwjIj0BwmfMKES5iwzAiORvYJEy5hwjIjUMKET5g4mm91Ey58xoVMuVzChGVGoIQJnzDhEiYsMwIlTPiECZcwYZkRKGHCJ0y4hAnLjEAJEz5hwiVMWGYESpjwCRMuYdIyI9EcJn3CpEuYtMxIlDDpEyZdwiSfZFv6hEmXMBlO4il9wqRLmLTMSDR7Sp8weTSr76b1KNsSmdi7hEnLjETZlj5h0iVMWmYk/kbhEyZdwqRlRqJsS58w6RImLTMSZVv6hEmXMNURhrKtfMKUS5jqCLvEnrPyCVMuYcoyo1C2lU+YcglTlhmFsq18wpRLmLLMKJQw5ROmXMKUZUahhCmfMHX07ti9PKKEKeT10SVMRZNzEuUTplzCVDw5M1A+YcolTFlmFMq28glTLmGRZUahbEc+YZFLWGSZUfhbs09Y5BIWdYShbEc+YZFLWNQRhubtyCcscgmLLDMRynbkExa5hEWWmQhlO/IJi1zCIstMhLId+YRFRysU3RIFynaELFK4hEXxZDKIfMIil7DIMhOhHSPyCYtcwmLLTITiGfuExS5hsWUmQvGMfcJil7DYMhOheMY+YbFLWGyZifCFHZ+w2CUs7ghD8Yx9wmKXsNgyE6N4xj5h+z91C5XfdGN09qFfsFyvD98qfgR3+1VMeTmsnf4IFAuufvxcBVFs//05rl52fz0sYNrfbMTDV+PRW8hGb+Hem4po3voNDvW4wWF0q4BbFZLc9Qu7o4v4YnQRS6KL/UeQPIOeIjF6ii6JnoY9xFibgScQzvWXgX32wGUMXNIe5uiyGjYuA38h8Edt//HWhNERH/1wqpvx1ofRD+CB0fx054iqJk3a7phba4+5fR+PuQGJ4PFyMcN52x1SMtURuxw8Xk58vMPRJfAEAL7hxRwv7oOMgBtav3Q/poM+CeoV0ZgYt0AANwq4oVWsZz4FFxSAbg56+Qxnpj+ICjo5UEXys99IChIr6DOSlnDgV2kgBTiKaGK6k77dV73m8IUVOJSgkWhN3jnsGqnujw4DvgGZnOjN2xgBxAF3Ea37PWpzP1wZMToCeNJ63aM2dX8jQLa/EQDkG5AUGFlV12B2i/P9Dsn7DLDKaLC6Ps3+IDlwCSrNyLU2tasLsM9ovI27/EDHBrle0ZpsfzaiGM5GtG5mFqDBBK3Bht3Eer+bGHRPkHckzdl/+g0Phyfg1BYAohTJXX8Svu63mHsJiIMhjtPGOHvNQ7K/5gE8TlBRRlRWPVbd4UhQP9D2EW3oLrZFlfSbJLN+kySWjCRoOEmTd9gtALIGAD+mwTYe/gKEgVQraGPa4OaovSSgXxIF9RtPm25PFGh5oEnRxpH+dAeoFhAjeG8kidU72joGmhwAGtF1jcN2+WAwIATwK2jgW7/lg1NlBoYRRhuVuuJwrgTIDEVvpGiZ4vgaK8AFwILsyp667+eYm/2pe5AnQMfkRHX99neAGGgsRevc8Pw5aDIAWkh25G0IBJABhxEtO3QTlLzctlnqeIIzQxr7w6G0B+1mLNBakobWPsn3GR/NggB6SYMeDhzIK5sA9ApaAtrfNNGTlmw234QDGkCX09h1HKbdBRrAHxiXOO3Ruv7qI39g2sJp05bhTE9Su30UeJK0WdRwpxYycwQEM1qX2F9A99BdQPfQX0AHOivoq0R33W1bbVUg6sDgwmi9Yn9nwb29s6De31kAMgCQF9L02Ytx0sPFOMlwMQ54skAkp4kcz0aBxwoygKL1W3BQE/Qs0P/FxX40pT3Z4bTtvTvjFmD2ImjA9YsNib1f5Sl3BgSgjljJ/lok0N5wlYZYsf32WZBvAQgxLaMNRzMA6yDnKFrD9OcdgAv4Jk/TMZ5WB48IVEfQuO4y89HSIRAT01q2O6b5rT+mCViG8whastvfOwf6PvDBaAl9vLQQuIFrccQGHq4jAO0LxAiamKMZdwg8hDQPwy2rwAnwMcPFHfJ6D8dfmqvhkgLgA/AiCI/5yyqo81oXeamDq/WXnz//DxMMox3YVwAA"; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,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"; \ No newline at end of file diff --git a/docs/classes/SolanaAgentKit.html b/docs/classes/SolanaAgentKit.html index 8179e3b..a567376 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 @@ -19,6 +19,7 @@ Provides a unified interface for token operations, NFT management, trading and m lendAssets mintNFT openbookCreateMarket +pythFetchPrice raydiumCreateAmmV4 raydiumCreateClmm raydiumCreateCpmm @@ -29,7 +30,7 @@ Provides a unified interface for token operations, NFT management, trading and m stake trade transfer -

Constructors

  • Parameters

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

    Returns SolanaAgentKit

Properties

connection: Connection

Solana RPC connection

-
openai_api_key: string
wallet: Keypair

Wallet keypair for signing transactions

-
wallet_address: PublicKey

Public key of the wallet

-

Methods

  • Parameters

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

    Returns Promise<string>

  • Parameters

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

    Returns Promise<{
        mint: PublicKey;
    }>

  • Parameters

    • mint: string

    Returns Promise<string>

  • Parameters

    • Optionaltoken_address: PublicKey

    Returns Promise<null | number>

  • 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

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

  • Parameters

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

    Returns Promise<string[]>

  • Parameters

    • amount: number

    Returns Promise<string>

  • Parameters

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

    Returns Promise<string>

  • Parameters

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

    Returns Promise<string>

+

Constructors

  • Parameters

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

    Returns SolanaAgentKit

Properties

connection: Connection

Solana RPC connection

+
openai_api_key: string
wallet: Keypair

Wallet keypair for signing transactions

+
wallet_address: PublicKey

Public key of the wallet

+

Methods

  • Parameters

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

    Returns Promise<string>

  • Parameters

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

    Returns Promise<{
        mint: PublicKey;
    }>

  • Parameters

    • mint: string

    Returns Promise<string>

  • Parameters

    • Optionaltoken_address: PublicKey

    Returns Promise<number>

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

  • Parameters

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

    Returns Promise<string[]>

  • Parameters

    • amount: number

    Returns Promise<string>

  • Parameters

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

    Returns Promise<string>

  • Parameters

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

    Returns Promise<string>

diff --git a/docs/functions/createSolanaTools.html b/docs/functions/createSolanaTools.html index 1f177c1..d2b61c6 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)[]

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

diff --git a/docs/index.html b/docs/index.html index c39a52f..7dd0878 100644 --- a/docs/index.html +++ b/docs/index.html @@ -86,25 +86,28 @@
npm install solana-agent-kit
 
-
agent: SolanaAgentKit, createSolanaTools } from "solana-agent-kit";

// Initialize with private key and optional RPC URL
const agent = new SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
);

// Create LangChain tools
const tools = createSolanaTools(agent); +
import { SolanaAgentKit, createSolanaTools } from "solana-agent-kit";

// Initialize with private key and optional RPC URL
const agent = new SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
);

// Create LangChain tools
const tools = createSolanaTools(agent);
-
const result = await agent.deployToken(
"my ai token", // name
"uri", // uri
"token", // symbol
9, // decimals
1000000 // initial supply
);

console.log("Token Mint Address:", result.mint.toString()); +
const result = await agent.deployToken(
"my ai token", // name
"uri", // uri
"token", // symbol
9, // decimals
1000000 // initial supply
);

console.log("Token Mint Address:", result.mint.toString());
-
const collection = await agent.deployCollection({
name: "My NFT Collection",
uri: "https://arweave.net/metadata.json",
royaltyBasisPoints: 500, // 5%
creators: [
{
address: "creator-wallet-address",
percentage: 100,
},
],
}); +
const collection = await agent.deployCollection({
name: "My NFT Collection",
uri: "https://arweave.net/metadata.json",
royaltyBasisPoints: 500, // 5%
creators: [
{
address: "creator-wallet-address",
percentage: 100,
},
],
});
-
import { PublicKey } from "@solana/web3.js";

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

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

const signature = await agent.lendAssets(
100 // amount of USDC to lend
); +
import { PublicKey } from "@solana/web3.js";

const signature = await agent.lendAssets(
100 // amount of USDC to lend
);
-
const signature = await agent.stake(
1 // amount in SOL to stake
); +
const signature = await agent.stake(
1 // amount in SOL to stake
);
-
import { PublicKey } from "@solana/web3.js";

(async () => {
console.log(
"~Airdrop cost estimate:",
getAirdropCostEstimate(
1000, // recipients
30_000 // priority fee in lamports
)
);

const signature = await agent.sendCompressedAirdrop(
new PublicKey("JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"), // mint
42, // amount per recipient
[
new PublicKey("1nc1nerator11111111111111111111111111111111"),
// ... add more recipients
],
30_000 // priority fee in lamports
);
})(); +
import { PublicKey } from "@solana/web3.js";

(async () => {
console.log(
"~Airdrop cost estimate:",
getAirdropCostEstimate(
1000, // recipients
30_000 // priority fee in lamports
)
);

const signature = await agent.sendCompressedAirdrop(
new PublicKey("JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"), // mint
42, // amount per recipient
[
new PublicKey("1nc1nerator11111111111111111111111111111111"),
// ... add more recipients
],
30_000 // priority fee in lamports
);
})(); +
+ +

const price = await agent.pythFetchPrice(
"0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"
);

console.log("Price in BTC/USD:", price);

The toolkit relies on several key Solana and Metaplex libraries:

@@ -116,9 +119,10 @@
  • @metaplex-foundation/umi
  • @lightprotocol/compressed-token
  • @lightprotocol/stateless.js
  • +
  • @pythnetwork/price-service-client
  • Contributions are welcome! Please feel free to submit a Pull Request. Refer to CONTRIBUTING.md for detailed guidelines on how to contribute to this project.

    MIT License

    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 6999f92..1cf2cc3 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 29b5bfc..1708dbe 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 38c524a..70a574b 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 37c020c..5e3ee44 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/JupiterTokenData.html b/docs/interfaces/JupiterTokenData.html index a162800..a47d48c 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 f80d34c..63c90f2 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 f5a840f..26d2c39 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 fd2a37f..7007dd2 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 da5a287..4568f3e 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 new file mode 100644 index 0000000..fb28177 --- /dev/null +++ b/docs/interfaces/PythFetchPriceResponse.html @@ -0,0 +1,6 @@ +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"
    diff --git a/docs/modules.html b/docs/modules.html index b5e59c9..29440e3 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -8,5 +8,6 @@ MintCollectionNFTResponse PumpfunLaunchResponse PumpFunTokenOptions +PythFetchPriceResponse

    Functions

    From fbd6ac600226dbe5435c4dd76a3d8322ac855952 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 19:25:30 +0100 Subject: [PATCH 17/31] added domain methods --- src/tools/get_all_active_tlds.ts | 0 src/tools/get_all_registered_all_domains.ts | 0 src/tools/get_domains_on_tld.ts | 23 +++++++++++ src/tools/get_main_domain.ts | 21 +++++++++++ src/tools/lookup_owner.ts | 21 +++++++++++ src/tools/resolve_domain.ts | 42 +++++++++++++++++++++ 6 files changed, 107 insertions(+) create mode 100644 src/tools/get_all_active_tlds.ts create mode 100644 src/tools/get_all_registered_all_domains.ts create mode 100644 src/tools/get_domains_on_tld.ts create mode 100644 src/tools/get_main_domain.ts create mode 100644 src/tools/lookup_owner.ts create mode 100644 src/tools/resolve_domain.ts diff --git a/src/tools/get_all_active_tlds.ts b/src/tools/get_all_active_tlds.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/tools/get_all_registered_all_domains.ts b/src/tools/get_all_registered_all_domains.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/tools/get_domains_on_tld.ts b/src/tools/get_domains_on_tld.ts new file mode 100644 index 0000000..045f44a --- /dev/null +++ b/src/tools/get_domains_on_tld.ts @@ -0,0 +1,23 @@ +import { SolanaAgentKit } from "../agent"; +import { getOwnedAllDomains } from "./lookup_owner"; +import { PublicKey } from "@solana/web3.js"; + +/** + * Get all domains owned by an address for a specific TLD + * @param agent SolanaAgentKit instance + * @param owner Owner's public key + * @param tld Top-level domain (e.g., "sol") + * @returns Array of owned domain names for the specified TLD + */ +export async function getOwnedDomainsForTLD( + agent: SolanaAgentKit, + owner: PublicKey, + tld: string +): Promise { + try { + const allDomains = await getOwnedAllDomains(agent, owner); + return allDomains.filter(domain => domain.endsWith(`.${tld}`)); + } catch (error: any) { + throw new Error(`Failed to fetch domains for TLD: ${error.message}`); + } +} diff --git a/src/tools/get_main_domain.ts b/src/tools/get_main_domain.ts new file mode 100644 index 0000000..775c343 --- /dev/null +++ b/src/tools/get_main_domain.ts @@ -0,0 +1,21 @@ +import { getFavoriteDomain as _getFavoriteDomain } from "@bonfida/spl-name-service"; +import { PublicKey } from "@solana/web3.js"; + + +/** + * Get the user's main/favorite domain for a SolanaAgentKit instance + * @param agent SolanaAgentKit instance + * @param owner Owner's public key + * @returns Promise resolving to the main domain name or null if not set + */ +export async function getMainAllDomainsDomain( + agent: any, + owner: PublicKey +): Promise { + try { + const favDomain = await _getFavoriteDomain(agent.connection, owner); + return favDomain.stale ? null : favDomain.reverse; + } catch (error: any) { + throw new Error(`Failed to fetch main domain: ${error.message}`); + } +} \ No newline at end of file diff --git a/src/tools/lookup_owner.ts b/src/tools/lookup_owner.ts new file mode 100644 index 0000000..9243467 --- /dev/null +++ b/src/tools/lookup_owner.ts @@ -0,0 +1,21 @@ +import { getAllDomains } from "@bonfida/spl-name-service"; +import { SolanaAgentKit } from "../agent"; +import { PublicKey } from "@solana/web3.js"; + +/** + * Get all domains owned by a specific address + * @param agent SolanaAgentKit instance + * @param owner Owner's public key + * @returns Array of owned domain names + */ +export async function getOwnedAllDomains( + agent: SolanaAgentKit, + owner: PublicKey +): Promise { + try { + const domains = await getAllDomains(agent.connection, owner); + return domains.map(domain => domain.name); + } catch (error: any) { + throw new Error(`Failed to fetch owned domains: ${error.message}`); + } +} diff --git a/src/tools/resolve_domain.ts b/src/tools/resolve_domain.ts new file mode 100644 index 0000000..3ea5e41 --- /dev/null +++ b/src/tools/resolve_domain.ts @@ -0,0 +1,42 @@ +import { Buffer } from "buffer"; +import { PublicKey } from "@solana/web3.js"; +import { + getNameAccountKeySync, + NAME_PROGRAM_ID, +} from "@bonfida/spl-name-service"; +import { SolanaAgentKit } from "../index"; + +/** + * Resolve a domain to its public key + * @param agent SolanaAgentKit instance + * @param domain Domain name to resolve + * @returns Associated public key or null if not found + */ +export async function resolveAllDomains( + agent: SolanaAgentKit, + domain: string +): Promise { + try { + // Convert domain name to buffer for hashing + const hashedDomain = Buffer.from(domain); + + // Get the name account key using the new sync method + const nameAccountKey = getNameAccountKeySync( + hashedDomain, + undefined, // nameClass + undefined // nameParent + ); + + // Get the account info to retrieve the owner + const owner = await agent.connection.getAccountInfo(nameAccountKey); + + if (!owner) { + return null; + } + + // The owner's public key is stored in the data buffer starting at offset 32 + return new PublicKey(owner.data.slice(32, 64)); + } catch (error: any) { + throw new Error(`Domain resolution failed: ${error.message}`); + } +} From 9e1fa3fae054831013c8d8bc2b06bafd22e95b7c Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 19:35:13 +0100 Subject: [PATCH 18/31] modified package lock --- package-lock.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..e69de29 From 1fc965c0174c0a87e1f2444fccd29c2643825700 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 20:12:16 +0100 Subject: [PATCH 19/31] feat:updated domains methods, added fixes --- src/tools/get_all_active_tlds.ts | 65 +++++++++++++++++++++ src/tools/get_all_registered_all_domains.ts | 36 ++++++++++++ src/tools/lookup_owner.ts | 2 +- 3 files changed, 102 insertions(+), 1 deletion(-) diff --git a/src/tools/get_all_active_tlds.ts b/src/tools/get_all_active_tlds.ts index e69de29..929fbfc 100644 --- a/src/tools/get_all_active_tlds.ts +++ b/src/tools/get_all_active_tlds.ts @@ -0,0 +1,65 @@ +import { + NameRegistryState, + getAllDomains, + ROOT_DOMAIN_ACCOUNT, +} from "@bonfida/spl-name-service"; +import { Connection, PublicKey } from "@solana/web3.js"; +import { SolanaAgentKit } from "../index"; + +/** + * Get all active top-level domains (TLDs) in the Solana name service + * @param agent SolanaAgentKit instance + * @returns Array of active TLD strings + */ +export async function getAllDomainsTLDs( + agent: SolanaAgentKit +): Promise { + try { + // Get the root domain record + const rootAccount = await NameRegistryState.retrieve( + agent.connection, + ROOT_DOMAIN_ACCOUNT + ); + + if (!rootAccount) { + throw new Error("Root domain account not found"); + } + + // Fetch all TLD records under the root domain + const tldAccounts = await agent.connection.getProgramAccounts( + new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"), + { + filters: [ + { + memcmp: { + offset: 0, + bytes: rootAccount.registry.owner.toBase58(), + }, + }, + ], + } + ); + + // Parse the TLD names from the accounts + const tlds: string[] = []; + for (const account of tldAccounts) { + const registry = await NameRegistryState.retrieve( + agent.connection, + account.pubkey + ); + + if (registry && registry.registry.data) { + const tldName = Buffer.from(registry.registry.data) + .toString() + .replace(/\0/g, ""); + if (tldName) { + tlds.push(tldName); + } + } + } + + return tlds; + } catch (error: any) { + throw new Error(`Failed to fetch TLDs: ${error.message}`); + } +} diff --git a/src/tools/get_all_registered_all_domains.ts b/src/tools/get_all_registered_all_domains.ts index e69de29..dc0f0a4 100644 --- a/src/tools/get_all_registered_all_domains.ts +++ b/src/tools/get_all_registered_all_domains.ts @@ -0,0 +1,36 @@ +import { getAllDomains } from "@bonfida/spl-name-service"; +import { SolanaAgentKit } from "../agent"; +import { PublicKey } from "@solana/web3.js"; +import { getAllDomainsTLDs } from "./get_all_active_tlds"; + +/** + * Get all registered domains across all TLDs + * @param agent SolanaAgentKit instance + * @returns Array of all registered domain names with their TLDs + */ +export async function getAllRegisteredAllDomains( + agent: SolanaAgentKit +): Promise { + try { + // First get all TLDs + const tlds = await getAllDomainsTLDs(agent); + const allDomains: string[] = []; + + // For each TLD, fetch all registered domains + for (const tld of tlds) { + const domains = await getAllDomains( + agent.connection, + new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"), + ); + + // Add domains with TLD suffix + domains.forEach((domain) => { + allDomains.push(`${domain}.${tld}`); + }); + } + + return allDomains; + } catch (error: any) { + throw new Error(`Failed to fetch all registered domains: ${error.message}`); + } +} diff --git a/src/tools/lookup_owner.ts b/src/tools/lookup_owner.ts index 9243467..cffd264 100644 --- a/src/tools/lookup_owner.ts +++ b/src/tools/lookup_owner.ts @@ -14,7 +14,7 @@ export async function getOwnedAllDomains( ): Promise { try { const domains = await getAllDomains(agent.connection, owner); - return domains.map(domain => domain.name); + return domains.map(domain => domain.toString()); } catch (error: any) { throw new Error(`Failed to fetch owned domains: ${error.message}`); } From b12b2a61d4cfec19b1481258d0e2866b1eab9832 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 20:22:34 +0100 Subject: [PATCH 20/31] feat : added domain methods to solana agent kit --- src/agent/index.ts | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/agent/index.ts b/src/agent/index.ts index 56cfe74..c5dca61 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -37,6 +37,12 @@ import { PumpFunTokenOptions, } from "../types"; import { BN } from "@coral-xyz/anchor"; +import { getAllDomainsTLDs } from "../tools/get_all_active_tlds"; +import { getAllRegisteredAllDomains } from "../tools/get_all_registered_all_domains"; +import { getOwnedDomainsForTLD } from "../tools/get_domains_on_tld"; +import { getMainAllDomainsDomain } from "../tools/get_main_domain"; +import { getOwnedAllDomains } from "../tools/lookup_owner"; +import { resolveAllDomains } from "../tools/resolve_domain"; /** * Main class for interacting with Solana blockchain @@ -192,8 +198,8 @@ export class SolanaAgentKit { otherTokenMint: PublicKey, initialPrice: Decimal, maxPrice: Decimal, - feeTier: keyof typeof FEE_TIERS, - ): Promise { + feeTier: keyof typeof FEE_TIERS + ) { return createOrcaSingleSidedWhirlpool( this, depositTokenAmount, @@ -201,10 +207,38 @@ export class SolanaAgentKit { otherTokenMint, initialPrice, maxPrice, - feeTier, + feeTier ); } + // New domain-related methods + async resolveAllDomains(domain: string): Promise { + return resolveAllDomains(this, domain); + } + + async getOwnedAllDomains(owner: PublicKey): Promise { + return getOwnedAllDomains(this, owner); + } + + async getOwnedDomainsForTLD( + owner: PublicKey, + tld: string + ): Promise { + return getOwnedDomainsForTLD(this, owner, tld); + } + + async getAllDomainsTLDs(): Promise { + return getAllDomainsTLDs(this); + } + + async getAllRegisteredAllDomains(): Promise { + return getAllRegisteredAllDomains(this); + } + + async getMainAllDomainsDomain(owner: PublicKey): Promise { + return getMainAllDomainsDomain(this, owner); + } + async raydiumCreateAmmV4( marketId: PublicKey, baseAmount: BN, From e2239a5029c04b76613c03eae8039e3302a24076 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 21:03:58 +0100 Subject: [PATCH 21/31] feat:removed package-lock update pnpm lock, modified agent/index.ts --- src/agent/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/agent/index.ts b/src/agent/index.ts index c5dca61..5d63b9e 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -211,7 +211,6 @@ export class SolanaAgentKit { ); } - // New domain-related methods async resolveAllDomains(domain: string): Promise { return resolveAllDomains(this, domain); } From 93ceb6732804526079b3108411f705c60e6369f7 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 21:12:33 +0100 Subject: [PATCH 22/31] updated imports for methods --- src/agent/index.ts | 12 ++++++------ src/tools/index.ts | 8 +++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/agent/index.ts b/src/agent/index.ts index 5d63b9e..344c47a 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -27,6 +27,12 @@ import { createOrcaSingleSidedWhirlpool, FEE_TIERS, pythFetchPrice, + getAllDomainsTLDs, + getAllRegisteredAllDomains, + getOwnedDomainsForTLD, + getMainAllDomainsDomain, + getOwnedAllDomains, + resolveAllDomains, } from "../tools"; import { CollectionDeployment, @@ -37,12 +43,6 @@ import { PumpFunTokenOptions, } from "../types"; import { BN } from "@coral-xyz/anchor"; -import { getAllDomainsTLDs } from "../tools/get_all_active_tlds"; -import { getAllRegisteredAllDomains } from "../tools/get_all_registered_all_domains"; -import { getOwnedDomainsForTLD } from "../tools/get_domains_on_tld"; -import { getMainAllDomainsDomain } from "../tools/get_main_domain"; -import { getOwnedAllDomains } from "../tools/lookup_owner"; -import { resolveAllDomains } from "../tools/resolve_domain"; /** * Main class for interacting with Solana blockchain diff --git a/src/tools/index.ts b/src/tools/index.ts index eee0471..a82b52a 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -16,7 +16,13 @@ export * from "./stake_with_jup"; export * from "./fetch_price"; export * from "./send_compressed_airdrop"; export * from "./create_orca_single_sided_whirlpool"; -export * from "./raydium_create_ammV4"; + +export * from "../tools/get_all_active_tlds"; +export * from "../tools/get_all_registered_all_domains"; +export * from "../tools/get_domains_on_tld"; +export * from "../tools/get_main_domain"; +export * from "../tools/lookup_owner"; +export * from "../tools/resolve_domain";export * from "./raydium_create_ammV4"; export * from "./raydium_create_clmm"; export * from "./raydium_create_cpmm"; export * from "./openbook_create_market"; From b1fcd6b56e2691f2a75680347dd8cb87aa9c3412 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Fri, 20 Dec 2024 21:26:06 +0100 Subject: [PATCH 23/31] feat: update imports in index.ts --- src/tools/index.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tools/index.ts b/src/tools/index.ts index a82b52a..85e338a 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -16,13 +16,14 @@ export * from "./stake_with_jup"; export * from "./fetch_price"; export * from "./send_compressed_airdrop"; export * from "./create_orca_single_sided_whirlpool"; +export * from "./get_all_active_tlds"; +export * from "./get_all_registered_all_domains"; +export * from "./get_domains_on_tld"; +export * from "./get_main_domain"; +export * from "./lookup_owner"; +export * from "./resolve_domain"; -export * from "../tools/get_all_active_tlds"; -export * from "../tools/get_all_registered_all_domains"; -export * from "../tools/get_domains_on_tld"; -export * from "../tools/get_main_domain"; -export * from "../tools/lookup_owner"; -export * from "../tools/resolve_domain";export * from "./raydium_create_ammV4"; +export * from "./raydium_create_ammV4"; export * from "./raydium_create_clmm"; export * from "./raydium_create_cpmm"; export * from "./openbook_create_market"; From cfda7151a28a7fb2446315094df8e80f5269a386 Mon Sep 17 00:00:00 2001 From: adpthegreat Date: Sat, 21 Dec 2024 20:53:00 +0100 Subject: [PATCH 24/31] feat: added langchain class, refactored methods to use tlb parser, wrote and ran tests --- package-lock.json | 0 package.json | 5 +- pnpm-lock.yaml | 428 ++++++++++++++++++ src/agent/index.ts | 32 +- src/langchain/index.ts | 6 + src/tools/get_all_active_tlds.ts | 65 --- src/tools/get_all_domains_tlds.ts | 21 + src/tools/get_all_registered_all_domains.ts | 4 +- ...main.ts => get_main_all_domains_domain.ts} | 13 +- src/tools/get_owned_all_domains.ts | 20 + ...on_tld.ts => get_owned_domains_for_tld.ts} | 18 +- src/tools/index.ts | 8 +- src/tools/lookup_owner.ts | 21 - src/tools/resolve_domain.ts | 36 +- test/domain_methods.test.ts | 146 ++++++ 15 files changed, 676 insertions(+), 147 deletions(-) delete mode 100644 package-lock.json delete mode 100644 src/tools/get_all_active_tlds.ts create mode 100644 src/tools/get_all_domains_tlds.ts rename src/tools/{get_main_domain.ts => get_main_all_domains_domain.ts} (68%) create mode 100644 src/tools/get_owned_all_domains.ts rename src/tools/{get_domains_on_tld.ts => get_owned_domains_for_tld.ts} (54%) delete mode 100644 src/tools/lookup_owner.ts create mode 100644 test/domain_methods.test.ts diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index e69de29..0000000 diff --git a/package.json b/package.json index 790b80c..cd4008d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "build": "tsc", "docs": "typedoc src --out docs", - "test": "ts-node test/index.ts", + "test": "ts-node test/**/*.ts", "generate": "ts-node src/utils/keypair.ts" }, "engines": { @@ -32,6 +32,7 @@ "@metaplex-foundation/umi": "^0.9.2", "@metaplex-foundation/umi-bundle-defaults": "^0.9.2", "@metaplex-foundation/umi-web3js-adapters": "^0.9.2", + "@onsol/tldparser": "^0.6.7", "@orca-so/common-sdk": "0.6.4", "@orca-so/whirlpools-sdk": "^0.13.12", "@pythnetwork/price-service-client": "^1.9.0", @@ -40,6 +41,7 @@ "@solana/web3.js": "^1.95.4", "bn.js": "^5.2.1", "bs58": "^6.0.0", + "chai": "^5.1.2", "decimal.js": "^10.4.3", "dotenv": "^16.4.5", "form-data": "^4.0.1", @@ -49,6 +51,7 @@ }, "devDependencies": { "@types/bn.js": "^5.1.5", + "@types/chai": "^5.0.1", "@types/node": "^22.9.0", "ts-node": "^10.9.2", "typescript": "^5.7.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 289b940..d4d7572 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,6 +50,9 @@ importers: '@metaplex-foundation/umi-web3js-adapters': specifier: ^0.9.2 version: 0.9.2(@metaplex-foundation/umi@0.9.2)(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + '@onsol/tldparser': + specifier: ^0.6.7 + version: 0.6.7(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bn.js@5.2.1)(borsh@2.0.0)(buffer@6.0.3)(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@orca-so/common-sdk': specifier: 0.6.4 version: 0.6.4(@solana/spl-token@0.4.9(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10))(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(decimal.js@10.4.3) @@ -74,6 +77,9 @@ importers: bs58: specifier: ^6.0.0 version: 6.0.0 + chai: + specifier: ^5.1.2 + version: 5.1.2 decimal.js: specifier: ^10.4.3 version: 10.4.3 @@ -96,6 +102,9 @@ importers: '@types/bn.js': specifier: ^5.1.5 version: 5.1.6 + '@types/chai': + specifier: ^5.0.1 + version: 5.0.1 '@types/node': specifier: ^22.9.0 version: 22.10.2 @@ -139,6 +148,15 @@ packages: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} + '@ethersproject/bytes@5.7.0': + resolution: {integrity: sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==} + + '@ethersproject/logger@5.7.0': + resolution: {integrity: sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==} + + '@ethersproject/sha2@5.7.0': + resolution: {integrity: sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==} + '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} @@ -194,6 +212,12 @@ packages: '@lightprotocol/stateless.js@0.17.1': resolution: {integrity: sha512-EjId1n33A6dBwpce33Wsa/fs/CDKtMtRrkxbApH0alXrnEXmbW6QhIViXOrKYXjZ4uJQM1xsBtsKe0vqJ4nbtQ==} + '@metaplex-foundation/beet-solana@0.4.1': + resolution: {integrity: sha512-/6o32FNUtwK8tjhotrvU/vorP7umBuRFvBZrC6XCk51aKidBHe5LPVPA5AjGPbV3oftMfRuXPNd9yAGeEqeCDQ==} + + '@metaplex-foundation/beet@0.7.2': + resolution: {integrity: sha512-K+g3WhyFxKPc0xIvcIjNyV1eaTVJTiuaHZpig7Xx0MuYRMoJLLvhLTnUXhFdR5Tu2l2QSyKwfyXDgZlzhULqFg==} + '@metaplex-foundation/mpl-core@1.1.1': resolution: {integrity: sha512-h1kLw+cGaV8SiykoHDb1/G01+VYqtJXAt0uGuO5+2Towsdtc6ET4M62iqUnh4EacTVMIW1yYHsKsG/LYWBCKaA==} peerDependencies: @@ -306,6 +330,15 @@ packages: resolution: {integrity: sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==} engines: {node: ^14.21.3 || >=16} + '@onsol/tldparser@0.6.7': + resolution: {integrity: sha512-QwkRDLyC514pxeplCCXZ2kTiRcJSeUrpp+9o2XqLbePy/qzZGGG8I0UbXUKuWVD/bUL1zAm21+D+Eu30OKwcQg==} + engines: {node: '>=14'} + peerDependencies: + '@solana/web3.js': ^1.95.3 + bn.js: ^5.2.1 + borsh: ^0.7.0 + buffer: 6.0.1 + '@orca-so/common-sdk@0.6.4': resolution: {integrity: sha512-iOiC6exTA9t2CEOaUPoWlNP3soN/1yZFjoz1mSf7NvOqo/PJZeIdWpB7BRXwU0mGGatjxU4SFgMGQ8NrSx+ONw==} peerDependencies: @@ -526,9 +559,15 @@ packages: '@types/bn.js@5.1.6': resolution: {integrity: sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w==} + '@types/chai@5.0.1': + resolution: {integrity: sha512-5T8ajsg3M/FOncpLYW7sdOcD6yf4+722sze/tc4KQV0P8Z2rAr3SAuHCIkYmYpt8VbcQlnz8SxlOlPQYefe4cA==} + '@types/connect@3.4.38': resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} @@ -596,15 +635,29 @@ packages: resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} engines: {node: '>=10'} + ansicolors@0.3.2: + resolution: {integrity: sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==} + arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + assert@2.1.0: + resolution: {integrity: sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==} + + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + available-typed-arrays@1.0.7: + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} + engines: {node: '>= 0.4'} + axios-retry@3.9.1: resolution: {integrity: sha512-8PJDLJv7qTTMMwdnbMvrLYuvB47M81wRtxQmEdV5w4rgbTXTt+vtPkXwajOfOdSyv/wZICJOC+/UhXH4aQ/R+w==} @@ -674,6 +727,18 @@ packages: resolution: {integrity: sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==} engines: {node: '>=6.14.2'} + call-bind-apply-helpers@1.0.1: + resolution: {integrity: sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==} + engines: {node: '>= 0.4'} + + call-bind@1.0.8: + resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==} + engines: {node: '>= 0.4'} + + call-bound@1.0.3: + resolution: {integrity: sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==} + engines: {node: '>= 0.4'} + camelcase@6.3.0: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} @@ -681,6 +746,10 @@ packages: ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} + chai@5.1.2: + resolution: {integrity: sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==} + engines: {node: '>=12'} + chalk@5.4.0: resolution: {integrity: sha512-ZkD35Mx92acjB2yNJgziGqT9oKHEOxjTBTDRpOsRWtdecL/0jM3z5kM/CTzHWvHIen1GvkM85p6TuFfDGfc8/Q==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} @@ -691,6 +760,10 @@ packages: character-entities-legacy@3.0.0: resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==} + check-error@2.1.1: + resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} + engines: {node: '>= 16'} + combined-stream@1.0.8: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} @@ -722,6 +795,15 @@ packages: dayjs@1.11.13: resolution: {integrity: sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==} + debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + decamelize@1.2.0: resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} engines: {node: '>=0.10.0'} @@ -732,6 +814,18 @@ packages: decimal.js@10.4.3: resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + + define-data-property@1.1.4: + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} + engines: {node: '>= 0.4'} + + define-properties@1.2.1: + resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} + engines: {node: '>= 0.4'} + delay@5.0.0: resolution: {integrity: sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==} engines: {node: '>=10'} @@ -758,6 +852,10 @@ packages: resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} engines: {node: '>=12'} + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + emoji-regex-xs@1.0.0: resolution: {integrity: sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==} @@ -765,6 +863,18 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + + es-object-atoms@1.0.0: + resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} + engines: {node: '>= 0.4'} + es6-promise@4.2.8: resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} @@ -803,6 +913,9 @@ packages: debug: optional: true + for-each@0.3.3: + resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + form-data-encoder@1.7.2: resolution: {integrity: sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==} @@ -814,6 +927,17 @@ packages: resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==} engines: {node: '>= 12.20'} + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + get-intrinsic@1.2.6: + resolution: {integrity: sha512-qxsEs+9A+u85HhllWJJFicJfPDhRmjzoYdl64aMWW9yRIJmSyxdn8IEkuIM530/7T+lv0TIHd8L6Q/ra0tEoeA==} + engines: {node: '>= 0.4'} + + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -823,6 +947,24 @@ packages: groq-sdk@0.5.0: resolution: {integrity: sha512-RVmhW7qZ+XZoy5fIuSdx/LGQJONpL8MHgZEW7dFwTdgkzStub2XQx6OKv28CHogijdwH41J+Npj/z2jBPu3vmw==} + has-property-descriptors@1.0.2: + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} + + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + + hash.js@1.1.7: + resolution: {integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==} + + hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} + hast-util-to-html@9.0.4: resolution: {integrity: sha512-wxQzXtdbhiwGAUKrnQJXlOPmHnEehzphwkK7aluUPQ+lEc1xefC8pblMgpp2w5ldBTEfveRIrADcrhGIWrlTDA==} @@ -838,10 +980,33 @@ packages: ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + ipaddr.js@2.2.0: resolution: {integrity: sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==} engines: {node: '>= 10'} + is-arguments@1.2.0: + resolution: {integrity: sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==} + engines: {node: '>= 0.4'} + + is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + + is-generator-function@1.0.10: + resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} + engines: {node: '>= 0.4'} + + is-nan@1.3.2: + resolution: {integrity: sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==} + engines: {node: '>= 0.4'} + + is-typed-array@1.1.15: + resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} + engines: {node: '>= 0.4'} + is-retry-allowed@2.2.0: resolution: {integrity: sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==} engines: {node: '>=10'} @@ -945,6 +1110,9 @@ packages: lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + loupe@3.1.2: + resolution: {integrity: sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==} + lower-case@2.0.2: resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} @@ -958,6 +1126,10 @@ packages: resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==} hasBin: true + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + mdast-util-to-hast@13.2.0: resolution: {integrity: sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==} @@ -987,6 +1159,9 @@ packages: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} + minimalistic-assert@1.0.1: + resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} + minimatch@9.0.5: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} @@ -1021,6 +1196,18 @@ packages: resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==} hasBin: true + object-is@1.1.6: + resolution: {integrity: sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==} + engines: {node: '>= 0.4'} + + object-keys@1.1.1: + resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} + engines: {node: '>= 0.4'} + + object.assign@4.1.7: + resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==} + engines: {node: '>= 0.4'} + oniguruma-to-es@0.8.0: resolution: {integrity: sha512-rY+/a6b+uCgoYIL9itjY0x99UUDHXmGaw7Jjk5ZvM/3cxDJifyxFr/Zm4tTmF6Tre18gAakJo7AzhKUeMNLgHA==} @@ -1058,6 +1245,14 @@ packages: pako@2.1.0: resolution: {integrity: sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==} + pathval@2.0.0: + resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} + engines: {node: '>= 14.16'} + + possible-typed-array-names@1.0.0: + resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} + engines: {node: '>= 0.4'} + property-information@6.5.0: resolution: {integrity: sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==} @@ -1099,6 +1294,10 @@ packages: engines: {node: '>=10'} hasBin: true + set-function-length@1.2.2: + resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} + engines: {node: '>= 0.4'} + shiki@1.24.3: resolution: {integrity: sha512-eMeX/ehE2IDKVs71kB4zVcDHjutNcOtm+yIRuR4sA6ThBbdFI0DffGJiyoKCodj0xRGxIoWC3pk/Anmm5mzHmA==} @@ -1220,6 +1419,9 @@ packages: resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} engines: {node: '>=6.14.2'} + util@0.12.5: + resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + uuid@10.0.0: resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} hasBin: true @@ -1255,6 +1457,10 @@ packages: whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + which-typed-array@1.1.18: + resolution: {integrity: sha512-qEcY+KJYlWyLH9vNbsr6/5j59AXk5ni5aakf8ldzBvGde6Iz4sxZGkJyWSAueTG7QhOvNRYb1lDdFmL5Td0QKA==} + engines: {node: '>= 0.4'} + ws@7.5.10: resolution: {integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==} engines: {node: '>=8.3.0'} @@ -1364,6 +1570,18 @@ snapshots: dependencies: '@jridgewell/trace-mapping': 0.3.9 + '@ethersproject/bytes@5.7.0': + dependencies: + '@ethersproject/logger': 5.7.0 + + '@ethersproject/logger@5.7.0': {} + + '@ethersproject/sha2@5.7.0': + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + hash.js: 1.1.7 + '@jridgewell/resolve-uri@3.1.2': {} '@jridgewell/sourcemap-codec@1.5.0': {} @@ -1463,6 +1681,27 @@ snapshots: - encoding - utf-8-validate + '@metaplex-foundation/beet-solana@0.4.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@metaplex-foundation/beet': 0.7.2 + '@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bs58: 5.0.0 + debug: 4.4.0 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + + '@metaplex-foundation/beet@0.7.2': + dependencies: + ansicolors: 0.3.2 + assert: 2.1.0 + bn.js: 5.2.1 + debug: 4.4.0 + transitivePeerDependencies: + - supports-color + '@metaplex-foundation/mpl-core@1.1.1(@metaplex-foundation/umi@0.9.2)(@noble/hashes@1.6.1)': dependencies: '@metaplex-foundation/umi': 0.9.2 @@ -1583,6 +1822,20 @@ snapshots: '@noble/hashes@1.6.1': {} + '@onsol/tldparser@0.6.7(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bn.js@5.2.1)(borsh@2.0.0)(buffer@6.0.3)(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@ethersproject/sha2': 5.7.0 + '@metaplex-foundation/beet-solana': 0.4.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@solana/web3.js': 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + bn.js: 5.2.1 + borsh: 2.0.0 + buffer: 6.0.3 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + '@orca-so/common-sdk@0.6.4(@solana/spl-token@0.4.9(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10))(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(decimal.js@10.4.3)': dependencies: '@solana/spl-token': 0.4.9(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10) @@ -1983,10 +2236,16 @@ snapshots: dependencies: '@types/node': 22.10.2 + '@types/chai@5.0.1': + dependencies: + '@types/deep-eql': 4.0.2 + '@types/connect@3.4.38': dependencies: '@types/node': 22.10.2 + '@types/deep-eql@4.0.2': {} + '@types/hast@3.0.4': dependencies: '@types/unist': 3.0.3 @@ -2051,12 +2310,28 @@ snapshots: ansi-styles@5.2.0: {} + ansicolors@0.3.2: {} + arg@4.1.3: {} argparse@2.0.1: {} + assert@2.1.0: + dependencies: + call-bind: 1.0.8 + is-nan: 1.3.2 + object-is: 1.1.6 + object.assign: 4.1.7 + util: 0.12.5 + + assertion-error@2.0.1: {} + asynckit@0.4.0: {} + available-typed-arrays@1.0.7: + dependencies: + possible-typed-array-names: 1.0.0 + axios-retry@3.9.1: dependencies: '@babel/runtime': 7.26.0 @@ -2134,16 +2409,43 @@ snapshots: node-gyp-build: 4.8.4 optional: true + call-bind-apply-helpers@1.0.1: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + + call-bind@1.0.8: + dependencies: + call-bind-apply-helpers: 1.0.1 + es-define-property: 1.0.1 + get-intrinsic: 1.2.6 + set-function-length: 1.2.2 + + call-bound@1.0.3: + dependencies: + call-bind-apply-helpers: 1.0.1 + get-intrinsic: 1.2.6 + camelcase@6.3.0: {} ccount@2.0.1: {} + chai@5.1.2: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.1 + deep-eql: 5.0.2 + loupe: 3.1.2 + pathval: 2.0.0 + chalk@5.4.0: {} character-entities-html4@2.1.0: {} character-entities-legacy@3.0.0: {} + check-error@2.1.1: {} + combined-stream@1.0.8: dependencies: delayed-stream: 1.0.0 @@ -2168,12 +2470,30 @@ snapshots: dayjs@1.11.13: {} + debug@4.4.0: + dependencies: + ms: 2.1.3 + decamelize@1.2.0: {} decimal.js-light@2.5.1: {} decimal.js@10.4.3: {} + deep-eql@5.0.2: {} + + define-data-property@1.1.4: + dependencies: + es-define-property: 1.0.1 + es-errors: 1.3.0 + gopd: 1.2.0 + + define-properties@1.2.1: + dependencies: + define-data-property: 1.1.4 + has-property-descriptors: 1.0.2 + object-keys: 1.1.1 + delay@5.0.0: {} delayed-stream@1.0.0: {} @@ -2193,10 +2513,24 @@ snapshots: dotenv@16.4.7: {} + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.1 + es-errors: 1.3.0 + gopd: 1.2.0 + emoji-regex-xs@1.0.0: {} entities@4.5.0: {} + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + + es-object-atoms@1.0.0: + dependencies: + es-errors: 1.3.0 + es6-promise@4.2.8: {} es6-promisify@5.0.0: @@ -2219,6 +2553,10 @@ snapshots: follow-redirects@1.15.9: {} + for-each@0.3.3: + dependencies: + is-callable: 1.2.7 + form-data-encoder@1.7.2: {} form-data@4.0.1: @@ -2232,6 +2570,23 @@ snapshots: node-domexception: 1.0.0 web-streams-polyfill: 4.0.0-beta.3 + function-bind@1.1.2: {} + + get-intrinsic@1.2.6: + dependencies: + call-bind-apply-helpers: 1.0.1 + dunder-proto: 1.0.1 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.0.0 + function-bind: 1.1.2 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.2 + math-intrinsics: 1.1.0 + + gopd@1.2.0: {} + graceful-fs@4.2.11: optional: true @@ -2253,6 +2608,25 @@ snapshots: transitivePeerDependencies: - encoding + has-property-descriptors@1.0.2: + dependencies: + es-define-property: 1.0.1 + + has-symbols@1.1.0: {} + + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 + + hash.js@1.1.7: + dependencies: + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + + hasown@2.0.2: + dependencies: + function-bind: 1.1.2 + hast-util-to-html@9.0.4: dependencies: '@types/hast': 3.0.4 @@ -2279,6 +2653,8 @@ snapshots: ieee754@1.2.1: {} + inherits@2.0.4: {} + ipaddr.js@2.2.0: {} is-retry-allowed@2.2.0: {} @@ -2372,6 +2748,8 @@ snapshots: lodash@4.17.21: {} + loupe@3.1.2: {} + lower-case@2.0.2: dependencies: tslib: 2.8.1 @@ -2389,6 +2767,8 @@ snapshots: punycode.js: 2.3.1 uc.micro: 2.1.0 + math-intrinsics@1.1.0: {} + mdast-util-to-hast@13.2.0: dependencies: '@types/hast': 3.0.4 @@ -2426,6 +2806,8 @@ snapshots: dependencies: mime-db: 1.52.0 + minimalistic-assert@1.0.1: {} + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 @@ -2450,6 +2832,22 @@ snapshots: node-gyp-build@4.8.4: optional: true + object-is@1.1.6: + dependencies: + call-bind: 1.0.8 + define-properties: 1.2.1 + + object-keys@1.1.1: {} + + object.assign@4.1.7: + dependencies: + call-bind: 1.0.8 + call-bound: 1.0.3 + define-properties: 1.2.1 + es-object-atoms: 1.0.0 + has-symbols: 1.1.0 + object-keys: 1.1.1 + oniguruma-to-es@0.8.0: dependencies: emoji-regex-xs: 1.0.0 @@ -2492,6 +2890,10 @@ snapshots: pako@2.1.0: {} + pathval@2.0.0: {} + + possible-typed-array-names@1.0.0: {} + property-information@6.5.0: {} proxy-from-env@1.1.0: {} @@ -2531,6 +2933,15 @@ snapshots: semver@7.6.3: {} + set-function-length@1.2.2: + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.2.6 + gopd: 1.2.0 + has-property-descriptors: 1.0.2 + shiki@1.24.3: dependencies: '@shikijs/core': 1.24.3 @@ -2656,6 +3067,14 @@ snapshots: node-gyp-build: 4.8.4 optional: true + util@0.12.5: + dependencies: + inherits: 2.0.4 + is-arguments: 1.2.0 + is-generator-function: 1.0.10 + is-typed-array: 1.1.15 + which-typed-array: 1.1.18 + uuid@10.0.0: {} uuid@8.3.2: {} @@ -2685,6 +3104,15 @@ snapshots: tr46: 0.0.3 webidl-conversions: 3.0.1 + which-typed-array@1.1.18: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.3 + for-each: 0.3.3 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10): optionalDependencies: bufferutil: 4.0.8 diff --git a/src/agent/index.ts b/src/agent/index.ts index 344c47a..9ecf699 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -43,6 +43,7 @@ import { PumpFunTokenOptions, } from "../types"; import { BN } from "@coral-xyz/anchor"; +import { NameAccountAndDomain } from "@onsol/tldparser"; /** * Main class for interacting with Solana blockchain @@ -211,22 +212,26 @@ export class SolanaAgentKit { ); } - async resolveAllDomains(domain: string): Promise { + async resolveAllDomains(domain: string): Promise { return resolveAllDomains(this, domain); } - async getOwnedAllDomains(owner: PublicKey): Promise { + async getOwnedAllDomains( + owner: PublicKey + ): Promise { return getOwnedAllDomains(this, owner); } async getOwnedDomainsForTLD( - owner: PublicKey, tld: string - ): Promise { - return getOwnedDomainsForTLD(this, owner, tld); + ):Promise { + return getOwnedDomainsForTLD(this, tld); } - async getAllDomainsTLDs(): Promise { + async getAllDomainsTLDs(): Promise> { return getAllDomainsTLDs(this); } @@ -242,7 +247,7 @@ export class SolanaAgentKit { marketId: PublicKey, baseAmount: BN, quoteAmount: BN, - startTime: BN, + startTime: BN ): Promise { return raydiumCreateAmmV4( this, @@ -251,8 +256,8 @@ export class SolanaAgentKit { baseAmount, quoteAmount, - startTime, - ); + startTime + );; } async raydiumCreateClmm( @@ -260,7 +265,7 @@ export class SolanaAgentKit { mint2: PublicKey, configId: PublicKey, initialPrice: Decimal, - startTime: BN, + startTime: BN ): Promise { return raydiumCreateClmm( this, @@ -278,7 +283,7 @@ export class SolanaAgentKit { configId: PublicKey, mintAAmount: BN, mintBAmount: BN, - startTime: BN, + startTime: BN ): Promise { return raydiumCreateCpmm( this, @@ -287,7 +292,8 @@ export class SolanaAgentKit { configId, mintAAmount, mintBAmount, - startTime, + + startTime ); } @@ -295,7 +301,7 @@ export class SolanaAgentKit { baseMint: PublicKey, quoteMint: PublicKey, lotSize: number = 1, - tickSize: number = 0.01, + tickSize: number = 0.01 ): Promise { return openbookCreateMarket( this, diff --git a/src/langchain/index.ts b/src/langchain/index.ts index afb214f..f8c76f7 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -1040,6 +1040,12 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) { new SolanaOpenbookCreateMarket(solanaKit), new SolanaCreateSingleSidedWhirlpoolTool(solanaKit), new SolanaPythFetchPrice(solanaKit), + new SolanaResolveDomain(solanaKit), + new SolanaGetOwnedDomains(solanaKit), + new SolanaGetOwnedTldDomains(solanaKit), + new SolanaGetAllTlds(solanaKit), + new SolanaGetAllRegisteredDomains(solanaKit), + new SolanaGetMainDomain(solanaKit), ]; } diff --git a/src/tools/get_all_active_tlds.ts b/src/tools/get_all_active_tlds.ts deleted file mode 100644 index 929fbfc..0000000 --- a/src/tools/get_all_active_tlds.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - NameRegistryState, - getAllDomains, - ROOT_DOMAIN_ACCOUNT, -} from "@bonfida/spl-name-service"; -import { Connection, PublicKey } from "@solana/web3.js"; -import { SolanaAgentKit } from "../index"; - -/** - * Get all active top-level domains (TLDs) in the Solana name service - * @param agent SolanaAgentKit instance - * @returns Array of active TLD strings - */ -export async function getAllDomainsTLDs( - agent: SolanaAgentKit -): Promise { - try { - // Get the root domain record - const rootAccount = await NameRegistryState.retrieve( - agent.connection, - ROOT_DOMAIN_ACCOUNT - ); - - if (!rootAccount) { - throw new Error("Root domain account not found"); - } - - // Fetch all TLD records under the root domain - const tldAccounts = await agent.connection.getProgramAccounts( - new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"), - { - filters: [ - { - memcmp: { - offset: 0, - bytes: rootAccount.registry.owner.toBase58(), - }, - }, - ], - } - ); - - // Parse the TLD names from the accounts - const tlds: string[] = []; - for (const account of tldAccounts) { - const registry = await NameRegistryState.retrieve( - agent.connection, - account.pubkey - ); - - if (registry && registry.registry.data) { - const tldName = Buffer.from(registry.registry.data) - .toString() - .replace(/\0/g, ""); - if (tldName) { - tlds.push(tldName); - } - } - } - - return tlds; - } catch (error: any) { - throw new Error(`Failed to fetch TLDs: ${error.message}`); - } -} diff --git a/src/tools/get_all_domains_tlds.ts b/src/tools/get_all_domains_tlds.ts new file mode 100644 index 0000000..d46fdba --- /dev/null +++ b/src/tools/get_all_domains_tlds.ts @@ -0,0 +1,21 @@ +import { Connection, PublicKey } from "@solana/web3.js"; +import { SolanaAgentKit } from "../index"; +import { getAllTld } from "@onsol/tldparser"; + +/** + * Get all active top-level domains (TLDs) in the Solana name service + * @param agent SolanaAgentKit instance + * @returns Array of active TLD strings + */ +export async function getAllDomainsTLDs( + agent: SolanaAgentKit +): Promise> { + try { + return getAllTld(agent.connection) + } catch (error: any) { + throw new Error(`Failed to fetch TLDs: ${error.message}`); + } +} \ No newline at end of file diff --git a/src/tools/get_all_registered_all_domains.ts b/src/tools/get_all_registered_all_domains.ts index dc0f0a4..5520a48 100644 --- a/src/tools/get_all_registered_all_domains.ts +++ b/src/tools/get_all_registered_all_domains.ts @@ -1,7 +1,7 @@ import { getAllDomains } from "@bonfida/spl-name-service"; import { SolanaAgentKit } from "../agent"; import { PublicKey } from "@solana/web3.js"; -import { getAllDomainsTLDs } from "./get_all_active_tlds"; +import { getAllDomainsTLDs } from "./get_all_domains_tlds"; /** * Get all registered domains across all TLDs @@ -20,7 +20,7 @@ export async function getAllRegisteredAllDomains( for (const tld of tlds) { const domains = await getAllDomains( agent.connection, - new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"), + new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX") ); // Add domains with TLD suffix diff --git a/src/tools/get_main_domain.ts b/src/tools/get_main_all_domains_domain.ts similarity index 68% rename from src/tools/get_main_domain.ts rename to src/tools/get_main_all_domains_domain.ts index 775c343..98f0dcd 100644 --- a/src/tools/get_main_domain.ts +++ b/src/tools/get_main_all_domains_domain.ts @@ -6,16 +6,19 @@ import { PublicKey } from "@solana/web3.js"; * Get the user's main/favorite domain for a SolanaAgentKit instance * @param agent SolanaAgentKit instance * @param owner Owner's public key - * @returns Promise resolving to the main domain name or null if not set + * @returns Promise resolving to the main domain name or null if not found */ export async function getMainAllDomainsDomain( agent: any, owner: PublicKey ): Promise { + let mainDomain = null; try { - const favDomain = await _getFavoriteDomain(agent.connection, owner); - return favDomain.stale ? null : favDomain.reverse; + mainDomain = await _getFavoriteDomain(agent.connection, owner); + return mainDomain.stale ? null : mainDomain.reverse; } catch (error: any) { - throw new Error(`Failed to fetch main domain: ${error.message}`); + console.log("No main/favorite domain found"); } -} \ No newline at end of file + return null +} + diff --git a/src/tools/get_owned_all_domains.ts b/src/tools/get_owned_all_domains.ts new file mode 100644 index 0000000..c626658 --- /dev/null +++ b/src/tools/get_owned_all_domains.ts @@ -0,0 +1,20 @@ +import { SolanaAgentKit } from "../agent"; +import { PublicKey } from "@solana/web3.js"; +import { NameAccountAndDomain, TldParser } from "@onsol/tldparser"; + +/** + * Get all domains owned domains for a specific TLD for the agent's wallet + * @param agent SolanaAgentKit instance + * @param owner - PublicKey of the owner + * @returns Promise resolving to an array of owned domains or an empty array if none are found + */ +export async function getOwnedAllDomains( + agent: SolanaAgentKit, + owner:PublicKey +): Promise { + try { + return new TldParser(agent.connection).getParsedAllUserDomains(owner); + } catch (error: any) { + throw new Error(`Failed to fetch owned domains: ${error.message}`); + } +} diff --git a/src/tools/get_domains_on_tld.ts b/src/tools/get_owned_domains_for_tld.ts similarity index 54% rename from src/tools/get_domains_on_tld.ts rename to src/tools/get_owned_domains_for_tld.ts index 045f44a..16c3cb9 100644 --- a/src/tools/get_domains_on_tld.ts +++ b/src/tools/get_owned_domains_for_tld.ts @@ -1,23 +1,25 @@ +import { NameAccountAndDomain, TldParser } from "@onsol/tldparser"; import { SolanaAgentKit } from "../agent"; -import { getOwnedAllDomains } from "./lookup_owner"; import { PublicKey } from "@solana/web3.js"; - /** * Get all domains owned by an address for a specific TLD * @param agent SolanaAgentKit instance - * @param owner Owner's public key * @param tld Top-level domain (e.g., "sol") - * @returns Array of owned domain names for the specified TLD + * @returns Promise resolving to an array of owned domain names for the specified TLD or an empty array if none are found */ export async function getOwnedDomainsForTLD( agent: SolanaAgentKit, - owner: PublicKey, tld: string -): Promise { +): Promise { try { - const allDomains = await getOwnedAllDomains(agent, owner); - return allDomains.filter(domain => domain.endsWith(`.${tld}`)); + return new TldParser(agent.connection) + .getParsedAllUserDomainsFromTld( + agent.wallet_address, + tld + ) } catch (error: any) { throw new Error(`Failed to fetch domains for TLD: ${error.message}`); } } + + diff --git a/src/tools/index.ts b/src/tools/index.ts index 85e338a..38fcdb5 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -16,11 +16,11 @@ export * from "./stake_with_jup"; export * from "./fetch_price"; export * from "./send_compressed_airdrop"; export * from "./create_orca_single_sided_whirlpool"; -export * from "./get_all_active_tlds"; +export * from "./get_all_domains_tlds"; export * from "./get_all_registered_all_domains"; -export * from "./get_domains_on_tld"; -export * from "./get_main_domain"; -export * from "./lookup_owner"; +export * from "./get_owned_domains_for_tld"; +export * from "./get_main_all_domains_domain"; +export * from "./get_owned_all_domains"; export * from "./resolve_domain"; export * from "./raydium_create_ammV4"; diff --git a/src/tools/lookup_owner.ts b/src/tools/lookup_owner.ts deleted file mode 100644 index cffd264..0000000 --- a/src/tools/lookup_owner.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { getAllDomains } from "@bonfida/spl-name-service"; -import { SolanaAgentKit } from "../agent"; -import { PublicKey } from "@solana/web3.js"; - -/** - * Get all domains owned by a specific address - * @param agent SolanaAgentKit instance - * @param owner Owner's public key - * @returns Array of owned domain names - */ -export async function getOwnedAllDomains( - agent: SolanaAgentKit, - owner: PublicKey -): Promise { - try { - const domains = await getAllDomains(agent.connection, owner); - return domains.map(domain => domain.toString()); - } catch (error: any) { - throw new Error(`Failed to fetch owned domains: ${error.message}`); - } -} diff --git a/src/tools/resolve_domain.ts b/src/tools/resolve_domain.ts index 3ea5e41..2ba5f4d 100644 --- a/src/tools/resolve_domain.ts +++ b/src/tools/resolve_domain.ts @@ -1,42 +1,22 @@ -import { Buffer } from "buffer"; -import { PublicKey } from "@solana/web3.js"; -import { - getNameAccountKeySync, - NAME_PROGRAM_ID, -} from "@bonfida/spl-name-service"; +import { TldParser } from "@onsol/tldparser"; import { SolanaAgentKit } from "../index"; +import { PublicKey } from "@solana/web3.js"; /** - * Resolve a domain to its public key + * Resolve all domains for a given agent and domain * @param agent SolanaAgentKit instance * @param domain Domain name to resolve - * @returns Associated public key or null if not found + * @returns Promise resolving to the domain or undefined if not found */ export async function resolveAllDomains( agent: SolanaAgentKit, domain: string -): Promise { +): Promise { try { - // Convert domain name to buffer for hashing - const hashedDomain = Buffer.from(domain); - - // Get the name account key using the new sync method - const nameAccountKey = getNameAccountKeySync( - hashedDomain, - undefined, // nameClass - undefined // nameParent - ); - - // Get the account info to retrieve the owner - const owner = await agent.connection.getAccountInfo(nameAccountKey); - - if (!owner) { - return null; - } - - // The owner's public key is stored in the data buffer starting at offset 32 - return new PublicKey(owner.data.slice(32, 64)); + let tld = new TldParser(agent.connection).getOwnerFromDomainTld(domain) + return tld; } catch (error: any) { throw new Error(`Domain resolution failed: ${error.message}`); } } + diff --git a/test/domain_methods.test.ts b/test/domain_methods.test.ts new file mode 100644 index 0000000..2485ed7 --- /dev/null +++ b/test/domain_methods.test.ts @@ -0,0 +1,146 @@ + +import { SolanaAgentKit } from "../src"; +import { PublicKey } from "@solana/web3.js"; +import * as dotenv from "dotenv"; +import { expect } from "chai"; +import { before, describe, it } from "node:test"; +import { TldParser } from "@onsol/tldparser"; + +dotenv.config(); + +describe("Solana Domain Methods Tests", () => { + let agent: SolanaAgentKit; + + before(() => { + // Initialize the agent before running tests + if ( + !process.env.SOLANA_PRIVATE_KEY || + !process.env.RPC_URL || + !process.env.OPENAI_API_KEY + ) { + throw new Error("Required environment variables are not set"); + } + + agent = new SolanaAgentKit( + process.env.SOLANA_PRIVATE_KEY, + process.env.RPC_URL, + process.env.OPENAI_API_KEY + ); + }); + + describe("resolveAllDomains", () => { + it("should resolve a valid domain to a public key", async () => { + const testDomain = "hero.sol"; + const result = await agent.resolveAllDomains(testDomain); + expect(result).to.be.instanceof(PublicKey); + }); + it("should perform fetching of an owner an nft domain", async () => { + const parser = new TldParser(agent.connection); + const domanTld = "miester.sol"; + const ownerReceived = await parser.getOwnerFromDomainTld(domanTld); + const owner = new PublicKey( + "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67" + ); + expect(ownerReceived).to.be(owner.toString()); + }); + it("should return null for non-existent domain", async () => { + const nonExistentDomain = "nonexistent123456789.sol"; + const result = await agent.resolveAllDomains(nonExistentDomain); + expect(result).to.be.null; + }); + + it("should handle invalid domain format", async () => { + const invalidDomain = ""; + try { + await agent.resolveAllDomains(invalidDomain); + expect.fail("Should have thrown an error"); + } catch (error) { + expect(error).to.be.instanceof(Error); + } + }); + }); + + describe("getOwnedAllDomains", () => { + it("should return array of domains for an owner", async () => { + const owner = new PublicKey( + "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67" + ); + const domains = await agent.getOwnedAllDomains(owner); + expect(domains).to.be.an("array").that.includes("miester.sol"); + domains.forEach((domain) => { + expect(domain).to.be.a("string"); + }); + }); + it("should return array of domains for an owner", async () => { + const owner = new PublicKey(agent.wallet_address); + const domains = await agent.getOwnedAllDomains(owner); + expect(domains).to.be.an("array"); + domains.forEach((domain) => { + expect(domain).to.be.a("string"); + }); + }); + + it("should handle owner with no domains", async () => { + // Create a new random public key that likely owns no domains + const emptyOwner = PublicKey.unique(); + const domains = await agent.getOwnedAllDomains(emptyOwner); + expect(domains).to.be.an("array"); + expect(domains).to.have.lengthOf(0); + }); + }); + + describe("getOwnedDomainsForTLD", () => { + it("should return domains for specific TLD", async () => { + const tld = "sol"; + const domains = await agent.getOwnedDomainsForTLD(tld); + expect(domains).to.be.an("array"); + domains.forEach((domain) => { + console.log(`these are the domains ${domain.domain}`) + }); + }); + + it("should return empty array for non-existent TLD", async () => { + const nonExistentTLD = "nonexistent"; + const domains = await agent.getOwnedDomainsForTLD(nonExistentTLD); + expect(domains).to.be.an("array"); + expect(domains).to.have.lengthOf(0); + }); + }); + + describe("getAllDomainsTLDs", () => { + it("should return array of TLDs", async () => { + const tlds = await agent.getAllDomainsTLDs(); + expect(tlds).to.be.an("array"); + }); + }); + + describe("getAllRegisteredAllDomains", () => { + it("should return array of all registered domains", async () => { + const domains = await agent.getAllRegisteredAllDomains(); + expect(domains).to.be.an("array"); + domains.forEach((domain) => { + expect(domain).to.be.a("string"); + expect(domain).to.include("."); + }); + }); + }); + + describe("getMainAllDomainsDomain", () => { + it("should return main domain or null for an owner", async () => { + const owner = new PublicKey( + "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67" + ); + const mainDomain = await agent.getMainAllDomainsDomain(owner); + expect(mainDomain).to.satisfy((domain: string | null) => { + return domain === null || typeof domain === "string"; + }); + }); + + it("should return null for address without main domain", async () => { + const emptyOwner = PublicKey.unique(); + const mainDomain = await agent.getMainAllDomainsDomain(emptyOwner); + expect(mainDomain).to.be.null; + }); + }); +}); + From cec8b33105264ed424a0a4ba9db01e09c44f2e5f Mon Sep 17 00:00:00 2001 From: aryan Date: Mon, 23 Dec 2024 13:57:20 +0530 Subject: [PATCH 25/31] wip: alldomain + sns --- package.json | 2 +- pnpm-lock.yaml | 3 ++ src/langchain/index.ts | 68 +++++++++++++++++++++--------------------- 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 147688f..0a8aa00 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "build": "tsc", "docs": "typedoc src --out docs", - "test": "ts-node test/**/*.ts", + "test": "ts-node test/index.ts", "generate": "ts-node src/utils/keypair.ts" }, "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cb9472e..256e519 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,6 +38,9 @@ importers: '@metaplex-foundation/mpl-token-metadata': specifier: ^3.3.0 version: 3.3.0(@metaplex-foundation/umi@0.9.2) + '@metaplex-foundation/mpl-toolbox': + specifier: ^0.9.4 + version: 0.9.4(@metaplex-foundation/umi@0.9.2) '@metaplex-foundation/umi': specifier: ^0.9.2 version: 0.9.2 diff --git a/src/langchain/index.ts b/src/langchain/index.ts index a4bfe2a..50403c9 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -343,9 +343,10 @@ export class SolanaRegisterDomainTool extends Tool { export class SolanaResolveDomainTool extends Tool { name = "solana_resolve_domain"; description = `Resolve a .sol domain to a Solana PublicKey. + For other domains, use the solana_resolve_all_domains tool. Inputs: - domain: string, eg "pumpfun.sol" or "pumpfun"(required) + domain: string, eg "pumpfun.sol" (required) `; constructor(private solanaKit: SolanaAgentKit) { @@ -980,12 +981,12 @@ export class SolanaOpenbookCreateMarket extends Tool { } } -export class SolanaResolveDomain extends Tool { - name = "solana_resolve_domain"; - description = `Resolve a Solana domain name to its owner's public key - Inputs (input is a json string): - domain: string (required) - The domain name to resolve (e.g., "mydomain.sol") - `; +export class SolanaResolveAllDomainsTool extends Tool { + name = "solana_resolve_all_domains"; + description = `Resolve a domain name to a public key. + + Input: + domain: string, eg "mydomain.blink" or "mydomain.bonk" (required)`; constructor(private solanaKit: SolanaAgentKit) { super(); @@ -993,8 +994,8 @@ export class SolanaResolveDomain extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input); - const owner = await this.solanaKit.resolveAllDomains(inputFormat.domain); + console.log(input) + const owner = await this.solanaKit.resolveAllDomains(input); return JSON.stringify({ status: "success", @@ -1010,12 +1011,13 @@ export class SolanaResolveDomain extends Tool { } } } + export class SolanaGetOwnedDomains extends Tool { name = "solana_get_owned_domains"; - description = `Get all domains owned by a specific wallet address - Inputs (input is a json string): - owner: string (required) - The public key of the domain owner - `; + description = `Get all domains owned by a specific wallet address. + + Inputs: + owner: string, eg "4Be9CvxqHW6BYiRAxW9Q3xu1ycTMWaL5z8NX4HR3ha7t" (required)`; constructor(private solanaKit: SolanaAgentKit) { super(); @@ -1023,8 +1025,7 @@ export class SolanaGetOwnedDomains extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input); - const ownerPubkey = new PublicKey(inputFormat.owner); + const ownerPubkey = new PublicKey(input); const domains = await this.solanaKit.getOwnedAllDomains(ownerPubkey); return JSON.stringify({ @@ -1044,10 +1045,10 @@ export class SolanaGetOwnedDomains extends Tool { export class SolanaGetOwnedTldDomains extends Tool { name = "solana_get_owned_tld_domains"; - description = `Get all domains owned by the agent's wallet for a specific TLD - Inputs (input is a json string): - tld: string (required) - The top-level domain to search (e.g., "sol") - `; + description = `Get all domains owned by the agent's wallet for a specific TLD. + + Inputs: + tld: string, eg "sol" (required)`; constructor(private solanaKit: SolanaAgentKit) { super(); @@ -1055,9 +1056,8 @@ export class SolanaGetOwnedTldDomains extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input); const domains = await this.solanaKit.getOwnedDomainsForTLD( - inputFormat.tld + input ); return JSON.stringify({ @@ -1074,17 +1074,16 @@ export class SolanaGetOwnedTldDomains extends Tool { } } } + export class SolanaGetAllTlds extends Tool { name = "solana_get_all_tlds"; - description = `Get all active top-level domains (TLDs) in the Solana name service - Inputs (input is a json string): {} - No additional parameters required`; + description = `Get all active top-level domains (TLDs) in the Solana name service` constructor(private solanaKit: SolanaAgentKit) { super(); } - async _call(input: string): Promise { + async _call(): Promise { try { const tlds = await this.solanaKit.getAllDomainsTLDs(); @@ -1102,17 +1101,16 @@ export class SolanaGetAllTlds extends Tool { } } } + export class SolanaGetAllRegisteredDomains extends Tool { name = "solana_get_all_registered_domains"; - description = `Get all registered domains across all TLDs in the Solana name service - Inputs (input is a json string): {} - No additional parameters required`; + description = `Get all registered domains across all TLDs in the Solana name service` constructor(private solanaKit: SolanaAgentKit) { super(); } - async _call(input: string): Promise { + async _call(): Promise { try { const domains = await this.solanaKit.getAllRegisteredAllDomains(); @@ -1130,12 +1128,13 @@ export class SolanaGetAllRegisteredDomains extends Tool { } } } + export class SolanaGetMainDomain extends Tool { name = "solana_get_main_domain"; - description = `Get the user's main/favorite domain - Inputs (input is a json string): - owner: string (required) - The public key of the domain owner - `; + description = `Get the main/favorite domain for a given wallet address. + + Inputs (input is a JSON string): + owner: string, eg "4Be9CvxqHW6BYiRAxW9Q3xu1ycTMWaL5z8NX4HR3ha7t" (required)`; constructor(private solanaKit: SolanaAgentKit) { super(); @@ -1163,6 +1162,7 @@ export class SolanaGetMainDomain extends Tool { } } } + export function createSolanaTools(solanaKit: SolanaAgentKit) { return [ new SolanaBalanceTool(solanaKit), @@ -1190,7 +1190,7 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) { new SolanaRaydiumCreateCpmm(solanaKit), new SolanaOpenbookCreateMarket(solanaKit), new SolanaCreateSingleSidedWhirlpoolTool(solanaKit), - new SolanaResolveDomain(solanaKit), + new SolanaResolveAllDomainsTool(solanaKit), new SolanaGetOwnedDomains(solanaKit), new SolanaGetOwnedTldDomains(solanaKit), new SolanaGetAllTlds(solanaKit), From 737d5ce86b966dfc17ffc13a07a0c1c006c44d0c Mon Sep 17 00:00:00 2001 From: aryan Date: Wed, 25 Dec 2024 04:26:06 +0530 Subject: [PATCH 26/31] feat: tool description + types --- package.json | 3 +- src/agent/index.ts | 9 +-- src/langchain/index.ts | 95 ++++++++++---------------- src/tools/get_all_domains_tlds.ts | 10 ++- src/tools/get_owned_all_domains.ts | 5 +- src/tools/get_owned_domains_for_tld.ts | 8 +-- src/tools/resolve_domain.ts | 14 +++- 7 files changed, 64 insertions(+), 80 deletions(-) diff --git a/package.json b/package.json index cd4008d..2882be6 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "scripts": { "build": "tsc", "docs": "typedoc src --out docs", - "test": "ts-node test/**/*.ts", + "test": "ts-node test/index.ts", + "test:domain": "ts-node test/domain_methods.test.ts", "generate": "ts-node src/utils/keypair.ts" }, "engines": { diff --git a/src/agent/index.ts b/src/agent/index.ts index 9ecf699..6eafa1d 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -218,20 +218,17 @@ export class SolanaAgentKit { async getOwnedAllDomains( owner: PublicKey - ): Promise { + ): Promise { return getOwnedAllDomains(this, owner); } async getOwnedDomainsForTLD( tld: string - ):Promise { + ):Promise { return getOwnedDomainsForTLD(this, tld); } - async getAllDomainsTLDs(): Promise> { + async getAllDomainsTLDs(): Promise { return getAllDomainsTLDs(this); } diff --git a/src/langchain/index.ts b/src/langchain/index.ts index 9a34f77..a5fd13c 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -342,8 +342,9 @@ export class SolanaRegisterDomainTool extends Tool { export class SolanaResolveDomainTool extends Tool { name = "solana_resolve_domain"; - description = `Resolve a .sol domain to a Solana PublicKey. - For other domains, use the solana_resolve_all_domains tool. + description = `Resolve ONLY .sol domain names to a Solana PublicKey. + This tool is exclusively for .sol domains. + DO NOT use this for other domain types like .blink, .bonk, etc. Inputs: domain: string, eg "pumpfun.sol" (required) @@ -777,7 +778,11 @@ export class SolanaCreateSingleSidedWhirlpoolTool extends Tool { const feeTier = inputFormat.feeTier; if (!feeTier || !(feeTier in FEE_TIERS)) { - throw new Error(`Invalid feeTier. Available options: ${Object.keys(FEE_TIERS).join(", ")}`); + throw new Error( + `Invalid feeTier. Available options: ${Object.keys(FEE_TIERS).join( + ", " + )}` + ); } const txId = await this.solanaKit.createOrcaSingleSidedWhirlpool( @@ -786,7 +791,7 @@ export class SolanaCreateSingleSidedWhirlpoolTool extends Tool { otherTokenMint, initialPrice, maxPrice, - feeTier, + feeTier ); return JSON.stringify({ @@ -804,7 +809,6 @@ export class SolanaCreateSingleSidedWhirlpoolTool extends Tool { } } - export class SolanaRaydiumCreateAmmV4 extends Tool { name = "raydium_create_ammV4"; description = `Raydium's Legacy AMM that requiers an OpenBook marketID @@ -822,13 +826,13 @@ export class SolanaRaydiumCreateAmmV4 extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input) + let inputFormat = JSON.parse(input); const tx = await this.solanaKit.raydiumCreateAmmV4( new PublicKey(inputFormat.marketId), new BN(inputFormat.baseAmount), new BN(inputFormat.quoteAmount), - new BN(inputFormat.startTime), + new BN(inputFormat.startTime) ); return JSON.stringify({ @@ -864,7 +868,7 @@ export class SolanaRaydiumCreateClmm extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input) + let inputFormat = JSON.parse(input); const tx = await this.solanaKit.raydiumCreateClmm( new PublicKey(inputFormat.mint1), @@ -873,7 +877,7 @@ export class SolanaRaydiumCreateClmm extends Tool { new PublicKey(inputFormat.configId), new Decimal(inputFormat.initialPrice), - new BN(inputFormat.startTime), + new BN(inputFormat.startTime) ); return JSON.stringify({ @@ -910,7 +914,7 @@ export class SolanaRaydiumCreateCpmm extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input) + let inputFormat = JSON.parse(input); const tx = await this.solanaKit.raydiumCreateCpmm( new PublicKey(inputFormat.mint1), @@ -921,7 +925,7 @@ export class SolanaRaydiumCreateCpmm extends Tool { new BN(inputFormat.mintAAmount), new BN(inputFormat.mintBAmount), - new BN(inputFormat.startTime), + new BN(inputFormat.startTime) ); return JSON.stringify({ @@ -956,14 +960,14 @@ export class SolanaOpenbookCreateMarket extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input) + let inputFormat = JSON.parse(input); const tx = await this.solanaKit.openbookCreateMarket( new PublicKey(inputFormat.baseMint), new PublicKey(inputFormat.quoteMint), inputFormat.lotSize, - inputFormat.tickSize, + inputFormat.tickSize ); return JSON.stringify({ @@ -1015,7 +1019,9 @@ export class SolanaPythFetchPrice extends Tool { export class SolanaResolveAllDomainsTool extends Tool { name = "solana_resolve_all_domains"; - description = `Resolve a domain name to a public key. + description = `Resolve domain names to a public key for ALL domain types EXCEPT .sol domains. + Use this for domains like .blink, .bonk, etc. + DO NOT use this for .sol domains (use solana_resolve_domain instead). Input: domain: string, eg "mydomain.blink" or "mydomain.bonk" (required)`; @@ -1026,9 +1032,16 @@ export class SolanaResolveAllDomainsTool extends Tool { async _call(input: string): Promise { try { - console.log(input) const owner = await this.solanaKit.resolveAllDomains(input); + if(!owner) { + return JSON.stringify({ + status: "error", + message: "Domain not found", + code: "DOMAIN_NOT_FOUND", + }); + } + return JSON.stringify({ status: "success", message: "Domain resolved successfully", @@ -1044,6 +1057,7 @@ export class SolanaResolveAllDomainsTool extends Tool { } } + export class SolanaGetOwnedDomains extends Tool { name = "solana_get_owned_domains"; description = `Get all domains owned by a specific wallet address. @@ -1057,7 +1071,7 @@ export class SolanaGetOwnedDomains extends Tool { async _call(input: string): Promise { try { - const ownerPubkey = new PublicKey(input); + const ownerPubkey = new PublicKey(input.trim()); const domains = await this.solanaKit.getOwnedAllDomains(ownerPubkey); return JSON.stringify({ @@ -1075,12 +1089,13 @@ export class SolanaGetOwnedDomains extends Tool { } } + export class SolanaGetOwnedTldDomains extends Tool { name = "solana_get_owned_tld_domains"; description = `Get all domains owned by the agent's wallet for a specific TLD. Inputs: - tld: string, eg "sol" (required)`; + tld: string, eg "bonk" (required)`; constructor(private solanaKit: SolanaAgentKit) { super(); @@ -1088,9 +1103,7 @@ export class SolanaGetOwnedTldDomains extends Tool { async _call(input: string): Promise { try { - const domains = await this.solanaKit.getOwnedDomainsForTLD( - input - ); + const domains = await this.solanaKit.getOwnedDomainsForTLD(input); return JSON.stringify({ status: "success", @@ -1107,9 +1120,10 @@ export class SolanaGetOwnedTldDomains extends Tool { } } + export class SolanaGetAllTlds extends Tool { name = "solana_get_all_tlds"; - description = `Get all active top-level domains (TLDs) in the Solana name service` + description = `Get all active top-level domains (TLDs) in the AllDomains Name Service`; constructor(private solanaKit: SolanaAgentKit) { super(); @@ -1134,38 +1148,12 @@ export class SolanaGetAllTlds extends Tool { } } -export class SolanaGetAllRegisteredDomains extends Tool { - name = "solana_get_all_registered_domains"; - description = `Get all registered domains across all TLDs in the Solana name service` - - constructor(private solanaKit: SolanaAgentKit) { - super(); - } - - async _call(): Promise { - try { - const domains = await this.solanaKit.getAllRegisteredAllDomains(); - - return JSON.stringify({ - status: "success", - message: "All registered domains fetched successfully", - domains: domains, - }); - } catch (error: any) { - return JSON.stringify({ - status: "error", - message: error.message, - code: error.code || "FETCH_ALL_DOMAINS_ERROR", - }); - } - } -} export class SolanaGetMainDomain extends Tool { name = "solana_get_main_domain"; description = `Get the main/favorite domain for a given wallet address. - Inputs (input is a JSON string): + Inputs: owner: string, eg "4Be9CvxqHW6BYiRAxW9Q3xu1ycTMWaL5z8NX4HR3ha7t" (required)`; constructor(private solanaKit: SolanaAgentKit) { @@ -1174,8 +1162,7 @@ export class SolanaGetMainDomain extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input); - const ownerPubkey = new PublicKey(inputFormat.owner); + const ownerPubkey = new PublicKey(input.trim()); const mainDomain = await this.solanaKit.getMainAllDomainsDomain( ownerPubkey ); @@ -1212,7 +1199,6 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) { new SolanaTPSCalculatorTool(solanaKit), new SolanaStakeTool(solanaKit), new SolanaFetchPriceTool(solanaKit), - new SolanaResolveDomainTool(solanaKit), new SolanaGetDomainTool(solanaKit), new SolanaTokenDataTool(solanaKit), new SolanaTokenDataByTickerTool(solanaKit), @@ -1227,14 +1213,7 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) { new SolanaGetOwnedDomains(solanaKit), new SolanaGetOwnedTldDomains(solanaKit), new SolanaGetAllTlds(solanaKit), - new SolanaGetAllRegisteredDomains(solanaKit), new SolanaGetMainDomain(solanaKit), new SolanaResolveAllDomainsTool(solanaKit), - new SolanaGetOwnedDomains(solanaKit), - new SolanaGetOwnedTldDomains(solanaKit), - new SolanaGetAllTlds(solanaKit), - new SolanaGetAllRegisteredDomains(solanaKit), - new SolanaGetMainDomain(solanaKit), ]; } - diff --git a/src/tools/get_all_domains_tlds.ts b/src/tools/get_all_domains_tlds.ts index d46fdba..93b6bf2 100644 --- a/src/tools/get_all_domains_tlds.ts +++ b/src/tools/get_all_domains_tlds.ts @@ -3,18 +3,16 @@ import { SolanaAgentKit } from "../index"; import { getAllTld } from "@onsol/tldparser"; /** - * Get all active top-level domains (TLDs) in the Solana name service + * Get all active top-level domains (TLDs) in the AllDomains Name Service * @param agent SolanaAgentKit instance * @returns Array of active TLD strings */ export async function getAllDomainsTLDs( agent: SolanaAgentKit -): Promise> { +): Promise { try { - return getAllTld(agent.connection) + let tlds = await getAllTld(agent.connection) + return tlds.map((tld) => tld.tld) } catch (error: any) { throw new Error(`Failed to fetch TLDs: ${error.message}`); } diff --git a/src/tools/get_owned_all_domains.ts b/src/tools/get_owned_all_domains.ts index c626658..17bbe40 100644 --- a/src/tools/get_owned_all_domains.ts +++ b/src/tools/get_owned_all_domains.ts @@ -11,9 +11,10 @@ import { NameAccountAndDomain, TldParser } from "@onsol/tldparser"; export async function getOwnedAllDomains( agent: SolanaAgentKit, owner:PublicKey -): Promise { +): Promise { try { - return new TldParser(agent.connection).getParsedAllUserDomains(owner); + let domains = await new TldParser(agent.connection).getParsedAllUserDomains(owner); + return domains.map((domain) => domain.domain) } catch (error: any) { throw new Error(`Failed to fetch owned domains: ${error.message}`); } diff --git a/src/tools/get_owned_domains_for_tld.ts b/src/tools/get_owned_domains_for_tld.ts index 16c3cb9..0e13344 100644 --- a/src/tools/get_owned_domains_for_tld.ts +++ b/src/tools/get_owned_domains_for_tld.ts @@ -1,6 +1,5 @@ -import { NameAccountAndDomain, TldParser } from "@onsol/tldparser"; +import { TldParser } from "@onsol/tldparser"; import { SolanaAgentKit } from "../agent"; -import { PublicKey } from "@solana/web3.js"; /** * Get all domains owned by an address for a specific TLD * @param agent SolanaAgentKit instance @@ -10,13 +9,14 @@ import { PublicKey } from "@solana/web3.js"; export async function getOwnedDomainsForTLD( agent: SolanaAgentKit, tld: string -): Promise { +): Promise { try { - return new TldParser(agent.connection) + let domains = await new TldParser(agent.connection) .getParsedAllUserDomainsFromTld( agent.wallet_address, tld ) + return domains.map((domain) => domain.domain) } catch (error: any) { throw new Error(`Failed to fetch domains for TLD: ${error.message}`); } diff --git a/src/tools/resolve_domain.ts b/src/tools/resolve_domain.ts index 2ba5f4d..a83885a 100644 --- a/src/tools/resolve_domain.ts +++ b/src/tools/resolve_domain.ts @@ -13,10 +13,18 @@ export async function resolveAllDomains( domain: string ): Promise { try { - let tld = new TldParser(agent.connection).getOwnerFromDomainTld(domain) - return tld; + console.log("domain", domain); + let tld = await new TldParser(agent.connection).getOwnerFromDomainTld( + domain + ); + console.log("tld", tld); + return tld; } catch (error: any) { + // console.log("error", error.); + + if(error.message.includes("Cannot read properties of undefined (reading 'owner')")) { + return undefined + } throw new Error(`Domain resolution failed: ${error.message}`); } } - From 585b1e39eb40fb0475483fffb0de3d11dee42ca0 Mon Sep 17 00:00:00 2001 From: aryan Date: Wed, 25 Dec 2024 05:13:48 +0530 Subject: [PATCH 27/31] fix: stale files --- package.json | 1 - test/domain_methods.test.ts | 146 ------------------------------------ 2 files changed, 147 deletions(-) delete mode 100644 test/domain_methods.test.ts diff --git a/package.json b/package.json index 0cfe249..9c16fd6 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "build": "tsc", "docs": "typedoc src --out docs", "test": "ts-node test/index.ts", - "test:domain": "ts-node test/domain_methods.test.ts", "generate": "ts-node src/utils/keypair.ts" }, "engines": { diff --git a/test/domain_methods.test.ts b/test/domain_methods.test.ts deleted file mode 100644 index 2485ed7..0000000 --- a/test/domain_methods.test.ts +++ /dev/null @@ -1,146 +0,0 @@ - -import { SolanaAgentKit } from "../src"; -import { PublicKey } from "@solana/web3.js"; -import * as dotenv from "dotenv"; -import { expect } from "chai"; -import { before, describe, it } from "node:test"; -import { TldParser } from "@onsol/tldparser"; - -dotenv.config(); - -describe("Solana Domain Methods Tests", () => { - let agent: SolanaAgentKit; - - before(() => { - // Initialize the agent before running tests - if ( - !process.env.SOLANA_PRIVATE_KEY || - !process.env.RPC_URL || - !process.env.OPENAI_API_KEY - ) { - throw new Error("Required environment variables are not set"); - } - - agent = new SolanaAgentKit( - process.env.SOLANA_PRIVATE_KEY, - process.env.RPC_URL, - process.env.OPENAI_API_KEY - ); - }); - - describe("resolveAllDomains", () => { - it("should resolve a valid domain to a public key", async () => { - const testDomain = "hero.sol"; - const result = await agent.resolveAllDomains(testDomain); - expect(result).to.be.instanceof(PublicKey); - }); - it("should perform fetching of an owner an nft domain", async () => { - const parser = new TldParser(agent.connection); - const domanTld = "miester.sol"; - const ownerReceived = await parser.getOwnerFromDomainTld(domanTld); - const owner = new PublicKey( - "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67" - ); - expect(ownerReceived).to.be(owner.toString()); - }); - it("should return null for non-existent domain", async () => { - const nonExistentDomain = "nonexistent123456789.sol"; - const result = await agent.resolveAllDomains(nonExistentDomain); - expect(result).to.be.null; - }); - - it("should handle invalid domain format", async () => { - const invalidDomain = ""; - try { - await agent.resolveAllDomains(invalidDomain); - expect.fail("Should have thrown an error"); - } catch (error) { - expect(error).to.be.instanceof(Error); - } - }); - }); - - describe("getOwnedAllDomains", () => { - it("should return array of domains for an owner", async () => { - const owner = new PublicKey( - "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67" - ); - const domains = await agent.getOwnedAllDomains(owner); - expect(domains).to.be.an("array").that.includes("miester.sol"); - domains.forEach((domain) => { - expect(domain).to.be.a("string"); - }); - }); - it("should return array of domains for an owner", async () => { - const owner = new PublicKey(agent.wallet_address); - const domains = await agent.getOwnedAllDomains(owner); - expect(domains).to.be.an("array"); - domains.forEach((domain) => { - expect(domain).to.be.a("string"); - }); - }); - - it("should handle owner with no domains", async () => { - // Create a new random public key that likely owns no domains - const emptyOwner = PublicKey.unique(); - const domains = await agent.getOwnedAllDomains(emptyOwner); - expect(domains).to.be.an("array"); - expect(domains).to.have.lengthOf(0); - }); - }); - - describe("getOwnedDomainsForTLD", () => { - it("should return domains for specific TLD", async () => { - const tld = "sol"; - const domains = await agent.getOwnedDomainsForTLD(tld); - expect(domains).to.be.an("array"); - domains.forEach((domain) => { - console.log(`these are the domains ${domain.domain}`) - }); - }); - - it("should return empty array for non-existent TLD", async () => { - const nonExistentTLD = "nonexistent"; - const domains = await agent.getOwnedDomainsForTLD(nonExistentTLD); - expect(domains).to.be.an("array"); - expect(domains).to.have.lengthOf(0); - }); - }); - - describe("getAllDomainsTLDs", () => { - it("should return array of TLDs", async () => { - const tlds = await agent.getAllDomainsTLDs(); - expect(tlds).to.be.an("array"); - }); - }); - - describe("getAllRegisteredAllDomains", () => { - it("should return array of all registered domains", async () => { - const domains = await agent.getAllRegisteredAllDomains(); - expect(domains).to.be.an("array"); - domains.forEach((domain) => { - expect(domain).to.be.a("string"); - expect(domain).to.include("."); - }); - }); - }); - - describe("getMainAllDomainsDomain", () => { - it("should return main domain or null for an owner", async () => { - const owner = new PublicKey( - "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67" - ); - const mainDomain = await agent.getMainAllDomainsDomain(owner); - expect(mainDomain).to.satisfy((domain: string | null) => { - return domain === null || typeof domain === "string"; - }); - }); - - it("should return null for address without main domain", async () => { - const emptyOwner = PublicKey.unique(); - const mainDomain = await agent.getMainAllDomainsDomain(emptyOwner); - expect(mainDomain).to.be.null; - }); - }); -}); - From 955290838fb05eef1987dab6cca6a6030ae4672f Mon Sep 17 00:00:00 2001 From: aryan Date: Wed, 25 Dec 2024 05:14:22 +0530 Subject: [PATCH 28/31] chore: docs --- docs/assets/search.js | 2 +- docs/classes/SolanaAgentKit.html | 16 +++++++++++----- docs/functions/createSolanaTools.html | 2 +- docs/interfaces/CollectionDeployment.html | 4 ++-- docs/interfaces/CollectionOptions.html | 4 ++-- docs/interfaces/Creator.html | 4 ++-- docs/interfaces/FetchPriceResponse.html | 4 ++-- docs/interfaces/JupiterTokenData.html | 4 ++-- docs/interfaces/LuloAccountDetailsResponse.html | 4 ++-- docs/interfaces/MintCollectionNFTResponse.html | 4 ++-- docs/interfaces/PumpFunTokenOptions.html | 4 ++-- docs/interfaces/PumpfunLaunchResponse.html | 4 ++-- docs/interfaces/PythFetchPriceResponse.html | 4 ++-- 13 files changed, 33 insertions(+), 27 deletions(-) diff --git a/docs/assets/search.js b/docs/assets/search.js index d5f491b..b0786c5 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE7Wc23LbOBKG34W+VTkBCJCU73JYV2U3M5MaZ2YvVCkXLcIO1xTJIaFktam8+xYoSuwWmnLT9FzNVIzu/gF8aBxE4EfQVN/b4Gr1I3jMyyy4EjJZBGW6McFVcFMVaZm+eTCl/Vdug0WwbYrgKlgXadua9hX+8+VXuymCxeGvwVUQ/FwcvGohj17XVdnaZru2VcNxeYHLA/eLoE4bU1pf6RBYvJYKRi7N2uZVyQ08FJ8T93taFIbVfhfHovPj3aZZ1pi2nRAXmMyJX9WmTPPbtM5vH82OFd8zmRhfvlYDt435a2tae51u18Zeb8uM1wak2RwdmamLave5ejQ84HD5+ZHfVUUxgXfCaI6GB2PfpkVarg0rOio+J+4mL+2v159ZQYeycyLaJi3be8NLZ6DwPMYf8taa5n21SXNe/3om8+K3VfHN3FTFJAWe0UzCPjX5Jm12EzQQRjP7PuMBfig5J1phyuxN2xrLy2io+MyW/vzphtu++6Jz47k0+D616dvdmwkT2Zjly6n5nK8fmWN9xHCOlntj1187p5+anJlafZtZDKbbcv3103ZTX29L/uRGms3R0dr0kVf/Q8lZ0UyZvas2tcPJZG/yJmuqmhd9xHKOmnVjUmt+a9bpTV4+FOYmz0z27695U9RVVfBWt0+5mDU7pLss327edTHebDZ/Kt78QJm9mI53xWYzXUZv9XIq6mepqGercEvsu6p63Dv8JW0emXuSEcM5Wuqd/XrtshI/iXkmE+NH6mT07Et+rqpimFnut2W39G1feWXO7m+ljo7eu2YCe9u8tKa5T9emfdX/6awrtJM63cKN+Lp4at920DQSpjbN2pQ2fTBPRkJFucFQ8xz3F7/VXVOTIU8L8Zus+w/b5UVffKQmntaRoNsmnxBzX3pmyKbapYXdvU3bvP1U5aWd0JAXpPFMQet9t0+RAUymB6ehet9tYjfO/KyOoRwfrfXR+nRFyglxQZk/VW1QnRFRbf5QpnbbPAH9qRho9iwRsPl/yUs7FP/1+vPvpq2rsiU1jRbmd4Tbtk93fdGb0dUdr8OYCGPTLLXpc4QMps8XAzsALqvPpFWiGL/R7ffcWkPOa2N+LwYbup6U7rHwpjAPTbqZFn8wmi3gu7lrc0siPRp/sJkdPi9zm6fFx/yvbZ7ldnfz28dJUmj72bLaIq/r9MG8rScRd4HtZsuom7xqcru7NtM6CNs9R8bpMLzflh+7re65HEgW5A/Fszl/3Dcj6dM1mJiGzyg4m4KnBe9z6B/00uucBmT5AlJM09Dr/TMiDjbPCw+h+7gtqjfrdbUt7Xtj07xoz5E3XnrCTFDZtPgzLbbPiXCBrOnqn6nSaHa0pjGt/UfalCZ7jizPw0tJa0xa2Hxj3tS75+jC5i8lqjXW5uUDmbOfUgRsZ8iJtA4HiG9v7a5+Fk4HNZdHF1NFXR4rNPZ75veSXvdM1HZ5cPRshYdKjh0XFEX13WSfmspWa3iuMUMz4fPvkv+12pi79Fl5y5MNfP1dcjd5mW+2m99TelE4VTF294Ki4WTxz22dW9Mcf5WghJ+WeZHjKtLpk+dWntyJhz501LNnPtyQ7W5zB47anwx6LD8vbGbW+SalhzYdGFjMC21Ter6gw/al54Usqofqj98/8KMOBjObOc2L3e23qthOAevEap6E+8aY/5nbdGu/dlsUvgzCcp4Ut2p/jhDPbp6M2jSbtDSlvc3cvn4k79JSSNt5csx/rSnbsbMWWgaymRyeu2Z6KvZTayXPHsgePRvNywezfqw+kKtvpqJL7GayuvOT3/Dz0bkdkl9qwsbcpnZL4jDi9eJoQdeVkDy6KXs0Jd34Y7EHk7nBa1foQ/nHzft3UwRgs7kiNqZtR37CGhMwmMwNvq6ySZH78s8Iiw6c0I+iZ0+cyJIvQfYZz0/RPSL/HGTXxmQf3k/VgU1fTMyzZLyQgDO0n5PwFPHTRIxRf07BWfLHwn9ZBHmZmf8GVz+Cb6ZxyT64CuRleLkMFsF9borMfcV+2Aisq03/E2BWrbfd/37pi/1p1t1PjlerfelXr4PF6vVCicswTr58WawOxt0fun84+Bj+pTMUwWIlKEPhGQpkKIPFSlKG0jOUyDAMFquQMgw9wxAZqmCxUpSh8gwVMtTBYqUpQ+0ZamQYBYtVRBlGnmGEDONgsYopw9gzjJFhEixWCWWYeIYJMlwGi9WSMlx6hksMgONBkOwIHx5xQk+HD80PARAmSDguBMmQ8CESmCLh2BAkR8IHSWCShONDkCwJHyaBaRKOEUHyJHygBCZKOE4EyZTwoRKYKuFYESRXwgdLYLKE40WQbAkfLoHpEo4ZQfIlfMAEJkw6ZiRJmPQJk5gw6ZiRJGHSJ0ye5KguSdFZikhTmDDpmJEkYdInTGLCpGNGkoRJnzCJCZOOGUkSJn3CJCZMOmYkSZj0CZOYMOmYkSRh0idMYsKkY0aShEmfMIkJk44ZSRImfcIkJix0zIQkYaFPWIgJCx0zIUlY6BMWYsJCx0woF2F0KWNs6wMWnkyE3UxIT4XEXIgBCx0yIQlY6AMWYsBCh0yoKdU+XyHmK3TEhCRfoc9XiPkKHTEhyVfo8xVivkJHTEjyFfp8hZiv0BETknyFPl8h5ks5YhTJl/L5Upgv5YhRgmhs5eOlMF7KEaPIBKZ8vhTmSzliVEgF9vFSJ2utbrFFr7aI5RbGSzliFJm/lM+XwnwpR4wi+VI+XwrzpRwxiuRL+XwpzJdyxCiSL+XzpTBfyhGjSL6Uz5fCfGlHjCb50j5fGvOlHTKazF/aB0xjwLRDRpOAaR8wjQHT4RjZ2gdMY8C0GoNT+3zpk/V8t6AnE6cmlvSYL+2I0STZ2udLY760I0bTewmfL4350o4YTZKtfb405ks7YjRJtvb50pivqOOLJDvy+YowX1HHF0l25PMVYb4iR0z0mujmyMcrwnhFjpiIBDvy+YowX5FDJiLBjnzAIgxY5JCJSMAiH7DoZNPY7RpJwCJi34gBixwyEQlY5AMWYcCiZGwxEvl8RZivaDm2JIh8vCKMV+yAiUiwYx+vGOMVO2AierPs4xVjvOIOLxLs2OcrxnzFHV8k2LHPV4z5ih0xMZmyY5+vGPMVO2JikuzY5yvGfMWOmJgkO/b5ik8OJrqTCZLsmDibwHzFDpmYJDv2AYsxYPFyLBPEPmAxBixxyMTkqEh8wBIMWOKQiUk6Ex+wBAOWOGTimFCd+HwlmK/EERPTpzk+XwnmK+n4IuFMfL4SzFfiiEmotk58vBKMV+KASahJPfHpSjBdieMlIdFMfLqSk6OvZLSpicMvDFfieElIrBOfrgTTtXS8JCTWS5+uJaZrKcaaeunDtcRwLeVYUy99uPp/6s6Qv5nGmuzD/ix5tTr+iPojuO0PmKPXh+PtH0Ekg6sfPxdBvHT//TkcLHf/ejxbdn9zEY+fswzeQjl4C3tvUcLztv/yqh6+vAIigdtIsdztz90HF4kYXCTR3mgpma76X2nzDHqMNfD4munpcMmBaDsFekJN9ZeBi0CgO5agO3idOrisDjcrgD8F/HH7YXhWZnAE+pPbB+BZnMEP6FTB89NddKyaddp294Bbdw/4+3APGEgEdZXMunbO2+4Wpa1OGA5B94bM7j3crQReQI3DCVXurp0BNwlwwxuf+GsfMAxAvWJeOw3faIEhHgM3vIrtmV+DF1zAcAdjc4Izu7+pD2oHVLH89F+6Dx404EhHPB/gsxkgBTiKeZXqnkLofoZtjj+WA4cRaCRek3cOu0bqf9wF4wVwIHl8+19uAXEA9Fiz3D0Ye3d4U2dwBFIgLwM+GFvvn0zJ+idTQL4BfSB4sD8Y2zWYu4NxtyPyvgCsCl6/Yp+2f2kDuASVFuxa2xrrAuwLHvzDZ8hgYIdg7uZ1ZH95qzhc3mpxZlagdopXu8N1B9NfdwDDE9RS85z9Z/9F1rEHUG3BoiDiNdr+qZB6fwfGS0ASjAPJG6TuHZy0fwcHdCcY7YKXh9znpd3tbVA/0PZxyPOyLap0/xV3tv+Km0pGGjSc5jXc8eMOkPZBEkp0v8rjtdpwSxWQBoa74g33g5uTdtNgFGjeKOi/kG+6jzdBDwBNEa8f99fQQLWAGBXujTSzeiffuIKEDdZ0MV/XMH2X95YCQwG/irdYdH7Le1RlAcAQvNmpKw7XTIDQsGcr4mWM0/f+ABcAC7Yr9zzJfq256Z8nAfkCzCaSN5v093QAYiDnRLxBDh/KAE0GQAvZjrwvlwFkwGHMyxLeQiUBA2jJQ6HzcW9MhneACVCT8EjoPOXlts3WqF4grSa8kXi4y3tvcB4Ffad5ma+fevbzEJmbwRDUvCEIpzNiI6kA94oHvnsRZ1jPIuRB40lmNyBnVJ0TUOeER1r/hNF+ZKabzTeFVIIqS16VkcN19zIT8Afmc8nLt9hffeIPLIQks8L9Zc20xjkNpKCIN8AOjzUSK27QD4LHXv+y6X33sun9/mVTkNyAOKa77hnHtioIdSADCF6C6x+juXOP0dT9YzQgY4JeCHm94F5cWx9fXEsPL66BngUiJU/kcOkVdCsYZhEvs4Ab+GDsgwylRL/6YMrqn1G4wzsVDSZ3zQNuf0iTuoezHnM0gQJfTFf79/ZAe8PTLR6yhy/HwYwAQEj6k9SEN58f7t4B5gH0Ma9W+wttwAUY1DGvUsNzJKDzQbUUj+9uDjk5eoXHOzx0unv43/b38AE5oGE0r3X7h01BDgCJXfAS+/AqLnADzzJ5w+v43gxoX1AhxctvJzuVEHgIeR4Oz3gDJ8DHBBe31LE4qBDP1eEVGuAD8KIY3fxlEdR5bYq8NMHV6svPn/8HMwsErTleAAA="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,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"; \ No newline at end of file diff --git a/docs/classes/SolanaAgentKit.html b/docs/classes/SolanaAgentKit.html index a567376..eccbc8c 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

    Constructors

    • Parameters

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

      Returns SolanaAgentKit

    Properties

    connection: Connection

    Solana RPC connection

    -
    openai_api_key: string
    wallet: Keypair

    Wallet keypair for signing transactions

    -
    wallet_address: PublicKey

    Public key of the wallet

    -

    Methods

    • Parameters

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

      Returns Promise<string>

    • Parameters

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

      Returns Promise<{
          mint: PublicKey;
      }>

    • Parameters

      • mint: string

      Returns Promise<string>

    • Parameters

      • Optionaltoken_address: PublicKey

      Returns Promise<number>

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

    • Parameters

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

      Returns Promise<string[]>

    • Parameters

      • amount: number

      Returns Promise<string>

    • Parameters

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

      Returns Promise<string>

    • Parameters

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

      Returns Promise<string>

    +

    Constructors

    • Parameters

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

      Returns SolanaAgentKit

    Properties

    connection: Connection

    Solana RPC connection

    +
    openai_api_key: string
    wallet: Keypair

    Wallet keypair for signing transactions

    +
    wallet_address: PublicKey

    Public key of the wallet

    +

    Methods

    • Parameters

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

      Returns Promise<string>

    • Parameters

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

      Returns Promise<{
          mint: PublicKey;
      }>

    • Parameters

      • mint: string

      Returns Promise<string>

    • Returns Promise<String[]>

    • Returns Promise<string[]>

    • Parameters

      • Optionaltoken_address: PublicKey

      Returns Promise<number>

    • Parameters

      • owner: PublicKey

      Returns Promise<null | string>

    • Parameters

      • owner: PublicKey

      Returns Promise<string[]>

    • Parameters

      • tld: string

      Returns Promise<string[]>

    • Parameters

      • account: PublicKey

      Returns Promise<string>

    • Parameters

      • amount: number

      Returns Promise<string>

    • Parameters

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

      Returns Promise<MintCollectionNFTResponse>

    • Parameters

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

      Returns Promise<string[]>

    • Parameters

      • priceFeedID: string

      Returns Promise<string>

    • Parameters

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

      Returns Promise<string>

    • Parameters

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

      Returns Promise<string>

    • Parameters

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

      Returns Promise<string>

    • Parameters

      • name: string
      • OptionalspaceKB: number

      Returns Promise<string>

    • Returns Promise<string>

    • Parameters

      • domain: string

      Returns Promise<undefined | PublicKey>

    • Parameters

      • domain: string

      Returns Promise<PublicKey>

    • Parameters

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

      Returns Promise<string[]>

    • Parameters

      • amount: number

      Returns Promise<string>

    • Parameters

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

      Returns Promise<string>

    • Parameters

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

      Returns Promise<string>

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

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

    diff --git a/docs/interfaces/CollectionDeployment.html b/docs/interfaces/CollectionDeployment.html index 1cf2cc3..c03b39a 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 1708dbe..6790105 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 70a574b..4e33592 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 5e3ee44..defd401 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/JupiterTokenData.html b/docs/interfaces/JupiterTokenData.html index a47d48c..2b23375 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 63c90f2..fa19d62 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 26d2c39..e2e1479 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 7007dd2..d1c0142 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 4568f3e..f667de7 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 fb28177..fcfb217 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"
    From bb629f287f8384cb0221a8c7d249d6d46595eb62 Mon Sep 17 00:00:00 2001 From: thatsmeadarsh Date: Wed, 25 Dec 2024 09:16:44 +0530 Subject: [PATCH 29/31] feat: Create tasks on Gibwork --- src/agent/index.ts | 25 ++++++++++- src/langchain/index.ts | 52 +++++++++++++++++++++- src/tools/create_gibwork_task.ts | 75 ++++++++++++++++++++++++++++++++ src/tools/index.ts | 2 + src/types/index.ts | 6 +++ 5 files changed, 158 insertions(+), 2 deletions(-) create mode 100644 src/tools/create_gibwork_task.ts diff --git a/src/agent/index.ts b/src/agent/index.ts index f1833f7..ead4bfb 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -34,10 +34,12 @@ import { getMainAllDomainsDomain, getOwnedAllDomains, resolveAllDomains, + create_gibwork_task, } from "../tools"; import { CollectionDeployment, CollectionOptions, + GibworkCreateTaskReponse, JupiterTokenData, MintCollectionNFTResponse, PumpfunLaunchResponse, @@ -229,7 +231,7 @@ export class SolanaAgentKit { async getOwnedDomainsForTLD( tld: string - ):Promise { + ): Promise { return getOwnedDomainsForTLD(this, tld); } @@ -318,4 +320,25 @@ export class SolanaAgentKit { async pythFetchPrice(priceFeedID: string): Promise { return pythFetchPrice(priceFeedID); } + + async createGibworkTask( + title: string, + content: string, + requirements: string, + tags: string[], + tokenMintAddress: string, + tokenAmount: number, + payer?: string + ): Promise { + return create_gibwork_task( + this, + title, + content, + requirements, + tags, + new PublicKey(tokenMintAddress), + tokenAmount, + payer ? new PublicKey(payer) : undefined + ); + } } diff --git a/src/langchain/index.ts b/src/langchain/index.ts index 51fc6b4..00f31e6 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -1,7 +1,7 @@ import { PublicKey } from "@solana/web3.js"; import Decimal from "decimal.js"; import { Tool } from "langchain/tools"; -import { PythFetchPriceResponse, SolanaAgentKit } from "../index"; +import { GibworkCreateTaskReponse, PythFetchPriceResponse, SolanaAgentKit } from "../index"; import { create_image } from "../tools/create_image"; import { BN } from "@coral-xyz/anchor"; import { FEE_TIERS } from "../tools"; @@ -1181,6 +1181,55 @@ export class SolanaGetMainDomain extends Tool { } } +export class SolanaCreateGibworkTask extends Tool { + name = "create_gibwork_task"; + description = `Create a task on Gibwork. + + Inputs (input is a JSON string): + title: string, title of the task (required) + content: string, description of the task (required) + requirements: string, requirements to complete the task (required) + tags: string[], list of tags associated with the task (required) + payer: string, payer address (optional, defaults to agent wallet) + tokenMintAddress: string, the mint address of the token, e.g., "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN" (required) + amount: number, payment amount (required) + `; + + constructor(private solanaSdk: SolanaAgentKit) { + super(); + } + + protected async _call(input: string): Promise { + try { + const parsedInput = JSON.parse(input); + + const taskData = await this.solanaSdk.createGibworkTask( + parsedInput.title, + parsedInput.content, + parsedInput.requirements, + parsedInput.tags, + parsedInput.tokenMintAddress, + parsedInput.amount, + parsedInput.payer, + ); + + const response: GibworkCreateTaskReponse = { + status: "success", + taskId: taskData.taskId, + signature: taskData.signature, + }; + + return JSON.stringify(response); + } catch (err: any) { + return JSON.stringify({ + status: "error", + message: err.message, + code: err.code || "CREATE_TASK_ERROR", + }); + } + } +} + export function createSolanaTools(solanaKit: SolanaAgentKit) { return [ new SolanaBalanceTool(solanaKit), @@ -1214,5 +1263,6 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) { new SolanaGetAllTlds(solanaKit), new SolanaGetMainDomain(solanaKit), new SolanaResolveAllDomainsTool(solanaKit), + new SolanaCreateGibworkTask(solanaKit), ]; } diff --git a/src/tools/create_gibwork_task.ts b/src/tools/create_gibwork_task.ts new file mode 100644 index 0000000..60d0dbc --- /dev/null +++ b/src/tools/create_gibwork_task.ts @@ -0,0 +1,75 @@ +import { SendTransactionError, Transaction, VersionedTransaction } from "@solana/web3.js"; +import { PublicKey } from "@solana/web3.js"; +import { GibworkCreateTaskReponse, SolanaAgentKit } from "../index"; + +/** + * Create an new task on Gibwork + * @param agent SolanaAgentKit instance + * @param title Title of the task + * @param content Description of the task + * @param requirements Requirements to complete the task + * @param tags List of tags associated with the task + * @param payer Payer address for the task (default: agent wallet address) + * @param tokenMintAddress Token mint address for payment + * @param tokenAmount Payment amount for the task + * @returns Object containing task creation transaction and generated taskId + */ +export async function create_gibwork_task( + agent: SolanaAgentKit, + title: string, + content: string, + requirements: string, + tags: string[], + tokenMintAddress: PublicKey, + tokenAmount: number, + payer?: PublicKey, +): Promise { + try { + const apiResponse = await fetch('https://api2.gib.work/tasks/public/transaction', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + title: title, + content: content, + requirements: requirements, + tags: tags, + payer: payer?.toBase58() || agent.wallet.publicKey.toBase58(), + token: { + mintAddress: tokenMintAddress.toBase58(), + amount: tokenAmount + } + }) + }); + + const responseData = await apiResponse.json(); + if (!responseData.taskId && !responseData.serializedTransaction) { + throw new Error(`${responseData.message}`); + } + + const serializedTransaction = Buffer.from(responseData.serializedTransaction, "base64"); + const tx = VersionedTransaction.deserialize(serializedTransaction); + + tx.sign([agent.wallet]); + const signature = await agent.connection.sendTransaction(tx, { + preflightCommitment: "confirmed", + maxRetries: 3, + }); + + const latestBlockhash = await agent.connection.getLatestBlockhash(); + await agent.connection.confirmTransaction({ + signature, + blockhash: latestBlockhash.blockhash, + lastValidBlockHeight: latestBlockhash.lastValidBlockHeight, + }); + + return { + status: "success", + taskId: responseData.taskId, + signature: signature + }; + } catch (err: any) { + throw new Error(`${err.message}`); + } +} \ No newline at end of file diff --git a/src/tools/index.ts b/src/tools/index.ts index 846c92b..92c6c1e 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -36,3 +36,5 @@ export * from "./raydium_create_clmm"; export * from "./raydium_create_cpmm"; export * from "./openbook_create_market"; export * from "./pyth_fetch_price"; + +export * from "./create_gibwork_task"; diff --git a/src/types/index.ts b/src/types/index.ts index 6c9dc16..95d1fc5 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -85,3 +85,9 @@ export interface PythFetchPriceResponse { message?: string; code?: string; } + +export interface GibworkCreateTaskReponse { + status: "success" | "error"; + taskId?: string | undefined; + signature?: string | undefined; +} From c81aa7f892cfbc124db209be472bf0c09adc11e2 Mon Sep 17 00:00:00 2001 From: aryan Date: Wed, 25 Dec 2024 17:08:17 +0530 Subject: [PATCH 30/31] feat: linting + prettier --- .eslintrc | 40 + .prettierignore | 4 + .prettierrc | 12 + LICENSE | 2 +- package.json | 15 +- pnpm-lock.yaml | 1039 +++++++++++++++++ src/agent/index.ts | 28 +- src/langchain/index.ts | 41 +- .../create_orca_single_sided_whirlpool.ts | 6 +- src/tools/get_all_domains_tlds.ts | 10 +- src/tools/get_all_registered_all_domains.ts | 4 +- src/tools/get_balance.ts | 3 +- src/tools/get_main_all_domains_domain.ts | 7 +- src/tools/get_owned_all_domains.ts | 10 +- src/tools/get_owned_domains_for_tld.ts | 16 +- src/tools/get_token_data.ts | 10 +- src/tools/index.ts | 1 - src/tools/launch_pumpfun_token.ts | 12 +- src/tools/pyth_fetch_price.ts | 6 +- src/tools/raydium_create_clmm.ts | 5 +- src/tools/raydium_create_cpmm.ts | 7 +- src/tools/resolve_domain.ts | 18 +- src/tools/send_compressed_airdrop.ts | 5 +- src/utils/keypair.ts | 2 +- src/utils/send_tx.ts | 2 +- 25 files changed, 1202 insertions(+), 103 deletions(-) create mode 100644 .eslintrc create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..d663169 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,40 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint", "prettier"], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "prettier" + ], + "rules": { + "prettier/prettier": "error", + "no-constant-condition": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], + "no-console": ["warn", { "allow": ["warn", "error"] }], + "curly": ["error", "all"], + "eqeqeq": ["error", "always"], + "no-floating-decimal": "error", + "no-var": "error", + "prefer-const": "error" + }, + "env": { + "browser": true, + "node": true, + "es6": true + }, + "parserOptions": { + "ecmaVersion": 2020, + "sourceType": "module" + }, + "overrides": [ + { + "files": ["test/**/*", "src/utils/keypair.ts"], + "rules": { + "no-console": "off" + } + } + ] +} \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..dfb631f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +dist +node_modules +docs +*.md \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..9928a2d --- /dev/null +++ b/.prettierrc @@ -0,0 +1,12 @@ +{ + "semi": true, + "trailingComma": "all", + "singleQuote": false, + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "bracketSpacing": true, + "arrowParens": "always", + "endOfLine": "lf", + "bracketSameLine": false +} \ No newline at end of file diff --git a/LICENSE b/LICENSE index 261eeb9..e6df5e1 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright [2024] [SendAI] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/package.json b/package.json index 9c16fd6..7cb163c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,10 @@ "build": "tsc", "docs": "typedoc src --out docs", "test": "ts-node test/index.ts", - "generate": "ts-node src/utils/keypair.ts" + "generate": "ts-node src/utils/keypair.ts", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"" }, "engines": { "node": ">=23.1.0", @@ -16,7 +19,7 @@ }, "keywords": [], "author": "sendaifun", - "license": "ISC", + "license": "Apache-2.0", "dependencies": { "@bonfida/spl-name-service": "^3.0.7", "@coral-xyz/anchor": "0.29", @@ -54,6 +57,12 @@ "@types/chai": "^5.0.1", "@types/node": "^22.9.0", "ts-node": "^10.9.2", - "typescript": "^5.7.2" + "typescript": "^5.7.2", + "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", + "@typescript-eslint/eslint-plugin": "^7.0.0", + "@typescript-eslint/parser": "^7.0.0", + "prettier": "^3.2.5" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ddaf940..ddfc583 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -108,6 +108,24 @@ importers: '@types/node': specifier: ^22.9.0 version: 22.10.2 + '@typescript-eslint/eslint-plugin': + specifier: ^7.0.0 + version: 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.2))(eslint@8.57.1)(typescript@5.7.2) + '@typescript-eslint/parser': + specifier: ^7.0.0 + version: 7.18.0(eslint@8.57.1)(typescript@5.7.2) + eslint: + specifier: ^8.56.0 + version: 8.57.1 + eslint-config-prettier: + specifier: ^9.1.0 + version: 9.1.0(eslint@8.57.1) + eslint-plugin-prettier: + specifier: ^5.1.3 + version: 5.2.1(eslint-config-prettier@9.1.0(eslint@8.57.1))(eslint@8.57.1)(prettier@3.4.2) + prettier: + specifier: ^3.2.5 + version: 3.4.2 ts-node: specifier: ^10.9.2 version: 10.9.2(@types/node@22.10.2)(typescript@5.7.2) @@ -148,6 +166,24 @@ packages: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} + '@eslint-community/eslint-utils@4.4.1': + resolution: {integrity: sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + + '@eslint-community/regexpp@4.12.1': + resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + + '@eslint/eslintrc@2.1.4': + resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + '@eslint/js@8.57.1': + resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@ethersproject/bytes@5.7.0': resolution: {integrity: sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==} @@ -157,6 +193,19 @@ packages: '@ethersproject/sha2@5.7.0': resolution: {integrity: sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==} + '@humanwhocodes/config-array@0.13.0': + resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==} + engines: {node: '>=10.10.0'} + deprecated: Use @eslint/config-array instead + + '@humanwhocodes/module-importer@1.0.1': + resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} + engines: {node: '>=12.22'} + + '@humanwhocodes/object-schema@2.0.3': + resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} + deprecated: Use @eslint/object-schema instead + '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} @@ -330,6 +379,18 @@ packages: resolution: {integrity: sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==} engines: {node: ^14.21.3 || >=16} + '@nodelib/fs.scandir@2.1.5': + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + + '@nodelib/fs.stat@2.0.5': + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + + '@nodelib/fs.walk@1.2.8': + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + '@onsol/tldparser@0.6.7': resolution: {integrity: sha512-QwkRDLyC514pxeplCCXZ2kTiRcJSeUrpp+9o2XqLbePy/qzZGGG8I0UbXUKuWVD/bUL1zAm21+D+Eu30OKwcQg==} engines: {node: '>=14'} @@ -355,6 +416,10 @@ packages: '@solana/web3.js': ^1.90.0 decimal.js: ^10.4.3 + '@pkgr/core@0.1.1': + resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + '@pythnetwork/price-service-client@1.9.0': resolution: {integrity: sha512-SLm3IFcfmy9iMqHeT4Ih6qMNZhJEefY14T9yTlpsH2D/FE5+BaGGnfcexUifVlfH6M7mwRC4hEFdNvZ6ebZjJg==} deprecated: This package is deprecated and is no longer maintained. Please use @pythnetwork/hermes-client instead. @@ -607,6 +672,64 @@ packages: '@types/ws@8.5.13': resolution: {integrity: sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==} + '@typescript-eslint/eslint-plugin@7.18.0': + resolution: {integrity: sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + '@typescript-eslint/parser': ^7.0.0 + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/parser@7.18.0': + resolution: {integrity: sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/scope-manager@7.18.0': + resolution: {integrity: sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==} + engines: {node: ^18.18.0 || >=20.0.0} + + '@typescript-eslint/type-utils@7.18.0': + resolution: {integrity: sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/types@7.18.0': + resolution: {integrity: sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==} + engines: {node: ^18.18.0 || >=20.0.0} + + '@typescript-eslint/typescript-estree@7.18.0': + resolution: {integrity: sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/utils@7.18.0': + resolution: {integrity: sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + eslint: ^8.56.0 + + '@typescript-eslint/visitor-keys@7.18.0': + resolution: {integrity: sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==} + engines: {node: ^18.18.0 || >=20.0.0} + '@ungap/structured-clone@1.2.1': resolution: {integrity: sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA==} @@ -618,6 +741,11 @@ packages: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} engines: {node: '>=6.5'} + acorn-jsx@5.3.2: + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + acorn-walk@8.3.4: resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==} engines: {node: '>=0.4.0'} @@ -631,6 +759,17 @@ packages: resolution: {integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==} engines: {node: '>= 8.0.0'} + ajv@6.12.6: + resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + ansi-styles@5.2.0: resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} engines: {node: '>=10'} @@ -644,6 +783,10 @@ packages: argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + array-union@2.1.0: + resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} + engines: {node: '>=8'} + assert@2.1.0: resolution: {integrity: sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==} @@ -704,9 +847,16 @@ packages: borsh@2.0.0: resolution: {integrity: sha512-kc9+BgR3zz9+cjbwM8ODoUB4fs3X3I5A/HtX7LZKxCLaMrEeDFoBpnhZY//DTS1VZBSs6S5v46RZRbZjRFspEg==} + brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + brace-expansion@2.0.1: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + bs58@4.0.1: resolution: {integrity: sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==} @@ -739,6 +889,10 @@ packages: resolution: {integrity: sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==} engines: {node: '>= 0.4'} + callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + camelcase@6.3.0: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} @@ -750,6 +904,10 @@ packages: resolution: {integrity: sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==} engines: {node: '>=12'} + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + chalk@5.4.0: resolution: {integrity: sha512-ZkD35Mx92acjB2yNJgziGqT9oKHEOxjTBTDRpOsRWtdecL/0jM3z5kM/CTzHWvHIen1GvkM85p6TuFfDGfc8/Q==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} @@ -764,6 +922,13 @@ packages: resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} engines: {node: '>= 16'} + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + combined-stream@1.0.8: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} @@ -782,12 +947,19 @@ packages: commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} cross-fetch@3.1.8: resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==} + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + crypto-hash@1.3.0: resolution: {integrity: sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==} engines: {node: '>=8'} @@ -818,6 +990,9 @@ packages: resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} engines: {node: '>=6'} + deep-is@0.1.4: + resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + define-data-property@1.1.4: resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} engines: {node: '>= 0.4'} @@ -845,6 +1020,14 @@ packages: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} + dir-glob@3.0.1: + resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} + engines: {node: '>=8'} + + doctrine@3.0.0: + resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} + engines: {node: '>=6.0.0'} + dot-case@3.0.4: resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} @@ -881,6 +1064,64 @@ packages: es6-promisify@5.0.0: resolution: {integrity: sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==} + escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + + eslint-config-prettier@9.1.0: + resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + + eslint-plugin-prettier@5.2.1: + resolution: {integrity: sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + '@types/eslint': '>=8.0.0' + eslint: '>=8.0.0' + eslint-config-prettier: '*' + prettier: '>=3.0.0' + peerDependenciesMeta: + '@types/eslint': + optional: true + eslint-config-prettier: + optional: true + + eslint-scope@7.2.2: + resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + eslint-visitor-keys@3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + eslint@8.57.1: + resolution: {integrity: sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. + hasBin: true + + espree@9.6.1: + resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + esquery@1.6.0: + resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==} + engines: {node: '>=0.10'} + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + event-target-shim@5.0.1: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} engines: {node: '>=6'} @@ -895,15 +1136,53 @@ packages: resolution: {integrity: sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==} engines: {node: '> 0.1.90'} + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-diff@1.3.0: + resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} + + fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} + engines: {node: '>=8.6.0'} + + fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + fast-levenshtein@2.0.6: + resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + fast-stable-stringify@1.0.0: resolution: {integrity: sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==} fastestsmallesttextencoderdecoder@1.0.22: resolution: {integrity: sha512-Pb8d48e+oIuY4MaM64Cd7OW1gt4nxCHs7/ddPPZ/Ic3sg8yVGM7O9wDvZ7us6ScaUupzM+pfBolwtYhN1IxBIw==} + fastq@1.18.0: + resolution: {integrity: sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==} + + file-entry-cache@6.0.1: + resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} + engines: {node: ^10.12.0 || >=12.0.0} + file-uri-to-path@1.0.0: resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + + flat-cache@3.2.0: + resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} + engines: {node: ^10.12.0 || >=12.0.0} + + flatted@3.3.2: + resolution: {integrity: sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==} + follow-redirects@1.15.9: resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} engines: {node: '>=4.0'} @@ -927,6 +1206,9 @@ packages: resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==} engines: {node: '>= 12.20'} + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + function-bind@1.1.2: resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} @@ -934,6 +1216,26 @@ packages: resolution: {integrity: sha512-qxsEs+9A+u85HhllWJJFicJfPDhRmjzoYdl64aMWW9yRIJmSyxdn8IEkuIM530/7T+lv0TIHd8L6Q/ra0tEoeA==} engines: {node: '>= 0.4'} + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} + + glob@7.2.3: + resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Glob versions prior to v9 are no longer supported + + globals@13.24.0: + resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} + engines: {node: '>=8'} + + globby@11.1.0: + resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} + engines: {node: '>=10'} + gopd@1.2.0: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} @@ -941,12 +1243,19 @@ packages: graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + graphemesplit@2.4.4: resolution: {integrity: sha512-lKrpp1mk1NH26USxC/Asw4OHbhSQf5XfrWZ+CDv/dFVvd1j17kFgMotdJvOesmHkbFX9P9sBfpH8VogxOWLg8w==} groq-sdk@0.5.0: resolution: {integrity: sha512-RVmhW7qZ+XZoy5fIuSdx/LGQJONpL8MHgZEW7dFwTdgkzStub2XQx6OKv28CHogijdwH41J+Npj/z2jBPu3vmw==} + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + has-property-descriptors@1.0.2: resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} @@ -980,6 +1289,22 @@ packages: ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + ignore@5.3.2: + resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} + engines: {node: '>= 4'} + + import-fresh@3.3.0: + resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} + engines: {node: '>=6'} + + imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} @@ -995,14 +1320,30 @@ packages: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + is-generator-function@1.0.10: resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} engines: {node: '>= 0.4'} + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + is-nan@1.3.2: resolution: {integrity: sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==} engines: {node: '>= 0.4'} + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-path-inside@3.0.3: + resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} + engines: {node: '>=8'} + is-retry-allowed@2.2.0: resolution: {integrity: sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==} engines: {node: '>=10'} @@ -1011,6 +1352,9 @@ packages: resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} engines: {node: '>= 0.4'} + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + isomorphic-ws@4.0.1: resolution: {integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==} peerDependencies: @@ -1031,6 +1375,15 @@ packages: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true + json-buffer@3.0.1: + resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} + + json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + json-stable-stringify-without-jsonify@1.0.1: + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + json-stringify-safe@5.0.1: resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} @@ -1050,6 +1403,9 @@ packages: resolution: {integrity: sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==} engines: {node: '>=0.10.0'} + keyv@4.5.4: + resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + langchain@0.3.7: resolution: {integrity: sha512-6/Gkk9Zez3HkbsETFxZVo1iKLmaK3OzkDseC5MYFKVmYFDXFAOyJR3srJ9P61xF8heVdsPixqYIsejBn7/9dXg==} engines: {node: '>=18'} @@ -1104,9 +1460,20 @@ packages: openai: optional: true + levn@0.4.1: + resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} + engines: {node: '>= 0.8.0'} + linkify-it@5.0.0: resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} + locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + + lodash.merge@4.6.2: + resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} @@ -1136,6 +1503,10 @@ packages: mdurl@2.0.0: resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + micromark-util-character@2.1.1: resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==} @@ -1151,6 +1522,10 @@ packages: micromark-util-types@2.0.1: resolution: {integrity: sha512-534m2WhVTddrcKVepwmVEVnUAmtrx9bfIjNoQHRqfnvdaHQiFytEhJoTgpWJvDEXCO5gLTQh3wYC1PgOJA4NSQ==} + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} @@ -1162,6 +1537,9 @@ packages: minimalistic-assert@1.0.1: resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} + minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@9.0.5: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} @@ -1176,6 +1554,9 @@ packages: resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==} hasBin: true + natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} @@ -1208,6 +1589,9 @@ packages: resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==} engines: {node: '>= 0.4'} + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + oniguruma-to-es@0.8.0: resolution: {integrity: sha512-rY+/a6b+uCgoYIL9itjY0x99UUDHXmGaw7Jjk5ZvM/3cxDJifyxFr/Zm4tTmF6Tre18gAakJo7AzhKUeMNLgHA==} @@ -1223,10 +1607,22 @@ packages: openapi-types@12.1.3: resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==} + optionator@0.9.4: + resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} + engines: {node: '>= 0.8.0'} + p-finally@1.0.0: resolution: {integrity: sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==} engines: {node: '>=4'} + p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + + p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + p-queue@6.6.2: resolution: {integrity: sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==} engines: {node: '>=8'} @@ -1245,14 +1641,51 @@ packages: pako@2.1.0: resolution: {integrity: sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==} + parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-type@4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + pathval@2.0.0: resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} engines: {node: '>= 14.16'} + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} engines: {node: '>= 0.4'} + prelude-ls@1.2.1: + resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} + engines: {node: '>= 0.8.0'} + + prettier-linter-helpers@1.0.0: + resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} + engines: {node: '>=6.0.0'} + + prettier@3.4.2: + resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} + engines: {node: '>=14'} + hasBin: true + property-information@6.5.0: resolution: {integrity: sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==} @@ -1267,6 +1700,9 @@ packages: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} + queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} @@ -1279,13 +1715,29 @@ packages: regex@5.0.2: resolution: {integrity: sha512-/pczGbKIQgfTMRV0XjABvc5RzLqQmwqxLHdQao2RTXPk+pmTXB2P0IaUHYdYyk412YLwUIkaeMd5T+RzVgTqnQ==} + resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + retry@0.13.1: resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==} engines: {node: '>= 4'} + reusify@1.0.4: + resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + + rimraf@3.0.2: + resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + deprecated: Rimraf versions prior to v4 are no longer supported + hasBin: true + rpc-websockets@9.0.4: resolution: {integrity: sha512-yWZWN0M+bivtoNLnaDbtny4XchdAIF5Q4g/ZsC5UC61Ckbp0QczwO8fg44rV3uYmY4WHd+EZQbn90W1d8ojzqQ==} + run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} @@ -1298,9 +1750,21 @@ packages: resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} engines: {node: '>= 0.4'} + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + shiki@1.24.3: resolution: {integrity: sha512-eMeX/ehE2IDKVs71kB4zVcDHjutNcOtm+yIRuR4sA6ThBbdFI0DffGJiyoKCodj0xRGxIoWC3pk/Anmm5mzHmA==} + slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + snake-case@3.0.4: resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==} @@ -1310,10 +1774,18 @@ packages: stringify-entities@4.0.4: resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==} + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + strip-bom@3.0.0: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} engines: {node: '>=4'} + strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + superstruct@0.15.5: resolution: {integrity: sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==} @@ -1321,9 +1793,20 @@ packages: resolution: {integrity: sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==} engines: {node: '>=14.0.0'} + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + synckit@0.9.2: + resolution: {integrity: sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==} + engines: {node: ^14.18.0 || >=16.0.0} + text-encoding-utf-8@1.0.2: resolution: {integrity: sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==} + text-table@0.2.0: + resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + through@2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} @@ -1333,6 +1816,10 @@ packages: tiny-invariant@1.3.3: resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==} + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + toformat@2.0.0: resolution: {integrity: sha512-03SWBVop6nU8bpyZCx7SodpYznbZF5R4ljwNLBcTQzKOD9xuihRo/psX58llS1BMFhhAI08H3luot5GoXJz2pQ==} @@ -1345,6 +1832,12 @@ packages: trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} + ts-api-utils@1.4.3: + resolution: {integrity: sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==} + engines: {node: '>=16'} + peerDependencies: + typescript: '>=4.2.0' + ts-log@2.2.7: resolution: {integrity: sha512-320x5Ggei84AxzlXp91QkIGSw5wgaLT6GeAH0KsqDmRZdVWW2OiSeVvElVoatk3f7nicwXlElXsoFkARiGE2yg==} @@ -1372,6 +1865,14 @@ packages: tweetnacl@1.0.3: resolution: {integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==} + type-check@0.4.0: + resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} + engines: {node: '>= 0.8.0'} + + type-fest@0.20.2: + resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} + engines: {node: '>=10'} + typedoc@0.26.11: resolution: {integrity: sha512-sFEgRRtrcDl2FxVP58Ze++ZK2UQAEvtvvH8rRlig1Ja3o7dDaMHmaBfvJmdGnNEFaLTpQsN8dpvZaTqJSu/Ugw==} engines: {node: '>= 18'} @@ -1415,6 +1916,9 @@ packages: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + utf-8-validate@5.0.10: resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} engines: {node: '>=6.14.2'} @@ -1461,6 +1965,18 @@ packages: resolution: {integrity: sha512-qEcY+KJYlWyLH9vNbsr6/5j59AXk5ni5aakf8ldzBvGde6Iz4sxZGkJyWSAueTG7QhOvNRYb1lDdFmL5Td0QKA==} engines: {node: '>= 0.4'} + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + word-wrap@1.2.5: + resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} + engines: {node: '>=0.10.0'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + ws@7.5.10: resolution: {integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==} engines: {node: '>=8.3.0'} @@ -1494,6 +2010,10 @@ packages: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + zod-to-json-schema@3.24.1: resolution: {integrity: sha512-3h08nf3Vw3Wl3PK+q3ow/lIil81IT2Oa7YpQyUUDsEWbXveMesdfK1xBd2RhCkynwZndAxixji/7SYJJowr62w==} peerDependencies: @@ -1570,6 +2090,29 @@ snapshots: dependencies: '@jridgewell/trace-mapping': 0.3.9 + '@eslint-community/eslint-utils@4.4.1(eslint@8.57.1)': + dependencies: + eslint: 8.57.1 + eslint-visitor-keys: 3.4.3 + + '@eslint-community/regexpp@4.12.1': {} + + '@eslint/eslintrc@2.1.4': + dependencies: + ajv: 6.12.6 + debug: 4.4.0 + espree: 9.6.1 + globals: 13.24.0 + ignore: 5.3.2 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + + '@eslint/js@8.57.1': {} + '@ethersproject/bytes@5.7.0': dependencies: '@ethersproject/logger': 5.7.0 @@ -1582,6 +2125,18 @@ snapshots: '@ethersproject/logger': 5.7.0 hash.js: 1.1.7 + '@humanwhocodes/config-array@0.13.0': + dependencies: + '@humanwhocodes/object-schema': 2.0.3 + debug: 4.4.0 + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + + '@humanwhocodes/module-importer@1.0.1': {} + + '@humanwhocodes/object-schema@2.0.3': {} + '@jridgewell/resolve-uri@3.1.2': {} '@jridgewell/sourcemap-codec@1.5.0': {} @@ -1822,6 +2377,18 @@ snapshots: '@noble/hashes@1.6.1': {} + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.18.0 + '@onsol/tldparser@0.6.7(@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(bn.js@5.2.1)(borsh@2.0.0)(buffer@6.0.3)(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: '@ethersproject/sha2': 5.7.0 @@ -1852,6 +2419,8 @@ snapshots: decimal.js: 10.4.3 tiny-invariant: 1.3.3 + '@pkgr/core@0.1.1': {} + '@pythnetwork/price-service-client@1.9.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: '@pythnetwork/price-service-sdk': 1.8.0 @@ -2287,6 +2856,87 @@ snapshots: dependencies: '@types/node': 22.10.2 + '@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.2))(eslint@8.57.1)(typescript@5.7.2)': + dependencies: + '@eslint-community/regexpp': 4.12.1 + '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.7.2) + '@typescript-eslint/scope-manager': 7.18.0 + '@typescript-eslint/type-utils': 7.18.0(eslint@8.57.1)(typescript@5.7.2) + '@typescript-eslint/utils': 7.18.0(eslint@8.57.1)(typescript@5.7.2) + '@typescript-eslint/visitor-keys': 7.18.0 + eslint: 8.57.1 + graphemer: 1.4.0 + ignore: 5.3.2 + natural-compare: 1.4.0 + ts-api-utils: 1.4.3(typescript@5.7.2) + optionalDependencies: + typescript: 5.7.2 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.2)': + dependencies: + '@typescript-eslint/scope-manager': 7.18.0 + '@typescript-eslint/types': 7.18.0 + '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.7.2) + '@typescript-eslint/visitor-keys': 7.18.0 + debug: 4.4.0 + eslint: 8.57.1 + optionalDependencies: + typescript: 5.7.2 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/scope-manager@7.18.0': + dependencies: + '@typescript-eslint/types': 7.18.0 + '@typescript-eslint/visitor-keys': 7.18.0 + + '@typescript-eslint/type-utils@7.18.0(eslint@8.57.1)(typescript@5.7.2)': + dependencies: + '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.7.2) + '@typescript-eslint/utils': 7.18.0(eslint@8.57.1)(typescript@5.7.2) + debug: 4.4.0 + eslint: 8.57.1 + ts-api-utils: 1.4.3(typescript@5.7.2) + optionalDependencies: + typescript: 5.7.2 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/types@7.18.0': {} + + '@typescript-eslint/typescript-estree@7.18.0(typescript@5.7.2)': + dependencies: + '@typescript-eslint/types': 7.18.0 + '@typescript-eslint/visitor-keys': 7.18.0 + debug: 4.4.0 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.6.3 + ts-api-utils: 1.4.3(typescript@5.7.2) + optionalDependencies: + typescript: 5.7.2 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/utils@7.18.0(eslint@8.57.1)(typescript@5.7.2)': + dependencies: + '@eslint-community/eslint-utils': 4.4.1(eslint@8.57.1) + '@typescript-eslint/scope-manager': 7.18.0 + '@typescript-eslint/types': 7.18.0 + '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.7.2) + eslint: 8.57.1 + transitivePeerDependencies: + - supports-color + - typescript + + '@typescript-eslint/visitor-keys@7.18.0': + dependencies: + '@typescript-eslint/types': 7.18.0 + eslint-visitor-keys: 3.4.3 + '@ungap/structured-clone@1.2.1': {} JSONStream@1.3.5: @@ -2298,6 +2948,10 @@ snapshots: dependencies: event-target-shim: 5.0.1 + acorn-jsx@5.3.2(acorn@8.14.0): + dependencies: + acorn: 8.14.0 + acorn-walk@8.3.4: dependencies: acorn: 8.14.0 @@ -2308,6 +2962,19 @@ snapshots: dependencies: humanize-ms: 1.2.1 + ajv@6.12.6: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + ansi-regex@5.0.1: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + ansi-styles@5.2.0: {} ansicolors@0.3.2: {} @@ -2316,6 +2983,8 @@ snapshots: argparse@2.0.1: {} + array-union@2.1.0: {} + assert@2.1.0: dependencies: call-bind: 1.0.8 @@ -2381,10 +3050,19 @@ snapshots: borsh@2.0.0: {} + brace-expansion@1.1.11: + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + brace-expansion@2.0.1: dependencies: balanced-match: 1.0.2 + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + bs58@4.0.1: dependencies: base-x: 3.0.10 @@ -2426,6 +3104,8 @@ snapshots: call-bind-apply-helpers: 1.0.1 get-intrinsic: 1.2.6 + callsites@3.1.0: {} + camelcase@6.3.0: {} ccount@2.0.1: {} @@ -2438,6 +3118,11 @@ snapshots: loupe: 3.1.2 pathval: 2.0.0 + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + chalk@5.4.0: {} character-entities-html4@2.1.0: {} @@ -2446,6 +3131,12 @@ snapshots: check-error@2.1.1: {} + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + combined-stream@1.0.8: dependencies: delayed-stream: 1.0.0 @@ -2458,6 +3149,8 @@ snapshots: commander@2.20.3: {} + concat-map@0.0.1: {} + create-require@1.1.1: {} cross-fetch@3.1.8: @@ -2466,6 +3159,12 @@ snapshots: transitivePeerDependencies: - encoding + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + crypto-hash@1.3.0: {} dayjs@1.11.13: {} @@ -2482,6 +3181,8 @@ snapshots: deep-eql@5.0.2: {} + deep-is@0.1.4: {} + define-data-property@1.1.4: dependencies: es-define-property: 1.0.1 @@ -2506,6 +3207,14 @@ snapshots: diff@4.0.2: {} + dir-glob@3.0.1: + dependencies: + path-type: 4.0.0 + + doctrine@3.0.0: + dependencies: + esutils: 2.0.3 + dot-case@3.0.4: dependencies: no-case: 3.0.4 @@ -2537,6 +3246,89 @@ snapshots: dependencies: es6-promise: 4.2.8 + escape-string-regexp@4.0.0: {} + + eslint-config-prettier@9.1.0(eslint@8.57.1): + dependencies: + eslint: 8.57.1 + + eslint-plugin-prettier@5.2.1(eslint-config-prettier@9.1.0(eslint@8.57.1))(eslint@8.57.1)(prettier@3.4.2): + dependencies: + eslint: 8.57.1 + prettier: 3.4.2 + prettier-linter-helpers: 1.0.0 + synckit: 0.9.2 + optionalDependencies: + eslint-config-prettier: 9.1.0(eslint@8.57.1) + + eslint-scope@7.2.2: + dependencies: + esrecurse: 4.3.0 + estraverse: 5.3.0 + + eslint-visitor-keys@3.4.3: {} + + eslint@8.57.1: + dependencies: + '@eslint-community/eslint-utils': 4.4.1(eslint@8.57.1) + '@eslint-community/regexpp': 4.12.1 + '@eslint/eslintrc': 2.1.4 + '@eslint/js': 8.57.1 + '@humanwhocodes/config-array': 0.13.0 + '@humanwhocodes/module-importer': 1.0.1 + '@nodelib/fs.walk': 1.2.8 + '@ungap/structured-clone': 1.2.1 + ajv: 6.12.6 + chalk: 4.1.2 + cross-spawn: 7.0.6 + debug: 4.4.0 + doctrine: 3.0.0 + escape-string-regexp: 4.0.0 + eslint-scope: 7.2.2 + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 + esquery: 1.6.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 6.0.1 + find-up: 5.0.0 + glob-parent: 6.0.2 + globals: 13.24.0 + graphemer: 1.4.0 + ignore: 5.3.2 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + is-path-inside: 3.0.3 + js-yaml: 4.1.0 + json-stable-stringify-without-jsonify: 1.0.1 + levn: 0.4.1 + lodash.merge: 4.6.2 + minimatch: 3.1.2 + natural-compare: 1.4.0 + optionator: 0.9.4 + strip-ansi: 6.0.1 + text-table: 0.2.0 + transitivePeerDependencies: + - supports-color + + espree@9.6.1: + dependencies: + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) + eslint-visitor-keys: 3.4.3 + + esquery@1.6.0: + dependencies: + estraverse: 5.3.0 + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@5.3.0: {} + + esutils@2.0.3: {} + event-target-shim@5.0.1: {} eventemitter3@4.0.7: {} @@ -2545,12 +3337,53 @@ snapshots: eyes@0.1.8: {} + fast-deep-equal@3.1.3: {} + + fast-diff@1.3.0: {} + + fast-glob@3.3.2: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + + fast-json-stable-stringify@2.1.0: {} + + fast-levenshtein@2.0.6: {} + fast-stable-stringify@1.0.0: {} fastestsmallesttextencoderdecoder@1.0.22: {} + fastq@1.18.0: + dependencies: + reusify: 1.0.4 + + file-entry-cache@6.0.1: + dependencies: + flat-cache: 3.2.0 + file-uri-to-path@1.0.0: {} + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + find-up@5.0.0: + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 + + flat-cache@3.2.0: + dependencies: + flatted: 3.3.2 + keyv: 4.5.4 + rimraf: 3.0.2 + + flatted@3.3.2: {} + follow-redirects@1.15.9: {} for-each@0.3.3: @@ -2570,6 +3403,8 @@ snapshots: node-domexception: 1.0.0 web-streams-polyfill: 4.0.0-beta.3 + fs.realpath@1.0.0: {} + function-bind@1.1.2: {} get-intrinsic@1.2.6: @@ -2585,11 +3420,43 @@ snapshots: hasown: 2.0.2 math-intrinsics: 1.1.0 + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + + glob-parent@6.0.2: + dependencies: + is-glob: 4.0.3 + + glob@7.2.3: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + + globals@13.24.0: + dependencies: + type-fest: 0.20.2 + + globby@11.1.0: + dependencies: + array-union: 2.1.0 + dir-glob: 3.0.1 + fast-glob: 3.3.2 + ignore: 5.3.2 + merge2: 1.4.1 + slash: 3.0.0 + gopd@1.2.0: {} graceful-fs@4.2.11: optional: true + graphemer@1.4.0: {} + graphemesplit@2.4.4: dependencies: js-base64: 3.7.7 @@ -2608,6 +3475,8 @@ snapshots: transitivePeerDependencies: - encoding + has-flag@4.0.0: {} + has-property-descriptors@1.0.2: dependencies: es-define-property: 1.0.1 @@ -2653,6 +3522,20 @@ snapshots: ieee754@1.2.1: {} + ignore@5.3.2: {} + + import-fresh@3.3.0: + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + + imurmurhash@0.1.4: {} + + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + inherits@2.0.4: {} ipaddr.js@2.2.0: {} @@ -2664,21 +3547,33 @@ snapshots: is-callable@1.2.7: {} + is-extglob@2.1.1: {} + is-generator-function@1.0.10: dependencies: has-tostringtag: 1.0.2 + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + is-nan@1.3.2: dependencies: call-bind: 1.0.8 define-properties: 1.2.1 + is-number@7.0.0: {} + + is-path-inside@3.0.3: {} + is-retry-allowed@2.2.0: {} is-typed-array@1.1.15: dependencies: which-typed-array: 1.1.18 + isexe@2.0.0: {} + isomorphic-ws@4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)): dependencies: ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) @@ -2715,6 +3610,12 @@ snapshots: dependencies: argparse: 2.0.1 + json-buffer@3.0.1: {} + + json-schema-traverse@0.4.1: {} + + json-stable-stringify-without-jsonify@1.0.1: {} + json-stringify-safe@5.0.1: {} json5@2.2.3: {} @@ -2729,6 +3630,10 @@ snapshots: jsonpointer@5.0.1: {} + keyv@4.5.4: + dependencies: + json-buffer: 3.0.1 + langchain@0.3.7(@langchain/core@0.3.26(openai@4.77.0(zod@3.24.1)))(@langchain/groq@0.1.2(@langchain/core@0.3.26(openai@4.77.0(zod@3.24.1))))(axios@1.7.9)(openai@4.77.0(zod@3.24.1)): dependencies: '@langchain/core': 0.3.26(openai@4.77.0(zod@3.24.1)) @@ -2762,10 +3667,21 @@ snapshots: optionalDependencies: openai: 4.77.0(zod@3.24.1) + levn@0.4.1: + dependencies: + prelude-ls: 1.2.1 + type-check: 0.4.0 + linkify-it@5.0.0: dependencies: uc.micro: 2.1.0 + locate-path@6.0.0: + dependencies: + p-locate: 5.0.0 + + lodash.merge@4.6.2: {} + lodash@4.17.21: {} loupe@3.1.2: {} @@ -2803,6 +3719,8 @@ snapshots: mdurl@2.0.0: {} + merge2@1.4.1: {} + micromark-util-character@2.1.1: dependencies: micromark-util-symbol: 2.0.1 @@ -2820,6 +3738,11 @@ snapshots: micromark-util-types@2.0.1: {} + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + mime-db@1.52.0: {} mime-types@2.1.35: @@ -2828,6 +3751,10 @@ snapshots: minimalistic-assert@1.0.1: {} + minimatch@3.1.2: + dependencies: + brace-expansion: 1.1.11 + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 @@ -2838,6 +3765,8 @@ snapshots: mustache@4.2.0: {} + natural-compare@1.4.0: {} + no-case@3.0.4: dependencies: lower-case: 2.0.2 @@ -2868,6 +3797,10 @@ snapshots: has-symbols: 1.1.0 object-keys: 1.1.1 + once@1.4.0: + dependencies: + wrappy: 1.0.2 + oniguruma-to-es@0.8.0: dependencies: emoji-regex-xs: 1.0.0 @@ -2890,8 +3823,25 @@ snapshots: openapi-types@12.1.3: {} + optionator@0.9.4: + dependencies: + deep-is: 0.1.4 + fast-levenshtein: 2.0.6 + levn: 0.4.1 + prelude-ls: 1.2.1 + type-check: 0.4.0 + word-wrap: 1.2.5 + p-finally@1.0.0: {} + p-limit@3.1.0: + dependencies: + yocto-queue: 0.1.0 + + p-locate@5.0.0: + dependencies: + p-limit: 3.1.0 + p-queue@6.6.2: dependencies: eventemitter3: 4.0.7 @@ -2910,10 +3860,32 @@ snapshots: pako@2.1.0: {} + parent-module@1.0.1: + dependencies: + callsites: 3.1.0 + + path-exists@4.0.0: {} + + path-is-absolute@1.0.1: {} + + path-key@3.1.1: {} + + path-type@4.0.0: {} + pathval@2.0.0: {} + picomatch@2.3.1: {} + possible-typed-array-names@1.0.0: {} + prelude-ls@1.2.1: {} + + prettier-linter-helpers@1.0.0: + dependencies: + fast-diff: 1.3.0 + + prettier@3.4.2: {} + property-information@6.5.0: {} proxy-from-env@1.1.0: {} @@ -2922,6 +3894,8 @@ snapshots: punycode@2.3.1: {} + queue-microtask@1.2.3: {} + regenerator-runtime@0.14.1: {} regex-recursion@5.0.0: @@ -2934,8 +3908,16 @@ snapshots: dependencies: regex-utilities: 2.3.0 + resolve-from@4.0.0: {} + retry@0.13.1: {} + reusify@1.0.4: {} + + rimraf@3.0.2: + dependencies: + glob: 7.2.3 + rpc-websockets@9.0.4: dependencies: '@swc/helpers': 0.5.15 @@ -2949,6 +3931,10 @@ snapshots: bufferutil: 4.0.8 utf-8-validate: 5.0.10 + run-parallel@1.2.0: + dependencies: + queue-microtask: 1.2.3 + safe-buffer@5.2.1: {} semver@7.6.3: {} @@ -2962,6 +3948,12 @@ snapshots: gopd: 1.2.0 has-property-descriptors: 1.0.2 + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + shiki@1.24.3: dependencies: '@shikijs/core': 1.24.3 @@ -2971,6 +3963,8 @@ snapshots: '@shikijs/vscode-textmate': 9.3.1 '@types/hast': 3.0.4 + slash@3.0.0: {} + snake-case@3.0.4: dependencies: dot-case: 3.0.4 @@ -2983,20 +3977,41 @@ snapshots: character-entities-html4: 2.1.0 character-entities-legacy: 3.0.0 + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + strip-bom@3.0.0: {} + strip-json-comments@3.1.1: {} + superstruct@0.15.5: {} superstruct@2.0.2: {} + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + synckit@0.9.2: + dependencies: + '@pkgr/core': 0.1.1 + tslib: 2.8.1 + text-encoding-utf-8@1.0.2: {} + text-table@0.2.0: {} + through@2.3.8: {} tiny-inflate@1.0.3: {} tiny-invariant@1.3.3: {} + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + toformat@2.0.0: {} toml@3.0.0: {} @@ -3005,6 +4020,10 @@ snapshots: trim-lines@3.0.1: {} + ts-api-utils@1.4.3(typescript@5.7.2): + dependencies: + typescript: 5.7.2 + ts-log@2.2.7: {} ts-node@10.9.2(@types/node@22.10.2)(typescript@5.7.2): @@ -3035,6 +4054,12 @@ snapshots: tweetnacl@1.0.3: {} + type-check@0.4.0: + dependencies: + prelude-ls: 1.2.1 + + type-fest@0.20.2: {} + typedoc@0.26.11(typescript@5.7.2): dependencies: lunr: 2.3.9 @@ -3082,6 +4107,10 @@ snapshots: universalify@2.0.1: {} + uri-js@4.4.1: + dependencies: + punycode: 2.3.1 + utf-8-validate@5.0.10: dependencies: node-gyp-build: 4.8.4 @@ -3133,6 +4162,14 @@ snapshots: gopd: 1.2.0 has-tostringtag: 1.0.2 + which@2.0.2: + dependencies: + isexe: 2.0.0 + + word-wrap@1.2.5: {} + + wrappy@1.0.2: {} + ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10): optionalDependencies: bufferutil: 4.0.8 @@ -3147,6 +4184,8 @@ snapshots: yn@3.1.1: {} + yocto-queue@0.1.0: {} + zod-to-json-schema@3.24.1(zod@3.24.1): dependencies: zod: 3.24.1 diff --git a/src/agent/index.ts b/src/agent/index.ts index f1833f7..175304a 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -44,7 +44,6 @@ import { PumpFunTokenOptions, } from "../types"; import { BN } from "@coral-xyz/anchor"; -import { NameAccountAndDomain } from "@onsol/tldparser"; /** * Main class for interacting with Solana blockchain @@ -204,7 +203,7 @@ export class SolanaAgentKit { otherTokenMint: PublicKey, initialPrice: Decimal, maxPrice: Decimal, - feeTier: keyof typeof FEE_TIERS + feeTier: keyof typeof FEE_TIERS, ) { return createOrcaSingleSidedWhirlpool( this, @@ -213,7 +212,7 @@ export class SolanaAgentKit { otherTokenMint, initialPrice, maxPrice, - feeTier + feeTier, ); } @@ -221,18 +220,15 @@ export class SolanaAgentKit { return resolveAllDomains(this, domain); } - async getOwnedAllDomains( - owner: PublicKey - ): Promise { + async getOwnedAllDomains(owner: PublicKey): Promise { return getOwnedAllDomains(this, owner); } - async getOwnedDomainsForTLD( - tld: string - ):Promise { + async getOwnedDomainsForTLD(tld: string): Promise { return getOwnedDomainsForTLD(this, tld); } + // eslint-disable-next-line @typescript-eslint/ban-types async getAllDomainsTLDs(): Promise { return getAllDomainsTLDs(this); } @@ -249,7 +245,7 @@ export class SolanaAgentKit { marketId: PublicKey, baseAmount: BN, quoteAmount: BN, - startTime: BN + startTime: BN, ): Promise { return raydiumCreateAmmV4( this, @@ -258,8 +254,8 @@ export class SolanaAgentKit { baseAmount, quoteAmount, - startTime - );; + startTime, + ); } async raydiumCreateClmm( @@ -267,7 +263,7 @@ export class SolanaAgentKit { mint2: PublicKey, configId: PublicKey, initialPrice: Decimal, - startTime: BN + startTime: BN, ): Promise { return raydiumCreateClmm( this, @@ -285,7 +281,7 @@ export class SolanaAgentKit { configId: PublicKey, mintAAmount: BN, mintBAmount: BN, - startTime: BN + startTime: BN, ): Promise { return raydiumCreateCpmm( this, @@ -295,7 +291,7 @@ export class SolanaAgentKit { mintAAmount, mintBAmount, - startTime + startTime, ); } @@ -303,7 +299,7 @@ export class SolanaAgentKit { baseMint: PublicKey, quoteMint: PublicKey, lotSize: number = 1, - tickSize: number = 0.01 + tickSize: number = 0.01, ): Promise { return openbookCreateMarket( this, diff --git a/src/langchain/index.ts b/src/langchain/index.ts index 51fc6b4..2d31173 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -461,7 +461,7 @@ export class SolanaPumpfunTokenLaunchTool extends Tool { try { // Parse and normalize input input = input.trim(); - let parsedInput = JSON.parse(input); + const parsedInput = JSON.parse(input); this.validateInput(parsedInput); @@ -543,7 +543,7 @@ export class SolanaLendAssetTool extends Tool { async _call(input: string): Promise { try { - let amount = JSON.parse(input).amount || input; + const amount = JSON.parse(input).amount || input; const tx = await this.solanaKit.lendAssets(amount); @@ -779,8 +779,8 @@ export class SolanaCreateSingleSidedWhirlpoolTool extends Tool { if (!feeTier || !(feeTier in FEE_TIERS)) { throw new Error( `Invalid feeTier. Available options: ${Object.keys(FEE_TIERS).join( - ", " - )}` + ", ", + )}`, ); } @@ -790,7 +790,7 @@ export class SolanaCreateSingleSidedWhirlpoolTool extends Tool { otherTokenMint, initialPrice, maxPrice, - feeTier + feeTier, ); return JSON.stringify({ @@ -825,13 +825,13 @@ export class SolanaRaydiumCreateAmmV4 extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input); + const inputFormat = JSON.parse(input); const tx = await this.solanaKit.raydiumCreateAmmV4( new PublicKey(inputFormat.marketId), new BN(inputFormat.baseAmount), new BN(inputFormat.quoteAmount), - new BN(inputFormat.startTime) + new BN(inputFormat.startTime), ); return JSON.stringify({ @@ -867,7 +867,7 @@ export class SolanaRaydiumCreateClmm extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input); + const inputFormat = JSON.parse(input); const tx = await this.solanaKit.raydiumCreateClmm( new PublicKey(inputFormat.mint1), @@ -876,7 +876,7 @@ export class SolanaRaydiumCreateClmm extends Tool { new PublicKey(inputFormat.configId), new Decimal(inputFormat.initialPrice), - new BN(inputFormat.startTime) + new BN(inputFormat.startTime), ); return JSON.stringify({ @@ -913,7 +913,7 @@ export class SolanaRaydiumCreateCpmm extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input); + const inputFormat = JSON.parse(input); const tx = await this.solanaKit.raydiumCreateCpmm( new PublicKey(inputFormat.mint1), @@ -924,7 +924,7 @@ export class SolanaRaydiumCreateCpmm extends Tool { new BN(inputFormat.mintAAmount), new BN(inputFormat.mintBAmount), - new BN(inputFormat.startTime) + new BN(inputFormat.startTime), ); return JSON.stringify({ @@ -959,14 +959,14 @@ export class SolanaOpenbookCreateMarket extends Tool { async _call(input: string): Promise { try { - let inputFormat = JSON.parse(input); + const inputFormat = JSON.parse(input); const tx = await this.solanaKit.openbookCreateMarket( new PublicKey(inputFormat.baseMint), new PublicKey(inputFormat.quoteMint), inputFormat.lotSize, - inputFormat.tickSize + inputFormat.tickSize, ); return JSON.stringify({ @@ -998,14 +998,14 @@ export class SolanaPythFetchPrice extends Tool { async _call(input: string): Promise { try { const price = await this.solanaKit.pythFetchPrice(input); - let response: PythFetchPriceResponse = { + const response: PythFetchPriceResponse = { status: "success", priceFeedID: input, price: price, }; return JSON.stringify(response); } catch (error: any) { - let response: PythFetchPriceResponse = { + const response: PythFetchPriceResponse = { status: "error", priceFeedID: input, message: error.message, @@ -1033,7 +1033,7 @@ export class SolanaResolveAllDomainsTool extends Tool { try { const owner = await this.solanaKit.resolveAllDomains(input); - if(!owner) { + if (!owner) { return JSON.stringify({ status: "error", message: "Domain not found", @@ -1056,7 +1056,6 @@ export class SolanaResolveAllDomainsTool extends Tool { } } - export class SolanaGetOwnedDomains extends Tool { name = "solana_get_owned_domains"; description = `Get all domains owned by a specific wallet address. @@ -1088,7 +1087,6 @@ export class SolanaGetOwnedDomains extends Tool { } } - export class SolanaGetOwnedTldDomains extends Tool { name = "solana_get_owned_tld_domains"; description = `Get all domains owned by the agent's wallet for a specific TLD. @@ -1119,7 +1117,6 @@ export class SolanaGetOwnedTldDomains extends Tool { } } - export class SolanaGetAllTlds extends Tool { name = "solana_get_all_tlds"; description = `Get all active top-level domains (TLDs) in the AllDomains Name Service`; @@ -1147,7 +1144,6 @@ export class SolanaGetAllTlds extends Tool { } } - export class SolanaGetMainDomain extends Tool { name = "solana_get_main_domain"; description = `Get the main/favorite domain for a given wallet address. @@ -1162,9 +1158,8 @@ export class SolanaGetMainDomain extends Tool { async _call(input: string): Promise { try { const ownerPubkey = new PublicKey(input.trim()); - const mainDomain = await this.solanaKit.getMainAllDomainsDomain( - ownerPubkey - ); + const mainDomain = + await this.solanaKit.getMainAllDomainsDomain(ownerPubkey); return JSON.stringify({ status: "success", diff --git a/src/tools/create_orca_single_sided_whirlpool.ts b/src/tools/create_orca_single_sided_whirlpool.ts index 7f3c4a9..d3038c1 100644 --- a/src/tools/create_orca_single_sided_whirlpool.ts +++ b/src/tools/create_orca_single_sided_whirlpool.ts @@ -157,8 +157,9 @@ export async function createOrcaSingleSidedWhirlpool( } const mintAAccount = await fetcher.getMintInfo(mintA); const mintBAccount = await fetcher.getMintInfo(mintB); - if (mintAAccount === null || mintBAccount === null) + if (mintAAccount === null || mintBAccount === null) { throw Error("Mint account not found"); + } const tickSpacing = FEE_TIERS[feeTier]; const tickIndex = PriceMath.priceToTickIndex( initialPrice, @@ -273,8 +274,9 @@ export async function createOrcaSingleSidedWhirlpool( if ( !TickUtil.checkTickInBounds(tickLowerInitializableIndex) || !TickUtil.checkTickInBounds(tickUpperInitializableIndex) - ) + ) { throw Error("Prices out of bounds"); + } const increasLiquidityQuoteParam: IncreaseLiquidityQuoteParam = { inputTokenAmount: new BN(depositTokenAmount), inputTokenMint: depositTokenMint, diff --git a/src/tools/get_all_domains_tlds.ts b/src/tools/get_all_domains_tlds.ts index 93b6bf2..12bd9f0 100644 --- a/src/tools/get_all_domains_tlds.ts +++ b/src/tools/get_all_domains_tlds.ts @@ -1,4 +1,3 @@ -import { Connection, PublicKey } from "@solana/web3.js"; import { SolanaAgentKit } from "../index"; import { getAllTld } from "@onsol/tldparser"; @@ -8,12 +7,13 @@ import { getAllTld } from "@onsol/tldparser"; * @returns Array of active TLD strings */ export async function getAllDomainsTLDs( - agent: SolanaAgentKit + agent: SolanaAgentKit, + // eslint-disable-next-line @typescript-eslint/ban-types ): Promise { try { - let tlds = await getAllTld(agent.connection) - return tlds.map((tld) => tld.tld) + const tlds = await getAllTld(agent.connection); + return tlds.map((tld) => tld.tld); } catch (error: any) { throw new Error(`Failed to fetch TLDs: ${error.message}`); } -} \ No newline at end of file +} diff --git a/src/tools/get_all_registered_all_domains.ts b/src/tools/get_all_registered_all_domains.ts index 5520a48..019a5ea 100644 --- a/src/tools/get_all_registered_all_domains.ts +++ b/src/tools/get_all_registered_all_domains.ts @@ -9,7 +9,7 @@ import { getAllDomainsTLDs } from "./get_all_domains_tlds"; * @returns Array of all registered domain names with their TLDs */ export async function getAllRegisteredAllDomains( - agent: SolanaAgentKit + agent: SolanaAgentKit, ): Promise { try { // First get all TLDs @@ -20,7 +20,7 @@ export async function getAllRegisteredAllDomains( for (const tld of tlds) { const domains = await getAllDomains( agent.connection, - new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX") + new PublicKey("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"), ); // Add domains with TLD suffix diff --git a/src/tools/get_balance.ts b/src/tools/get_balance.ts index 05a56a1..a1e3736 100644 --- a/src/tools/get_balance.ts +++ b/src/tools/get_balance.ts @@ -11,11 +11,12 @@ export async function get_balance( agent: SolanaAgentKit, token_address?: PublicKey, ): Promise { - if (!token_address) + if (!token_address) { return ( (await agent.connection.getBalance(agent.wallet_address)) / LAMPORTS_PER_SOL ); + } const token_account = await agent.connection.getTokenAccountBalance(token_address); diff --git a/src/tools/get_main_all_domains_domain.ts b/src/tools/get_main_all_domains_domain.ts index 98f0dcd..d9ac724 100644 --- a/src/tools/get_main_all_domains_domain.ts +++ b/src/tools/get_main_all_domains_domain.ts @@ -1,7 +1,6 @@ import { getFavoriteDomain as _getFavoriteDomain } from "@bonfida/spl-name-service"; import { PublicKey } from "@solana/web3.js"; - /** * Get the user's main/favorite domain for a SolanaAgentKit instance * @param agent SolanaAgentKit instance @@ -10,15 +9,13 @@ import { PublicKey } from "@solana/web3.js"; */ export async function getMainAllDomainsDomain( agent: any, - owner: PublicKey + owner: PublicKey, ): Promise { let mainDomain = null; try { mainDomain = await _getFavoriteDomain(agent.connection, owner); return mainDomain.stale ? null : mainDomain.reverse; } catch (error: any) { - console.log("No main/favorite domain found"); + return null; } - return null } - diff --git a/src/tools/get_owned_all_domains.ts b/src/tools/get_owned_all_domains.ts index 17bbe40..aa52e1e 100644 --- a/src/tools/get_owned_all_domains.ts +++ b/src/tools/get_owned_all_domains.ts @@ -1,6 +1,6 @@ import { SolanaAgentKit } from "../agent"; import { PublicKey } from "@solana/web3.js"; -import { NameAccountAndDomain, TldParser } from "@onsol/tldparser"; +import { TldParser } from "@onsol/tldparser"; /** * Get all domains owned domains for a specific TLD for the agent's wallet @@ -10,11 +10,13 @@ import { NameAccountAndDomain, TldParser } from "@onsol/tldparser"; */ export async function getOwnedAllDomains( agent: SolanaAgentKit, - owner:PublicKey + owner: PublicKey, ): Promise { try { - let domains = await new TldParser(agent.connection).getParsedAllUserDomains(owner); - return domains.map((domain) => domain.domain) + const domains = await new TldParser( + agent.connection, + ).getParsedAllUserDomains(owner); + return domains.map((domain) => domain.domain); } catch (error: any) { throw new Error(`Failed to fetch owned domains: ${error.message}`); } diff --git a/src/tools/get_owned_domains_for_tld.ts b/src/tools/get_owned_domains_for_tld.ts index 0e13344..c3fde6a 100644 --- a/src/tools/get_owned_domains_for_tld.ts +++ b/src/tools/get_owned_domains_for_tld.ts @@ -4,22 +4,18 @@ import { SolanaAgentKit } from "../agent"; * Get all domains owned by an address for a specific TLD * @param agent SolanaAgentKit instance * @param tld Top-level domain (e.g., "sol") - * @returns Promise resolving to an array of owned domain names for the specified TLD or an empty array if none are found + * @returns Promise resolving to an array of owned domain names for the specified TLD or an empty array if none are found */ export async function getOwnedDomainsForTLD( agent: SolanaAgentKit, - tld: string + tld: string, ): Promise { try { - let domains = await new TldParser(agent.connection) - .getParsedAllUserDomainsFromTld( - agent.wallet_address, - tld - ) - return domains.map((domain) => domain.domain) + const domains = await new TldParser( + agent.connection, + ).getParsedAllUserDomainsFromTld(agent.wallet_address, tld); + return domains.map((domain) => domain.domain); } catch (error: any) { throw new Error(`Failed to fetch domains for TLD: ${error.message}`); } } - - diff --git a/src/tools/get_token_data.ts b/src/tools/get_token_data.ts index 110a801..6e6bc44 100644 --- a/src/tools/get_token_data.ts +++ b/src/tools/get_token_data.ts @@ -27,11 +27,11 @@ export async function getTokenDataByAddress( } export async function getTokenAddressFromTicker( - ticker: string + ticker: string, ): Promise { try { const response = await fetch( - `https://api.dexscreener.com/latest/dex/search?q=${ticker}` + `https://api.dexscreener.com/latest/dex/search?q=${ticker}`, ); const data = await response.json(); @@ -46,7 +46,7 @@ export async function getTokenAddressFromTicker( solanaPairs = solanaPairs.filter( (pair: any) => - pair.baseToken.symbol.toLowerCase() === ticker.toLowerCase() + pair.baseToken.symbol.toLowerCase() === ticker.toLowerCase(), ); // Return the address of the highest FDV Solana pair @@ -58,11 +58,11 @@ export async function getTokenAddressFromTicker( } export async function getTokenDataByTicker( - ticker: string + ticker: string, ): Promise { const address = await getTokenAddressFromTicker(ticker); if (!address) { throw new Error(`Token address not found for ticker: ${ticker}`); } return getTokenDataByAddress(new PublicKey(address)); -} \ No newline at end of file +} diff --git a/src/tools/index.ts b/src/tools/index.ts index 846c92b..8729dd3 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -23,7 +23,6 @@ export * from "./get_main_all_domains_domain"; export * from "./get_owned_all_domains"; export * from "./resolve_domain"; - export * from "./get_all_domains_tlds"; export * from "./get_all_registered_all_domains"; export * from "./get_owned_domains_for_tld"; diff --git a/src/tools/launch_pumpfun_token.ts b/src/tools/launch_pumpfun_token.ts index 0c3e6f5..08fd3bf 100644 --- a/src/tools/launch_pumpfun_token.ts +++ b/src/tools/launch_pumpfun_token.ts @@ -21,9 +21,15 @@ async function uploadMetadata( formData.append("showName", "true"); - if (options?.twitter) formData.append("twitter", options.twitter); - if (options?.telegram) formData.append("telegram", options.telegram); - if (options?.website) formData.append("website", options.website); + if (options?.twitter) { + formData.append("twitter", options.twitter); + } + if (options?.telegram) { + formData.append("telegram", options.telegram); + } + if (options?.website) { + formData.append("website", options.website); + } const imageResponse = await fetch(imageUrl); const imageBlob = await imageResponse.blob(); diff --git a/src/tools/pyth_fetch_price.ts b/src/tools/pyth_fetch_price.ts index 29129f8..789cec8 100644 --- a/src/tools/pyth_fetch_price.ts +++ b/src/tools/pyth_fetch_price.ts @@ -27,11 +27,11 @@ export async function pythFetchPrice(priceFeedID: string): Promise { } // get price and exponent from price feed - let price = new BN(currentPrice[0].getPriceUnchecked().price); - let exponent = new BN(currentPrice[0].getPriceUnchecked().expo); + const price = new BN(currentPrice[0].getPriceUnchecked().price); + const exponent = new BN(currentPrice[0].getPriceUnchecked().expo); // convert to scaled price - let scaledPrice = price.div(new BN(10).pow(exponent)); + const scaledPrice = price.div(new BN(10).pow(exponent)); return scaledPrice.toString(); } catch (error: any) { diff --git a/src/tools/raydium_create_clmm.ts b/src/tools/raydium_create_clmm.ts index b77ab74..7d049d4 100644 --- a/src/tools/raydium_create_clmm.ts +++ b/src/tools/raydium_create_clmm.ts @@ -25,8 +25,9 @@ export async function raydiumCreateClmm( const [mintInfo1, mintInfo2] = await agent.connection.getMultipleAccountsInfo( [mint1, mint2], ); - if (mintInfo1 === null || mintInfo2 === null) + if (mintInfo1 === null || mintInfo2 === null) { throw Error("fetch mint info error"); + } const mintDecodeInfo1 = MintLayout.decode(mintInfo1.data); const mintDecodeInfo2 = MintLayout.decode(mintInfo2.data); @@ -59,7 +60,7 @@ export async function raydiumCreateClmm( // programId: DEVNET_PROGRAM_ID.CLMM, mint1: mintFormatInfo1, mint2: mintFormatInfo2, - // @ts-ignore + // @ts-expect-error sdk bug ammConfig: { id: configId }, initialPrice, startTime, diff --git a/src/tools/raydium_create_cpmm.ts b/src/tools/raydium_create_cpmm.ts index d1c4dbd..35c702d 100644 --- a/src/tools/raydium_create_cpmm.ts +++ b/src/tools/raydium_create_cpmm.ts @@ -26,8 +26,9 @@ export async function raydiumCreateCpmm( const [mintInfoA, mintInfoB] = await agent.connection.getMultipleAccountsInfo( [mintA, mintB], ); - if (mintInfoA === null || mintInfoB === null) + if (mintInfoA === null || mintInfoB === null) { throw Error("fetch mint info error"); + } const mintDecodeInfoA = MintLayout.decode(mintInfoA.data); const mintDecodeInfoB = MintLayout.decode(mintInfoB.data); @@ -55,7 +56,7 @@ export async function raydiumCreateCpmm( extensions: {}, }; - const { execute, extInfo } = await raydium.cpmm.createPool({ + const { execute } = await raydium.cpmm.createPool({ programId: CREATE_CPMM_POOL_PROGRAM, poolFeeAccount: CREATE_CPMM_POOL_FEE_ACC, mintA: mintFormatInfoA, @@ -63,7 +64,7 @@ export async function raydiumCreateCpmm( mintAAmount, mintBAmount, startTime, - //@ts-ignore + //@ts-expect-error sdk bug feeConfig: { id: configId.toString() }, associatedOnly: false, ownerInfo: { diff --git a/src/tools/resolve_domain.ts b/src/tools/resolve_domain.ts index a83885a..6de2206 100644 --- a/src/tools/resolve_domain.ts +++ b/src/tools/resolve_domain.ts @@ -10,20 +10,20 @@ import { PublicKey } from "@solana/web3.js"; */ export async function resolveAllDomains( agent: SolanaAgentKit, - domain: string + domain: string, ): Promise { try { - console.log("domain", domain); - let tld = await new TldParser(agent.connection).getOwnerFromDomainTld( - domain + const tld = await new TldParser(agent.connection).getOwnerFromDomainTld( + domain, ); - console.log("tld", tld); return tld; } catch (error: any) { - // console.log("error", error.); - - if(error.message.includes("Cannot read properties of undefined (reading 'owner')")) { - return undefined + if ( + error.message.includes( + "Cannot read properties of undefined (reading 'owner')", + ) + ) { + return undefined; } throw new Error(`Domain resolution failed: ${error.message}`); } diff --git a/src/tools/send_compressed_airdrop.ts b/src/tools/send_compressed_airdrop.ts index 2a66e47..3df33ef 100644 --- a/src/tools/send_compressed_airdrop.ts +++ b/src/tools/send_compressed_airdrop.ts @@ -18,7 +18,7 @@ import { CompressedTokenProgram, createTokenPool, } from "@lightprotocol/compressed-token"; -import { Account, getOrCreateAssociatedTokenAccount } from "@solana/spl-token"; +import { getOrCreateAssociatedTokenAccount } from "@solana/spl-token"; // arbitrary const MAX_AIRDROP_RECIPIENTS = 1000; @@ -80,9 +80,8 @@ export async function sendCompressedAirdrop( ); } - let sourceTokenAccount: Account; try { - sourceTokenAccount = await getOrCreateAssociatedTokenAccount( + await getOrCreateAssociatedTokenAccount( agent.connection, agent.wallet, mintAddress, diff --git a/src/utils/keypair.ts b/src/utils/keypair.ts index 4b2035c..665765b 100644 --- a/src/utils/keypair.ts +++ b/src/utils/keypair.ts @@ -4,4 +4,4 @@ import bs58 from "bs58"; export const keypair = Keypair.generate(); console.log(keypair.publicKey.toString()); -console.log(bs58.encode(keypair.secretKey)); \ No newline at end of file +console.log(bs58.encode(keypair.secretKey)); diff --git a/src/utils/send_tx.ts b/src/utils/send_tx.ts index 593cbc8..5af33b7 100644 --- a/src/utils/send_tx.ts +++ b/src/utils/send_tx.ts @@ -86,7 +86,7 @@ export async function sendTx( } tx.sign(agent.wallet, ...(otherKeypairs ?? [])); - let txid = await agent.connection.sendRawTransaction(tx.serialize()); + const txid = await agent.connection.sendRawTransaction(tx.serialize()); await agent.connection.confirmTransaction({ signature: txid, blockhash: (await agent.connection.getLatestBlockhash()).blockhash, From 8c1ce69743b4804dbda0f784efee523d6159ef50 Mon Sep 17 00:00:00 2001 From: aryan Date: Wed, 25 Dec 2024 17:20:17 +0530 Subject: [PATCH 31/31] fix: lint --- src/agent/index.ts | 4 +- src/langchain/index.ts | 6 +- src/tools/create_gibwork_task.ts | 118 ++++++++++++++++--------------- 3 files changed, 69 insertions(+), 59 deletions(-) diff --git a/src/agent/index.ts b/src/agent/index.ts index b217dee..56f66f4 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -324,7 +324,7 @@ export class SolanaAgentKit { tags: string[], tokenMintAddress: string, tokenAmount: number, - payer?: string + payer?: string, ): Promise { return create_gibwork_task( this, @@ -334,7 +334,7 @@ export class SolanaAgentKit { tags, new PublicKey(tokenMintAddress), tokenAmount, - payer ? new PublicKey(payer) : undefined + payer ? new PublicKey(payer) : undefined, ); } } diff --git a/src/langchain/index.ts b/src/langchain/index.ts index 4095269..f28b000 100644 --- a/src/langchain/index.ts +++ b/src/langchain/index.ts @@ -1,7 +1,11 @@ import { PublicKey } from "@solana/web3.js"; import Decimal from "decimal.js"; import { Tool } from "langchain/tools"; -import { GibworkCreateTaskReponse, PythFetchPriceResponse, SolanaAgentKit } from "../index"; +import { + GibworkCreateTaskReponse, + PythFetchPriceResponse, + SolanaAgentKit, +} from "../index"; import { create_image } from "../tools/create_image"; import { BN } from "@coral-xyz/anchor"; import { FEE_TIERS } from "../tools"; diff --git a/src/tools/create_gibwork_task.ts b/src/tools/create_gibwork_task.ts index 60d0dbc..40ff3c3 100644 --- a/src/tools/create_gibwork_task.ts +++ b/src/tools/create_gibwork_task.ts @@ -1,4 +1,4 @@ -import { SendTransactionError, Transaction, VersionedTransaction } from "@solana/web3.js"; +import { VersionedTransaction } from "@solana/web3.js"; import { PublicKey } from "@solana/web3.js"; import { GibworkCreateTaskReponse, SolanaAgentKit } from "../index"; @@ -15,61 +15,67 @@ import { GibworkCreateTaskReponse, SolanaAgentKit } from "../index"; * @returns Object containing task creation transaction and generated taskId */ export async function create_gibwork_task( - agent: SolanaAgentKit, - title: string, - content: string, - requirements: string, - tags: string[], - tokenMintAddress: PublicKey, - tokenAmount: number, - payer?: PublicKey, + agent: SolanaAgentKit, + title: string, + content: string, + requirements: string, + tags: string[], + tokenMintAddress: PublicKey, + tokenAmount: number, + payer?: PublicKey, ): Promise { - try { - const apiResponse = await fetch('https://api2.gib.work/tasks/public/transaction', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - title: title, - content: content, - requirements: requirements, - tags: tags, - payer: payer?.toBase58() || agent.wallet.publicKey.toBase58(), - token: { - mintAddress: tokenMintAddress.toBase58(), - amount: tokenAmount - } - }) - }); + try { + const apiResponse = await fetch( + "https://api2.gib.work/tasks/public/transaction", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + title: title, + content: content, + requirements: requirements, + tags: tags, + payer: payer?.toBase58() || agent.wallet.publicKey.toBase58(), + token: { + mintAddress: tokenMintAddress.toBase58(), + amount: tokenAmount, + }, + }), + }, + ); - const responseData = await apiResponse.json(); - if (!responseData.taskId && !responseData.serializedTransaction) { - throw new Error(`${responseData.message}`); - } - - const serializedTransaction = Buffer.from(responseData.serializedTransaction, "base64"); - const tx = VersionedTransaction.deserialize(serializedTransaction); - - tx.sign([agent.wallet]); - const signature = await agent.connection.sendTransaction(tx, { - preflightCommitment: "confirmed", - maxRetries: 3, - }); - - const latestBlockhash = await agent.connection.getLatestBlockhash(); - await agent.connection.confirmTransaction({ - signature, - blockhash: latestBlockhash.blockhash, - lastValidBlockHeight: latestBlockhash.lastValidBlockHeight, - }); - - return { - status: "success", - taskId: responseData.taskId, - signature: signature - }; - } catch (err: any) { - throw new Error(`${err.message}`); + const responseData = await apiResponse.json(); + if (!responseData.taskId && !responseData.serializedTransaction) { + throw new Error(`${responseData.message}`); } -} \ No newline at end of file + + const serializedTransaction = Buffer.from( + responseData.serializedTransaction, + "base64", + ); + const tx = VersionedTransaction.deserialize(serializedTransaction); + + tx.sign([agent.wallet]); + const signature = await agent.connection.sendTransaction(tx, { + preflightCommitment: "confirmed", + maxRetries: 3, + }); + + const latestBlockhash = await agent.connection.getLatestBlockhash(); + await agent.connection.confirmTransaction({ + signature, + blockhash: latestBlockhash.blockhash, + lastValidBlockHeight: latestBlockhash.lastValidBlockHeight, + }); + + return { + status: "success", + taskId: responseData.taskId, + signature: signature, + }; + } catch (err: any) { + throw new Error(`${err.message}`); + } +}