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
d2d2d9e3
Commit
d2d2d9e3
authored
Jan 24, 2020
by
LianaHus
Committed by
Liana Husikyan
Jan 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move isHexadecimal to helpers.js
parent
08a807d6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
24 deletions
+21
-24
universal-dapp-ui.js
src/app/ui/universal-dapp-ui.js
+2
-10
helper.js
src/lib/helper.js
+6
-0
specialFunctions.js
test-browser/tests/specialFunctions.js
+13
-14
No files found.
src/app/ui/universal-dapp-ui.js
View file @
d2d2d9e3
...
@@ -178,7 +178,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
...
@@ -178,7 +178,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
const
amount
=
document
.
querySelector
(
'#value'
).
value
const
amount
=
document
.
querySelector
(
'#value'
).
value
if
(
amount
!==
'0'
)
{
if
(
amount
!==
'0'
)
{
// check for numeric and receive/fallback
// check for numeric and receive/fallback
if
(
!
isNumeric
(
amount
))
{
if
(
!
helper
.
isNumeric
(
amount
))
{
setLLIError
(
'Value to send should be a number'
)
setLLIError
(
'Value to send should be a number'
)
}
else
if
(
!
receive
&&
!
(
fallback
&&
fallback
.
stateMutability
===
'payable'
))
{
}
else
if
(
!
receive
&&
!
(
fallback
&&
fallback
.
stateMutability
===
'payable'
))
{
setLLIError
(
"In order to receive Ether transfer the contract should have either 'receive' or payable 'fallback' function"
)
setLLIError
(
"In order to receive Ether transfer the contract should have either 'receive' or payable 'fallback' function"
)
...
@@ -186,7 +186,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
...
@@ -186,7 +186,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
}
}
if
(
calldata
)
{
if
(
calldata
)
{
if
(
calldata
.
length
>
3
&&
calldata
.
substr
(
0
,
2
)
===
'0x'
)
{
if
(
calldata
.
length
>
3
&&
calldata
.
substr
(
0
,
2
)
===
'0x'
)
{
if
(
!
isHexadecimal
(
calldata
.
substr
(
2
,
calldata
.
length
)))
{
if
(
!
helper
.
isHexadecimal
(
calldata
.
substr
(
2
,
calldata
.
length
)))
{
setLLIError
(
'the calldata should be a valid hexadecimal value.'
)
setLLIError
(
'the calldata should be a valid hexadecimal value.'
)
}
}
}
}
...
@@ -197,14 +197,6 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
...
@@ -197,14 +197,6 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
if
((
calldata
||
amount
!==
'0'
)
&&
!
error
)
self
.
runTransaction
(
false
,
args
,
null
,
calldata
,
null
)
if
((
calldata
||
amount
!==
'0'
)
&&
!
error
)
self
.
runTransaction
(
false
,
args
,
null
,
calldata
,
null
)
}
}
function
isHexadecimal
(
value
)
{
return
/^
[
0-9a-fA-F
]
+$/
.
test
(
value
)
}
function
isNumeric
(
value
)
{
return
/^
\+?(
0|
[
1-9
]\d
*
)
$/
.
test
(
value
)
}
contractActionsWrapper
.
appendChild
(
lowLevelInteracions
)
contractActionsWrapper
.
appendChild
(
lowLevelInteracions
)
return
instance
return
instance
}
}
...
...
src/lib/helper.js
View file @
d2d2d9e3
...
@@ -44,6 +44,12 @@ module.exports = {
...
@@ -44,6 +44,12 @@ module.exports = {
checkSpecialChars
(
name
)
{
checkSpecialChars
(
name
)
{
return
name
.
match
(
/
[
:*?"<>
\\
'|
]
/
)
!=
null
return
name
.
match
(
/
[
:*?"<>
\\
'|
]
/
)
!=
null
},
},
isHexadecimal
(
value
)
{
return
/^
[
0-9a-fA-F
]
+$/
.
test
(
value
)
},
isNumeric
(
value
)
{
return
/^
\+?(
0|
[
1-9
]\d
*
)
$/
.
test
(
value
)
},
find
:
find
find
:
find
}
}
...
...
test-browser/tests/specialFunctions.js
View file @
d2d2d9e3
...
@@ -11,21 +11,20 @@ module.exports = {
...
@@ -11,21 +11,20 @@ module.exports = {
},
},
'Use special functions receive/fullback'
:
function
(
browser
)
{
'Use special functions receive/fullback'
:
function
(
browser
)
{
browser
.
waitForElementVisible
(
'#icon-panel'
,
10000
)
browser
.
waitForElementVisible
(
'#icon-panel'
,
10000
)
.
testContracts
(
'receiveAndfFallback.sol'
,
sources
[
0
][
'browser/Untitled.sol'
],
[
'CheckSpecials'
])
.
testContracts
(
'browser/receiveAndfFallback.sol'
,
sources
[
0
][
'receiveAndfFallback.sol'
],
[
'CheckSpecials'
])
.
clickLaunchIcon
(
'udapp'
.
clickLaunchIcon
(
'udapp'
)
.
selectContract
(
'CheckSpecials'
)
.
selectContract
(
'CheckSpecials'
)
.
createContract
(
''
)
.
createContract
(
''
)
.
clickInstance
(
0
)
.
clickInstance
(
0
)
.
perform
((
done
)
=>
{
.
perform
((
done
)
=>
{
browser
.
getAddressAtPosition
(
0
,
(
address
)
=>
{
browser
.
getAddressAtPosition
(
0
,
(
address
)
=>
{
browser
.
sendLowLevelTx
(
address
,
'0'
,
'0xaa'
)
browser
.
sendLowLevelTx
(
address
,
'0'
,
'0xaa'
)
.
journalLastChild
(
'dd'
)
.
journalLastChild
(
'dd'
)
.
waitForElementVisible
(
'label[id="deployAndRunLLTxError"]'
)
.
waitForElementVisible
(
'label[id="deployAndRunLLTxError"]'
)
.
assert
.
containsText
(
'label[id="deployAndRunLLTxError"]'
,
''
)
.
assert
.
containsText
(
'label[id="deployAndRunLLTxError"]'
,
''
)
.
perform
(
done
)
.
perform
(
done
)
})
})
})
)
}
)
},
},
tearDown
:
sauce
tearDown
:
sauce
}
}
...
...
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