Exemplo n.º 1
0
 def test_valid_version(self):
     try:
         PlatformAddress.from_account_id(account_id,
                                         network_id="tc",
                                         version=1)
     except Exception as e:
         raise pytest.fail(f"Unexpected exception: {e}")
Exemplo n.º 2
0
    def create_platform_address(self, keystore=None, passphrase=""):
        keystore = self.ensure_keystore()
        if not is_keystore(keystore):
            raise ValueError(
                f"Expected keyStore param to be a KeyStore instance but found {keystore}"
            )

        account_id = keystore.platform.create_key(passphrase=passphrase)
        network_id = self.network_id

        return PlatformAddress.from_account_id(account_id,
                                               network_id=network_id)
Exemplo n.º 3
0
 def test_invalid_account_id(self):
     with pytest.raises(ValueError) as e:
         PlatformAddress.from_account_id("xxx", network_id="tc")
     assert "account_id" in str(e.value)
Exemplo n.º 4
0
 def test_invalid_network_id(self):
     with pytest.raises(ValueError) as e:
         PlatformAddress.from_account_id(account_id,
                                         network_id="x",
                                         version=1)
     assert "network_id" in str(e.value)
Exemplo n.º 5
0
    def test_testnet(self):
        address = PlatformAddress.from_account_id(account_id, network_id="tc")

        assert address.value == "tccq9a4urhgv3xx7kzlc2tnvs2r9q9ytpz9qgcejvw8"
Exemplo n.º 6
0
    def test_mainnet(self):
        address = PlatformAddress.from_account_id(account_id, network_id="cc")

        assert address.value == "cccq9a4urhgv3xx7kzlc2tnvs2r9q9ytpz9qgs7q0a7"
Exemplo n.º 7
0
 def get_signer_address(self, network_id: str):
     return PlatformAddress.from_account_id(self.get_signer_account_id(),
                                            network_id=network_id)