beem.hivesigner

class beem.hivesigner.HiveSigner(blockchain_instance=None, *args, **kwargs)

Bases: object

Parameters:scope (str) – comma separated string with scopes login,offline,vote,comment,delete_comment,comment_options,custom_json,claim_reward_balance
# Run the login_app in examples and login with a account
from beem import Steem
from beem.HiveSigner import HiveSigner
from beem.comment import Comment
hs = HiveSigner(client_id="beem.app")
steem = Steem(HiveSigner=hs)
steem.wallet.unlock("supersecret-passphrase")
post = Comment("author/permlink", blockchain_instance=steem)
post.upvote(voter="test")  # replace "test" with your account

Examples for creating HiveSigner urls for broadcasting in browser:

from beem import Steem
from beem.account import Account
from beem.HiveSigner import HiveSigner
from pprint import pprint
steem = Steem(nobroadcast=True, unsigned=True)
hs = HiveSigner(blockchain_instance=steem)
acc = Account("test", blockchain_instance=steem)
pprint(hs.url_from_tx(acc.transfer("test1", 1, "HIVE", "test")))
'https://hivesigner.com/sign/transfer?from=test&to=test1&amount=1.000+HIVE&memo=test'
from beem import Steem
from beem.transactionbuilder import TransactionBuilder
from beembase import operations
from beem.HiveSigner import HiveSigner
from pprint import pprint
stm = Steem(nobroadcast=True, unsigned=True)
hs = HiveSigner(blockchain_instance=stm)
tx = TransactionBuilder(blockchain_instance=stm)
op = operations.Transfer(**{"from": 'test',
                            "to": 'test1',
                            "amount": '1.000 HIVE',
                            "memo": 'test'})
tx.appendOps(op)
pprint(hs.url_from_tx(tx.json()))
'https://hivesigner.com/sign/transfer?from=test&to=test1&amount=1.000+HIVE&memo=test'
broadcast(operations, username=None)

Broadcast an operation

Sample operations:

[
    [
        'vote', {
                    'voter': 'gandalf',
                    'author': 'gtg',
                    'permlink': 'steem-pressure-4-need-for-speed',
                    'weight': 10000
                }
    ]
]
create_hot_sign_url(operation, params, redirect_uri=None)

Creates a link for broadcasting an operation

Parameters:
  • operation (str) – operation name (e.g.: vote)
  • params (dict) – operation dict params
  • redirect_uri (str) – Redirects to this uri, when set
get_access_token(code)
get_login_url(redirect_uri, **kwargs)

Returns a login url for receiving token from HiveSigner

headers
me(username=None)

Calls the me function from HiveSigner

from beem.HiveSigner import HiveSigner
hs = HiveSigner()
hs.steem.wallet.unlock("supersecret-passphrase")
hs.me(username="test")
refresh_access_token(code, scope)
revoke_token(access_token)
set_access_token(access_token)

Is needed for broadcast() and me()

set_username(username, permission='posting')

Set a username for the next broadcast() or me() operation. The necessary token is fetched from the wallet

update_user_metadata(metadata)
url_from_tx(tx, redirect_uri=None)

Creates a link for broadcasting an operation

Parameters:
  • tx (dict) – includes the operation, which should be broadcast
  • redirect_uri (str) – Redirects to this uri, when set