Ejemplo n.º 1
0
    def setUpClass(cls):

        setup.use_keosd(False)
        #setup.set_nodeos_URL("88.99.97.30:38888")
        #wallet = eosf.Wallet("jungle_wallet2")
        account_master = eosf.AccountMaster()
        print(account_master.info())
Ejemplo n.º 2
0
    def test_local_testnet(self):
        setup.use_keosd(False)
        eosf.reset(is_verbose=0)
        eosf.stop(is_verbose=0)
        eosf.run(is_verbose=0)

        account_master = eosf.AccountMaster()
        print(account_master.info())
Ejemplo n.º 3
0
 def test_reopen_with_stored_password(self): 
     setup.use_keosd(False)
     eosf.reset(is_verbose=0)
     eosf.Wallet()
     eosf.stop(is_verbose=0)
     node.run(is_verbose=0)
     
     wallet = eosf.Wallet()
     self.assertTrue(wallet.error)
Ejemplo n.º 4
0
 def test_remote_testnet_existing_account(self):
     setup.use_keosd(True)
     setup.set_nodeos_URL("88.99.97.30:38888")
     
     account_master = eosf.AccountMaster(
         "nbhyi5exmjcl",
         "EOS6wAChSUxgHpUaG8bdCSKVFEMbmT85qnja1bh7zaWiYDp4sLW98",
         "EOS6wAChSUxgHpUaG8bdCSKVFEMbmT85qnja1bh7zaWiYDp4sLW98"
     )
     print(account_master.info())
Ejemplo n.º 5
0
 def test_invalid_password(self): 
     setup.use_keosd(False)
     eosf.reset(is_verbose=0)
     wallet = eosf.Wallet()
     eosf.stop(is_verbose=0)
     eosf.run(is_verbose=0)        
     
     wallet = eosf.Wallet(
         "default", "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV")
     self.assertTrue(wallet.error)
Ejemplo n.º 6
0
    def test_create_keosd_wallet(self):
        setup.use_keosd(True)
        cleos.WalletStop(is_verbose=0)
        wallet_name = "jungle_wallet"
        try:
            os.remove(eosf.wallet_dir() + wallet_name + ".wallet")
        except:
            pass

        setup.set_nodeos_URL(cryptolions)
        wallet = eosf.Wallet(wallet_name)
        self.assertTrue(not wallet.error)
Ejemplo n.º 7
0
# python3 ./tests/unittest3.py

import setup
import eosf
import node
import unittest
from termcolor import cprint

setup.set_verbose(True)
setup.set_json(False)
setup.use_keosd(False)

CONTRACT_NAME = "_e4b2ffc804529ce9c6fae258197648cc2"


class Test1(unittest.TestCase):
    def run(self, result=None):
        """ Stop after first error """
        if not result.failures:
            super().run(result)

    @classmethod
    def setUpClass(cls):
        testnet = node.reset()
        assert (not testnet.error)

        wallet = eosf.Wallet()
        assert (not wallet.error)

        account_master = eosf.AccountMaster()
        wallet.import_key(account_master)
Ejemplo n.º 8
0
 def setUpClass(cls):
     setup.set_verbose(True)
     setup.set_json(False)
     setup.use_keosd(False)
Ejemplo n.º 9
0
class TestSessionInit(unittest.TestCase):

    setup.set_verbose(False)
    setup.use_keosd(False)    

    def run(self, result=None):
        """ Stop after first error """      
        if not result.failures:
            super().run(result)


    @classmethod
    def setUpClass(cls):
        pass
        
    def setUp(self):
        pass


    def test_04(self):
        print("""
Start a local test EOSIO node:
        """)
        reset = eosf.reset()
        self.assertTrue(not reset.error)
        
        print("""
Create a local wallet (not with EOSIO `keosd` application):
        """)
        global wallet
        wallet = eosf.Wallet()
        self.assertTrue(not wallet.error)

        print("""
Implement the `eosio` master account as a `cleos.AccountMaster` object:
        """)
        global account_master
        account_master = eosf.AccountMaster()
        wallet.import_key(account_master)

        print("""
Create accounts `alice`, `bob` and `carol`:
        """)
        global alice
        alice = eosf.account()
        self.assertTrue(not alice.error)
        alice.account
        wallet.import_key(alice)

        global bob
        bob = eosf.account()
        self.assertTrue(not bob.error)
        wallet.import_key(bob)        

        global carol
        carol = eosf.account()
        self.assertTrue(not carol.error)
        wallet.import_key(carol)        


    def tearDown(self):
        pass

    @classmethod
    def tearDownClass(cls):
        pass
Ejemplo n.º 10
0
import setup
import eosf
from termcolor import cprint


setup.set_verbose(True)
setup.use_keosd(True)
setup.set_nodeos_URL("88.99.97.30:38888")  


def test():
    """
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5KftuwFePUSaqrq2d8ZcEtJZYQCsWPE5gyo6DMBEcSUeb646coy"
    """
    """
Use the following data to register a new account on a public testnet:
Accout Name: gpdwptppwhs3
Owner Public Key: EOS8Lg58cfq8sZswvj6jfMQfngsvHjiLuj6MpNna66PM1mUMPZiXd
Owner Private Key: 5KhXVUvYd5o3sGoZL8usGNBFauLsYTWtdmzHck1GTCVhNJhoAtJ
Active Public Key: EOS5z8pbMiugbJ5nSBxpQggqhwUFYmHwtxka9f5J8QKXBEn4xE3B6
Active Private Key: 5HuW65NGrGCQuRKz4SivsCA9JdENUcE91pFYB5TYNUkqm62VeRV
    """

    global account_master

    wallet_name = "default"
    wallet_pass = "******"
    
Ejemplo n.º 11
0
def test():

    wallet_name = "default"
    wallet_pass = "******"
    wallet = eosf.Wallet(wallet_name, wallet_pass)

    cprint(
        """
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5JhJKaibFbv1cg8sPQiCtiGLh5WP4FFWFeRqXANetKeA8XKn31N"
    """, 'magenta')

    wallet.index()
    wallet.keys()

    restored = wallet.restore_accounts(globals())

    return

    print()
    print(account_master.info())

    global account_alice

    if "account_alice" in restored:
        print(account_alice.info())
    else:

        cprint(
            """
./programs/cleos/cleos -u http://"dev.cryptolions.io:38888 system newaccount 
nbhyi5exmjcl ljzirxm1wy1n 
EOS6wAChSUxgHpUaG8bdCSKVFEMbmT85qnja1bh7zaWiYDp4sLW98 
EOS6wAChSUxgHpUaG8bdCSKVFEMbmT85qnja1bh7zaWiYDp4sLW98 
--buy-ram-kbytes 8 --stake-net '100 EOS' --stake-cpu '100 EOS' --transfer
        """, 'magenta')

        account_alice = eosf.account(account_master,
                                     stake_net="100 EOS",
                                     stake_cpu="100 EOS",
                                     buy_ram_kbytes="8",
                                     transfer=True)
        if (not account_alice.error):
            wallet.import_key(account_alice)

    account_test = eosf.account(account_master,
                                stake_net="10 EOS",
                                stake_cpu="10 EOS",
                                buy_ram_kbytes="8",
                                transfer=True)

    print(account_test.info())
    cprint(
        """
name: yeyuoae5rtcg
permissions:
    owner     1:    1 EOS8jeCrY4EjJtvcveuy1aK2aFv7rqhGAGvGLJ2Sodazmv2yyi2hm
    active     1:    1 EOS5PD28JPyHALuRPPJnm1oR83KxLFKvKkVXx9VrsLjLieHSLq35j
    """, 'magenta')

    wallet.open()
    wallet.unlock()
    wallet.import_key(account_test)

    return

    import setup
    import eosf
    import cleos

    setup.use_keosd(True)
    setup.set_nodeos_URL("dev.cryptolions.io:38888")

    wallet_name = "default"
    wallet_pass = "******"
    wallet = eosf.Wallet(wallet_name, wallet_pass)
    wallet.restore_accounts(globals())
    # print(account_alice.info())

    #     account_test = eosf.account(
    #                 account_master,
    #                 stake_net="10 EOS",
    #                 stake_cpu="10 EOS",
    #                 buy_ram_kbytes="8",
    #                 transfer=True)

    #     print(account_test.info())
    #     cprint("""
    # name: yeyuoae5rtcg
    # permissions:
    #     owner     1:    1 EOS8jeCrY4EjJtvcveuy1aK2aFv7rqhGAGvGLJ2Sodazmv2yyi2hm
    #     active     1:    1 EOS5PD28JPyHALuRPPJnm1oR83KxLFKvKkVXx9VrsLjLieHSLq35j
    #     """, 'magenta')

    #     wallet.open()
    #     wallet.unlock()
    #     wallet.import_key(account_test)

    contract_test = eosf.Contract(
        account_test,
        "/mnt/c/Workspaces/EOS/eosfactory/contracts/xs_and_os/test/../build/",
        dont_broadcast=True,
        is_verbose=False).deploy()
    import json
    print(json.dumps(contract_test.json, indent=4))
Ejemplo n.º 12
0
    def test_is_not_running_not_keosd_set(self):
        setup.use_keosd(False)
        eosf.stop(is_verbose=0)

        with self.assertRaises(Exception):
            eosf.AccountMaster()
Ejemplo n.º 13
0
    def test_remote_testnet_new_account(self):
        setup.use_keosd(True)
        setup.set_nodeos_URL("88.99.97.30:38888")

        account_master = eosf.AccountMaster()
        print()
Ejemplo n.º 14
0
 def test_is_not_running_not_keosd_set(self):
     setup.use_keosd(False)
     eosf.stop(is_verbose=0)
     
     wallet = eosf.Wallet()
     self.assertTrue(wallet.error)