apibara/starknet-react

bug: address & connector from useAccount are undefined

irisdv opened this issue · 10 comments

When I test our connection button with v3 of starknet-react, the value of account from useAccount is defined correctly, isConnected is true, but address is undefined and connector is undefined.

Here is how I connect :

import { InjectedConnector } from "starknetkit/injected";
import { Connector } from "@starknet-react/core";

 const connectors = [
    new InjectedConnector({ options: { id: "argentX" } }),
    new InjectedConnector({ options: { id: "braavos" } }),
  ];
 <StarknetConfig
              chains={chains}
              provider={providers}
              connectors={connectors as Connector[]}
              autoConnect
            ></StarknetConfig>
import { Connector, useConnect } from "@starknet-react/core";

const { connectAsync } = useConnect();
const connectWallet = async (connector: Connector) => {
    await connectAsync({ connector });
}

I'm testing with

"@starknet-react/chains": "^3.0.0-beta.1",
"@starknet-react/core": "^3.0.0-beta.1",
"starknetkit": "^2.2.15",
"starknet": "^6.11.0",

Thank you for the report! I will check what's going on and fix it.

hey @fracek if you like I can take it too

Hey @jrmncos if you are able to reproduce and can open a PR with a fix I'm happy to review it. Notice this is with the code in the develop branch.

Is someone working on it? I'm currently debugging this issue, might send a patch PR later if I figure what's going on.

Edit: I looked around and from my testings when calling useAccount it seems to always go to here, where it's not connected to any connector. connAccount is a WalletAccount instance, but the address is an empty string (which is set in the constructor) when comparing with connectedAccount.address.

I couldn't reproduce the issue. If you can and can submit a fix I'll be happy to review it!

I couldn't reproduce the issue. If you can and can submit a fix I'll be happy to review it!

I got the issue in my work project and this sandbox here for reference. I'm still investigating the issue, but so far I understand that the address is set when connected, but then reverts back to an empty string, while the connector is always undefined.

Tested with the following wallet versions:
Argent X: v5.17.8
Braavos: v3.69.2

Chromium Engine Version 127.0.6533.100

I couldn't reproduce the issue. If you can and can submit a fix I'll be happy to review it!

I got the issue in my work project and this sandbox here for reference. I'm still investigating the issue, but so far I understand that the address is set when connected, but then reverts back to an empty string, while the connector is always undefined.

Tested with the following wallet versions: Argent X: v5.17.8 Braavos: v3.69.2

Chromium Engine Version 127.0.6533.100

That's super helpful thank you!

I'm currently debugging this issue. Can anyone help me?

hey @fracek can you help me?

Hey @irisdv @kseikyo , this issue has been fixed in the latest beta release. Please update the starknet-react and starknet packages to the latest versions. Here's the updated sandbox if it helps.

Also thank you @NGUYENDANGVU-coder and @jrmncos for offering to help with this issue. it's already been resolved now, so no further action is needed. : )