-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
automatic gas estimation #855
base: master
Are you sure you want to change the base?
Changes from 12 commits
79e4602
a116e13
e50c75a
772259b
7183940
f423aae
c326a8a
38a8828
6dc76af
42235fb
9843e2c
275a400
b8fa44c
e68c6d8
2ce9250
d06f6ba
07483f9
8d5b6fe
5a7e024
7c8b24e
f21d606
5568fed
8fb178e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,20 +13,36 @@ if [[ $2 ]]; then | |
data=$(seth calldata "${@:2}") | ||
fi | ||
|
||
data=${data:-0x} | ||
|
||
if [[ -z "$SETH_CREATE" ]]; then | ||
TO=$(seth --to-address "$1") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why only for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If SETH_CREATE is unset, then we are doing a normal transaction that has a recipient. If not, we are creating a contract, and TO must be unset since this is a requirement for a contract creation tx. |
||
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[@]}") | ||
fi | ||
|
||
args=( | ||
--from "$(seth --to-address "$ETH_FROM")" | ||
--nonce "${ETH_NONCE:-$(seth nonce "$ETH_FROM")}" | ||
--chain-id "$(seth chain-id)" | ||
--gas-price "${ETH_GAS_PRICE:-$(seth gas-price)}" | ||
--gas-limit "${ETH_GAS:-200000}" | ||
--gas-limit "$ETH_GAS" | ||
--value "$value" | ||
--data "${data:-0x}" | ||
--data "$data" | ||
) | ||
|
||
if [[ $SETH_CREATE ]]; then | ||
args+=(--create) | ||
else | ||
args+=(--to "$(seth --to-address "$1")") | ||
args+=(--to "$TO") | ||
fi | ||
|
||
if [[ $ETH_PRIO_FEE ]]; then | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we put this in an
else
for the aboveif
statement?