Skip to content

Commit

Permalink
CHanged the error text and added text for odd number of digits for
Browse files Browse the repository at this point in the history
calldata
  • Loading branch information
LianaHus authored and Aniket-Engg committed Feb 3, 2020
1 parent e9684d4 commit 20ffc1e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/app/ui/universal-dapp-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
<label class="pt-2 border-top d-flex justify-content-start flex-grow-1">
Low level interactions
</label>
<a href="https://solidity.readthedocs.io/en/v0.6.2/contracts.html#receive-ether-function" title="check out docs for using 'receive'/'fallback'" target="_blank">
<a
href="https://solidity.readthedocs.io/en/v0.6.2/contracts.html#receive-ether-function"
title="check out docs for using 'receive'/'fallback'"
target="_blank"
>
<i aria-hidden="true" class="fas fa-info text-info my-2 mr-2"></i>
</a>
</div>
Expand Down Expand Up @@ -176,13 +180,13 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
let calldata = calldataInput.value
if (calldata) {
if (calldata.length < 2 || calldata.length < 4 && helper.is0XPrefixed(calldata)) {
return setLLIError('the calldata should be a valid hexadecimal value with size of at least one byte.')
return setLLIError('The calldata should be a valid hexadecimal value with size of at least one byte.')
} else {
if (helper.is0XPrefixed(calldata)) {
calldata = calldata.substr(2, calldata.length)
}
if (!helper.isHexadecimal(calldata)) {
return setLLIError('the calldata should be a valid hexadecimal value with size of at least one byte.')
return setLLIError('The calldata should be a valid hexadecimal value.')
}
}
if (!fallback) {
Expand Down
14 changes: 13 additions & 1 deletion test-browser/tests/specialFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@ module.exports = {
browser.sendLowLevelTx(address, '0', '0xa')
.pause(1000)
.waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
.assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `the calldata should be a valid hexadecimal value with size of at least one byte.`)
.assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `The calldata should be a valid hexadecimal value with size of at least one byte.`)
.perform(done)
})
})
},
'Use special functions receive/fallback - both are declared, failing sending data with odd number of digits': function (browser) {
// don't need to redeploy it, same contract
browser.perform((done) => {
browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '0', '0x1aa')
.pause(1000)
.waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
.assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `The calldata should be a valid hexadecimal value.`)
.perform(done)
})
})
Expand Down

0 comments on commit 20ffc1e

Please sign in to comment.