File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @near-js/providers " : patch
3+ " near-api-js " : patch
4+ ---
5+
6+ Remove a redundant ` assert ` call in ` @near-js/providers `
Original file line number Diff line number Diff line change @@ -55,7 +55,6 @@ import { Provider } from './provider';
5555import { ConnectionInfo , fetchJsonRpc , retryConfig } from './fetch_json' ;
5656import { TxExecutionStatus } from '@near-js/types' ;
5757import { PublicKey } from '@near-js/crypto' ;
58- import assert from 'assert' ;
5958
6059/** @hidden */
6160// Default number of retries before giving up on a request.
@@ -302,13 +301,11 @@ export class JsonRpcProvider implements Provider {
302301 * - `null`: Current epoch.
303302 */
304303 public async viewValidatorsV2 ( params : { blockId : string | number } | { epochId : string } | null ) : Promise < EpochValidatorInfo > {
305- assert ( typeof params === 'object' ) ;
306-
307304 if ( params === null ) return this . sendJsonRpc ( 'validators' , [ null ] ) ;
308305
309- if ( 'blockId' in params ) return this . sendJsonRpc ( 'validators' , { block_id : params . blockId } ) ;
306+ if ( typeof params === 'object' && 'blockId' in params ) return this . sendJsonRpc ( 'validators' , { block_id : params . blockId } ) ;
310307
311- if ( 'epochId' in params ) return this . sendJsonRpc ( 'validators' , { epoch_id : params . epochId } ) ;
308+ if ( typeof params === 'object' && 'epochId' in params ) return this . sendJsonRpc ( 'validators' , { epoch_id : params . epochId } ) ;
312309
313310 throw new Error ( 'Invalid parameters for validatorsV2' ) ;
314311 }
You can’t perform that action at this time.
0 commit comments