diff --git a/src/components/common/CheckWallet/index.test.tsx b/src/components/common/CheckWallet/index.test.tsx index 56e66dfe31..bfa0a64bd7 100644 --- a/src/components/common/CheckWallet/index.test.tsx +++ b/src/components/common/CheckWallet/index.test.tsx @@ -231,9 +231,18 @@ describe('CheckWallet', () => { expect(getByText('Continue')).toBeDisabled() }) - it('should disable the button if SDK is not initialized', () => { + it('should disable the button if SDK is not initialized and safe is loaded', () => { mockUseSafeSdk.mockReturnValue(undefined) + const mockSafeInfo = { + safeLoaded: true, + safe: extendedSafeInfoBuilder(), + } + + ;(useSafeInfo as jest.MockedFunction).mockReturnValueOnce( + mockSafeInfo as unknown as ReturnType, + ) + const { getByText, getByLabelText } = render( {(isOk) => }, ) @@ -241,6 +250,29 @@ describe('CheckWallet', () => { expect(getByText('Continue')).toBeDisabled() expect(getByLabelText('SDK is not initialized yet')) }) + + it('should not disable the button if SDK is not initialized and safe is not loaded', () => { + mockUseSafeSdk.mockReturnValue(undefined) + + const safeAddress = faker.finance.ethereumAddress() + const mockSafeInfo = { + safeAddress, + safe: extendedSafeInfoBuilder() + .with({ address: { value: safeAddress } }) + .with({ deployed: true }) + .build(), + safeLoaded: false, + } + + ;(useSafeInfo as jest.MockedFunction).mockReturnValueOnce( + mockSafeInfo as unknown as ReturnType, + ) + + const { queryByText } = render({(isOk) => }) + + expect(queryByText('Continue')).not.toBeDisabled() + }) + it('should allow nested Safe owners', () => { ;(useIsSafeOwner as jest.MockedFunction).mockReturnValueOnce(false) mockUseNestedSafeOwners.mockReturnValue([faker.finance.ethereumAddress()]) diff --git a/src/components/common/CheckWallet/index.tsx b/src/components/common/CheckWallet/index.tsx index dcf1b786de..16794ea8a3 100644 --- a/src/components/common/CheckWallet/index.tsx +++ b/src/components/common/CheckWallet/index.tsx @@ -44,7 +44,7 @@ const CheckWallet = ({ const sdk = useSafeSDK() const isProposer = useIsWalletProposer() - const { safe } = useSafeInfo() + const { safe, safeLoaded } = useSafeInfo() const isNestedSafeOwner = useIsNestedSafeOwner() @@ -54,7 +54,7 @@ const CheckWallet = ({ if (!wallet) { return Message.WalletNotConnected } - if (!sdk) { + if (!sdk && safeLoaded) { return Message.SDKNotInitialized } @@ -87,6 +87,7 @@ const CheckWallet = ({ isUndeployedSafe, sdk, wallet, + safeLoaded, ]) if (checkNetwork && isWrongChain) return children(false)