Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
c7799a18
Commit
c7799a18
authored
May 25, 2021
by
aniket-engg
Committed by
Aniket
May 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin code segregation
parent
bbd645de
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
hardhat-provider.js
apps/remix-ide/src/app/tabs/hardhat-provider.js
+27
-10
settings.js
apps/remix-ide/src/app/tabs/runTab/settings.js
+1
-18
execution-context.js
apps/remix-ide/src/blockchain/execution-context.js
+1
-1
No files found.
apps/remix-ide/src/app/tabs/hardhat-provider.js
View file @
c7799a18
import
*
as
packageJson
from
'../../../../../package.json'
import
*
as
packageJson
from
'../../../../../package.json'
import
{
Plugin
}
from
'@remixproject/engine'
import
{
Plugin
}
from
'@remixproject/engine'
import
Web3
from
'web3'
const
yo
=
require
(
'yo-yo'
)
const
modalDialogCustom
=
require
(
'../ui/modal-dialog-custom'
)
const
profile
=
{
const
profile
=
{
name
:
'hardhat-provider'
,
name
:
'hardhat-provider'
,
...
@@ -13,20 +16,34 @@ const profile = {
...
@@ -13,20 +16,34 @@ const profile = {
export
default
class
HardhatProvider
extends
Plugin
{
export
default
class
HardhatProvider
extends
Plugin
{
constructor
(
blockchain
)
{
constructor
(
blockchain
)
{
super
(
profile
)
super
(
profile
)
this
.
provider
=
null
this
.
blockchain
=
blockchain
this
.
blockchain
=
blockchain
}
}
hardhatProviderDialogBody
()
{
return
yo
`
<div class="">
Hardhat JSON-RPC Endpoint
</div>
`
}
sendAsync
(
data
)
{
sendAsync
(
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
modalDialogCustom
.
prompt
(
'Hardhat node request'
,
this
.
hardhatProviderDialogBody
(),
'http://127.0.0.1:8545'
,
(
target
)
=>
{
const
provider
=
this
.
blockchain
.
web3
().
currentProvider
this
.
blockchain
.
setProviderFromEndpoint
(
target
,
'Hardhat Provider'
,
(
alertMsg
)
=>
{
if
(
provider
)
{
console
.
log
(
'target-->'
,
target
)
provider
[
provider
.
sendAsync
?
'sendAsync'
:
'send'
](
data
,
(
error
,
message
)
=>
{
this
.
provider
=
new
Web3
.
providers
.
HttpProvider
(
target
)
if
(
error
)
return
reject
(
error
)
return
new
Promise
((
resolve
,
reject
)
=>
{
resolve
(
message
)
if
(
this
.
provider
)
{
})
this
.
provider
[
this
.
provider
.
sendAsync
?
'sendAsync'
:
'send'
](
data
,
(
error
,
message
)
=>
{
}
else
{
if
(
error
)
return
reject
(
error
)
resolve
({
jsonrpc
:
'2.0'
,
result
:
[],
id
:
data
.
id
})
resolve
(
message
)
}
})
}
else
{
resolve
({
jsonrpc
:
'2.0'
,
result
:
[],
id
:
data
.
id
})
}
})
})
})
})
}
}
}
}
...
...
apps/remix-ide/src/app/tabs/runTab/settings.js
View file @
c7799a18
...
@@ -245,16 +245,7 @@ class SettingsUI {
...
@@ -245,16 +245,7 @@ class SettingsUI {
setExecutionContext
(
context
)
{
setExecutionContext
(
context
)
{
if
(
context
===
'Hardhat Provider'
)
{
if
(
context
===
'Hardhat Provider'
)
{
this
.
blockchain
.
changeExecutionContext
(
context
,
()
=>
{
this
.
blockchain
.
changeExecutionContext
(
context
)
modalDialogCustom
.
prompt
(
'Hardhat node request'
,
this
.
hardhatProviderDialogBody
(),
'http://127.0.0.1:8545'
,
(
target
)
=>
{
this
.
blockchain
.
setProviderFromEndpoint
(
target
,
context
,
(
alertMsg
)
=>
{
if
(
alertMsg
)
addTooltip
(
alertMsg
)
this
.
setFinalContext
()
})
},
this
.
setFinalContext
.
bind
(
this
))
},
(
alertMsg
)
=>
{
addTooltip
(
alertMsg
)
},
this
.
setFinalContext
.
bind
(
this
))
}
else
{
}
else
{
this
.
blockchain
.
changeExecutionContext
(
context
,
()
=>
{
this
.
blockchain
.
changeExecutionContext
(
context
,
()
=>
{
modalDialogCustom
.
prompt
(
'External node request'
,
this
.
web3ProviderDialogBody
(),
'http://127.0.0.1:8545'
,
(
target
)
=>
{
modalDialogCustom
.
prompt
(
'External node request'
,
this
.
web3ProviderDialogBody
(),
'http://127.0.0.1:8545'
,
(
target
)
=>
{
...
@@ -291,14 +282,6 @@ class SettingsUI {
...
@@ -291,14 +282,6 @@ class SettingsUI {
`
`
}
}
hardhatProviderDialogBody
()
{
return
yo
`
<div class="">
Hardhat JSON-RPC Endpoint
</div>
`
}
setFinalContext
()
{
setFinalContext
()
{
// set the final context. Cause it is possible that this is not the one we've originaly selected
// set the final context. Cause it is possible that this is not the one we've originaly selected
this
.
selectExEnv
.
value
=
this
.
blockchain
.
getProvider
()
this
.
selectExEnv
.
value
=
this
.
blockchain
.
getProvider
()
...
...
apps/remix-ide/src/blockchain/execution-context.js
View file @
c7799a18
...
@@ -142,7 +142,7 @@ export class ExecutionContext {
...
@@ -142,7 +142,7 @@ export class ExecutionContext {
}
}
}
}
if
(
context
===
'web3'
||
context
===
'Hardhat Provider'
)
{
if
(
context
===
'web3'
)
{
confirmCb
(
cb
)
confirmCb
(
cb
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment