Skip to content

Commit fa1e96e

Browse files
committed
Update jsdoc
1 parent 26e8c04 commit fa1e96e

File tree

1 file changed

+17
-45
lines changed

1 file changed

+17
-45
lines changed

src/EtherscanApi.js

Lines changed: 17 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class EtherscanApi {
2828
* Creates request
2929
* @private
3030
* @param {object} params Query params
31-
* @return {Promise<any>}
31+
* @return {Promise}
3232
*/
3333
_createRequest(params) {
3434
return createRequest(this.host, {
@@ -39,8 +39,7 @@ class EtherscanApi {
3939

4040
/**
4141
* Returns Ether balance for a single address
42-
* @method getAccountBalance
43-
* @param {string} address
42+
* @param {string} address Address
4443
* @param {string} [unit=wei] Balance unit
4544
* @returns {Promise<string>}
4645
*/
@@ -61,10 +60,9 @@ class EtherscanApi {
6160
/**
6261
* Returns Ether balance for multiple addresses in a single call.
6362
* Up to a maximum of 20 accounts in a single batch.
64-
* @method getAccountBalances
65-
* @param {Array<string>} addresses
63+
* @param {Array<string>} addresses List of addresses
6664
* @param {string} [unit=wei] Balance unit
67-
* @return {Promise<object>} Array of "{ account: string; balance: string }[]"
65+
* @return {Promise<object>}
6866
*/
6967
getAccountBalances(addresses, unit = 'wei', tag = 'latest') {
7068
return this._createRequest({
@@ -89,14 +87,13 @@ class EtherscanApi {
8987
/**
9088
* Get a list of 'Normal' transactions by address
9189
* Returns up to a maximum of the last 10000 transactions only
92-
* @method getTransactions
9390
* @param {string} address Contract address
9491
* @param {string|number} startBlock Starting block number to retrieve results
9592
* @param {string|number} endBlock Ending block number to retrieve results
9693
* @param {number} offset Max records to return
9794
* @param {number} page Page number
9895
* @param {"asc"|"desc"} sort Sort type
99-
* @returns {Promise<TransactionDescription[]>}
96+
* @returns {Promise<object[]>}
10097
*/
10198
getTransactions(address, startBlock, endBlock, offset, page, sort) {
10299
return this._createRequest({
@@ -114,14 +111,13 @@ class EtherscanApi {
114111
/**
115112
* Returns a list of 'Internal' Transactions by Address
116113
* Returns up to a maximum of the last 10000 transactions only
117-
* @method getInternalTransactions
118114
* @param {string} address Contract address
119115
* @param {string|number} startBlock Starting block number to retrieve results
120116
* @param {string|number} endBlock Ending block number to retrieve results
121117
* @param {string|number} offset Max records to return
122118
* @param {string|number} page Page number
123119
* @param {"asc"|"desc"} sort Sort type
124-
* @returns {Promise<TransactionDescription[]>}
120+
* @returns {Promise<object[]>}
125121
*/
126122
getInternalTransactions(address, startBlock, endBlock, offset, page, sort) {
127123
return this._createRequest({
@@ -138,9 +134,8 @@ class EtherscanApi {
138134

139135
/**
140136
* Returns a list of 'Internal' Transactions by Address
141-
* @method getInternalTransactionsByHash
142137
* @param txhash Contract address
143-
* @returns {Promise<InternalTransactionDescription[]>}
138+
* @returns {Promise<object[]>}
144139
*/
145140
getInternalTransactionsByHash(txhash) {
146141
return this._createRequest({
@@ -152,13 +147,12 @@ class EtherscanApi {
152147

153148
/**
154149
* List of blocks mined by address
155-
* @method getMinedBlocks
156150
* @param {string} address Miner address
157151
* @param {"blocks"|"uncles"} type Type of block: blocks (full blocks only)
158152
* or uncles (uncle blocks only)
159153
* @param {number} offset Max records to return
160154
* @param {number} page Page number
161-
* @returns {Promise<BlockInfo[]>}
155+
* @returns {Promise<object[]>}
162156
*/
163157
getMinedBlocks(address, type = 'blocks', offset, page) {
164158
return this._createRequest({
@@ -173,9 +167,8 @@ class EtherscanApi {
173167

174168
/**
175169
* Returns Contract ABI
176-
* @method getContractAbi
177170
* @param address
178-
* @returns {Promsie<AbiItemDescription[]>}
171+
* @returns {Promsie<object[]>}
179172
*/
180173
getContractAbi(address) {
181174
return this._createRequest({
@@ -191,7 +184,6 @@ class EtherscanApi {
191184
* Checks contract execution status (if there was an error during contract
192185
* execution). "isError": "0" = Pass, "isError": "1" = Error during contract
193186
* execution
194-
* @method getContractExecutionStatus
195187
* @param {string} txhash Contract address
196188
* @returns {Promise<object>}
197189
*/
@@ -207,7 +199,6 @@ class EtherscanApi {
207199
* Checks transaction receipt status (only applicable for post byzantium fork
208200
* transactions). Status: 0 = Fail, 1 = Pass. Will return null/empty value
209201
* for pre-byzantium fork
210-
* @method getTransactionStatus
211202
* @param {string} txhash Transaction address
212203
* @returns {Promise<object>}
213204
*/
@@ -221,7 +212,6 @@ class EtherscanApi {
221212

222213
/**
223214
* Get block and uncle rewards by block number
224-
* @method getBlockReward
225215
* @param {number} blockNumber The number of the block
226216
*/
227217
getBlockReward(blockNumber) {
@@ -235,10 +225,9 @@ class EtherscanApi {
235225
/**
236226
* Returns events logs.
237227
* The Event Log API was designed to provide an alternative to the native
238-
* eth_getLogs. Topic Operator (opr) choices are either '''and' or 'or' and
228+
* eth_getLogs. Topic Operator (opr) choices are either 'and' or 'or' and
239229
* are restricted to the above choices only. For performance and security
240230
* considerations, only the first 1000 results are return.
241-
* @method getEventsLogs
242231
* @param {string} address
243232
* @param {number} fromBlock Start block number (integer, NOT hex)
244233
* @param {number|'latest'} toBlock End block number or "latest"
@@ -251,6 +240,7 @@ class EtherscanApi {
251240
* @param {"and"|"or"} [topic23operator] Operator between topic2 & topic3
252241
* @param {string} [topic3] Topic 3
253242
* @param {"and"|"or"} [topic02operator] Operator between topic0 & topic2
243+
* @return {Promise<object>}
254244
*/
255245
getEventsLogs(
256246
address,
@@ -283,7 +273,6 @@ class EtherscanApi {
283273

284274
/**
285275
* Returns the number of the most recent block
286-
* @method getRecentBlockNumber
287276
* @returns {Promise<number>}
288277
*/
289278
getRecentBlockNumber() {
@@ -297,9 +286,8 @@ class EtherscanApi {
297286

298287
/**
299288
* Returns information about a block by block number
300-
* @method getBlockByNumber
301289
* @param {number} blockNumber Block number
302-
* @returns {Promise<GethBlockInfo>}
290+
* @returns {Promise<object>}
303291
*/
304292
getBlockByNumber(blockNumber) {
305293
return this._createRequest({
@@ -312,10 +300,9 @@ class EtherscanApi {
312300

313301
/**
314302
* Returns information about a uncle by block number and index
315-
* @method getUncleByBlockNumberAndIndex
316303
* @param {number} blockNumber
317304
* @param {number} [index=0]
318-
* @returns {Promise<GethBlockInfo>}
305+
* @returns {Promise<object>}
319306
*/
320307
getUncleByBlockNumberAndIndex(blockNumber, index = 0) {
321308
return this._createRequest({
@@ -329,7 +316,6 @@ class EtherscanApi {
329316
/**
330317
* Returns the number of transactions in a block from a block matching the
331318
* given block number
332-
* @method getBlockTransactionCount
333319
* @param {number} blockNumber
334320
* @returns {Promise<number>}
335321
*/
@@ -345,9 +331,8 @@ class EtherscanApi {
345331

346332
/**
347333
* Returns the information about a transaction requested by transaction hash
348-
* @method getTransactionByHash
349334
* @param {string} txhash Transaction hash
350-
* @returns {Promise<TransactionDescription>}
335+
* @returns {Promise<object>}
351336
*/
352337
getTransactionByHash(txhash) {
353338
return this._createRequest({
@@ -360,10 +345,9 @@ class EtherscanApi {
360345
/**
361346
* Returns information about a transaction by block number and transaction
362347
* index position
363-
* @method getTransactionByBlockNumberAndIndex
364348
* @param {number} blockNumber
365349
* @param {number} [index=0]
366-
* @returns {Promise<TransactionDescription>}
350+
* @returns {Promise<object>}
367351
*/
368352
getTransactionByBlockNumberAndIndex(blockNumber, index = 0) {
369353
return this._createRequest({
@@ -376,7 +360,6 @@ class EtherscanApi {
376360

377361
/**
378362
* Returns the number of transactions sent from an address
379-
* @method getTransactionCount
380363
* @param {string} address Transaction address
381364
* @returns {Promise<number>}
382365
*/
@@ -394,7 +377,6 @@ class EtherscanApi {
394377
/**
395378
* Creates new message call transaction or a contract creation for signed
396379
* transactions
397-
* @method sendRawTransaction
398380
* @param {string} hex Raw hex encoded transaction that you want to send
399381
*/
400382
sendRawTransaction(hex) {
@@ -407,9 +389,8 @@ class EtherscanApi {
407389

408390
/**
409391
* Returns the receipt of a transaction by transaction hash
410-
* @method getTransactionReceipt
411392
* @param {string} txhash Transaction hash
412-
* @returns {Promise<TransactionReceipt>}
393+
* @returns {Promise<object>}
413394
*/
414395
getTransactionReceipt(txhash) {
415396
return this._createRequest({
@@ -422,7 +403,6 @@ class EtherscanApi {
422403
/**
423404
* Executes a new message call immediately without creating a transaction on
424405
* the block chain
425-
* @method call
426406
* @param {string} to Address to execute from
427407
* @param {string} data Data to transfer
428408
* @returns {Promise<string>}
@@ -439,7 +419,6 @@ class EtherscanApi {
439419

440420
/**
441421
* Returns code at a given address
442-
* @method getCode
443422
* @param {string} address
444423
* @returns {Promise<string>}
445424
*/
@@ -454,7 +433,6 @@ class EtherscanApi {
454433

455434
/**
456435
* Returns the value from a storage position at a given address.
457-
* @method getStorageAt
458436
* @param {string} address
459437
* @param {number} position
460438
* @returns {Promise<string>}
@@ -471,7 +449,6 @@ class EtherscanApi {
471449

472450
/**
473451
* Returns the current price per gas (in wei by default)
474-
* @method getGasPrice
475452
* @param {string} [unit=wei] Unit of gas
476453
* @returns {string}
477454
*/
@@ -496,7 +473,6 @@ class EtherscanApi {
496473
/**
497474
* Makes a call or transaction, which won't be added to the blockchain and
498475
* returns the used gas, which can be used for estimating the used gas
499-
* @method estimateGas
500476
* @param {string} to Address to get code from
501477
* @param {string} value Storage position
502478
* @param {string} gasPrice Gas price in wei
@@ -515,7 +491,6 @@ class EtherscanApi {
515491

516492
/**
517493
* Returns ERC20-Token total supply by contract address
518-
* @method getTokenByContractAddress
519494
* @param {string} contractAddress
520495
* @returns {Promise<string>}
521496
*/
@@ -529,7 +504,6 @@ class EtherscanApi {
529504

530505
/**
531506
* Returns ERC20-Token account balance by token's contract address
532-
* @method getTokenBalanceByContractAddress
533507
* @param {string} contractAddress
534508
* @returns {Promise<string>}
535509
*/
@@ -545,7 +519,6 @@ class EtherscanApi {
545519

546520
/**
547521
* Returns total supply of Ether
548-
* @method getTotalEtherSupply
549522
* @returns {Promise<string>}
550523
*/
551524
getTotalEtherSupply() {
@@ -557,8 +530,7 @@ class EtherscanApi {
557530

558531
/**
559532
* Returns Ether last price
560-
* @method getEtherLastPrice
561-
* @returns {Promise<EtherPrice>}
533+
* @returns {Promise<object>}
562534
*/
563535
getEtherLastPrice() {
564536
return this._createRequest({

0 commit comments

Comments
 (0)