Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/seth/libexec/seth/seth-estimate
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
### or: seth estimate [<options>] <receiver> <data>
### or: seth estimate [<options>] --create <code> <sig> [<args>]
### or: seth estimate [<options>] --create <code> <data>
### or: seth estimate [<options>] --create <data>
###
### Perform a local call to <receiver> and return the gas usage.
###
Expand All @@ -15,7 +16,7 @@
### With `-F <sender>', simulate calling <receiver> from <sender>
### With `-V <value>', simulate transferring <value> to <receiver>.
set -e
[[ $2 ]] || seth --fail-usage "$0"
[[ $1 ]] || seth --fail-usage "$0"

if [[ $SETH_CREATE ]]; then
DATA=$(seth --to-hexdata "$1")
Expand Down
12 changes: 5 additions & 7 deletions src/seth/libexec/seth/seth-mktx
Original file line number Diff line number Diff line change
Expand Up @@ -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=(
Expand Down
9 changes: 9 additions & 0 deletions src/seth/libexec/seth/seth-send
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down