Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.
4 changes: 4 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
NEXT_PUBLIC_FIREBASE_APP_ID=

# Acta
NEXT_PUBLIC_ACTA_API_URL=https://acta.up.railway.app
NEXT_PUBLIC_ACTA_DEFAULT_NETWORK=testnet

Comment on lines +9 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Add API key sample and warn about client-exposed secrets.

  • .env.example is missing NEXT_PUBLIC_ACTA_API_KEY, yet code reads it in multiple places. Add it to guide setup.
  • If the ACTA API key is sensitive, avoid exposing it via NEXT_PUBLIC and route via a backend proxy. If it’s intended to be public (rate-limited per-user), document that explicitly.

Apply this diff:

 # Acta 
 NEXT_PUBLIC_ACTA_API_URL=https://acta.up.railway.app
 NEXT_PUBLIC_ACTA_DEFAULT_NETWORK=testnet
+NEXT_PUBLIC_ACTA_API_KEY=

To confirm usage and avoid dead vars, search for references:


🏁 Script executed:

#!/bin/bash
rg -n -C2 'NEXT_PUBLIC_ACTA_DEFAULT_NETWORK|NEXT_PUBLIC_ACTA_API_KEY|NEXT_PUBLIC_ACTA_API_URL'

Length of output: 3628


Add NEXT_PUBLIC_ACTA_API_KEY to .env.example and warn about public exposure

 # Acta 
 NEXT_PUBLIC_ACTA_API_URL=https://acta.up.railway.app
 NEXT_PUBLIC_ACTA_DEFAULT_NETWORK=testnet
+# WARNING: NEXT_PUBLIC_ keys are exposed to the browser. If this API key is sensitive, proxy requests through a backend; if it’s intended to be public, document rate limits and usage.
 NEXT_PUBLIC_ACTA_API_KEY=
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Acta
NEXT_PUBLIC_ACTA_API_URL=https://acta.up.railway.app
NEXT_PUBLIC_ACTA_DEFAULT_NETWORK=testnet
# Acta
NEXT_PUBLIC_ACTA_API_URL=https://acta.up.railway.app
NEXT_PUBLIC_ACTA_DEFAULT_NETWORK=testnet
# WARNING: NEXT_PUBLIC_ keys are exposed to the browser. If this API key is sensitive, proxy requests through a backend; if it’s intended to be public, document rate limits and usage.
NEXT_PUBLIC_ACTA_API_KEY=
🤖 Prompt for AI Agents
In frontend/.env.example around lines 9 to 12, the example file is missing
NEXT_PUBLIC_ACTA_API_KEY; add a line defining
NEXT_PUBLIC_ACTA_API_KEY=your_api_key_here to document the key usage, and add a
brief comment above it warning that NEXT_PUBLIC_* variables are exposed to the
browser and should only contain public-safe values or limited-scope API keys;
ensure the example uses a placeholder value and the warning text is concise.

# STELLAR CONTRACT
NEXT_PUBLIC_STELLAR_RPC_URL=https://soroban-testnet.stellar.org
NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE=Test SDF Network ; September 2015
Expand Down
377 changes: 377 additions & 0 deletions frontend/src/@types/acta.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,377 @@
/**
* ACTA (Accountable Credential Transparency and Authentication) Types
*
* Minimal type definitions for ACTA API responses and data structures.
*/

// ============================================================================
// BASE RESPONSE TYPES
// ============================================================================

/**
* Successful ACTA API response
*/
export interface ActaOk<T = unknown> {
success: true;
data: T;
}

/**
* Error ACTA API response
*/
export interface ActaErr {
success: false;
error: string;
}

/**
* Union type for all ACTA API responses
*/
export type ActaResponse<T = unknown> = ActaOk<T> | ActaErr;

// ============================================================================
// HEALTH & STATUS TYPES
// ============================================================================

/**
* ACTA health check response data
*/
export interface ActaHealth {
status: "healthy" | "unhealthy" | "degraded";
timestamp: string;
version?: string;
uptime?: number;
database?: {
status: "connected" | "disconnected";
latency?: number;
};
dependencies?: Record<
string,
{
status: "up" | "down";
latency?: number;
}
>;
}

// ============================================================================
// CREDENTIAL TYPES
// ============================================================================

/**
* Credential subject information
*/
export interface CredentialSubject {
id: string;
[key: string]: unknown;
}

/**
* Credential issuer information
*/
export interface CredentialIssuer {
id: string;
name?: string;
[key: string]: unknown;
}

/**
* Credential status information
*/
export interface CredentialStatus {
id: string;
type: string;
status?: string;
}

/**
* Credential evidence
*/
export interface CredentialEvidence {
id: string;
type: string;
[key: string]: unknown;
}

/**
* Create credential request body
*/
export interface CreateCredentialReq {
credentialSubject: CredentialSubject;
issuer: CredentialIssuer;
issuanceDate?: string;
expirationDate?: string;
credentialStatus?: CredentialStatus;
evidence?: CredentialEvidence[];
[key: string]: unknown;
}

/**
* Create credential response data
*/
export interface CreateCredentialRes {
id: string;
hash: string;
status: string;
createdAt: string;
updatedAt: string;
credential: CreateCredentialReq;
}

/**
* Get credential response data
*/
export interface GetCredentialRes {
id: string;
hash: string;
status: string;
createdAt: string;
updatedAt: string;
credential: CreateCredentialReq;
metadata?: {
verified: boolean;
verificationDate?: string;
issuerSignature?: string;
};
}

/**
* Update credential status request
*/
export interface UpdateCredentialStatusReq {
status: string;
}

/**
* Update credential status response data
*/
export interface UpdateCredentialStatusRes {
id: string;
hash: string;
status: string;
updatedAt: string;
}

// ============================================================================
// POOL PARTICIPATION TYPES
// ============================================================================

/**
* Pool participation duration options
*/
export type PoolDuration = "30d" | "90d" | "180d" | "365d" | "perpetual";

/**
* Risk level for pool participation
*/
export type PoolRiskLevel = "low" | "medium" | "high" | "very-high";

/**
* Pool participation duration for credentials (Phase 2)
*/
export type ParticipationDuration = "3+ months" | "6+ months" | "12+ months";

/**
* Risk level for credentials (Phase 2)
*/
export type CredentialRiskLevel = "Conservative" | "Moderate" | "Aggressive";

/**
* Performance tier for credentials (Phase 2)
*/
export type PerformanceTier =
| "No liquidations"
| "Stable participant"
| "Recovered events";

/**
* Pool type experience for credentials (Phase 2)
*/
export type PoolTypeExperience =
| "Multi-asset"
| "Stablecoin"
| "LSD"
| "LP-Perp";

/**
* Pool participation reputation claims for credential creation
*/
export interface ReputationClaims {
participationDuration: ParticipationDuration;
riskLevel: CredentialRiskLevel;
performanceTier: PerformanceTier;
poolTypeExperience: PoolTypeExperience[];
}

/**
* Pool participation credential data structure (Phase 2)
*/
export interface PoolParticipationCredentialData {
type: "PoolParticipationCredential";
credentialSubject: {
reputationClaims: ReputationClaims;
};
issuer?: string;
issuanceDate: string;
expirationDate?: string;
}

/**
* Local credential record for localStorage management
*/
export interface LocalCredentialRecord {
localId: string;
contractId: string;
hash: string;
displayData: {
type: string;
participationDuration: ParticipationDuration;
riskLevel: CredentialRiskLevel;
performanceTier: PerformanceTier;
poolTypeExperience: PoolTypeExperience[];
issuer?: string;
};
createdAt: string;
}

/**
* Pool performance metrics
*/
export interface PoolPerformance {
apy: number; // Annual Percentage Yield
totalValueLocked: number;
utilizationRate: number;
defaultRate?: number;
historicalReturns?: Array<{
period: string;
return: number;
}>;
}

/**
* Pool type classification
*/
export type PoolType =
| "lending"
| "borrowing"
| "liquidity"
| "staking"
| "yield-farming"
| "derivatives"
| "insurance";

/**
* Pool participation claims for credential generation
*/
export interface PoolParticipationClaims {
// Duration information
duration: PoolDuration;
startDate: string;
endDate?: string; // Optional for perpetual pools

// Risk assessment
risk: PoolRiskLevel;
riskScore?: number; // 0-100 risk score
riskFactors?: string[]; // Array of risk factor descriptions

// Performance metrics
performance: PoolPerformance;
expectedReturns?: {
min: number;
max: number;
avg: number;
};

// Pool classification
poolType: PoolType;
poolId: string;
poolName?: string;
poolDescription?: string;

// Participation details
amount: number;
currency: string;
participationDate: string;

// Additional metadata
terms?: {
minLockPeriod?: string;
penaltyForEarlyWithdrawal?: number;
autoRenewal?: boolean;
};

// Verification data
verification?: {
verifiedBy: string;
verificationDate: string;
verificationMethod: string;
[key: string]: unknown;
};
}

/**
* Pool participation credential request
*/
export interface CreatePoolParticipationCredentialReq
extends CreateCredentialReq {
credentialSubject: CredentialSubject & {
poolParticipation: PoolParticipationClaims;
};
}

/**
* Pool participation credential response
*/
export interface CreatePoolParticipationCredentialRes
extends CreateCredentialRes {
credential: CreatePoolParticipationCredentialReq;
}

// ============================================================================
// UTILITY TYPES
// ============================================================================

/**
* Check if a response is successful
*/
export function isActaOk<T>(response: ActaResponse<T>): response is ActaOk<T> {
return response.success === true;
}

/**
* Check if a response is an error
*/
export function isActaErr(response: ActaResponse): response is ActaErr {
return response.success === false;
}

/**
* Extract data from successful response or throw error
*/
export function extractActaData<T>(response: ActaResponse<T>): T {
if (isActaOk(response)) {
return response.data;
}
throw new Error(response.error);
}

/**
* Pool duration in days
*/
export const POOL_DURATION_DAYS: Record<PoolDuration, number> = {
"30d": 30,
"90d": 90,
"180d": 180,
"365d": 365,
perpetual: Infinity,
} as const;

/**
* Risk level weights for calculations
*/
export const RISK_LEVEL_WEIGHTS: Record<PoolRiskLevel, number> = {
low: 1,
medium: 2,
high: 3,
"very-high": 4,
} as const;
Loading