diff --git a/src/components/SignMessage/SignMessage.js b/src/components/SignMessage/SignMessage.js index f1fb8f3db..7e19d3e0c 100644 --- a/src/components/SignMessage/SignMessage.js +++ b/src/components/SignMessage/SignMessage.js @@ -36,9 +36,9 @@ export default function SignMessage({ const [promiseResolve, setPromiseResolve] = useState(null) const inputSecretRef = useRef(null) const textAreaRef = useRef(null) - const location = useLocation(); - const queryParams = new URLSearchParams(location.search); - const isTomek = queryParams.get('isTomek'); + const location = useLocation() + const queryParams = new URLSearchParams(location.search) + const isTomek = queryParams.get('isTomek') const onConfirmationCodeRequired = async (confCodeRequired, approveQuickAcc) => { const confCode = await new Promise((resolve) => { @@ -72,19 +72,30 @@ export default function SignMessage({ onConfirmationCodeRequired, useStorage }) - - const isSnapshot = (_dappName, _txn) => _dappName && _dappName.startsWith('https://snapshot.org') && _txn.domain && _txn.domain.name === 'snapshot' + + const isSnapshot = (_dappName, _txn) => + _dappName && + ['https://snapshot.org', 'https://snapshot.box'].includes(_dappName) && + _txn.domain && + _txn.domain.name === 'snapshot' const isOkPermit2 = (_txn, _chainId) => _txn.primaryType && _txn.primaryType.toLowerCase().includes('permit') && - _txn.message && _txn.message.spender && - UNISWAP_UNIVERSAL_ROUTERS[_chainId] && + _txn.message && + _txn.message.spender && + UNISWAP_UNIVERSAL_ROUTERS[_chainId] && _txn.message.spender.toLowerCase() === UNISWAP_UNIVERSAL_ROUTERS[_chainId].toLowerCase() && - _txn.domain && _txn.domain.verifyingContract && + _txn.domain && + _txn.domain.verifyingContract && _txn.domain.verifyingContract.toLowerCase() === PERMIT_2_ADDRESS.toLowerCase() const isSigTool = (_dappUrl) => _dappUrl === 'https://sigtool.ambire.com/' - const isDAppSupported = !isTypedData || isTomek==='true' || (dApp && dataV4 && isSnapshot(dApp.url, dataV4)) || isOkPermit2(dataV4, requestedChainId) || (dApp && isSigTool(dApp.url)) + const isDAppSupported = + !isTypedData || + isTomek === 'true' || + (dApp && dataV4 && isSnapshot(dApp.url, dataV4)) || + isOkPermit2(dataV4, requestedChainId) || + (dApp && isSigTool(dApp.url)) const onScroll = (textArea) => { if (textArea.scrollHeight - textArea.scrollTop - textArea.clientHeight < 1) { @@ -276,7 +287,7 @@ export default function SignMessage({ variant="primaryGradient" className={styles.button} loading={isLoading} - disabled={ !isDAppSupported || !hasScrolledToBottom || typeDataErr} + disabled={!isDAppSupported || !hasScrolledToBottom || typeDataErr} loadingText="Signing..." > Sign