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