Skip to content

Steem Proposal System support

Dariusz Kędzierski edited this page Mar 14, 2019 · 12 revisions

In this document we describe added functionality to support Steem Proposal System in steem-python library.

Usage in steempy CLI

Create new proposal

Create new proposal in Steem Proposal System.

steempy createproposal -h
usage: steempy createproposal [-h]
                              creator receiver start_date end_date daily_pay
                              subject url

positional arguments:
  creator     Creator name
  receiver    Receiver name
  start_date  Start date for proposal
  end_date    End date of proposal
  daily_pay   Daily pay for proposal
  subject     Subject of the proposal
  permlink    permlink-identifier of the detailed description of the proposal

Example:

$ steempy createproposal "dariusz" "treasury" "2019-03-05T00:00:00" "2019-04-01T00:00:00" "16.000 TBD" "STEEMPy Proposal created in steempy 2" "mypermalink"
Passphrase: 
{
    "ref_block_num": 3669,
    "ref_block_prefix": 2452470458,
    "expiration": "2019-03-04T19:37:14",
    "operations": [
        [
            "create_proposal",
            {
                "creator": "dariusz",
                "receiver": "treasury",
                "start_date": "2019-03-05T00:00:00",
                "end_date": "2019-04-01T00:00:00",
                "daily_pay": "16.000 TBD",
                "subject": "STEEMPy Proposal created in steempy 2",
                "permlink": "mypermalink"
            }
        ]
    ],
    "extensions": [],
    "signatures": [
        "1f101f2d224b59e8bc6d57960552a31ef5cbf06bac966970b6cc908d36cc2f37364ac6c216cbd9fc1dda2aa8057aa075648c98b46acad62c46d9995bee53cfb2eb"
    ]
}

Update proposal votes

Allows for voting for selected proposals.

steempy updateproposalvotes -h
usage: steempy updateproposalvotes [-h]
                                   voter [proposal_ids [proposal_ids ...]]
                                   approve

positional arguments:
  voter         Voter name
  proposal_ids  List of proposal ids to vote
  approve       Approve proposals given with ids

optional arguments:
  -h, --help    show this help message and exit

Example:

$ steempy updateproposalvotes dariusz 2 3 true 
Passphrase: 
{
    "ref_block_num": 3707,
    "ref_block_prefix": 233573710,
    "expiration": "2019-03-04T19:39:09",
    "operations": [
        [
            "update_proposal_votes",
            {
                "voter": "dariusz",
                "proposal_ids": [
                    2,
                    3
                ],
                "approve": true
            }
        ]
    ],
    "extensions": [],
    "signatures": [
        "1f507ca645e7fd7d58aef2508365a6136321bb17de498d3000cb9f7c1b4f57dd381b636f3f8ec5ceaf8c877f830921dd89662178ea451064a0d61f10e9b9b511be"
    ]
}

Remove proposal

Allows to remove given proposals by proposal creator.

steempy removeproposal -h
usage: steempy removeproposal [-h]
                              proposal_owner [proposal_ids [proposal_ids ...]]

positional arguments:
  proposal_owner  Proposal owner name
  proposal_ids    List of proposal ids to vote

optional arguments:
  -h, --help      show this help message and exit

Example:

$ steempy removeproposal "dariusz" 1
Passphrase: 
{
    "ref_block_num": 1849,
    "ref_block_prefix": 2907618307,
    "expiration": "2019-03-04T18:06:15",
    "operations": [
        [
            "remove_proposal",
            {
                "proposal_owner": "dariusz",
                "proposal_ids": [
                    1
                ]
            }
        ]
    ],
    "extensions": [],
    "signatures": [
        "2069c5991ece2075864ead16aa85e7883709164d985f08e056486da110420bbd0b63967bdb1e43c7e49c26e457e2f14bc9d40e65254c515eae1483fef162d9c1ed"
    ]
}

Find proposals

Find proposals with given ids.

steempy findproposals -h
usage: steempy findproposals [-h] [proposal_ids [proposal_ids ...]]

positional arguments:
  proposal_ids  List of proposal ids to find

optional arguments:
  -h, --help    show this help message and exit

Example:

$ steempy findproposals 3
[
    {
        "id": 3,
        "creator": "dariusz",
        "receiver": "treasury",
        "start_date": "2019-03-05T00:00:00",
        "end_date": "2019-04-01T00:00:00",
        "daily_pay": {
            "amount": "16000",
            "precision": 3,
            "nai": "@@000000013"
        },
        "subject": "STEEMPy Proposal created in steempy",
        "permlink": "mypermlink",
        "total_votes": 0
    }
]

List proposals

Query for proposals with search criteria.

steempy listproposals -h
usage: steempy listproposals [-h]
                             start
                             {by_creator,by_start_date,by_end_date,by_number_of_votes}
                             {direction_ascending,direction_descending} limit
                             {inactive, active, all} 

positional arguments:
  start                 Starting value for search
  {by_creator,by_start_date,by_end_date,by_number_of_votes}
                        Results will be ordered by this field
  {direction_ascending,direction_descending}
                        Results will be ordered ascending or descending
  limit                 Limit resut of the query to number defined in this
                        parameter
  {inactive, active, all} 
                        List only results with given status (inactive, active, all)

optional arguments:
  -h, --help            show this help message and exit

Example:

$ steempy listproposals dariusz by_creator direction_ascending 10 all
[
    {
        "id": 2,
        "creator": "dariusz",
        "receiver": "treasury",
        "start_date": "2019-03-06T00:00:00",
        "end_date": "2019-04-01T00:00:00",
        "daily_pay": {
            "amount": "16000",
            "precision": 3,
            "nai": "@@000000013"
        },
        "subject": "this is subject",
        "permlink": "mypermalink",
        "total_votes": 0
    },
    {
        "id": 3,
        "creator": "dariusz",
        "receiver": "treasury",
        "start_date": "2019-03-05T00:00:00",
        "end_date": "2019-04-01T00:00:00",
        "daily_pay": {
            "amount": "16000",
            "precision": 3,
            "nai": "@@000000013"
        },
        "subject": "STEEMPy Proposal created in steempy",
        "permlink": "mypermalink",
        "total_votes": 0
    },
    {
        "id": 4,
        "creator": "dariusz",
        "receiver": "treasury",
        "start_date": "2019-03-05T00:00:00",
        "end_date": "2019-04-01T00:00:00",
        "daily_pay": {
            "amount": "16000",
            "precision": 3,
            "nai": "@@000000013"
        },
        "subject": "STEEMPy Proposal created in steempy 2",
        "permlink": "mypermalink",
        "total_votes": 0
    }
]

List voter proposals

Query for proposals voted by given voter.

steempy listvoterproposals -h
usage: steempy listvoterproposals [-h]
                                  voter
                                  {by_creator,by_start_date,by_end_date,by_number_of_votes}
                                  {direction_ascending,direction_descending}
                                  limit {inactive, active, all} 

positional arguments:
  start                 Starting value for search
  {by_creator,by_start_date,by_end_date,by_number_of_votes}
                        Results will be ordered by this field
  {direction_ascending,direction_descending}
                        Results will be ordered ascending or descending
  limit                 Limit resut of the query to number defined in this
                        parameter
  {inactive, active, all} 
                        List only results with given status (inactive, active, all)

optional arguments:
  -h, --help            show this help message and exit

Example:

$ steempy listvoterproposals dariusz by_creator direction_ascending 10 all
{ 
  "dariusz" : [{
        "id": 2,
        "creator": "dariusz",
        "receiver": "treasury",
        "start_date": "2019-03-06T00:00:00",
        "end_date": "2019-04-01T00:00:00",
        "daily_pay": {
            "amount": "16000",
            "precision": 3,
            "nai": "@@000000013"
        },
        "subject": "this is subject",
        "permlink": "mypermalink",
        "total_votes": 0
    },
    {
        "id": 3,
        "creator": "dariusz",
        "receiver": "treasury",
        "start_date": "2019-03-05T00:00:00",
        "end_date": "2019-04-01T00:00:00",
        "daily_pay": {
            "amount": "16000",
            "precision": 3,
            "nai": "@@000000013"
        },
        "subject": "STEEMPy Proposal created in steempy",
        "permlink": "mypermalink",
        "total_votes": 0
    }]
}

Usage in python scripts

Create new proposal

 def create_proposal(self, creator, receiver, start_date, end_date, daily_pay, subject, url):
        """ Create new proposal in Steem Proposal System
            :param str creator: Proposal creator
            :param str receiver: Receiver of the funds
            :param str start_date: Stating date of proposal
            :param str end_date: Ending date for the proposal
            :param str daily_pay: Amount of assets to be paid daily
            :param str subject: Short description of the proposal
            :param str permlink: perm-link to the long description of the proposal
        """

Update proposal votes

def update_proposal_votes(self, voter, proposal_ids, approve):
        """ Allows for voting for selected proposals
            :param str voter: Voter account name
            :param list proposal_ids: List with proposal ids. Voter will vote
                for proposals given in this list
            :param bool approve: If set to true proposals will be approved
        """

Remove proposal

def remove_proposal(self, proposal_owner, proposal_ids):
        """ Allows to remove given proposals by proposal creator
            :param str proposal_owner: Proposal owner/creator account
            :param list proposal_ids: Ids of the proposal to be removed
        """

Find proposals

def find_proposals(self, id_set):
        """ Find proposals with given ids
            :param list id_set: List of the proposal ids to be found
        """

List proposals

def list_proposals(self, start, order_by, order_direction, limit, status):
        """ Query for proposals with search criteria
            :param str start: Starting value for search. This option is coupled
                with order_by option. If you select by_creator in order_by
                start have to be an account name
            :param str order_by: Results will be ordered with respect to given
                field name. Allowed: by_creator, by_start_date, by_end_date, 
                by_number_of_votes
            :param str order_direction: Results will be ordered descending or
                ascending depending on this option. Allowed:
                direction_ascending, direction_descending
            :param int limit: Limit results to this value
            :param str status: List only results with given state (inactive, active, all)
        """

List voter proposals

def list_voter_proposals(self, start, order_by, order_direction, limit, status):
        """ Query for proposals voted by given voter
            :param str start: Starting value for search.
            :param str order_by: Results will be ordered with respect to given
                field name. Allowed: by_creator, by_start_date, by_end_date, 
                by_number_of_votes
            :param str order_direction: Results will be ordered descending or
                ascending depending on this option. Allowed:
                direction_ascending, direction_descending
            :param int limit: Limit results to this value
            :param str status: List only results with given state (inactive, active, all)
        """