Example #1
0
    def compareConstructedTX(self):
        self.maxDiff = None
        self.op = operations.Bid_collateral(**{
            'fee': {'amount': 100,
                    'asset_id': '1.3.0'},
            'additional_collateral': {
                'amount': 10000,
                'asset_id': '1.3.22'},
            'debt_covered': {
                'amount': 100000000,
                'asset_id': '1.3.0'},
            'bidder': '1.2.29',
            'extensions': []
        })
        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], "BTS")
        txWire = hexlify(bytes(tx)).decode("ascii")
        print("=" * 80)
        pprint(tx.json())
        print("=" * 80)

        from grapheneapi.grapheneapi import GrapheneAPI
        rpc = GrapheneAPI("localhost", 8092)
        self.cm = rpc.serialize_transaction(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_bid_collateral(self):
     self.op = operations.Bid_collateral(
         **{
             "fee": {"amount": 100, "asset_id": "1.3.0"},
             "additional_collateral": {"amount": 10000, "asset_id": "1.3.22"},
             "debt_covered": {"amount": 100000000, "asset_id": "1.3.0"},
             "bidder": "1.2.29",
             "extensions": [],
         }
     )
     self.cm = (
         "f68585abf4dce7c80457012d6400000000000000001d1027000"
         "0000000001600e1f50500000000000000012043b82194bce84d"
         "80b6e03eecf1dc24366fc54ca3d4733b3eb3815ca22e4b38b71"
         "dff62b3d8f151b15a06eb4ae40fce964044297f8632b4817de6"
         "2e94750ce2c5"
     )
     self.doit()
Example #3
0
 def test_bid_collateral(self):
     self.op = operations.Bid_collateral(**{
         'fee': {'amount': 100,
                 'asset_id': '1.3.0'},
         'additional_collateral': {
             'amount': 10000,
             'asset_id': '1.3.22'},
         'debt_covered': {
             'amount': 100000000,
             'asset_id': '1.3.0'},
         'bidder': '1.2.29',
         'extensions': []
     })
     self.cm = ("f68585abf4dce7c80457012d6400000000000000001d1027000"
                "0000000001600e1f50500000000000000012043b82194bce84d"
                "80b6e03eecf1dc24366fc54ca3d4733b3eb3815ca22e4b38b71"
                "dff62b3d8f151b15a06eb4ae40fce964044297f8632b4817de6"
                "2e94750ce2c5")
     self.doit()
Example #4
0
 def test_bid_collateral(self):
     self.op = operations.Bid_collateral(
         **{
             "fee": {
                 "amount": 0,
                 "asset_id": "1.3.0"
             },
             "bidder": "1.2.123",
             "additional_collateral": {
                 "amount": 1123456,
                 "asset_id": "1.3.0"
             },
             "debt_covered": {
                 "amount": 12345,
                 "asset_id": "1.3.121"
             },
             "extensions": []
         })
     self.cm = ("f68585abf4dce7c80457012d0000000000000000007b802411"
                "00000000000039300000000000007900000120739c87a9198b"
                "4522cb3020dabeb7ea2fde4ffb8dee4f31c53b94d96747077c"
                "bf08db69a66234b15de171e7be2bb872400712e3ccaaa41ad6"
                "94d8756c329b2b49")
     self.doit()