# SolanaAgentKit | solana-agent-kit
Documentation for 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

- Defined in agent/index.ts:85

#####
Index

### Constructors

constructor

### Properties

config
connection
wallet
wallet_address

### Methods

approveMultisigProposal
batchOrder
cancelAllOrders
closePerpTradeLong
closePerpTradeShort
createGibworkTask
createMultisigProposal
createSquadsMultisig
createTiplink
deployCollection
deployToken
depositToMultisig
executeMultisigTransaction
fetchTokenDetailedReport
fetchTokenPrice
fetchTokenReportSummary
flashCloseTrade
flashOpenTrade
getAllDomainsTLDs
getAllRegisteredAllDomains
getBalance
getBalanceOther
getMainAllDomainsDomain
getOwnedAllDomains
getOwnedDomainsForTLD
getPrimaryDomain
getPythPrice
getPythPriceFeedID
getTokenDataByAddress
getTokenDataByTicker
getTPS
launchPumpFunToken
lendAssets
limitOrder
manifestCreateMarket
mintNFT
openbookCreateMarket
openPerpTradeLong
openPerpTradeShort
orcaClosePosition
orcaCreateCLMM
orcaCreateSingleSidedLiquidityPool
orcaFetchPositions
orcaOpenCenteredPositionWithLiquidity
orcaOpenSingleSidedPosition
raydiumCreateAmmV4
raydiumCreateClmm
raydiumCreateCpmm
registerDomain
rejectMultisigProposal
requestFaucetFunds
resolveAllDomains
resolveSolDomain
restake
rockPaperScissors
sendCompressedAirdrop
stake
tensorCancelListing
tensorListNFT
trade
transfer
transferFromMultisig
withdrawAll

##
Constructors

### constructor

- new SolanaAgentKit(
  private_key: string,
  rpc_url: string,
  openai_api_key: null | string,
  ): SolanaAgentKit

- #### Parameters

  - private_key: string
  - rpc_url: string
  - openai_api_key: null | string

  #### Returns SolanaAgentKit

  #### Deprecated

  Using openai_api_key directly in constructor is deprecated. Please use the new constructor with Config object instead:

  #### Example

      const agent = new SolanaAgentKit(privateKey, rpcUrl, {
        OPENAI_API_KEY: 'your-key'
      });

  - Defined in agent/index.ts:99
- new SolanaAgentKit(
  private_key: string,
  rpc_url: string,
  config: Config ,
  ): SolanaAgentKit

- #### Parameters

  - private_key: string
  - rpc_url: string
  - config: Config

  #### Returns SolanaAgentKit

  - Defined in agent/index.ts:104

##
Properties

### config

config: Config

Configuration object

- Defined in agent/index.ts:89

### connection

connection: Connection

Solana RPC connection

- Defined in agent/index.ts:86

### wallet

wallet: Keypair

Wallet keypair for signing transactions

- Defined in agent/index.ts:87

### wallet_address

wallet_address: PublicKey

Public key of the wallet

- Defined in agent/index.ts:88

##
Methods

### batchOrder

- batchOrder(marketId: PublicKey, orders: OrderParams []): Promise<string>

- #### Parameters

  - marketId: PublicKey
  - orders: OrderParams []

  #### Returns Promise<string>

  - Defined in agent/index.ts:202

### cancelAllOrders

- cancelAllOrders(marketId: PublicKey): Promise<string>

- #### Parameters

  - marketId: PublicKey

  #### Returns Promise<string>

  - Defined in agent/index.ts:209

### closePerpTradeLong

- closePerpTradeLong(
  args: Omit<
  { agent: SolanaAgentKit ; price: number; tradeMint: PublicKey },
  "agent",
  >,
  ): Promise<string>

- #### Parameters

  - args: Omit<{ agent: SolanaAgentKit ; price: number; tradeMint: PublicKey }, "agent">

  #### Returns Promise<string>

  - Defined in agent/index.ts:244

### closePerpTradeShort

- closePerpTradeShort(
  args: Omit<
  { agent: SolanaAgentKit ; price: number; tradeMint: PublicKey },
  "agent",
  >,
  ): Promise<string>

- #### Parameters

  - args: Omit<{ agent: SolanaAgentKit ; price: number; tradeMint: PublicKey }, "agent">

  #### Returns Promise<string>

  - Defined in agent/index.ts:235

### createGibworkTask

- createGibworkTask(
  title: string,
  content: string,
  requirements: string,
  tags: string[],
  tokenMintAddress: string,
  tokenAmount: number,
  payer?: string,
  ): Promise< GibworkCreateTaskReponse >

- #### Parameters

  - title: string
  - content: string
  - requirements: string
  - tags: string[]
  - tokenMintAddress: string
  - tokenAmount: number
  - `Optional` payer: string

  #### Returns Promise< GibworkCreateTaskReponse >

  - Defined in agent/index.ts:498

### createTiplink

- createTiplink(
  amount: number,
  splmintAddress?: PublicKey,
  ): Promise<{ signature: string; url: string }>

- #### Parameters

  - amount: number
  - `Optional` splmintAddress: PublicKey

  #### Returns Promise<{ signature: string; url: string }>

  - Defined in agent/index.ts:525

### deployCollection

- deployCollection(options: CollectionOptions ): Promise< CollectionDeployment >

- #### Parameters

  - options: CollectionOptions

  #### Returns Promise< CollectionDeployment >

  - Defined in agent/index.ts:139

### deployToken

- deployToken(
  name: string,
  uri: string,
  symbol: string,
  decimals?: number,
  initialSupply?: number,
  ): Promise<{ mint: PublicKey }>

- #### Parameters

  - name: string
  - uri: string
  - symbol: string
  - decimals: number = DEFAULT_OPTIONS.TOKEN_DECIMALS
  - `Optional` initialSupply: number

  #### Returns Promise<{ mint: PublicKey }>

  - Defined in agent/index.ts:129

### fetchTokenDetailedReport

- fetchTokenDetailedReport(mint: string): Promise< TokenCheck >

- #### Parameters

  - mint: string

  #### Returns Promise< TokenCheck >

  - Defined in agent/index.ts:541

### fetchTokenPrice

- fetchTokenPrice(mint: string): Promise<string>

- #### Parameters

  - mint: string

  #### Returns Promise<string>

  - Defined in agent/index.ts:273

### fetchTokenReportSummary

- fetchTokenReportSummary(mint: string): Promise< TokenCheck >

- #### Parameters

  - mint: string

  #### Returns Promise< TokenCheck >

  - Defined in agent/index.ts:537

### getAllDomainsTLDs

- getAllDomainsTLDs(): Promise<string[]>

- #### Returns Promise<string[]>

  - Defined in agent/index.ts:401

### getAllRegisteredAllDomains

- getAllRegisteredAllDomains(): Promise<string[]>

- #### Returns Promise<string[]>

  - Defined in agent/index.ts:405

### getBalance

- getBalance(token_address?: PublicKey): Promise<number>

- #### Parameters

  - `Optional` token_address: PublicKey

  #### Returns Promise<number>

  - Defined in agent/index.ts:145

### getBalanceOther

- getBalanceOther(
  walletAddress: PublicKey,
  tokenAddress?: PublicKey,
  ): Promise<number>

- #### Parameters

  - walletAddress: PublicKey
  - `Optional` tokenAddress: PublicKey

  #### Returns Promise<number>

  - Defined in agent/index.ts:149

### getMainAllDomainsDomain

- getMainAllDomainsDomain(owner: PublicKey): Promise<null | string>

- #### Parameters

  - owner: PublicKey

  #### Returns Promise<null | string>

  - Defined in agent/index.ts:409

### getOwnedAllDomains

- getOwnedAllDomains(owner: PublicKey): Promise<string[]>

- #### Parameters

  - owner: PublicKey

  #### Returns Promise<string[]>

  - Defined in agent/index.ts:393

### getOwnedDomainsForTLD

- getOwnedDomainsForTLD(tld: string): Promise<string[]>

- #### Parameters

  - tld: string

  #### Returns Promise<string[]>

  - Defined in agent/index.ts:397

### getPrimaryDomain

- getPrimaryDomain(account: PublicKey): Promise<string>

- #### Parameters

  - account: PublicKey

  #### Returns Promise<string>

  - Defined in agent/index.ts:180

### getPythPrice

- getPythPrice(priceFeedID: string): Promise<string>

- #### Parameters

  - priceFeedID: string

  #### Returns Promise<string>

  - Defined in agent/index.ts:494

### getPythPriceFeedID

- getPythPriceFeedID(tokenSymbol: string): Promise<string>

- #### Parameters

  - tokenSymbol: string

  #### Returns Promise<string>

  - Defined in agent/index.ts:490

### getTokenDataByAddress

- getTokenDataByAddress(mint: string): Promise<undefined | JupiterTokenData >

- #### Parameters

  - mint: string

  #### Returns Promise<undefined | JupiterTokenData >

  - Defined in agent/index.ts:261

### getTokenDataByTicker

- getTokenDataByTicker(ticker: string): Promise<undefined | JupiterTokenData >

- #### Parameters

  - ticker: string

  #### Returns Promise<undefined | JupiterTokenData >

  - Defined in agent/index.ts:267

### getTPS

- getTPS(): Promise<number>

- #### Returns Promise<number>

  - Defined in agent/index.ts:257

### launchPumpFunToken

- launchPumpFunToken(
  tokenName: string,
  tokenTicker: string,
  description: string,
  imageUrl: string,
  options?: PumpFunTokenOptions ,
  ): Promise< PumpfunLaunchResponse >

- #### Parameters

  - tokenName: string
  - tokenTicker: string
  - description: string
  - imageUrl: string
  - `Optional` options: PumpFunTokenOptions

  #### Returns Promise< PumpfunLaunchResponse >

  - Defined in agent/index.ts:277

### lendAssets

- lendAssets(amount: number): Promise<string>

- #### Parameters

  - amount: number

  #### Returns Promise<string>

  - Defined in agent/index.ts:253

### limitOrder

- limitOrder(
  marketId: PublicKey,
  quantity: number,
  side: string,
  price: number,
  ): Promise<string>

- #### Parameters

  - marketId: PublicKey
  - quantity: number
  - side: string
  - price: number

  #### Returns Promise<string>

  - Defined in agent/index.ts:193

### manifestCreateMarket

- manifestCreateMarket(
  baseMint: PublicKey,
  quoteMint: PublicKey,
  ): Promise<string[]>

- #### Parameters

  - baseMint: PublicKey
  - quoteMint: PublicKey

  #### Returns Promise<string[]>

  - Defined in agent/index.ts:483

### mintNFT

- mintNFT(
  collectionMint: PublicKey,
  metadata: {
  creators?: { address: string; share: number }[];
  name: string;
  sellerFeeBasisPoints?: number;
  uri: string;
  },
  recipient?: PublicKey,
  ): Promise< MintCollectionNFTResponse >

- #### Parameters

  - collectionMint: PublicKey
  - metadata: {
    creators?: { address: string; share: number }[];
    name: string;
    sellerFeeBasisPoints?: number;
    uri: string;
    }
  - `Optional` recipient: PublicKey

  #### Returns Promise< MintCollectionNFTResponse >

  - Defined in agent/index.ts:156

### openbookCreateMarket

- openbookCreateMarket(
  baseMint: PublicKey,
  quoteMint: PublicKey,
  lotSize?: number,
  tickSize?: number,
  ): Promise<string[]>

- #### Parameters

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

  #### Returns Promise<string[]>

  - Defined in agent/index.ts:467

### openPerpTradeLong

- openPerpTradeLong(
  args: Omit<
  {
  agent: SolanaAgentKit ;
  collateralAmount: number;
  collateralMint?: PublicKey;
  leverage?: number;
  price: number;
  slippage?: number;
  tradeMint?: PublicKey;
  },
  "agent",
  >,
  ): Promise<string>

- #### Parameters

  - args: Omit<
    {
    agent: SolanaAgentKit ;
    collateralAmount: number;
    collateralMint?: PublicKey;
    leverage?: number;
    price: number;
    slippage?: number;
    tradeMint?: PublicKey;
    },
    "agent",
    >

  #### Returns Promise<string>

  - Defined in agent/index.ts:217

### openPerpTradeShort

- openPerpTradeShort(
  args: Omit<
  {
  agent: SolanaAgentKit ;
  collateralAmount: number;
  collateralMint?: PublicKey;
  leverage?: number;
  price: number;
  slippage?: number;
  tradeMint?: PublicKey;
  },
  "agent",
  >,
  ): Promise<string>

- #### Parameters

  - args: Omit<
    {
    agent: SolanaAgentKit ;
    collateralAmount: number;
    collateralMint?: PublicKey;
    leverage?: number;
    price: number;
    slippage?: number;
    tradeMint?: PublicKey;
    },
    "agent",
    >

  #### Returns Promise<string>

  - Defined in agent/index.ts:226

### orcaClosePosition

- orcaClosePosition(positionMintAddress: PublicKey): Promise<string>

- #### Parameters

  - positionMintAddress: PublicKey

  #### Returns Promise<string>

  - Defined in agent/index.ts:321

### orcaCreateCLMM

- orcaCreateCLMM(
  mintDeploy: PublicKey,
  mintPair: PublicKey,
  initialPrice: Decimal,
  feeTier: 1 | 2 | 4 | 5 | 16 | 30 | 65 | 100 | 200,
  ): Promise<string>

- #### Parameters

  - mintDeploy: PublicKey
  - mintPair: PublicKey
  - initialPrice: Decimal
  - feeTier: 1 | 2 | 4 | 5 | 16 | 30 | 65 | 100 | 200

  #### Returns Promise<string>

  - Defined in agent/index.ts:325

### orcaCreateSingleSidedLiquidityPool

- orcaCreateSingleSidedLiquidityPool(
  depositTokenAmount: number,
  depositTokenMint: PublicKey,
  otherTokenMint: PublicKey,
  initialPrice: Decimal,
  maxPrice: Decimal,
  feeTier: 1 | 2 | 4 | 5 | 16 | 30 | 65 | 100 | 200,
  ): Promise<string>

- #### Parameters

  - depositTokenAmount: number
  - depositTokenMint: PublicKey
  - otherTokenMint: PublicKey
  - initialPrice: Decimal
  - maxPrice: Decimal
  - feeTier: 1 | 2 | 4 | 5 | 16 | 30 | 65 | 100 | 200

  #### Returns Promise<string>

  - Defined in agent/index.ts:334

### orcaFetchPositions

- orcaFetchPositions(): Promise<string>

- #### Returns Promise<string>

  - Defined in agent/index.ts:353

### orcaOpenCenteredPositionWithLiquidity

- orcaOpenCenteredPositionWithLiquidity(
  whirlpoolAddress: PublicKey,
  priceOffsetBps: number,
  inputTokenMint: PublicKey,
  inputAmount: Decimal,
  ): Promise<string>

- #### Parameters

  - whirlpoolAddress: PublicKey
  - priceOffsetBps: number
  - inputTokenMint: PublicKey
  - inputAmount: Decimal

  #### Returns Promise<string>

  - Defined in agent/index.ts:357

### orcaOpenSingleSidedPosition

- orcaOpenSingleSidedPosition(
  whirlpoolAddress: PublicKey,
  distanceFromCurrentPriceBps: number,
  widthBps: number,
  inputTokenMint: PublicKey,
  inputAmount: Decimal,
  ): Promise<string>

- #### Parameters

  - whirlpoolAddress: PublicKey
  - distanceFromCurrentPriceBps: number
  - widthBps: number
  - inputTokenMint: PublicKey
  - inputAmount: Decimal

  #### Returns Promise<string>

  - Defined in agent/index.ts:372

### raydiumCreateAmmV4

- raydiumCreateAmmV4(
  marketId: PublicKey,
  baseAmount: BN,
  quoteAmount: BN,
  startTime: BN,
  ): Promise<string>

- #### Parameters

  - marketId: PublicKey
  - baseAmount: BN
  - quoteAmount: BN
  - startTime: BN

  #### Returns Promise<string>

  - Defined in agent/index.ts:413

### raydiumCreateClmm

- raydiumCreateClmm(
  mint1: PublicKey,
  mint2: PublicKey,
  configId: PublicKey,
  initialPrice: Decimal,
  startTime: BN,
  ): Promise<string>

- #### Parameters

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

  #### Returns Promise<string>

  - Defined in agent/index.ts:430

### raydiumCreateCpmm

- raydiumCreateCpmm(
  mint1: PublicKey,
  mint2: PublicKey,
  configId: PublicKey,
  mintAAmount: BN,
  mintBAmount: BN,
  startTime: BN,
  ): Promise<string>

- #### Parameters

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

  #### Returns Promise<string>

  - Defined in agent/index.ts:447

### registerDomain

- registerDomain(name: string, spaceKB?: number): Promise<string>

- #### Parameters

  - name: string
  - `Optional` spaceKB: number

  #### Returns Promise<string>

  - Defined in agent/index.ts:172

### requestFaucetFunds

- requestFaucetFunds(): Promise<string>

- #### Returns Promise<string>

  - Defined in agent/index.ts:125

### resolveAllDomains

- resolveAllDomains(domain: string): Promise<undefined | PublicKey>

- #### Parameters

  - domain: string

  #### Returns Promise<undefined | PublicKey>

  - Defined in agent/index.ts:389

### resolveSolDomain

- resolveSolDomain(domain: string): Promise<PublicKey>

- #### Parameters

  - domain: string

  #### Returns Promise<PublicKey>

  - Defined in agent/index.ts:176

### restake

- restake(amount: number): Promise<string>

- #### Parameters

  - amount: number

  #### Returns Promise<string>

  - Defined in agent/index.ts:298

### rockPaperScissors

- rockPaperScissors(
  amount: number,
  choice: "rock" | "paper" | "scissors",
  ): Promise<string>

- #### Parameters

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

  #### Returns Promise<string>

  - Defined in agent/index.ts:519

### sendCompressedAirdrop

- sendCompressedAirdrop(
  mintAddress: string,
  amount: number,
  decimals: number,
  recipients: string[],
  priorityFeeInLamports: number,
  shouldLog: boolean,
  ): Promise<string[]>

- #### Parameters

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

  #### Returns Promise<string[]>

  - Defined in agent/index.ts:302

### stake

- stake(amount: number): Promise<string>

- #### Parameters

  - amount: number

  #### Returns Promise<string>

  - Defined in agent/index.ts:294

### tensorCancelListing

- tensorCancelListing(nftMint: PublicKey): Promise<string>

- #### Parameters

  - nftMint: PublicKey

  #### Returns Promise<string>

  - Defined in agent/index.ts:533

### tensorListNFT

- tensorListNFT(nftMint: PublicKey, price: number): Promise<string>

- #### Parameters

  - nftMint: PublicKey
  - price: number

  #### Returns Promise<string>

  - Defined in agent/index.ts:529

### trade

- trade(
  outputMint: PublicKey,
  inputAmount: number,
  inputMint?: PublicKey,
  slippageBps?: number,
  ): Promise<string>

- #### Parameters

  - outputMint: PublicKey
  - inputAmount: number
  - `Optional` inputMint: PublicKey
  - slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS

  #### Returns Promise<string>

  - Defined in agent/index.ts:184

### transfer

- transfer(to: PublicKey, amount: number, mint?: PublicKey): Promise<string>

- #### Parameters

  - to: PublicKey
  - amount: number
  - `Optional` mint: PublicKey

  #### Returns Promise<string>

  - Defined in agent/index.ts:164

### withdrawAll

- withdrawAll(marketId: PublicKey): Promise<string>

- #### Parameters

  - marketId: PublicKey

  #### Returns Promise<string>

  - Defined in agent/index.ts:213