From 7e51f45af5f71f525e0faa0c2da14073400ea2ef Mon Sep 17 00:00:00 2001 From: SotaTek-TungNguyen2 Date: Mon, 11 Dec 2023 16:25:38 +0700 Subject: [PATCH] fix: temporary use snap version 0.1.1 for the site --- packages/site/.env.example | 1 + packages/site/src/services/useMinaSnap.ts | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/site/.env.example b/packages/site/.env.example index 40f19a3..f3d30c8 100644 --- a/packages/site/.env.example +++ b/packages/site/.env.example @@ -2,6 +2,7 @@ REACT_APP_SNAP_ID=npm:mina-portal REACT_APP_SNAP_VERSION=* REACT_APP_MIN_SNAP_VERSION=1.2.0 REACT_APP_ZK_ADDRESS=B62qnnzR3T62Du9ad2ug8HzuSbG8G1y61qmXVFx3ZSDNyP6rLRbWz46 +NEED_UPDATE=false # environment: develop | staging | production NODE_ENV=develop diff --git a/packages/site/src/services/useMinaSnap.ts b/packages/site/src/services/useMinaSnap.ts index f073420..326067f 100644 --- a/packages/site/src/services/useMinaSnap.ts +++ b/packages/site/src/services/useMinaSnap.ts @@ -63,10 +63,13 @@ export const useMinaSnap = () => { const connectToSnap = async () => { const latestSnapVersion = await getLatestSnapVersion(); - const version = (snapVersion != latestSnapVersion) ? latestSnapVersion : snapVersion; + let version = snapVersion; + if (process.env.REACT_APP_NEED_UPDATE && (snapVersion != latestSnapVersion)) { + version = latestSnapVersion; + } return await ethereum.request({ method: 'wallet_requestSnaps', - params: { [snapId]: { version: `^${version}` } } }) + params: { [snapId]: { version: `${version}` } } }) }; const getSnap = async () => {