Beispiel #1
0
    def event_group_create(self, names, sport_id="0.0.0", account=None):
        """ Create an event group. This needs to be **proposed**.

            :param list names: Internationalized names, e.g. ``[['de', 'Foo'], ['en', 'bar']]``
            :param str sport_id: Sport ID to create the competitors for (defaults to *relative* id ``0.0.0``)
            :param str account: (optional) the account to allow access
                to (defaults to ``default_account``)
        """
        assert self.proposer, "'event_group_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.Event_group_create(
            **{
                "fee": {
                    "amount": 0,
                    "asset_id": "1.3.0"
                },
                "name": names,
                "sport_id": sport_id,
                "prefix": self.rpc.chain_params["prefix"]
            })
        return self.finalizeOp(op, account["name"], "active")
Beispiel #2
0
 def test_event_group_create(self):
     op = operations.Event_group_create(
         **{
             "fee": {
                 "amount": 0,
                 "asset_id": "1.3.0"
             },
             "name": [["en", "NHL"], ["zh_Hans", "國家冰球聯盟"]],
             "sport_id": "1.0.1241",
             "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 = ("f68585abf4dce7c80457012f000000000000000000020265"
                "6e034e484c077a685f48616e7312e59c8be5aeb6e586b0e7"
                "9083e881afe79b9fd9040000000000010000011f15a6cb74"
                "7df1d9bb3e7e607d8094624b3f27010ad461dd8d833590b0"
                "e0f72c946082083f90686e9bc225f5b28fd50c63c8150b8c"
                "45956c336a182702e17d800d")
     self.assertEqual(compare[:-130], txWire[:-130])
Beispiel #3
0
 def test_event_group_create(self):
     self.op = operations.Event_group_create(
         **{
             "fee": {
                 "amount": 0,
                 "asset_id": "1.3.0"
             },
             "name": [["en", "NHL"], ["zh_Hans", "國家冰球聯盟"]],
             "sport_id": "1.0.1241",
             "prefix": prefix,
         })
     self.cm = ("f68585abf4dce7c804570131000000000000000000020265"
                "6e034e484c077a685f48616e7312e59c8be5aeb6e586b0e7"
                "9083e881afe79b9fd9040000000000010000011f2e739264"
                "8b843f756c8773a984cb2b218a39558cb7415bf7abc6168a"
                "2a30336e65a5fe70fa63e6b870e18e2f9e1a8dcc96070e75"
                "a3e28f9c474e651c5860cea7")
     self.doit()