Skip to content

Commit

Permalink
Merge branch 'dev' into dependabot/npm_and_yarn/nanoid-3.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
RyRy79261 authored Dec 19, 2024
2 parents 5422ef7 + ffafb17 commit db1bd0e
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 77 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"frappe-charts": "^1.6.2",
"jsbi": "^4.3.0",
"lottie-react": "^2.4.0",
"next": "13.5.7-canary.37",
"next": "14.2.15",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/features/swap/SwapForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ export function SwapFormCard() {
}

function SwapForm() {
const balances = useAppSelector((s) => s.account.balances)
const { balances, lastUpdated } = useAppSelector((s) => s.account)
const { showSlippage } = useAppSelector((s) => s.swap)

const dispatch = useAppDispatch()
const onSubmit = (values: SwapFormValues) => {
dispatch(setFormValues(values))
dispatch(setConfirmView(true)) // Switch to confirm view
}
const validateForm = useFormValidator(balances)
const validateForm = useFormValidator(balances, lastUpdated)
const storedFormValues = useAppSelector((s) => s.swap.formValues) // Get stored form values
const initialFormValues = storedFormValues || initialValues // Use stored values if they exist

Expand Down
5 changes: 3 additions & 2 deletions src/features/swap/useFormValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import { areAmountsNearlyEqual, parseAmount, toWei } from 'src/utils/amount'
import { logger } from 'src/utils/logger'
import { useChainId } from 'wagmi'

export function useFormValidator(balances: AccountBalances) {
export function useFormValidator(balances: AccountBalances, lastUpdated: number | null) {
const chainId = useChainId()
return useCallback(
(values?: SwapFormValues): Promise<FormikErrors<SwapFormValues>> => {
return (async () => {
if (!lastUpdated) return { fromTokenId: 'Balance still loading' }
if (!values || !values.amount) return { amount: 'Amount Required' }
const parsedAmount = parseAmount(values.amount)
if (!parsedAmount) return { amount: 'Amount is Invalid' }
Expand All @@ -33,7 +34,7 @@ export function useFormValidator(balances: AccountBalances) {
return {}
})
},
[balances, chainId]
[balances, chainId, lastUpdated]
)
}

Expand Down
145 changes: 73 additions & 72 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,7 @@ __metadata:
jest: ^29.5.0
jsbi: ^4.3.0
lottie-react: ^2.4.0
next: 13.5.7-canary.37
next: 14.2.15
postcss: ^8.4.32
prettier: ^2.8.8
react: ^18.2.0
Expand Down Expand Up @@ -2124,10 +2124,10 @@ __metadata:
languageName: node
linkType: hard

"@next/env@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "@next/env@npm:13.5.7-canary.37"
checksum: cbeba53f806a30fdbbbaa48785b0784702953d2e4e3a7bc6a14cb7e6e6e005232050cc627368b233257b1d60bcc41af5cfd6d0ee789497e4c4736f40e3956177
"@next/env@npm:14.2.15":
version: 14.2.15
resolution: "@next/env@npm:14.2.15"
checksum: bf794604ee62e86ca092120c790815c0caf367009966baa14e75dbd8454a59df524327539d5febc7da42841c3bf6a10443ae0f95280599352a8def56291857fd
languageName: node
linkType: hard

Expand All @@ -2140,65 +2140,65 @@ __metadata:
languageName: node
linkType: hard

"@next/swc-darwin-arm64@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "@next/swc-darwin-arm64@npm:13.5.7-canary.37"
"@next/swc-darwin-arm64@npm:14.2.15":
version: 14.2.15
resolution: "@next/swc-darwin-arm64@npm:14.2.15"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard

"@next/swc-darwin-x64@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "@next/swc-darwin-x64@npm:13.5.7-canary.37"
"@next/swc-darwin-x64@npm:14.2.15":
version: 14.2.15
resolution: "@next/swc-darwin-x64@npm:14.2.15"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard

"@next/swc-linux-arm64-gnu@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "@next/swc-linux-arm64-gnu@npm:13.5.7-canary.37"
"@next/swc-linux-arm64-gnu@npm:14.2.15":
version: 14.2.15
resolution: "@next/swc-linux-arm64-gnu@npm:14.2.15"
conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node
linkType: hard

"@next/swc-linux-arm64-musl@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "@next/swc-linux-arm64-musl@npm:13.5.7-canary.37"
"@next/swc-linux-arm64-musl@npm:14.2.15":
version: 14.2.15
resolution: "@next/swc-linux-arm64-musl@npm:14.2.15"
conditions: os=linux & cpu=arm64 & libc=musl
languageName: node
linkType: hard

"@next/swc-linux-x64-gnu@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "@next/swc-linux-x64-gnu@npm:13.5.7-canary.37"
"@next/swc-linux-x64-gnu@npm:14.2.15":
version: 14.2.15
resolution: "@next/swc-linux-x64-gnu@npm:14.2.15"
conditions: os=linux & cpu=x64 & libc=glibc
languageName: node
linkType: hard

"@next/swc-linux-x64-musl@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "@next/swc-linux-x64-musl@npm:13.5.7-canary.37"
"@next/swc-linux-x64-musl@npm:14.2.15":
version: 14.2.15
resolution: "@next/swc-linux-x64-musl@npm:14.2.15"
conditions: os=linux & cpu=x64 & libc=musl
languageName: node
linkType: hard

"@next/swc-win32-arm64-msvc@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "@next/swc-win32-arm64-msvc@npm:13.5.7-canary.37"
"@next/swc-win32-arm64-msvc@npm:14.2.15":
version: 14.2.15
resolution: "@next/swc-win32-arm64-msvc@npm:14.2.15"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard

"@next/swc-win32-ia32-msvc@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "@next/swc-win32-ia32-msvc@npm:13.5.7-canary.37"
"@next/swc-win32-ia32-msvc@npm:14.2.15":
version: 14.2.15
resolution: "@next/swc-win32-ia32-msvc@npm:14.2.15"
conditions: os=win32 & cpu=ia32
languageName: node
linkType: hard

"@next/swc-win32-x64-msvc@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "@next/swc-win32-x64-msvc@npm:13.5.7-canary.37"
"@next/swc-win32-x64-msvc@npm:14.2.15":
version: 14.2.15
resolution: "@next/swc-win32-x64-msvc@npm:14.2.15"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
Expand Down Expand Up @@ -2633,12 +2633,20 @@ __metadata:
languageName: node
linkType: hard

"@swc/helpers@npm:0.5.2":
version: 0.5.2
resolution: "@swc/helpers@npm:0.5.2"
"@swc/counter@npm:^0.1.3":
version: 0.1.3
resolution: "@swc/counter@npm:0.1.3"
checksum: df8f9cfba9904d3d60f511664c70d23bb323b3a0803ec9890f60133954173047ba9bdeabce28cd70ba89ccd3fd6c71c7b0bd58be85f611e1ffbe5d5c18616598
languageName: node
linkType: hard

"@swc/helpers@npm:0.5.5":
version: 0.5.5
resolution: "@swc/helpers@npm:0.5.5"
dependencies:
"@swc/counter": ^0.1.3
tslib: ^2.4.0
checksum: 51d7e3d8bd56818c49d6bfbd715f0dbeedc13cf723af41166e45c03e37f109336bbcb57a1f2020f4015957721aeb21e1a7fff281233d797ff7d3dd1f447fa258
checksum: d4f207b191e54b29460804ddf2984ba6ece1d679a0b2f6a9c765dcf27bba92c5769e7965668a4546fb9f1021eaf0ff9be4bf5c235ce12adcd65acdfe77187d11
languageName: node
linkType: hard

Expand Down Expand Up @@ -4652,13 +4660,20 @@ __metadata:
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001400, caniuse-lite@npm:^1.0.30001406, caniuse-lite@npm:^1.0.30001449, caniuse-lite@npm:^1.0.30001464":
"caniuse-lite@npm:^1.0.30001400, caniuse-lite@npm:^1.0.30001449, caniuse-lite@npm:^1.0.30001464":
version: 1.0.30001568
resolution: "caniuse-lite@npm:1.0.30001568"
checksum: 7092aaa246dc8531fbca5b47be91e92065db7e5c04cc9e3d864e848f8f1be769ac6754429e843a5e939f7331a771e8b0a1bc3b13495c66b748c65e2f5bdb1220
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001579":
version: 1.0.30001690
resolution: "caniuse-lite@npm:1.0.30001690"
checksum: f2c1b595f15d8de4d9ccd155d61ac9f00ac62f1515870505a0186266fd52aef169fcddc90d8a4814e52b77107244806466fadc2c216662f23f1022a430e735ee
languageName: node
linkType: hard

"case@npm:^1.6.3":
version: 1.6.3
resolution: "case@npm:1.6.3"
Expand Down Expand Up @@ -6376,13 +6391,6 @@ __metadata:
languageName: node
linkType: hard

"glob-to-regexp@npm:^0.4.1":
version: 0.4.1
resolution: "glob-to-regexp@npm:0.4.1"
checksum: e795f4e8f06d2a15e86f76e4d92751cf8bbfcf0157cea5c2f0f35678a8195a750b34096b1256e436f0cebc1883b5ff0888c47348443e69546a5a87f9e1eb1167
languageName: node
linkType: hard

"glob@npm:7.1.6":
version: 7.1.6
resolution: "glob@npm:7.1.6"
Expand Down Expand Up @@ -6490,7 +6498,7 @@ __metadata:
languageName: node
linkType: hard

"graceful-fs@npm:^4.1.2":
"graceful-fs@npm:^4.2.11":
version: 4.2.11
resolution: "graceful-fs@npm:4.2.11"
checksum: ac85f94da92d8eb6b7f5a8b20ce65e43d66761c55ce85ac96df6865308390da45a8d3f0296dd3a663de65d30ba497bd46c696cc1e248c72b13d6d567138a4fc7
Expand Down Expand Up @@ -8439,28 +8447,29 @@ __metadata:
languageName: node
linkType: hard

"next@npm:13.5.7-canary.37":
version: 13.5.7-canary.37
resolution: "next@npm:13.5.7-canary.37"
"next@npm:14.2.15":
version: 14.2.15
resolution: "next@npm:14.2.15"
dependencies:
"@next/env": 13.5.7-canary.37
"@next/swc-darwin-arm64": 13.5.7-canary.37
"@next/swc-darwin-x64": 13.5.7-canary.37
"@next/swc-linux-arm64-gnu": 13.5.7-canary.37
"@next/swc-linux-arm64-musl": 13.5.7-canary.37
"@next/swc-linux-x64-gnu": 13.5.7-canary.37
"@next/swc-linux-x64-musl": 13.5.7-canary.37
"@next/swc-win32-arm64-msvc": 13.5.7-canary.37
"@next/swc-win32-ia32-msvc": 13.5.7-canary.37
"@next/swc-win32-x64-msvc": 13.5.7-canary.37
"@swc/helpers": 0.5.2
"@next/env": 14.2.15
"@next/swc-darwin-arm64": 14.2.15
"@next/swc-darwin-x64": 14.2.15
"@next/swc-linux-arm64-gnu": 14.2.15
"@next/swc-linux-arm64-musl": 14.2.15
"@next/swc-linux-x64-gnu": 14.2.15
"@next/swc-linux-x64-musl": 14.2.15
"@next/swc-win32-arm64-msvc": 14.2.15
"@next/swc-win32-ia32-msvc": 14.2.15
"@next/swc-win32-x64-msvc": 14.2.15
"@swc/helpers": 0.5.5
busboy: 1.6.0
caniuse-lite: ^1.0.30001406
caniuse-lite: ^1.0.30001579
graceful-fs: ^4.2.11
postcss: 8.4.31
styled-jsx: 5.1.1
watchpack: 2.4.0
peerDependencies:
"@opentelemetry/api": ^1.1.0
"@playwright/test": ^1.41.2
react: ^18.2.0
react-dom: ^18.2.0
sass: ^1.3.0
Expand All @@ -8486,11 +8495,13 @@ __metadata:
peerDependenciesMeta:
"@opentelemetry/api":
optional: true
"@playwright/test":
optional: true
sass:
optional: true
bin:
next: dist/bin/next
checksum: 1b10587ee764d86e4a9135359fdf6d636f549326518a8c45efdbc6fc55ad8dd4e3214d6db7bc0ec35992b87c07ae34da4452a794c16a60e1aa59d5f324ce0183
checksum: bed22817ea82c679e78c1f1e6530991ae89f3c51d547a876dddcda4a3b34cbb970af7c714793e1a1f0a1974859ccc97e10b5aceb61e9807ea94318116e8e7dd6
languageName: node
linkType: hard

Expand Down Expand Up @@ -11059,16 +11070,6 @@ __metadata:
languageName: node
linkType: hard

"watchpack@npm:2.4.0":
version: 2.4.0
resolution: "watchpack@npm:2.4.0"
dependencies:
glob-to-regexp: ^0.4.1
graceful-fs: ^4.1.2
checksum: 23d4bc58634dbe13b86093e01c6a68d8096028b664ab7139d58f0c37d962d549a940e98f2f201cecdabd6f9c340338dc73ef8bf094a2249ef582f35183d1a131
languageName: node
linkType: hard

"webextension-polyfill-ts@npm:^0.22.0":
version: 0.22.0
resolution: "webextension-polyfill-ts@npm:0.22.0"
Expand Down

0 comments on commit db1bd0e

Please sign in to comment.