This repository was archived by the owner on Dec 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { middleware , validators } from '../validation'
2
2
import { addHexPrefix , keccak , toBuffer } from 'ethereumjs-util'
3
3
import { platform } from 'os'
4
+ import { getClientVersion } from '../../util'
4
5
5
6
/**
6
7
* web3_* RPC module
@@ -29,9 +30,7 @@ export class Web3 {
29
30
* client version as the second argument
30
31
*/
31
32
clientVersion ( _params = [ ] , cb : ( err : null , version : string ) => void ) {
32
- const packageVersion = require ( '../../../package.json' ) . version
33
- const { version } = process
34
- const ethJsVersion = `EthereumJS/${ packageVersion } /${ platform ( ) } /node${ version . substring ( 1 ) } `
33
+ const ethJsVersion = getClientVersion ( )
35
34
cb ( null , ethJsVersion )
36
35
}
37
36
Original file line number Diff line number Diff line change 1
1
/**
2
2
* @module util
3
3
*/
4
+ import { platform } from 'os'
5
+ import { version as packageVersion } from '../../package.json'
4
6
5
7
export * from './parse'
6
8
7
9
export function short ( buffer : Buffer ) : string {
8
10
return buffer . toString ( 'hex' ) . slice ( 0 , 8 ) + '...'
9
11
}
12
+
13
+ export function getClientVersion ( ) {
14
+ const { version } = process
15
+ return `EthereumJS/${ packageVersion } /${ platform ( ) } /node${ version . substring ( 1 ) } `
16
+ }
You can’t perform that action at this time.
0 commit comments