Skip to content

Commit 681ed61

Browse files
authored
Merge pull request #2977 from ethereum/handleconnections
handle connections in plugins
2 parents 42c1add + 9723b79 commit 681ed61

File tree

6 files changed

+49
-0
lines changed

6 files changed

+49
-0
lines changed

apps/remix-ide/src/app/files/foundry-handle.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@ export class FoundryHandle extends WebsocketPlugin {
1515
constructor () {
1616
super(profile)
1717
}
18+
19+
callPluginMethod(key, payload = []) {
20+
if (this.socket.readyState !== this.socket.OPEN) {
21+
console.log(`${this.profile.name} connection is not opened.`)
22+
return false
23+
}
24+
return super.callPluginMethod(key, payload)
25+
}
1826
}

apps/remix-ide/src/app/files/git-handle.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@ export class GitHandle extends WebsocketPlugin {
1515
constructor () {
1616
super(profile)
1717
}
18+
19+
callPluginMethod(key, payload = []) {
20+
if (this.socket.readyState !== this.socket.OPEN) {
21+
console.log(`${this.profile.name} connection is not opened.`)
22+
return false
23+
}
24+
return super.callPluginMethod(key, payload)
25+
}
1826
}

apps/remix-ide/src/app/files/hardhat-handle.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@ export class HardhatHandle extends WebsocketPlugin {
1515
constructor () {
1616
super(profile)
1717
}
18+
19+
callPluginMethod(key, payload = []) {
20+
if (this.socket.readyState !== this.socket.OPEN) {
21+
console.log(`${this.profile.name} connection is not opened.`)
22+
return false
23+
}
24+
return super.callPluginMethod(key, payload)
25+
}
1826
}

apps/remix-ide/src/app/files/slither-handle.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,12 @@ export class SlitherHandle extends WebsocketPlugin {
1616
constructor () {
1717
super(profile)
1818
}
19+
20+
callPluginMethod(key, payload = []) {
21+
if (this.socket.readyState !== this.socket.OPEN) {
22+
console.log(`${this.profile.name} connection is not opened.`)
23+
return false
24+
}
25+
return super.callPluginMethod(key, payload)
26+
}
1927
}

apps/remix-ide/src/app/files/truffle-handle.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,13 @@ export class TruffleHandle extends WebsocketPlugin {
1515
constructor () {
1616
super(profile)
1717
}
18+
19+
callPluginMethod(key, payload = []) {
20+
if (this.socket.readyState !== this.socket.OPEN) {
21+
console.log(`${this.profile.name} connection is not opened.`)
22+
return false
23+
}
24+
return super.callPluginMethod(key, payload)
25+
}
26+
1827
}

apps/remix-ide/src/app/plugins/remixd-handle.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ export class RemixdHandle extends WebsocketPlugin {
7171

7272
}
7373

74+
async callPluginMethod(key: string, payload?: any[]) {
75+
if (this.socket.readyState !== this.socket.OPEN) {
76+
console.log(`${this.profile.name} connection is not opened.`)
77+
return false
78+
}
79+
return super.callPluginMethod(key, payload)
80+
}
81+
7482
/**
7583
* connect to localhost if no connection and render the explorer
7684
* disconnect from localhost if connected and remove the explorer

0 commit comments

Comments
 (0)