Commit d7001fc
feat(ovsm): Complete aggregation system with pagination and proper function arg orders
## Full Transfer Pagination
- Implemented while loop to fetch ALL transfers (1000 at a time)
- Continues until batch size < 1000 (indicating end of data)
- Handles wallets with any number of transfers
## Token-Grouped Aggregation
- Uses group-by to organize transfers by mint address
- For each token: separates inflows/outflows
- Aggregates amounts by sender (for inflows) and receiver (for outflows)
- Sorts and returns top 5 of each
- Returns ONLY aggregated summaries (no raw transaction data)
## Fixed OVSM Function Argument Orders
**CRITICAL**: OVSM functions have different arg order than typical FP languages!
- `map`: (map collection lambda) NOT (map lambda collection)
- `filter`: (filter collection predicate) NOT (filter predicate collection)
- `reduce`: (reduce collection initial lambda) NOT (reduce lambda initial collection)
- `sort`: (sort collection comparator) NOT (sort comparator collection)
## Fixed Conditional Logic
- OVSM `or` returns boolean, not first truthy value
- Changed from `(or (get acc key) 0)` to `(if (get acc key) (get acc key) 0)`
## Test Results
✅ Fetches all 50 transfers from test wallet
✅ Aggregates into 7 unique tokens with top senders/receivers
✅ Output size: ~7 token summaries vs 50 raw transactions (85% reduction)
✅ Proper amount summation per address
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 010bfdb commit d7001fc
1 file changed
+93
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
158 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
159 | 245 | | |
160 | | - | |
161 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
162 | 249 | | |
163 | 250 | | |
164 | 251 | | |
| |||
0 commit comments