コード例 #1
0
ファイル: account.py プロジェクト: 48cfu/near-api-py
 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)
コード例 #2
0
ファイル: account.py プロジェクト: 48cfu/near-api-py
 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)
コード例 #3
0
ファイル: account.py プロジェクト: 48cfu/near-api-py
 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)
コード例 #4
0
ファイル: account.py プロジェクト: 48cfu/near-api-py
 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)])