|
|
|
@@ -87,14 +87,6 @@ const injectedConnectorOptions = {
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const walletconnect1ConnectorOptions = {
|
|
|
|
|
chains,
|
|
|
|
|
options: {
|
|
|
|
|
bridge: import.meta.env.VITE_WALLETCONNECT1_BRIDGE,
|
|
|
|
|
qrcode: true,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const walletconnect2ConnectorOptions: ConstructorParameters<typeof WalletConnectConnector>[0] = {
|
|
|
|
|
chains,
|
|
|
|
|
options: {
|
|
|
|
@@ -143,7 +135,6 @@ const connectors = [
|
|
|
|
|
reloadOnDisconnect: false,
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
new WalletConnectLegacyConnector(walletconnect1ConnectorOptions),
|
|
|
|
|
new WalletConnectConnector(walletconnect2ConnectorOptions),
|
|
|
|
|
new InjectedConnector(injectedConnectorOptions),
|
|
|
|
|
];
|
|
|
|
@@ -166,19 +157,6 @@ const createInjectedConnectorWithProvider = (provider: ExternalProvider) =>
|
|
|
|
|
provider as unknown as Awaited<ReturnType<InjectedConnector['getProvider']>>;
|
|
|
|
|
})(injectedConnectorOptions) as InjectedConnector;
|
|
|
|
|
|
|
|
|
|
// Create a custom wagmi WalletConnectLegacyConnector with a modal showing only wallet links matching the given name
|
|
|
|
|
const createWalletConnect1ConnectorWithName = (walletconnect1Name: string) =>
|
|
|
|
|
new WalletConnectLegacyConnector({
|
|
|
|
|
...walletconnect1ConnectorOptions,
|
|
|
|
|
options: {
|
|
|
|
|
...walletconnect1ConnectorOptions.options,
|
|
|
|
|
qrcodeModalOptions: {
|
|
|
|
|
desktopLinks: [walletconnect1Name],
|
|
|
|
|
mobileLinks: [walletconnect1Name],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const createWalletConnect2ConnectorWithId = (walletconnect2Id: string) =>
|
|
|
|
|
new WalletConnectConnector({
|
|
|
|
|
...walletconnect2ConnectorOptions,
|
|
|
|
@@ -214,9 +192,6 @@ export const resolveWagmiConnector = ({
|
|
|
|
|
|
|
|
|
|
return walletConnection.type === WalletConnectionType.InjectedEip1193 && walletConnection.provider
|
|
|
|
|
? createInjectedConnectorWithProvider(walletConnection.provider)
|
|
|
|
|
: walletConnection.type === WalletConnectionType.WalletConnect1 &&
|
|
|
|
|
walletConfig.walletconnect1Name
|
|
|
|
|
? createWalletConnect1ConnectorWithName(walletConfig.walletconnect1Name)
|
|
|
|
|
: walletConnection.type === WalletConnectionType.WalletConnect2 && walletConfig.walletconnect2Id
|
|
|
|
|
? createWalletConnect2ConnectorWithId(walletConfig.walletconnect2Id)
|
|
|
|
|
: connectors.find(({ id }: { id: string }) => id === walletConnectionConfig.wagmiConnectorId);
|
|
|
|
|