diff --git a/package.json b/package.json index d0b90231..ddcc8b88 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "@fortawesome/free-solid-svg-icons": "6.4.0", "@fortawesome/react-fontawesome": "0.2.0", "@multiversx/sdk-core": "12.16.0", - "@multiversx/sdk-dapp": "2.25.2", + "@multiversx/sdk-dapp": "2.26.2", "@multiversx/sdk-network-providers": "2.2.0", "axios": "1.6.2", "classnames": "2.3.2", diff --git a/src/hooks/index.ts b/src/hooks/index.ts index 1bead67c..f5eff249 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -2,3 +2,4 @@ export * from './sdkDappHooks'; export * from './withPageTitle'; export * from './transactions'; export * from './useScrollToElement'; +export * from './useIsWebProvider'; diff --git a/src/hooks/useIsWebProvider.ts b/src/hooks/useIsWebProvider.ts new file mode 100644 index 00000000..0828fa05 --- /dev/null +++ b/src/hooks/useIsWebProvider.ts @@ -0,0 +1,9 @@ +import { LoginMethodsEnum } from 'types/sdkDappTypes'; +import { useGetAccountProvider } from './sdkDappHooks'; + +export const useIsWebProvider = () => { + const { providerType } = useGetAccountProvider(); + const isWebProvider = providerType === LoginMethodsEnum.wallet; + + return { isWebProvider }; +}; diff --git a/src/pages/Dashboard/components/Widget.tsx b/src/pages/Dashboard/components/Widget.tsx index 1bd5bdc3..ec796eb1 100644 --- a/src/pages/Dashboard/components/Widget.tsx +++ b/src/pages/Dashboard/components/Widget.tsx @@ -1,8 +1,7 @@ import { Card } from 'components/Card'; import { getCallbackRoute } from 'utils/getCallbackRoute'; import { WidgetType } from 'types/widget.types'; -import { LoginMethodsEnum } from 'types/sdkDappTypes'; -import { useGetAccountProvider } from 'hooks/sdkDappHooks'; +import { useIsWebProvider } from 'hooks'; export const Widget = ({ title, @@ -12,9 +11,10 @@ export const Widget = ({ widget: MxWidget, props = {} }: WidgetType) => { - const { providerType } = useGetAccountProvider(); - const isWebWallet = providerType === LoginMethodsEnum.wallet; - const callbackRoute = anchor ? getCallbackRoute({ anchor, isWebWallet }) : ''; + const { isWebProvider } = useIsWebProvider(); + const callbackRoute = anchor + ? getCallbackRoute({ anchor, isWebProvider }) + : ''; return ( { - if (!isWebWallet) { + if (!isWebProvider) { return ''; } diff --git a/yarn.lock b/yarn.lock index 9ad8d353..bd814eaf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -924,16 +924,15 @@ keccak "3.0.2" protobufjs "7.2.4" -"@multiversx/sdk-dapp@2.25.2": - version "2.25.2" - resolved "https://registry.yarnpkg.com/@multiversx/sdk-dapp/-/sdk-dapp-2.25.2.tgz#64ce52b9c9c7adeff0ec24aa2d2bfeca0d188eb8" - integrity sha512-mWd25A/mznIXkJn6LmSMX8IotpJHCGixLjWO+4Lxok0cztnQ3pQWzimJ5Mfiu/k0eYJxv53X3C1YO11DnWvjWA== +"@multiversx/sdk-dapp@2.26.2": + version "2.26.2" + resolved "https://registry.yarnpkg.com/@multiversx/sdk-dapp/-/sdk-dapp-2.26.2.tgz#eec7be64e735485dfa6fe9dfd5504055fae90d6b" + integrity sha512-vzHoIy9Sg+ptvcqH0S8amO9rmF8vB1K3tqBzhAk75ekHo4Nnrw/mmhqJClH7IwqTpp6/CFSXM/RBVaPVh1wiqA== dependencies: "@multiversx/sdk-core" "12.16.0" "@multiversx/sdk-extension-provider" "3.0.0" "@multiversx/sdk-hw-provider" "6.4.0" "@multiversx/sdk-native-auth-client" "1.0.6" - "@multiversx/sdk-network-providers" "2.2.0" "@multiversx/sdk-opera-provider" "1.0.0-alpha.1" "@multiversx/sdk-wallet" "4.2.0" "@multiversx/sdk-wallet-connect-provider" "4.0.4"