def test_proposal_update(self): self.op = operations.Proposal_update(**{ 'fee_paying_account': "1.2.1", 'proposal': "1.10.90", 'active_approvals_to_add': ["1.2.5"], "fee": objects.Asset(amount=12512, asset_id="1.3.0"), }) self.cm = ("f68585abf4dce7c804570117e03000000000000000015a01050000000" "000000001203255378db6dc19443e74421c954ad7fdcf23f4ea45fe4f" "e5a1b078a0f94fb529594819c9799d68efa5cfb5b271a9333a2f516ca" "4fb5093226275f48a42d9e8cf") self.doit()
def approveproposal(self, proposal_ids, account=None, approver=None): """ Approve Proposal :param list proposal_id: Ids of the proposals :param str account: (optional) the account to allow access to (defaults to ``default_account``) """ from .proposal import Proposal if not account: if "default_account" in config: account = config["default_account"] if not account: raise ValueError("You need to provide an account") account = Account(account, bitshares_instance=self) is_key = approver and approver[:3] == self.rpc.chain_params["prefix"] if not approver and not is_key: approver = account elif approver and not is_key: approver = Account(approver, bitshares_instance=self) else: approver = PublicKey(approver) if not isinstance(proposal_ids, (list, set)): proposal_ids = set(proposal_ids) op = [] for proposal_id in proposal_ids: proposal = Proposal(proposal_id, bitshares_instance=self) update_dict = { "fee": { "amount": 0, "asset_id": "1.3.0" }, 'fee_paying_account': account["id"], 'proposal': proposal["id"], "prefix": self.rpc.chain_params["prefix"] } if is_key: update_dict.update({ 'key_approvals_to_add': [str(approver)], }) else: update_dict.update({ 'active_approvals_to_add': [approver["id"]], }) op.append(operations.Proposal_update(**update_dict)) if is_key: self.txbuffer.appendSigner(account["name"], "active") return self.finalizeOp(op, approver, "active") else: return self.finalizeOp(op, approver["name"], "active")
def test_proposal_update(self): op = operations.Proposal_update( **{ 'fee_paying_account': "1.2.1", 'proposal': "1.10.90", 'active_approvals_to_add': ["1.2.5"], "fee": objects.Asset(amount=12512, asset_id="1.3.0"), }) ops = [Operation(op)] tx = Signed_Transaction(ref_block_num=ref_block_num, ref_block_prefix=ref_block_prefix, expiration=expiration, operations=ops) tx = tx.sign([wif], chain=prefix) tx.verify([PrivateKey(wif).pubkey], "BTS") txWire = hexlify(bytes(tx)).decode("ascii") compare = ("f68585abf4dce7c804570117e03000000000000000015a01050000000" "000000001203255378db6dc19443e74421c954ad7fdcf23f4ea45fe4f" "e5a1b078a0f94fb529594819c9799d68efa5cfb5b271a9333a2f516ca" "4fb5093226275f48a42d9e8cf") self.assertEqual(compare[:-130], txWire[:-130])
def disapproveproposal(self, proposal_ids, account=None, approver=None): """ Disapprove Proposal :param list proposal_ids: Ids of the proposals :param str account: (optional) the account to allow access to (defaults to ``default_account``) """ from .proposal import Proposal if not account: if "default_account" in config: account = config["default_account"] if not account: raise ValueError("You need to provide an account") account = Account(account, bitshares_instance=self) if not approver: approver = account else: approver = Account(approver, bitshares_instance=self) if not isinstance(proposal_ids, (list, set)): proposal_ids = set(proposal_ids) op = [] for proposal_id in proposal_ids: proposal = Proposal(proposal_id, bitshares_instance=self) op.append( operations.Proposal_update( **{ "fee": { "amount": 0, "asset_id": "1.3.0" }, 'fee_paying_account': account["id"], 'proposal': proposal["id"], 'active_approvals_to_remove': [approver["id"]], "prefix": self.rpc.chain_params["prefix"] })) return self.finalizeOp(op, account["name"], "active")