示例#1
0
 def test_transfer(self):
     stm = shared_steem_instance()
     runner = CliRunner()
     result = runner.invoke(
         cli, ['-dt', 'transfer', 'beembot', '1', stm.sbd_symbol, 'test'],
         input="test\n")
     self.assertEqual(result.exit_code, 0)
示例#2
0
文件: test_cli.py 项目: E-D-A/beem
 def setUpClass(cls):
     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', 'wss://testnet.steem.vc'])
     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))
示例#3
0
    def __init__(
            self,
            # accounts=[],
            on_block=None,
            only_block_id=False,
            steem_instance=None,
            keep_alive=25):
        # Events
        Events.__init__(self)
        self.events = Events()

        # Steem instance
        self.steem = steem_instance or shared_steem_instance()

        # Callbacks
        if on_block:
            self.on_block += on_block

        # Open the websocket
        self.websocket = SteemWebsocket(urls=self.steem.rpc.urls,
                                        user=self.steem.rpc.user,
                                        password=self.steem.rpc.password,
                                        only_block_id=only_block_id,
                                        on_block=self.process_block,
                                        keep_alive=keep_alive)
示例#4
0
文件: nodelist.py 项目: Bjoern-B/beem
 def update_nodes(self, steem_instance=None):
     """ Reads metadata from fullnodeupdate"""
     steem = steem_instance or shared_steem_instance()
     account = Account("fullnodeupdate", steem_instance=steem)
     metadata = json.loads(account["json_metadata"])
     report = metadata["report"]
     failing_nodes = metadata["failing_nodes"]
     parameter = metadata["parameter"]
     benchmarks = parameter["benchmarks"]
     max_score = len(report) + 1
     new_nodes = []
     for node in self:
         new_node = node.copy()
         for report_node in report:
             if node["url"] == report_node["node"]:
                 new_node["version"] = report_node["version"]
                 ranks = []
                 for benchmark in benchmarks:
                     result = report_node[benchmark]
                     rank = result["rank"]
                     if not result["ok"]:
                         rank = max_score + 1
                     ranks.append(rank)
                 sum_rank = 0
                 for rank in ranks:
                     sum_rank += rank
                 new_node["score"] = (
                     (len(ranks) * max_score) - sum_rank) / len(ranks) * 10
         for node_failing in failing_nodes:
             if node["url"] == node_failing:
                 new_node["score"] = -1
         new_nodes.append(new_node)
     super(NodeList, self).__init__(new_nodes)
示例#5
0
 def __init__(self,
              name_list,
              batch_limit=100,
              lazy=False,
              full=True,
              steem_instance=None):
     self.steem = steem_instance or shared_steem_instance()
     if not self.steem.is_connected():
         return
     witnesses = []
     name_cnt = 0
     if self.steem.rpc.get_use_appbase():
         while name_cnt < len(name_list):
             self.steem.rpc.set_next_node_on_empty_reply(False)
             witnesses += self.steem.rpc.find_witnesses(
                 {'owners': name_list[name_cnt:batch_limit + name_cnt]},
                 api="database")["witnesses"]
             name_cnt += batch_limit
     else:
         for witness in name_list:
             witnesses.append(
                 self.steem.rpc.get_witness_by_account(witness))
     self.identifier = ""
     super(GetWitnesses, self).__init__([
         Witness(x, lazy=lazy, full=full, steem_instance=self.steem)
         for x in witnesses
     ])
示例#6
0
 def setUpClass(cls):
     cls.nodelist = NodeList()
     cls.nodelist.update_nodes(steem_instance=Steem(
         node=cls.nodelist.get_nodes(normal=True, appbase=True),
         num_retries=10))
     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.nodelist.get_testnet())])
     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))
示例#7
0
    def __init__(self, steem_instance=None, *args, **kwargs):
        self.steem = steem_instance or shared_steem_instance()

        # Compatibility after name change from wif->keys
        if "wif" in kwargs and "keys" not in kwargs:
            kwargs["keys"] = kwargs["wif"]
        master_password_set = False
        if "keys" in kwargs:
            self.setKeys(kwargs["keys"])
        else:
            """ If no keys are provided manually we load the SQLite
                keyStorage
            """
            from .storage import (keyStorage, MasterPassword)
            self.MasterPassword = MasterPassword
            master_password_set = True
            self.keyStorage = keyStorage

        if "token" in kwargs:
            self.setToken(kwargs["token"])
        else:
            """ If no keys are provided manually we load the SQLite
                keyStorage
            """
            from .storage import tokenStorage
            if not master_password_set:
                from .storage import MasterPassword
                self.MasterPassword = MasterPassword
            self.tokenStorage = tokenStorage
示例#8
0
 def __init__(self,
              from_account="",
              limit=100,
              lazy=False,
              full=False,
              steem_instance=None):
     self.steem = steem_instance or shared_steem_instance()
     self.identifier = from_account
     self.steem.rpc.set_next_node_on_empty_reply(False)
     if self.steem.rpc.get_use_appbase():
         witnessess = self.steem.rpc.list_witnesses(
             {
                 'start': from_account,
                 'limit': limit,
                 'order': 'by_name'
             },
             api="database")['witnesses']
     else:
         witnessess = self.steem.rpc.lookup_witness_accounts(
             from_account, limit)
     if len(witnessess) == 0:
         return
     super(ListWitnesses, self).__init__([
         Witness(x, lazy=lazy, full=full, steem_instance=self.steem)
         for x in witnessess
     ])
示例#9
0
    def __init__(self, account, steem_instance=None):
        self.steem = steem_instance or shared_steem_instance()
        self.account = Account(account, full=True, steem_instance=self.steem)
        account_name = self.account["name"]
        self.identifier = account_name
        self.steem.rpc.set_next_node_on_empty_reply(False)
        if self.steem.rpc.get_use_appbase():
            if "witnesses_voted_for" not in self.account:
                return
            limit = self.account["witnesses_voted_for"]
            witnessess_dict = self.steem.rpc.list_witness_votes(
                {
                    'start': [account_name],
                    'limit': limit,
                    'order': 'by_account_witness'
                },
                api="database")['votes']
            witnessess = []
            for w in witnessess_dict:
                witnessess.append(w["witness"])
        else:
            if "witness_votes" not in self.account:
                return
            witnessess = self.account["witness_votes"]

        super(WitnessesVotedByAccount, self).__init__([
            Witness(x, lazy=True, steem_instance=self.steem)
            for x in witnessess
        ])
示例#10
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)
示例#11
0
    def __init__(self,
                 account,
                 path,
                 trxStorage,
                 transactionStorage,
                 transactionOutStorage,
                 member_data,
                 memberStorage=None,
                 steem_instance=None):
        self.steem = steem_instance or shared_steem_instance()
        self.account = Account(account, steem_instance=self.steem)
        self.delegated_vests_in = {}
        self.delegated_vests_out = {}
        self.timestamp = addTzInfo(datetime(1970, 1, 1, 0, 0, 0, 0))
        self.path = path
        self.member_data = member_data
        self.memberStorage = memberStorage
        self.memo_parser = MemoParser(steem_instance=self.steem)
        self.excluded_accounts = [
            "minnowbooster", "smartsteem", "randowhale", "steemvoter",
            "jerrybanfield", "boomerang", "postpromoter", "appreciator",
            "buildawhale", "upme", "smartmarket", "minnowhelper", "pushup",
            "steembasicincome", "sbi2", "sbi3", "sbi4", "sbi5", "sbi6", "sbi7",
            "sbi8", "sbi9"
        ]

        self.trxStorage = trxStorage
        self.transactionStorage = transactionStorage
        self.transactionOutStorage = transactionOutStorage
示例#12
0
    def __init__(
        self,
        base=None,
        quote=None,
        steem_instance=None,
    ):
        """
        Init Market

            :param beem.steem.Steem steem_instance: Steem instance
            :param beem.asset.Asset base: Base asset
            :param beem.asset.Asset quote: Quote asset
        """
        self.steem = steem_instance or shared_steem_instance()

        if quote is None and isinstance(base, str):
            quote_symbol, base_symbol = assets_from_string(base)
            quote = Asset(quote_symbol, steem_instance=self.steem)
            base = Asset(base_symbol, steem_instance=self.steem)
            super(Market, self).__init__({"base": base, "quote": quote})
        elif base and quote:
            quote = Asset(quote, steem_instance=self.steem)
            base = Asset(base, steem_instance=self.steem)
            super(Market, self).__init__({"base": base, "quote": quote})
        elif base is None and quote is None:
            quote = Asset("SBD", steem_instance=self.steem)
            base = Asset("STEEM", steem_instance=self.steem)
            super(Market, self).__init__({"base": base, "quote": quote})
        else:
            raise ValueError("Unknown Market config")
示例#13
0
 def setUpClass(cls):
     stm = shared_steem_instance()
     stm.config.refreshBackup()
     stm.set_default_nodes("")
     del stm
     cls.url = "https://api.steemitdev.com"
     bts = Steem(node=[cls.url], nobroadcast=True, num_retries=10)
     set_shared_steem_instance(bts)
示例#14
0
    def __init__(self,
                 data,
                 klass=None,
                 space_id=1,
                 object_id=None,
                 lazy=False,
                 use_cache=True,
                 id_item=None,
                 steem_instance=None,
                 *args,
                 **kwargs):
        self.steem = steem_instance or shared_steem_instance()
        self.cached = False
        self.identifier = None

        # We don't read lists, sets, or tuples
        if isinstance(data, (list, set, tuple)):
            raise ValueError(
                "Cannot interpret lists! Please load elements individually!")

        if id_item and isinstance(id_item, string_types):
            self.id_item = id_item
        else:
            self.id_item = "id"
        if klass and isinstance(data, klass):
            self.identifier = data.get(self.id_item)
            super(BlockchainObject, self).__init__(data)
        elif isinstance(data, dict):
            self.identifier = data.get(self.id_item)
            super(BlockchainObject, self).__init__(data)
        elif isinstance(data, integer_types):
            # This is only for block number bascially
            self.identifier = data
            if not lazy and not self.cached:
                self.refresh()
            # make sure to store the blocknumber for caching
            self[self.id_item] = (data)
            # Set identifier again as it is overwritten in super() in refresh()
            self.identifier = data
        elif isinstance(data, string_types):
            self.identifier = data
            if not lazy and not self.cached:
                self.refresh()
            self[self.id_item] = str(data)
            self.identifier = data
        else:
            self.identifier = data
            if self.test_valid_objectid(self.identifier):
                # Here we assume we deal with an id
                self.testid(self.identifier)
            if self.iscached(data):
                super(BlockchainObject, self).__init__(self.getcache(data))
            elif not lazy and not self.cached:
                self.refresh()

        if use_cache and not lazy:
            self.cache()
            self.cached = True
示例#15
0
def vote(
    c
):  # maybe implement curation reward evaluation and adjust voting time per author for max rewards
    log.info('Start voting routine...')
    votes = []
    try:
        votes = c.get_votes()
    except UnhandledRPCError as e:
        msg = decodeRPCErrorMsg(e).strip()
        if not re.search("Method not found", msg):
            raise e
        else:
            log.info('No votes on this post.')

    if config['GENERAL'][
            'acc_name'] in votes:  # check if account has already voted this post
        log.info('Post already voted.')
        return False

    age = c.time_elapsed().total_seconds()
    if age > config.getfloat('VOTER', 'vote_after_minutes') * 60:
        log.info('Post is edit after voting time ({})'.format(c.authorperm))
        return False

    log.info('Preparing for post: ' + c.authorperm)
    wait = (config.getfloat('VOTER', 'vote_after_minutes') * 60) - age
    log.info('Waiting {:.2f} seconds / {:.2f} minutes.'.format(
        wait, wait / 60))
    time.sleep(wait)

    comment_body = ''
    if config.getboolean('VOTER', 'write_comment'):
        with open(file=config['VOTER']['comment_file'],
                  mode='rb') as file:  # loading comment text
            comment_body = file.read().decode('iso-8859-1')
            log.info('Loaded comment text.')

    try:
        shared_steem_instance().wallet.unlock(config['GENERAL']['wallet_key'])
        c.upvote(weight=config.getfloat('VOTER', 'vote_weight'),
                 voter=config['GENERAL']['acc_name'])  # vote
        if config.getboolean('VOTER', 'write_comment'):
            shared_steem_instance().post(
                title='',
                body=comment_body,
                author=config['GENERAL']['acc_name'],
                reply_identifier=c.authorperm,
                app='https://github.com/PortalMine/portalvotes')
        log.debug(shared_steem_instance().broadcast())
        shared_steem_instance().wallet.lock()
        log.info('Voted {}'.format(c.permlink))
        return True
    except MissingKeyError as e:
        log.exception(e)
        if not config.getboolean('GENERAL', 'testing'):
            exit(1)
    except Exception as e:
        log.exception(e)
        log.info('Didn\'t vote {}'.format(c.permlink))
    return False
示例#16
0
def claim_it(chain, mana):
    """Very simple Utility to claim HIVE and/or STEEM account tokens"""

    api = {"steem": "https://api.steemit.com", "hive": "https://api.hive.blog"}
    wif = click.prompt("Enter private key",
                       confirmation_prompt=False,
                       hide_input=True)
    for network in chain:
        steem = Steem(node=api[network], keys=wif)
        set_shared_steem_instance(steem)
        wallet = Wallet(shared_steem_instance())
        steemid = wallet.getAccountFromPrivateKey(wif)
        account = Account(steemid, steem_instance=shared_steem_instance())
        mana_old = account.get_rc_manabar()
        mana_human_readable = mana_old["current_mana"] / 1e9

        tries = 2
        for i in range(tries):
            try:
                if mana_human_readable > mana:
                    click.echo(f"[Mana on {network} Before: %f RC]" %
                               (mana_old["current_mana"] / 1e9))
                    tx = steem.claim_account(creator=steemid, fee=None)
                    pprint(tx)
                    time.sleep(5)
                    mana_new = account.get_rc_manabar()
                    click.echo(f"[Mana on {network} After: %f RC]" %
                               (mana_new["current_mana"] / 1e9))
                    rc_costs = mana_old["current_mana"] - mana_new[
                        "current_mana"]
                    click.echo("[Mana cost: %f RC]" % (rc_costs / 1e9))
                else:
                    click.echo(
                        f"[Skipping claim account: current mana of %f lower than the set limit of %f on {network}]"
                        % (mana_human_readable, mana))
                    time.sleep(5)
            except Exception as e:
                click.echo('[Error:', e, ' - Trying Again]')
                time.sleep(2)
                if i < tries:
                    continue
                else:
                    click.echo('[Failed to claim]')
            else:
                break
示例#17
0
 def setUpClass(cls):
     stm = shared_steem_instance()
     stm.config.refreshBackup()
     cls.bts = Steem(node=["wss://testnet.steem.vc"],
                     nobroadcast=True,
                     num_retries=10)
     # from getpass import getpass
     # self.bts.wallet.unlock(getpass())
     cls.bts.set_default_account("beem")
示例#18
0
 def __init__(self, api=None, steem_instance=None):
     if api is None:
         self.api = Api()
     else:
         self.api = api        
     self.steem = steem_instance or shared_steem_instance()
     self.tokens = Tokens(api=self.api)
     self.ssc_id = "ssc-mainnet1"
     self.refresh()
示例#19
0
 def __init__(self, steem_instance=None):
     self.steem = steem_instance or shared_steem_instance()
     self.allowed_memo_words = [
         'for', 'and', 'sponsor', 'shares', 'share', 'sponsorship',
         'please', 'steem', 'thanks', 'additional', 'sponsee', 'sponsoring',
         'sponser', 'one', 'you', 'thank', 'enroll', 'sponsering:',
         'sponsoring;', 'sponsoring:', 'would', 'like', 'too', 'enroll:',
         'sponsor:'
     ]
示例#20
0
 def __init__(self, account, api=None, steem_instance=None):
     if api is None:
         self.api = Api()
     else:
         self.api = api
     self.ssc_id = "ssc-mainnet1"
     self.steem = steem_instance or shared_steem_instance()
     check_account = Account(account, steem_instance=self.steem)
     self.account = check_account["name"]
     self.refresh()
示例#21
0
 def __init__(self, steem_instance=None, *args, **kwargs):
     self.steem = steem_instance or shared_steem_instance()
     self.access_token = None
     self.get_refresh_token = kwargs.get("get_refresh_token", False)
     self.hot_sign_redirect_uri = kwargs.get("hot_sign_redirect_uri", config["hot_sign_redirect_uri"])
     if self.hot_sign_redirect_uri == "":
         self.hot_sign_redirect_uri = None
     self.client_id = kwargs.get("client_id", config["sc2_client_id"])
     self.scope = kwargs.get("scope", "login")
     self.oauth_base_url = kwargs.get("oauth_base_url", config["oauth_base_url"])
     self.sc2_api_url = kwargs.get("sc2_api_url", config["sc2_api_url"])
示例#22
0
 def __init__(self, owner, full=False, lazy=False, steem_instance=None):
     self.full = full
     self.lazy = lazy
     self.steem = steem_instance or shared_steem_instance()
     if isinstance(owner, dict):
         owner = self._parse_json_data(owner)
     super(Witness, self).__init__(owner,
                                   lazy=lazy,
                                   full=full,
                                   id_item="owner",
                                   steem_instance=steem_instance)
示例#23
0
 def __init__(self, tx={}, steem_instance=None, **kwargs):
     self.steem = steem_instance or shared_steem_instance()
     self.clear()
     if tx and isinstance(tx, dict):
         super(TransactionBuilder, self).__init__(tx)
         # Load operations
         self.ops = tx["operations"]
         self._require_reconstruction = False
     else:
         self._require_reconstruction = True
     self.set_expiration(kwargs.get("expiration", self.steem.expiration))
示例#24
0
 def test_sell(self):
     stm = shared_steem_instance()
     runner = CliRunner()
     result = runner.invoke(cli, ['-dt', '-x', 'sell', '1', stm.token_symbol, '2.2'], input="test\n")
     self.assertEqual(result.exit_code, 0)
     result = runner.invoke(cli, ['-dt', '-x', 'sell', '1', stm.backed_token_symbol, '2.2'], input="test\n")
     self.assertEqual(result.exit_code, 0)
     result = runner.invoke(cli, ['-dt', '-x', 'sell', '1', stm.token_symbol], input="y\ntest\n")
     self.assertEqual(result.exit_code, 0)
     result = runner.invoke(cli, ['-dt', '-x', 'sell', '1', stm.backed_token_symbol], input="y\ntest\n")
     self.assertEqual(result.exit_code, 0)
示例#25
0
    def __init__(self,
                 from_account=None,
                 to_account=None,
                 steem_instance=None):

        self.steem = steem_instance or shared_steem_instance()

        if to_account:
            self.to_account = Account(to_account, steem_instance=self.steem)
        if from_account:
            self.from_account = Account(from_account,
                                        steem_instance=self.steem)
示例#26
0
def publish(_title, _body, _user_beneficiaries: list = None):
    shared_steem_instance().wallet.unlock(config['GENERAL']['wallet_key'])
    try:
        if _user_beneficiaries and len(_user_beneficiaries):
            log.debug(shared_steem_instance().post(
                title=_title,
                body=_body,
                author=config['GENERAL']['acc_name'],
                tags=config['POSTER']['tags'].replace(' ', '').split(','),
                self_vote=config.getboolean('POSTER', 'self_vote'),
                app="https://github.com/PortalMine/portalvotes",
                beneficiaries=_user_beneficiaries))
        else:
            log.debug(shared_steem_instance().post(
                title=_title,
                body=_body,
                author=config['GENERAL']['acc_name'],
                tags=config['POSTER']['tags'].replace(' ', '').split(','),
                self_vote=config.getboolean('POSTER', 'self_vote'),
                app="https://github.com/PortalMine/portalvotes"))
    except MissingKeyError as err:
        log.exception(err)
        if not config.getboolean('GENERAL', 'testing'):
            exit(1)
    shared_steem_instance().wallet.lock()
示例#27
0
文件: witness.py 项目: DoctorLai/beem
 def __init__(self,
              from_account="",
              limit=100,
              lazy=False,
              full=False,
              steem_instance=None):
     self.steem = steem_instance or shared_steem_instance()
     witnessList = []
     last_limit = limit
     self.identifier = ""
     self.steem.rpc.set_next_node_on_empty_reply(False)
     if self.steem.rpc.get_use_appbase() and from_account == "":
         last_account = None
     else:
         last_account = from_account
     if limit > 100:
         while last_limit > 100:
             tmpList = WitnessesRankedByVote(last_account, 100)
             if (last_limit < limit):
                 witnessList.extend(tmpList[1:])
                 last_limit -= 99
             else:
                 witnessList.extend(tmpList)
                 last_limit -= 100
             if self.steem.rpc.get_use_appbase():
                 last_account = str(witnessList[-1]["votes"])
             else:
                 last_account = witnessList[-1]["owner"]
     if (last_limit < limit):
         last_limit += 1
     if self.steem.rpc.get_use_appbase():
         witnessess = self.steem.rpc.list_witnesses(
             {
                 'start': [last_account],
                 'limit': last_limit,
                 'order': 'by_vote_name'
             },
             api="database")['witnesses']
     else:
         witnessess = self.steem.rpc.get_witnesses_by_vote(
             last_account, last_limit)
     # self.witness_count = len(self.voted_witnessess)
     if (last_limit < limit):
         witnessess = witnessess[1:]
     if len(witnessess) > 0:
         for x in witnessess:
             witnessList.append(
                 Witness(x, lazy=lazy, full=full,
                         steem_instance=self.steem))
     if len(witnessList) == 0:
         return
     super(WitnessesRankedByVote, self).__init__(witnessList)
示例#28
0
def deposit(amount, account):
    """Deposit STEEM to market in exchange for STEEMP."""
    stm = shared_steem_instance()
    if stm.rpc is not None:
        stm.rpc.rpcconnect()
    if not account:
        account = stm.config["default_account"]
    if not unlock_wallet(stm):
        return
    market = Market(steem_instance=stm)
    tx = market.deposit(account, amount)
    tx = json.dumps(tx, indent=4)
    print(tx)
示例#29
0
    def __init__(self, symbol: str):
        super().__init__(symbol)
        settings = self.coin.settings['json']

        rpcs = settings.get('rpcs')
        # If you've specified custom RPC nodes in the custom JSON, make a new instance with those
        # Otherwise, use the global shared_steem_instance.
        self.rpc = shared_steem_instance() if empty(rpcs, itr=True) else Steem(
            rpcs)  # type: Steem
        self.rpc.set_password_storage(settings.get('pass_store',
                                                   'environment'))
        # Internal storage variables for the properties ``asset`` and ``precisions``
        self._asset = self._precision = None
示例#30
0
 def setUpClass(cls):
     nodelist = NodeList()
     stm = shared_steem_instance()
     stm.config.refreshBackup()
     cls.bts = Steem(
         node=nodelist.get_testnet(),
         nobroadcast=True,
         num_retries=10,
         expiration=120,
     )
     # from getpass import getpass
     # self.bts.wallet.unlock(getpass())
     cls.bts.set_default_account("beem")