server.js 소스 코드를 직접 분석하여 작성된 API 명세입니다.
본 프로젝트의 모든 인증은 authenticateUser 미들웨어를 통해 처리됩니다. API 호출 시 HTTP 헤더에 Supabase에서 발급받은 JWT를 포함해야 합니다.
Authorization: Bearer <SUPABASE_JWT>POST /api/friends/add{
"userId": "<요청자_UUID>",
"friendEmail": "<친구의_이메일>"
}
{"message": "친구 요청이 전송되었습니다."}{"error": "해당 이메일의 사용자를 찾을 수 없습니다."}GET /api/friends{
"friends": [
{
"id": "<친구_UUID>",
"profile": {
"id": "<친구_UUID>",
"name": "친구 이름",
"email": "friend@example.com",
"profile_image_url": "<URL>"
}
}
]
}
GET /api/friends/received{
"requests": [
{
"id": "<요청_레코드_ID>",
"user_id": "<요청자_UUID>",
"profile": { ... }
}
]
}
PATCH /api/friends/request{
"requestId": "<요청_레코드_ID>",
"status": "accepted"
}
{"message": "친구 요청이 업데이트되었습니다."}POST /createLoan{
"id": "<대출_고유_ID>",
"lender": "<채권자_지갑주소>",
"borrower": "<채무자_지갑주소>",
"amount": 100000,
"durationDays": 30,
"interestRate": 5.0
}
{"message": "Loan created on chain and DB", "txId": "..."}GET /approveLoan?id=<대출_고유_ID>{"success": true, "message": "대출 승인 완료 (체인+DB 기록됨)", "chainResult": "..."}POST /loan/repay{
"loanId": "<대출_고유_ID>"
}
{"success": true, "result": "..."}GET /myLoans?wallet=<사용자_지갑주소>GET /queryAllLoansPOST /createPool{
"id": "<풀_ID>",
"name": "<풀_이름>",
"minDeposit": 10000,
"interestRate": 10.0,
"durationMonths": 6,
"creatorAddress": "<생성자_지갑주소>",
"initialDeposit": 50000
}
{"message": "풀 생성 완료", "poolId": "..."}POST /joinPool{
"poolID": "<풀_ID>",
"userAddress": "<참여자_지갑주소>",
"deposit": 20000
}
{"message": "참여 완료", "result": "..."}GET /QueryPoolsByUser?wallet=<사용자_지갑주소>POST /api/contract/save{
"loanId": "<대출_고유_ID>",
"contractImage": "<Base64_인코딩된_이미지_데이터>"
}
{"success": true, "message": "계약서 해시가 저장되었습니다.", "contractHash": "..."}GET /api/transaction/:txHashtxHash: 조회할 트랜잭션의 해시값{
"success": true,
"transaction": {
"txHash": "...",
"contractHash": "...",
"createdAt": "...",
"loanInfo": { ... },
"verification": {
"isContractValid": true,
"isTransactionValid": true,
"lastVerified": "..."
}
}
}
POST /check-email{"email": "user@example.com"}{"exists": true, "provider": "google"}POST /api/inquiry{
"name": "문의자 이름",
"email": "user@example.com",
"message": "문의 내용",
"captchaToken": "<reCAPTCHA_토큰>"
}
{"success": true, "data": [ ... ]}