MetaMask SDK and Safari issue

Hi, I am trying to integrate MetaMask SDK to my dApp. The stack is Next.js + ethers.js. Here is the relevant code:

1. SDK initialization
  useEffect(() => {
    const doAsync = async () => {
      const MMSDK = new MetaMaskSDK({
        dappMetadata: {
          name: "My DApp", // replace with your DApp name
          url: "###", // replace with your DApp url
        },
        logging: {
          developerMode: true,
        },
      });
      await MMSDK.init();
      setMMSDK(MMSDK);
      console.log("MMSDK", MMSDK);
      const ethereum = MMSDK.getProvider();
      const provider = new ethers.providers.Web3Provider(
        ethereum as any,
        ethers.providers.getNetwork("sepolia")
      );
      setProvider(provider);
      console.log("provider", provider);
    };
    doAsync();
  }, []);
2. Login button handler
const handleLoginClick = async () => {
    try {
      await MMSDK?.connect();
    } catch (error) {
      console.error(error);
      alert(error);
    }
    console.log("MMSDK connected");
    const signer = provider?.getSigner();
    console.log("Signer received");
    console.log("signer address", await signer?.getAddress());
    if (!signer) {
      alert("You need to install MetaMask!");
    } else {
      onSetConnecting(true);
      try {
        onContractStateUpdate("BTCUSDT", 0);
      } catch (error) {
        console.error(error);
      }
    }
  };
3. A function to get some data from the contract
  const handleContractStateUpdate = async (
    key: string,
    accountIndex: number
  ) => {
    try {
      const prov = provider;
      if (!prov) {
        throw new Error("Provider not initialized");
      }
      const signer = prov.getSigner(accountIndex);
      console.log("Contract state: signer received");
      const optionix = getOptionix(prov);
      const optionixWithSigner = optionix.connect(signer);
      console.log("Contract state: Optionix connected");
      const addr = await signer?.getAddress();
      const userBalance = await optionixWithSigner?.userBalance(addr);
      console.log("Contract state: User balance received", userBalance);
      const accounts = await prov.listAccounts();
      console.log("Contract state: accounts", accounts);
      const winRate = await optionixWithSigner?.winRates(key);
      console.log("Win rate", winRate);
      const minBetRequest = await optionixWithSigner?.minBet();
      console.log("minBet", minBetRequest);
      const maxBet = await optionixWithSigner?.calculateMaxBet();
      console.log("maxBet", maxBet);
      const comissionShare = await optionixWithSigner?.calculateComissionShare(
        key
      );
      console.log("Contract state: Comission share", comissionShare);
      const liquidityProvided =
        await optionixWithSigner?.viewLiquidityProviderInitialBalance();
      let liquidityCurrent = "0";
      if (ethers.utils.formatEther(liquidityProvided) !== "0.0") {
        liquidityCurrent =
          await optionixWithSigner?.calculateLiquidityProvidersCurrentBalance();
      }
      setContractState({
        signer: signer,
        optionixWithSigner: optionixWithSigner,
        address: addr,
        accounts: accounts,
        currentAccountIndex: accountIndex,
        userBalance: ethers.utils.formatEther(userBalance),
        winRate: ethers.utils.formatEther(winRate),
        minBet: ethers.utils.formatEther(minBetRequest),
        maxBet: ethers.utils.formatEther(maxBet),
        comissionShare: ethers.utils.formatEther(comissionShare),
        liquidityProvided: ethers.utils.formatEther(liquidityProvided),
        currentLiquidity: ethers.utils.formatEther(liquidityCurrent),
      });
    } catch (error) {
      console.error(error);
      alert(error);
    } finally {
      setIsConnecting(false);
      setReady(true);
    }
  };

All this code works fine on desktop Chrome browser, but when I try it on iPhone’s Safari the process of fetching data from the contract dies somewhere in the middle. For example, here is

Console output of Chrome
MMSDK connected
header.tsx:67 Signer received
header.tsx:68 signer address 0x625B3B580011513DD1a015E0bF093ceC8d92171e
index.tsx:142 Contract state: signer received
index.tsx:145 Contract state: Optionix connected
index.tsx:148 Contract state: User balance received BigNumber {_hex: '0x018cbb67fb3f3a34', _isBigNumber: true}
index.tsx:150 Contract state: accounts (3) ['0x625B3B580011513DD1a015E0bF093ceC8d92171e', '0xB26fccA707837430c849868CAb2DBB433B1d4510', '0x70997970C51812dc3A010C7d01b50e0d17dc79C8']
index.tsx:152 Win rate BigNumber {_hex: '0x072f4c2bb4e4fe00', _isBigNumber: true}
index.tsx:154 minBet BigNumber {_hex: '0x11c37937e08000', _isBigNumber: true}
index.tsx:156 maxBet BigNumber {_hex: '0x2386f26fc10000', _isBigNumber: true}
index.tsx:160 Contract state: Comission share BigNumber {_hex: '0x01c84f70d6c21a0f', _isBigNumber: true}
index.tsx:96 Contract state {signer: JsonRpcSigner, optionixWithSigner: Contract, address: '0x625B3B580011513DD1a015E0bF093ceC8d92171e', accounts: Array(3), currentAccountIndex: 0, …}
Console output of Safari (a lot of text)
MMSDK connected
index-c67c067bafecb285.js:2 Signer received
fafcd94e-be7506f0f2b9cacf.js:9 Platform::isMetaMaskInstalled isMetaMask=true isConnected=true
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts ongoing=false selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e isInstalled=true checkInstallationOnAllCalls=false socketConnected=true
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='eth_accounts' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write redirect link for 'eth_accounts' socketConnected=true connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink universalLink --> ####metamask.app.link/connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink deepLink --> metamask://connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 WakeLockManager::start() hasNativeWakeLock=false
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write eth_accounts sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() initial method completed -- prevent installation and call provider
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='metamask_getProviderState' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write method metamask_getProviderState doesn't need redirect.
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write metamask_getProviderState sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {name: "metamask-provider", data: }
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts rpcResponse: [0: "0x625b3b580011513dd1a015e0bf093cec8d92171e"]
index-c67c067bafecb285.js:2 signer address 0x625B3B580011513DD1a015E0bF093ceC8d92171e
fafcd94e-be7506f0f2b9cacf.js:9 Platform::isMetaMaskInstalled isMetaMask=true isConnected=true
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=wallet_switchEthereumChain ongoing=false selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e isInstalled=true checkInstallationOnAllCalls=false socketConnected=true
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='wallet_switchEthereumChain' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write redirect link for 'wallet_switchEthereumChain' socketConnected=true connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink universalLink --> ####metamask.app.link/connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink deepLink --> metamask://connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 WakeLockManager::start() hasNativeWakeLock=false
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write wallet_switchEthereumChain sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 SDKProvider::_initializeStateAsync state selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e  {isUnlocked: true, networkVersion: "11155111", chainId: "0xaa36a7", accounts: }
fafcd94e-be7506f0f2b9cacf.js:7 SDKProvider::_initializeState() set state._initialized to false
fafcd94e-be7506f0f2b9cacf.js:7 SDKProvider::_handleChainChanged chainId=0xaa36a7 networkVersion=11155111
fafcd94e-be7506f0f2b9cacf.js:7 Ethereum provider initialized {chainId: "0xaa36a7", isConnected: true, isMetaNask: true, selectedAddress: "0x625b3b580011513dd1a015e0bf093cec8d92171e", networkVersion: "11155111"}
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {name: "metamask-provider", data: }
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=wallet_switchEthereumChain rpcResponse: null
index-c67c067bafecb285.js:2 Contract state: signer received
index-c67c067bafecb285.js:2 Contract state: Optionix connected
fafcd94e-be7506f0f2b9cacf.js:9 Platform::isMetaMaskInstalled isMetaMask=true isConnected=true
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts ongoing=false selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e isInstalled=true checkInstallationOnAllCalls=false socketConnected=true
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='eth_accounts' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write redirect link for 'eth_accounts' socketConnected=true connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink universalLink --> ####metamask.app.link/connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink deepLink --> metamask://connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 WakeLockManager::start() hasNativeWakeLock=false
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write eth_accounts sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {name: "metamask-provider", data: }
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts rpcResponse: [0: "0x625b3b580011513dd1a015e0bf093cec8d92171e"]
fafcd94e-be7506f0f2b9cacf.js:9 Platform::isMetaMaskInstalled isMetaMask=true isConnected=true
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts ongoing=false selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e isInstalled=true checkInstallationOnAllCalls=false socketConnected=true
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='eth_accounts' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write redirect link for 'eth_accounts' socketConnected=true connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink universalLink --> ####metamask.app.link/connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink deepLink --> metamask://connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 WakeLockManager::start() hasNativeWakeLock=false
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write eth_accounts sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {name: "metamask-provider", data: }
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts rpcResponse: [0: "0x625b3b580011513dd1a015e0bf093cec8d92171e"]
fafcd94e-be7506f0f2b9cacf.js:9 Platform::isMetaMaskInstalled isMetaMask=true isConnected=true
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts ongoing=false selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e isInstalled=true checkInstallationOnAllCalls=false socketConnected=true
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='eth_accounts' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write redirect link for 'eth_accounts' socketConnected=true connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink universalLink --> ####metamask.app.link/connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink deepLink --> metamask://connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 WakeLockManager::start() hasNativeWakeLock=false
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write eth_accounts sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {name: "metamask-provider", data: }
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts rpcResponse: [0: "0x625b3b580011513dd1a015e0bf093cec8d92171e"]
fafcd94e-be7506f0f2b9cacf.js:9 Platform::isMetaMaskInstalled isMetaMask=true isConnected=true
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_chainId ongoing=false selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e isInstalled=true checkInstallationOnAllCalls=false socketConnected=true
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='eth_chainId' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write method eth_chainId doesn't need redirect.
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write eth_chainId sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {name: "metamask-provider", data: }
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_chainId rpcResponse: 0xaa36a7
fafcd94e-be7506f0f2b9cacf.js:9 Platform::isMetaMaskInstalled isMetaMask=true isConnected=true
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_call ongoing=false selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e isInstalled=true checkInstallationOnAllCalls=false socketConnected=true
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='eth_call' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write method eth_call doesn't need redirect.
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write eth_call sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {name: "metamask-provider", data: }
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_call rpcResponse: 0x000000000000000000000000000000000000000000000000018cbb67fb3f3a34
index-c67c067bafecb285.js:2 Contract state: User balance received d {_hex: "0x018cbb67fb3f3a34", _isBigNumber: true}
fafcd94e-be7506f0f2b9cacf.js:9 Platform::isMetaMaskInstalled isMetaMask=true isConnected=true
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts ongoing=false selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e isInstalled=true checkInstallationOnAllCalls=false socketConnected=true
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='eth_accounts' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write redirect link for 'eth_accounts' socketConnected=true connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink universalLink --> ####metamask.app.link/connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink deepLink --> metamask://connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 WakeLockManager::start() hasNativeWakeLock=false
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write eth_accounts sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {name: "metamask-provider", data: }
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts rpcResponse: [0: "0x625b3b580011513dd1a015e0bf093cec8d92171e"]
index-c67c067bafecb285.js:2 Contract state: accounts [0: "0x625B3B580011513DD1a015E0bF093ceC8d92171e"]
fafcd94e-be7506f0f2b9cacf.js:9 Platform::isMetaMaskInstalled isMetaMask=true isConnected=true
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts ongoing=false selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e isInstalled=true checkInstallationOnAllCalls=false socketConnected=true
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='eth_accounts' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write redirect link for 'eth_accounts' socketConnected=true connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink universalLink --> ####metamask.app.link/connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink deepLink --> metamask://connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 WakeLockManager::start() hasNativeWakeLock=false
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write eth_accounts sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {name: "metamask-provider", data: }
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts rpcResponse: [0: "0x625b3b580011513dd1a015e0bf093cec8d92171e"]
fafcd94e-be7506f0f2b9cacf.js:9 Platform::isMetaMaskInstalled isMetaMask=true isConnected=true
fafcd94e-be7506f0f2b9cacf.js:9 initializeProvider::sendRequest() method=eth_accounts ongoing=false selectedAddress=0x625b3b580011513dd1a015e0bf093cec8d92171e isInstalled=true checkInstallationOnAllCalls=false socketConnected=true
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write method='eth_accounts' isRemoteReady=true channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab isSocketConnected=true isRemotePaused=false providerConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:7 RPCMS::_write remote.isPaused()=false authorized=true ready=true socketConnected=true {name: "metamask-provider", data: {…}}
fafcd94e-be7506f0f2b9cacf.js:9 RCPMS::_write redirect link for 'eth_accounts' socketConnected=true connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink universalLink --> ####metamask.app.link/connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 Platform::openDeepLink deepLink --> metamask://connect?channelId=8f29911d-1674-404d-a1e9-2fe67886e1ab&pubkey=0222b0fe780e7a8839e6f61b349fed71f7443634c9f44606c796621e3d319cbe90&comm=socket
fafcd94e-be7506f0f2b9cacf.js:9 WakeLockManager::start() hasNativeWakeLock=false
fafcd94e-be7506f0f2b9cacf.js:7 RCPMS::_write eth_accounts sent successfully
fafcd94e-be7506f0f2b9cacf.js:9 [RCPMS] _onMessage  {type: "pause"}
fafcd94e-be7506f0f2b9cacf.js:52 [RCPMS] received 'clients_disconnected'
fafcd94e-be7506f0f2b9cacf.js:3 Error rpcId=1976107020 eth_accounts Error: RPC 1976107020 timed out

For me it seems that on Safari the provider is sending a lot of unnecessary requests of eth_accounts but I dont’t know how to get rid of it. I would really appreciate any ideas on how to fix the implementation for Safari.

Hi have you tried debugging it:

  • Debugging physical iOS devices requires idb to be installed, which consists of 2 parts
  • Install the two idb parts:
    1. brew tap facebook/fb & brew install idb-companion
    2. pip3.9 install fb-idb (This step may require that you install python3 via python -m pip3 install --upgrade pip)
1 Like

@0xroo Thanks, I haven’t tried it.

It seems that I found a workaround for this issue, so the topic can be closed. I made a single function in the smart contract that returns all necessary data, with it MetaMask SDK is able to fetch the data on iPhone’s Safari. However it takes much more time than on desktop.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.