@@ -99,6 +99,24 @@ export interface OtsAddressTransactionsPage {
9999 lastPage : boolean ;
100100}
101101
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+
102120/**
103121 * Contract creator information
104122 */
@@ -212,9 +230,9 @@ export class OtterscanProvider extends JsonRpcProvider {
212230 /**
213231 * Get execution trace for a transaction
214232 * @param txHash - Transaction hash
215- * @returns Trace data
233+ * @returns Array of trace entries showing call execution flow
216234 */
217- async traceTransaction ( txHash : string ) : Promise < any > {
235+ async traceTransaction ( txHash : string ) : Promise < OtsTraceEntry [ ] > {
218236 return await this . send ( "ots_traceTransaction" , [ txHash ] ) ;
219237 }
220238
@@ -243,7 +261,7 @@ export class OtterscanProvider extends JsonRpcProvider {
243261 * Removes verbose fields like logs from receipts to save bandwidth
244262 * @param blockNumber - Block number
245263 * @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)
247265 * @returns Page of transactions and receipts (with logs removed)
248266 */
249267 async getBlockTransactions ( blockNumber : number , page : number , pageSize : number ) : Promise < OtsBlockTransactionsPage > {
@@ -255,24 +273,19 @@ export class OtterscanProvider extends JsonRpcProvider {
255273 * Provides paginated transaction history with in-node search (no external indexer needed)
256274 * @param address - Address to search for
257275 * @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)
259277 * @returns Page of transactions and receipts
260278 */
261279 async searchTransactionsBefore (
262280 address : string ,
263281 blockNumber : number ,
264282 pageSize : number
265283 ) : 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 ;
272285 return {
273286 ...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 => ( {
276289 ...formatTransactionReceipt ( receipt ) ,
277290 timestamp : receipt . timestamp
278291 } ) )
@@ -284,24 +297,19 @@ export class OtterscanProvider extends JsonRpcProvider {
284297 * Provides paginated transaction history with in-node search (no external indexer needed)
285298 * @param address - Address to search for
286299 * @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)
288301 * @returns Page of transactions and receipts
289302 */
290303 async searchTransactionsAfter (
291304 address : string ,
292305 blockNumber : number ,
293306 pageSize : number
294307 ) : 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 ;
301309 return {
302310 ...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 => ( {
305313 ...formatTransactionReceipt ( receipt ) ,
306314 timestamp : receipt . timestamp
307315 } ) )
@@ -353,7 +361,7 @@ export class OtterscanProvider extends JsonRpcProvider {
353361 * @param address - Address to search
354362 * @param direction - Search direction ("before" or "after")
355363 * @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 )
357365 * @yields Object with tx and receipt for each transaction
358366 */
359367 async * iterateAddressHistory (
@@ -379,7 +387,7 @@ export class OtterscanProvider extends JsonRpcProvider {
379387 }
380388
381389 // Check if we've reached the end
382- if ( page . lastPage ) break ;
390+ if ( direction === "before" ? page . lastPage : page . firstPage ) break ;
383391
384392 // Update block cursor for next iteration
385393 const lastTx = page . txs [ page . txs . length - 1 ] ;
0 commit comments