Skip to content

Commit 230c2ae

Browse files
Merge pull request #32 from Divyn/main
solana token holding period query
2 parents f02061c + 6e3b033 commit 230c2ae

1 file changed

Lines changed: 16 additions & 131 deletions

File tree

docs/Examples/Solana/transfers.md

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

131-
## Historical Pump.fun Token creations on a specific date
131+
## Holding Period of a Token by a Wallet
132132

133-
This query retrieves all pump.fun token creations on a specific date on Solana.
134-
Try the query [here](https://ide.bitquery.io/Historical-pump-fun-created-coins#).
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.
135134

136-
```
137-
{
138-
solana {
139-
transfers(
140-
options: {limit: 100}
141-
date: {is: "2025-11-17"}
142-
parsedActionName: {is: "mintTo"}
143-
callPath: {is: "4-11"}
144-
externalProgramId: {is: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"}
145-
) {
146-
block {
147-
height
148-
timestamp {
149-
iso8601
150-
}
151-
}
152-
instruction {
153-
action {
154-
name
155-
}
156-
callPath
157-
external
158-
externalAction {
159-
name
160-
type
161-
}
162-
program {
163-
name
164-
id
165-
}
166-
externalProgram {
167-
id
168-
name
169-
}
170-
}
171-
currency {
172-
name
173-
symbol
174-
address
175-
}
176-
date {
177-
date
178-
}
179-
amount
180-
sender {
181-
address
182-
mintAccount
183-
type
184-
}
185-
receiver {
186-
address
187-
mintAccount
188-
type
189-
}
190-
transaction {
191-
signature
192-
signer
193-
}
194-
transferType
195-
}
196-
}
197-
}
198-
```
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)
199139

200-
## Historical Pump.fun Token creations by a Dev on a specific date
140+
Update `receiverAddress` with the target wallet and `currency` with the token mint address you want to analyze.
201141

202-
This query retrieves all pump.fun token creations by a Dev on a specific date on Solana.
203-
Try the query [here](https://ide.bitquery.io/Historical-Pumpfun-created-coins-by-creator#).
142+
[Run Query](https://ide.bitquery.io/find-holding-period-of-a-token-on-Solana)
204143

205144
```
206-
{
207-
solana {
145+
query MyQuery {
146+
solana(network: solana) {
208147
transfers(
209-
options:{limit:100}
210-
date: {is: "2025-11-17"}
211-
parsedActionName: {is: "mintTo"}
212-
signer:{
213-
is:"5TaPtQ9DE1YMUfiyLv7CCNx1CEh88nWx3sPmNRz9zL75"
214-
}
215-
callPath:{
216-
is:"4-11"
217-
}
218-
externalProgramId: {is: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"}
148+
receiverAddress: {is: "FwTau1HAZcjexdph4xvkLxATcKAabS1F1vPE6Ut3Gem9"}
149+
currency: {is: "6fHw6vUNrvuvjK2oadJm8Qkz152jef6wVDbdK2wNGiDT"}
219150
) {
220-
block {
221-
height
222-
timestamp {
223-
iso8601
224-
}
225-
}
226-
instruction {
227-
action {
228-
name
229-
}
230-
callPath
231-
external
232-
externalAction {
233-
name
234-
type
235-
}
236-
program {
237-
name
238-
id
239-
}
240-
externalProgram {
241-
id
242-
name
243-
}
244-
}
245-
currency {
246-
name
247-
symbol
248-
address
249-
}
250-
date {
251-
date
252-
}
253-
amount
254-
sender {
255-
address
256-
mintAccount
257-
type
258-
}
259-
receiver {
260-
address
261-
mintAccount
262-
type
263-
}
264-
transaction {
265-
signature
266-
signer
267-
}
268-
transferType
151+
first:minimum(of: height)
152+
last:maximum(of: height)
153+
period:expression(get:"last-first")
269154
}
270155
}
271156
}
272157
```
273158

274-
## Historical Pumpfun Token Migrations on a specific date
159+
## Pumpfun Token Migrations on a specific date
275160

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

0 commit comments

Comments
 (0)