@@ -1520,8 +1520,10 @@ def beneficiaries(authorperm, beneficiaries):
15201520@click .option ('--reply_identifier' , help = ' Identifier of the parent post/comment, when set a comment is broadcasted' )
15211521@click .option ('--community' , help = ' Name of the community (optional)' )
15221522@click .option ('--beneficiaries' , '-b' , help = 'Post beneficiaries (komma separated, e.g. a:10%,b:20%)' )
1523+ @click .option ('--percent-steem-dollars' , '-b' , help = '50% SBD /50% SP is 10000 (default), 100% SP is 0' )
1524+ @click .option ('--max-accepted-payout' , '-b' , help = 'Default is 1000000.000 [SBD]' )
15231525@click .option ('--no-parse-body' , help = 'Disable parsing of links, tags and images' , is_flag = True , default = False )
1524- def post (body , account , title , permlink , tags , reply_identifier , community , beneficiaries , no_parse_body ):
1526+ def post (body , account , title , permlink , tags , reply_identifier , community , beneficiaries , percent_steem_dollars , max_accepted_payout , no_parse_body ):
15251527 """broadcasts a post/comment"""
15261528 stm = shared_steem_instance ()
15271529 if stm .rpc is not None :
@@ -1539,9 +1541,9 @@ def post(body, account, title, permlink, tags, reply_identifier, community, bene
15391541 if len (content .split ("---" )) > 1 :
15401542 body = content .split ("---" )[- 1 ]
15411543 docs = yaml .load_all (content .split ("---" )[- 2 ])
1542-
1544+
15431545 for doc in docs :
1544- for k ,v in doc .items ():
1546+ for k , v in doc .items ():
15451547 parameter [k ] = v
15461548 else :
15471549 body = content
@@ -1555,6 +1557,14 @@ def post(body, account, title, permlink, tags, reply_identifier, community, bene
15551557 parameter ["beneficiaries" ] = beneficiaries
15561558 if reply_identifier is not None :
15571559 parameter ["reply_identifier" ] = reply_identifier
1560+ if percent_steem_dollars is not None :
1561+ parameter ["percent_steem_dollars" ] = percent_steem_dollars
1562+ elif "percent-steem-dollars" in parameter :
1563+ parameter ["percent_steem_dollars" ] = parameter ["percent-steem-dollars" ]
1564+ if max_accepted_payout is not None :
1565+ parameter ["max_accepted_payout" ] = max_accepted_payout
1566+ elif "max-accepted-payout" in parameter :
1567+ parameter ["max_accepted_payout" ] = parameter ["max-accepted-payout" ]
15581568 tags = None
15591569 if "tags" in parameter :
15601570 tags = []
@@ -1582,6 +1592,23 @@ def post(body, account, title, permlink, tags, reply_identifier, community, bene
15821592 parse_body = bool (parameter ["parse_body" ])
15831593 else :
15841594 parse_body = not no_parse_body
1595+ max_accepted_payout = None
1596+
1597+ percent_steem_dollars = None
1598+ if "percent_steem_dollars" in parameter :
1599+ percent_steem_dollars = parameter ["percent_steem_dollars" ]
1600+ max_accepted_payout = None
1601+ if "max_accepted_payout" in parameter :
1602+ max_accepted_payout = parameter ["max_accepted_payout" ]
1603+ comment_options = None
1604+ if max_accepted_payout is not None or percent_steem_dollars is not None :
1605+ comment_options = {}
1606+ if max_accepted_payout is not None :
1607+ if stm .sbd_symbol not in max_accepted_payout :
1608+ max_accepted_payout = str (Amount (float (max_accepted_payout ), stm .sbd_symbol , steem_instance = stm ))
1609+ comment_options ["max_accepted_payout" ] = max_accepted_payout
1610+ if percent_steem_dollars is not None :
1611+ comment_options ["percent_steem_dollars" ] = percent_steem_dollars
15851612 beneficiaries = None
15861613 if "beneficiaries" in parameter :
15871614 beneficiaries_list = []
@@ -1604,7 +1631,7 @@ def post(body, account, title, permlink, tags, reply_identifier, community, bene
16041631 beneficiaries_sum += percentage
16051632 beneficiaries_list .append ({"account" : a ["name" ], "weight" : int (percentage * 100 )})
16061633 beneficiaries_accounts .append (a ["name" ])
1607-
1634+
16081635 missing = 0
16091636 for bene in beneficiaries_list :
16101637 if bene ["weight" ] < 0 :
@@ -1615,8 +1642,9 @@ def post(body, account, title, permlink, tags, reply_identifier, community, bene
16151642 beneficiaries_list [index ]["weight" ] = int ((int (100 * 100 ) - int (beneficiaries_sum * 100 )) / missing )
16161643 index += 1
16171644 beneficiaries = sorted (beneficiaries_list , key = lambda beneficiaries_list : beneficiaries_list ["account" ])
1645+
16181646 tx = stm .post (title , body , author = author , permlink = permlink , reply_identifier = reply_identifier , community = community ,
1619- tags = tags , beneficiaries = beneficiaries , parse_body = parse_body )
1647+ tags = tags , comment_options = comment_options , beneficiaries = beneficiaries , parse_body = parse_body )
16201648 if stm .unsigned and stm .nobroadcast and stm .steemconnect is not None :
16211649 tx = stm .steemconnect .url_from_tx (tx )
16221650 tx = json .dumps (tx , indent = 4 )
@@ -1645,7 +1673,7 @@ def reply(authorperm, body, account, title):
16451673 if stm .unsigned and stm .nobroadcast and stm .steemconnect is not None :
16461674 tx = stm .steemconnect .url_from_tx (tx )
16471675 tx = json .dumps (tx , indent = 4 )
1648- print (tx )
1676+ print (tx )
16491677
16501678
16511679@cli .command ()
@@ -3203,8 +3231,7 @@ def info(objects):
32033231 median_price = stm .get_current_median_history ()
32043232 steem_per_mvest = stm .get_steem_per_mvest ()
32053233 chain_props = stm .get_chain_properties ()
3206- price = (Amount (median_price ["base" ], steem_instance = stm ).amount / Amount (
3207- median_price ["quote" ], steem_instance = stm ).amount )
3234+ price = (Amount (median_price ["base" ], steem_instance = stm ).amount / Amount (median_price ["quote" ], steem_instance = stm ).amount )
32083235 for key in info :
32093236 t .add_row ([key , info [key ]])
32103237 t .add_row (["steem per mvest" , steem_per_mvest ])
0 commit comments