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
f11b3e1e
Commit
f11b3e1e
authored
Sep 26, 2017
by
serapath
Committed by
yann300
Dec 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ADD recorder
parent
90b82b95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
27 deletions
+12
-27
recorder.js
src/recorder.js
+12
-27
No files found.
src/recorder.js
View file @
f11b3e1e
...
@@ -10,41 +10,26 @@ class Recorder {
...
@@ -10,41 +10,26 @@ class Recorder {
opts
.
events
.
executioncontext
.
register
(
'contextChanged'
,
function
()
{
opts
.
events
.
executioncontext
.
register
(
'contextChanged'
,
function
()
{
self
.
clearAll
()
self
.
clearAll
()
})
})
var
counter
=
1
self
.
_addressCache
=
{}
opts
.
events
.
udapp
.
register
(
'initiatingTransaction'
,
(
stamp
,
tx
)
=>
{
opts
.
events
.
udapp
.
register
(
'initiatingTransaction'
,
(
stamp
,
tx
)
=>
{
var
{
from
,
to
,
value
,
gas
,
data
}
=
tx
var
{
from
,
to
,
value
,
gas
,
data
}
=
tx
var
deTx
=
{
from
,
to
,
value
,
gas
,
data
,
pending
:
true
}
var
record
=
{
value
,
gas
,
data
}
self
.
data
.
_pending
[
stamp
]
=
deTx
record
.
from
=
self
.
_addressCache
[
from
]
||
(
self
.
_addressCache
[
from
]
=
`<account -
${(
++
counter
)}
>`
)
if
(
to
===
null
)
self
.
data
.
_pending
[
stamp
]
=
record
else
record
.
to
=
self
.
_addressCache
[
to
]
||
(
self
.
_addressCache
[
to
]
=
`<account -
${(
++
counter
)}
>`
)
self
.
append
(
stamp
,
record
)
})
})
opts
.
events
.
udapp
.
register
(
'transactionExecuted'
,
args
=>
{
opts
.
events
.
udapp
.
register
(
'transactionExecuted'
,
args
=>
{
var
[
err
,
from
,
to
,
data
,
/* isUserCall, result, */
stamp
]
=
args
var
err
=
args
[
0
]
if
(
err
)
console
.
error
(
err
)
else
update
(
stamp
,
from
,
to
,
data
)
})
opts
.
events
.
udapp
.
register
(
'callExecuted'
,
args
=>
{
var
[
err
,
from
,
to
,
data
,
/* isUserCall, result, */
stamp
]
=
args
if
(
err
)
console
.
error
(
err
)
if
(
err
)
console
.
error
(
err
)
else
update
(
stamp
,
from
,
to
,
data
)
var
stamp
=
args
[
6
]
})
function
update
(
stamp
,
from
,
to
,
data
)
{
var
record
=
self
.
_pending
[
stamp
]
var
record
=
self
.
_pending
[
stamp
]
delete
self
.
_pending
[
stamp
]
delete
self
.
_pending
[
stamp
]
if
(
!
record
)
return
if
(
!
record
)
return
// at this point you have a map 0x123789 <=> < contractName - 1>
var
to
=
args
[
2
]
// if a from` is 0x123789 you ill replace it by < contractName - 1>
record
.
to
=
self
.
_addressCache
[
to
]
||
(
self
.
_addressCache
[
to
]
=
`<contract -
${
++
counter
}
>`
)
// > if (start with 0x) do nothing (we already have a supposed address)
})
// > if not : <account - 0> is resolved to the first account in the list of accounts given from universaldapp.
// > <account - 1> is resolved to second first account in the list of accounts given from universaldapp.
// > if the account list is not large enough, we take the last one.
// > Real addresses should be translated into token (apply to: to / from / return value of contract creation)
// > e.g: from: 0x123...123 , to: 0x123...145 should be saved as: from:, to:
// > e.g: from: 0x123...123, to: null (cause this is a contract creation),
// > the return value is the address of the created contract.
console
.
log
(
'@TODO: probably the below translation need to be adapted to the comments above'
)
record
.
from
=
from
record
.
to
=
to
record
.
data
=
data
self
.
append
(
stamp
,
record
)
}
}
}
append
(
timestamp
,
record
)
{
append
(
timestamp
,
record
)
{
var
self
=
this
var
self
=
this
...
...
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