로컬에서 Uniswap 프론트엔드 구동 후 테스트넷 이용하기

로컬에서 Uniswap 프론트엔드 구동 후 테스트넷 이용하기

유니스왑을 테스트넷 환경에서 사용하는법은 간단하다. 연결된 월렛의 네트워크를 테스트넷으로 변경하면된다. 혹은 쿼리스트링에서 체인을 명시해주면 된다. 예를들어 Ethereum Sepolia테스트넷에서 유니스왑을 사용하고 싶으면 아래 url처럼 하면 된다.

https://app.uniswap.org/swap?chain=sepolia

그러나 현재의 uniswap web interface는 sepolia테스트넷 환경에서 제대로 작동하지 않는다.

Uniswap Sepolia issues
We do have Sepolia v3 setup, although the Sepolia testnet is currently having issues in the Uniswap app. The developers are aware, and a fix is planned. Currently, there is no estimation for this completion.
 
Here is an older version without the bug. (two links are the same version, just different types of IPFS routing as some browsers will only use one)

The v2 setup here is broken, please don’t use the v2. v2 is currently not available.
Verify these are official here.
Version 1 link 1
Version 1 link 2

이 문제가 올해 초에 처음 겪고 해결되길 기다렸으나 거의 반년째 방치되어있다. 공식 디스코드에서 안내해준 과거버전의 Uniswap으로 접속하려했으나 이 역시 접속이 되지 않는다.

'Official here'에 걸려있는 url은 https://github.com/Uniswap/interface/releases?page=3 인데 이미 시간이 흐른 뒤라 어떤 버전을 지칭하고 있는지도 불명확하다. 3페이지의 무슨버전을 지칭하는지?🧐

Uniswap Interface는 github에 공개되어 있다. 그러나 가이드대로 실행해도...역시나 제대로 되지 않는다.

GitHub - Uniswap/interface: 🦄 Open source interfaces for the Uniswap protocol
🦄 Open source interfaces for the Uniswap protocol. Contribute to Uniswap/interface development by creating an account on GitHub.

직접 local에서 Uniswap Interface를 실행해보았고 테스트넷환경에서 잘 작동하는걸 확인하는 과정을 기록해보았다.

문제 및 해결책

  • .env.defaults가 존재하지 않음
  • apps/web/src/utils/__generated__ 가 존재하지 않음
  • 테스트넷환경이 잘 돌아가는 버전이 있고 오류가 있는 버전이 있다. 아래는 내가 테스트해본 버전이다. 나는 5.19.3버전을 현재 사용하고 있다.
    • 테스트넷 잘 작동함
      • 5.17.0
      • 5.19.1
      • 5.19.3
    • 테스트넷 작동 안함
      • 5.27.2

아래는 내가 사용한 스크립트이다.

이대로 복사 붙여넣기하면 잘 작동할것이다.

git clone https://github.com/Uniswap/interface
cd interface
git fetch --all --tags
git checkout tags/web/5.19.3
mkdir apps/web/src/utils/__generated__  # https://github.com/Uniswap/interface/issues/7631
# create .env.defaults file under project root.
# https://github.com/Uniswap/interface/issues/7678
cat <<EOL > .env.defaults
ALCHEMY_API_KEY='key'
AMPLITUDE_EXPERIMENTS_DEPLOYMENT_KEY='key'
APPSFLYER_API_KEY='key'
APPSFLYER_APP_ID="123"
FIAT_ON_RAMP_API_URL='https://api.uniswap.org'
MOONPAY_API_KEY='key'
MOONPAY_API_URL='https://api.moonpay.com'
MOONPAY_WIDGET_API_URL='https://api.moonpay.com'
INFURA_PROJECT_ID="123"
ONESIGNAL_APP_ID="123"
QUICKNODE_BNB_RPC_URL='https://api.uniswap.org'
SENTRY_DSN='http://sentry.com'
SHAKE_CLIENT_ID="123"
SHAKE_CLIENT_SECRET="123"
SIMPLEHASH_API_KEY='key'
SIMPLEHASH_API_URL='https://api.simplehash.com'
STATSIG_PROXY_URL='https://api.statsig.com'
TEMP_SCANTASTIC_URL='https://api.uniswap.org'
TRADING_API_KEY='key'
TRADING_API_URL='https://api.uniswap.org'
UNISWAP_API_KEY='key'
UNISWAP_API_BASE_URL='https://api.uniswap.org'
UNISWAP_APP_URL='https://app.uniswap.org'
WALLETCONNECT_PROJECT_ID="123"
UNITAGS_API_URL='https://api.uniswap.org/unitags'
FIREBASE_APP_CHECK_DEBUG_TOKEN='token'
EOL

yarn
yarn web start