Skip to content

Conversation

@editaahn
Copy link
Collaborator

@editaahn editaahn commented Nov 11, 2025

Linear KEPLR-1305

배경

multichain ecosystem에 맞춘 코드 베이스로 개선

  • Cosmos, EVM 체인 정보를 담는 ChainInfo 타입과 Starknet, Bitcoin 정보를 담는 ModularChainInfo 타입이 혼용되고 있어 코드 복잡성 상승 -> ModularChainInfo 타입 하나만을 주사용할 수 있도록 한다.

진행 상태

  • Extension 스모킹 테스트 마침
  • develop 브랜치 충돌 해결 완료 (2025/11/27 기준) - Topup, Supernova release 후 본 브랜치에서 병합 충돌 해결
  • peer review 완료

예정 timeline

  • Extension QA
  • Mobile QA

변경 사항 요약

  1. ModularChainInfo 타입 확장 code

    • CosmosInfoModule 타입에 evm 추가 (as-is: EVM 체인도 cosmos 타입을 사용하고 있었음)
    • EVM only chain을 위한 Union 타입, EVM compatible Cosmos를 위한 Union 타입 신규 추가함
      export type ModularChainInfo = ModularChainInfoBase &
        (
          | {
              readonly cosmos: ChainInfo;
            }
          | {
              readonly starknet: StarknetChainInfo;
            }
          | {
              readonly bitcoin: BitcoinChainInfo;
              readonly linkedChainKey: string;
            }
          // EVM only chain
          | {
              readonly evm: EVMNativeChainInfo;
            }
          // EVM compatible Cosmos chain
          | {
              readonly cosmos: ChainInfo;
              readonly evm: EVMNativeChainInfo;
            }
        );
    • isNative: 기존 ChainInfo 타입에서는 native 체인 여부를 알기 위해 embedded.embedded 또는 beta 필드 사용 -> ModularChainInfo에서는 isNative라는 이름으로 통합
        export interface ModularChainInfoBase {
          readonly chainId: string;
          readonly chainName: string;
          readonly chainSymbolImageUrl?: string;
          readonly isTestnet?: boolean;
          readonly isNative?: boolean; // 신규 추가
        }
  2. logic 상 분리: EVM <> Cosmos

    • 코드 예시
      // 변경 전 - cosmos 객체에 evm도 포함된 구조
        if ("cosmos" in modularChainInfo) { ... } 
      
      // 변경 후 - evm 객체를 동일 차원으로 분리
        if ("evm" in modularChainInfo) { 
          ... 
        } else if ("cosmos" in modularChainInfo) { 
        ... 
        } 
  3. ModularChainInfoImpl 확장 및 메서드 최적화 code packages/stores/src/chain/base.ts

    • ChainInfoImpl에만 있던 메서드 마이그레이션 + 코드 개선 (hasFeature, findCurrency, forceFindCurrency, addUnknownDenoms 등등)
    • 메서드 추가 및 조정 (matchModules, getCurrencies, getCurrenciesByModule, stakeCurrency 등등)
  4. ChainInfo -> ModularChainInfo 사용부 legacy 전면 교체

    • type 교체
      • ChainInfo, IChainInfoImpl -> ModularChainInfo, ModularChainInfoImpl
    • ChainStore 메서드 교체
      • ChainStore.getChain -> getModularChain or getModularChainInfoImpl
      • ChainStore.hasChain -> hasModularChain or matchModules
    • ChainStore accessor 교체
      • ChainStore.chainInfos -> modularChainInfos
      • chainStore.chainInfosInUI -> modularChainInfosInUI
  5. 분기가 필요한 경우는 “cosmos”, “evm”, “bitcoin” 등의 객체 존재 여부로 확인하시거나,
    getModularChainInfoImpl(chainId).matchModule(“cosmos”)
    getModularChainInfoImpl(chainId).matchModules({ or: [“cosmos”, “evm”] }) 등을 사용해주세요.

기타 참고사항

editaahn and others added 30 commits September 19, 2025 12:51
…sic-updates

ModularChainInfo 타입 수정 / stores, background 내부의 modularChainInfos 데이터 가공 시 분기
const modularChainInfo =
this.chainsService.getModularChainInfoOrThrow(chainId);

if ("evm" in modularChainInfo) {
Copy link
Collaborator

@piatoss3612 piatoss3612 Dec 18, 2025

Choose a reason for hiding this comment

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

@Thunnini finalizeKeyCoinType 메서드에서 evm을 먼저 검사하면 ethermint, cosmos/evm 체인에서 문제가 되지 않을까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants