Skip to content

Commit

Permalink
Merge safe-cli and safe-runner
Browse files Browse the repository at this point in the history
  • Loading branch information
falvaradorodriguez committed Jun 23, 2024
1 parent 8d82f8a commit ee7a27c
Show file tree
Hide file tree
Showing 8 changed files with 667 additions and 652 deletions.
89 changes: 46 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ You can also run the following command to run the Safe CLI with an existing Safe
docker run -it safeglobal/safe-cli safe-cli <checksummed_safe_address> <ethereum_node_url>
```

To execute transactions unattended, or execute transactions from a json exported from the tx_builder you can use:
```bash
docker run -it safeglobal/safe-cli safe-runner
```

## Using Python PIP

**Prerequisite:** [Python](https://www.python.org/downloads/) >= 3.9 (Python 3.12 is recommended).
Expand All @@ -48,27 +43,55 @@ pip3 install -U safe-cli

```bash
usage:
safe-cli [-h] [--history] [--get-safes-from-owner] address node_url

Examples:
safe-cli 0x0000000000000000000000000000000000000000 https://sepolia.drpc.org
safe-cli --get-safes-from-owner 0x0000000000000000000000000000000000000000 https://sepolia.drpc.org

safe-cli --history 0x0000000000000000000000000000000000000000 https://sepolia.drpc.org
safe-cli --history --get-safes-from-owner 0x0000000000000000000000000000000000000000 https://sepolia.drpc.org

safe-cli [--history] [--get-safes-from-owner] address node_url

Examples:
safe-cli 0x0000000000000000000000000000000000000000 https://sepolia.drpc.org
safe-cli --get-safes-from-owner 0x0000000000000000000000000000000000000000 https://sepolia.drpc.org

safe-cli --history 0x0000000000000000000000000000000000000000 https://sepolia.drpc.org
safe-cli --history --get-safes-from-owner 0x0000000000000000000000000000000000000000 https://sepolia.drpc.org

safe-cli send-ether 0xsafeaddress https://sepolia.drpc.org 0xtoaddress wei-amount --private-key key1 --private-key key1 --private-key keyN
safe-cli send-erc721 0xsafeaddress https://sepolia.drpc.org 0xtoaddress 0xtokenaddres id --private-key key1 --private-key key2 --private-key keyN
safe-cli send-erc20 0xsafeaddress https://sepolia.drpc.org 0xtoaddress 0xtokenaddres wei-amount --private-key key1 --private-key key2 --private-key keyN
safe-cli send-custom 0xsafeaddress https://sepolia.drpc.org 0xtoaddress value 0xtxdata --private-key key1 --private-key key2 --private-key keyN

safe-cli tx-builder 0xsafeaddress https://sepolia.drpc.org ./path/to/exported/tx-builder/file.json --private-key key1 --private-key keyN

╭─ Arguments ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
* address PARSE_CHECKSUM_ADDRESS The address of the Safe, or an owner address if --get-safes-from-owner is specified. [required] │
* node_url TEXT Ethereum node url. [required] │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Optional Arguments ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --history --no-history Enable history. By default it's disabled due to security reasons [default: no-history] │
│ --get-safes-from-owner --no-get-safes-from-owner Indicates that address is an owner (Safe Transaction Service is required for this feature) [default: no-get-safes-from-owner] │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Commands available in unattended mode:
send-ether
send-erc20
send-erc721
send-custom
tx-builder
version
Use the --help option of each command to see the usage options.
```
positional arguments:
address The address of the Safe, or an owner address if --get-safes-from-owner is specified.
node_url Ethereum node url
To execute transactions unattended, or execute transactions from a json exported from the tx_builder you can use:
options:
-h, --help show this help message and exit
-v, --version Show program's version number and exit.
--history Enable history. By default it's disabled due to security reasons
--get-safes-from-owner
Indicates that address is an owner (Safe Transaction Service is required for this feature)
```bash
safe-cli send-ether 0xsafeaddress https://sepolia.drpc.org 0xtoaddress wei-amount --private-key key1 --private-key key1 --private-key keyN
safe-cli send-erc721 0xsafeaddress https://sepolia.drpc.org 0xtoaddress 0xtokenaddres id --private-key key1 --private-key key2 --private-key keyN
safe-cli send-erc20 0xsafeaddress https://sepolia.drpc.org 0xtoaddress 0xtokenaddres wei-amount --private-key key1 --private-key key2 --private-key keyN
safe-cli send-custom 0xsafeaddress https://sepolia.drpc.org 0xtoaddress value 0xtxdata --private-key key1 --private-key key2 --private-key keyN
safe-cli tx-builder 0xsafeaddress https://sepolia.drpc.org ./path/to/exported/tx-builder/file.json --private-key key1 --private-key keyN
```
### Safe-Creator
Expand Down Expand Up @@ -106,26 +129,6 @@ options:

```
### Safe-Runner
```bash
safe-runner send-ether 0xsafeaddress https://sepolia.drpc.org 0xtoaddress wei-amount --private-key key1 --private-key key1 --private-key keyN
safe-runner send-erc721 0xsafeaddress https://sepolia.drpc.org 0xtoaddress 0xtokenaddres id --private-key key1 --private-key key2 --private-key keyN
safe-runner send-erc20 0xsafeaddress https://sepolia.drpc.org 0xtoaddress 0xtokenaddres wei-amount --private-key key1 --private-key key2 --private-key keyN
safe-runner send-custom 0xsafeaddress https://sepolia.drpc.org 0xtoaddress value 0xtxdata --private-key key1 --private-key key2 --private-key keyN
safe-runner tx-builder 0xsafeaddress https://sepolia.drpc.org ./path/to/exported/tx-builder/file.json --private-key key1 --private-key keyN
```
It is possible to get help for each command separately using:
```bash
safe-runner command --help
```
Or list the available commands
```bash
safe-runner --help
```
## Safe{Core} API/Protocol
- [Safe Infrastructure](https://github.com/safe-global/safe-infrastructure)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ trezor = ["trezor==0.13.8"]
[project.scripts]
safe-cli = "safe_cli.main:main"
safe-creator = "safe_cli.safe_creator:main"
safe-runner = "safe_cli.safe_runner:main"

[project.urls]
Download = "https://github.com/gnosis/safe-cli/releases"
Expand Down
Loading

0 comments on commit ee7a27c

Please sign in to comment.