def create_and_deploy_contract(self, contract_id, public_key, contract_code, initial_balance): actions = [ transactions.create_create_account_action(), transactions.create_transfer_action(initial_balance), transactions.create_deploy_contract_action(contract_code)] + \ ([transactions.create_full_access_key_action(public_key)] if public_key is not None else []) return self._sign_and_submit_tx(contract_id, actions)
def create_deploy_and_init_contract(self, contract_id, public_key, contract_code, initial_balance, args, gas=DEFAULT_ATTACHED_GAS, init_method_name="new"): args = json.dumps(args).encode('utf8') actions = [ transactions.create_create_account_action(), transactions.create_transfer_action(initial_balance), transactions.create_deploy_contract_action(contract_code), transactions.create_function_call_action(init_method_name, args, gas, 0)] + \ ([transactions.create_full_access_key_action(public_key)] if public_key is not None else []) return self._sign_and_submit_tx(contract_id, actions)
def create_account(self, account_id, public_key, initial_balance): actions = [ transactions.create_create_account_action(), transactions.create_full_access_key_action(public_key), transactions.create_transfer_action(initial_balance)] return self._sign_and_submit_tx(account_id, actions)
def send_money(self, account_id, amount): """Sends funds to given account_id given amount.""" return self._sign_and_submit_tx(account_id, [transactions.create_transfer_action(amount)])