Merge pull request #3531 from poanetwork/vb-allow-double-quotes-ini-input-data

Allow double quotes in input data of contract methods
pull/3532/head
Victor Baranov 4 years ago committed by GitHub
commit f41e898c3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 9
      apps/block_scout_web/assets/js/lib/smart_contract/functions.js

@ -1,6 +1,7 @@
## Current ## Current
### Features ### Features
- [#3531](https://github.com/poanetwork/blockscout/pull/3531) - Allow double quotes in input data of contract methods
- [#3515](https://github.com/poanetwork/blockscout/pull/3515) - CRC total balance - [#3515](https://github.com/poanetwork/blockscout/pull/3515) - CRC total balance
- [#3513](https://github.com/poanetwork/blockscout/pull/3513) - Allow square brackets for an array input data in contracts interaction - [#3513](https://github.com/poanetwork/blockscout/pull/3513) - Allow square brackets for an array input data in contracts interaction
- [#3480](https://github.com/poanetwork/blockscout/pull/3480) - Add support of Autonity client - [#3480](https://github.com/poanetwork/blockscout/pull/3480) - Add support of Autonity client

@ -183,6 +183,9 @@ function prepareMethodArgs ($functionInputs, inputs) {
const inputType = inputs[ind] && inputs[ind].type const inputType = inputs[ind] && inputs[ind].type
let preparedVal let preparedVal
if (isNonSpaceInputType(inputType)) { preparedVal = val.replace(/\s/g, '') } else { preparedVal = val } if (isNonSpaceInputType(inputType)) { preparedVal = val.replace(/\s/g, '') } else { preparedVal = val }
if (isAddressInputType(inputType)) {
preparedVal = preparedVal.replaceAll('"', '')
}
if (isArrayInputType(inputType)) { if (isArrayInputType(inputType)) {
if (preparedVal === '') { if (preparedVal === '') {
return [[]] return [[]]
@ -200,8 +203,12 @@ function isArrayInputType (inputType) {
return inputType && inputType.includes('[') && inputType.includes(']') return inputType && inputType.includes('[') && inputType.includes(']')
} }
function isAddressInputType (inputType) {
return inputType.includes('address')
}
function isNonSpaceInputType (inputType) { function isNonSpaceInputType (inputType) {
return inputType.includes('address') || inputType.includes('int') || inputType.includes('bool') return isAddressInputType(inputType) || inputType.includes('int') || inputType.includes('bool')
} }
function getTxValue ($functionInputs) { function getTxValue ($functionInputs) {

Loading…
Cancel
Save