@@ -99,6 +99,24 @@ export interface OtsAddressTransactionsPage {
99
99
lastPage : boolean ;
100
100
}
101
101
102
+ /**
103
+ * Trace entry from ots_traceTransaction
104
+ */
105
+ export interface OtsTraceEntry {
106
+ /** Type of operation (CALL, DELEGATECALL, STATICCALL, CREATE, etc.) */
107
+ type : string ;
108
+ /** Call depth in the execution stack */
109
+ depth : number ;
110
+ /** Source address */
111
+ from : string ;
112
+ /** Target address */
113
+ to : string ;
114
+ /** Value transferred (hex string, null for delegate/static calls) */
115
+ value : string | null ;
116
+ /** Input data for the call */
117
+ input ?: string ;
118
+ }
119
+
102
120
/**
103
121
* Contract creator information
104
122
*/
@@ -212,9 +230,9 @@ export class OtterscanProvider extends JsonRpcProvider {
212
230
/**
213
231
* Get execution trace for a transaction
214
232
* @param txHash - Transaction hash
215
- * @returns Trace data
233
+ * @returns Array of trace entries showing call execution flow
216
234
*/
217
- async traceTransaction ( txHash : string ) : Promise < any > {
235
+ async traceTransaction ( txHash : string ) : Promise < OtsTraceEntry [ ] > {
218
236
return await this . send ( "ots_traceTransaction" , [ txHash ] ) ;
219
237
}
220
238
@@ -243,7 +261,7 @@ export class OtterscanProvider extends JsonRpcProvider {
243
261
* Removes verbose fields like logs from receipts to save bandwidth
244
262
* @param blockNumber - Block number
245
263
* @param page - Page number (0-based)
246
- * @param pageSize - Number of transactions per page
264
+ * @param pageSize - Soft limit on transactions per page (actual results may exceed this if a block contains more transactions)
247
265
* @returns Page of transactions and receipts (with logs removed)
248
266
*/
249
267
async getBlockTransactions ( blockNumber : number , page : number , pageSize : number ) : Promise < OtsBlockTransactionsPage > {
@@ -255,24 +273,19 @@ export class OtterscanProvider extends JsonRpcProvider {
255
273
* Provides paginated transaction history with in-node search (no external indexer needed)
256
274
* @param address - Address to search for
257
275
* @param blockNumber - Starting block number
258
- * @param pageSize - Maximum results to return
276
+ * @param pageSize - Soft limit on results to return (actual results may exceed this if a block contains more transactions)
259
277
* @returns Page of transactions and receipts
260
278
*/
261
279
async searchTransactionsBefore (
262
280
address : string ,
263
281
blockNumber : number ,
264
282
pageSize : number
265
283
) : Promise < OtsAddressTransactionsPage > {
266
- const result = ( await this . send ( "ots_searchTransactionsBefore" , [ address , blockNumber , pageSize ] ) ) as {
267
- txs : any [ ] ;
268
- receipts : any [ ] ;
269
- firstPage : boolean ;
270
- lastPage : boolean ;
271
- } ;
284
+ const result = await this . send ( "ots_searchTransactionsBefore" , [ address , blockNumber , pageSize ] ) as OtsAddressTransactionsPage ;
272
285
return {
273
286
...result ,
274
- txs : result . txs . map ( ( tx : any ) => formatTransactionResponse ( tx ) ) ,
275
- receipts : result . receipts . map ( ( receipt : any ) => ( {
287
+ txs : result . txs . map ( tx => formatTransactionResponse ( tx ) ) ,
288
+ receipts : result . receipts . map ( receipt => ( {
276
289
...formatTransactionReceipt ( receipt ) ,
277
290
timestamp : receipt . timestamp
278
291
} ) )
@@ -284,24 +297,19 @@ export class OtterscanProvider extends JsonRpcProvider {
284
297
* Provides paginated transaction history with in-node search (no external indexer needed)
285
298
* @param address - Address to search for
286
299
* @param blockNumber - Starting block number
287
- * @param pageSize - Maximum results to return
300
+ * @param pageSize - Soft limit on results to return (actual results may exceed this if a block contains more transactions)
288
301
* @returns Page of transactions and receipts
289
302
*/
290
303
async searchTransactionsAfter (
291
304
address : string ,
292
305
blockNumber : number ,
293
306
pageSize : number
294
307
) : Promise < OtsAddressTransactionsPage > {
295
- const result = ( await this . send ( "ots_searchTransactionsAfter" , [ address , blockNumber , pageSize ] ) ) as {
296
- txs : any [ ] ;
297
- receipts : any [ ] ;
298
- firstPage : boolean ;
299
- lastPage : boolean ;
300
- } ;
308
+ const result = await this . send ( "ots_searchTransactionsAfter" , [ address , blockNumber , pageSize ] ) as OtsAddressTransactionsPage ;
301
309
return {
302
310
...result ,
303
- txs : result . txs . map ( ( tx : any ) => formatTransactionResponse ( tx ) ) ,
304
- receipts : result . receipts . map ( ( receipt : any ) => ( {
311
+ txs : result . txs . map ( tx => formatTransactionResponse ( tx ) ) ,
312
+ receipts : result . receipts . map ( receipt => ( {
305
313
...formatTransactionReceipt ( receipt ) ,
306
314
timestamp : receipt . timestamp
307
315
} ) )
@@ -353,7 +361,7 @@ export class OtterscanProvider extends JsonRpcProvider {
353
361
* @param address - Address to search
354
362
* @param direction - Search direction ("before" or "after")
355
363
* @param startBlock - Starting block number
356
- * @param pageSize - Results per page (default: 500)
364
+ * @param pageSize - Soft limit on results per page (default: 500, actual results may exceed this if a block contains more transactions )
357
365
* @yields Object with tx and receipt for each transaction
358
366
*/
359
367
async * iterateAddressHistory (
@@ -379,7 +387,7 @@ export class OtterscanProvider extends JsonRpcProvider {
379
387
}
380
388
381
389
// Check if we've reached the end
382
- if ( page . lastPage ) break ;
390
+ if ( direction === "before" ? page . lastPage : page . firstPage ) break ;
383
391
384
392
// Update block cursor for next iteration
385
393
const lastTx = page . txs [ page . txs . length - 1 ] ;
0 commit comments