diff --git a/src/seth/libexec/seth/seth-estimate b/src/seth/libexec/seth/seth-estimate index 41864607e..26e03fd5e 100755 --- a/src/seth/libexec/seth/seth-estimate +++ b/src/seth/libexec/seth/seth-estimate @@ -4,6 +4,7 @@ ### or: seth estimate [] ### or: seth estimate [] --create [] ### or: seth estimate [] --create +### or: seth estimate [] --create ### ### Perform a local call to and return the gas usage. ### @@ -15,7 +16,7 @@ ### With `-F ', simulate calling from ### With `-V ', simulate transferring to . set -e -[[ $2 ]] || seth --fail-usage "$0" +[[ $1 ]] || seth --fail-usage "$0" if [[ $SETH_CREATE ]]; then DATA=$(seth --to-hexdata "$1") diff --git a/src/seth/libexec/seth/seth-mktx b/src/seth/libexec/seth/seth-mktx index b04c067c1..b9a340fdd 100755 --- a/src/seth/libexec/seth/seth-mktx +++ b/src/seth/libexec/seth/seth-mktx @@ -20,13 +20,11 @@ if [[ -z "$SETH_CREATE" ]]; then fi if [[ -z "$ETH_GAS" ]]; then - jshon+=(-n {}) - [[ $TO ]] && jshon+=(-s "$TO" -i to) - jshon+=(-s "$data" -i data) - # shellcheck disable=SC2207 - jshon+=($(SETH_PARAMS_NO_GAS=1 seth --send-params)) - jshon+=(-i append) - ETH_GAS=$(seth rpc eth_estimateGas -- "${jshon[@]}") + if [[ $SETH_CREATE ]]; then + ETH_GAS=$(seth estimate --create $data) + else + ETH_GAS=$(seth estimate $TO $data) + fi fi args=( diff --git a/src/seth/libexec/seth/seth-send b/src/seth/libexec/seth/seth-send index ea1663b0f..3d72f1b5d 100755 --- a/src/seth/libexec/seth/seth-send +++ b/src/seth/libexec/seth/seth-send @@ -42,9 +42,18 @@ else fi fi +if [[ -z "$ETH_GAS" ]]; then + if [[ $SETH_CREATE ]]; then + ETH_GAS=$(seth estimate --create $DATA) + else + ETH_GAS=$(seth estimate $TO ${DATA:-0x}) + fi +fi + jshon+=(-n {}) [[ $TO ]] && jshon+=(-s "$TO" -i to) [[ $DATA ]] && jshon+=(-s "$DATA" -i data) +[[ $ETH_GAS ]] && jshon+=(-s "$ETH_GAS" -i gas) # shellcheck disable=SC2207 jshon+=($(seth --send-params)) jshon+=(-i append)