Exemplo n.º 1
0
 def publish_module(self, address_or_refid, module_file):
     account = self.address_or_refid_to_account(address_or_refid)
     code = get_code_by_filename(module_file)
     payload = TransactionPayload('Module', Module(code))
     return self.grpc_client.submit_payload(account,
                                            payload,
                                            is_blocking=True)
Exemplo n.º 2
0
 def create_account(self, sender_account, fresh_address, auth_key_prefix,
                    **kwargs):
     return self.mint_coins(fresh_address, auth_key_prefix, 1, **kwargs)
     # create_account script no longer exsits.
     script = Script.gen_create_account_script(fresh_address,
                                               auth_key_prefix)
     payload = TransactionPayload('Script', script)
     return self.submit_payload(sender_account, payload, **kwargs)
Exemplo n.º 3
0
 def execute_script(self, address_or_refid, code_file, script_args):
     account = self.address_or_refid_to_account(address_or_refid)
     code = get_code_by_filename(code_file)
     arguments = [
         TransactionArgument.parse_as_transaction_argument(x)
         for x in script_args
     ]
     payload = TransactionPayload('Script', Script(code, arguments))
     self.grpc_client.submit_payload(account, payload, is_blocking=True)
Exemplo n.º 4
0
 def mint_coins_with_faucet_account(self,
                                    receiver_address,
                                    micro_libra,
                                    is_blocking=False):
     script = Script.gen_mint_script(receiver_address, micro_libra)
     payload = TransactionPayload('Script', script)
     return self.submit_payload(self.faucet_account,
                                payload,
                                is_blocking=is_blocking)
Exemplo n.º 5
0
 def remove_validator_with_faucet_account(self, validator_address,
                                          **kwargs):
     script = Script.gen_remove_validator_script(validator_address)
     payload = TransactionPayload('Script', script)
     return self.submit_payload(self.faucet_account, payload, **kwargs)
Exemplo n.º 6
0
 def rotate_authentication_key(self, sender_account, public_key, **kwargs):
     script = Script.gen_rotate_auth_key_script(public_key)
     payload = TransactionPayload('Script', script)
     return self.submit_payload(sender_account, payload, **kwargs)
Exemplo n.º 7
0
 def transfer_coin(self, sender_account, receiver_address, micro_libra,
                   **kwargs):
     script = Script.gen_transfer_script(receiver_address, micro_libra,
                                         **kwargs)
     payload = TransactionPayload('Script', script)
     return self.submit_payload(sender_account, payload, **kwargs)
Exemplo n.º 8
0
 def mint_coins_with_faucet_account(self, receiver_address, auth_key_prefix,
                                    micro_libra, **kwargs):
     script = Script.gen_mint_script(receiver_address, auth_key_prefix,
                                     micro_libra)
     payload = TransactionPayload('Script', script)
     return self.submit_payload(self.faucet_account, payload, **kwargs)
Exemplo n.º 9
0
 def create_account(self, sender_account, fresh_address):
     script = Script.gen_create_account_script(fresh_address)
     payload = TransactionPayload('Script', script)
     return self.submit_payload(sender_account, payload)
Exemplo n.º 10
0
                if expiration_time <= (usecs // 1000_000):
                    raise TransactionTimeoutError("Transaction expired.")
                if self.verbose:
                    print(".", end='', flush=True)
        raise TransactionTimeoutError("wait_for_transaction timeout.")

    def transfer_coin(self,
                      sender_account,
                      receiver_address,
                      micro_libra,
                      max_gas=140_000,
                      unit_price=0,
                      is_blocking=False,
                      txn_expiration=100):
        script = Script.gen_transfer_script(receiver_address, micro_libra)
        payload = TransactionPayload('Script', script)
        return self.submit_payload(sender_account, payload, max_gas,
                                   unit_price, is_blocking, txn_expiration)

    def create_account(self, sender_account, fresh_address):
        script = Script.gen_create_account_script(fresh_address)
        payload = TransactionPayload('Script', script)
        return self.submit_payload(sender_account, payload)

    def rotate_authentication_key(self, sender_account, public_key):
        script = Script.gen_rotate_auth_key_script(public_key)
        payload = TransactionPayload('Script', script)
        return self.submit_payload(sender_account, payload)

    def submit_payload(self,
                       sender_account,