Commit 8811920
fix(research): Use cursor-based pagination for fetching ALL transfers
## Problem
- MCP tool has 50 transfer default limit (not 1000)
- `:limit` parameter wasn't being respected
- `:offset` pagination not supported by MCP endpoint
- Only fetching first 50 transfers regardless of pagination attempt
## Root Cause Analysis
MCP server uses **cursor-based pagination**, not offset-based:
- Response includes `nextPageSignature` field
- Next page requires `beforeSignature` parameter with cursor from previous response
- No support for numeric offsets
## Solution
Changed from offset-based to cursor-based pagination:
**Before (broken):**
```lisp
(get_account_transfers {:address addr :limit 1000 :offset 1000})
```
**After (working):**
```lisp
;; First page
(get_account_transfers {:address addr :limit 1000})
;; Get nextPageSignature from response
;; Next pages
(get_account_transfers {:address addr :limit 1000 :beforeSignature cursor})
;; Repeat until nextPageSignature is null
```
## Implementation
- Loop condition: `(while (or is_first_page next_cursor))`
- Dynamically build params based on page (with/without beforeSignature)
- Accumulate all pages: `(set! all_transfers (append all_transfers batch))`
- Continue until `nextPageSignature` is null
## Expected Impact
- Will now fetch ALL wallet transfers (not just first 50)
- Handles wallets with 1000s of transfers via proper pagination
- Aggregation will work on complete dataset
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent d7001fc commit 8811920
2 files changed
+18
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | | - | |
160 | | - | |
| 159 | + | |
| 160 | + | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
165 | 172 | | |
166 | | - | |
167 | 173 | | |
168 | | - | |
| 174 | + | |
169 | 175 | | |
170 | 176 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
175 | 180 | | |
176 | 181 | | |
177 | 182 | | |
| |||
0 commit comments