コード例 #1
0
 def setUpClass(cls):
     nodelist = NodeList()
     nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(
         normal=True, appbase=True),
                                                num_retries=10))
     cls.bts = Steem(node=nodelist.get_nodes(appbase=False),
                     use_condenser=True,
                     nobroadcast=True,
                     unsigned=True,
                     keys={"active": wif},
                     num_retries=10)
     cls.appbase = Steem(node=nodelist.get_nodes(normal=False,
                                                 appbase=True),
                         nobroadcast=True,
                         unsigned=True,
                         keys={"active": wif},
                         num_retries=10)
     acc = Account("holger80", steem_instance=cls.bts)
     comment = acc.get_blog(limit=20)[-1]
     cls.authorperm = comment.authorperm
     [author, permlink] = resolve_authorperm(cls.authorperm)
     cls.author = author
     cls.permlink = permlink
     cls.category = comment.category
     cls.title = comment.title
コード例 #2
0
ファイル: test_wallet.py プロジェクト: svitx/beem
    def setUpClass(cls):
        stm = shared_steem_instance()
        stm.config.refreshBackup()
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(
            normal=True, appbase=True),
                                                   num_retries=10))

        cls.stm = Steem(
            node=nodelist.get_nodes(),
            nobroadcast=True,
            # We want to bundle many operations into a single transaction
            bundle=True,
            num_retries=10
            # Overwrite wallet to use this list of wifs only
        )
        cls.stm.set_default_account("test")
        set_shared_steem_instance(cls.stm)
        # self.stm.newWallet("TestingOneTwoThree")

        cls.wallet = Wallet(steem_instance=cls.stm)
        cls.wallet.wipe(True)
        cls.wallet.newWallet(pwd="TestingOneTwoThree")
        cls.wallet.unlock(pwd="TestingOneTwoThree")
        cls.wallet.addPrivateKey(wif)
コード例 #3
0
ファイル: hiveforpod.py プロジェクト: brianoflondon/pod2hive
def getHiveNodes():
    """ Return a list of hive node URLS """
    from beem.nodelist import NodeList
    nodelist = NodeList()
    nodelist.update_nodes()
    nodes = nodelist.get_hive_nodes()
    return nodes
コード例 #4
0
 def setUpClass(cls):
     nodelist = NodeList()
     nodelist.update_nodes(steem_instance=Steem(
         node=nodelist.get_nodes(normal=True, appbase=True), num_retries=3))
     cls.nodes = nodelist.get_nodes(https=False, appbase=False)
     cls.nodes_https = nodelist.get_nodes(wss=False, appbase=False)
     cls.nodes_appbase = nodelist.get_nodes(normal=False)
     cls.test_list = nodelist.get_nodes()
     cls.bts = Steem(node=cls.nodes,
                     nobroadcast=True,
                     keys={
                         "active": wif,
                         "owner": wif,
                         "memo": wif
                     },
                     num_retries=10)
     cls.appbase = Steem(node=cls.nodes_appbase,
                         nobroadcast=True,
                         keys={
                             "active": wif,
                             "owner": wif,
                             "memo": wif
                         },
                         num_retries=10)
     cls.rpc = SteemNodeRPC(urls=cls.test_list)
     # from getpass import getpass
     # self.bts.wallet.unlock(getpass())
     set_shared_steem_instance(cls.bts)
     cls.bts.set_default_account("test")
コード例 #5
0
ファイル: test_vote.py プロジェクト: oldas1/beem
    def setUpClass(cls):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(hive=True), num_retries=10))
        cls.bts = Steem(
            node=nodelist.get_nodes(hive=True),
            nobroadcast=True,
            keys={"active": wif},
            num_retries=10
        )
        # from getpass import getpass
        # self.bts.wallet.unlock(getpass())
        set_shared_steem_instance(cls.bts)
        cls.bts.set_default_account("test")

        acc = Account("fullnodeupdate", steem_instance=cls.bts)
        n_votes = 0
        index = 0
        entries = acc.get_blog_entries(limit=30)[::-1]
        while n_votes == 0:
            comment = Comment(entries[index], steem_instance=cls.bts)
            votes = comment.get_votes()
            n_votes = len(votes)
            index += 1

        last_vote = votes[0]

        cls.authorpermvoter = construct_authorpermvoter(last_vote['author'], last_vote['permlink'], last_vote["voter"])
        [author, permlink, voter] = resolve_authorpermvoter(cls.authorpermvoter)
        cls.author = author
        cls.permlink = permlink
        cls.voter = voter
        cls.authorperm = construct_authorperm(author, permlink)
コード例 #6
0
ファイル: test_nodelist.py プロジェクト: dkedzierski/beem
 def test_steem_nodes(self):
     nodelist = NodeList()
     nodelist.update_nodes()
     steem_nodes = nodelist.get_steem_nodes()
     for node in steem_nodes:
         blockchainobject = Steem(node=node)
         assert blockchainobject.is_steem
コード例 #7
0
ファイル: test_nodelist.py プロジェクト: dkedzierski/beem
 def test_hive_nodes(self):
     nodelist = NodeList()
     nodelist.update_nodes()
     hive_nodes = nodelist.get_hive_nodes()
     for node in hive_nodes:
         blockchainobject = Hive(node=node)
         assert blockchainobject.is_hive
コード例 #8
0
    def setUpClass(cls):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(exclude_limited=False), num_retries=10))
        node_list = nodelist.get_nodes(exclude_limited=True)

        cls.bts = Steem(
            node=node_list,
            use_condenser=True,
            nobroadcast=True,
            unsigned=True,
            keys={"active": wif},
            num_retries=10
        )
        cls.steemit = Steem(
            node="https://api.steemit.com",
            nobroadcast=True,
            unsigned=True,
            keys={"active": wif},
            num_retries=10
        )
        acc = Account("holger80", steem_instance=cls.bts)
        comment = acc.get_feed(limit=20)[-1]
        cls.authorperm = comment.authorperm
        [author, permlink] = resolve_authorperm(cls.authorperm)
        cls.author = author
        cls.permlink = permlink
        cls.category = comment.category
        cls.title = comment.title
コード例 #9
0
ファイル: test_blockchain.py プロジェクト: espoem/beem
    def setUpClass(cls):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(
            normal=True, appbase=True),
                                                   num_retries=10))
        cls.bts = Steem(node=nodelist.get_nodes(),
                        nobroadcast=True,
                        keys={"active": wif},
                        num_retries=10)
        b = Blockchain(steem_instance=cls.bts)
        num = b.get_current_block_num()
        cls.start = num - 25
        cls.stop = num

        cls.testnet = Steem(node="https://testnet.steemitdev.com",
                            nobroadcast=True,
                            keys={"active": wif},
                            num_retries=10)
        # from getpass import getpass
        # self.bts.wallet.unlock(getpass())
        set_shared_steem_instance(cls.bts)
        cls.bts.set_default_account("test")
        b = Blockchain(steem_instance=cls.testnet)
        num = b.get_current_block_num()
        cls.start_testnet = num - 25
        cls.stop_testnet = num
コード例 #10
0
ファイル: claimer.py プロジェクト: steemtm/ufm
def claim_tokens():
    username = ["ufm.reserve", "taskmanager", "tmholdings", "upfundme", "tmps"]
    for username in username:
        url = "http://scot-api.steem-engine.com/@" + username
        r = requests.get(url)
        result = r.json()

        json_data = []
        for token in result:
            scot = result[token]
            if int(scot["pending_token"]) > 0:
                json_data.append({"symbol": token})
                print(username + " can claim %s" % (token))

        if len(json_data) > 0:
            nodes = NodeList()
            nodes.update_nodes()
            stm = Steem(nodes.get_nodes())
            try:
                stm.unlock(pwd=beem_pass)
            except:
                stm = Steem(node=nodes.get_nodes(), keys=[pwd])
            stm.custom_json("scot_claim_token",
                            json_data,
                            required_posting_auths=[username])
        else:
            print(username + " Has nothing to claim")
コード例 #11
0
ファイル: test_cli.py プロジェクト: masudr4n4/beem
    def setUpClass(cls):
        nodelist = NodeList()
        nodelist.update_nodes()
        nodelist.update_nodes(steem_instance=Steem(
            node=nodelist.get_nodes(hive=True), num_retries=10))
        cls.node_list = nodelist.get_nodes(hive=True)

        # stm = shared_steem_instance()
        # stm.config.refreshBackup()
        runner = CliRunner()
        result = runner.invoke(cli,
                               ['-o', 'set', 'default_vote_weight', '100'])
        if result.exit_code != 0:
            raise AssertionError(str(result))
        result = runner.invoke(cli, ['-o', 'set', 'default_account', 'beem'])
        if result.exit_code != 0:
            raise AssertionError(str(result))
        result = runner.invoke(cli, ['-o', 'set', 'nodes', str(cls.node_list)])
        if result.exit_code != 0:
            raise AssertionError(str(result))
        result = runner.invoke(cli, ['createwallet', '--wipe'],
                               input="test\ntest\n")
        if result.exit_code != 0:
            raise AssertionError(str(result))
        result = runner.invoke(cli, ['addkey'], input="test\n" + wif + "\n")
        if result.exit_code != 0:
            raise AssertionError(str(result))
        result = runner.invoke(cli, ['addkey'],
                               input="test\n" + posting_key + "\n")
        if result.exit_code != 0:
            raise AssertionError(str(result))
        result = runner.invoke(cli, ['addkey'],
                               input="test\n" + memo_key + "\n")
        if result.exit_code != 0:
            raise AssertionError(str(result))
コード例 #12
0
 def setUpClass(cls):
     nodelist = NodeList()
     nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(
         normal=True, appbase=True),
                                                num_retries=10))
     cls.bts = Steem(
         node=nodelist.get_nodes(normal=True, appbase=False),
         nobroadcast=True,
         bundle=False,
         unsigned=True,
         # Overwrite wallet to use this list of wifs only
         keys={"active": wif},
         num_retries=10)
     cls.appbase = Steem(
         node=nodelist.get_nodes(normal=False, appbase=True, dev=False),
         nobroadcast=True,
         bundle=False,
         unsigned=True,
         # Overwrite wallet to use this list of wifs only
         keys={"active": wif},
         num_retries=10)
     cls.account = Account("beembot", full=True, steem_instance=cls.bts)
     cls.account_appbase = Account("beembot",
                                   full=True,
                                   steem_instance=cls.appbase)
     set_shared_steem_instance(cls.bts)
コード例 #13
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("config", help="Config file in JSON format")
    parser.add_argument("--logconfig",
                        help="Logger Config file in JSON format",
                        default='logger.json')
    parser.add_argument("--datadir", help="Data storage dir", default='.')
    args = parser.parse_args()

    setup_logging(default_path=args.logconfig)

    logger.info("Loading config: %s" % str(args.config))
    config = json.loads(open(args.config).read())
    datadir = args.datadir

    nodelist = NodeList()
    nodelist.update_nodes()
    stm = Steem(node=nodelist.get_nodes(),
                num_retries=5,
                call_num_retries=3,
                timeout=15)
    data_file = os.path.join(datadir, 'data.db')
    bot = Distribubot(config, data_file, stm)

    data_file = os.path.join(datadir, 'data.db')
    data_db = read_data(data_file)
    if "last_block_num" in data_db:
        last_block_num = data_db["last_block_num"]
    else:
        last_block_num = 0
    if "comment_queue" in data_db:
        comment_queue = data_db["comment_queue"]
    else:
        comment_queue = {}

    if "last_block_num" in data_db:
        start_block = data_db["last_block_num"] + 1
    else:
        start_block = None
    logger.info("starting token distributor..")
    block_counter = None
    while True:

        last_block_num = bot.run(start_block)
        # Update nodes once a day
        if block_counter is None:
            block_counter = last_block_num
        elif last_block_num - block_counter > 20 * 60 * 24:
            nodelist.update_nodes()
            stm = Steem(node=nodelist.get_nodes(),
                        num_retries=5,
                        call_num_retries=3,
                        timeout=15)

            bot.stm = stm

        start_block = last_block_num + 1
        store_data(data_file, "last_block_num", last_block_num)
        time.sleep(3)
コード例 #14
0
 def test_nodes_update(self):
     nodelist = NodeList()
     all_nodes = nodelist.get_nodes(exclude_limited=False,
                                    dev=True,
                                    testnet=True)
     nodelist.update_nodes(steem_instance=self.bts)
     nodes = nodelist.get_nodes()
     self.assertIn(nodes[0], all_nodes)
コード例 #15
0
 def setUpClass(cls):
     nodelist = NodeList()
     nodelist.update_nodes(steem_instance=Steem(
         node=nodelist.get_nodes(exclude_limited=False), num_retries=10))
     cls.bts = Steem(node=nodelist.get_nodes(exclude_limited=True),
                     nobroadcast=True,
                     num_retries=10)
     set_shared_steem_instance(cls.bts)
コード例 #16
0
def steem():
    nodes = NodeList()
    nodes.update_nodes()
    stm = Steem(node=nodes.get_nodes(), nobroadcast=config.test)
    set_shared_steem_instance(stm)
    stm.wallet.unlock(config.default_passphrase)
    account = Account(config.default_stmacct, steem_instance=stm)
    return stm, account
コード例 #17
0
ファイル: test_websocket.py プロジェクト: hobbit19/beem
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(
            normal=True, appbase=True),
                                                   num_retries=10))
        stm = Steem(node=nodelist.get_nodes(appbase=False))

        self.ws = SteemWebsocket(urls=stm.rpc.nodes, num_retries=10)
コード例 #18
0
 def setUpClass(cls):
     nodelist = NodeList()
     nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(
         normal=True, appbase=True),
                                                num_retries=10))
     cls.bts = Steem(node=nodelist.get_nodes(),
                     nobroadcast=True,
                     num_retries=10)
     set_shared_steem_instance(cls.bts)
コード例 #19
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     nodelist = NodeList()
     nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(
         normal=True, appbase=True),
                                                num_retries=10))
     self.bts = Steem(node=nodelist.get_nodes(),
                      nobroadcast=True,
                      num_retries=10)
コード例 #20
0
ファイル: test_nodelist.py プロジェクト: nnnarvaez/bearsbeem
 def test_nodes_update(self):
     nodelist = NodeList()
     all_nodes = nodelist.get_nodes(normal=True,
                                    appbase=True,
                                    dev=True,
                                    testnet=True)
     nodelist.update_nodes(steem_instance=self.bts)
     nodes = nodelist.get_nodes()
     self.assertIn(nodes[0], all_nodes)
コード例 #21
0
 def setUpClass(cls):
     nodelist = NodeList()
     nodelist.update_nodes(steem_instance=Hive(node=nodelist.get_hive_nodes(), num_retries=10))
     cls.bts = Hive(
         node=nodelist.get_nodes(exclude_limited=True),
         nobroadcast=True,
         keys=[wif],
         num_retries=10
     )
     set_shared_steem_instance(cls.bts)
コード例 #22
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_steem_nodes(), num_retries=10))
        stm = Steem(node=nodelist.get_steem_nodes())

        self.ws = NodeWebsocket(
            urls=stm.rpc.nodes,
            num_retries=10
        )
コード例 #23
0
    def test_default_connection(self):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(normal=True, appbase=True), num_retries=10))

        b2 = Steem(
            node=nodelist.get_nodes(),
            nobroadcast=True,
        )
        set_shared_steem_instance(b2)
        bts = Account("beem")
        self.assertEqual(bts.steem.prefix, "STM")
コード例 #24
0
 def setUpClass(cls):
     nodelist = NodeList()
     nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(exclude_limited=False), num_retries=10))
     cls.appbase = Steem(
         node=nodelist.get_nodes(exclude_limited=True),
         nobroadcast=True,
         bundle=False,
         # Overwrite wallet to use this list of wifs only
         keys={"active": wif},
         num_retries=10
     )
コード例 #25
0
ファイル: test_hivesigner.py プロジェクト: oldas1/beem
    def setUpClass(cls):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(
            node=nodelist.get_nodes(hive=True), num_retries=10))
        cls.bts = Steem(node=nodelist.get_nodes(hive=True),
                        nobroadcast=True,
                        unsigned=True,
                        data_refresh_time_seconds=900,
                        num_retries=10)

        cls.account = Account("test", full=True, steem_instance=cls.bts)
コード例 #26
0
ファイル: test_nodelist.py プロジェクト: dkedzierski/beem
    def test_nodes_update(self):
        nodelist = NodeList()
        all_nodes = nodelist.get_hive_nodes()
        nodelist.update_nodes(blockchain_instance=self.bts)
        nodes = nodelist.get_hive_nodes()
        self.assertIn(nodes[0], all_nodes)

        all_nodes = nodelist.get_steem_nodes()
        nodelist.update_nodes(blockchain_instance=self.bts)
        nodes = nodelist.get_steem_nodes()
        self.assertIn(nodes[0], all_nodes)
コード例 #27
0
ファイル: go.py プロジェクト: officiallymarky/heairdrop
def main():
    load_config()
    load_users()

    nodelist = NodeList()
    nodelist.update_nodes()
    nodes = nodelist.get_hive_nodes()
    hive = Hive(wif=config['wif'])
    set_shared_hive_instance(hive)

    do_airdrop(hive)
コード例 #28
0
    def start(self, authorperm=None, file=None):
        self.main_window = Tk()
        self.main_window.title('HiveDiff')
        self.__main_window_ui = MainWindowUI(self.main_window)
        
        self.leftFile = ''
        self.rightFile = ''
        self.authorperm = ''

        self.__main_window_ui.center_window()
        self.__main_window_ui.create_file_path_labels()
        self.__main_window_ui.create_text_areas()
        self.__main_window_ui.create_search_text_entry(self.__findNext)
        self.__main_window_ui.create_line_numbers()
        self.__main_window_ui.create_scroll_bars()
        self.__main_window_ui.create_file_treeview()
        path_to_my_project = os.getcwd()
        self.__main_window_ui.add_menu('File', [
            {'name': 'Compare Markdown file', 'command': self.__browse_files},
            {'name': 'View Post history', 'command': self.__enter_post},
            {'name': 'Compare Markdown files in Directory', 'command': self.__browse_directories},
            {'name': 'Reload', 'command': self.__reload, 'accelerator': 'Ctrl+R'},
            {'separator'},
            {'name': 'Exit', 'command': self.__exit, 'accelerator': 'Alt+F4'}
            ])
        self.__main_window_ui.add_menu('Edit', [
            {'name': 'Find', 'command': self.__startFindText, 'accelerator': 'Ctrl+F'},
            {'separator'},
            {'name': 'Cut', 'command': self.__cut, 'accelerator': 'Ctrl+X'},
            {'name': 'Copy', 'command': self.__copy, 'accelerator': 'Ctrl+C'},
            {'name': 'Paste', 'command': self.__paste, 'accelerator': 'Ctrl+P'},
            {'separator'},
            {'name': 'Go To Line', 'command': self.__goToLine, 'accelerator': 'Ctrl+G'}
            ])
        self.__main_window_ui.add_menu('Help', [
            {'name': 'About', 'command': self.__about},
            ])
        self.__main_window_ui.fileTreeView.bind('<<TreeviewSelect>>', lambda *x:self.treeViewItemSelected())

        nodelist = NodeList()
        nodelist.update_nodes()
        hive = Hive(node=nodelist.get_hive_nodes())
        set_shared_blockchain_instance(hive)

        self.leftFile = ''
        self.rightFile = file if file else ''
        self.filesChanged()
        if authorperm != '' and authorperm is not None:
            self.authorperm = authorperm
            self.__resolve_authorperm()

        self.__bind_key_shortcuts()

        self.main_window.mainloop()
コード例 #29
0
    def test_default_connection(self):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Hive(node=nodelist.get_hive_nodes(), num_retries=10))

        b2 = Hive(
            node=nodelist.get_hive_nodes(),
            nobroadcast=True,
        )
        set_shared_steem_instance(b2)
        bts = Account("beem")
        self.assertEqual(bts.blockchain.prefix, "STM")
コード例 #30
0
 def setUpClass(cls):
     nodelist = NodeList()
     nodelist.update_nodes(steem_instance=Steem(
         node=nodelist.get_steem_nodes(), num_retries=10))
     cls.bts = Steem(node=nodelist.get_steem_nodes(),
                     nobroadcast=True,
                     num_retries=10)
     set_shared_steem_instance(cls.bts)
     cls.asset = Asset("SBD")
     cls.symbol = cls.asset["symbol"]
     cls.precision = cls.asset["precision"]
     cls.asset2 = Asset("STEEM")