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
79b3cf2a
Commit
79b3cf2a
authored
Apr 09, 2019
by
Grandschtroumpf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `Udapp` instead of `TxListener`
parent
2e4b793a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
44 deletions
+26
-44
app.js
src/app.js
+12
-19
txlistener-module.js
src/app/tabs/txlistener-module.js
+0
-21
universal-dapp.js
src/universal-dapp.js
+14
-4
No files found.
src/app.js
View file @
79b3cf2a
...
...
@@ -55,7 +55,6 @@ import { RemixAppManager } from './remixAppManager'
import
{
LandingPage
}
from
'./app/ui/landing-page/landing-page'
import
framingService
from
'./framingService'
import
{
BaseApi
}
from
'remix-plugin'
import
{
TxListenerModule
}
from
'./app/tabs/txlistener-module'
import
{
ThemeModule
}
from
'./app/tabs/theme-module'
var
css
=
csjs
`
...
...
@@ -327,7 +326,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry
.
put
({
api
:
self
.
_components
.
compilersArtefacts
,
name
:
'compilersartefacts'
})
// ----------------- UniversalDApp -----------------
var
udapp
=
new
UniversalDApp
(
registry
)
const
udapp
=
new
UniversalDApp
(
registry
)
// TODO: to remove when possible
registry
.
put
({
api
:
udapp
,
name
:
'udapp'
})
udapp
.
event
.
register
(
'transactionBroadcasted'
,
(
txhash
,
networkName
)
=>
{
...
...
@@ -335,14 +334,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
if
(
txLink
)
registry
.
get
(
'logCallback'
).
api
.
logCallback
(
yo
`<a href="
${
txLink
}
" target="_blank">
${
txLink
}
</a>`
)
})
var
udappUI
=
new
UniversalDAppUI
(
udapp
,
registry
)
const
udappUI
=
new
UniversalDAppUI
(
udapp
,
registry
)
// TODO: to remove when possible
registry
.
put
({
api
:
udappUI
,
name
:
'udappUI'
})
// ----------------- Tx listener -----------------
var
transactionReceiptResolver
=
new
TransactionReceiptResolver
()
const
transactionReceiptResolver
=
new
TransactionReceiptResolver
()
var
txlistener
=
new
Txlistener
({
const
txlistener
=
new
Txlistener
({
api
:
{
contracts
:
function
()
{
if
(
self
.
_components
.
compilersArtefacts
[
'__last'
])
return
self
.
_components
.
compilersArtefacts
[
'__last'
].
getContracts
()
...
...
@@ -357,7 +356,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}})
registry
.
put
({
api
:
txlistener
,
name
:
'txlistener'
})
var
eventsDecoder
=
new
EventsDecoder
({
const
eventsDecoder
=
new
EventsDecoder
({
api
:
{
resolveReceipt
:
function
(
tx
,
cb
)
{
transactionReceiptResolver
.
resolve
(
tx
,
cb
)
...
...
@@ -366,11 +365,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
})
registry
.
put
({
api
:
eventsDecoder
,
name
:
'eventsdecoder'
})
/*
that proxy is used by appManager to broadcast new transaction event
*/
const
txListenerModule
=
new
TxListenerModule
(
txlistener
)
txlistener
.
startListening
()
// TODO: There are still a lot of dep between editorpanel and filemanager
...
...
@@ -383,7 +377,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// ----------------- file manager ----------------------------
self
.
_components
.
fileManager
=
new
FileManager
()
var
fileManager
=
self
.
_components
.
fileManager
const
fileManager
=
self
.
_components
.
fileManager
registry
.
put
({
api
:
fileManager
,
name
:
'filemanager'
})
// ----------------- theme module ----------------------------
...
...
@@ -395,7 +389,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry
.
put
({
api
:
self
.
_components
.
editorpanel
,
name
:
'editorpanel'
})
// ----------------- Renderer -----------------
var
renderer
=
new
Renderer
()
const
renderer
=
new
Renderer
()
registry
.
put
({
api
:
renderer
,
name
:
'renderer'
})
// ----------------- app manager ----------------------------
...
...
@@ -472,7 +466,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
udapp
.
api
(),
fileManager
.
api
(),
sourceHighlighters
.
api
(),
txListenerModule
.
api
(),
filePanel
.
api
(),
// { profile: support.profile(), api: support },
settings
.
api
(),
...
...
@@ -494,8 +487,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// The event listener needs to be registered as early as possible, because the
// parent will send the message upon the "load" event.
var
filesToLoad
=
null
var
loadFilesCallback
=
function
(
files
)
{
filesToLoad
=
files
}
// will be replaced later
let
filesToLoad
=
null
const
loadFilesCallback
=
function
(
files
)
{
filesToLoad
=
files
}
// will be replaced later
window
.
addEventListener
(
'message'
,
function
(
ev
)
{
if
(
typeof
ev
.
data
===
typeof
[]
&&
ev
.
data
[
0
]
===
'loadFiles'
)
{
...
...
@@ -513,7 +506,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
self
.
loadFiles
(
filesToLoad
)
}
var
txLogger
=
new
TxLogger
()
// eslint-disable-line
const
txLogger
=
new
TxLogger
()
// eslint-disable-line
txLogger
.
event
.
register
(
'debuggingRequested'
,
(
hash
)
=>
{
if
(
!
appStore
.
isActive
(
'debugger'
))
appManager
.
activateOne
(
'debugger'
)
debug
.
debugger
().
debug
(
hash
)
...
...
@@ -545,9 +538,9 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}
udapp
.
resetAPI
(
transactionContextAPI
)
var
queryParams
=
new
QueryParams
()
const
queryParams
=
new
QueryParams
()
var
loadingFromGist
=
self
.
loadFromGist
(
queryParams
.
get
())
const
loadingFromGist
=
self
.
loadFromGist
(
queryParams
.
get
())
if
(
!
loadingFromGist
)
{
// insert ballot contract if there are no files to show
self
.
_components
.
filesProviders
[
'browser'
].
resolveDirectory
(
'browser'
,
(
error
,
filesList
)
=>
{
...
...
src/app/tabs/txlistener-module.js
deleted
100644 → 0
View file @
2e4b793a
import
{
BaseApi
}
from
'remix-plugin'
import
{
EventEmitter
}
from
'events'
const
profile
=
{
name
:
'txListener'
,
displayName
:
'transaction listener'
,
events
:
[
'newTransaction'
],
description
:
'service - notify new transactions'
,
permission
:
true
}
export
class
TxListenerModule
extends
BaseApi
{
constructor
(
txlistener
)
{
super
(
profile
)
this
.
events
=
new
EventEmitter
()
txlistener
.
event
.
register
(
'newTransaction'
,
(
tx
)
=>
{
this
.
events
.
emit
(
'newTransaction'
,
tx
)
})
}
}
src/universal-dapp.js
View file @
79b3cf2a
...
...
@@ -8,22 +8,32 @@ var txHelper = remixLib.execution.txHelper
var
EventManager
=
remixLib
.
EventManager
var
executionContext
=
remixLib
.
execution
.
executionContext
import
{
UdappApi
}
from
'remix-plugin'
import
{
EventEmitter
}
from
'events'
;
const
profile
=
{
name
:
'udapp'
,
displayName
:
'universal dapp'
,
methods
:
[
'runTestTx'
,
'getAccounts'
,
'createVMAccount'
],
description
:
'service - run transaction and access account'
events
:
[
'newTransaction'
],
methods
:
[
'sendTransaction'
,
'getAccounts'
,
'createVMAccount'
],
description
:
'service - run transaction and access account'
,
permission
:
true
}
module
.
exports
=
class
UniversalDApp
extends
UdappApi
{
constructor
(
registry
)
{
super
(
profile
)
this
.
events
=
new
EventEmitter
()
this
.
event
=
new
EventManager
()
this
.
_deps
=
{
config
:
registry
.
get
(
'config'
).
api
config
:
registry
.
get
(
'config'
).
api
,
txlistener
:
registry
.
get
(
'txlistener'
).
api
}
this
.
_deps
.
txlistener
.
event
.
register
(
'newTransaction'
,
(
tx
)
=>
{
this
.
events
.
emit
(
'newTransaction'
,
tx
)
})
this
.
_txRunnerAPI
=
{
config
:
this
.
_deps
.
config
,
detectNetwork
:
(
cb
)
=>
{
...
...
@@ -240,7 +250,7 @@ module.exports = class UniversalDApp extends UdappApi {
*
* @param {Object} tx - transaction.
*/
runTestTx
(
tx
)
{
sendTransaction
(
tx
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
if
(
error
)
return
reject
(
error
)
...
...
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