mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-06-03 15:11:32 +00:00
Removed tooling added
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import {
|
||||
CreateCollectionOptions,
|
||||
StoreInitOptions,
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import {
|
||||
CreateSingleOptions,
|
||||
StoreInitOptions,
|
||||
2
src/langchain/3land/index.ts
Normal file
2
src/langchain/3land/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./create_single";
|
||||
export * from "./create_collection";
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { PerpTradeResponse } from "./types";
|
||||
|
||||
export class SolanaPerpCloseTradeTool extends BaseSolanaTool {
|
||||
2
src/langchain/adrena/index.ts
Normal file
2
src/langchain/adrena/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./open_trade";
|
||||
export * from "./close_trade";
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { PerpTradeResponse } from "./types";
|
||||
|
||||
export class SolanaPerpOpenTradeTool extends BaseSolanaTool {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { CreateImageResponse } from "./types";
|
||||
import { create_image } from "../../../tools/agent";
|
||||
import { create_image } from "../../tools/agent";
|
||||
|
||||
export class SolanaCreateImageTool extends BaseSolanaTool {
|
||||
name = "solana_create_image";
|
||||
2
src/langchain/agent/index.ts
Normal file
2
src/langchain/agent/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./create_image";
|
||||
export * from "./wallet_address";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { WalletAddressResponse } from "./types";
|
||||
|
||||
export class SolanaGetWalletAddressTool extends BaseSolanaTool {
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { DomainResponse } from "./types";
|
||||
|
||||
export class SolanaGetDomainTool extends BaseSolanaTool {
|
||||
4
src/langchain/bonfida/index.ts
Normal file
4
src/langchain/bonfida/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from "./register_domain";
|
||||
export * from "./resolve_domain";
|
||||
export * from "./get_domain";
|
||||
export * from "./main_domain";
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { DomainResponse } from "./types";
|
||||
|
||||
export class SolanaGetMainDomain extends BaseSolanaTool {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { RegisterDomainInput, RegisterDomainResponse } from "./types";
|
||||
|
||||
export class SolanaRegisterDomainTool extends BaseSolanaTool {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { ResolveDomainResponse } from "./types";
|
||||
|
||||
export class SolanaResolveDomainTool extends BaseSolanaTool {
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Tool } from "langchain/tools";
|
||||
import { SolanaAgentKit } from "../../../agent";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { BaseToolResponse } from "./types";
|
||||
|
||||
export abstract class BaseSolanaTool extends Tool {
|
||||
2
src/langchain/common/index.ts
Normal file
2
src/langchain/common/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./types";
|
||||
export * from "./base";
|
||||
1
src/langchain/dexscreener/index.ts
Normal file
1
src/langchain/dexscreener/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./token_data_ticker";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
|
||||
export class SolanaTokenDataByTickerTool extends BaseSolanaTool {
|
||||
name = "solana_token_data_by_ticker";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { FlashCloseTradeInput, PerpTradeResponse } from "./types";
|
||||
|
||||
export class SolanaFlashCloseTrade extends BaseSolanaTool {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { FlashOpenTradeInput, PerpTradeResponse } from "./types";
|
||||
|
||||
export class SolanaFlashOpenTrade extends BaseSolanaTool {
|
||||
3
src/langchain/flash/index.ts
Normal file
3
src/langchain/flash/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./flash_open";
|
||||
export * from "./flash_close";
|
||||
export * from "./types";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { CreateGibworkTaskInput, GibworkTaskResponse } from "./types";
|
||||
|
||||
export class SolanaCreateGibworkTask extends BaseSolanaTool {
|
||||
2
src/langchain/gibwork/index.ts
Normal file
2
src/langchain/gibwork/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./create_task";
|
||||
export * from "./types";
|
||||
@@ -1,3 +1,29 @@
|
||||
export * from "./adrena";
|
||||
export * from "./onsol";
|
||||
export * from "./dexscreener";
|
||||
export * from "./onsol";
|
||||
export * from "./flash";
|
||||
export * from "./gibwork";
|
||||
export * from "./jupiter";
|
||||
export * from "./lulo";
|
||||
export * from "./manifest";
|
||||
export * from "./solana";
|
||||
export * from "./agent";
|
||||
export * from "./metaplex";
|
||||
export * from "./openbook";
|
||||
export * from "./orca";
|
||||
export * from "./pumpfun";
|
||||
export * from "./pyth";
|
||||
export * from "./raydium";
|
||||
export * from "./rugcheck";
|
||||
export * from "./sendarcade";
|
||||
export * from "./solayer";
|
||||
export * from "./tensor";
|
||||
export * from "./3land";
|
||||
export * from "./tiplink";
|
||||
export * from "./bonfida";
|
||||
export * from "./lightprotocol";
|
||||
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import {
|
||||
SolanaBalanceTool,
|
||||
@@ -57,7 +83,7 @@ import {
|
||||
SolanaPerpCloseTradeTool,
|
||||
SolanaFlashOpenTrade,
|
||||
SolanaFlashCloseTrade,
|
||||
} from "./tools/index";
|
||||
} from "./index";
|
||||
|
||||
export function createSolanaTools(solanaKit: SolanaAgentKit) {
|
||||
return [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { PriceResponse } from "./types";
|
||||
|
||||
export class SolanaFetchPriceTool extends BaseSolanaTool {
|
||||
5
src/langchain/jupiter/index.ts
Normal file
5
src/langchain/jupiter/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from "./fetch_price";
|
||||
export * from "./token_data";
|
||||
export * from "./trade";
|
||||
export * from "./stake";
|
||||
export * from "./types";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { StakeResponse } from "./types";
|
||||
|
||||
export class SolanaStakeTool extends BaseSolanaTool {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
|
||||
export class SolanaTokenDataTool extends BaseSolanaTool {
|
||||
name = "solana_token_data";
|
||||
@@ -1,5 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { CompressedAirdropInput, CompressedAirdropResponse } from "./types";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
|
||||
export class SolanaCompressedAirdropTool extends BaseSolanaTool {
|
||||
name = "solana_compressed_airdrop";
|
||||
@@ -15,7 +14,7 @@ export class SolanaCompressedAirdropTool extends BaseSolanaTool {
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const params: CompressedAirdropInput = JSON.parse(input);
|
||||
const params = JSON.parse(input);
|
||||
|
||||
const txs = await this.solanaKit.sendCompressedAirdrop(
|
||||
params.mintAddress,
|
||||
@@ -30,7 +29,7 @@ export class SolanaCompressedAirdropTool extends BaseSolanaTool {
|
||||
status: "success",
|
||||
message: `Airdropped ${params.amount} tokens to ${params.recipients.length} recipients.`,
|
||||
transactionHashes: txs,
|
||||
} as CompressedAirdropResponse);
|
||||
});
|
||||
} catch (error: any) {
|
||||
return this.handleError(error);
|
||||
}
|
||||
1
src/langchain/lightprotocol/index.ts
Normal file
1
src/langchain/lightprotocol/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./compressed_airdrop";
|
||||
2
src/langchain/lulo/index.ts
Normal file
2
src/langchain/lulo/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./lend_asset";
|
||||
export * from "./types";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { LendAssetResponse } from "./types";
|
||||
|
||||
export class SolanaLendAssetTool extends BaseSolanaTool {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BaseSolanaTool } from "../common";
|
||||
import { OrderParams } from "../../../types";
|
||||
import { generateOrdersfromPattern } from "./../../../tools/manifest";
|
||||
import { OrderParams } from "../../types";
|
||||
import { generateOrdersfromPattern } from "../../tools/manifest";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
|
||||
export class SolanaBatchOrderTool extends BaseSolanaTool {
|
||||
6
src/langchain/manifest/index.ts
Normal file
6
src/langchain/manifest/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from "./manifest_market";
|
||||
export * from "./batch_order";
|
||||
export * from "./cancel_orders";
|
||||
export * from "./limit_order";
|
||||
export * from "./withdraw";
|
||||
export * from "./types";
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { ManifestMarketInput, ManifestMarketResponse } from "./types";
|
||||
|
||||
export class SolanaManifestCreateMarket extends BaseSolanaTool {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { DeployCollectionInput, DeployCollectionResponse } from "./types";
|
||||
|
||||
export class SolanaDeployCollectionTool extends BaseSolanaTool {
|
||||
@@ -1,5 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { DeployTokenInput, DeployTokenResponse } from "./types";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
|
||||
export class SolanaDeployTokenTool extends BaseSolanaTool {
|
||||
name = "solana_deploy_token";
|
||||
@@ -14,7 +13,7 @@ export class SolanaDeployTokenTool extends BaseSolanaTool {
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const params: DeployTokenInput = JSON.parse(input);
|
||||
const params = JSON.parse(input);
|
||||
|
||||
const result = await this.solanaKit.deployToken(
|
||||
params.name,
|
||||
@@ -29,7 +28,7 @@ export class SolanaDeployTokenTool extends BaseSolanaTool {
|
||||
message: "Token deployed successfully",
|
||||
mintAddress: result.mint.toString(),
|
||||
decimals: params.decimals || 9,
|
||||
} as DeployTokenResponse);
|
||||
});
|
||||
} catch (error: any) {
|
||||
return this.handleError(error);
|
||||
}
|
||||
4
src/langchain/metaplex/index.ts
Normal file
4
src/langchain/metaplex/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from "./deploy_collection";
|
||||
export * from "./mint_nft";
|
||||
export * from "./deploy_token";
|
||||
export * from "./types";
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { MintNFTInput, MintNFTResponse } from "./types";
|
||||
|
||||
export class SolanaMintNFTTool extends BaseSolanaTool {
|
||||
5
src/langchain/onsol/index.ts
Normal file
5
src/langchain/onsol/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from "./resolve_all_domains";
|
||||
export * from "./owned_domains";
|
||||
export * from "./tld_domains";
|
||||
export * from "./get_all_tld";
|
||||
export * from "./types";
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { DomainsListResponse } from "./types";
|
||||
|
||||
export class SolanaGetOwnedDomains extends BaseSolanaTool {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { ResolveDomainResponse } from "./types";
|
||||
|
||||
export class SolanaResolveAllDomainsTool extends BaseSolanaTool {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { DomainsListResponse } from "./types";
|
||||
|
||||
export class SolanaGetOwnedTldDomains extends BaseSolanaTool {
|
||||
45
src/langchain/onsol/types.ts
Normal file
45
src/langchain/onsol/types.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { BaseToolResponse } from "../common/types";
|
||||
|
||||
export interface RegisterDomainInput {
|
||||
name: string;
|
||||
spaceKB?: number;
|
||||
}
|
||||
|
||||
export interface ResolveDomainInput {
|
||||
domain: string;
|
||||
}
|
||||
|
||||
export interface GetDomainInput {
|
||||
account: string;
|
||||
}
|
||||
|
||||
export interface OwnedDomainsInput {
|
||||
owner: string;
|
||||
}
|
||||
|
||||
export interface TldDomainsInput {
|
||||
tld: string;
|
||||
}
|
||||
|
||||
export interface RegisterDomainResponse extends BaseToolResponse {
|
||||
transaction?: string;
|
||||
domain?: string;
|
||||
spaceKB?: number;
|
||||
}
|
||||
|
||||
export interface ResolveDomainResponse extends BaseToolResponse {
|
||||
publicKey?: string;
|
||||
owner?: string;
|
||||
}
|
||||
|
||||
export interface DomainResponse extends BaseToolResponse {
|
||||
domain?: string | null;
|
||||
}
|
||||
|
||||
export interface DomainsListResponse extends BaseToolResponse {
|
||||
domains?: string[];
|
||||
}
|
||||
|
||||
export interface TldsResponse extends BaseToolResponse {
|
||||
tlds?: string[];
|
||||
}
|
||||
2
src/langchain/openbook/index.ts
Normal file
2
src/langchain/openbook/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./openbook_market";
|
||||
export * from "./types";
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { OpenbookMarketInput } from "./types";
|
||||
|
||||
export class SolanaOpenbookCreateMarket extends BaseSolanaTool {
|
||||
7
src/langchain/orca/index.ts
Normal file
7
src/langchain/orca/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export * from "./orca_clmm";
|
||||
export * from "./orca_single_sided_pool";
|
||||
export * from "./orca_position";
|
||||
export * from "./orca_fetch_positions";
|
||||
export * from "./orca_centered_position";
|
||||
export * from "./orca_single_sided_position";
|
||||
export * from "./types";
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { Decimal } from "decimal.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { OrcaCenteredPositionInput, LiquidityResponse } from "./types";
|
||||
|
||||
export class SolanaOrcaOpenCenteredPosition extends BaseSolanaTool {
|
||||
@@ -1,8 +1,8 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { Decimal } from "decimal.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { LiquidityResponse } from "./types";
|
||||
import { FEE_TIERS } from "../../../tools/orca";
|
||||
import { FEE_TIERS } from "../../tools/orca";
|
||||
|
||||
export class SolanaOrcaCreateCLMM extends BaseSolanaTool {
|
||||
name = "orca_create_clmm";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { OrcaPositionsResponse } from "./types";
|
||||
|
||||
export class SolanaOrcaFetchPositions extends BaseSolanaTool {
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { OrcaPositionInput, LiquidityResponse } from "./types";
|
||||
|
||||
export class SolanaOrcaClosePosition extends BaseSolanaTool {
|
||||
@@ -1,8 +1,8 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { Decimal } from "decimal.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { LiquidityResponse } from "./types";
|
||||
import { FEE_TIERS } from "../../../tools/orca";
|
||||
import { FEE_TIERS } from "../../tools/orca";
|
||||
|
||||
export class SolanaOrcaCreateSingleSidedPool extends BaseSolanaTool {
|
||||
name = "orca_create_single_sided_liquidity_pool";
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { Decimal } from "decimal.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { OrcaSingleSidedPositionInput, LiquidityResponse } from "./types";
|
||||
|
||||
export class SolanaOrcaOpenSingleSidedPosition extends BaseSolanaTool {
|
||||
1
src/langchain/pumpfun/index.ts
Normal file
1
src/langchain/pumpfun/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./launch_pumpfun_token";
|
||||
2
src/langchain/pyth/index.ts
Normal file
2
src/langchain/pyth/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./pyth_price";
|
||||
export * from "./types";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { PythPriceResponse } from "./types";
|
||||
|
||||
export class SolanaPythFetchPrice extends BaseSolanaTool {
|
||||
4
src/langchain/raydium/index.ts
Normal file
4
src/langchain/raydium/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from "./raydium_amm";
|
||||
export * from "./raydium_clmm";
|
||||
export * from "./raydium_cpmm";
|
||||
export * from "./types";
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BN } from "@coral-xyz/anchor";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { RaydiumAmmV4Input } from "./types";
|
||||
|
||||
export class SolanaRaydiumCreateAmmV4 extends BaseSolanaTool {
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BN } from "@coral-xyz/anchor";
|
||||
import { Decimal } from "decimal.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { RaydiumClmmInput } from "./types";
|
||||
|
||||
export class SolanaRaydiumCreateClmm extends BaseSolanaTool {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BN } from "@coral-xyz/anchor";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { RaydiumCpmmInput } from "./types";
|
||||
|
||||
export class SolanaRaydiumCreateCpmm extends BaseSolanaTool {
|
||||
3
src/langchain/rugcheck/index.ts
Normal file
3
src/langchain/rugcheck/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./token_report_summary";
|
||||
export * from "./token_report_detailed";
|
||||
export * from "./types";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { TokenReportResponse } from "./types";
|
||||
|
||||
export class SolanaFetchTokenDetailedReportTool extends BaseSolanaTool {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { TokenReportResponse } from "./types";
|
||||
|
||||
export class SolanaFetchTokenReportSummaryTool extends BaseSolanaTool {
|
||||
2
src/langchain/sendarcade/index.ts
Normal file
2
src/langchain/sendarcade/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./rock_paper_scissors";
|
||||
export * from "./types";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { RockPaperScissorsInput } from "./types";
|
||||
|
||||
export class SolanaRockPaperScissorsTool extends BaseSolanaTool {
|
||||
@@ -1,6 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BalanceToolInput, BalanceToolResponse } from "./types";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
|
||||
export class SolanaBalanceTool extends BaseSolanaTool {
|
||||
name = "solana_balance";
|
||||
@@ -14,7 +13,7 @@ export class SolanaBalanceTool extends BaseSolanaTool {
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const params: BalanceToolInput = input ? JSON.parse(input) : {};
|
||||
const params = input ? JSON.parse(input) : {};
|
||||
const tokenAddress = params.tokenAddress
|
||||
? new PublicKey(params.tokenAddress)
|
||||
: undefined;
|
||||
@@ -24,7 +23,7 @@ export class SolanaBalanceTool extends BaseSolanaTool {
|
||||
status: "success",
|
||||
balance,
|
||||
token: params.tokenAddress || "SOL",
|
||||
} as BalanceToolResponse);
|
||||
});
|
||||
} catch (error: any) {
|
||||
return this.handleError(error);
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BalanceOtherToolInput, BalanceOtherToolResponse } from "./types";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
|
||||
export class SolanaBalanceOtherTool extends BaseSolanaTool {
|
||||
name = "solana_balance_other";
|
||||
@@ -14,7 +13,7 @@ export class SolanaBalanceOtherTool extends BaseSolanaTool {
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const params: BalanceOtherToolInput = JSON.parse(input);
|
||||
const params = JSON.parse(input);
|
||||
const tokenPubKey = params.tokenAddress
|
||||
? new PublicKey(params.tokenAddress)
|
||||
: undefined;
|
||||
@@ -29,7 +28,7 @@ export class SolanaBalanceOtherTool extends BaseSolanaTool {
|
||||
balance,
|
||||
wallet: params.walletAddress,
|
||||
token: params.tokenAddress || "SOL",
|
||||
} as BalanceOtherToolResponse);
|
||||
});
|
||||
} catch (error: any) {
|
||||
return this.handleError(error);
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { CloseEmptyAccountsResponse } from "./types";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
|
||||
export class SolanaCloseEmptyTokenAccounts extends BaseSolanaTool {
|
||||
name = "close_empty_token_accounts";
|
||||
@@ -15,7 +14,7 @@ export class SolanaCloseEmptyTokenAccounts extends BaseSolanaTool {
|
||||
message: `${size} accounts closed successfully. ${size === 48 ? "48 accounts can be closed in a single transaction try again to close more accounts" : ""}`,
|
||||
signature,
|
||||
size,
|
||||
} as CloseEmptyAccountsResponse);
|
||||
});
|
||||
} catch (error: any) {
|
||||
return this.handleError(error);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { TPSResponse } from "./types";
|
||||
|
||||
export class SolanaTPSCalculatorTool extends BaseSolanaTool {
|
||||
7
src/langchain/solana/index.ts
Normal file
7
src/langchain/solana/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export * from "./get_tps";
|
||||
export * from "./request_funds";
|
||||
export * from "./balance";
|
||||
export * from "./balance_other";
|
||||
export * from "./close_empty_accounts";
|
||||
export * from "./transfer";
|
||||
export * from "./types";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { BaseToolResponse } from "../common/types";
|
||||
|
||||
export class SolanaRequestFundsTool extends BaseSolanaTool {
|
||||
@@ -1,6 +1,5 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { TransferToolInput, TransferToolResponse } from "./types";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
|
||||
export class SolanaTransferTool extends BaseSolanaTool {
|
||||
name = "solana_transfer";
|
||||
@@ -13,7 +12,7 @@ export class SolanaTransferTool extends BaseSolanaTool {
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const params: TransferToolInput = JSON.parse(input);
|
||||
const params = JSON.parse(input);
|
||||
|
||||
const recipient = new PublicKey(params.to);
|
||||
const mintAddress = params.mint ? new PublicKey(params.mint) : undefined;
|
||||
@@ -31,7 +30,7 @@ export class SolanaTransferTool extends BaseSolanaTool {
|
||||
recipient: params.to,
|
||||
token: params.mint || "SOL",
|
||||
transaction: tx,
|
||||
} as TransferToolResponse);
|
||||
});
|
||||
} catch (error: any) {
|
||||
return this.handleError(error);
|
||||
}
|
||||
1
src/langchain/solayer/index.ts
Normal file
1
src/langchain/solayer/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./restake";
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSolanaTool } from "../common/base.tool";
|
||||
import { BaseSolanaTool } from "../common/base";
|
||||
import { StakeResponse } from "./types";
|
||||
|
||||
export class SolanaRestakeTool extends BaseSolanaTool {
|
||||
33
src/langchain/squads_multisig/approve_proposal.ts
Normal file
33
src/langchain/squads_multisig/approve_proposal.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { BaseSolanaTool } from "../common";
|
||||
|
||||
export class SolanaApproveProposal2by2Multisig extends BaseSolanaTool {
|
||||
name = "approve_proposal_2by2_multisig";
|
||||
description = `Approve a proposal to transfer funds from a 2-of-2 multisig account on Solana with the user and the agent, where both approvals will be required to run the transactions.
|
||||
|
||||
If proposalIndex is not provided, the latest index will automatically be fetched and used.
|
||||
|
||||
Inputs (JSON string):
|
||||
- proposalIndex: number, the index of the proposal (optional).`;
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const inputFormat = JSON.parse(input);
|
||||
const proposalIndex = inputFormat.proposalIndex ?? undefined;
|
||||
|
||||
const tx = await this.solanaKit.approveMultisigProposal(proposalIndex);
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Proposal approved successfully",
|
||||
transaction: tx,
|
||||
proposalIndex: proposalIndex.toString(),
|
||||
});
|
||||
} catch (error: any) {
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "APPROVE_PROPOSAL_2BY2_MULTISIG_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
33
src/langchain/squads_multisig/create_multisig.ts
Normal file
33
src/langchain/squads_multisig/create_multisig.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { BaseSolanaTool } from "../common";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
|
||||
export class SolanaCreate2by2Multisig extends BaseSolanaTool {
|
||||
name = "create_2by2_multisig";
|
||||
description = `Create a 2-of-2 multisig account on Solana with the user and the agent, where both approvals will be required to run the transactions.
|
||||
|
||||
Note: For one AI agent, only one 2-by-2 multisig can be created as it is pair-wise.
|
||||
|
||||
Inputs (JSON string):
|
||||
- creator: string, the public key of the creator (required).`;
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const inputFormat = JSON.parse(input);
|
||||
const creator = new PublicKey(inputFormat.creator);
|
||||
|
||||
const multisig = await this.solanaKit.createSquadsMultisig(creator);
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "2-by-2 multisig account created successfully",
|
||||
multisig,
|
||||
});
|
||||
} catch (error: any) {
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "CREATE_2BY2_MULTISIG_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user