Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set beneficiaries via steem.post() #20

Closed
crokkon opened this issue Jun 3, 2018 · 0 comments
Closed

Unable to set beneficiaries via steem.post() #20

crokkon opened this issue Jun 3, 2018 · 0 comments

Comments

@crokkon
Copy link
Contributor

crokkon commented Jun 3, 2018

Expected behavior

steem.post() brings two options to set beneficiaries:

  • via a parameter comment_options in the form of:
            comment_options = {
                'max_accepted_payout': '1000000.000 SBD',
                'percent_steem_dollars': 10000,
                'allow_votes': True,
                'allow_curation_rewards': True,
                'extensions': [[0, {
                    'beneficiaries': [
                        {'account': 'account1', 'weight': 5000},
                        {'account': 'account2', 'weight': 5000},
                    ]}
                ]]
            }
  • via a parameter beneficiaries in the form of:
            beneficiaries = [
                {'account': 'account1', 'weight': 5000},
                {'account': 'account2', 'weight': 5000}
            ]

The list in beneficiaries is supposed to override the settings in the comment_options if both parameters are present.

Actual behavior

It is not possible to set beneficiaries using either method.

  1. via comment_options, dry run, creating an unsigned transaction that is not broadcasted:
from beem import Steem
import json

s = Steem(nobroadcast=True, unsigned=True)

comment_options = {
    'max_accepted_payout': '1000000.000 SBD',
    'percent_steem_dollars': 10000,
    'allow_votes': True,
    'allow_curation_rewards': True,
    'extensions': [[0, {
        'beneficiaries': [
            {'account': 'account1', 'weight': 5000},
            {'account': 'account2', 'weight': 5000},
        ]}
    ]]
}

tx = s.post(title="title", body="body", permlink="permlink",
            author="author", comment_options=comment_options,
            beneficiaries=None)

print(json.dumps(tx, indent=2))

Result:

[...]
    [
      "comment_options",
      {
        "author": "author",
        "permlink": "permlink",
        "max_accepted_payout": "1000000.000 SBD",
        "percent_steem_dollars": 10000,
        "allow_votes": true,
        "allow_curation_rewards": true,
        "extensions": []
      }
    ]

The resulting extensions field is empty, the post will be created but without beneficiaries.

  1. via the beneficiary parameter:
from beem import Steem
import cfg_stmdev as cfg
import time
import json

s = Steem(keys=[cfg.POSTING_WIF], nobroadcast=False)

comment_options = {
    'max_accepted_payout': '1000000.000 SBD',
    'percent_steem_dollars': 10000,
    'allow_votes': True,
    'allow_curation_rewards': True,
}

beneficiaries = [{'account': 'stmdev', 'weight': 1000}]

reply_identifier = '@stmdev/pwdtest'
timestamp = int(time.time())

permlink = 'reply-case-1-%s' % timestamp
body = "%s %s" % (comment_options, beneficiaries)
tx = s.post(title=permlink, body=body, permlink=permlink,
            author=cfg.ACCOUNT, reply_identifier=reply_identifier,
            comment_options=comment_options,
            beneficiaries=beneficiaries)

print(json.dumps(tx, indent=2))

The list of beneficiaries is now part of the transaction, but the operation fails with a missing required posting authority exception:

[...]
{"ops":[["comment",{"parent_author":"stmdev","parent_permlink":"pwdtest","author":"stmdev","permlink":"reply-case-1-1528013878","title":"reply-case-1-1528013878","body":"{'max_accepted_payout': '1000000.000 SBD', 'percent_steem_dollars': 10000, 'allow_votes': True, 'allow_curation_rewards': True} [{'account': 'stmdev', 'weight': 1000}]","json_metadata":"{\"app\": \"beem/0.19.35\"}"}],["comment_options",{"author":"stmdev","permlink":"reply-case-1-1528013878","max_accepted_payout":"1000000.000 SBD","percent_steem_dollars":10000,"allow_votes":true,"allow_curation_rewards":true,"extensions":[[0,{"beneficiaries":[{"account":"stmdev","weight":1000}]}]]}]],"sigs":["STM6x286end3rLZj9ornAaxBaVzovxjHtXzBQppSFXCe67gCMu3xq"]}
[...]
beemapi.exceptions.UnhandledRPCError: missing required posting authority

The used posting key is correct, the same script creates a post with beneficiaries=None.

Possibly related: steemit/steem-python#9

Environment

# beempy --version
beempy, version 0.19.35
# python --version
Python 3.6.5
crokkon added a commit to crokkon/beem that referenced this issue Jun 3, 2018
crokkon added a commit to crokkon/beem that referenced this issue Jun 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant