Esempio n. 1
0
async def claim():
    stm = Steem(node="https://api.steemit.com", keys=[SR])
    rc = RC(steem_instance=stm)
    acc = Account('sourovafrin')
    current_mana = acc.get_rc_manabar()["current_mana"]
    mana_cost= stm.get_rc_cost(rc.get_resource_count(tx_size=250, execution_time_count=0, state_bytes_count=0, new_account_op_count=1))
    mana_cost+=2500000000
    if current_mana>mana_cost:
        stm.claim_account('sourovafrin','0 STEEM')
        await client.send_message(client.get_channel('544916428881657856'), "<@397972596207124480> I have claimed a steem discounted account just now and that's only for you")
Esempio n. 2
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