def _deploy_score(self, path: str, score_name: str, owner: 'Address', to: 'Address', deploy_params: dict):
     timestamp = int(time.time()*10**6)
     tx1 = self._make_deploy_tx(path, score_name, owner, to, deploy_params, timestamp)
     score_address = generate_score_address(owner, timestamp, nonce=0)
     tx_hash = tx1['params']['txHash']
     self._make_directory_using_address_and_hash(score_address, tx_hash)
     return tx1
示例#2
0
    def _create_deploy_score_tx(self,
                                score_root: str,
                                score_name: str,
                                from_: Union['EOAAccount', 'Address', None],
                                to_: Union['EOAAccount', 'Address'],
                                deploy_params: dict) -> dict:
        addr_from: Optional['Address'] = self._convert_address_from_address_type(from_)
        addr_to: 'Address' = self._convert_address_from_address_type(to_)

        timestamp = int(time.time() * 10 ** 6)
        tx: dict = self.create_deploy_score_tx(score_root=score_root,
                                               score_name=score_name,
                                               from_=addr_from,
                                               to_=addr_to,
                                               deploy_params=deploy_params,
                                               timestamp_us=timestamp)
        score_address: 'Address' = generate_score_address(addr_from, timestamp, nonce=0)
        tx_hash: bytes = tx['params']['txHash']
        self._make_directory_using_address_and_hash(score_address, tx_hash)
        return tx