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}")
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)
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)
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)
def test_testnet(self): address = PlatformAddress.from_account_id(account_id, network_id="tc") assert address.value == "tccq9a4urhgv3xx7kzlc2tnvs2r9q9ytpz9qgcejvw8"
def test_mainnet(self): address = PlatformAddress.from_account_id(account_id, network_id="cc") assert address.value == "cccq9a4urhgv3xx7kzlc2tnvs2r9q9ytpz9qgs7q0a7"
def get_signer_address(self, network_id: str): return PlatformAddress.from_account_id(self.get_signer_account_id(), network_id=network_id)