Returns the state change which contains the corresponding balance
    proof.

    Use this function to find a balance proof for a call to settle, which only
    has the blinded balance proof data.

def get_state_change_with_balance_proof_by_balance_hash(
        storage: sqlite.SQLiteStorage,
        canonical_identifier: CanonicalIdentifier,
        balance_hash: BalanceHash,
        sender: Address,
) -> sqlite.StateChangeRecord:
    """ Returns the state change which contains the corresponding balance
    proof.

    Use this function to find a balance proof for a call to settle, which only
    has the blinded balance proof data.
    """
    return storage.get_latest_state_change_by_data_field({
        'balance_proof.canonical_identifier.chain_identifier':
        str(canonical_identifier.chain_identifier),
        'balance_proof.canonical_identifier.token_network_address': to_checksum_address(
            canonical_identifier.token_network_address,
        ),
        'balance_proof.canonical_identifier.channel_identifier': str(
            canonical_identifier.channel_identifier,
        ),
        'balance_proof.balance_hash': serialize_bytes(balance_hash),
        'balance_proof.sender': to_checksum_address(sender),
    })