From d55ca84235b948e1ac7654201e61a63a0acad942 Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Fri, 9 Aug 2024 10:30:47 +0200 Subject: [PATCH 1/3] fix: make demo work on helder with nginx basename to /demo --- apps/web/package.json | 7 ++++--- .../src/components/NavBar/CompanyMenu/index.tsx | 2 +- apps/web/src/hooks/useSendCallback.ts | 6 +++--- apps/web/src/index.tsx | 2 +- apps/web/src/pages/App/Layout.tsx | 4 ++-- .../pages/Swap/Send/SendCurrencyInputForm.tsx | 5 +++-- apps/web/src/pages/Swap/Send/SendForm.tsx | 14 ++++++++++++++ apps/web/src/pages/Swap/index.tsx | 16 ++++++++++++---- yarn.lock | 6 +++--- 9 files changed, 43 insertions(+), 19 deletions(-) diff --git a/apps/web/package.json b/apps/web/package.json index 1c2a8b6cec1..445742ebbd3 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -3,6 +3,7 @@ "version": "1.1.0", "description": "Uniswap Interface", "license": "GPL-3.0-or-later", + "homepage": "/demo", "scripts": { "ajv": "node scripts/compile-ajv-validators.js", "check:deps:usage": "depcheck", @@ -11,11 +12,11 @@ "i18n:upload": "./scripts/crowdin.sh upload", "i18n:download": "./scripts/crowdin.sh download", "i18n:download:if-missing": "ONLY_IF_MISSING=1 ./scripts/crowdin.sh download", - "start": "craco start", - "start:cloud": "NODE_OPTIONS=--dns-result-order=ipv4first PORT=3001 REACT_APP_SKIP_CSP=1 npx wrangler pages dev --compatibility-flags=nodejs_compat --compatibility-date=2023-08-01 --proxy=3001 --port=3000 -- yarn start", + "start": "PORT=3005 craco start", + "start:cloud": "NODE_OPTIONS=--dns-result-order=ipv4first PORT=3005 REACT_APP_SKIP_CSP=1 npx wrangler pages dev --compatibility-flags=nodejs_compat --compatibility-date=2023-08-01 --proxy=3005 --port=3006 -- yarn start", "build:production": "yarn i18n:download:if-missing && craco build", "analyze": "source-map-explorer 'build/static/js/*.js' --no-border-checks --gzip", - "serve": "serve build -s -l 3000", + "serve": "serve build -s -l 3005", "format": "../../scripts/prettier.sh", "lint": "yarn eslint --ignore-path .gitignore --cache --cache-location node_modules/.cache/eslint/ .", "lint:fix": "yarn eslint --ignore-path .gitignore --cache --cache-location node_modules/.cache/eslint/ . --fix", diff --git a/apps/web/src/components/NavBar/CompanyMenu/index.tsx b/apps/web/src/components/NavBar/CompanyMenu/index.tsx index 664d7c20789..4ccacf8df86 100644 --- a/apps/web/src/components/NavBar/CompanyMenu/index.tsx +++ b/apps/web/src/components/NavBar/CompanyMenu/index.tsx @@ -54,7 +54,7 @@ export function CompanyMenu() { return ( // - Bolt Demo + Bolt Demo // // diff --git a/apps/web/src/hooks/useSendCallback.ts b/apps/web/src/hooks/useSendCallback.ts index 42834577ecc..58d75155c52 100644 --- a/apps/web/src/hooks/useSendCallback.ts +++ b/apps/web/src/hooks/useSendCallback.ts @@ -136,11 +136,11 @@ export function useSendCallback({ throw new UserRejectedRequestError(`Transfer failed: User rejected signature`) } else if (error.message.includes('lookahead')) { setNoProposerInTheLookahead(true) - sleep(5_000).then(() => setNoProposerInTheLookahead(false)) + sleep(10_000).then(() => setNoProposerInTheLookahead(false)) throw error } else if (error.message.includes('nonce')) { setInternalError('nonce mismatch') - sleep(5_000).then(() => setInternalError(undefined)) + sleep(10_000).then(() => setInternalError(undefined)) throw error } else { throw error @@ -166,7 +166,7 @@ export function useSendCallback({ // show the preconfirmed popup for 5s sleep(200).then(() => setPreconfirmedAtSlot({ slot: response.slot, latency: response.latency })) - sleep(5_500).then(() => setPreconfirmedAtSlot(undefined)) + sleep(10_500).then(() => setPreconfirmedAtSlot(undefined)) // now start polling for actual inclusion in a block provider!.waitForTransaction(txHash).then(async (receipt) => { diff --git a/apps/web/src/index.tsx b/apps/web/src/index.tsx index a5be2b4abff..cdfb44cbc08 100644 --- a/apps/web/src/index.tsx +++ b/apps/web/src/index.tsx @@ -126,7 +126,7 @@ createRoot(container).render( - + diff --git a/apps/web/src/pages/App/Layout.tsx b/apps/web/src/pages/App/Layout.tsx index 01f4696b598..c0bcfb1be98 100644 --- a/apps/web/src/pages/App/Layout.tsx +++ b/apps/web/src/pages/App/Layout.tsx @@ -60,12 +60,12 @@ export function AppLayout() { zIndex: 1, objectFit: 'cover', }} - src="/images/background.png" + src="/demo/images/background.png" alt="background" /> Bolt Logo diff --git a/apps/web/src/pages/Swap/Send/SendCurrencyInputForm.tsx b/apps/web/src/pages/Swap/Send/SendCurrencyInputForm.tsx index 6ed3ba0f622..f59c27e66e7 100644 --- a/apps/web/src/pages/Swap/Send/SendCurrencyInputForm.tsx +++ b/apps/web/src/pages/Swap/Send/SendCurrencyInputForm.tsx @@ -145,8 +145,9 @@ const AlternateCurrencyDisplay = ({ }) // From "The art of Mocking" chapter 2 - // Assuming the input is in ETH with a price of 3,149.69 USD - const formattedAmountOutMocked = (Number(displayedValue) * 3149.69).toString() + '$' + const formattedAmountOutMocked = inputInFiat + ? (Number(displayedValue) / 2628.69).toPrecision(2) + 'ETH' + : (Number(displayedValue) * 2628.69).toString() + '$' const displayCurrency = inputInFiat ? inputCurrency?.symbol ?? '' : activeCurrency const formattedAlternateCurrency = formattedAmountOut + ' ' + displayCurrency diff --git a/apps/web/src/pages/Swap/Send/SendForm.tsx b/apps/web/src/pages/Swap/Send/SendForm.tsx index a6cad4ec229..a6be544896c 100644 --- a/apps/web/src/pages/Swap/Send/SendForm.tsx +++ b/apps/web/src/pages/Swap/Send/SendForm.tsx @@ -243,6 +243,20 @@ export function SendForm(props: SendFormProps) { + + {/* */} ) diff --git a/apps/web/src/pages/Swap/index.tsx b/apps/web/src/pages/Swap/index.tsx index efdf352fdca..49311d9aced 100644 --- a/apps/web/src/pages/Swap/index.tsx +++ b/apps/web/src/pages/Swap/index.tsx @@ -210,7 +210,7 @@ function ShowPreconfirmedComponent() { >
- bolt mascot + bolt mascot
- bolt mascot + bolt mascot
- No luck this time, try again later! + No Bolt proposers in the lookahead, try again later!

@@ -360,7 +364,11 @@ function ShowInternalErrorComponent() { >
- bolt mascot + bolt mascot
Date: Fri, 9 Aug 2024 10:33:24 +0200 Subject: [PATCH 2/3] chore: shorten msg --- apps/web/src/components/NavBar/CompanyMenu/index.tsx | 2 +- apps/web/src/pages/Swap/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/NavBar/CompanyMenu/index.tsx b/apps/web/src/components/NavBar/CompanyMenu/index.tsx index 4ccacf8df86..8590f558a39 100644 --- a/apps/web/src/components/NavBar/CompanyMenu/index.tsx +++ b/apps/web/src/components/NavBar/CompanyMenu/index.tsx @@ -54,7 +54,7 @@ export function CompanyMenu() { return ( // - Bolt Demo + Bolt Demo // // diff --git a/apps/web/src/pages/Swap/index.tsx b/apps/web/src/pages/Swap/index.tsx index 49311d9aced..fdd713a3d12 100644 --- a/apps/web/src/pages/Swap/index.tsx +++ b/apps/web/src/pages/Swap/index.tsx @@ -337,7 +337,7 @@ function ShowBadLuckComponent() { width: '100%', }} > - No Bolt proposers in the lookahead, try again later! + No Bolt proposers in the lookahead window

From b2fc42acf438ae1769d0fb6761dc1af450ed3a6f Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Fri, 9 Aug 2024 15:03:13 +0200 Subject: [PATCH 3/3] chore: minor change --- apps/web/src/pages/Swap/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/pages/Swap/index.tsx b/apps/web/src/pages/Swap/index.tsx index fdd713a3d12..54653b5a736 100644 --- a/apps/web/src/pages/Swap/index.tsx +++ b/apps/web/src/pages/Swap/index.tsx @@ -337,7 +337,7 @@ function ShowBadLuckComponent() { width: '100%', }} > - No Bolt proposers in the lookahead window + No Bolt proposers in the lookahead window, try again later!