def compareConstructedTX(self): self.maxDiff = None self.op = operations.Custom( **{ "fee": { "amount": 0, "asset_id": "1.3.0" }, "payer": "1.2.0", "required_auths": ["1.2.100", "1.2.101"], "id": "35235", "data": hexlify(b"Foobar").decode("ascii") }) ops = [Operation(self.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) # Test against Bitshares backened self.cm = bitshares.rpc.get_transaction_hex(tx.json()) print("soll: %s" % self.cm[:-130]) print("ist: %s" % txWire[:-130]) print(txWire[:-130] == self.cm[:-130]) self.assertEqual(self.cm[:-130], txWire[:-130])
def test_custom(self): self.op = operations.Custom( **{ "fee": { "amount": 0, "asset_id": "1.3.0" }, "payer": "1.2.0", "required_auths": ["1.2.100", "1.2.101"], "id": "35235", "data": hexlify(b"Foobar").decode("ascii"), }) self.cm = ("f68585abf4dce7c80457012300000000000000000000026465" "a38906466f6f6261720001207c94df60dc9fddb63391b60925" "889547d5c1c5aad4bb2e45a215345c3a088974253c9434de38" "453802bc5a6e8de3a6bb4e4f603a6ae3e5f8fc83b234a671ee" "85") self.doit()