starknet.dart icon indicating copy to clipboard operation
starknet.dart copied to clipboard

Account infos loading issue with wallet_kit when WalletBody widget is not used

Open redDwarf03 opened this issue 6 months ago • 1 comments

When using wallet_kit, I encountered an issue where the DeployAccountButtonappear, and a message saying "Not enough ETH" is shown — even though my account does have ETH.

This issue occurs depending on how the widgets are structured in the widget tree.

✅ Working code (button is available):

const Column(
  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  children: [
    Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        WalletSelector(),
        AccountAddress(),
        DeployAccountButton(),
      ],
    ),
    WalletBody(),
    SendEthButton(),
    WalletErrorHandler(),
  ],
),

❌ Not working (button is NOT available):

const Column(
  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  children: [
    Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        WalletSelector(),
        AccountAddress(),
        DeployAccountButton(),
      ],
    ),
    SendEthButton(),
    WalletErrorHandler(),
  ],
),

Note: The two snippets look the same — this is intentional, as I’m using the same code, but getting different behavior depending on how it's rendered.

Hypothesis:

It seems that WalletBody may internally initialize some providers or context necessary for DeployAccountButton to work correctly (ex: selectedAccount!.balances).

redDwarf03 avatar May 22 '25 12:05 redDwarf03

I forced in my project

  final selectedAccount =
        ref.watch(walletsProvider.select((value) => value.selectedAccount));
    if (selectedAccount != null) {
      ref.read(walletsProvider.notifier)
        ..refreshEthBalance(
          selectedAccount.walletId,
          selectedAccount.id,
        )
        ..refreshStrkBalance(
          selectedAccount.walletId,
          selectedAccount.id,
        );
    }

instead of using WalletBody widget

redDwarf03 avatar May 22 '25 13:05 redDwarf03

Could you assign me this issue please

Recommended by OnlyDust for outstanding experience and quality contributions.

redDwarf03 avatar Jun 26 '25 13:06 redDwarf03

Hi, I have multiple OSS experience and mobile development on blockchain projects, would love to tackle this!

Recommended by OnlyDust for outstanding experience and quality contributions.

adrianvrj avatar Jun 28 '25 11:06 adrianvrj