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
04219939
Commit
04219939
authored
Oct 13, 2017
by
serapath
Committed by
yann300
Dec 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UPDATE acount placeholder counter to use address array index
parent
4cb317fd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
run-tab.js
src/app/tabs/run-tab.js
+7
-2
recorder.js
src/recorder.js
+11
-2
universal-dapp.js
src/universal-dapp.js
+6
-2
No files found.
src/app/tabs/run-tab.js
View file @
04219939
...
...
@@ -246,10 +246,15 @@ function updateAccountBalances (container, appAPI) {
------------------------------------------------ */
function
makeRecorder
(
appAPI
,
appEvents
)
{
var
udapp
=
appAPI
.
udapp
()
var
recorder
=
new
Recorder
({
events
:
{
var
recorder
=
new
Recorder
({
events
:
{
udapp
:
appEvents
.
udapp
,
executioncontext
:
executionContext
.
event
}})
},
api
:
{
getAccounts
(
cb
)
{
udapp
.
getAccounts
(
cb
)
}
}
})
var
css
=
csjs
`
.container {
margin-top: 10px;
...
...
src/recorder.js
View file @
04219939
...
...
@@ -11,15 +11,24 @@ class Recorder {
self
.
clearAll
()
})
var
counter
=
0
function
getIndex
(
accounts
,
address
)
{
var
index
accounts
.
forEach
((
addr
,
idx
)
=>
{
if
(
address
===
addr
)
index
=
idx
})
if
(
!
index
)
index
=
(
++
counter
)
return
index
}
self
.
_addressCache
=
{}
opts
.
events
.
udapp
.
register
(
'initiatingTransaction'
,
(
timestamp
,
tx
)
=>
{
var
{
from
,
to
,
value
,
gas
,
data
}
=
tx
var
record
=
{
value
,
gas
,
data
}
record
.
from
=
self
.
_addressCache
[
from
]
||
(
self
.
_addressCache
[
from
]
=
`<account -
${(
++
counter
)}
>`
)
self
.
_api
.
getAccounts
(
function
(
err
,
accounts
=
[])
{
if
(
err
)
console
.
error
(
err
)
record
.
from
=
self
.
_addressCache
[
from
]
||
(
self
.
_addressCache
[
from
]
=
`<account -
${
getIndex
(
accounts
,
from
)}
>`
)
if
(
to
===
null
)
self
.
data
.
_pendingCreation
[
timestamp
]
=
record
else
record
.
to
=
self
.
_addressCache
[
to
]
||
(
self
.
_addressCache
[
to
]
=
`<account -
${(
++
counter
)}
>`
)
else
record
.
to
=
self
.
_addressCache
[
to
]
||
(
self
.
_addressCache
[
to
]
=
`<account -
${
getIndex
(
accounts
,
to
)}
>`
)
self
.
append
(
timestamp
,
record
)
})
})
opts
.
events
.
udapp
.
register
(
'transactionExecuted'
,
(...
args
)
=>
{
var
err
=
args
[
0
]
if
(
err
)
console
.
error
(
err
)
...
...
src/universal-dapp.js
View file @
04219939
...
...
@@ -469,10 +469,14 @@ function execute (pipeline, env, callback) {
UniversalDApp
.
prototype
.
replayTx
=
function
(
args
,
cb
)
{
var
self
=
this
var
tx
=
{
to
:
args
.
to
,
data
:
args
.
data
,
useCall
:
args
.
useCall
}
self
.
getAccounts
(
function
(
err
,
accounts
=
[])
{
if
(
err
)
console
.
error
(
err
)
if
(
args
.
to
[
0
]
===
'<'
)
args
.
to
=
accounts
[
args
.
to
.
split
(
'>'
)[
0
].
slice
(
11
)]
if
(
args
.
from
&&
args
.
from
[
0
]
===
'<'
)
args
.
from
=
accounts
[
args
.
from
.
split
(
'>'
)[
0
].
slice
(
11
)]
var
pipeline
=
[
runTransaction
]
var
env
=
{
self
,
args
,
tx
}
var
env
=
{
self
,
args
,
tx
:
{
to
:
args
.
to
,
from
:
args
.
from
,
data
:
args
.
data
,
useCall
:
args
.
useCall
}
}
execute
(
pipeline
,
env
,
cb
)
})
}
UniversalDApp
.
prototype
.
runTx
=
function
(
args
,
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