swapSubscribe
Subscribe to receive notifications when a new transaction containing a swap is confirmed on the solana chain that alters the price of any Supported pair with wrapped sol.
Notifications may arrive out of order.
It uses commitment
level confirmed which allows for a fast response
time with reasonable confidence on being included in the blockchain. See more about commitment levels here
Please note: Although unlikely, some events may be missed due to transient network issues or a swap on chain not following the conventional format.
Subscriptions to swaps are limited to 1 per connection.
Try it out in the ConsoleDISCLAIMER: We cannot guarantee 100% accuracy and/or delivery of the data. Please do your own checks. SolanaStreaming is not responsible for any misuse or financial losses as a result of using this data.
Request Parameters
All parameters can also be updated at a later time using the updateSubscriptionParams method.
-
include
includeFilterObject
An include filter object. Depending on your subscription level, this may be required.
At least one of the sub fields in includeFilterObject is required when supplying this filter.
This filter operates as an "OR" filter. This means if you supply more than one param in this filter, e.g. you supply two accounts, it will return the data matching for either account.
includeFilterObject
-
ammAccount (optional)
array(string)
Case Sensitive
An array of strings containing base58 encoded accounts. This is the account of the automated market maker. This is the same as the dexscreener pair address. -
walletAccount (optional)
array(string)
Case Sensitive
An array of strings containing base58 encoded accounts. This is the account of the swap beneficiary. This is useful if you want to follow a wallets swap activities. -
baseTokenMint (optional)
array(string)
Case Sensitive
Use caution with this filter as pools with little liquidity can drastically impact the quotePrice of the swap. This filter tracks the token across any liquidity pool. It is reccomended to use ammAccount instead.An array of strings containing base58 encoded accounts. These are the mints of the tokens you want to filter by. -
sourceExchange (optional)
array(string)
Case Sensitive
An array of exchange names to filter by. Supported values:raydium,pumpswap,pumpfun,raydium_launchlab, andmeteora. -
usdValue (optional)
number
The minimum USD value of the swap that caused the price to change. Some legacy plans require a minimum value of 10,000 USD; the minimum depends on your subscription plan. This can be useful for discovering whale transactions.
Response Fields
-
subscription_id
unsigned integer
The subscription id which can be used to unsubscribe and associate websocket messages with the subscription.
Request Examples
Subscribe to all swaps for a set of trading pairs.
{
"jsonrpc": "2.0",
"id": 1,
"method": "swapSubscribe",
"params": {
"include": {
"ammAccount": [
"58fzJMbX5PatnfJPqWWsqkVFPRKptkbb5r2vCw4Qq3z9",
"F59abNFXebqyMioXWgM4mXMw896wNtP9d4gSe4yo5wx3"
]
}
}
}
Subscribe to swaps on selected exchanges.
{
"jsonrpc": "2.0",
"id": 1,
"method": "swapSubscribe",
"params": {
"include": {
"sourceExchange": ["raydium", "pumpfun"]
}
}
}
Subscribe to all swaps for a certian wallet account.
{
"jsonrpc": "2.0",
"id": 1,
"method": "swapSubscribe",
"params": {
"include": {
"walletAccount": [
"E1wid5KyTfkzxWDUmhxhJTKZqVRR4N6kyuTLXB5bPiU"
]
}
}
}
Subscribe to all swaps where the value is higher than 10,000 USD.
{
"jsonrpc": "2.0",
"id": 1,
"method": "swapSubscribe",
"params": {
"include": {
"usdValue": 10000
}
}
}
Response Example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"subscription_id": 1
}
}
swapNotification
These are the notifications you will receive when swapSubscribe is called successfully. Notifications do not typically conform to jsonrpc.
Notification Fields
-
subscription_id
unsigned integer
The subscription id which was returned when creating the subscription. This can be used to unsubscribe with the newPairUnsubscribe method. -
method
string
The name of the notification. -
params
newSwapObject
newSwapObject
-
slot
unsigned integer
The slot of the transaction that created the new pair. -
signature
string
The signature of the transaction that created the new pair. -
blockTime
unsigned integer
The time the block was confirmed in the unix seconds timestamp format. This will match the blocktime in solscan. -
swap
swapObject
swapObject
-
sourceExchange
string
The name of the exchange the pair is located.
Supported values:raydium,pumpswap,pumpfun,meteora -
ammAccount
string
The account of the amm. This is the same as the dexscreener pair address. For Pumpfun tokens, this is thebondingCurveaccount. -
baseTokenMint
string
The mint of the base token in the pair as a base58 string. -
quoteTokenMint
string
The mint of the quote token in the pair as a base58 string. This is normally wsol. For Pumpfun tokens, this is populated as wSol for consistency. Pumpfun uses SOL but has the same price. -
walletAccount
string
The account that receives the result of the swap that isnt the amm as a base58 string. -
quotePrice
string
This is the price paid by this transaction represented in the quoteToken which means the price is often in wSol (execution price). This field is calculated as the quoteAmount divided by the baseAmount. This does not take into account any fees.
This is a float encoded as a string as some tokens can have very small prices that are not typically represented as a float. It can take the form of an e notation, e.g.4.665456971e-06which equates to0.000004665456971. If a price cannot be calculated due to a 0 amount or other error, the field will be"". -
usdValue
float64 | null
The approximate USD value of the swap that caused the price to change. Null if it could not be calculated. -
baseAmount
string
The raw amount of baseTokenMint that was swapped. -
swapType
enum
From the perspective of the walletAccount, whether they were buying baseTokenMint or selling it. Supported values:buy,sell -
quoteTokenLiquidity Beta
string
This field is in beta testing which means it is subject to change. The raw amount of quoteToken in the liquidity pool after the swap. This field is not always available and can be an empty string for concentrated liquidity pools. When the swap involves a launch token/pool, the field represents the real quote or SOL reserves rather than the virtual reserves. This field reflects the value at the end of the transaction, regardless of how many swaps executed within the transaction.
Notification Example
{
"slot": 315256016,
"signature": "2BpJTsumysXzfX7BZS8u3o8xaZUdov3QGSijfB9asBfWowsRuvGwFY88FqaeWZzbywHobTE5uvDPzcV4LnaGdAbX",
"blockTime": 1737393555,
"swap": {
"ammAccount": "CDHWtKhraDWyp57B2bp7DM5DwHGiyRD8f6n5sKKR7VWo",
"baseTokenMint": "BwyMeGp9kqCQ7zYn1mEj5REkMFKZhRRHfCEJ8eqcmoon",
"quoteTokenMint": "So11111111111111111111111111111111111111112",
"walletAccount": "5S2fWgsbzqTTGVkUUrk83iH17h9T8C5ojYxhrDUWbg6L",
"quotePrice": "4.665456971e-06",
"usdValue": 466.04,
"baseAmount": "398674773250",
"swapType": "buy"
}
}