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": { "amount": 0, "asset_id": "1.3.0" }, }) self.cm = ("f68585abf4dce7c804570117000000000000000000015a01050000000" "000000001200b28528d1436564f4b4a9faf38b77c17d69ea85476076e" "bafebbad9733ac014411b044a7570ef103a518d2e17f7250e1cd8e31c" "f19272395c8fe9bbce0b4bfb4") self.doit()
def compareConstructedTX(self): op = operations.Proposal_update( **{ 'fee_paying_account': "1.2.1", 'proposal': "1.10.90", 'active_approvals_to_add': ["1.2.5"], "fee": { "amount": 0, "asset_id": "1.3.0" }, }) """ op = operations.Betting_market_resolve(**{ "fee": {"amount": 0, "asset_id": "1.3.0"}, "betting_market_id": "1.21.1", "resolution": "win", "prefix": prefix, }) op = operations.Bet_cancel_operation(**{ "fee": {"amount": 0, "asset_id": "1.3.0"}, "bettor_id": "1.2.1241", "bet_to_cancel": "1.22.10", "prefix": prefix, }) """ 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], prefix) txWire = hexlify(bytes(tx)).decode("ascii") print("=" * 80) pprint(tx.json()) print("=" * 80) from grapheneapi.grapheneapi import GrapheneAPI rpc = GrapheneAPI("localhost", 8092) compare = rpc.serialize_transaction(tx.json()) print(compare[:-130]) print(txWire[:-130]) print(txWire[:-130] == compare[:-130]) self.assertEqual(compare[:-130], txWire[:-130])
def disapproveproposal(self, proposal_ids, account=None, approver=None): """ Disapprove Proposal :param list proposal_ids: Id 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) if not approver: approver = account else: approver = Account(approver) if not isinstance(proposal_ids, (list, set)): proposal_ids = set(proposal_ids) op = [] for proposal_id in proposal_ids: proposal = Proposal(proposal_id, peerplays_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")
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": { "amount": 0, "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], prefix) txWire = hexlify(bytes(tx)).decode("ascii") compare = ("f68585abf4dce7c804570117000000000000000000015a01050000000" "000000001200b28528d1436564f4b4a9faf38b77c17d69ea85476076e" "bafebbad9733ac014411b044a7570ef103a518d2e17f7250e1cd8e31c" "f19272395c8fe9bbce0b4bfb4") self.assertEqual(compare[:-130], txWire[:-130])