-
[Intern] Controller 부분 분기문 처리 수정 / 최종 코드 테스트Intern/Project 2024. 12. 29. 20:33
✏ 근무 내용
- controller 부분 분기문 처리 수정
- squid api 연동 트랜잭션 개발 내용 PR 올리기 및 최종 코드 테스트
⭐근무 결과
Squid - have a nice swap.
Get the tokens you want on any chain.
app.squidrouter.com
[예시로 조회되어야 할 해시값 목록]
- 이더리움↔아비트리움 간
- 이더리움 ↔ 베이스 간
- controller 부분 분기문 처리 수정
에러 처리 순서:
- LayerZeroError 발생 시 CCTP API로 전환.
- CCTPapiError 발생 시 Squid API로 전환.
- CrawlingError 발생 시 Range 크롤링으로 전환.
- 기타 알 수 없는 에러는 재발생.
[getRecipientActivitiesFromCCTP: CCTP 데이터를 통한 수신 활동 조회]
- 입력된 txHash로 트랜잭션 정보를 조회: getTransactionInfoFromRange.
- txInfo가 유효하지 않거나 from_network 속성이 없으면 CCTPapiError 발생.
- 성공적으로 데이터를 조회하면 CCTP API에서 수신 트랜잭션 리스트 가져옴: getRecipientTxListFromCCTP.
- CCTP 처리 실패 시 CrawlingError로 재정의하여 에러를 던짐.
} catch (error) { if (error instanceof LayerZeroError) { console.error("LayerZero 에러 발생. CCTP api로 전환:", error.message); try { const result = await this.getRecipientActivitiesFromCCTP(txHash); return result; } catch (cctpError) { if (cctpError instanceof CCTPapiError) { console.error("CCTP api 처리 실패. Squid api로 전환:", cctpError.message); try { const result = await this.apiService.fetchTransactionData(txHash); return result; } catch (squidError) { console.error("Squid API 처리 실패. Range 크롤링으로 전환:", squidError.message); if (squidError instanceof SquidapiError) { const result = await this.apiService.fetchAndParseHtml(txHash); return result; } } } } } else { console.error("알 수 없는 에러 발생:", error.message); throw error; } } } private async getRecipientActivitiesFromCCTP(txHash: string) { try { const txInfo = await this.apiService.getTransactionInfoFromRange(txHash); if (!txInfo || typeof txInfo.from_network === 'undefined') { throw new CCTPapiError('Invalid txInfo or missing from_network property'); } return this.apiService.getRecipientTxListFromCCTP(txInfo); } catch (error) { // CCTPapiError 외의 에러를 SquidapiError로 감쌈 if (!(error instanceof CCTPapiError)) { throw new SquidapiError('CCTP 처리 실패: ' + (error.message || 'Unknown error')); } throw error; } }
이후 구현되어야 할 부분
- source/destination tx - value 값, sender/receiver address 값 검증 필요
- 브릿지 이후 tx 조회 개발
반응형'Intern > Project' 카테고리의 다른 글
[Intern] 트랜잭션 조회 로직 고도화 (안뜨는 token value 데이터 처리) (0) 2024.12.19 [Intern] Squid api 연동 출발 및 도착 체인 트랜잭션 정보 조회 개발 (0) 2024.12.18 [Intern] Squid router API 데이터 분석 (0) 2024.12.17 [Intern] Squid 브리지 api 연동 및 데이터 확인 (0) 2024.12.13 [Intern] 캐싱 및 redis 사용 검색 속도 향상 적용 (0) 2024.12.12