Esempio n. 1
0
    def decode_transaction_data(self, contract: Contract = None, registry=None) -> Tuple[ContractFunction, Dict[str, Any]]:
        if self.data:
            if not contract:
                agent = ContractAgency.get_agent(MultiSigAgent, registry=registry)
                blockchain = agent.blockchain

                name, version, address, abi = registry.search(contract_address=self.target_address)
                contract = blockchain.client.w3.eth.contract(abi=abi,
                                                             address=address,
                                                             version=version,
                                                             ContractFactoryClass=blockchain._CONTRACT_FACTORY)
            contract_function, params = contract.decode_function_input(self.data)
            return contract_function, params
        else:
            raise ValueError("This proposed TX doesn't have data")