fcl-js icon indicating copy to clipboard operation
fcl-js copied to clipboard

[BUG] WalletConnect warnings

Open jribbink opened this issue 5 months ago • 0 comments

Current Behavior

Discord report:

I am attempting to configure my website correctly to use FCL / WalletConnect 2.0

I see a bunch of warnings in my console:

WalletConnect Plugin has been already loaded with different configuration. It is not possible to change the configuration after the plugin has been loaded.

I am loading a config file that includes:

export async function setupFclConfigAndWalletConnect() {
  // Flow SDK configuration
  fcl
    .config()
    .put("accessNode.api", "https://rest-mainnet.onflow.org") // Mainnet HTTP access
    .put("discovery.wallet", "https://fcl-discovery.onflow.org/authn") // Wallet service for Flow Mainnet
    .put(
      "discovery.authn.endpoint",
      "https://fcl-discovery.onflow.org/api/authn"
    )
    .put("walletconnect.projectId", "123") // WalletConnect project ID
    .put("app.detail.title", "FlowConnect") // Your app's title
    .put("app.detail.icon", "https://flowconnect.io/logo.png") // Your app's icon URL
    .put("app.detail.description", "Connecting Flow Communities") // Your app's description
    .put("app.detail.url", "https://flowconnect.io"); // Your app's URL

  // WalletConnect configuration
  const { FclWcServicePlugin } = await init({
    projectId: "123", // Your WalletConnect project ID
    metadata: {
      name: "FlowConnect",
      description: "Connecting Flow Communities",
      url: "https://flowconnect.io",
      icons: ["https://flowconnect.io/logo.png"],
    },
    includeBaseWC: true, // Includes a basic WalletConnect service
    wcRequestHook: (wcRequestData) => {
      console.log("WalletConnect request:", wcRequestData);
    }, // Optional: Hook to handle signing requests
    pairingModalOverride: (uri, rejectPairingRequest) => {
      console.log("Override pairing modal with URI:", uri);
    }, // Optional: Custom handling for QR code pairing modal
  });

  // Register the WalletConnect plugin with FCL
  fcl.pluginRegistry.add(FclWcServicePlugin);
}

Context https://discord.com/channels/613813861610684416/1171147675895345162/1285358946097434655

Expected Behavior

Should not display warning if WalletConnect is configured correctly/once.

Maybe we can refresh the plugin when the config changes, but I think the fact that it's "changing" when it hasn't actually changed is an issue in and of itself.

Steps To Reproduce

n/a

Environment

n/a

What are you currently working on that this is blocking?

No response

jribbink avatar Sep 24 '24 21:09 jribbink