Skip to content

Commit

Permalink
fix: use allowance refetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeday committed Nov 7, 2024
1 parent 9cbc025 commit c7e9946
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
6 changes: 5 additions & 1 deletion modules/web3/hooks/use-allowance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { BigNumber } from 'ethers';
import { Address, WatchContractEventOnLogsFn } from 'viem';
import { useReadContract, useWatchContractEvent } from 'wagmi';

import { config } from 'config';

import { useDappStatus } from './use-dapp-status';

const nativeToBN = (data: bigint) => BigNumber.from(data.toString());
Expand Down Expand Up @@ -86,6 +88,8 @@ export const useAllowance = ({
query: {
enabled,
select: nativeToBN,
// bypasses laggy user RPCs
refetchInterval: config.PROVIDER_POLLING_INTERVAL * 2,
},
});

Expand All @@ -100,7 +104,7 @@ export const useAllowance = ({
},
// queryKey is unstable
// eslint-disable-next-line react-hooks/exhaustive-deps
[account, spender, token],
[chainId, account, spender, token],
);

useWatchContractEvent({
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"tiny-async-pool": "^1.2.0",
"tiny-invariant": "^1.1.0",
"uuid": "^8.3.2",
"viem": "2.21.40",
"wagmi": "2.12.25"
"viem": "2.21.42",
"wagmi": "2.12.27"
},
"devDependencies": {
"@commitlint/cli": "^17.4.4",
Expand Down
36 changes: 18 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4104,10 +4104,10 @@
resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406"
integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==

"@wagmi/[email protected].3":
version "5.3.3"
resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-5.3.3.tgz#ef823eeebeaa72852c0e5176bc5308f5cb8699ec"
integrity sha512-RUgwgqX7H+qg1lXBhLqcG0D5xb8USlAv4MVai4r5YpRw6lxpDvELFXxHN4ldZuUARKhH7Q3ZpfvdWyEXY+wn9w==
"@wagmi/[email protected].5":
version "5.3.5"
resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-5.3.5.tgz#79a15011c0fcd24e40e1dd1631d1744e8b09cc82"
integrity sha512-M6JTaRFN7Q50no9Rpth2azUQn1ZwiFz0NrDEumpJWqdKh6Yz0zNhqFIcalJ/8PigCHnGXXw5cVY9CtN93nQ4uQ==
dependencies:
"@coinbase/wallet-sdk" "4.1.0"
"@metamask/sdk" "0.30.1"
Expand All @@ -4116,10 +4116,10 @@
"@walletconnect/ethereum-provider" "2.17.0"
cbw-sdk "npm:@coinbase/[email protected]"

"@wagmi/[email protected].1":
version "2.14.1"
resolved "https://registry.yarnpkg.com/@wagmi/core/-/core-2.14.1.tgz#e6adb8a350cfd7be4ea9c5581768f951c60127de"
integrity sha512-Vl7VK5XdKxPfnYlp3E7U7AJSweBdfh+cd953hgAU2H+uNrekS9Nmt89l1b6WkwkYyqvccRDjsCtlcKRwvPtNAQ==
"@wagmi/[email protected].3":
version "2.14.3"
resolved "https://registry.yarnpkg.com/@wagmi/core/-/core-2.14.3.tgz#030d3f8775e7d9855f639de8eb242669b1975cfb"
integrity sha512-KpbejlQcXa5w6G9c0cXMspZJ/+ni3HzhybhoBCk9lWbQgGkI5o27Ay+FVR7TI6sMG8V5sG/XE51Rscyqg8xiNg==
dependencies:
eventemitter3 "5.0.1"
mipd "0.0.7"
Expand Down Expand Up @@ -11078,10 +11078,10 @@ vary@^1:
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==

[email protected].40:
version "2.21.40"
resolved "https://registry.yarnpkg.com/viem/-/viem-2.21.40.tgz#d73a515e3eaf2a7ec2394d1de3d8409bf4bd2e21"
integrity sha512-no/mE3l7B0mdUTtvO7z/cTLENttQ/M7+ombqFGXJqsQrxv9wrYsTIGpS3za+FA5a447hY+x9D8Wxny84q1zAaA==
[email protected].42:
version "2.21.42"
resolved "https://registry.yarnpkg.com/viem/-/viem-2.21.42.tgz#c7d64b7ba3fa548d258384d0838eca7215fa9a8c"
integrity sha512-PWBb3iaVFAzLWUaNrYLweOGwHPTQid5J4HfERh/WjJgixbAFwb4ZEc1leRfygvgJPtqUGdYNapvw9b2k2FoCAg==
dependencies:
"@adraffy/ens-normalize" "1.11.0"
"@noble/curves" "1.6.0"
Expand All @@ -11107,13 +11107,13 @@ viem@^2.1.1:
isows "1.0.4"
ws "8.17.1"

[email protected].25:
version "2.12.25"
resolved "https://registry.yarnpkg.com/wagmi/-/wagmi-2.12.25.tgz#0e4f23a96e021143f202c250ec0af3a5ea0cca08"
integrity sha512-RdQCDbTv1+b7fWCAoLEYX0loymqLnhmNrMZq1gfPEs6cOhEHYOQeZtJWnyaXOD5+3xIFw+xoA0xDNvAHVbtbKw==
[email protected].27:
version "2.12.27"
resolved "https://registry.yarnpkg.com/wagmi/-/wagmi-2.12.27.tgz#f2647e3fe8b88f142b388777a5c84e32bd57fd7d"
integrity sha512-vyPZ6mAHTabQYuMwD/LPm5aQfihtHdSE1K99lMkR8vuYFE20xxtyOYoIkpa4XbA9p0WaGBH8VoB/PBCRIB1I3w==
dependencies:
"@wagmi/connectors" "5.3.3"
"@wagmi/core" "2.14.1"
"@wagmi/connectors" "5.3.5"
"@wagmi/core" "2.14.3"
use-sync-external-store "1.2.0"

walker@^1.0.8:
Expand Down

0 comments on commit c7e9946

Please sign in to comment.