Skip to content

Commit 421c175

Browse files
committed
solana token holding period query
1 parent 6cc8a63 commit 421c175

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

docs/Examples/Solana/transfers.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,34 @@ This query calculates the SOL balance of a wallet at a specific block height by
128128
}
129129
```
130130

131+
## Holding Period of a Token by a Wallet
132+
133+
This query calculates how long a wallet has been holding a specific token by looking at the first and last transfer block heights for that token into the wallet. It is useful for analyzing token holding behavior, vesting, or eligibility for airdrops and loyalty programs.
134+
135+
The query returns:
136+
- **first**: minimum block height at which the wallet first received the token
137+
- **last**: maximum block height at which the wallet most recently received the token
138+
- **period**: the difference between `last` and `first` block heights, representing the *holding period in blocks* (you can convert this to time using block timestamps if needed)
139+
140+
Update `receiverAddress` with the target wallet and `currency` with the token mint address you want to analyze.
141+
142+
[Run Query](https://ide.bitquery.io/find-holding-period-of-a-token-on-Solana)
143+
144+
```
145+
query MyQuery {
146+
solana(network: solana) {
147+
transfers(
148+
receiverAddress: {is: "FwTau1HAZcjexdph4xvkLxATcKAabS1F1vPE6Ut3Gem9"}
149+
currency: {is: "6fHw6vUNrvuvjK2oadJm8Qkz152jef6wVDbdK2wNGiDT"}
150+
) {
151+
first:minimum(of: height)
152+
last:maximum(of: height)
153+
period:expression(get:"last-first")
154+
}
155+
}
156+
}
157+
```
158+
131159
## Pumpfun Token Migrations on a specific date
132160

133161
Below API retrieves pump fun token migraions on a specific date.

0 commit comments

Comments
 (0)