Beispiel #1
0
    def sport_create(self, names, account=None):
        """ Create a sport. This needs to be **proposed**.

            :param list names: Internationalized names, e.g. ``[['de', 'Foo'], ['en', 'bar']]``
            :param str account: (optional) the account to allow access
                to (defaults to ``default_account``)
        """
        assert self.proposer, "'sport_create' needs to be proposed"
        assert isinstance(names, list)
        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)
        op = operations.Sport_create(
            **{
                "fee": {
                    "amount": 0,
                    "asset_id": "1.3.0"
                },
                "name": names,
                "prefix": self.rpc.chain_params["prefix"]
            })
        return self.finalizeOp(op, account["name"], "active")
Beispiel #2
0
 def test_sport_create(self):
     self.op = operations.Sport_create(
         **{
             "fee": {
                 "amount": 0,
                 "asset_id": "1.3.0"
             },
             "name": [["en", "Football"], ["de", "Fußball"]],
             "prefix": prefix,
         })
     self.cm = ("f68585abf4dce7c80457012f000000000000000000020264650"
                "84675c39f62616c6c02656e08466f6f7462616c6c0000011f73"
                "9bf27286518931950b40ee739e34972bda63a44e3a7901e6686"
                "7b505f8122f2c9a47df242aad5e3630a5add2ea3aea8e62a92b"
                "8f2247c05033e8f40eb1836e")
     self.doit()
Beispiel #3
0
 def test_sport_create(self):
     op = operations.Sport_create(
         **{
             "fee": {
                 "amount": 0,
                 "asset_id": "1.3.0"
             },
             "name": [["en", "Football"], ["de", "Fußball"]],
             "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")
     compare = ("f68585abf4dce7c80457012d000000000000000000020264650"
                "84675c39f62616c6c02656e08466f6f7462616c6c0000011f14"
                "eb892a0c4a6c28e0a54852d45526b0d8e017edc4eaac1c0c54c"
                "6f944ff1d7e5e909157257fe6e71a4532563564c8c063f38846"
                "5f8a9420459d5b6cb1fdfcc1")
     self.assertEqual(compare[:-130], txWire[:-130])