Exemplo n.º 1
0
    def test_remove_transfer_token_metadata(self):
        alice_xmss = get_alice_xmss()
        bob_xmss = get_bob_xmss()

        token_transaction = get_token_transaction(alice_xmss, bob_xmss)
        TokenMetadata.create_token_metadata(self.state, token_transaction,
                                            None)

        transfer_token = TransferTokenTransaction.create(
            token_txhash=token_transaction.txhash,
            addrs_to=[alice_xmss.address],
            amounts=[100000000],
            fee=1,
            xmss_pk=bob_xmss.pk)
        transfer_token.sign(alice_xmss)

        TokenMetadata.update_token_metadata(self.state, transfer_token, None)
        token_metadata = TokenMetadata.get_token_metadata(
            self.state, transfer_token.token_txhash)
        self.assertIn(transfer_token.txhash,
                      token_metadata.transfer_token_tx_hashes)

        TokenMetadata.remove_transfer_token_metadata(self.state,
                                                     transfer_token, None)
        token_metadata = TokenMetadata.get_token_metadata(
            self.state, transfer_token.token_txhash)
        self.assertNotIn(transfer_token.txhash,
                         token_metadata.transfer_token_tx_hashes)
Exemplo n.º 2
0
    def test_create_token_metadata(self):
        alice_xmss = get_alice_xmss()
        bob_xmss = get_bob_xmss()

        token_transaction = get_token_transaction(alice_xmss, bob_xmss)
        TokenMetadata.create_token_metadata(self.state, token_transaction,
                                            None)

        token_metadata = TokenMetadata.get_token_metadata(
            self.state, token_transaction.txhash)
        self.assertEqual(token_metadata.token_txhash, token_transaction.txhash)
        self.assertEqual(token_metadata.transfer_token_tx_hashes[0],
                         token_transaction.txhash)
Exemplo n.º 3
0
    def test_remove_token_metadata(self):
        alice_xmss = get_alice_xmss()
        bob_xmss = get_bob_xmss()

        token_tx = get_token_transaction(alice_xmss, bob_xmss)
        TokenMetadata.create_token_metadata(self.state, token_tx, None)

        token_metadata = TokenMetadata.get_token_metadata(
            self.state, token_tx.txhash)
        self.assertEqual(token_metadata.token_txhash, token_tx.txhash)
        TokenMetadata.remove_token_metadata(self.state, token_tx, None)
        self.assertIsNone(
            TokenMetadata.get_token_metadata(self.state, token_tx.txhash))