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
09ce2c03
Commit
09ce2c03
authored
Feb 16, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move txHelper reference to Remix-lib
parent
8c333475
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
122 deletions
+2
-122
txFormat.js
src/app/execution/txFormat.js
+2
-1
txHelper.js
src/app/execution/txHelper.js
+0
-121
No files found.
src/app/execution/txFormat.js
View file @
09ce2c03
...
...
@@ -2,7 +2,8 @@
var
ethJSABI
=
require
(
'ethereumjs-abi'
)
var
ethJSUtil
=
require
(
'ethereumjs-util'
)
var
BN
=
ethJSUtil
.
BN
var
helper
=
require
(
'./txHelper'
)
var
remixLib
=
require
(
'remix-lib'
)
var
helper
=
remixLib
.
execution
.
txHelper
var
TreeView
=
require
(
'remix-debugger'
).
ui
.
TreeView
var
executionContext
=
require
(
'../../execution-context'
)
...
...
src/app/execution/txHelper.js
deleted
100644 → 0
View file @
8c333475
'use strict'
var
ethJSABI
=
require
(
'ethereumjs-abi'
)
module
.
exports
=
{
encodeParams
:
function
(
funABI
,
args
)
{
var
types
=
[]
if
(
funABI
.
inputs
&&
funABI
.
inputs
.
length
)
{
for
(
var
i
=
0
;
i
<
funABI
.
inputs
.
length
;
i
++
)
{
var
type
=
funABI
.
inputs
[
i
].
type
types
.
push
(
type
)
if
(
args
.
length
<
types
.
length
)
{
args
.
push
(
''
)
}
}
}
// NOTE: the caller will concatenate the bytecode and this
// it could be done here too for consistency
return
ethJSABI
.
rawEncode
(
types
,
args
)
},
encodeFunctionId
:
function
(
funABI
)
{
var
types
=
[]
if
(
funABI
.
inputs
&&
funABI
.
inputs
.
length
)
{
for
(
var
i
=
0
;
i
<
funABI
.
inputs
.
length
;
i
++
)
{
types
.
push
(
funABI
.
inputs
[
i
].
type
)
}
}
return
ethJSABI
.
methodID
(
funABI
.
name
,
types
)
},
sortAbiFunction
:
function
(
contractabi
)
{
var
abi
=
contractabi
.
sort
(
function
(
a
,
b
)
{
if
(
a
.
name
>
b
.
name
)
{
return
-
1
}
else
{
return
1
}
}).
sort
(
function
(
a
,
b
)
{
if
(
a
.
constant
===
true
)
{
return
-
1
}
else
{
return
1
}
})
return
abi
},
getConstructorInterface
:
function
(
abi
)
{
var
funABI
=
{
'name'
:
''
,
'inputs'
:
[],
'type'
:
'constructor'
,
'outputs'
:
[]
}
if
(
typeof
abi
===
'string'
)
{
try
{
abi
=
JSON
.
parse
(
abi
)
}
catch
(
e
)
{
console
.
log
(
'exception retrieving ctor abi '
+
abi
)
return
funABI
}
}
for
(
var
i
=
0
;
i
<
abi
.
length
;
i
++
)
{
if
(
abi
[
i
].
type
===
'constructor'
)
{
funABI
.
inputs
=
abi
[
i
].
inputs
||
[]
break
}
}
return
funABI
},
getFunction
:
function
(
abi
,
fnName
)
{
for
(
var
i
=
0
;
i
<
abi
.
length
;
i
++
)
{
if
(
abi
[
i
].
name
===
fnName
)
{
return
abi
[
i
]
}
}
return
null
},
getFallbackInterface
:
function
(
abi
)
{
for
(
var
i
=
0
;
i
<
abi
.
length
;
i
++
)
{
if
(
abi
[
i
].
type
===
'fallback'
)
{
return
abi
[
i
]
}
}
},
/**
* return the contract obj of the given @arg name. Uses last compilation result.
* return null if not found
* @param {String} name - contract name
* @returns contract obj and associated file: { contract, file } or null
*/
getContract
:
(
contractName
,
contracts
)
=>
{
for
(
var
file
in
contracts
)
{
if
(
contracts
[
file
][
contractName
])
{
return
{
object
:
contracts
[
file
][
contractName
],
file
:
file
}
}
}
return
null
},
/**
* call the given @arg cb (function) for all the contracts. Uses last compilation result
* stop visiting when cb return true
* @param {Function} cb - callback
*/
visitContracts
:
(
contracts
,
cb
)
=>
{
for
(
var
file
in
contracts
)
{
for
(
var
name
in
contracts
[
file
])
{
if
(
cb
({
name
:
name
,
object
:
contracts
[
file
][
name
],
file
:
file
}))
return
}
}
},
inputParametersDeclarationToString
:
function
(
abiinputs
)
{
var
inputs
=
(
abiinputs
||
[]).
map
((
inp
)
=>
inp
.
type
+
' '
+
inp
.
name
)
return
inputs
.
join
(
', '
)
}
}
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