Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
moisses89 committed Feb 1, 2024
1 parent 0d351d2 commit 6315aa1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ There are 2 operation modes:
- `get_delegates`: Returns a list of **delegates** for the Safe. A **delegate** can be used when you **trust an address to post transactions to the tx-service on your behalf**. If a transaction is not trusted (posted to the service not signed by a delegate or an owner of the Safe) it will be stored in the service but not shown in the UI or mobile applications.
- `add_delegate <address> <label> <owner-address>`: Adds a new delegate `address` for the `owner` of the Safe.
- `remove_delegate <address> <owner-address>`: Removes a delegate `address` from the Safe.
- `remove_proposed_transaction <safe_tx_hsh>`: Removes a proposed transaction with the sign of the account that proposed the transaction.
- `drain <address>`: Sends all Ether and ERC20 funds to the provided account. **WARNING: DON'T USE THIS IF YOU DON'T KNOW WHAT YOU ARE DOING. ALL YOUR FUNDS COULD BE LOST**

If the information in the information bar is outdated or there's any problem you can force the `safe-cli` to update the information about the Safe using:
Expand Down
18 changes: 12 additions & 6 deletions safe_cli/operators/hw_wallets/hw_wallet_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ def delete_accounts(self, addresses: List[ChecksumAddress]) -> Set:
self.wallets = self.wallets.difference(accounts_to_remove)
return accounts_to_remove

def sign_eip712(self, eip712_message: Dict, wallets: List[HwWallet]):
def sign_eip712(self, eip712_message: Dict, wallets: List[HwWallet]) -> HexBytes:
"""
Sign a eip712 message
:param eip712_message:
:param wallets:
:return: Appended sorted signatures for all the provided wallets
"""
encode_hash = eip712_encode(eip712_message)
eip712_message_hash = eip712_encode_hash(eip712_message)
domain_hash = encode_hash[1]
Expand All @@ -135,12 +142,11 @@ def sign_eip712(self, eip712_message: Dict, wallets: List[HwWallet]):

def sign_safe_tx(self, safe_tx: SafeTx, wallets: List[HwWallet]) -> SafeTx:
"""
Sign a safeTx EIP-712 hashes with supported hw wallet devices
Sign a safe transaction with the provided hardware wallets
:param domain_hash:
:param message_hash:
:param wallets: list of HwWallet
:return: signed safeTx
:param safe_tx:
:param wallets:
:return: SafeTx with signature.
"""
signatures = self.sign_eip712(safe_tx.eip712_structured_data, wallets)
safe_tx.signatures = signatures
Expand Down
5 changes: 5 additions & 0 deletions safe_cli/operators/safe_tx_service_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,11 @@ def drain(self, to: ChecksumAddress):
def search_account(
self, address: ChecksumAddress
) -> Optional[Union[LocalAccount, HwWallet]]:
"""
Search the provided address between loaded owners
:param address:
:return: LocalAccount or HwWallet of the provided address
"""
eoa_account = [
account for account in self.accounts if account.address == address
]
Expand Down
2 changes: 1 addition & 1 deletion safe_cli/safe_completer_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"current loaded safe."
),
"remove_proposed_transaction": HTML(
"Command <b>remove_proposed_transaction</b> will proposed not executed transaction for "
"Command <b>remove_proposed_transaction</b> will remove proposed not executed transaction for "
"provided<u>&lt;safe-tx-hash&gt;</u>"
),
"enable_module": HTML(
Expand Down

0 comments on commit 6315aa1

Please sign in to comment.