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
14faf263
Commit
14faf263
authored
Dec 20, 2019
by
Aniket-Engg
Committed by
Liana Husikyan
Dec 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
execution context updated
parent
e374061a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
20 deletions
+20
-20
dropdownlogic.js
src/app/tabs/runTab/model/dropdownlogic.js
+9
-9
recorder.js
src/app/tabs/runTab/model/recorder.js
+5
-5
run-tab.js
src/app/udapp/run-tab.js
+1
-1
universal-dapp-ui.js
src/app/ui/universal-dapp-ui.js
+5
-5
No files found.
src/app/tabs/runTab/model/dropdownlogic.js
View file @
14faf263
...
@@ -106,17 +106,17 @@ class DropdownLogic {
...
@@ -106,17 +106,17 @@ class DropdownLogic {
fromWei
(
value
,
doTypeConversion
,
unit
)
{
fromWei
(
value
,
doTypeConversion
,
unit
)
{
if
(
doTypeConversion
)
{
if
(
doTypeConversion
)
{
return
executionContext
.
web3
().
fromWei
(
typeConversion
.
toInt
(
value
),
unit
||
'ether'
)
return
executionContext
.
web3
().
utils
.
fromWei
(
typeConversion
.
toInt
(
value
),
unit
||
'ether'
)
}
}
return
executionContext
.
web3
().
fromWei
(
value
.
toString
(
10
),
unit
||
'ether'
)
return
executionContext
.
web3
().
utils
.
fromWei
(
value
.
toString
(
10
),
unit
||
'ether'
)
}
}
toWei
(
value
,
unit
)
{
toWei
(
value
,
unit
)
{
return
executionContext
.
web3
().
toWei
(
value
,
unit
||
'gwei'
)
return
executionContext
.
web3
().
utils
.
toWei
(
value
,
unit
||
'gwei'
)
}
}
calculateFee
(
gas
,
gasPrice
,
unit
)
{
calculateFee
(
gas
,
gasPrice
,
unit
)
{
return
executionContext
.
web3
().
toBigNumber
(
gas
).
mul
(
executionContext
.
web3
().
toBigNumber
(
executionContext
.
web3
()
.
toWei
(
gasPrice
.
toString
(
10
),
unit
||
'gwei'
)))
return
executionContext
.
web3
().
utils
.
toBN
(
gas
).
mul
(
executionContext
.
web3
().
utils
.
toBN
(
executionContext
.
web3
().
utils
.
toWei
(
gasPrice
.
toString
(
10
),
unit
||
'gwei'
)))
}
}
getGasPrice
(
cb
)
{
getGasPrice
(
cb
)
{
...
@@ -139,7 +139,7 @@ class DropdownLogic {
...
@@ -139,7 +139,7 @@ class DropdownLogic {
if
(
network
.
name
!==
'Main'
)
{
if
(
network
.
name
!==
'Main'
)
{
return
continueTxExecution
(
null
)
return
continueTxExecution
(
null
)
}
}
var
amount
=
executionContext
.
web3
().
fromWei
(
typeConversion
.
toInt
(
tx
.
value
),
'ether'
)
var
amount
=
executionContext
.
web3
().
utils
.
fromWei
(
typeConversion
.
toInt
(
tx
.
value
),
'ether'
)
// TODO: there is still a UI dependency to remove here, it's still too coupled at this point to remove easily
// TODO: there is still a UI dependency to remove here, it's still too coupled at this point to remove easily
var
content
=
confirmDialog
(
tx
,
amount
,
gasEstimation
,
this
.
recorder
,
var
content
=
confirmDialog
(
tx
,
amount
,
gasEstimation
,
this
.
recorder
,
...
@@ -148,8 +148,8 @@ class DropdownLogic {
...
@@ -148,8 +148,8 @@ class DropdownLogic {
// TODO: this try catch feels like an anti pattern, can/should be
// TODO: this try catch feels like an anti pattern, can/should be
// removed, but for now keeping the original logic
// removed, but for now keeping the original logic
try
{
try
{
var
fee
=
executionContext
.
web3
().
toBigNumber
(
tx
.
gas
).
mul
(
executionContext
.
web3
().
toBigNumber
(
executionContext
.
web3
()
.
toWei
(
gasPrice
.
toString
(
10
),
'gwei'
)))
var
fee
=
executionContext
.
web3
().
utils
.
toBN
(
tx
.
gas
).
mul
(
executionContext
.
web3
().
utils
.
toBN
(
executionContext
.
web3
().
utils
.
toWei
(
gasPrice
.
toString
(
10
),
'gwei'
)))
txFeeText
=
' '
+
executionContext
.
web3
().
fromWei
(
fee
.
toString
(
10
),
'ether'
)
+
' Ether'
txFeeText
=
' '
+
executionContext
.
web3
().
utils
.
fromWei
(
fee
.
toString
(
10
),
'ether'
)
+
' Ether'
priceStatus
=
true
priceStatus
=
true
}
catch
(
e
)
{
}
catch
(
e
)
{
txFeeText
=
' Please fix this issue before sending any transaction. '
+
e
.
message
txFeeText
=
' Please fix this issue before sending any transaction. '
+
e
.
message
...
@@ -164,7 +164,7 @@ class DropdownLogic {
...
@@ -164,7 +164,7 @@ class DropdownLogic {
return
cb
(
'Unable to retrieve the current network gas price.'
+
warnMessage
+
error
)
return
cb
(
'Unable to retrieve the current network gas price.'
+
warnMessage
+
error
)
}
}
try
{
try
{
var
gasPriceValue
=
executionContext
.
web3
().
fromWei
(
gasPrice
.
toString
(
10
),
'gwei'
)
var
gasPriceValue
=
executionContext
.
web3
().
utils
.
fromWei
(
gasPrice
.
toString
(
10
),
'gwei'
)
cb
(
null
,
gasPriceValue
)
cb
(
null
,
gasPriceValue
)
}
catch
(
e
)
{
}
catch
(
e
)
{
cb
(
warnMessage
+
e
.
message
,
null
,
false
)
cb
(
warnMessage
+
e
.
message
,
null
,
false
)
...
@@ -180,7 +180,7 @@ class DropdownLogic {
...
@@ -180,7 +180,7 @@ class DropdownLogic {
if
(
!
content
.
gasPriceStatus
)
{
if
(
!
content
.
gasPriceStatus
)
{
cancelCb
(
'Given gas price is not correct'
)
cancelCb
(
'Given gas price is not correct'
)
}
else
{
}
else
{
var
gasPrice
=
executionContext
.
web3
().
toWei
(
content
.
querySelector
(
'#gasprice'
).
value
,
'gwei'
)
var
gasPrice
=
executionContext
.
web3
().
utils
.
toWei
(
content
.
querySelector
(
'#gasprice'
).
value
,
'gwei'
)
continueTxExecution
(
gasPrice
)
continueTxExecution
(
gasPrice
)
}
}
}},
{
}},
{
...
...
src/app/tabs/runTab/model/recorder.js
View file @
14faf263
...
@@ -315,7 +315,7 @@ class Recorder {
...
@@ -315,7 +315,7 @@ class Recorder {
if
(
network
.
name
!==
'Main'
)
{
if
(
network
.
name
!==
'Main'
)
{
return
continueTxExecution
(
null
)
return
continueTxExecution
(
null
)
}
}
var
amount
=
executionContext
.
web3
().
fromWei
(
typeConversion
.
toInt
(
tx
.
value
),
'ether'
)
var
amount
=
executionContext
.
web3
().
utils
.
fromWei
(
typeConversion
.
toInt
(
tx
.
value
),
'ether'
)
// TODO: there is still a UI dependency to remove here, it's still too coupled at this point to remove easily
// TODO: there is still a UI dependency to remove here, it's still too coupled at this point to remove easily
var
content
=
confirmDialog
(
tx
,
amount
,
gasEstimation
,
this
.
recorder
,
var
content
=
confirmDialog
(
tx
,
amount
,
gasEstimation
,
this
.
recorder
,
...
@@ -324,8 +324,8 @@ class Recorder {
...
@@ -324,8 +324,8 @@ class Recorder {
// TODO: this try catch feels like an anti pattern, can/should be
// TODO: this try catch feels like an anti pattern, can/should be
// removed, but for now keeping the original logic
// removed, but for now keeping the original logic
try
{
try
{
var
fee
=
executionContext
.
web3
().
toBigNumber
(
tx
.
gas
).
mul
(
executionContext
.
web3
().
toBigNumber
(
executionContext
.
web3
().
toWei
(
gasPrice
.
toString
(
10
),
'gwei'
)))
var
fee
=
executionContext
.
web3
().
utils
.
toBN
(
tx
.
gas
).
mul
(
executionContext
.
web3
().
utils
.
toBN
(
executionContext
.
web3
().
toWei
(
gasPrice
.
toString
(
10
),
'gwei'
)))
txFeeText
=
' '
+
executionContext
.
web3
().
fromWei
(
fee
.
toString
(
10
),
'ether'
)
+
' Ether'
txFeeText
=
' '
+
executionContext
.
web3
().
utils
.
fromWei
(
fee
.
toString
(
10
),
'ether'
)
+
' Ether'
priceStatus
=
true
priceStatus
=
true
}
catch
(
e
)
{
}
catch
(
e
)
{
txFeeText
=
' Please fix this issue before sending any transaction. '
+
e
.
message
txFeeText
=
' Please fix this issue before sending any transaction. '
+
e
.
message
...
@@ -340,7 +340,7 @@ class Recorder {
...
@@ -340,7 +340,7 @@ class Recorder {
return
cb
(
'Unable to retrieve the current network gas price.'
+
warnMessage
+
error
)
return
cb
(
'Unable to retrieve the current network gas price.'
+
warnMessage
+
error
)
}
}
try
{
try
{
var
gasPriceValue
=
executionContext
.
web3
().
fromWei
(
gasPrice
.
toString
(
10
),
'gwei'
)
var
gasPriceValue
=
executionContext
.
web3
().
utils
.
fromWei
(
gasPrice
.
toString
(
10
),
'gwei'
)
cb
(
null
,
gasPriceValue
)
cb
(
null
,
gasPriceValue
)
}
catch
(
e
)
{
}
catch
(
e
)
{
cb
(
warnMessage
+
e
.
message
,
null
,
false
)
cb
(
warnMessage
+
e
.
message
,
null
,
false
)
...
@@ -356,7 +356,7 @@ class Recorder {
...
@@ -356,7 +356,7 @@ class Recorder {
if
(
!
content
.
gasPriceStatus
)
{
if
(
!
content
.
gasPriceStatus
)
{
cancelCb
(
'Given gas price is not correct'
)
cancelCb
(
'Given gas price is not correct'
)
}
else
{
}
else
{
var
gasPrice
=
executionContext
.
web3
().
toWei
(
content
.
querySelector
(
'#gasprice'
).
value
,
'gwei'
)
var
gasPrice
=
executionContext
.
web3
().
utils
.
toWei
(
content
.
querySelector
(
'#gasprice'
).
value
,
'gwei'
)
continueTxExecution
(
gasPrice
)
continueTxExecution
(
gasPrice
)
}
}
}},
{
}},
{
...
...
src/app/udapp/run-tab.js
View file @
14faf263
...
@@ -63,7 +63,7 @@ export class RunTab extends LibraryPlugin {
...
@@ -63,7 +63,7 @@ export class RunTab extends LibraryPlugin {
if
([
'ether'
,
'finney'
,
'gwei'
,
'wei'
].
indexOf
(
selectedUnit
)
>=
0
)
{
if
([
'ether'
,
'finney'
,
'gwei'
,
'wei'
].
indexOf
(
selectedUnit
)
>=
0
)
{
unit
=
selectedUnit
unit
=
selectedUnit
}
}
cb
(
null
,
executionContext
.
web3
().
toWei
(
number
,
unit
))
cb
(
null
,
executionContext
.
web3
().
utils
.
toWei
(
number
,
unit
))
}
catch
(
e
)
{
}
catch
(
e
)
{
cb
(
e
)
cb
(
e
)
}
}
...
...
src/app/ui/universal-dapp-ui.js
View file @
14faf263
...
@@ -163,14 +163,14 @@ UniversalDAppUI.prototype.getCallButton = function (args) {
...
@@ -163,14 +163,14 @@ UniversalDAppUI.prototype.getCallButton = function (args) {
if
(
network
.
name
!==
'Main'
)
{
if
(
network
.
name
!==
'Main'
)
{
return
continueTxExecution
(
null
)
return
continueTxExecution
(
null
)
}
}
const
amount
=
executionContext
.
web3
()
.
fromWei
(
typeConversion
.
toInt
(
tx
.
value
),
'ether'
)
var
amount
=
executionContext
.
web3
().
utils
.
fromWei
(
typeConversion
.
toInt
(
tx
.
value
),
'ether'
)
const
content
=
confirmDialog
(
tx
,
amount
,
gasEstimation
,
self
.
udapp
,
var
content
=
confirmDialog
(
tx
,
amount
,
gasEstimation
,
self
.
udapp
,
(
gasPrice
,
cb
)
=>
{
(
gasPrice
,
cb
)
=>
{
let
txFeeText
,
priceStatus
let
txFeeText
,
priceStatus
// TODO: this try catch feels like an anti pattern, can/should be
// TODO: this try catch feels like an anti pattern, can/should be
// removed, but for now keeping the original logic
// removed, but for now keeping the original logic
try
{
try
{
const
fee
=
executionContext
.
web3
().
toBigNumber
(
tx
.
gas
).
mul
(
executionContext
.
web3
().
toBigNumber
(
executionContext
.
web3
()
.
toWei
(
gasPrice
.
toString
(
10
),
'gwei'
)))
var
fee
=
executionContext
.
web3
().
utils
.
toBN
(
tx
.
gas
).
mul
(
executionContext
.
web3
().
utils
.
toBN
(
executionContext
.
web3
().
utils
.
toWei
(
gasPrice
.
toString
(
10
),
'gwei'
)))
txFeeText
=
' '
+
executionContext
.
web3
().
fromWei
(
fee
.
toString
(
10
),
'ether'
)
+
' Ether'
txFeeText
=
' '
+
executionContext
.
web3
().
fromWei
(
fee
.
toString
(
10
),
'ether'
)
+
' Ether'
priceStatus
=
true
priceStatus
=
true
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -186,7 +186,7 @@ UniversalDAppUI.prototype.getCallButton = function (args) {
...
@@ -186,7 +186,7 @@ UniversalDAppUI.prototype.getCallButton = function (args) {
return
cb
(
'Unable to retrieve the current network gas price.'
+
warnMessage
+
error
)
return
cb
(
'Unable to retrieve the current network gas price.'
+
warnMessage
+
error
)
}
}
try
{
try
{
const
gasPriceValue
=
executionContext
.
web3
()
.
fromWei
(
gasPrice
.
toString
(
10
),
'gwei'
)
var
gasPriceValue
=
executionContext
.
web3
().
utils
.
fromWei
(
gasPrice
.
toString
(
10
),
'gwei'
)
cb
(
null
,
gasPriceValue
)
cb
(
null
,
gasPriceValue
)
}
catch
(
e
)
{
}
catch
(
e
)
{
cb
(
warnMessage
+
e
.
message
,
null
,
false
)
cb
(
warnMessage
+
e
.
message
,
null
,
false
)
...
@@ -207,7 +207,7 @@ UniversalDAppUI.prototype.getCallButton = function (args) {
...
@@ -207,7 +207,7 @@ UniversalDAppUI.prototype.getCallButton = function (args) {
if
(
!
content
.
gasPriceStatus
)
{
if
(
!
content
.
gasPriceStatus
)
{
cancelCb
(
'Given gas price is not correct'
)
cancelCb
(
'Given gas price is not correct'
)
}
else
{
}
else
{
var
gasPrice
=
executionContext
.
web3
().
toWei
(
content
.
querySelector
(
'#gasprice'
).
value
,
'gwei'
)
var
gasPrice
=
executionContext
.
web3
().
utils
.
toWei
(
content
.
querySelector
(
'#gasprice'
).
value
,
'gwei'
)
continueTxExecution
(
gasPrice
)
continueTxExecution
(
gasPrice
)
}
}
}},
{
}},
{
...
...
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