API docs

class ape_safe.ApeSafe(address, base_url=None, multisend=None)

Bases: gnosis.safe.safe.Safe

property account: brownie.network.account.LocalAccount

Unlocked Brownie account for Gnosis Safe.

confirmations_to_signatures(confirmations: List[Dict]) bytes

Convert confirmations as returned by the transaction service to combined signatures.

contract(address) brownie.network.contract.Contract

Instantiate a Brownie Contract owned by Safe account.

estimate_gas(safe_tx: gnosis.safe.safe_tx.SafeTx) int

Estimate gas limit for successful execution.

execute_transaction(safe_tx: gnosis.safe.safe_tx.SafeTx, signer=None) brownie.network.transaction.TransactionReceipt

Execute a fully signed transaction likely retrieved from the pending_transactions method.

execute_transaction_with_frame(safe_tx: gnosis.safe.safe_tx.SafeTx, frame_rpc='http://127.0.0.1:1248') bytes

Execute a fully signed transaction with frame. Use this option with hardware wallets.

get_signer(signer: Optional[Union[brownie.network.account.LocalAccount, str]] = None) brownie.network.account.LocalAccount
multisend_from_receipts(receipts: Optional[List[brownie.network.transaction.TransactionReceipt]] = None, safe_nonce: Optional[int] = None) gnosis.safe.safe_tx.SafeTx

Convert multiple Brownie transaction receipts (or history) to a multisend Safe transaction.

pending_nonce() int

Subsequent nonce which accounts for pending transactions in the transaction service.

property pending_transactions: List[gnosis.safe.safe_tx.SafeTx]

Retrieve pending transactions from the transaction service.

post_signature(safe_tx: gnosis.safe.safe_tx.SafeTx, signature: bytes)

Submit a confirmation signature to a transaction service.

post_transaction(safe_tx: gnosis.safe.safe_tx.SafeTx)

Submit a Safe transaction to a transaction service. Prompts for a signature if needed.

See also https://github.com/gnosis/safe-cli/blob/master/safe_cli/api/gnosis_transaction.py

preview(safe_tx: gnosis.safe.safe_tx.SafeTx, events=True, call_trace=False, reset=True)

Dry run a Safe transaction in a forked network environment.

preview_pending(events=True, call_trace=False)

Dry run all pending transactions in a forked environment.

sign_transaction(safe_tx: gnosis.safe.safe_tx.SafeTx, signer=None) gnosis.safe.safe_tx.SafeTx

Sign a Safe transaction with a private key account.

sign_with_frame(safe_tx: gnosis.safe.safe_tx.SafeTx, frame_rpc='http://127.0.0.1:1248') bytes

Sign a Safe transaction using Frame. Use this option with hardware wallets.

sign_with_trezor(safe_tx: gnosis.safe.safe_tx.SafeTx, derivation_path: str = "m/44'/60'/0'/0/0", use_passphrase: bool = False, force_eth_sign: bool = False) bytes

Sign a Safe transaction with a Trezor wallet.

Defaults to no passphrase (and skips passphrase prompt) by default. Uses on-device passphrase input if use_passphrase is truthy

Defaults to EIP-712 signatures on wallets & fw revisions that support it: - TT fw >v2.4.3 (clear signing only) - T1: not yet, and maybe only blind signing Otherwise (or if force_eth_sign is truthy), use eth_sign instead

tx_from_receipt(receipt: brownie.network.transaction.TransactionReceipt, operation: gnosis.safe.safe.SafeOperation = SafeOperation.CALL, safe_nonce: Optional[int] = None) gnosis.safe.safe_tx.SafeTx

Convert Brownie transaction receipt to a Safe transaction.

exception ape_safe.ApiError

Bases: Exception

exception ape_safe.ExecutionFailure

Bases: Exception