Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map not enough coins to fit the target error #2522

Open
arboleya opened this issue Jun 15, 2024 · 4 comments
Open

Map not enough coins to fit the target error #2522

arboleya opened this issue Jun 15, 2024 · 4 comments
Labels
feat Issue is a feature p1 Medium priority
Milestone

Comments

@arboleya
Copy link
Member

Errors like not enough coins to fit the target don't seem obvious to users:

We should consider mapping this one even before we get to #2467.

@goheesheng
Copy link

goheesheng commented Jun 18, 2024

The reason for causing this issue is because of the deployer or the provider has 0 tokens at first. Hence I think to fix it is to use generateTestWallet. However currently, the importation doesn't work forum.

P.S. The current fuel dApp in Typescript SDK uses local node.

import { NODE_URL } from "../../lib";
import { Provider, Wallet, WalletUnlocked, Signer } from "fuels";
import { useState } from "react";
import useAsync from "react-use/lib/useAsync";
// import { generateTestWallet } from '@fuel-ts/account/test-utils';

export const useFaucet = () => {
  const [faucetWallet, setFaucetWallet] = useState<WalletUnlocked>();

  useAsync(async () => {
    if (!faucetWallet) {
      const provider = await Provider.create(NODE_URL);
      const wallet = Wallet.fromPrivateKey("0x01", provider);
      const signer = new Signer("0x01");
      const balances: CoinQuantity[] = await wallet.getBalances();
      console.log('Local Provider address', signer)
      setFaucetWallet(wallet);
    }
  }, [faucetWallet]);

  return {
    faucetWallet,
  };
};

@arboleya arboleya removed the chore Issue is a chore label Jun 18, 2024
@nedsalk nedsalk self-assigned this Jun 28, 2024
@nedsalk nedsalk removed their assignment Jul 11, 2024
@danielbate
Copy link
Contributor

I'd like to close this in favour of #2467, I also don't think this is required for mainnet as we don't map any of the other VM errors. @FuelLabs/sdk-ts

@arboleya
Copy link
Member Author

I was hoping we could squeeze this in because it's been more prevalent, but you also have a point.

Maybe we can give it another week or so and then deprioritize it in case we can't get it across the line.

@maschad
Copy link
Member

maschad commented Jul 16, 2024

@danielbate whilst I agree that this would be an exceptional use case in terms of mapping a VM error, the fact that other consumers have been perplexed by it suggests to me that we should consider the DX when this error is thrown. My personal opinion is that they should be directed to the faucet when this error is thrown, but that would require it to be mapped first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature p1 Medium priority
Projects
None yet
Development

No branches or pull requests

5 participants