Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dysbulic authored Oct 30, 2024
2 parents 73ea4e6 + ee83146 commit ebcb66c
Show file tree
Hide file tree
Showing 26 changed files with 75 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Create Ganache network
run: docker network create ganache
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[![PyPI version](https://badge.fury.io/py/safe-cli.svg)](https://badge.fury.io/py/safe-cli)
[![Build Status](https://github.com/safe-global/safe-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/safe-global/safe-cli/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/safe-global/safe-cli/badge.svg?branch=main)](https://coveralls.io/github/safe-global/safe-cli?branch=main)
![Python 3.9](https://img.shields.io/badge/Python-3.9-blue.svg)
![Python 3.10](https://img.shields.io/badge/Python-3.10-blue.svg)
![Python 3.11](https://img.shields.io/badge/Python-3.11-blue.svg)
![Python 3.12](https://img.shields.io/badge/Python-3.12-blue.svg)
Expand Down Expand Up @@ -30,7 +29,7 @@ docker run -it safeglobal/safe-cli safe-cli <checksummed_safe_address> <ethereum

## Using Python PIP

**Prerequisite:** [Python](https://www.python.org/downloads/) >= 3.9 (Python 3.12 is recommended).
**Prerequisite:** [Python](https://www.python.org/downloads/) >= 3.10 (Python 3.12 is recommended).

Once Python is installed on your system, run the following command to install Safe CLI:
```bash
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -27,7 +25,7 @@ dependencies = [
"prompt_toolkit>=3",
"pygments>=2",
"requests>=2",
"safe-eth-py==6.0.0b35",
"safe-eth-py>=6.0.0b41",
"tabulate>=0.8",
"typer==0.12.5",
]
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-r requirements.txt
coverage==7.6.3
coverage==7.6.4
flake8==7.1.1
pytest==8.3.3
pytest-sugar==1.0.0
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ colorama==0.4.6
hexbytes==0.3.1
ledgereth==0.9.1
packaging>=23.1
prompt_toolkit==3.0.47
prompt_toolkit==3.0.48
pygments==2.18.0
requests==2.32.3
safe-eth-py==6.0.0b35
safe-eth-py==6.0.0b41
tabulate==0.9.0
trezor==0.13.9
typer==0.12.5
Expand Down
2 changes: 1 addition & 1 deletion src/safe_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "1.3.0"
VERSION = "1.4.0"
11 changes: 5 additions & 6 deletions src/safe_cli/operators/hw_wallets/hw_wallet_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
from eth_typing import ChecksumAddress
from hexbytes import HexBytes
from prompt_toolkit import HTML, print_formatted_text
from web3.types import TxParams, Wei

from gnosis.eth import TxSpeed
from gnosis.eth.eip712 import eip712_encode, eip712_encode_hash
from gnosis.safe import SafeTx
from gnosis.safe.safe_signature import (
from safe_eth.eth import TxSpeed
from safe_eth.eth.eip712 import eip712_encode, eip712_encode_hash
from safe_eth.safe import SafeTx
from safe_eth.safe.safe_signature import (
SafeSignature,
SafeSignatureEOA,
SafeSignatureEthSign,
)
from web3.types import TxParams, Wei

from .hw_wallet import HwWallet

Expand Down
3 changes: 1 addition & 2 deletions src/safe_cli/operators/hw_wallets/ledger_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
from ledgereth import create_transaction, sign_message, sign_typed_data_draft
from ledgereth.accounts import get_account_by_path
from ledgereth.comms import init_dongle
from safe_eth.safe.signatures import signature_to_bytes
from web3.types import TxParams

from gnosis.safe.signatures import signature_to_bytes

from .hw_wallet import HwWallet
from .ledger_exceptions import raise_ledger_exception_as_hw_wallet_exception

Expand Down
3 changes: 1 addition & 2 deletions src/safe_cli/operators/hw_wallets/trezor_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import rlp
from eth_typing import ChecksumAddress
from hexbytes import HexBytes
from safe_eth.safe.signatures import signature_split, signature_to_bytes
from trezorlib import tools
from trezorlib.client import TrezorClient, get_default_client
from trezorlib.ethereum import (
Expand All @@ -15,8 +16,6 @@
from trezorlib.ui import ClickUI
from web3.types import TxParams

from gnosis.safe.signatures import signature_split, signature_to_bytes

from .hw_wallet import HwWallet
from .trezor_exceptions import raise_trezor_exception_as_hw_wallet_exception

Expand Down
27 changes: 13 additions & 14 deletions src/safe_cli/operators/safe_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,29 @@
from hexbytes import HexBytes
from packaging import version as semantic_version
from prompt_toolkit import HTML, print_formatted_text
from web3 import Web3
from web3.contract import Contract
from web3.exceptions import BadFunctionCallOutput

from gnosis.eth import (
from safe_eth.eth import (
EthereumClient,
EthereumNetwork,
EthereumNetworkNotSupported,
TxSpeed,
)
from gnosis.eth.clients import EtherscanClient, EtherscanClientConfigurationProblem
from gnosis.eth.constants import NULL_ADDRESS, SENTINEL_ADDRESS
from gnosis.eth.contracts import (
from safe_eth.eth.clients import EtherscanClient, EtherscanClientConfigurationProblem
from safe_eth.eth.constants import NULL_ADDRESS, SENTINEL_ADDRESS
from safe_eth.eth.contracts import (
get_erc20_contract,
get_erc721_contract,
get_safe_V1_1_1_contract,
get_sign_message_lib_contract,
)
from gnosis.eth.eip712 import eip712_encode
from gnosis.eth.utils import get_empty_tx_params
from gnosis.safe import InvalidInternalTx, Safe, SafeOperationEnum, SafeTx
from gnosis.safe.api import TransactionServiceApi
from gnosis.safe.multi_send import MultiSend, MultiSendOperation, MultiSendTx
from gnosis.safe.safe_deployments import safe_deployments
from safe_eth.eth.eip712 import eip712_encode
from safe_eth.eth.utils import get_empty_tx_params
from safe_eth.safe import InvalidInternalTx, Safe, SafeOperationEnum, SafeTx
from safe_eth.safe.api import TransactionServiceApi
from safe_eth.safe.multi_send import MultiSend, MultiSendOperation, MultiSendTx
from safe_eth.safe.safe_deployments import safe_deployments
from web3 import Web3
from web3.contract import Contract
from web3.exceptions import BadFunctionCallOutput

from safe_cli.ethereum_hd_wallet import get_account_from_words
from safe_cli.operators.exceptions import (
Expand Down
19 changes: 9 additions & 10 deletions src/safe_cli/operators/safe_tx_service_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@
from eth_typing import ChecksumAddress
from hexbytes import HexBytes
from prompt_toolkit import HTML, print_formatted_text
from tabulate import tabulate

from gnosis.eth.contracts import get_erc20_contract
from gnosis.eth.eip712 import eip712_encode_hash
from gnosis.safe import SafeOperationEnum, SafeTx
from gnosis.safe.api import SafeAPIException
from gnosis.safe.api.transaction_service_api.transaction_service_messages import (
from safe_eth.eth.contracts import get_erc20_contract
from safe_eth.eth.eip712 import eip712_encode_hash
from safe_eth.safe import SafeOperationEnum, SafeTx
from safe_eth.safe.api import SafeAPIException
from safe_eth.safe.api.transaction_service_api.transaction_service_messages import (
get_remove_transaction_message,
)
from gnosis.safe.multi_send import MultiSend, MultiSendOperation, MultiSendTx
from gnosis.safe.safe_signature import SafeSignature
from gnosis.safe.signatures import signature_to_bytes
from safe_eth.safe.multi_send import MultiSend, MultiSendOperation, MultiSendTx
from safe_eth.safe.safe_signature import SafeSignature
from safe_eth.safe.signatures import signature_to_bytes
from tabulate import tabulate

from ..utils import get_input, yes_or_no_question
from . import SafeServiceNotAvailable
Expand Down
3 changes: 1 addition & 2 deletions src/safe_cli/prompt_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

from prompt_toolkit import HTML, print_formatted_text
from prompt_toolkit.formatted_text import html

from gnosis.safe.api import SafeAPIException
from safe_eth.safe.api import SafeAPIException

from .argparse_validators import (
check_ethereum_address,
Expand Down
3 changes: 1 addition & 2 deletions src/safe_cli/safe_addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from typing import Sequence

from eth_typing import ChecksumAddress

from gnosis.eth import EthereumClient
from safe_eth.eth import EthereumClient


def _get_valid_contract(
Expand Down
9 changes: 4 additions & 5 deletions src/safe_cli/safe_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
from eth_typing import URI
from hexbytes import HexBytes
from prompt_toolkit import print_formatted_text

from gnosis.eth import EthereumClient, EthereumTxSent
from gnosis.eth.constants import NULL_ADDRESS
from gnosis.eth.contracts import get_safe_V1_4_1_contract
from gnosis.safe import ProxyFactory, Safe
from safe_eth.eth import EthereumClient, EthereumTxSent
from safe_eth.eth.constants import NULL_ADDRESS
from safe_eth.eth.contracts import get_safe_V1_4_1_contract
from safe_eth.safe import ProxyFactory, Safe

from safe_cli.safe_addresses import (
get_default_fallback_handler_address,
Expand Down
5 changes: 2 additions & 3 deletions src/safe_cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

from eth_typing import ChecksumAddress
from prompt_toolkit import HTML, print_formatted_text

from gnosis.eth import EthereumClient
from gnosis.safe.api import TransactionServiceApi
from safe_eth.eth import EthereumClient
from safe_eth.safe.api import TransactionServiceApi


def get_erc_20_list(
Expand Down
5 changes: 2 additions & 3 deletions tests/safe_cli_test_case_mixin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from unittest import mock

from eth_account import Account

from gnosis.eth import EthereumClient, EthereumNetwork
from gnosis.safe.tests.safe_test_case import SafeTestCaseMixin
from safe_eth.eth import EthereumClient, EthereumNetwork
from safe_eth.safe.tests.safe_test_case import SafeTestCaseMixin

from safe_cli.operators import SafeOperator, SafeOperatorMode, SafeTxServiceOperator

Expand Down
5 changes: 2 additions & 3 deletions tests/test_hw_wallet_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
from hexbytes import HexBytes
from ledgerblue.Dongle import Dongle
from ledgereth import SignedTransaction

from gnosis.safe import SafeTx
from gnosis.safe.tests.safe_test_case import SafeTestCaseMixin
from safe_eth.safe import SafeTx
from safe_eth.safe.tests.safe_test_case import SafeTestCaseMixin

from safe_cli.operators.hw_wallets.hw_wallet_manager import (
HwWalletManager,
Expand Down
9 changes: 4 additions & 5 deletions tests/test_ledger_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
LedgerNotFound,
)
from ledgereth.objects import LedgerAccount, SignedMessage, SignedTransaction

from gnosis.eth.eip712 import eip712_encode
from gnosis.safe import SafeTx
from gnosis.safe.signatures import signature_split
from gnosis.safe.tests.safe_test_case import SafeTestCaseMixin
from safe_eth.eth.eip712 import eip712_encode
from safe_eth.safe import SafeTx
from safe_eth.safe.signatures import signature_split
from safe_eth.safe.tests.safe_test_case import SafeTestCaseMixin

from safe_cli.operators.exceptions import HardwareWalletException
from safe_cli.operators.hw_wallets.ledger_wallet import LedgerWallet
Expand Down
5 changes: 2 additions & 3 deletions tests/test_safe_addresses.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import unittest

from eth_account import Account

from gnosis.eth import EthereumClient
from gnosis.eth.tests.utils import just_test_if_mainnet_node
from safe_eth.eth import EthereumClient
from safe_eth.eth.tests.utils import just_test_if_mainnet_node

from safe_cli.safe_addresses import (
_get_valid_contract,
Expand Down
3 changes: 1 addition & 2 deletions tests/test_safe_cli.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import unittest

from eth_account import Account
from safe_eth.safe import Safe
from web3 import Web3

from gnosis.safe import Safe

from safe_cli.operators import SafeCliTerminationException
from safe_cli.operators.safe_operator import SafeOperator
from safe_cli.prompt_parser import PromptParser
Expand Down
11 changes: 5 additions & 6 deletions tests/test_safe_cli_entry_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
import pytest
from eth_account import Account
from eth_typing import HexStr
from safe_eth.eth import EthereumClient
from safe_eth.eth.constants import NULL_ADDRESS
from safe_eth.safe import Safe
from safe_eth.safe.api import TransactionServiceApi
from safe_eth.safe.safe import SafeInfo
from typer.testing import CliRunner

from gnosis.eth import EthereumClient
from gnosis.eth.constants import NULL_ADDRESS
from gnosis.safe import Safe
from gnosis.safe.api import TransactionServiceApi
from gnosis.safe.safe import SafeInfo

from safe_cli import VERSION
from safe_cli.main import app
from safe_cli.operators.exceptions import (
Expand Down
3 changes: 1 addition & 2 deletions tests/test_safe_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from unittest.mock import MagicMock

from eth_account import Account

from gnosis.safe import Safe
from safe_eth.safe import Safe

from safe_cli.safe_creator import main

Expand Down
11 changes: 5 additions & 6 deletions tests/test_safe_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
from eth_typing import ChecksumAddress
from ledgerblue.Dongle import Dongle
from ledgereth.objects import LedgerAccount
from safe_eth.eth import EthereumClient
from safe_eth.eth.eip712 import eip712_encode
from safe_eth.safe import Safe
from safe_eth.safe.multi_send import MultiSend
from web3 import Web3
from web3.types import Wei

from gnosis.eth import EthereumClient
from gnosis.eth.eip712 import eip712_encode
from gnosis.safe import Safe
from gnosis.safe.multi_send import MultiSend

from safe_cli.contracts import safe_to_l2_migration
from safe_cli.operators.exceptions import (
AccountNotLoadedException,
Expand Down Expand Up @@ -64,7 +63,7 @@ def test_setup_operator(self):
self.assertEqual(len(safe.retrieve_owners()), number_owners)

@mock.patch(
"gnosis.safe.Safe.contract", new_callable=mock.PropertyMock, return_value=None
"safe_eth.safe.Safe.contract", new_callable=mock.PropertyMock, return_value=None
)
def test_load_cli_owner(self, get_contract_mock: MagicMock):
random_address = Account.create().address
Expand Down
9 changes: 4 additions & 5 deletions tests/test_safe_tx_service_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
from eth_account import Account
from hexbytes import HexBytes
from ledgereth.objects import LedgerAccount
from safe_eth.eth import EthereumClient
from safe_eth.safe import SafeTx
from safe_eth.safe.api import SafeAPIException, TransactionServiceApi
from web3 import Web3

from gnosis.eth import EthereumClient
from gnosis.safe import SafeTx
from gnosis.safe.api import SafeAPIException, TransactionServiceApi

from safe_cli.operators import SafeOperatorMode, SafeTxServiceOperator

from .mocks.balances_mock import balances_mock
Expand Down Expand Up @@ -122,7 +121,7 @@ def test_remove_delegate(self, remove_delegate_mock: MagicMock):
@mock.patch.object(TransactionServiceApi, "delete_transaction", return_value=None)
@mock.patch.object(TransactionServiceApi, "get_safe_transaction")
@mock.patch(
"gnosis.safe.api.transaction_service_api.transaction_service_messages.get_totp",
"safe_eth.safe.api.transaction_service_api.transaction_service_messages.get_totp",
return_value=8365,
)
def test_remove_transaction(
Expand Down
Loading

0 comments on commit ebcb66c

Please sign in to comment.