@@ -267,26 +267,36 @@ declare class EtherscanApi {
267
267
/**
268
268
* Returns Ether balance for a single address
269
269
* @param {string } address Address
270
- * @param {string } [unit=wei] Balance unit
270
+ * @param {object } [options]
271
+ * @param {string } [options.unit=wei] Balance unit
272
+ * @param {string } [options.tag=latest]
271
273
* @returns {Promise<string> }
274
+ * @todo Write test for options
272
275
*/
273
276
getAccountBalance (
274
277
address : string ,
275
- unit ?: keyof UNITS ,
276
- tag ?: string
278
+ options ?: {
279
+ unit ?: keyof UNITS
280
+ tag ?: string
281
+ }
277
282
) : Promise < string >
278
283
279
284
/**
280
285
* Returns Ether balance for multiple addresses in a single call.
281
286
* Up to a maximum of 20 accounts in a single batch.
282
287
* @param {Array<string> } addresses List of addresses
283
- * @param {string } [unit=wei] Balance unit
284
- * @returns {Promise<object> }
288
+ * @param {object } [options]
289
+ * @param {string } [options.unit=wei] Balance unit
290
+ * @param {string } [options.tag=latest]
291
+ * @return {Promise<object> }
292
+ * @todo Write test for options
285
293
*/
286
294
getAccountBalances (
287
295
addresses : string [ ] ,
288
- unit ?: keyof UNITS ,
289
- tag ?: string
296
+ options ?: {
297
+ unit ?: keyof UNITS
298
+ tag ?: string
299
+ }
290
300
) : Promise <
291
301
{
292
302
account : string
@@ -295,43 +305,53 @@ declare class EtherscanApi {
295
305
>
296
306
297
307
/**
298
- * Get a list of 'Normal' transactions by address
299
- * Returns up to a maximum of the last 10000 transactions only
308
+ * Returns a list of 'Normal' transactions by address.
309
+ * Returns up to a maximum of the last 10000 transactions only.
300
310
* @param {string } address Contract address
301
- * @param {string|number } startBlock Starting block number to retrieve results
302
- * @param {string|number } endBlock Ending block number to retrieve results
303
- * @param {number } offset Max records to return
304
- * @param {number } page Page number
305
- * @param {"asc"|"desc" } sort Sort type
311
+ * @param {object } [options]
312
+ * @param {object } [options.startBlock] Starting block number to retrieve
313
+ * results
314
+ * @param {string|number } [options.endBlock] Ending block number to retrieve
315
+ * results
316
+ * @param {number } [options.offset] Max records to return
317
+ * @param {number } [options.page] Page number
318
+ * @param {"asc"|"desc" } [options.sort] Sort type
306
319
* @returns {Promise<object[]> }
307
320
*/
308
321
getTransactions (
309
322
address : string ,
310
- startBlock ?: number ,
311
- endBlock ?: number ,
312
- offset ?: number ,
313
- page ?: number ,
314
- sort ?: 'asc' | 'desc'
323
+ options ?: {
324
+ startBlock ?: number
325
+ endBlock ?: number
326
+ offset ?: number
327
+ page ?: number
328
+ sort ?: 'asc' | 'desc'
329
+ }
315
330
) : Promise < TransactionDescription [ ] >
316
331
317
332
/**
318
- * Returns a list of 'Internal' Transactions by Address
319
- * Returns up to a maximum of the last 10000 transactions only
333
+ * Returns a list of 'Internal' Transactions by Address.
334
+ * Returns up to a maximum of the last 10000 transactions only.
320
335
* @param {string } address Contract address
321
- * @param {string|number } startBlock Starting block number to retrieve results
322
- * @param {string|number } endBlock Ending block number to retrieve results
323
- * @param {string|number } offset Max records to return
324
- * @param {string|number } page Page number
325
- * @param {"asc"|"desc" } sort Sort type
336
+ * @param {object } [options]
337
+ * @param {string|number } [options.startBlock] Starting block number to
338
+ * retrieve results
339
+ * @param {string|number } [options.endBlock] Ending block number to
340
+ * retrieve results
341
+ * @param {string|number } [options.offset] Max records to return
342
+ * @param {string|number } [options.page] Page number
343
+ * @param {"asc"|"desc" } [options.sort] Sort type
326
344
* @returns {Promise<object[]> }
327
345
*/
328
346
getInternalTransactions (
329
347
address : string ,
330
- startBlock ?: number ,
331
- endBlock ?: number ,
332
- offset ?: number ,
333
- page ?: number ,
334
- sort ?: 'asc' | 'desc'
348
+ options ?: {
349
+ startBlock ?: number
350
+ endBlock ?: number
351
+ offset ?: number
352
+ page ?: number
353
+ sort ?: 'asc' | 'desc'
354
+ }
335
355
) : Promise < InternalTransactionDescription [ ] >
336
356
337
357
/**
@@ -346,17 +366,20 @@ declare class EtherscanApi {
346
366
/**
347
367
* List of blocks mined by address
348
368
* @param {string } address Miner address
349
- * @param {"blocks"|"uncles" } type Type of block: blocks (full blocks only)
350
- * or uncles (uncle blocks only)
351
- * @param {number } offset Max records to return
352
- * @param {number } page Page number
369
+ * @param {object } [options]
370
+ * @param {"blocks"|"uncles" } [options.type] Type of block:
371
+ * blocks (full blocks only) or uncles (uncle blocks only)
372
+ * @param {number } [options.offset] Max records to return
373
+ * @param {number } [options.page] Page number
353
374
* @returns {Promise<object[]> }
354
375
*/
355
376
getMinedBlocks (
356
377
address : string ,
357
- type ?: 'blocks' | 'uncles' ,
358
- offset ?: number ,
359
- page ?: number
378
+ options ?: {
379
+ type ?: 'blocks' | 'uncles'
380
+ offset ?: number
381
+ page ?: number
382
+ }
360
383
) : Promise < BlockInfo [ ] >
361
384
362
385
/**
@@ -402,35 +425,42 @@ declare class EtherscanApi {
402
425
/**
403
426
* Returns events logs.
404
427
* The Event Log API was designed to provide an alternative to the native
405
- * eth_getLogs. Topic Operator (opr) choices are either 'and' or 'or' and
406
- * are restricted to the above choices only. For performance and security
428
+ * eth_getLogs. Topic Operator choices are either 'and' or 'or' and are
429
+ * restricted to the above choices only. For performance and security
407
430
* considerations, only the first 1000 results are return.
408
431
* @param {string } address
409
- * @param {number } fromBlock Start block number (integer, NOT hex)
410
- * @param {number|'latest' } toBlock End block number or "latest"
432
+ * @param {object } options
433
+ * @param {number } options.fromBlock Start block number (integer, NOT hex)
434
+ * @param {number|'latest' } options.toBlock End block number or "latest"
411
435
* (earliest and pending is NOT supported yet)
412
- * @param {string } topic0 Topic 0
413
- * @param {"and"|"or" } [topic01operator] Operator between topic0 & topic1
414
- * @param {string } [topic1] Topic 1
415
- * @param {"and"|"or" } [topic12operator] Operator between topic1 & topic2
416
- * @param {string } [topic2] Topic 2
417
- * @param {"and"|"or" } [topic23operator] Operator between topic2 & topic3
418
- * @param {string } [topic3] Topic 3
419
- * @param {"and"|"or" } [topic02operator] Operator between topic0 & topic2
436
+ * @param {string } options.topic0 Topic 0
437
+ * @param {"and"|"or" } [options.topic01operator] Operator between topic0 &
438
+ * topic1
439
+ * @param {string } [options.topic1] Topic 1
440
+ * @param {"and"|"or" } [options.topic12operator] Operator between topic1 &
441
+ * topic2
442
+ * @param {string } [options.topic2] Topic 2
443
+ * @param {"and"|"or" } [options.topic23operator] Operator between topic2 &
444
+ * topic3
445
+ * @param {string } [options.topic3] Topic 3
446
+ * @param {"and"|"or" } [options.topic02operator] Operator between topic0 &
447
+ * topic2
420
448
* @return {Promise<object> }
421
449
*/
422
450
getEventsLogs (
423
451
address : string ,
424
- fromBlock : number ,
425
- toBlock : number | 'latest' ,
426
- topic0 ?: string ,
427
- topic01operator ?: 'and' | 'or' ,
428
- topic1 ?: string ,
429
- topic12operator ?: 'and' | 'or' ,
430
- topic2 ?: string ,
431
- topic23operator ?: 'and' | 'or' ,
432
- topic3 ?: string ,
433
- topic02operator ?: 'and' | 'or'
452
+ options : {
453
+ fromBlock : number
454
+ toBlock : number | 'latest'
455
+ topic0 ?: string
456
+ topic01operator ?: 'and' | 'or'
457
+ topic1 ?: string
458
+ topic12operator ?: 'and' | 'or'
459
+ topic2 ?: string
460
+ topic23operator ?: 'and' | 'or'
461
+ topic3 ?: string
462
+ topic02operator ?: 'and' | 'or'
463
+ }
434
464
) : Promise < EventDescription [ ] >
435
465
436
466
/**
@@ -487,9 +517,14 @@ declare class EtherscanApi {
487
517
/**
488
518
* Returns the number of transactions sent from an address
489
519
* @param {string } address Transaction address
520
+ * @param {object } [options]
521
+ * @param {string } [options.tag=latest]
490
522
* @returns {Promise<number> }
491
523
*/
492
- getTransactionCount ( address : string , tag ?: string ) : Promise < number >
524
+ getTransactionCount (
525
+ address : string ,
526
+ options ?: { tag ?: string }
527
+ ) : Promise < number >
493
528
494
529
/**
495
530
* Creates new message call transaction or a contract creation for signed
@@ -510,46 +545,60 @@ declare class EtherscanApi {
510
545
* the block chain
511
546
* @param {string } to Address to execute from
512
547
* @param {string } data Data to transfer
548
+ * @param {object } [options]
549
+ * @param {string } [options.tag=latest]
513
550
* @returns {Promise<string> }
514
551
*/
515
- call ( to : string , data : string , tag ?: string ) : Promise < string >
552
+ call ( to : string , data : string , options ?: { tag ?: string } ) : Promise < string >
516
553
517
554
/**
518
555
* Returns code at a given address
519
556
* @param {string } address
557
+ * @param {object } [options]
558
+ * @param {string } [options.tag=latest]
520
559
* @returns {Promise<string> }
521
560
*/
522
- getCode ( address : string , tag ?: string ) : Promise < string >
561
+ getCode ( address : string , options ?: { tag ?: string } ) : Promise < string >
523
562
524
563
/**
525
564
* Returns the value from a storage position at a given address.
526
565
* @param {string } address
527
566
* @param {number } position
567
+ * @param {object } [options]
568
+ * @param {string } [options.tag=latest]
528
569
* @returns {Promise<string> }
529
570
*/
530
- getStorageAt ( address : string , position : number , tag ?: string ) : Promise < string >
571
+ getStorageAt (
572
+ address : string ,
573
+ position : number ,
574
+ options ?: { tag ?: string }
575
+ ) : Promise < string >
531
576
532
577
/**
533
578
* Returns the current price per gas (in wei by default)
534
- * @param {string } [unit=wei] Unit of gas
579
+ * @param {object } [options]
580
+ * @param {string } [options.unit=wei] Unit of gas
535
581
* @returns {Promise<string> }
536
582
*/
537
- getGasPrice ( unit ?: keyof UNITS ) : Promise < string >
583
+ getGasPrice ( options ?: { unit ?: keyof UNITS } ) : Promise < string >
538
584
539
585
/**
540
586
* Makes a call or transaction, which won't be added to the blockchain and
541
587
* returns the used gas, which can be used for estimating the used gas
542
- * @param {string } to Address to get code from
543
- * @param {string } value Storage position
544
- * @param {string } gasPrice Gas price in wei
545
- * @param {string } gas
546
- * @returns {Promise<void> }
588
+ * @param {string } toAddress Address to get code from
589
+ * @param {object } options
590
+ * @param {string } options.value Storage position
591
+ * @param {string } options.gasPrice Gas price in wei
592
+ * @param {string } options.gas
593
+ * @return {Promise<void> }
547
594
*/
548
595
estimateGas (
549
- to : string ,
550
- value : string | number ,
551
- gasPrice : string ,
552
- gas : string
596
+ toAddress : string ,
597
+ options : {
598
+ value : string | number
599
+ gasPrice : string
600
+ gas : string
601
+ }
553
602
) : Promise < void >
554
603
555
604
/**
@@ -562,12 +611,17 @@ declare class EtherscanApi {
562
611
/**
563
612
* Returns ERC20-Token account balance by token's contract address
564
613
* @param {string } contractAddress
614
+ * @param {string } address
615
+ * @param {object } [options]
616
+ * @param {object } [options.tag=latest]
565
617
* @returns {Promise<string> }
566
618
*/
567
619
getTokenBalanceByContractAddress (
568
620
contractAddress : string ,
569
- address : string ,
570
- tag ?: string
621
+ options ?: {
622
+ address : string
623
+ tag ?: string
624
+ }
571
625
) : Promise < string >
572
626
573
627
/**
0 commit comments