Skip to content

Commit

Permalink
Merge pull request #771 from gakonst/fix/sign-and-send-with-rpc
Browse files Browse the repository at this point in the history
feat: expand sign and send cases
  • Loading branch information
d-xo authored Sep 7, 2021
2 parents 2cf4410 + e8a839e commit 9022881
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/seth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `seth resolve-name <name>` to resolve an ENS name to an address
- `seth lookup-address <address>` to lookup the ENS name an address reverse resolves to
- Dynamic transaction fee format transactions (EIP-1559) supported by introducing the flag `--prio-fee` and corresponding environment variable `ETH_PRIO_FEE` to seth and ethsign. If `--prio-fee` is provided (or `ETH_PRIO_FEE`) is set, 1559 transaction will be used and `--gas-price` will reflect the maximum gas price, rather than the absolute gas price.
- If `ETH_RPC_ACCOUNTS` is set and the account corresponding to `ETH_FROM` exists in the keystore,
Seth will sign the transaction locally and then publish it signed (previously it'd always send it to the node)

### Changed

Expand Down
3 changes: 3 additions & 0 deletions src/seth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ the `ETH_RPC_ACCOUNTS` variable or use the `--rpc-accounts` flag.
This probably means you need to use Geth's or Parity's account
management tools to "unlock" your account.

If both `ETH_RPC_ACCOUNTS` and `ETH_FROM` are set, `seth` will first check if the
provided account can be found in the keystore, or in any connected hardware
wallet, and only use the RPC node's signer if the account does not exist.
Note: Seth uses the [`ethsign`] tool for signing transactions.
This tool uses Geth as a library.

Expand Down
8 changes: 7 additions & 1 deletion src/seth/libexec/seth/seth-send
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ jshon+=(-n {})
jshon+=($(seth --send-params))
jshon+=(-i append)

if [[ -z $ETH_RPC_ACCOUNTS ]]; then
function signAndSend() {
tx=$(seth mktx "$TO" "$DATA")
tx=$(seth publish "$tx")
}

if [[ -z $ETH_RPC_ACCOUNTS ]]; then
signAndSend
elif ethsign ls | grep -q $ETH_FROM; then
signAndSend
else
tx=$(seth rpc eth_sendTransaction -- "${jshon[@]}")
fi
Expand Down

0 comments on commit 9022881

Please sign in to comment.