Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added POST
Empty file.
6 changes: 3 additions & 3 deletions apps/backend/src/modules/admin/admin.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable, Inject, forwardRef } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository, Between, MoreThan, LessThan } from 'typeorm';
import { Repository, Between, MoreThan, FindOptionsWhere } from 'typeorm';
import { User, UserRole } from '../user/entities/user.entity';
import { AdminAuditLogService } from './services/admin-audit-log.service';
import { Escrow, EscrowStatus } from '../escrow/entities/escrow.entity';
Expand Down Expand Up @@ -56,7 +56,7 @@ export class AdminService {
}) {
const { status, page = 1, limit = 50, startDate, endDate } = filters;

const where: any = {};
const where: FindOptionsWhere<Escrow> = {};
if (status) where.status = status;
if (startDate && endDate) {
where.createdAt = Between(new Date(startDate), new Date(endDate));
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/modules/escrow/dto/create-escrow.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class CreateConditionDto {
type?: ConditionType;

@IsOptional()
metadata?: Record<string, any>;
metadata?: Record<string, unknown>;
}

export class CreateEscrowDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Condition {
metByUserId?: string;

@Column({ type: 'simple-json', nullable: true })
metadata?: Record<string, any>;
metadata?: Record<string, unknown>;

@CreateDateColumn()
createdAt: Date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class EscrowEvent {
actorId?: string;

@Column({ type: 'simple-json', nullable: true })
data?: Record<string, any>;
data?: Record<string, unknown>;

@Column({ nullable: true })
ipAddress?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ConfigType } from '@nestjs/config';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Escrow } from '../entities/escrow.entity';
import { Party } from '../entities/party.entity';
import { Party, PartyRole } from '../entities/party.entity';
import { Condition } from '../entities/condition.entity';
import { StellarService } from '../../../services/stellar.service';
import { EscrowOperationsService } from '../../../services/stellar/escrow-operations';
Expand Down Expand Up @@ -51,15 +51,15 @@ export class EscrowStellarIntegrationService {

// Get the depositor (usually the buyer)
const depositor = escrow.parties.find(
(party) => party.role === ('buyer' as any),
(party) => party.role === PartyRole.BUYER,
);
if (!depositor) {
throw new Error(`Depositor not found for escrow ${escrowId}`);
}

// Get the recipient (usually the seller)
const recipient = escrow.parties.find(
(party) => party.role === ('seller' as any),
(party) => party.role === PartyRole.SELLER,
);
if (!recipient) {
throw new Error(`Recipient not found for escrow ${escrowId}`);
Expand Down Expand Up @@ -386,7 +386,7 @@ export class EscrowStellarIntegrationService {
}
if (typeof error === 'object' && error !== null && 'message' in error) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return String((error as any).message);
return String((error as { message: unknown }).message);
}
return 'Unknown error';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ describe('EscrowService', () => {

describe('findOverview', () => {
function createOverviewQueryBuilder() {
const qb: any = {
const qb: Record<string, jest.Mock> = {
select: jest.fn().mockReturnThis(),
addSelect: jest.fn().mockReturnThis(),
setParameter: jest.fn().mockReturnThis(),
Expand Down
26 changes: 11 additions & 15 deletions apps/backend/src/services/stellar.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class StellarService {
streamTransactions(
accountId: string,
callback: (transaction: StellarTransactionResponse) => void,
): any {
): () => void {
this.logger.log(`Starting transaction stream for account: ${accountId}`);

const handler = (transaction: StellarTransactionResponse) => {
Expand Down Expand Up @@ -265,17 +265,14 @@ export class StellarService {
* Type guard to check if error has response with status
*/
private isNotFoundError(error: unknown): boolean {
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
return (
typeof error === 'object' &&
error !== null &&
'response' in error &&
typeof (error as any).response === 'object' &&
(error as any).response !== null &&
'status' in (error as any).response &&
(error as any).response.status === 404
);
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
if (typeof error !== 'object' || error === null || !('response' in error)) {
return false;
}
const { response } = error as { response: unknown };
if (typeof response !== 'object' || response === null || !('status' in response)) {
return false;
}
return (response as { status: unknown }).status === 404;
}

/**
Expand All @@ -286,8 +283,7 @@ export class StellarService {
return error.message;
}
if (typeof error === 'object' && error !== null && 'message' in error) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return String((error as any).message);
return String((error as { message: unknown }).message);
}
return 'Unknown error';
}
Expand All @@ -307,7 +303,7 @@ export class StellarService {
if (typeof error === 'object' && error !== null) {
// Check if it's a Horizon API error
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const errorObj = error as any;
const errorObj = error as Record<string, unknown>;
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
if (errorObj.response?.data) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/services/stellar/escrow-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export class EscrowOperationsService {
}
if (typeof error === 'object' && error !== null && 'message' in error) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return String((error as any).message);
return String((error as { message: unknown }).message);
}
return 'Unknown error';
}
Expand Down
4 changes: 2 additions & 2 deletions apps/backend/src/services/stellar/soroban-integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ describe('EscrowOperationsService Integration', () => {
deadline,
);

const op = ops[0] as any as {
const op = ops[0] as unknown as {
body: {
value: () => {
call: () => { functionName: () => { args: () => any[] } };
call: () => { functionName: () => { args: () => unknown[] } };
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/types/stellar.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ export interface StellarHorizonError {
};
}

export type StellarServer = any; // For now, keep as any but we'll use this alias for future typing
export type StellarServer = StellarSdk.Horizon.Server;
13 changes: 12 additions & 1 deletion apps/frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
"extends": "next/core-web-vitals"
"root": true,
"extends": "next/core-web-vitals",
"rules": {
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
}
}
2 changes: 1 addition & 1 deletion apps/frontend/app/contexts/ToastContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

Check failure on line 1 in apps/frontend/app/contexts/ToastContext.tsx

View workflow job for this annotation

GitHub Actions / Build and Test

Definition for rule '@typescript-eslint/no-unused-vars' was not found

import React, { createContext, useContext, useState, useCallback } from 'react';
import { createContext, useContext } from 'react';

export type ToastType = 'success' | 'error' | 'warning' | 'info';

Expand Down
18 changes: 12 additions & 6 deletions apps/frontend/app/contexts/WalletContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use client';

Check failure on line 1 in apps/frontend/app/contexts/WalletContext.tsx

View workflow job for this annotation

GitHub Actions / Build and Test

Definition for rule '@typescript-eslint/no-unused-vars' was not found

import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { WalletType, WalletConnection, WalletServiceFactory } from '../services/wallet';
Expand All @@ -10,6 +10,7 @@
connect: (walletType: WalletType) => Promise<void>;
disconnect: () => void;
signTransaction: (xdr: string) => Promise<string>;
signMessage: (message: string) => Promise<string>;
getAvailableWallets: () => Promise<WalletType[]>;
}

Expand Down Expand Up @@ -60,8 +61,8 @@

setWallet(walletConnection);
window.localStorage.setItem('vaultix_wallet', JSON.stringify(walletConnection));
} catch (err: any) {
setError(err.message || 'Failed to connect wallet');
} catch (err: unknown) {
setError(err instanceof Error ? err.message : 'Failed to connect wallet');
throw err;
} finally {
setIsConnecting(false);
Expand All @@ -75,14 +76,18 @@
};

const signTransaction = async (xdr: string): Promise<string> => {
if (!wallet) {
throw new Error('No wallet connected');
}

if (!wallet) throw new Error('No wallet connected');
const service = WalletServiceFactory.getService(wallet.walletType);
return await service.signTransaction(xdr);
};

const signMessage = async (message: string): Promise<string> => {
if (!wallet) throw new Error('No wallet connected');
const service = WalletServiceFactory.getService(wallet.walletType);
if (!service.signMessage) throw new Error('Connected wallet does not support message signing');
return await service.signMessage(message);
};

const getAvailableWallets = async (): Promise<WalletType[]> => {
return await WalletServiceFactory.getAvailableWallets();
};
Expand All @@ -96,6 +101,7 @@
connect,
disconnect,
signTransaction,
signMessage,
getAvailableWallets,
}}
>
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use client';

Check failure on line 1 in apps/frontend/app/dashboard/page.tsx

View workflow job for this annotation

GitHub Actions / Build and Test

Definition for rule '@typescript-eslint/no-unused-vars' was not found

import { useState } from 'react';
import StatusTabs from '@/component/dashboard/StatusTabs';
Expand Down Expand Up @@ -29,7 +29,7 @@
});

// Flatten the paginated data
const flatEscrows = escrowsData?.pages.flatMap((page: any) => page.escrows) || [];
const flatEscrows = escrowsData?.pages.flatMap((page: { escrows: IEscrow[] }) => page.escrows) || [];

// Handle tab changes
const handleTabChange = (tab: 'all' | 'active' | 'pending' | 'completed' | 'disputed') => {
Expand Down
6 changes: 2 additions & 4 deletions apps/frontend/app/escrow/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use client';

Check failure on line 1 in apps/frontend/app/escrow/[id]/page.tsx

View workflow job for this annotation

GitHub Actions / Build and Test

Definition for rule '@typescript-eslint/no-unused-vars' was not found

import { useState, useEffect } from 'react';
import { useParams } from 'next/navigation';
Expand All @@ -9,11 +9,9 @@
import PartiesSection from '@/components/escrow/detail/PartiesSection';
import TermsSection from '@/components/escrow/detail/TermsSection';
import TimelineSection from '@/components/escrow/detail/TimelineSection';
import TransactionHistory from '@/components/escrow/detail/TransactionHistory';
import ActivityFeed from '@/components/common/ActivityFeed';
import { IEscrowExtended } from '@/types/escrow';
import { IParty } from '@/types/escrow';
import FileDisputeModal from '@/components/escrow/detail/file-dispute-modal';
import { Button } from '@/components/ui/button';
import { EscrowDetailSkeleton } from '@/components/ui/EscrowDetailSkeleton';

const EscrowDetailPage = () => {
Expand All @@ -28,7 +26,7 @@
if (escrow && publicKey) {
if (escrow.creatorId === publicKey) {
setUserRole('creator');
} else if (escrow.parties?.some((party: any) => party.userId === publicKey)) {
} else if (escrow.parties?.some((party: IParty) => party.userId === publicKey)) {
setUserRole('counterparty');
}
}
Expand Down
11 changes: 6 additions & 5 deletions apps/frontend/app/hooks/useWallet.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { useWallet as useWalletContext } from "../contexts/WalletContext";

Check failure on line 1 in apps/frontend/app/hooks/useWallet.ts

View workflow job for this annotation

GitHub Actions / Build and Test

Definition for rule '@typescript-eslint/no-unused-vars' was not found



export const useWalletConnection = () => {
const { wallet, isConnecting, error, connect, disconnect } = useWalletContext();
const { wallet, isConnecting, error, connect, disconnect, signMessage } = useWalletContext();

return {
isConnected: !!wallet,
wallet,
isConnecting,
error,
connect,
disconnect,
publicKey: wallet?.publicKey,
walletType: wallet?.walletType,
network: wallet?.network,
signMessage,
publicKey: wallet?.publicKey ?? null,
walletType: wallet?.walletType ?? null,
network: wallet?.network ?? null,
};
};
1 change: 0 additions & 1 deletion apps/frontend/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { Metadata } from "next";

Check failure on line 1 in apps/frontend/app/layout.tsx

View workflow job for this annotation

GitHub Actions / Build and Test

Definition for rule '@typescript-eslint/no-unused-vars' was not found
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import Providers from "@/component/Providers";
import Navbar from "@/component/layout/Navbar";
import FileDisputeModal from "@/components/escrow/detail/file-dispute-modal";

const geistSans = Geist({
variable: "--font-geist-sans",
Expand Down
3 changes: 1 addition & 2 deletions apps/frontend/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

Check failure on line 1 in apps/frontend/app/page.tsx

View workflow job for this annotation

GitHub Actions / Build and Test

Definition for rule '@typescript-eslint/no-unused-vars' was not found
import Image from "next/image";
import Link from "next/link";
import Link from "next/link";

export default function Home() {
return (
Expand Down
3 changes: 2 additions & 1 deletion apps/frontend/app/services/wallet/albedo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import albedo from '@albedo-link/intent';

Check failure on line 1 in apps/frontend/app/services/wallet/albedo.ts

View workflow job for this annotation

GitHub Actions / Build and Test

Definition for rule '@typescript-eslint/no-unused-vars' was not found

export interface AlbedoIntentResult {
signed_envelope_xdr?: string;
Expand Down Expand Up @@ -30,7 +30,8 @@
}
}

async signTransaction(xdr: string): Promise<string> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async signTransaction(_xdr: string): Promise<string> {
try {
const result = await albedo.tx({ xdr, network: this.getNetworkParam() });

Expand Down
Loading
Loading