Commit 8fd0729 1 parent 20a89c4 commit 8fd0729 Copy full SHA for 8fd0729
File tree 2 files changed +16
-2
lines changed
packages/hardhat-core/src/internal/cli
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
15
15
writeTelemetryConsent ,
16
16
} from "../util/global-dir" ;
17
17
import { getPackageJson } from "../util/packageInfo" ;
18
+ import { HardhatRuntimeEnvironment } from "../../types" ;
18
19
import { confirmTelemetryConsent } from "./prompt" ;
19
20
20
21
const log = debug ( "hardhat:core:analytics" ) ;
@@ -58,6 +59,7 @@ interface TaskHitPayload extends AnalyticsPayload {
58
59
session_id ?: string ;
59
60
scope ?: string ;
60
61
task ?: string ;
62
+ chainId ?: string ;
61
63
} ;
62
64
} > ;
63
65
}
@@ -119,7 +121,8 @@ export class Analytics {
119
121
*/
120
122
public async sendTaskHit (
121
123
scopeName : string | undefined ,
122
- taskName : string
124
+ taskName : string ,
125
+ hre : HardhatRuntimeEnvironment
123
126
) : Promise < [ AbortAnalytics , Promise < void > ] > {
124
127
if ( ! this . _enabled ) {
125
128
return [ ( ) => { } , Promise . resolve ( ) ] ;
@@ -130,9 +133,19 @@ export class Analytics {
130
133
( scopeName === "ignition" && taskName === "deploy" ) ||
131
134
( scopeName === undefined && taskName === "deploy" )
132
135
) {
136
+ let chainId : number | undefined ;
137
+ try {
138
+ chainId = Number (
139
+ await hre . network . provider . request ( {
140
+ method : "eth_chainId" ,
141
+ } )
142
+ ) ;
143
+ } catch { }
144
+
133
145
eventParams = {
134
146
scope : scopeName ,
135
147
task : taskName ,
148
+ chainId : chainId ?. toString ( ) ,
136
149
} ;
137
150
}
138
151
Original file line number Diff line number Diff line change @@ -271,7 +271,8 @@ async function main() {
271
271
272
272
const [ abortAnalytics , hitPromise ] = await analytics . sendTaskHit (
273
273
scopeName ,
274
- taskName
274
+ taskName ,
275
+ env
275
276
) ;
276
277
277
278
let taskArguments : TaskArguments ;
You can’t perform that action at this time.
0 commit comments