diff --git a/src/@types/partners.ts b/src/@types/partners.ts
index 1fca043f..1ce6da93 100644
--- a/src/@types/partners.ts
+++ b/src/@types/partners.ts
@@ -4,6 +4,7 @@ export interface PartnerDataType {
}
export interface AttributesType {
+ cChainAddresses?: { Network: string; cAddress: string; id: number }[]
cChainAddress?: string
contactEmail?: string
companyName?: string
@@ -12,7 +13,7 @@ export interface AttributesType {
contactFirstname?: string
contactLastname?: string
contactPhone?: string
- pChainAddresses?: string[]
+ pChainAddresses?: { Network: string; pAddress: string; id: number }[]
pChainAddress?: string
companyShortDescription?: string
companyLongDescription?: string
diff --git a/src/components/Input.tsx b/src/components/Input.tsx
index ca85b4aa..b7e75d47 100644
--- a/src/components/Input.tsx
+++ b/src/components/Input.tsx
@@ -81,9 +81,14 @@ const Input = ({ ...rest }) => {
/>
{error && (
- {parseFloat(state.balance) < 100 || !state.balance || state.balance === '0'
+ {parseFloat(state.balance) < 100 ||
+ !state.balance ||
+ state.balance === '0' ||
+ parseFloat(maxBalance) < 100
? 'Balance must be at least 100'
- : `Balance cannot exceed ${parseFloat(maxBalance) - 0.5}`}
+ : parseFloat(state.balance) < 100.5
+ ? `Insufficient funds: Your wallet balance is too low to create a Camino Messenger account.`
+ : `Prefund Amount cannot exceed ${parseFloat(maxBalance) - 0.5}`}
)}
>
diff --git a/src/components/Partners/PartnerCard.tsx b/src/components/Partners/PartnerCard.tsx
index 40886e3d..729ae12d 100644
--- a/src/components/Partners/PartnerCard.tsx
+++ b/src/components/Partners/PartnerCard.tsx
@@ -6,6 +6,7 @@ import { useAppSelector } from '../../hooks/reduxHooks'
import { useEffectOnce } from '../../hooks/useEffectOnce'
import useWallet from '../../hooks/useWallet'
import { selectValidators } from '../../redux/slices/app-config'
+import { getActiveNetwork } from '../../redux/slices/network'
import PartnerBusinessFields from './PartnerBusinessFields'
import PartnerFlag from './PartnerFlag'
import PartnerLogo from './PartnerLogo'
@@ -23,10 +24,13 @@ const PartnerCard: React.FC = ({ partner, clickable, onClick }
const [isValidator, setIsValidator] = useState(false)
const validators = useAppSelector(selectValidators)
const { getAddress } = useWallet()
+ const activeNetwork = useAppSelector(getActiveNetwork)
const chackValidatorStatus = async (address: string) => {
- if (!pChainAddress) setIsValidator(false)
- let nodeID = await getRegisteredNode(getAddress(address))
- setIsValidator(!!validators.find(v => v.nodeID === nodeID))
+ try {
+ if (!pChainAddress) setIsValidator(false)
+ let nodeID = await getRegisteredNode(getAddress(address))
+ setIsValidator(!!validators.find(v => v.nodeID === nodeID))
+ } catch (e) {}
}
const {
attributes: {
@@ -41,7 +45,12 @@ const PartnerCard: React.FC = ({ partner, clickable, onClick }
},
} = partner
useEffect(() => {
- if (pChainAddress) chackValidatorStatus(pChainAddress)
+ if (pChainAddresses) {
+ let partnerAddresses = pChainAddresses.find(
+ elem => elem.Network.toLowerCase() === activeNetwork.name.toLowerCase(),
+ )
+ if (partnerAddresses) chackValidatorStatus(partnerAddresses.pAddress)
+ }
}, [partner, validators])
return (
= ({ state, dispatchPartners
const searchByName = param =>
dispatchPartnersActions({ type: partnersActions.UPDATE_COMPANY_NAME, payload: param })
return (
-
+
@@ -67,6 +76,28 @@ const PartnersFilter: React.FC = ({ state, dispatchPartners
/>
+
+
+
)
}
diff --git a/src/constants/route-paths.ts b/src/constants/route-paths.ts
index 11eb9339..52056700 100644
--- a/src/constants/route-paths.ts
+++ b/src/constants/route-paths.ts
@@ -40,4 +40,6 @@ export const XCHAIN = BASE_PATH + '/x-chain'
export const PCHAIN = BASE_PATH + '/p-chain'
-export const TERMS_OF_USE_URL = 'https://camino.network/terms/'
\ No newline at end of file
+export const TERMS_OF_USE_URL = 'https://camino.network/terms/'
+
+export const REGISTER_PARTNER_URL = 'https://9gp400vrnwo.typeform.com/supporter'
diff --git a/src/layout/PartnersLayout.tsx b/src/layout/PartnersLayout.tsx
index de0daf93..35eef053 100644
--- a/src/layout/PartnersLayout.tsx
+++ b/src/layout/PartnersLayout.tsx
@@ -1,7 +1,7 @@
import { Box, Button, Link, Toolbar, Typography } from '@mui/material'
import { Paper } from '@mui/material'
-import React, { useEffect } from 'react'
+import React, { useEffect, useMemo } from 'react'
import { Navigate, Outlet, useNavigate, useParams } from 'react-router'
import store from 'wallet/store'
import { PartnerConfigurationProvider } from '../helpers/partnerConfigurationContext'
@@ -64,18 +64,24 @@ const ClaimProfile = () => {
const PartnersLayout = () => {
const path = window.location.pathname
- const { data, isLoading } = useIsPartnerQuery({
+ const { data, isLoading, refetch } = useIsPartnerQuery({
cChainAddress: store?.state?.activeWallet?.ethAddress
? '0x' + store?.state?.activeWallet?.ethAddress
: '',
})
let { partnerID } = useParams()
- const { data: partner } = useFetchPartnerDataQuery({
+ const { data: partner, refetch: refetchPartenrData } = useFetchPartnerDataQuery({
companyName: partnerID,
})
const walletName = useAppSelector(getWalletName)
const navigate = useNavigate()
-
+ const activeNetwork = useAppSelector(getActiveNetwork)
+ useEffect(() => {
+ if (activeNetwork) {
+ refetch()
+ refetchPartenrData()
+ }
+ }, [activeNetwork])
useEffect(() => {
if (
walletName &&
@@ -86,7 +92,13 @@ const PartnersLayout = () => {
}
}, [walletName])
- const activeNetwork = useAppSelector(getActiveNetwork)
+ const partnerCChainAddress = useMemo(() => {
+ let cAddress = data?.attributes?.cChainAddresses.find(
+ elem => elem.Network === activeNetwork.name.toLowerCase(),
+ )
+ if (cAddress) return cAddress
+ return ''
+ }, [data])
if (isLoading) return <>>
if (
path.includes('partners/messenger-configuration') &&
@@ -129,7 +141,7 @@ const PartnersLayout = () => {
{((path.includes('partners/messenger-configuration') &&
!!data &&
- data?.attributes?.cChainAddress) ||
+ partnerCChainAddress) ||
(partner &&
partner?.contractAddress &&
partnerID === partner.attributes.companyName)) && (
@@ -158,7 +170,7 @@ const PartnersLayout = () => {
mt:
(path.includes('partners/messenger-configuration') &&
!!data &&
- data?.attributes?.cChainAddress) ||
+ partnerCChainAddress) ||
(path !== '/partners' && partner?.contractAddress)
? '9rem'
: '5rem',
@@ -173,7 +185,7 @@ const PartnersLayout = () => {
{!path.includes('partners/messenger-configuration') ||
(path.includes('partners/messenger-configuration') &&
!!data &&
- data?.attributes?.cChainAddress) ? (
+ partnerCChainAddress) ? (
) : (
diff --git a/src/redux/services/partners.ts b/src/redux/services/partners.ts
index d427f966..d58a83e2 100644
--- a/src/redux/services/partners.ts
+++ b/src/redux/services/partners.ts
@@ -159,6 +159,7 @@ export const partnersApi = createApi({
let query = '?populate=*'
+ const selectedNetwork = store.getters['Network/selectedNetwork']
if (!isNaN(page) && !onMessenger) {
query += `&sort[0]=companyName:asc&pagination[page]=${page}&pagination[pageSize]=12`
}
@@ -176,11 +177,10 @@ export const partnersApi = createApi({
query += `&filters[companyName][$contains]=${companyName}`
}
if (validators) {
- query += `&filters[pChainAddress][$ne]=null`
+ query += `&filters[$and][0][pChainAddresses][pAddress][$notNull]=true&filters[$and][1][pChainAddresses][Network][$eq]=${selectedNetwork.name.toLowerCase()}`
}
- // Only add the cChainAddress filter if onMessenger is explicitly true
if (onMessenger === true) {
- query += `&sort[0]=companyName:asc&_limit=-1&filters[cChainAddress][$ne]=null`
+ query += `&sort[0]=companyName:asc&_limit=-1&filters[$and][0][cChainAddresses][cAddress][$notNull]=true&filters[$and][1][cChainAddresses][Network][$eq]=${selectedNetwork.name.toLowerCase()}`
}
return {
@@ -205,11 +205,14 @@ export const partnersApi = createApi({
const partnersWithServices = await Promise.all(
response.data.map(async partner => {
- if (partner.attributes.cChainAddress) {
+ let partnerCChainAddress = partner?.attributes?.cChainAddresses?.find(
+ elem => elem.Network === selectedNetwork.name.toLowerCase(),
+ )
+ if (partnerCChainAddress?.cAddress) {
const contractAddress = Array.from(contractMappings.entries()).find(
([_, partnerAddress]) =>
partnerAddress.toLowerCase() ===
- partner.attributes.cChainAddress.toLowerCase(),
+ partnerCChainAddress?.cAddress.toLowerCase(),
)?.[0]
if (contractAddress) {
@@ -250,7 +253,7 @@ export const partnersApi = createApi({
contractAddress,
bots,
supportedCurrencies,
- isOnMessenger: Boolean(partner.attributes.cChainAddress),
+ isOnMessenger: Boolean(partnerCChainAddress.cAddress),
}
}
}
@@ -295,9 +298,10 @@ export const partnersApi = createApi({
query: ({ companyName, cChainAddress }) => {
if (cChainAddress) {
const baseUrl = getBaseUrl()
+ const selectedNetwork = store.getters['Network/selectedNetwork']
let query =
'?populate=*&sort[0]=companyName:asc&pagination[page]=1&pagination[pageSize]=12'
- query += `&filters[cChainAddress][$eq]=${cChainAddress}`
+ query += `&filters[$and][0][cChainAddresses][cAddress][$containsi]=${cChainAddress}&filters[$and][1][cChainAddresses][Network][$eq]=${selectedNetwork.name.toLowerCase()}`
return `${baseUrl}${query}`
}
if (companyName) {
@@ -310,7 +314,12 @@ export const partnersApi = createApi({
},
async transformResponse(response: PartnersResponseType, _meta, arg) {
const partnerData = response.data[0]
- if (partnerData && partnerData.attributes.cChainAddress) {
+ const selectedNetwork = store.getters['Network/selectedNetwork']
+ let partnerCChainAddress = partnerData?.attributes?.cChainAddresses.find(
+ elem => elem.Network === selectedNetwork.name.toLowerCase(),
+ )
+
+ if (partnerData && partnerCChainAddress.cAddress) {
const selectedNetwork = store.getters['Network/selectedNetwork']
const providerUrl = `${selectedNetwork.protocol}://${selectedNetwork.ip}:${selectedNetwork.port}/ext/bc/C/rpc`
const provider = new ethers.JsonRpcProvider(providerUrl)
@@ -318,9 +327,7 @@ export const partnersApi = createApi({
const contractAddress = Array.from(contractMappings.entries()).find(
([_, partnerAddress]) =>
partnerAddress.toLowerCase() ===
- (
- arg.cChainAddress || partnerData.attributes.cChainAddress
- ).toLowerCase(),
+ (arg.cChainAddress || partnerCChainAddress.cAddress).toLowerCase(),
)?.[0]
if (contractAddress) {
const { supportedServices, wantedServices, bots, supportedCurrencies } =
@@ -385,6 +392,7 @@ export const partnersApi = createApi({
}) => {
const baseUrl = getBaseUrl()
let query = '?populate=*'
+ const selectedNetwork = store.getters['Network/selectedNetwork']
if (!isNaN(page)) {
query += `&sort[0]=companyName:asc&_limit=-1`
@@ -403,10 +411,10 @@ export const partnersApi = createApi({
query += `&filters[companyName][$contains]=${companyName}`
}
if (validators) {
- query += `&filters[pChainAddress][$ne]=null`
+ query += `&filters[$and][0][pChainAddresses][pAddress][$notNull]=true&filters[$and][1][pChainAddresses][Network][$eq]=${selectedNetwork.name.toLowerCase()}`
}
// Only add the cChainAddress filter if onMessenger is explicitly true
- query += `&filters[cChainAddress][$ne]=null`
+ query += `&filters[$and][0][cChainAddresses][cAddress][$notNull]=true&filters[$and][1][cChainAddresses][Network][$eq]=${selectedNetwork.name.toLowerCase()}`
return {
url: `${baseUrl}${query}`,
@@ -433,11 +441,14 @@ export const partnersApi = createApi({
const partnersWithServices = await Promise.all(
response.data.map(async partner => {
- if (partner.attributes.cChainAddress) {
+ let partnerCChainAddress = partner?.attributes?.cChainAddresses.find(
+ elem => elem.Network === selectedNetwork.name.toLowerCase(),
+ )
+ if (partnerCChainAddress.cAddress) {
const contractAddress = Array.from(contractMappings.entries()).find(
([_, partnerAddress]) =>
partnerAddress.toLowerCase() ===
- partner.attributes.cChainAddress.toLowerCase(),
+ partnerCChainAddress.cAddress.toLowerCase(),
)?.[0]
if (contractAddress) {
@@ -514,14 +525,19 @@ export const partnersApi = createApi({
isPartner: build.query({
query: ({ cChainAddress }) => {
const baseUrl = getBaseUrl()
+ const selectedNetwork = store.getters['Network/selectedNetwork']
let query =
'?populate=*&sort[0]=companyName:asc&pagination[page]=1&pagination[pageSize]=12'
- query += `&filters[cChainAddress][$eq]=${cChainAddress}`
+ query += `&filters[$and][0][cChainAddresses][cAddress][$containsi]=${cChainAddress}&filters[$and][1][cChainAddresses][Network][$eq]=${selectedNetwork.name.toLowerCase()}`
return `${baseUrl}${query}`
},
async transformResponse(response: PartnersResponseType, _meta, { cChainAddress }) {
const partnerData = response.data[0]
- if (partnerData && partnerData.attributes.cChainAddress) {
+ const selectedNetwork = store.getters['Network/selectedNetwork']
+ let partnerCChainAddress = partnerData?.attributes?.cChainAddresses.find(
+ elem => elem.Network === selectedNetwork.name.toLowerCase(),
+ )
+ if (partnerData && partnerCChainAddress.cAddress) {
const selectedNetwork = store.getters['Network/selectedNetwork']
const providerUrl = `${selectedNetwork.protocol}://${selectedNetwork.ip}:${selectedNetwork.port}/ext/bc/C/rpc`
const provider = new ethers.JsonRpcProvider(providerUrl)
diff --git a/src/views/partners/ConfigurDistrubitor.tsx b/src/views/partners/ConfigurDistrubitor.tsx
index dcb0c1a4..0bfef7b0 100644
--- a/src/views/partners/ConfigurDistrubitor.tsx
+++ b/src/views/partners/ConfigurDistrubitor.tsx
@@ -25,9 +25,10 @@ import {
} from '../../helpers/partnerConfigurationContext'
import { usePartnerConfig } from '../../helpers/usePartnerConfig'
import { useSmartContract } from '../../helpers/useSmartContract'
-import { useAppDispatch } from '../../hooks/reduxHooks'
+import { useAppDispatch, useAppSelector } from '../../hooks/reduxHooks'
import { useFetchPartnerDataQuery } from '../../redux/services/partners'
import { updateNotificationStatus } from '../../redux/slices/app-config'
+import { getActiveNetwork } from '../../redux/slices/network'
import { Configuration } from './Configuration'
function ServiceChangesPreview({ added, removed }) {
@@ -148,9 +149,14 @@ export const BasicWantedServices = () => {
const { partnerID } = useParams()
const { state, dispatch } = usePartnerConfigurationContext()
const [distrubitorState, dispatchDistrubitorState] = useReducer(reducer, { ...state, step: 2 })
- const { data: partner } = useFetchPartnerDataQuery({
+ const { data: partner, refetch } = useFetchPartnerDataQuery({
companyName: partnerID,
})
+ const activeNetwork = useAppSelector(getActiveNetwork)
+ useEffect(() => {
+ if (activeNetwork) refetch()
+ }, [activeNetwork])
+
const navigate = useNavigate()
useEffect(() => {
if (partner)
diff --git a/src/views/partners/ConfigurSupplier.tsx b/src/views/partners/ConfigurSupplier.tsx
index c2861d5b..5ca1362e 100644
--- a/src/views/partners/ConfigurSupplier.tsx
+++ b/src/views/partners/ConfigurSupplier.tsx
@@ -25,9 +25,10 @@ import {
} from '../../helpers/partnerConfigurationContext'
import { usePartnerConfig } from '../../helpers/usePartnerConfig'
import { useSmartContract } from '../../helpers/useSmartContract'
-import { useAppDispatch } from '../../hooks/reduxHooks'
+import { useAppDispatch, useAppSelector } from '../../hooks/reduxHooks'
import { useFetchPartnerDataQuery } from '../../redux/services/partners'
import { updateNotificationStatus } from '../../redux/slices/app-config'
+import { getActiveNetwork } from '../../redux/slices/network'
import { Configuration } from './Configuration'
function ServiceChangesPreview({ added, updated, removed }) {
@@ -291,10 +292,14 @@ export const BasicSupportedServices = () => {
const { partnerID } = useParams()
const { state, dispatch } = usePartnerConfigurationContext()
const [supplierState, dispatchSupplierState] = useReducer(reducer, { ...state, step: 1 })
- const { data: partner } = useFetchPartnerDataQuery({
+ const { data: partner, refetch } = useFetchPartnerDataQuery({
companyName: partnerID,
})
const navigate = useNavigate()
+ const activeNetwork = useAppSelector(getActiveNetwork)
+ useEffect(() => {
+ if (activeNetwork) refetch()
+ }, [activeNetwork])
useEffect(() => {
if (partner) {
dispatchSupplierState({
diff --git a/src/views/partners/Configuration.tsx b/src/views/partners/Configuration.tsx
index 59123888..15af60ca 100644
--- a/src/views/partners/Configuration.tsx
+++ b/src/views/partners/Configuration.tsx
@@ -93,14 +93,12 @@ const Content = () => {
- {balance !== '' && parseFloat(balance) < 100 && (
-
- Refresh Balance
-
-
-
-
- )}
+
+ Refresh Balance
+
+
+
+
>
)}
{state.step === 0 && (
@@ -136,7 +134,7 @@ const Content = () => {
disabled={
!state.balance ||
parseFloat(state.balance) < 100 ||
- parseFloat(state.balance) > parseFloat(balance) - 0.5 ||
+ parseFloat(state.balance) + 0.5 > parseFloat(balance) ||
!store.getters['Accounts/kycStatus']
}
>
diff --git a/src/views/partners/ManageBots.tsx b/src/views/partners/ManageBots.tsx
index 791e1387..2ca58e82 100644
--- a/src/views/partners/ManageBots.tsx
+++ b/src/views/partners/ManageBots.tsx
@@ -4,16 +4,21 @@ import React, { useEffect, useState } from 'react'
import { useNavigate, useParams } from 'react-router'
import Alert from '../../components/Alert'
import { usePartnerConfig } from '../../helpers/usePartnerConfig'
-import { useAppDispatch } from '../../hooks/reduxHooks'
+import { useAppDispatch, useAppSelector } from '../../hooks/reduxHooks'
import { useFetchPartnerDataQuery } from '../../redux/services/partners'
import { updateNotificationStatus } from '../../redux/slices/app-config'
+import { getActiveNetwork } from '../../redux/slices/network'
import { Configuration } from './Configuration'
export const BasicManageBots = () => {
const { partnerID } = useParams()
- const { data: partner } = useFetchPartnerDataQuery({
+ const { data: partner, refetch } = useFetchPartnerDataQuery({
companyName: partnerID,
})
+ const activeNetwork = useAppSelector(getActiveNetwork)
+ useEffect(() => {
+ if (activeNetwork) refetch()
+ }, [activeNetwork])
const navigate = useNavigate()
if (!partner) return <>>
diff --git a/src/views/partners/MatchingPartners.tsx b/src/views/partners/MatchingPartners.tsx
index e02031c3..6d058c36 100644
--- a/src/views/partners/MatchingPartners.tsx
+++ b/src/views/partners/MatchingPartners.tsx
@@ -1,10 +1,12 @@
import { Box, Typography } from '@mui/material'
-import React, { useMemo } from 'react'
+import React, { useEffect, useMemo } from 'react'
import { useNavigate } from 'react-router'
import PartnerCard from '../../components/Partners/PartnerCard'
import { usePartnerConfigurationContext } from '../../helpers/partnerConfigurationContext'
import { useSmartContract } from '../../helpers/useSmartContract'
+import { useAppSelector } from '../../hooks/reduxHooks'
import { useListMatchingPartnersQuery } from '../../redux/services/partners'
+import { getActiveNetwork } from '../../redux/slices/network'
const MatchingPartners = ({ state }) => {
const value = usePartnerConfigurationContext()
@@ -13,17 +15,28 @@ const MatchingPartners = ({ state }) => {
isLoading,
isFetching,
error,
+ refetch,
} = useListMatchingPartnersQuery({
...state,
supportedResult: value?.state?.stepsConfig[1]?.services,
wantedResult: value?.state?.stepsConfig[2]?.services,
})
+ const activeNetwork = useAppSelector(getActiveNetwork)
const sc = useSmartContract()
const matchingPartnersFiltred = useMemo(() => {
return partners?.data
- ? partners?.data?.filter(elem => elem.attributes.cChainAddress != sc?.wallet?.address)
+ ? partners?.data?.filter(elem => {
+ let address = (elem?.attributes?.cChainAddresses.find(
+ elem => elem.Network.toLowerCase() === activeNetwork.name.toLowerCase(),
+ )).cAddress
+ if (address !== sc?.wallet?.address) return true
+ return false
+ })
: []
}, [partners])
+ useEffect(() => {
+ if (activeNetwork) refetch()
+ }, [activeNetwork])
const navigate = useNavigate()
if (
isLoading ||
diff --git a/src/views/partners/MyMessenger.tsx b/src/views/partners/MyMessenger.tsx
index 7b898e6c..39f01e85 100644
--- a/src/views/partners/MyMessenger.tsx
+++ b/src/views/partners/MyMessenger.tsx
@@ -26,9 +26,10 @@ import { usePartnerConfigurationContext } from '../../helpers/partnerConfigurati
import { usePartnerConfig } from '../../helpers/usePartnerConfig'
import { useSmartContract } from '../../helpers/useSmartContract'
import useWalletBalance from '../../helpers/useWalletBalance'
-import { useAppDispatch } from '../../hooks/reduxHooks'
+import { useAppDispatch, useAppSelector } from '../../hooks/reduxHooks'
import { useFetchPartnerDataQuery } from '../../redux/services/partners'
import { updateNotificationStatus } from '../../redux/slices/app-config'
+import { getActiveNetwork } from '../../redux/slices/network'
import { Configuration } from './Configuration'
const AmountInput = ({ amount, onAmountChange, onMaxAmountClick, maxAmount }) => {
@@ -335,10 +336,14 @@ const MyMessenger = () => {
removeSupportedToken,
getListOfBots,
} = usePartnerConfig()
- const { data: partner } = useFetchPartnerDataQuery({
+ const { data: partner, refetch } = useFetchPartnerDataQuery({
companyName: '',
cChainAddress: wallet.address,
})
+ const activeNetwork = useAppSelector(getActiveNetwork)
+ useEffect(() => {
+ if (activeNetwork) refetch()
+ }, [activeNetwork])
const appDispatch = useAppDispatch()
const handleOpenModal = () => {
setOpen(true)
diff --git a/src/views/partners/Partner.tsx b/src/views/partners/Partner.tsx
index 70f188fd..9780774b 100644
--- a/src/views/partners/Partner.tsx
+++ b/src/views/partners/Partner.tsx
@@ -16,6 +16,7 @@ import { useAppSelector } from '../../hooks/reduxHooks'
import useWallet from '../../hooks/useWallet'
import { useFetchPartnerDataQuery, useIsPartnerQuery } from '../../redux/services/partners'
import { selectValidators } from '../../redux/slices/app-config'
+import { getActiveNetwork } from '../../redux/slices/network'
import { displayFirstPartLongString, displaySecondPartLongString } from '../../utils/display-utils'
const ContentField = ({ label, children }) => {
@@ -69,7 +70,7 @@ const Widget = ({
supportedCurrencies,
partner,
}) => {
- const { data } = useIsPartnerQuery({
+ const { data, refetch } = useIsPartnerQuery({
cChainAddress: store?.state?.activeWallet?.ethAddress
? '0x' + store?.state?.activeWallet?.ethAddress
: '',
@@ -103,6 +104,10 @@ const Widget = ({
]
}, [])
+ const activeNetwork = useAppSelector(getActiveNetwork)
+ useEffect(() => {
+ if (activeNetwork) refetch()
+ }, [activeNetwork])
const partnerConf = usePartnerConfig()
function checkMatch(data): boolean {
@@ -388,6 +393,7 @@ const Partner = () => {
isLoading,
isFetching,
error,
+ refetch,
} = useFetchPartnerDataQuery({
companyName: partnerID,
cChainAddress: !path.includes('partners/messenger-configuration')
@@ -399,6 +405,10 @@ const Partner = () => {
const validators = useAppSelector(selectValidators)
const { state, dispatch } = usePartnerConfigurationContext()
+ const activeNetwork = useAppSelector(getActiveNetwork)
+ useEffect(() => {
+ if (activeNetwork) refetch()
+ }, [activeNetwork])
const chackValidatorStatus = async (address: string) => {
if (!partner.attributes.pChainAddress) setIsValidator(false)
let nodeID = await getRegisteredNode(getAddress(address))