solana-agent-kit / SolanaAgentKit
Class: SolanaAgentKit
Defined in: agent/index.ts:89 Main class for interacting with Solana blockchain Provides a unified interface for token operations, NFT management, trading and more SolanaAgentKitConstructors
new SolanaAgentKit()
new SolanaAgentKit(Defined in: agent/index.ts:103private_key,rpc_url,openai_api_key):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
new SolanaAgentKit()
new SolanaAgentKit(Defined in: agent/index.ts:108private_key,rpc_url,config):SolanaAgentKit
Parameters
private_key
string
rpc_url
string
config
Config
Returns
SolanaAgentKit
Methods
requestFaucetFunds()
requestFaucetFunds():Defined in: agent/index.ts:129Promise<string>
Returns
Promise<string>
deployToken()
deployToken(Defined in: agent/index.ts:133name,uri,symbol,decimals,initialSupply?):Promise<{mint:PublicKey; }>
Parameters
name
string
uri
string
symbol
string
decimals
number = DEFAULT_OPTIONS.TOKEN_DECIMALS
initialSupply?
number
Returns
Promise<{ mint: PublicKey; }>
deployCollection()
deployCollection(Defined in: agent/index.ts:143options):Promise<CollectionDeployment>
Parameters
options
CollectionOptions
Returns
Promise<CollectionDeployment>
getBalance()
getBalance(Defined in: agent/index.ts:149token_address?):Promise<number>
Parameters
token_address?
PublicKey
Returns
Promise<number>
getBalanceOther()
getBalanceOther(Defined in: agent/index.ts:153walletAddress,tokenAddress?):Promise<number>
Parameters
walletAddress
PublicKey
tokenAddress?
PublicKey
Returns
Promise<number>
mintNFT()
mintNFT(Defined in: agent/index.ts:160collectionMint,metadata,recipient?):Promise<MintCollectionNFTResponse>
Parameters
collectionMint
PublicKey
metadata
name
string
uri
string
sellerFeeBasisPoints
number
creators
object[]
recipient?
PublicKey
Returns
Promise<MintCollectionNFTResponse>
transfer()
transfer(Defined in: agent/index.ts:168to,amount,mint?):Promise<string>
Parameters
to
PublicKey
amount
number
mint?
PublicKey
Returns
Promise<string>
registerDomain()
registerDomain(Defined in: agent/index.ts:176name,spaceKB?):Promise<string>
Parameters
name
string
spaceKB?
number
Returns
Promise<string>
resolveSolDomain()
resolveSolDomain(Defined in: agent/index.ts:180domain):Promise<PublicKey>
Parameters
domain
string
Returns
Promise<PublicKey>
getPrimaryDomain()
getPrimaryDomain(Defined in: agent/index.ts:184account):Promise<string>
Parameters
account
PublicKey
Returns
Promise<string>
trade()
trade(Defined in: agent/index.ts:188outputMint,inputAmount,inputMint?,slippageBps?):Promise<string>
Parameters
outputMint
PublicKey
inputAmount
number
inputMint?
PublicKey
slippageBps?
number = DEFAULT_OPTIONS.SLIPPAGE_BPS
Returns
Promise<string>
limitOrder()
limitOrder(Defined in: agent/index.ts:197marketId,quantity,side,price):Promise<string>
Parameters
marketId
PublicKey
quantity
number
side
string
price
number
Returns
Promise<string>
batchOrder()
batchOrder(Defined in: agent/index.ts:206marketId,orders):Promise<string>
Parameters
marketId
PublicKey
orders
OrderParams[]
Returns
Promise<string>
cancelAllOrders()
cancelAllOrders(Defined in: agent/index.ts:213marketId):Promise<string>
Parameters
marketId
PublicKey
Returns
Promise<string>
withdrawAll()
withdrawAll(Defined in: agent/index.ts:217marketId):Promise<string>
Parameters
marketId
PublicKey
Returns
Promise<string>
openPerpTradeLong()
openPerpTradeLong(Defined in: agent/index.ts:221args):Promise<string>
Parameters
args
Omit<{ agent: SolanaAgentKit; price: number; collateralAmount: number; collateralMint: PublicKey; leverage: number; tradeMint: PublicKey; slippage: number; }, "agent">
Returns
Promise<string>
openPerpTradeShort()
openPerpTradeShort(Defined in: agent/index.ts:230args):Promise<string>
Parameters
args
Omit<{ agent: SolanaAgentKit; price: number; collateralAmount: number; collateralMint: PublicKey; leverage: number; tradeMint: PublicKey; slippage: number; }, "agent">
Returns
Promise<string>
closePerpTradeShort()
closePerpTradeShort(Defined in: agent/index.ts:239args):Promise<string>
Parameters
args
Omit<{ agent: SolanaAgentKit; price: number; tradeMint: PublicKey; }, "agent">
Returns
Promise<string>
closePerpTradeLong()
closePerpTradeLong(Defined in: agent/index.ts:248args):Promise<string>
Parameters
args
Omit<{ agent: SolanaAgentKit; price: number; tradeMint: PublicKey; }, "agent">
Returns
Promise<string>
lendAssets()
lendAssets(Defined in: agent/index.ts:257amount):Promise<string>
Parameters
amount
number
Returns
Promise<string>
getTPS()
getTPS():Defined in: agent/index.ts:261Promise<number>
Returns
Promise<number>
getTokenDataByAddress()
getTokenDataByAddress(Defined in: agent/index.ts:265mint):Promise<undefined|JupiterTokenData>
Parameters
mint
string
Returns
Promise<undefined | JupiterTokenData>
getTokenDataByTicker()
getTokenDataByTicker(Defined in: agent/index.ts:271ticker):Promise<undefined|JupiterTokenData>
Parameters
ticker
string
Returns
Promise<undefined | JupiterTokenData>
fetchTokenPrice()
fetchTokenPrice(Defined in: agent/index.ts:277mint):Promise<string>
Parameters
mint
string
Returns
Promise<string>
launchPumpFunToken()
launchPumpFunToken(Defined in: agent/index.ts:281tokenName,tokenTicker,description,imageUrl,options?):Promise<PumpfunLaunchResponse>
Parameters
tokenName
string
tokenTicker
string
description
string
imageUrl
string
options?
PumpFunTokenOptions
Returns
Promise<PumpfunLaunchResponse>
stake()
stake(Defined in: agent/index.ts:298amount):Promise<string>
Parameters
amount
number
Returns
Promise<string>
restake()
restake(Defined in: agent/index.ts:302amount):Promise<string>
Parameters
amount
number
Returns
Promise<string>
sendCompressedAirdrop()
sendCompressedAirdrop(Defined in: agent/index.ts:306mintAddress,amount,decimals,recipients,priorityFeeInLamports,shouldLog):Promise<string[]>
Parameters
mintAddress
string
amount
number
decimals
number
recipients
string[]
priorityFeeInLamports
number
shouldLog
boolean
Returns
Promise<string[]>
orcaClosePosition()
orcaClosePosition(Defined in: agent/index.ts:325positionMintAddress):Promise<string>
Parameters
positionMintAddress
PublicKey
Returns
Promise<string>
orcaCreateCLMM()
orcaCreateCLMM(Defined in: agent/index.ts:329mintDeploy,mintPair,initialPrice,feeTier):Promise<string>
Parameters
mintDeploy
PublicKey
mintPair
PublicKey
initialPrice
Decimal
feeTier
1 | 2 | 4 | 5 | 16 | 30 | 65 | 100 | 200
Returns
Promise<string>
orcaCreateSingleSidedLiquidityPool()
orcaCreateSingleSidedLiquidityPool(Defined in: agent/index.ts:338depositTokenAmount,depositTokenMint,otherTokenMint,initialPrice,maxPrice,feeTier):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>
orcaFetchPositions()
orcaFetchPositions():Defined in: agent/index.ts:357Promise<string>
Returns
Promise<string>
orcaOpenCenteredPositionWithLiquidity()
orcaOpenCenteredPositionWithLiquidity(Defined in: agent/index.ts:361whirlpoolAddress,priceOffsetBps,inputTokenMint,inputAmount):Promise<string>
Parameters
whirlpoolAddress
PublicKey
priceOffsetBps
number
inputTokenMint
PublicKey
inputAmount
Decimal
Returns
Promise<string>
orcaOpenSingleSidedPosition()
orcaOpenSingleSidedPosition(Defined in: agent/index.ts:376whirlpoolAddress,distanceFromCurrentPriceBps,widthBps,inputTokenMint,inputAmount):Promise<string>
Parameters
whirlpoolAddress
PublicKey
distanceFromCurrentPriceBps
number
widthBps
number
inputTokenMint
PublicKey
inputAmount
Decimal
Returns
Promise<string>
resolveAllDomains()
resolveAllDomains(Defined in: agent/index.ts:393domain):Promise<undefined|PublicKey>
Parameters
domain
string
Returns
Promise<undefined | PublicKey>
getOwnedAllDomains()
getOwnedAllDomains(Defined in: agent/index.ts:397owner):Promise<string[]>
Parameters
owner
PublicKey
Returns
Promise<string[]>
getOwnedDomainsForTLD()
getOwnedDomainsForTLD(Defined in: agent/index.ts:401tld):Promise<string[]>
Parameters
tld
string
Returns
Promise<string[]>
getAllDomainsTLDs()
getAllDomainsTLDs():Defined in: agent/index.ts:405Promise<string[]>
Returns
Promise<string[]>
getAllRegisteredAllDomains()
getAllRegisteredAllDomains():Defined in: agent/index.ts:409Promise<string[]>
Returns
Promise<string[]>
getMainAllDomainsDomain()
getMainAllDomainsDomain(Defined in: agent/index.ts:413owner):Promise<null|string>
Parameters
owner
PublicKey
Returns
Promise<null | string>
raydiumCreateAmmV4()
raydiumCreateAmmV4(Defined in: agent/index.ts:417marketId,baseAmount,quoteAmount,startTime):Promise<string>
Parameters
marketId
PublicKey
baseAmount
BN
quoteAmount
BN
startTime
BN
Returns
Promise<string>
raydiumCreateClmm()
raydiumCreateClmm(Defined in: agent/index.ts:434mint1,mint2,configId,initialPrice,startTime):Promise<string>
Parameters
mint1
PublicKey
mint2
PublicKey
configId
PublicKey
initialPrice
Decimal
startTime
BN
Returns
Promise<string>
raydiumCreateCpmm()
raydiumCreateCpmm(Defined in: agent/index.ts:451mint1,mint2,configId,mintAAmount,mintBAmount,startTime):Promise<string>
Parameters
mint1
PublicKey
mint2
PublicKey
configId
PublicKey
mintAAmount
BN
mintBAmount
BN
startTime
BN
Returns
Promise<string>
openbookCreateMarket()
openbookCreateMarket(Defined in: agent/index.ts:471baseMint,quoteMint,lotSize,tickSize):Promise<string[]>
Parameters
baseMint
PublicKey
quoteMint
PublicKey
lotSize
number = 1
tickSize
number = 0.01
Returns
Promise<string[]>
manifestCreateMarket()
manifestCreateMarket(Defined in: agent/index.ts:487baseMint,quoteMint):Promise<string[]>
Parameters
baseMint
PublicKey
quoteMint
PublicKey
Returns
Promise<string[]>
getPythPriceFeedID()
getPythPriceFeedID(Defined in: agent/index.ts:494tokenSymbol):Promise<string>
Parameters
tokenSymbol
string
Returns
Promise<string>
getPythPrice()
getPythPrice(Defined in: agent/index.ts:498priceFeedID):Promise<string>
Parameters
priceFeedID
string
Returns
Promise<string>
createGibworkTask()
createGibworkTask(Defined in: agent/index.ts:502title,content,requirements,tags,tokenMintAddress,tokenAmount,payer?):Promise<GibworkCreateTaskReponse>
Parameters
title
string
content
string
requirements
string
tags
string[]
tokenMintAddress
string
tokenAmount
number
payer?
string
Returns
Promise<GibworkCreateTaskReponse>
rockPaperScissors()
rockPaperScissors(Defined in: agent/index.ts:523amount,choice):Promise<string>
Parameters
amount
number
choice
"rock" | "paper" | "scissors"
Returns
Promise<string>
createTiplink()
createTiplink(Defined in: agent/index.ts:529amount,splmintAddress?):Promise<{url:string;signature:string; }>
Parameters
amount
number
splmintAddress?
PublicKey
Returns
Promise<{ url: string; signature: string; }>
tensorListNFT()
tensorListNFT(Defined in: agent/index.ts:533nftMint,price):Promise<string>
Parameters
nftMint
PublicKey
price
number
Returns
Promise<string>
tensorCancelListing()
tensorCancelListing(Defined in: agent/index.ts:537nftMint):Promise<string>
Parameters
nftMint
PublicKey
Returns
Promise<string>
fetchTokenReportSummary()
fetchTokenReportSummary(Defined in: agent/index.ts:541mint):Promise<TokenCheck>
Parameters
mint
string
Returns
Promise<TokenCheck>
fetchTokenDetailedReport()
fetchTokenDetailedReport(Defined in: agent/index.ts:545mint):Promise<TokenCheck>
Parameters
mint
string
Returns
Promise<TokenCheck>
flashOpenTrade()
flashOpenTrade(Defined in: agent/index.ts:554 Opens a new trading position on Flash.Tradeparams):Promise<string>
Parameters
params
FlashTradeParams
Flash trade parameters including market, side, collateral, leverage, and pool name
Returns
Promise<string>
Transaction signature
flashCloseTrade()
flashCloseTrade(Defined in: agent/index.ts:563 Closes an existing trading position on Flash.Tradeparams):Promise<string>
Parameters
params
FlashCloseTradeParams
Flash trade close parameters
Returns
Promise<string>
Transaction signature
Properties
connection
connection: Connection
Defined in: agent/index.ts:90
Solana RPC connection
wallet
wallet: Keypair
Defined in: agent/index.ts:91
Wallet keypair for signing transactions
wallet_address
wallet_address: PublicKey
Defined in: agent/index.ts:92
Public key of the wallet
config
config: Config
Defined in: agent/index.ts:93
Configuration object