@multiplatform.one/web3 7.19.0 → 7.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -4
- package/dist/cjs/bundler/metaMaskConnectTimeouts.cjs +92 -0
- package/dist/cjs/bundler/metaMaskConnectTimeouts.native.js +123 -0
- package/dist/cjs/bundler/metaMaskConnectTimeouts.native.js.map +1 -0
- package/dist/cjs/connectkit/components/Common/ConnectorList/index.cjs +10 -29
- package/dist/cjs/connectkit/components/Common/ConnectorList/index.native.js +11 -32
- package/dist/cjs/connectkit/components/Common/ConnectorList/index.native.js.map +1 -1
- package/dist/cjs/connectkit/components/ConnectModal/ConnectUsing.cjs +4 -38
- package/dist/cjs/connectkit/components/ConnectModal/ConnectUsing.native.js +4 -42
- package/dist/cjs/connectkit/components/ConnectModal/ConnectUsing.native.js.map +1 -1
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithInjector/index.cjs +0 -14
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js +7 -62
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js.map +1 -1
- package/dist/cjs/connectkit/components/ConnectModal/demo.cjs +0 -15
- package/dist/cjs/connectkit/components/ConnectModal/demo.native.js +0 -15
- package/dist/cjs/connectkit/components/ConnectModal/demo.native.js.map +1 -1
- package/dist/cjs/connectkit/components/contexts/web3/index.cjs +0 -15
- package/dist/cjs/connectkit/components/contexts/web3/index.native.js +0 -17
- package/dist/cjs/connectkit/components/contexts/web3/index.native.js.map +1 -1
- package/dist/cjs/connectkit/connectors/aaveAccountConnector.cjs +57 -0
- package/dist/cjs/connectkit/connectors/aaveAccountConnector.native.js +67 -0
- package/dist/cjs/connectkit/connectors/aaveAccountConnector.native.js.map +1 -0
- package/dist/cjs/connectkit/connectors/embeddedDesktop.cjs +1 -1
- package/dist/cjs/connectkit/connectors/embeddedDesktop.native.js +1 -1
- package/dist/cjs/connectkit/connectors/embeddedDesktop.native.js.map +1 -1
- package/dist/cjs/connectkit/connectors/metaMaskConnectConnector.cjs +255 -0
- package/dist/cjs/connectkit/connectors/metaMaskConnectConnector.native.js +315 -0
- package/dist/cjs/connectkit/connectors/metaMaskConnectConnector.native.js.map +1 -0
- package/dist/cjs/connectkit/defaultConfig.cjs +8 -2
- package/dist/cjs/connectkit/defaultConfig.native.js +8 -2
- package/dist/cjs/connectkit/defaultConfig.native.js.map +1 -1
- package/dist/cjs/connectkit/defaultConnectors.cjs +19 -37
- package/dist/cjs/connectkit/defaultConnectors.native.js +19 -37
- package/dist/cjs/connectkit/defaultConnectors.native.js.map +1 -1
- package/dist/cjs/connectkit/hooks/useConnectors.cjs +1 -5
- package/dist/cjs/connectkit/hooks/useConnectors.native.js +1 -5
- package/dist/cjs/connectkit/hooks/useConnectors.native.js.map +1 -1
- package/dist/cjs/connectkit/index.cjs +2 -0
- package/dist/cjs/connectkit/index.native.js +2 -0
- package/dist/cjs/connectkit/index.native.js.map +1 -1
- package/dist/cjs/connectkit/screens.cjs +1 -14
- package/dist/cjs/connectkit/screens.native.js +16 -33
- package/dist/cjs/connectkit/screens.native.js.map +1 -1
- package/dist/cjs/connectkit/siwe/SIWEProvider.cjs +3 -2
- package/dist/cjs/connectkit/siwe/SIWEProvider.native.js +6 -4
- package/dist/cjs/connectkit/siwe/SIWEProvider.native.js.map +1 -1
- package/dist/cjs/connectkit/wallets/index.cjs +4 -3
- package/dist/cjs/connectkit/wallets/index.native.js +4 -3
- package/dist/cjs/connectkit/wallets/index.native.js.map +1 -1
- package/dist/cjs/connectkit/wallets/useWallets.cjs +7 -22
- package/dist/cjs/connectkit/wallets/useWallets.native.js +6 -22
- package/dist/cjs/connectkit/wallets/useWallets.native.js.map +1 -1
- package/dist/cjs/connectkit/wallets/walletConfigs.cjs +3 -62
- package/dist/cjs/connectkit/wallets/walletConfigs.native.js +2 -65
- package/dist/cjs/connectkit/wallets/walletConfigs.native.js.map +1 -1
- package/dist/cjs/connectkit/web3Bridge.cjs +2 -6
- package/dist/cjs/connectkit/web3Bridge.native.js +2 -7
- package/dist/cjs/connectkit/web3Bridge.native.js.map +1 -1
- package/dist/cjs/esbuild.cjs +54 -0
- package/dist/cjs/esbuild.native.js +57 -0
- package/dist/cjs/esbuild.native.js.map +1 -0
- package/dist/cjs/hooks/useWallet.cjs +1 -2
- package/dist/cjs/hooks/useWallet.native.js +1 -4
- package/dist/cjs/hooks/useWallet.native.js.map +1 -1
- package/dist/cjs/providers/WalletProvider.cjs +1 -2
- package/dist/cjs/providers/native/deepLink.cjs +1 -1
- package/dist/cjs/providers/native/deepLink.native.js +1 -1
- package/dist/cjs/providers/native/deepLink.native.js.map +1 -1
- package/dist/cjs/providers/walletConfig.native.js.map +1 -1
- package/dist/cjs/vite.cjs +76 -0
- package/dist/cjs/vite.native.js +79 -0
- package/dist/cjs/vite.native.js.map +1 -0
- package/dist/esm/bundler/metaMaskConnectTimeouts.mjs +64 -0
- package/dist/esm/bundler/metaMaskConnectTimeouts.mjs.map +1 -0
- package/dist/esm/bundler/metaMaskConnectTimeouts.native.js +92 -0
- package/dist/esm/bundler/metaMaskConnectTimeouts.native.js.map +1 -0
- package/dist/esm/connectkit/components/Common/ConnectorList/index.mjs +11 -30
- package/dist/esm/connectkit/components/Common/ConnectorList/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/Common/ConnectorList/index.native.js +12 -33
- package/dist/esm/connectkit/components/Common/ConnectorList/index.native.js.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/ConnectUsing.mjs +4 -38
- package/dist/esm/connectkit/components/ConnectModal/ConnectUsing.mjs.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/ConnectUsing.native.js +4 -42
- package/dist/esm/connectkit/components/ConnectModal/ConnectUsing.native.js.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs +1 -15
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js +8 -63
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/demo.mjs +0 -15
- package/dist/esm/connectkit/components/ConnectModal/demo.mjs.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/demo.native.js +0 -15
- package/dist/esm/connectkit/components/ConnectModal/demo.native.js.map +1 -1
- package/dist/esm/connectkit/components/contexts/web3/index.mjs +0 -15
- package/dist/esm/connectkit/components/contexts/web3/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/contexts/web3/index.native.js +0 -17
- package/dist/esm/connectkit/components/contexts/web3/index.native.js.map +1 -1
- package/dist/esm/connectkit/connectors/aaveAccountConnector.mjs +31 -0
- package/dist/esm/connectkit/connectors/aaveAccountConnector.mjs.map +1 -0
- package/dist/esm/connectkit/connectors/aaveAccountConnector.native.js +38 -0
- package/dist/esm/connectkit/connectors/aaveAccountConnector.native.js.map +1 -0
- package/dist/esm/connectkit/connectors/embeddedDesktop.mjs +1 -1
- package/dist/esm/connectkit/connectors/embeddedDesktop.mjs.map +1 -1
- package/dist/esm/connectkit/connectors/embeddedDesktop.native.js +1 -1
- package/dist/esm/connectkit/connectors/embeddedDesktop.native.js.map +1 -1
- package/dist/esm/connectkit/connectors/metaMaskConnectConnector.mjs +216 -0
- package/dist/esm/connectkit/connectors/metaMaskConnectConnector.mjs.map +1 -0
- package/dist/esm/connectkit/connectors/metaMaskConnectConnector.native.js +273 -0
- package/dist/esm/connectkit/connectors/metaMaskConnectConnector.native.js.map +1 -0
- package/dist/esm/connectkit/defaultConfig.mjs +8 -2
- package/dist/esm/connectkit/defaultConfig.mjs.map +1 -1
- package/dist/esm/connectkit/defaultConfig.native.js +8 -2
- package/dist/esm/connectkit/defaultConfig.native.js.map +1 -1
- package/dist/esm/connectkit/defaultConnectors.mjs +16 -34
- package/dist/esm/connectkit/defaultConnectors.mjs.map +1 -1
- package/dist/esm/connectkit/defaultConnectors.native.js +16 -34
- package/dist/esm/connectkit/defaultConnectors.native.js.map +1 -1
- package/dist/esm/connectkit/hooks/useConnectors.mjs +1 -4
- package/dist/esm/connectkit/hooks/useConnectors.mjs.map +1 -1
- package/dist/esm/connectkit/hooks/useConnectors.native.js +1 -4
- package/dist/esm/connectkit/hooks/useConnectors.native.js.map +1 -1
- package/dist/esm/connectkit/index.mjs +2 -1
- package/dist/esm/connectkit/index.mjs.map +1 -1
- package/dist/esm/connectkit/index.native.js +2 -1
- package/dist/esm/connectkit/index.native.js.map +1 -1
- package/dist/esm/connectkit/screens.mjs +1 -14
- package/dist/esm/connectkit/screens.mjs.map +1 -1
- package/dist/esm/connectkit/screens.native.js +16 -33
- package/dist/esm/connectkit/screens.native.js.map +1 -1
- package/dist/esm/connectkit/siwe/SIWEProvider.mjs +3 -2
- package/dist/esm/connectkit/siwe/SIWEProvider.mjs.map +1 -1
- package/dist/esm/connectkit/siwe/SIWEProvider.native.js +6 -4
- package/dist/esm/connectkit/siwe/SIWEProvider.native.js.map +1 -1
- package/dist/esm/connectkit/wallets/index.mjs +3 -2
- package/dist/esm/connectkit/wallets/index.mjs.map +1 -1
- package/dist/esm/connectkit/wallets/index.native.js +3 -2
- package/dist/esm/connectkit/wallets/index.native.js.map +1 -1
- package/dist/esm/connectkit/wallets/useWallets.mjs +2 -17
- package/dist/esm/connectkit/wallets/useWallets.mjs.map +1 -1
- package/dist/esm/connectkit/wallets/useWallets.native.js +1 -17
- package/dist/esm/connectkit/wallets/useWallets.native.js.map +1 -1
- package/dist/esm/connectkit/wallets/walletConfigs.mjs +4 -63
- package/dist/esm/connectkit/wallets/walletConfigs.mjs.map +1 -1
- package/dist/esm/connectkit/wallets/walletConfigs.native.js +3 -66
- package/dist/esm/connectkit/wallets/walletConfigs.native.js.map +1 -1
- package/dist/esm/connectkit/web3Bridge.mjs +3 -7
- package/dist/esm/connectkit/web3Bridge.mjs.map +1 -1
- package/dist/esm/connectkit/web3Bridge.native.js +3 -8
- package/dist/esm/connectkit/web3Bridge.native.js.map +1 -1
- package/dist/esm/esbuild.mjs +29 -0
- package/dist/esm/esbuild.mjs.map +1 -0
- package/dist/esm/esbuild.native.js +29 -0
- package/dist/esm/esbuild.native.js.map +1 -0
- package/dist/esm/hooks/useWallet.mjs +1 -2
- package/dist/esm/hooks/useWallet.mjs.map +1 -1
- package/dist/esm/hooks/useWallet.native.js +1 -4
- package/dist/esm/hooks/useWallet.native.js.map +1 -1
- package/dist/esm/providers/WalletProvider.mjs +1 -2
- package/dist/esm/providers/WalletProvider.mjs.map +1 -1
- package/dist/esm/providers/native/deepLink.mjs +1 -1
- package/dist/esm/providers/native/deepLink.mjs.map +1 -1
- package/dist/esm/providers/native/deepLink.native.js +1 -1
- package/dist/esm/providers/native/deepLink.native.js.map +1 -1
- package/dist/esm/providers/walletConfig.mjs.map +1 -1
- package/dist/esm/providers/walletConfig.native.js.map +1 -1
- package/dist/esm/vite.mjs +51 -0
- package/dist/esm/vite.mjs.map +1 -0
- package/dist/esm/vite.native.js +51 -0
- package/dist/esm/vite.native.js.map +1 -0
- package/dist/jsx/bundler/metaMaskConnectTimeouts.mjs +64 -0
- package/dist/jsx/bundler/metaMaskConnectTimeouts.mjs.map +1 -0
- package/dist/jsx/bundler/metaMaskConnectTimeouts.native.js +123 -0
- package/dist/jsx/bundler/metaMaskConnectTimeouts.native.js.map +1 -0
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.mjs +11 -30
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.native.js +11 -32
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.native.js.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/ConnectUsing.mjs +4 -38
- package/dist/jsx/connectkit/components/ConnectModal/ConnectUsing.mjs.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/ConnectUsing.native.js +4 -42
- package/dist/jsx/connectkit/components/ConnectModal/ConnectUsing.native.js.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs +1 -15
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js +7 -62
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/demo.mjs +0 -15
- package/dist/jsx/connectkit/components/ConnectModal/demo.mjs.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/demo.native.js +0 -15
- package/dist/jsx/connectkit/components/ConnectModal/demo.native.js.map +1 -1
- package/dist/jsx/connectkit/components/contexts/web3/index.mjs +0 -15
- package/dist/jsx/connectkit/components/contexts/web3/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/contexts/web3/index.native.js +0 -17
- package/dist/jsx/connectkit/components/contexts/web3/index.native.js.map +1 -1
- package/dist/jsx/connectkit/connectors/aaveAccountConnector.mjs +31 -0
- package/dist/jsx/connectkit/connectors/aaveAccountConnector.mjs.map +1 -0
- package/dist/jsx/connectkit/connectors/aaveAccountConnector.native.js +67 -0
- package/dist/jsx/connectkit/connectors/aaveAccountConnector.native.js.map +1 -0
- package/dist/jsx/connectkit/connectors/embeddedDesktop.mjs +1 -1
- package/dist/jsx/connectkit/connectors/embeddedDesktop.mjs.map +1 -1
- package/dist/jsx/connectkit/connectors/embeddedDesktop.native.js +1 -1
- package/dist/jsx/connectkit/connectors/metaMaskConnectConnector.mjs +216 -0
- package/dist/jsx/connectkit/connectors/metaMaskConnectConnector.mjs.map +1 -0
- package/dist/jsx/connectkit/connectors/metaMaskConnectConnector.native.js +315 -0
- package/dist/jsx/connectkit/connectors/metaMaskConnectConnector.native.js.map +1 -0
- package/dist/jsx/connectkit/defaultConfig.mjs +8 -2
- package/dist/jsx/connectkit/defaultConfig.mjs.map +1 -1
- package/dist/jsx/connectkit/defaultConfig.native.js +8 -2
- package/dist/jsx/connectkit/defaultConfig.native.js.map +1 -1
- package/dist/jsx/connectkit/defaultConnectors.mjs +16 -34
- package/dist/jsx/connectkit/defaultConnectors.mjs.map +1 -1
- package/dist/jsx/connectkit/defaultConnectors.native.js +19 -37
- package/dist/jsx/connectkit/defaultConnectors.native.js.map +1 -1
- package/dist/jsx/connectkit/hooks/useConnectors.mjs +1 -4
- package/dist/jsx/connectkit/hooks/useConnectors.mjs.map +1 -1
- package/dist/jsx/connectkit/hooks/useConnectors.native.js +1 -5
- package/dist/jsx/connectkit/hooks/useConnectors.native.js.map +1 -1
- package/dist/jsx/connectkit/index.mjs +2 -1
- package/dist/jsx/connectkit/index.mjs.map +1 -1
- package/dist/jsx/connectkit/index.native.js +2 -0
- package/dist/jsx/connectkit/index.native.js.map +1 -1
- package/dist/jsx/connectkit/screens.mjs +1 -14
- package/dist/jsx/connectkit/screens.mjs.map +1 -1
- package/dist/jsx/connectkit/screens.native.js +16 -33
- package/dist/jsx/connectkit/screens.native.js.map +1 -1
- package/dist/jsx/connectkit/siwe/SIWEProvider.mjs +3 -2
- package/dist/jsx/connectkit/siwe/SIWEProvider.mjs.map +1 -1
- package/dist/jsx/connectkit/siwe/SIWEProvider.native.js +6 -4
- package/dist/jsx/connectkit/siwe/SIWEProvider.native.js.map +1 -1
- package/dist/jsx/connectkit/wallets/index.mjs +3 -2
- package/dist/jsx/connectkit/wallets/index.mjs.map +1 -1
- package/dist/jsx/connectkit/wallets/index.native.js +4 -3
- package/dist/jsx/connectkit/wallets/index.native.js.map +1 -1
- package/dist/jsx/connectkit/wallets/useWallets.mjs +2 -17
- package/dist/jsx/connectkit/wallets/useWallets.mjs.map +1 -1
- package/dist/jsx/connectkit/wallets/useWallets.native.js +6 -22
- package/dist/jsx/connectkit/wallets/useWallets.native.js.map +1 -1
- package/dist/jsx/connectkit/wallets/walletConfigs.mjs +4 -63
- package/dist/jsx/connectkit/wallets/walletConfigs.mjs.map +1 -1
- package/dist/jsx/connectkit/wallets/walletConfigs.native.js +2 -65
- package/dist/jsx/connectkit/wallets/walletConfigs.native.js.map +1 -1
- package/dist/jsx/connectkit/web3Bridge.mjs +3 -7
- package/dist/jsx/connectkit/web3Bridge.mjs.map +1 -1
- package/dist/jsx/connectkit/web3Bridge.native.js +2 -7
- package/dist/jsx/connectkit/web3Bridge.native.js.map +1 -1
- package/dist/jsx/esbuild.mjs +29 -0
- package/dist/jsx/esbuild.mjs.map +1 -0
- package/dist/jsx/esbuild.native.js +57 -0
- package/dist/jsx/esbuild.native.js.map +1 -0
- package/dist/jsx/hooks/useWallet.mjs +1 -2
- package/dist/jsx/hooks/useWallet.mjs.map +1 -1
- package/dist/jsx/hooks/useWallet.native.js +1 -4
- package/dist/jsx/hooks/useWallet.native.js.map +1 -1
- package/dist/jsx/providers/WalletProvider.mjs +1 -2
- package/dist/jsx/providers/WalletProvider.mjs.map +1 -1
- package/dist/jsx/providers/native/deepLink.mjs +1 -1
- package/dist/jsx/providers/native/deepLink.mjs.map +1 -1
- package/dist/jsx/providers/native/deepLink.native.js +1 -1
- package/dist/jsx/providers/native/deepLink.native.js.map +1 -1
- package/dist/jsx/providers/walletConfig.mjs.map +1 -1
- package/dist/jsx/providers/walletConfig.native.js.map +1 -1
- package/dist/jsx/vite.mjs +51 -0
- package/dist/jsx/vite.mjs.map +1 -0
- package/dist/jsx/vite.native.js +79 -0
- package/dist/jsx/vite.native.js.map +1 -0
- package/package.json +22 -10
- package/src/bundler/metaMaskConnectTimeouts.spec.ts +390 -0
- package/src/bundler/metaMaskConnectTimeouts.ts +126 -0
- package/src/connectkit/adapters/SolanaAdapter.ts +1 -1
- package/src/connectkit/adapters/discover.ts +1 -1
- package/src/connectkit/components/Common/ConnectorList/index.tsx +20 -50
- package/src/connectkit/components/ConnectModal/ConnectUsing.tsx +11 -62
- package/src/connectkit/components/ConnectModal/ConnectWithInjector/index.tsx +10 -70
- package/src/connectkit/components/ConnectModal/demo.tsx +1 -19
- package/src/connectkit/components/contexts/web3/index.tsx +1 -23
- package/src/connectkit/connectors/aaveAccountConnector.spec.ts +87 -0
- package/src/connectkit/connectors/aaveAccountConnector.ts +43 -0
- package/src/connectkit/connectors/embeddedDesktop.spec.ts +5 -5
- package/src/connectkit/connectors/embeddedDesktop.ts +5 -5
- package/src/connectkit/connectors/metaMaskConnectConnector.spec.ts +230 -0
- package/src/connectkit/connectors/metaMaskConnectConnector.ts +272 -0
- package/src/connectkit/defaultConfig.ts +16 -7
- package/src/connectkit/defaultConnectors.ts +19 -40
- package/src/connectkit/hooks/useConnectors.ts +0 -10
- package/src/connectkit/index.ts +4 -0
- package/src/connectkit/screens.tsx +1 -21
- package/src/connectkit/siwe/SIWEProvider.spec.tsx +70 -2
- package/src/connectkit/siwe/SIWEProvider.tsx +5 -3
- package/src/connectkit/wallets/index.ts +5 -2
- package/src/connectkit/wallets/useWallets.tsx +1 -20
- package/src/connectkit/wallets/walletConfigs.tsx +2 -64
- package/src/connectkit/web3Bridge.tsx +4 -21
- package/src/esbuild.ts +42 -0
- package/src/hooks/useWallet.spec.ts +6 -15
- package/src/hooks/useWallet.ts +1 -2
- package/src/providers/WalletProvider.native.tsx +1 -1
- package/src/providers/WalletProvider.tsx +5 -7
- package/src/providers/mockConnector.ts +2 -2
- package/src/providers/native/deepLink.spec.ts +3 -4
- package/src/providers/native/deepLink.ts +1 -2
- package/src/providers/native/inject.spec.ts +1 -1
- package/src/providers/walletConfig.spec.ts +1 -1
- package/src/providers/walletConfig.ts +2 -1
- package/src/vite.ts +60 -0
- package/types/bundler/metaMaskConnectTimeouts.d.ts +36 -0
- package/types/bundler/metaMaskConnectTimeouts.d.ts.map +1 -0
- package/types/connectkit/adapters/discover.d.ts +1 -1
- package/types/connectkit/components/Common/ConnectorList/index.d.ts.map +1 -1
- package/types/connectkit/components/ConnectModal/ConnectUsing.d.ts.map +1 -1
- package/types/connectkit/components/ConnectModal/ConnectWithInjector/index.d.ts +0 -1
- package/types/connectkit/components/ConnectModal/ConnectWithInjector/index.d.ts.map +1 -1
- package/types/connectkit/components/ConnectModal/demo.d.ts.map +1 -1
- package/types/connectkit/components/contexts/web3/index.d.ts +1 -5
- package/types/connectkit/components/contexts/web3/index.d.ts.map +1 -1
- package/types/connectkit/connectors/aaveAccountConnector.d.ts +5 -0
- package/types/connectkit/connectors/aaveAccountConnector.d.ts.map +1 -0
- package/types/connectkit/connectors/embeddedDesktop.d.ts +4 -4
- package/types/connectkit/connectors/embeddedDesktop.d.ts.map +1 -1
- package/types/connectkit/connectors/metaMaskConnectConnector.d.ts +35 -0
- package/types/connectkit/connectors/metaMaskConnectConnector.d.ts.map +1 -0
- package/types/connectkit/defaultConfig.d.ts +3 -2
- package/types/connectkit/defaultConfig.d.ts.map +1 -1
- package/types/connectkit/defaultConnectors.d.ts +3 -4
- package/types/connectkit/defaultConnectors.d.ts.map +1 -1
- package/types/connectkit/hooks/useConnectors.d.ts +0 -1
- package/types/connectkit/hooks/useConnectors.d.ts.map +1 -1
- package/types/connectkit/index.d.ts +1 -0
- package/types/connectkit/index.d.ts.map +1 -1
- package/types/connectkit/screens.d.ts +0 -4
- package/types/connectkit/screens.d.ts.map +1 -1
- package/types/connectkit/siwe/SIWEProvider.d.ts.map +1 -1
- package/types/connectkit/wallets/index.d.ts.map +1 -1
- package/types/connectkit/wallets/useWallets.d.ts.map +1 -1
- package/types/connectkit/wallets/walletConfigs.d.ts +0 -2
- package/types/connectkit/wallets/walletConfigs.d.ts.map +1 -1
- package/types/connectkit/web3Bridge.d.ts.map +1 -1
- package/types/esbuild.d.ts +31 -0
- package/types/esbuild.d.ts.map +1 -0
- package/types/hooks/useWallet.d.ts.map +1 -1
- package/types/providers/WalletProvider.d.ts.map +1 -1
- package/types/providers/mockConnector.d.ts +2 -2
- package/types/providers/native/deepLink.d.ts +1 -1
- package/types/providers/native/deepLink.d.ts.map +1 -1
- package/types/providers/walletConfig.d.ts +2 -1
- package/types/providers/walletConfig.d.ts.map +1 -1
- package/types/vite.d.ts +12 -0
- package/types/vite.d.ts.map +1 -0
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithQRCode.cjs +0 -133
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithQRCode.native.js +0 -179
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithQRCode.native.js.map +0 -1
- package/dist/cjs/connectkit/components/Pages/MobileConnectors/index.cjs +0 -158
- package/dist/cjs/connectkit/components/Pages/MobileConnectors/index.native.js +0 -183
- package/dist/cjs/connectkit/components/Pages/MobileConnectors/index.native.js.map +0 -1
- package/dist/cjs/connectkit/components/Pages/MobileConnectors/styles.cjs +0 -90
- package/dist/cjs/connectkit/components/Pages/MobileConnectors/styles.native.js +0 -99
- package/dist/cjs/connectkit/components/Pages/MobileConnectors/styles.native.js.map +0 -1
- package/dist/cjs/connectkit/connectors/metaMaskSdkConnector.cjs +0 -398
- package/dist/cjs/connectkit/connectors/metaMaskSdkConnector.native.js +0 -453
- package/dist/cjs/connectkit/connectors/metaMaskSdkConnector.native.js.map +0 -1
- package/dist/cjs/connectkit/hooks/connectors/useCoinbaseWalletUri.cjs +0 -0
- package/dist/cjs/connectkit/hooks/connectors/useCoinbaseWalletUri.native.js +0 -2
- package/dist/cjs/connectkit/hooks/connectors/useCoinbaseWalletUri.native.js.map +0 -1
- package/dist/cjs/connectkit/hooks/connectors/useWalletConnectUri.cjs +0 -113
- package/dist/cjs/connectkit/hooks/connectors/useWalletConnectUri.native.js +0 -117
- package/dist/cjs/connectkit/hooks/connectors/useWalletConnectUri.native.js.map +0 -1
- package/dist/cjs/connectkit/hooks/useWalletConnectModal.cjs +0 -74
- package/dist/cjs/connectkit/hooks/useWalletConnectModal.native.js +0 -79
- package/dist/cjs/connectkit/hooks/useWalletConnectModal.native.js.map +0 -1
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithQRCode.mjs +0 -108
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithQRCode.mjs.map +0 -1
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithQRCode.native.js +0 -140
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithQRCode.native.js.map +0 -1
- package/dist/esm/connectkit/components/Pages/MobileConnectors/index.mjs +0 -133
- package/dist/esm/connectkit/components/Pages/MobileConnectors/index.mjs.map +0 -1
- package/dist/esm/connectkit/components/Pages/MobileConnectors/index.native.js +0 -144
- package/dist/esm/connectkit/components/Pages/MobileConnectors/index.native.js.map +0 -1
- package/dist/esm/connectkit/components/Pages/MobileConnectors/styles.mjs +0 -61
- package/dist/esm/connectkit/components/Pages/MobileConnectors/styles.mjs.map +0 -1
- package/dist/esm/connectkit/components/Pages/MobileConnectors/styles.native.js +0 -67
- package/dist/esm/connectkit/components/Pages/MobileConnectors/styles.native.js.map +0 -1
- package/dist/esm/connectkit/connectors/metaMaskSdkConnector.mjs +0 -362
- package/dist/esm/connectkit/connectors/metaMaskSdkConnector.mjs.map +0 -1
- package/dist/esm/connectkit/connectors/metaMaskSdkConnector.native.js +0 -414
- package/dist/esm/connectkit/connectors/metaMaskSdkConnector.native.js.map +0 -1
- package/dist/esm/connectkit/hooks/connectors/useCoinbaseWalletUri.mjs +0 -2
- package/dist/esm/connectkit/hooks/connectors/useCoinbaseWalletUri.mjs.map +0 -1
- package/dist/esm/connectkit/hooks/connectors/useCoinbaseWalletUri.native.js +0 -2
- package/dist/esm/connectkit/hooks/connectors/useCoinbaseWalletUri.native.js.map +0 -1
- package/dist/esm/connectkit/hooks/connectors/useWalletConnectUri.mjs +0 -88
- package/dist/esm/connectkit/hooks/connectors/useWalletConnectUri.mjs.map +0 -1
- package/dist/esm/connectkit/hooks/connectors/useWalletConnectUri.native.js +0 -89
- package/dist/esm/connectkit/hooks/connectors/useWalletConnectUri.native.js.map +0 -1
- package/dist/esm/connectkit/hooks/useWalletConnectModal.mjs +0 -49
- package/dist/esm/connectkit/hooks/useWalletConnectModal.mjs.map +0 -1
- package/dist/esm/connectkit/hooks/useWalletConnectModal.native.js +0 -51
- package/dist/esm/connectkit/hooks/useWalletConnectModal.native.js.map +0 -1
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithQRCode.mjs +0 -108
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithQRCode.mjs.map +0 -1
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithQRCode.native.js +0 -179
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithQRCode.native.js.map +0 -1
- package/dist/jsx/connectkit/components/Pages/MobileConnectors/index.mjs +0 -133
- package/dist/jsx/connectkit/components/Pages/MobileConnectors/index.mjs.map +0 -1
- package/dist/jsx/connectkit/components/Pages/MobileConnectors/index.native.js +0 -183
- package/dist/jsx/connectkit/components/Pages/MobileConnectors/index.native.js.map +0 -1
- package/dist/jsx/connectkit/components/Pages/MobileConnectors/styles.mjs +0 -61
- package/dist/jsx/connectkit/components/Pages/MobileConnectors/styles.mjs.map +0 -1
- package/dist/jsx/connectkit/components/Pages/MobileConnectors/styles.native.js +0 -99
- package/dist/jsx/connectkit/components/Pages/MobileConnectors/styles.native.js.map +0 -1
- package/dist/jsx/connectkit/connectors/metaMaskSdkConnector.mjs +0 -362
- package/dist/jsx/connectkit/connectors/metaMaskSdkConnector.mjs.map +0 -1
- package/dist/jsx/connectkit/connectors/metaMaskSdkConnector.native.js +0 -453
- package/dist/jsx/connectkit/connectors/metaMaskSdkConnector.native.js.map +0 -1
- package/dist/jsx/connectkit/hooks/connectors/useCoinbaseWalletUri.mjs +0 -2
- package/dist/jsx/connectkit/hooks/connectors/useCoinbaseWalletUri.mjs.map +0 -1
- package/dist/jsx/connectkit/hooks/connectors/useCoinbaseWalletUri.native.js +0 -2
- package/dist/jsx/connectkit/hooks/connectors/useCoinbaseWalletUri.native.js.map +0 -1
- package/dist/jsx/connectkit/hooks/connectors/useWalletConnectUri.mjs +0 -88
- package/dist/jsx/connectkit/hooks/connectors/useWalletConnectUri.mjs.map +0 -1
- package/dist/jsx/connectkit/hooks/connectors/useWalletConnectUri.native.js +0 -117
- package/dist/jsx/connectkit/hooks/connectors/useWalletConnectUri.native.js.map +0 -1
- package/dist/jsx/connectkit/hooks/useWalletConnectModal.mjs +0 -49
- package/dist/jsx/connectkit/hooks/useWalletConnectModal.mjs.map +0 -1
- package/dist/jsx/connectkit/hooks/useWalletConnectModal.native.js +0 -79
- package/dist/jsx/connectkit/hooks/useWalletConnectModal.native.js.map +0 -1
- package/src/connectkit/components/ConnectModal/ConnectWithQRCode.tsx +0 -188
- package/src/connectkit/components/Pages/MobileConnectors/index.tsx +0 -142
- package/src/connectkit/components/Pages/MobileConnectors/styles.ts +0 -66
- package/src/connectkit/connectors/metaMaskSdkConnector.ts +0 -505
- package/src/connectkit/hooks/connectors/useCoinbaseWalletUri.tsx +0 -101
- package/src/connectkit/hooks/connectors/useWalletConnectUri.ts +0 -99
- package/src/connectkit/hooks/useWalletConnectModal.tsx +0 -52
- package/types/connectkit/components/ConnectModal/ConnectWithQRCode.d.ts +0 -6
- package/types/connectkit/components/ConnectModal/ConnectWithQRCode.d.ts.map +0 -1
- package/types/connectkit/components/Pages/MobileConnectors/index.d.ts +0 -4
- package/types/connectkit/components/Pages/MobileConnectors/index.d.ts.map +0 -1
- package/types/connectkit/components/Pages/MobileConnectors/styles.d.ts +0 -6
- package/types/connectkit/components/Pages/MobileConnectors/styles.d.ts.map +0 -1
- package/types/connectkit/connectors/metaMaskSdkConnector.d.ts +0 -30
- package/types/connectkit/connectors/metaMaskSdkConnector.d.ts.map +0 -1
- package/types/connectkit/hooks/connectors/useCoinbaseWalletUri.d.ts +0 -1
- package/types/connectkit/hooks/connectors/useCoinbaseWalletUri.d.ts.map +0 -1
- package/types/connectkit/hooks/connectors/useWalletConnectUri.d.ts +0 -8
- package/types/connectkit/hooks/connectors/useWalletConnectUri.d.ts.map +0 -1
- package/types/connectkit/hooks/useWalletConnectModal.d.ts +0 -5
- package/types/connectkit/hooks/useWalletConnectModal.d.ts.map +0 -1
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { mkdtempSync, readdirSync, readFileSync, rmSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { runInThisContext } from "node:vm";
|
|
7
|
+
|
|
8
|
+
import type { Plugin as EsbuildPlugin } from "esbuild";
|
|
9
|
+
import {
|
|
10
|
+
build,
|
|
11
|
+
type InlineConfig,
|
|
12
|
+
optimizeDeps,
|
|
13
|
+
type Plugin,
|
|
14
|
+
type Rolldown,
|
|
15
|
+
resolveConfig,
|
|
16
|
+
} from "vite";
|
|
17
|
+
import { afterAll, afterEach, describe, expect, it, vi } from "vitest";
|
|
18
|
+
|
|
19
|
+
import { metaMaskConnectTimeoutsEsbuild } from "../esbuild";
|
|
20
|
+
import { metaMaskConnectTimeouts } from "../vite";
|
|
21
|
+
import {
|
|
22
|
+
createMetaMaskConnectTimeoutTracker,
|
|
23
|
+
patchMetaMaskConnectTimeouts,
|
|
24
|
+
} from "./metaMaskConnectTimeouts";
|
|
25
|
+
|
|
26
|
+
const web3Root = fileURLToPath(new URL("../..", import.meta.url));
|
|
27
|
+
const requireHere = createRequire(import.meta.url);
|
|
28
|
+
|
|
29
|
+
const multichainPkg = "@metamask/connect-multichain";
|
|
30
|
+
const dappClientPkg = "@metamask/mobile-wallet-protocol-dapp-client";
|
|
31
|
+
|
|
32
|
+
/** Every JS file a package's root export can resolve to, whatever the bundler's conditions. */
|
|
33
|
+
function exportedFiles(pkgDir: string): string[] {
|
|
34
|
+
const { exports } = JSON.parse(readFileSync(join(pkgDir, "package.json"), "utf8"));
|
|
35
|
+
const files = new Set<string>();
|
|
36
|
+
const walk = (node: unknown) => {
|
|
37
|
+
if (typeof node === "string") {
|
|
38
|
+
if (/\.[cm]?js$/.test(node)) files.add(join(pkgDir, node));
|
|
39
|
+
} else if (node && typeof node === "object") Object.values(node).forEach(walk);
|
|
40
|
+
};
|
|
41
|
+
walk(exports["."]);
|
|
42
|
+
return [...files];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const multichainDir = dirname(requireHere.resolve(`${multichainPkg}/package.json`));
|
|
46
|
+
const dappClientDir = join(dirname(requireHere.resolve(dappClientPkg)), "..");
|
|
47
|
+
const connectEvmEntry = requireHere.resolve("@metamask/connect-evm");
|
|
48
|
+
const multichainFiles = exportedFiles(multichainDir);
|
|
49
|
+
const dappClientFiles = exportedFiles(dappClientDir);
|
|
50
|
+
const read = (file: string) => readFileSync(file, "utf8");
|
|
51
|
+
|
|
52
|
+
const pageLoadResume =
|
|
53
|
+
/resumeSession_fn = function\(session, options\)[\s\S]*?isContinuingPriorAttempt \? this\.options\.resumeTimeout : options \? this\.options\.connectionTimeout : 120 \* 1e3/;
|
|
54
|
+
const stockConnectionTimer =
|
|
55
|
+
/isContinuingPriorAttempt \? this\.options\.resumeTimeout : this\.options\.connectionTimeout/g;
|
|
56
|
+
|
|
57
|
+
describe("the timer patches on the installed MetaMask Connect", () => {
|
|
58
|
+
it("finds every entry file the bundlers can pick", () => {
|
|
59
|
+
expect(multichainFiles.length).toBeGreaterThanOrEqual(4);
|
|
60
|
+
expect(dappClientFiles.length).toBeGreaterThanOrEqual(2);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("raises the request timer to 600 s and the handshake timer to 540 s", () => {
|
|
64
|
+
for (const file of multichainFiles) {
|
|
65
|
+
const tracker = createMetaMaskConnectTimeoutTracker();
|
|
66
|
+
tracker.see(connectEvmEntry);
|
|
67
|
+
const code = read(file);
|
|
68
|
+
expect(code).toMatch(/DEFAULT_REQUEST_TIMEOUT\d* = 60 \* 1e3;\s+CONNECTION_GRACE_PERIOD =/);
|
|
69
|
+
const patched = tracker.patch(file, code)!.code;
|
|
70
|
+
expect(patched).toMatch(
|
|
71
|
+
/DEFAULT_REQUEST_TIMEOUT\d* = 600 \* 1e3;\s+CONNECTION_GRACE_PERIOD = 60 \* 1e3;/,
|
|
72
|
+
);
|
|
73
|
+
for (const dapp of dappClientFiles) tracker.patch(dapp, read(dapp));
|
|
74
|
+
expect(tracker.problem()).toBeUndefined();
|
|
75
|
+
}
|
|
76
|
+
for (const file of dappClientFiles) {
|
|
77
|
+
const code = read(file);
|
|
78
|
+
expect(code).toContain("HANDSHAKE_TIMEOUT = 60 * 1e3;");
|
|
79
|
+
const patched = patchMetaMaskConnectTimeouts(file, code)!.code;
|
|
80
|
+
expect(patched).toContain("HANDSHAKE_TIMEOUT = 540 * 1e3;");
|
|
81
|
+
expect(patched).not.toContain("HANDSHAKE_TIMEOUT = 60 * 1e3;");
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("gives only the option-less page-load resume the stock 120 s", () => {
|
|
86
|
+
for (const file of multichainFiles) {
|
|
87
|
+
const code = read(file);
|
|
88
|
+
expect(code.match(stockConnectionTimer)).toHaveLength(2);
|
|
89
|
+
const patched = patchMetaMaskConnectTimeouts(file, code)!.code;
|
|
90
|
+
expect(patched).toMatch(pageLoadResume);
|
|
91
|
+
// startSession (a new connect) keeps the long connection timer.
|
|
92
|
+
expect(patched.match(stockConnectionTimer)).toHaveLength(1);
|
|
93
|
+
expect(patched.indexOf("startSession_fn = function")).toBeLessThan(
|
|
94
|
+
patched.search(stockConnectionTimer),
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("fails the build when a package renames the marker it looks for", () => {
|
|
100
|
+
const [multichain] = multichainFiles;
|
|
101
|
+
const [dappClient] = dappClientFiles;
|
|
102
|
+
|
|
103
|
+
const renamedGrace = createMetaMaskConnectTimeoutTracker();
|
|
104
|
+
renamedGrace.see(connectEvmEntry);
|
|
105
|
+
expect(
|
|
106
|
+
renamedGrace.patch(
|
|
107
|
+
multichain!,
|
|
108
|
+
read(multichain!).replaceAll("CONNECTION_GRACE_PERIOD", "CONNECTION_GRACE_MS"),
|
|
109
|
+
),
|
|
110
|
+
).toBeUndefined();
|
|
111
|
+
renamedGrace.patch(dappClient!, read(dappClient!));
|
|
112
|
+
expect(renamedGrace.problem()).toMatch(
|
|
113
|
+
/left the timers in @metamask\/connect-multichain unpatched/,
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const renamedHandshake = createMetaMaskConnectTimeoutTracker();
|
|
117
|
+
renamedHandshake.see(connectEvmEntry);
|
|
118
|
+
renamedHandshake.patch(multichain!, read(multichain!));
|
|
119
|
+
renamedHandshake.patch(
|
|
120
|
+
dappClient!,
|
|
121
|
+
read(dappClient!).replaceAll("HANDSHAKE_TIMEOUT", "HANDSHAKE_GRACE"),
|
|
122
|
+
);
|
|
123
|
+
expect(renamedHandshake.problem()).toMatch(
|
|
124
|
+
/left the timers in @metamask\/mobile-wallet-protocol-dapp-client unpatched/,
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it("throws when a timer changed its value", () => {
|
|
129
|
+
const [multichain] = multichainFiles;
|
|
130
|
+
const [dappClient] = dappClientFiles;
|
|
131
|
+
const code = read(multichain!);
|
|
132
|
+
|
|
133
|
+
expect(() =>
|
|
134
|
+
patchMetaMaskConnectTimeouts(
|
|
135
|
+
multichain!,
|
|
136
|
+
code.replace(/(DEFAULT_REQUEST_TIMEOUT\d*) = 60 \* 1e3;/, "$1 = 90 * 1e3;"),
|
|
137
|
+
),
|
|
138
|
+
).toThrow(/timer DEFAULT_REQUEST_TIMEOUT not found/);
|
|
139
|
+
expect(() =>
|
|
140
|
+
patchMetaMaskConnectTimeouts(
|
|
141
|
+
dappClient!,
|
|
142
|
+
read(dappClient!).replace("HANDSHAKE_TIMEOUT = 60 * 1e3;", "HANDSHAKE_TIMEOUT = 45 * 1e3;"),
|
|
143
|
+
),
|
|
144
|
+
).toThrow(/timer HANDSHAKE_TIMEOUT not found/);
|
|
145
|
+
// A resume that no longer reads the connection timer must not send the
|
|
146
|
+
// rewrite on to startSession's copy of the expression.
|
|
147
|
+
expect(() =>
|
|
148
|
+
patchMetaMaskConnectTimeouts(
|
|
149
|
+
multichain!,
|
|
150
|
+
code.replace(stockConnectionTimer, (match, offset: number) =>
|
|
151
|
+
offset < code.indexOf("startSession_fn = function")
|
|
152
|
+
? "isContinuingPriorAttempt ? this.options.resumeTimeout : this.options.handshakeTimeout"
|
|
153
|
+
: match,
|
|
154
|
+
),
|
|
155
|
+
),
|
|
156
|
+
).toThrow(/timer the page-load session resume not found/);
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
type MWPTransportClass = new (
|
|
161
|
+
dappClient: unknown,
|
|
162
|
+
kvstore: unknown,
|
|
163
|
+
) => {
|
|
164
|
+
options: { requestTimeout: number; connectionTimeout: number; resumeTimeout: number };
|
|
165
|
+
getActiveSession(): Promise<unknown>;
|
|
166
|
+
connect(options?: { scopes: string[]; caipAccountIds: string[] }): Promise<void>;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/** connect-multichain's MWPTransport from its node build, with the timer patch applied. */
|
|
170
|
+
function loadPatchedMWPTransport() {
|
|
171
|
+
const file = requireHere.resolve(multichainPkg);
|
|
172
|
+
const code = patchMetaMaskConnectTimeouts(file, read(file))!.code;
|
|
173
|
+
const requireThere = createRequire(file);
|
|
174
|
+
const wrapper = runInThisContext(
|
|
175
|
+
`(function (module, exports, require, __filename, __dirname) {${code}\nreturn (init_mwp(), MWPTransport);\n})`,
|
|
176
|
+
{ filename: file },
|
|
177
|
+
);
|
|
178
|
+
const module = { exports: {} };
|
|
179
|
+
const MWPTransport: MWPTransportClass = wrapper(
|
|
180
|
+
module,
|
|
181
|
+
module.exports,
|
|
182
|
+
requireThere,
|
|
183
|
+
file,
|
|
184
|
+
dirname(file),
|
|
185
|
+
);
|
|
186
|
+
const { TransportTimeoutError } = requireThere("@metamask/multichain-api-client");
|
|
187
|
+
return { MWPTransport, TransportTimeoutError: TransportTimeoutError as new () => Error };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
describe("the patched MetaMask Connect transport", () => {
|
|
191
|
+
const { MWPTransport, TransportTimeoutError } = loadPatchedMWPTransport();
|
|
192
|
+
|
|
193
|
+
function transport(storedSession: boolean) {
|
|
194
|
+
// A relay that never answers: nothing resumes, nothing connects.
|
|
195
|
+
const dappClient = {
|
|
196
|
+
state: "DISCONNECTED",
|
|
197
|
+
on: vi.fn(),
|
|
198
|
+
off: vi.fn(),
|
|
199
|
+
once: vi.fn(),
|
|
200
|
+
resume: () => new Promise(() => undefined),
|
|
201
|
+
connect: () => new Promise(() => undefined),
|
|
202
|
+
disconnect: vi.fn(async () => undefined),
|
|
203
|
+
sendRequest: vi.fn(async () => undefined),
|
|
204
|
+
};
|
|
205
|
+
const store = new Map<string, string>();
|
|
206
|
+
const kvstore = {
|
|
207
|
+
get: async (key: string) => store.get(key) ?? null,
|
|
208
|
+
set: async (key: string, value: string) => void store.set(key, value),
|
|
209
|
+
delete: async (key: string) => void store.delete(key),
|
|
210
|
+
};
|
|
211
|
+
const mwp = new MWPTransport(dappClient, kvstore);
|
|
212
|
+
mwp.getActiveSession = async () => (storedSession ? { id: "stored" } : undefined);
|
|
213
|
+
return mwp;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function settle(promise: Promise<unknown>) {
|
|
217
|
+
const state: { error?: unknown; settled: boolean } = { settled: false };
|
|
218
|
+
promise.then(
|
|
219
|
+
() => Object.assign(state, { settled: true }),
|
|
220
|
+
(error) => Object.assign(state, { settled: true, error }),
|
|
221
|
+
);
|
|
222
|
+
return state;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
afterEach(() => vi.useRealTimers());
|
|
226
|
+
|
|
227
|
+
it("waits 600 s for a reply and 660 s for a connection", () => {
|
|
228
|
+
expect(transport(false).options).toMatchObject({
|
|
229
|
+
requestTimeout: 600_000,
|
|
230
|
+
connectionTimeout: 660_000,
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it("gives up on resuming a stored session on page load after 120 s", async () => {
|
|
235
|
+
vi.useFakeTimers();
|
|
236
|
+
const pageLoad = settle(transport(true).connect());
|
|
237
|
+
await vi.advanceTimersByTimeAsync(119_999);
|
|
238
|
+
expect(pageLoad.settled).toBe(false);
|
|
239
|
+
await vi.advanceTimersByTimeAsync(1);
|
|
240
|
+
expect(pageLoad.error).toBeInstanceOf(TransportTimeoutError);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it("keeps a connect on a stored session open for 660 s", async () => {
|
|
244
|
+
vi.useFakeTimers();
|
|
245
|
+
const connect = settle(transport(true).connect({ scopes: ["eip155:1"], caipAccountIds: [] }));
|
|
246
|
+
await vi.advanceTimersByTimeAsync(659_999);
|
|
247
|
+
expect(connect.settled).toBe(false);
|
|
248
|
+
await vi.advanceTimersByTimeAsync(1);
|
|
249
|
+
expect(connect.error).toBeInstanceOf(TransportTimeoutError);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
it("keeps a new connect open for 660 s", async () => {
|
|
253
|
+
vi.useFakeTimers();
|
|
254
|
+
const connect = settle(transport(false).connect({ scopes: ["eip155:1"], caipAccountIds: [] }));
|
|
255
|
+
await vi.advanceTimersByTimeAsync(659_999);
|
|
256
|
+
expect(connect.settled).toBe(false);
|
|
257
|
+
await vi.advanceTimersByTimeAsync(1);
|
|
258
|
+
expect(connect.error).toBeInstanceOf(TransportTimeoutError);
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
const entryId = "mpo-web3-timer-entry";
|
|
263
|
+
const entrySource = 'export { createEVMClient } from "@metamask/connect-evm";';
|
|
264
|
+
|
|
265
|
+
const entry: Plugin = {
|
|
266
|
+
name: "entry",
|
|
267
|
+
enforce: "pre",
|
|
268
|
+
resolveId: (id) => (id === entryId ? `\0${entryId}` : null),
|
|
269
|
+
load: (id) => (id === `\0${entryId}` ? entrySource : null),
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
/** Stands in for a MetaMask Connect release that renamed the marker the patch looks for. */
|
|
273
|
+
const renameGracePeriod: Plugin = {
|
|
274
|
+
name: "rename-grace-period",
|
|
275
|
+
enforce: "pre",
|
|
276
|
+
transform: (code, id) =>
|
|
277
|
+
id.replace(/\\/g, "/").includes(`/${multichainPkg}/`)
|
|
278
|
+
? code.replaceAll("CONNECTION_GRACE_PERIOD", "CONNECTION_GRACE_MS")
|
|
279
|
+
: null,
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
function expectLongTimers(code: string) {
|
|
283
|
+
expect(code).toMatch(/DEFAULT_REQUEST_TIMEOUT[\w$]* = 600 \* 1e3;\s+CONNECTION_GRACE_PERIOD/);
|
|
284
|
+
expect(code).toMatch(/HANDSHAKE_TIMEOUT[\w$]* = 540 \* 1e3;/);
|
|
285
|
+
expect(code).toMatch(/resumeTimeout : [\w$]+ \? this\.options\.connectionTimeout : 120 \* 1e3/);
|
|
286
|
+
expect(code).not.toMatch(/DEFAULT_REQUEST_TIMEOUT[\w$]* = 60 \* 1e3;\s+CONNECTION_GRACE_PERIOD/);
|
|
287
|
+
expect(code).not.toMatch(/HANDSHAKE_TIMEOUT[\w$]* = 60 \* 1e3;/);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function viteBuild(plugins: Plugin[]) {
|
|
291
|
+
return build({
|
|
292
|
+
configFile: false,
|
|
293
|
+
logLevel: "silent",
|
|
294
|
+
root: web3Root,
|
|
295
|
+
publicDir: false,
|
|
296
|
+
plugins,
|
|
297
|
+
build: {
|
|
298
|
+
write: false,
|
|
299
|
+
minify: false,
|
|
300
|
+
rolldownOptions: { input: entryId, preserveEntrySignatures: "exports-only" },
|
|
301
|
+
},
|
|
302
|
+
}) as Promise<Rolldown.RolldownOutput>;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
describe("the bundler plugins", () => {
|
|
306
|
+
const cacheDirs: string[] = [];
|
|
307
|
+
afterAll(() => {
|
|
308
|
+
for (const dir of cacheDirs) rmSync(dir, { recursive: true, force: true });
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
it("ships the long timers in a vite build", async () => {
|
|
312
|
+
const output = await viteBuild([entry, metaMaskConnectTimeouts()]);
|
|
313
|
+
expectLongTimers(output.output.map((chunk) => ("code" in chunk ? chunk.code : "")).join("\n"));
|
|
314
|
+
}, 120_000);
|
|
315
|
+
|
|
316
|
+
it("fails a vite build that bundles MetaMask Connect with a marker gone", async () => {
|
|
317
|
+
await expect(viteBuild([entry, renameGracePeriod, metaMaskConnectTimeouts()])).rejects.toThrow(
|
|
318
|
+
/left the timers in @metamask\/connect-multichain unpatched/,
|
|
319
|
+
);
|
|
320
|
+
}, 120_000);
|
|
321
|
+
|
|
322
|
+
async function preBundle(extra: Plugin[]) {
|
|
323
|
+
const cacheDir = mkdtempSync(join(tmpdir(), "mpo-web3-timers-"));
|
|
324
|
+
cacheDirs.push(cacheDir);
|
|
325
|
+
const inline: InlineConfig = {
|
|
326
|
+
configFile: false,
|
|
327
|
+
logLevel: "silent",
|
|
328
|
+
root: web3Root,
|
|
329
|
+
cacheDir,
|
|
330
|
+
optimizeDeps: {
|
|
331
|
+
include: ["@metamask/connect-evm"],
|
|
332
|
+
noDiscovery: true,
|
|
333
|
+
rolldownOptions: { plugins: extra },
|
|
334
|
+
},
|
|
335
|
+
plugins: [metaMaskConnectTimeouts()],
|
|
336
|
+
};
|
|
337
|
+
await optimizeDeps(await resolveConfig(inline, "serve"), true);
|
|
338
|
+
const deps = join(cacheDir, "deps");
|
|
339
|
+
return readdirSync(deps)
|
|
340
|
+
.filter((file) => file.endsWith(".js"))
|
|
341
|
+
.map((file) => readFileSync(join(deps, file), "utf8"))
|
|
342
|
+
.join("\n");
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
it("ships the long timers in the dev server's dependency pre-bundle", async () => {
|
|
346
|
+
expectLongTimers(await preBundle([]));
|
|
347
|
+
}, 120_000);
|
|
348
|
+
|
|
349
|
+
it("fails the dev server's pre-bundle when a marker is gone", async () => {
|
|
350
|
+
await expect(preBundle([renameGracePeriod])).rejects.toThrow(
|
|
351
|
+
/left the timers in @metamask\/connect-multichain unpatched/,
|
|
352
|
+
);
|
|
353
|
+
}, 120_000);
|
|
354
|
+
|
|
355
|
+
async function esbuildBundle(before: EsbuildPlugin[] = []) {
|
|
356
|
+
const esbuild = await import("esbuild");
|
|
357
|
+
const result = await esbuild.build({
|
|
358
|
+
stdin: { contents: entrySource, resolveDir: web3Root },
|
|
359
|
+
bundle: true,
|
|
360
|
+
write: false,
|
|
361
|
+
format: "esm",
|
|
362
|
+
platform: "browser",
|
|
363
|
+
logLevel: "silent",
|
|
364
|
+
plugins: [...before, metaMaskConnectTimeoutsEsbuild()],
|
|
365
|
+
});
|
|
366
|
+
return result.outputFiles.map((file) => file.text).join("\n");
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
it("ships the long timers in an esbuild bundle", async () => {
|
|
370
|
+
expectLongTimers(await esbuildBundle());
|
|
371
|
+
}, 120_000);
|
|
372
|
+
|
|
373
|
+
it("fails an esbuild bundle when a marker is gone", async () => {
|
|
374
|
+
const renamed: EsbuildPlugin = {
|
|
375
|
+
name: "rename-grace-period",
|
|
376
|
+
setup(build) {
|
|
377
|
+
build.onLoad(
|
|
378
|
+
{ filter: /[\\/]@metamask[\\/]connect-multichain[\\/].*\.[cm]?js$/ },
|
|
379
|
+
(args) => ({
|
|
380
|
+
contents: read(args.path).replaceAll("CONNECTION_GRACE_PERIOD", "CONNECTION_GRACE_MS"),
|
|
381
|
+
loader: "js",
|
|
382
|
+
}),
|
|
383
|
+
);
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
await expect(esbuildBundle([renamed])).rejects.toThrow(
|
|
387
|
+
/left the timers in @metamask\/connect-multichain unpatched/,
|
|
388
|
+
);
|
|
389
|
+
}, 120_000);
|
|
390
|
+
});
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// MetaMask Connect gives up on the wallet after fixed timers it has no option
|
|
2
|
+
// for: a request's reply after 60 s, and the connect handshake 60 s after its
|
|
3
|
+
// 60 s session request expires. Both are module constants (connect-multichain
|
|
4
|
+
// builds its MWPTransport without options), so the only way to move them is to
|
|
5
|
+
// rewrite the constant in the bundled source. On Android 16 the browser has no
|
|
6
|
+
// network while MetaMask is in front, so the wallet's answer waits in the relay
|
|
7
|
+
// until the user switches back; a user who lingered in MetaMask lost the request
|
|
8
|
+
// to those timers. Both become ten minutes (540 s + the 60 s session expiry).
|
|
9
|
+
//
|
|
10
|
+
// The connection timer is the request timer plus 60 s, so it grows to 660 s with
|
|
11
|
+
// it. That is right for a connect the user is approving in MetaMask, but the same
|
|
12
|
+
// timer bounds resuming a stored session on page load, where nobody is in
|
|
13
|
+
// MetaMask and connector calls wait on the resume. The resume made without
|
|
14
|
+
// connect options (the page-load one) keeps the stock 120 s.
|
|
15
|
+
//
|
|
16
|
+
// A pattern that stops matching fails the build instead of quietly shipping the
|
|
17
|
+
// short timers again.
|
|
18
|
+
|
|
19
|
+
export type MetaMaskConnectTimerRewrite = {
|
|
20
|
+
/** The timer, as a build error names it. */
|
|
21
|
+
timer: string;
|
|
22
|
+
pattern: RegExp;
|
|
23
|
+
replacement: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type MetaMaskConnectTimeoutPatch = {
|
|
27
|
+
pkg: string;
|
|
28
|
+
marker: string;
|
|
29
|
+
rewrites: readonly MetaMaskConnectTimerRewrite[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const metaMaskConnectTimeoutPatches: readonly MetaMaskConnectTimeoutPatch[] = [
|
|
33
|
+
{
|
|
34
|
+
pkg: "@metamask/connect-multichain",
|
|
35
|
+
marker: "CONNECTION_GRACE_PERIOD",
|
|
36
|
+
rewrites: [
|
|
37
|
+
{
|
|
38
|
+
timer: "DEFAULT_REQUEST_TIMEOUT",
|
|
39
|
+
pattern: /(DEFAULT_REQUEST_TIMEOUT\d*) = 60 \* 1e3;(\s+CONNECTION_GRACE_PERIOD =)/,
|
|
40
|
+
replacement: "$1 = 600 * 1e3;$2",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
timer: "the page-load session resume",
|
|
44
|
+
pattern:
|
|
45
|
+
/(resumeSession_fn = function\((\w+), (\w+)\)(?:(?!startSession_fn)[\s\S])*?isContinuingPriorAttempt \? this\.options\.resumeTimeout : )this\.options\.connectionTimeout/,
|
|
46
|
+
replacement: "$1$3 ? this.options.connectionTimeout : 120 * 1e3",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
pkg: "@metamask/mobile-wallet-protocol-dapp-client",
|
|
52
|
+
marker: "HANDSHAKE_TIMEOUT",
|
|
53
|
+
rewrites: [
|
|
54
|
+
{
|
|
55
|
+
timer: "HANDSHAKE_TIMEOUT",
|
|
56
|
+
pattern: /(HANDSHAKE_TIMEOUT) = 60 \* 1e3;/,
|
|
57
|
+
replacement: "$1 = 540 * 1e3;",
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const metaMaskConnectPkg = "@metamask/connect-evm";
|
|
64
|
+
|
|
65
|
+
const normalize = (id: string) => id.replace(/\\/g, "/");
|
|
66
|
+
|
|
67
|
+
/** Which timer patch a module needs, or undefined when it carries none. */
|
|
68
|
+
export function metaMaskConnectTimeoutPatchFor(
|
|
69
|
+
id: string,
|
|
70
|
+
code: string,
|
|
71
|
+
): MetaMaskConnectTimeoutPatch | undefined {
|
|
72
|
+
const path = normalize(id);
|
|
73
|
+
return metaMaskConnectTimeoutPatches.find(
|
|
74
|
+
(patch) => path.includes(`/${patch.pkg}/`) && code.includes(patch.marker),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Raise the timers in one module's source. Returns undefined for a module that
|
|
80
|
+
* holds no timer, and throws when a module holds one the patterns no longer match.
|
|
81
|
+
*/
|
|
82
|
+
export function patchMetaMaskConnectTimeouts(
|
|
83
|
+
id: string,
|
|
84
|
+
code: string,
|
|
85
|
+
): { pkg: string; code: string } | undefined {
|
|
86
|
+
const patch = metaMaskConnectTimeoutPatchFor(id, code);
|
|
87
|
+
if (!patch) return undefined;
|
|
88
|
+
let patched = code;
|
|
89
|
+
for (const rewrite of patch.rewrites) {
|
|
90
|
+
if (!rewrite.pattern.test(patched))
|
|
91
|
+
throw new Error(
|
|
92
|
+
`MetaMask Connect timer ${rewrite.timer} not found in ${id}: ${patch.pkg} changed its source, so the long Android timers cannot be applied`,
|
|
93
|
+
);
|
|
94
|
+
patched = patched.replace(rewrite.pattern, rewrite.replacement);
|
|
95
|
+
}
|
|
96
|
+
return { pkg: patch.pkg, code: patched };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Counts what one build patched, so the build can refuse to ship MetaMask Connect
|
|
101
|
+
* with a timer left short (a package renamed the marker the patch looks for).
|
|
102
|
+
*/
|
|
103
|
+
export function createMetaMaskConnectTimeoutTracker() {
|
|
104
|
+
const patched = new Map<string, number>();
|
|
105
|
+
let bundlesMetaMaskConnect = false;
|
|
106
|
+
return {
|
|
107
|
+
see(id: string) {
|
|
108
|
+
if (normalize(id).includes(`/${metaMaskConnectPkg}/`)) bundlesMetaMaskConnect = true;
|
|
109
|
+
},
|
|
110
|
+
patch(id: string, code: string) {
|
|
111
|
+
this.see(id);
|
|
112
|
+
const result = patchMetaMaskConnectTimeouts(id, code);
|
|
113
|
+
if (result) patched.set(result.pkg, (patched.get(result.pkg) ?? 0) + 1);
|
|
114
|
+
return result;
|
|
115
|
+
},
|
|
116
|
+
/** Error text when the build bundles MetaMask Connect with a timer left unpatched. */
|
|
117
|
+
problem(): string | undefined {
|
|
118
|
+
if (!bundlesMetaMaskConnect) return undefined;
|
|
119
|
+
const missing = metaMaskConnectTimeoutPatches
|
|
120
|
+
.map((patch) => patch.pkg)
|
|
121
|
+
.filter((pkg) => !patched.get(pkg));
|
|
122
|
+
if (!missing.length) return undefined;
|
|
123
|
+
return `the build bundles ${metaMaskConnectPkg} but left the timers in ${missing.join(", ")} unpatched`;
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// base64(message); message is the SIWS text; address == base58 ed25519 pubkey.
|
|
10
10
|
//
|
|
11
11
|
// (A future system-browser / Mobile-Wallet-Adapter path — the Solana analogue
|
|
12
|
-
// of
|
|
12
|
+
// of a relay — would be a separate adapter, same as the Ethereum gap.)
|
|
13
13
|
|
|
14
14
|
import type { SignInMessageOptions, WalletAdapter, WalletAddress } from "./types";
|
|
15
15
|
|
|
@@ -19,7 +19,7 @@ export interface WalletEntry {
|
|
|
19
19
|
/**
|
|
20
20
|
* Detect the non-EVM wallets present in the page (Solana / Sui / Bitcoin). EVM
|
|
21
21
|
* wallets are intentionally NOT returned here — they are handled natively by
|
|
22
|
-
* wagmi's EIP-6963 / Coinbase /
|
|
22
|
+
* wagmi's EIP-6963 / Coinbase / MetaMask connectors. One entry per
|
|
23
23
|
* (ecosystem, primary wallet); each carries a ready wallet adapter.
|
|
24
24
|
*/
|
|
25
25
|
export function discoverWallets(): WalletEntry[] {
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
isCoinbaseWalletConnector,
|
|
10
10
|
isMetaMaskConnector,
|
|
11
11
|
isPortoConnector,
|
|
12
|
-
isWalletConnectConnector,
|
|
13
12
|
resolveListEntries,
|
|
14
13
|
useModalState,
|
|
15
14
|
useScreenRegistry,
|
|
@@ -25,7 +24,6 @@ import {
|
|
|
25
24
|
RecentlyUsedTag,
|
|
26
25
|
} from "./styles";
|
|
27
26
|
|
|
28
|
-
import { useWeb3 } from "../../contexts/web3";
|
|
29
27
|
import { WalletProps, useWallets } from "../../../wallets/useWallets";
|
|
30
28
|
import { useLastConnector } from "../../../hooks/useLastConnector";
|
|
31
29
|
import { setConnectIntent } from "../../../siwe/connectIntent";
|
|
@@ -62,13 +60,12 @@ const ConnectorList = () => {
|
|
|
62
60
|
|
|
63
61
|
const filteredWallets = wallets.filter((wallet) => wallet.id !== aaveAccountConnector?.id);
|
|
64
62
|
|
|
65
|
-
const walletsToDisplay =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
];
|
|
63
|
+
const walletsToDisplay = context.options?.hideRecentBadge
|
|
64
|
+
? filteredWallets
|
|
65
|
+
: [
|
|
66
|
+
...filteredWallets.filter((wallet) => lastConnectorId === wallet.connector.id),
|
|
67
|
+
...filteredWallets.filter((wallet) => lastConnectorId !== wallet.connector.id),
|
|
68
|
+
];
|
|
72
69
|
|
|
73
70
|
// Group by brand name (first-seen order preserved).
|
|
74
71
|
const groups: WalletGroup[] = [];
|
|
@@ -205,63 +202,36 @@ const ConnectorItem = ({
|
|
|
205
202
|
isRecent?: boolean;
|
|
206
203
|
labelOverride?: string;
|
|
207
204
|
}) => {
|
|
208
|
-
const {
|
|
209
|
-
connect: { getUri },
|
|
210
|
-
} = useWeb3();
|
|
211
|
-
const uri = getUri();
|
|
212
205
|
const isMobile = useIsMobile();
|
|
213
206
|
const context = useContext();
|
|
214
207
|
|
|
215
208
|
const { connect } = useConnect();
|
|
216
209
|
|
|
217
|
-
let deeplink =
|
|
218
|
-
!isMetaMaskConnector(wallet.connector.id) && // metaMaskSDK deep-links via the SDK's connect(), never via WalletConnect
|
|
219
|
-
((!wallet.isInstalled && isMobile) || (wallet.shouldDeeplinkDesktop && !isMobile))
|
|
220
|
-
? wallet.getWalletConnectDeeplink?.(uri ?? "")
|
|
221
|
-
: undefined;
|
|
222
|
-
|
|
223
|
-
const redirectToMoreWallets = isMobile && isWalletConnectConnector(wallet.id);
|
|
224
210
|
// Safari requires opening popup on user gesture, so we connect immediately here.
|
|
225
|
-
//
|
|
226
|
-
//
|
|
211
|
+
// MetaMask on mobile must also connect inside the tap gesture so its app
|
|
212
|
+
// deeplink isn't blocked by the browser's user-activation rules.
|
|
227
213
|
const shouldConnectImmediately =
|
|
228
214
|
((detectBrowser() === "safari" || detectBrowser() === "ios") &&
|
|
229
215
|
(isCoinbaseWalletConnector(wallet.connector.id) || isPortoConnector(wallet.connector.id))) ||
|
|
230
216
|
(isMobile && isMetaMaskConnector(wallet.connector.id));
|
|
231
217
|
|
|
232
|
-
if (redirectToMoreWallets || shouldConnectImmediately) deeplink = undefined; // mobile redirects to more wallets page
|
|
233
|
-
|
|
234
218
|
return (
|
|
235
219
|
<ConnectorButton
|
|
236
220
|
type="button"
|
|
237
|
-
as={deeplink ? "a" : undefined}
|
|
238
|
-
href={deeplink ? deeplink : undefined}
|
|
239
221
|
disabled={context.route !== routes.CONNECTORS}
|
|
240
|
-
onClick={
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
setConnectIntent();
|
|
252
|
-
connect({ connector: wallet?.connector });
|
|
253
|
-
}
|
|
254
|
-
context.setRoute(routes.CONNECT);
|
|
255
|
-
context.setConnector({ id: wallet.id });
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
222
|
+
onClick={() => {
|
|
223
|
+
if (shouldConnectImmediately) {
|
|
224
|
+
// Mobile deeplinks out to the wallet app and comes back through a
|
|
225
|
+
// page remount, so record the intent to continue into signing before
|
|
226
|
+
// we lose all in-memory state (see connectIntent).
|
|
227
|
+
setConnectIntent();
|
|
228
|
+
connect({ connector: wallet?.connector });
|
|
229
|
+
}
|
|
230
|
+
context.setRoute(routes.CONNECT);
|
|
231
|
+
context.setConnector({ id: wallet.id });
|
|
232
|
+
}}
|
|
259
233
|
>
|
|
260
|
-
<ConnectorIcon
|
|
261
|
-
data-small={wallet.iconShouldShrink}
|
|
262
|
-
data-shape={wallet.iconShape}
|
|
263
|
-
data-background={redirectToMoreWallets}
|
|
264
|
-
>
|
|
234
|
+
<ConnectorIcon data-small={wallet.iconShouldShrink} data-shape={wallet.iconShape}>
|
|
265
235
|
{wallet.iconConnector ?? wallet.icon}
|
|
266
236
|
</ConnectorIcon>
|
|
267
237
|
<ConnectorLabel>
|