safe-global / safe-cli Goto Github PK
View Code? Open in Web Editor NEWCommand line utility for Safe
License: MIT License
Command line utility for Safe
License: MIT License
As a user of the Safe CLI, I would like to be able to change the threshold of a Safe
changeThreshold
transaction must be generated. That transaction must be signed and send with the minimum loaded owners to get to the current threshold of the SafeDescribe the bug
safe-creator fails to create safe
Expected behavior
to create a safe
Additional context
safe-cli v0.3.0
nethermind rpc v1.12.4
output.log
I would love to be able to enable and disable a modules on my Safe.
So I was expecting a binary app, with some config file somewhere that you can run without having to troubleshoot python.
python ...at least on ubuntu 18.04 is by default 2 or 3.6. You say you need to upgrade it...I have to search how to upgrade it because I don't use python for my shit.
Now besides python you also have some virtual env shit that I barely understand
and lastly, after installing everything you have some kind of app, that behaves like CLI but you have to enter inside it from a script !?
do you realise how hard it is for non-python developer to work with what you did here ? If you don't, then I'm telling you that this is just not usable.
Hi! Thanks for your work on the safe-cli, it's a super useful tool! I was wondering why it doesn't support Ropsten. Is that a permanent decision or are there any plans to support it?
I managed to use the script to deploy a Safe to Ropsten by changing the addresses in these lines:
# Support only Mainnet, Rinkeby, Goerli and Kovan
safe_contract_address = '0x34CfAC646f301356fAa8B21e94227e3583Fe3F5F'
proxy_factory_address = '0x76E2cFc1F5Fa8F6a5b3fC4c8F4788F0116861F9B'
callback_handler_address = '0xd5D82B6aDDc9027B22dCA772Aa68D5d74cdBdF44'
To addresses corresponding to instances of those contracts that I deployed to Ropsten. It worked as is, so I was curious whether there's a deeper reason not to support Ropsten.
Thank you!
This repo is absolutely awesome, congrats on your work!
It absolutely saved my life
To be more precise, I have a private network were I deployed the safe contracts from gnosis, then I wanted to have a front and I tried to use safe-react from gnosis but I couldn't get it to work with my private network...
Now my question is: are you planning on adding contract interactions to the CLI ? (like on the picture)
This will be really usefull
Just an another suggestion: when creating a safe, you should add the option to create it even if the address who does the Tx doesn't have funds, because this test is irrelevant on a private network with a gasPrice null
Cheers
Describe the bug
When trying to load the safe in a cli using safe-cli <checksummed_safe_address> <ethereum_node_url>
command, it fails with AttributeError: 'Safe' object has no attribute 'get_contract'
To Reproduce
Expected behavior
The safe loads fine
python safe_cli.py 0x942e4f830D25700412D0614Ae9dAd2220BBfc5F7 https://rinkeby.infura.io/v3/xxx
history
usage: [-h]
{show_cli_owners,load_cli_owners,unload_cli_owners,change_threshold,add_owner,remove_owner,change_master_copy,send_ether,send_erc20,get_threshold,get_nonce,get_owners,enable_module,disable_module,info,refresh}
...
: error: invalid choice: 'history' (choose from 'show_cli_owners', 'load_cli_owners', 'unload_cli_owners', 'change_threshold', 'add_owner', 'remove_owner', 'change_master_copy', 'send_ether', 'send_erc20', 'get_threshold', 'get_nonce', 'get_owners', 'enable_module', 'disable_module', 'info', 'refresh')
The tx history is still displayed though :)
First of all: thank you, this looks awesome!
It would be great if there were a way to add ABIs of contracts and send arbitrary transactions to them.
Create approveHash
command
Hi
I have a safe which requires only one out of the two owners to approve a transaction.
I'm trying to sign and post a safe tx using the safe-cli from one of the owner accounts, to the gnosis transaction service address here,
https://safe-transaction.mainnet.gnosis.io/api/v1/safes/{self.address}/multisig-transactions/
Currently the posted safe transaction shows up on the safe UI in the web app and I need to login to the safe webapp to manually execute it each time.
Is there a way for me to post my safe transaction from the command line such that it auto executes as soon as I post it to the transaction service, with out me having to manually execute it via the Safe web app UI?
since the transaction is already signed and posted by one of the owners I want it to auto execute directly.
A docker image should be created so that the app can really be portable
A way for an owner to sign for a safe transaction without the need of other owners to be loaded.
Other owners can load the signature for the transaction and add their own signature.
Once there are enough signatures for the transaction to be executed, an owner can submit the execution transaction to the network.
So the general idea is:
(The owner that created a proposed safe transaction could also sign for it themselves as a step number 1.5)
Currently, the owners need to share their keys on the same machine which defeats the purpose of a multisig wallet.
I build a failing txs by entering a non erc20 token address in send_erc20
. This crashed the cli.
I would expect an error or something "tx is malformed" or "tx will be failing"
0x9D2407C6b6c1C307AB54Adb01627Ba0845e3Cddf > send_erc20 0x9D2407C6b6c1C307AB54Adb01627Ba0845e3Cddf 0x9D2407C6b6c1C307AB54Adb01627Ba0845e3Cddf 100000000000000000000000000000000000000000000000000000000000000000000000
Traceback (most recent call last):
File "safe_cli.py", line 62, in <module>
args.func(args)
File "/Users/tobias/gnosis/safe-cli/prompt_parser.py", line 42, in send_erc20
safe_operator.send_erc20(args.address, args.token_address, args.value)
File "/Users/tobias/gnosis/safe-cli/safe_operator.py", line 204, in send_erc20
return self.execute_safe_transaction(token_address, 0, transaction['data'])
File "/Users/tobias/gnosis/safe-cli/safe_operator.py", line 318, in execute_safe_transaction
call_result = safe_tx.call(self.default_sender.address)
File "/Users/tobias/.virtualenvs/safe-cli/lib/python3.7/site-packages/gnosis/safe/safe_tx.py", line 195, in call
raise InvalidInternalTx('Success bit is %d, should be equal to 1' % success)
gnosis.safe.exceptions.InvalidInternalTx: Success bit is 0, should be equal to 1
Sign transactions present on the safe transaction service
Hello,
I had a problem right here and i don't know how to solve it.
How I could send BUSD from an account to another using cli ?
Describe the bug
I am attempting to use safe contracts I have deployed on a private subnet on the avalanche network. I am able to successfully create a safe and send funds to it. However when I am attempting to interact with the safe (eg. add owner) I am getting the following error.
web3.exceptions.ValidationError: The transaction declared chain ID -1, but the connected node is on 335
There may be an obvious way to configure the chainID on the CLI that I am not seeing in the documentation, or something else is going on.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expected the transaction to be sent to the RPC
Additional context
Our chain ID 335 is not a supported gnosis safe chain yet.
As a user of the Safe CLI, I would like to see the info of a Safe when it's loaded in the CLI
When a Safe is loaded with the CLI, something similar to this should appear:
Loaded safe with address 0x984C2bECbdA3F304ad146F70299e5cDE7B0afBE6
Gnosis-py
library provides all the resources to get that information: https://github.com/gnosis/gnosis-py/blob/master/gnosis/safe/safe.py
I would love to be able to use the safe-cli with Safes with more than 1 owner and threshold > 1 :)
A command drain
that can be use to transfer all the ether
and tokens
to the provided address
.
Be able to list, add and remove delegates from the Safe CLI through the transaction-service.
I recently found out about the delegates features in the Safe Transaction Service. However, I didn't find an easy way to set it apart from manually crafting the http payload and signing. I was needing it for a use case where I don't want to expose a private key of an owner from a backend service.
I forked the repo and wrote an implementation https://github.com/abarmat/safe-cli/commits/manage-delegates for my own use. It is something that you might want to include, not sure if it was a planned feature.
I would love to see ERC20 token interactions (Transfer, Approval) in the dataDecoded
column of the history
command
Take a look at https://github.com/gnosis/safe-deployments/tree/main/src/assets/v1.3.0
Describe the bug
Hi, A gnosis developer said to use safe-cli to access funds in the event the website is down. I cannot get safe-cli to install properly on Windows. Is this intended/supported for Windows?
To Reproduce
install git bash, visual c++ runtime library, notepad++, 7zip
git clone https://github.com/gnosis/safe-cli.git
cd safe-cli
stat venv 2>/dev/null || python -m venv venv
source venv/bin/activate && pip install -r requirements.txt
This last line errors due to no "bin" folder on windows, so I changed the line to:
source venv/Scripts/activate && pip install -r requirements.txt
After changing to Scripts rather than bin, I see this message:
I see message "c1: fatal error C1083: Cannot open source file: 'src/libethash/io_win32.c'"
Before getting to this point, I had,10+ errors where I had to use pip install to install something not present, and had to get two wheel files.
Expected behavior
To finish the install without error.
I would love to be able to load an owner by entering a 12 word seed phrase.
Enhancement:
I would love to be able to optionally specify and account index which is used to derive the private key. :)
As a user of the Safe CLI, I would like to be able to sign and submit Safe transactions
Account.privateKeyToAccount
from python package eth_account
can be used to achieve thatbalance > 0
that owner will be set as the default sender of the Safe transactions.You should add the option to create a safe even without funds when the network has a gasPrice null
Describe the bug
I can't create a safe on a private network where the gasPrice is null because the account doesn't have funds (even if not needed)
It is irrelevant to test if the account have enough funds to do the Tx on a private network where the gasPrice is null
To Reproduce
Steps to reproduce the behavior:
If I imagine to use the cli instead of etherscan when checking out a Safe address, I felt like i was missing:
When I load a Safe, e.g. python safe_cli.py 0x9D2407C6b6c1C307AB54Adb01627Ba0845e3Cddf https://rinkeby.infura.io/v3/
It takes for me several seconds until the cli is opened. I assume that RPC calls are made to load all required info.
Would it make sense to show either a loading bar or some verbose output what info is current pulled? That would give me the feeling that something is in the works. Otherwise I'm unsure if it's maybe blocked.
After approving the TRX hash, how to execute it by CLI
Thanks
After source venv/bin/activate && pip install -r requirements.txt there is a bug!
Describe the bug
When sending to tx-service, delegates don't sign the request, causing it to fail.
To Reproduce
send_custom
) with --tx-service
(after running tx-service
)Error posting transaction: b'{"signature":["This field may not be null."]}'
Expected behavior
You should be able to send txs to the safe transaction service with a delegate.
Additional context
It works correctly if I comment out this line:
Unfortunately, this would break if you load non-owner and non-delegate addresses.
Basic:
ENS
address assignedAdvanced:
I would love to see the list of enabled modules on my Safe incl. some meta info such as module address, name etc.
Describe the bug
I am trying to pull funds accidentally sent to another blockchain. I have deployed a safe contract on Ethereum and now I am trying to make a send_erc20 transaction. And when trying to send I am getting this error: "err: max fee per gas less than block base fee", but there are no options for setting custom gas fee via this command.
Command must use MultiSend
to also update the FallbackHandler
Context
Hi
I have a private network with a gasPrice null. I successfully deployed the safe contracts on it
Then I modified the contract addresses in safe_addresses.py
I have been able to create a safe, informations on the safe are correctly displayed (threshold, signers, funds, etc), but I can't send funds from the safe to an another address
Describe the bug
I can't send funds from the safe to an another address with: send_ether <to> <value>
Error:
Traceback (most recent call last):
File "/home/test/safe-cli/safe_cli.py", line 140, in <module>
safe_cli.loop()
File "/home/test/safe-cli/safe_cli.py", line 128, in loop
self.prompt_parser.process_command(command)
File "/home/test/safe-cli/safe_cli/prompt_parser.py", line 173, in process_command
return args.func(args)
File "/home/test/safe-cli/safe_cli/prompt_parser.py", line 79, in wrapper
return function(*args, **kwargs)
File "/home/test/safe-cli/safe_cli/prompt_parser.py", line 241, in send_ether
safe_operator.send_ether(args.to, args.value, safe_nonce=args.safe_nonce)
File "/home/test/safe-cli/safe_cli/safe_operator.py", line 483, in send_ether
return self.send_custom(to, value, b"", **kwargs)
File "/home/test/safe-cli/safe_cli/safe_operator.py", line 478, in send_custom
return self.execute_safe_transaction(
File "/home/test/safe-cli/safe_cli/safe_operator.py", line 761, in execute_safe_transaction
tx_hash, tx = safe_tx.execute(
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/gnosis/safe/safe_tx.py", line 400, in execute
self.tx_hash = self.ethereum_client.send_unsigned_transaction(
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/gnosis/eth/ethereum_client.py", line 1782, in send_unsigned_transaction
return self.send_raw_transaction(signed_tx.rawTransaction)
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/gnosis/eth/ethereum_client.py", line 140, in with_exception_handling
return func(*args, **kwargs)
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/gnosis/eth/ethereum_client.py", line 1731, in send_raw_transaction
return self.w3.eth.send_raw_transaction(bytes(raw_transaction))
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/eth.py", line 698, in send_raw_transaction
return self._send_raw_transaction(transaction)
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/manager.py", line 186, in request_blocking
response = self._make_request(method, params)
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/manager.py", line 147, in _make_request
return request_func(method, params)
File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/middleware/formatting.py", line 76, in apply_formatters
response = make_request(method, params)
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/middleware/gas_price_strategy.py", line 90, in middleware
return make_request(method, params)
File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/middleware/formatting.py", line 74, in apply_formatters
response = make_request(method, formatted_params)
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/middleware/attrdict.py", line 33, in middleware
response = make_request(method, params)
File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/middleware/formatting.py", line 76, in apply_formatters
response = make_request(method, params)
File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/middleware/formatting.py", line 76, in apply_formatters
response = make_request(method, params)
File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/middleware/formatting.py", line 74, in apply_formatters
response = make_request(method, formatted_params)
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/middleware/buffered_gas_estimate.py", line 40, in middleware
return make_request(method, params)
File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/middleware/formatting.py", line 76, in apply_formatters
response = make_request(method, params)
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/middleware/exception_retry_request.py", line 105, in middleware
return make_request(method, params)
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/providers/rpc.py", line 88, in make_request
raw_response = make_post_request(
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/web3/_utils/request.py", line 49, in make_post_request
response.raise_for_status()
File "/home/test/safe-cli/venv/lib/python3.9/site-packages/requests/models.py", line 960, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url
To Reproduce
Steps to reproduce the behavior:
I would like to be able to show all non-zero balances of supported ERC20 tokens .
Problem accessing Polygon Safes with Gnosis CLI
When accessing a gnosis safe on the polygon network, Safe_cli returns 403.
To Reproduce
Try safe 0x3a04102Ed4a9f1468a6E3b606C8423015946b58C
python safe_cli.py 0x3a04102Ed4a9f1468a6E3b606C8423015946b58C https://polygon-mainnet.infura.io/v3/(...)
Expected behavior
On mainnet this same safe loads without error. On polygon it throws 403.
Additional context
This was a deployment of a version 1.1.1 safe, and cli is required since UX doesn-t support this safe version in polygon.
When I want to execute info
, I get the following error:
> info
usage: [-h]
{show_cli_owners,load_cli_owners,unload_cli_owners,change_threshold,add_owner,remove_owner,change_master_copy,send_ether,send_erc20,get_threshold,get_nonce,get_owners}
...
: error: invalid choice: 'info' (choose from 'show_cli_owners', 'load_cli_owners', 'unload_cli_owners', 'change_threshold', 'add_owner', 'remove_owner', 'change_master_copy', 'send_ether', 'send_erc20', 'get_threshold', 'get_nonce', 'get_owners')
(I'm on the up-to-date master branch with a mainnet safe loaded. No owner loaded.)
Currently the only way to use the safe-cli
is using the interactive mode. For example, to send some ether a user must run the app, load the owners and then call send_ether
and press intro.
An automatic way to do it, like python safe_cli --node <node_url> --private-key <owner_private_key_1> --private-key <owner_private_key_2> send-ether --wei <ether_in_wei> --to <address>
Feature request:
When checking out a Safe, it would be great to have a command like "info" or so, that just prints out network, mastercopy, owners, balance, nonce.
I know all this is in the footer, but that's cut off.
I also wouldn't mind if all this is printed out once after the Safe was loaded :)
I have python3.7.7 installed and get this error:
ImportError: cannot import name 'cached_property' from 'functools' (/Users/tobias/.virtualenvs/safe-cli/lib/python3.7/functools.py)
Seems like cached_property isn't available in python < 3.8: https://docs.python.org/3.7/library/functools.html
I've deployed the v1.1.1 contracts to the Volta testnet using Truffle (yarn truffle deploy
)
volta: {
provider: () => {
return new HDWalletProvider(mnemonic, 'https://volta-rpc.energyweb.org')
},
network_id: '73799',
gasPrice: 1
}
and verified on the Volta block explorer (links included).
GnosisSafeProxyFactory: 0x15cbA3FCAa2D1A03fD84D10D2F290e74535E3d7B
CreateAndAddModules: 0xCde77B42c294e293eA64492aA3cB836396E491eb
MultiSend: 0x8311e46d637607E42fBd595DD2fDff130a94110e
GnosisSafe: 0xA0232BAab476eE456446f25585A696E35942b657
StateChannelModule: 0x7d6FCA9ceA7d3C14d6acEE43DCD91A3aa2b701eB
DailyLimitModule: 0xe490bA5F4a65CE92826DF20d76591146717Fa8B6
SocialRecoveryModule: 0x88e7F8aC4057e5e175119d8bf881E3B63bb403Bd
WhitelistModule: 0x1aE4Ce2E4F93F81d490F922829fc3376F03B9a5C
After deploying the contracts, I try connecting to them using the CLI, but run into the following error:
(venv) ➜ safe-cli git:(master) ✗ python safe_cli.py 0xA0232BAab476eE456446f25585A696E35942b657 https://volta-rpc.energyweb.org
____ _ ____ __ ____ _ ___
/ ___|_ __ ___ ___(_)___ / ___| __ _ / _| ___ / ___| | |_ _|
| | _| '_ \ / _ \/ __| / __| \___ \ / _` | |_ / _ \ | | | | | |
| |_| | | | | (_) \__ \ \__ \ ___) | (_| | _| __/ | |___| |___ | |
\____|_| |_|\___/|___/_|___/ |____/ \__,_|_| \___| \____|_____|___|
Loading Safe information...
Traceback (most recent call last):
File "safe_cli.py", line 28, in <module>
safe_operator.print_info()
File "/Users/bagaricj/Code/safe-cli/safe_cli/safe_operator.py", line 410, in print_info
for key, value in dataclasses.asdict(self.safe_cli_info).items():
File "/Users/bagaricj/Code/safe-cli/safe_cli/safe_operator.py", line 129, in safe_cli_info
self._safe_cli_info = self.refresh_safe_cli_info()
File "/Users/bagaricj/Code/safe-cli/safe_cli/safe_operator.py", line 155, in refresh_safe_cli_info
self._safe_cli_info = self.get_safe_cli_info()
File "/Users/bagaricj/Code/safe-cli/safe_cli/safe_operator.py", line 438, in get_safe_cli_info
safe_info = safe.retrieve_all_info()
File "/Users/bagaricj/Code/safe-cli/venv/lib/python3.8/site-packages/gnosis/safe/safe.py", line 538, in retrieve_all_info
results = self.ethereum_client.batch_call([
File "/Users/bagaricj/Code/safe-cli/venv/lib/python3.8/site-packages/gnosis/eth/ethereum_client.py", line 820, in batch_call
return self.batch_call_custom(payloads, raise_exception=raise_exception, block_identifier=block_identifier)
File "/Users/bagaricj/Code/safe-cli/venv/lib/python3.8/site-packages/gnosis/eth/ethereum_client.py", line 786, in batch_call_custom
raise ValueError(f'Errors returned {errors}')
ValueError: Errors returned ["`getOwners`: {'code': -32015, 'message': 'VM execution error.', 'data': 'Bad instruction fe'}"]
Am I doing something wrong? Did I miss some initialization?
I would like to be able to call https://safe-transaction.gnosis.io/owners/{address}/safes/
via a cli command
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.