@kagamidigital/salt-sdk-mirror
    Preparing search index...

    Function isInsufficientFundsError

    • Check whether an error indicates insufficient native currency for a transaction's total cost. Matches viem errors (InsufficientFundsError), raw RPC errors (insufficient funds for gas * price + value), and Salt API errors (ApiError with code INSUFFICIENT_FUNDS).

      Used internally to translate low-level failures into InsufficientFunds; also exported for consumers who need to classify errors from their own viem or API calls.

      Parameters

      • error: unknown

        The error to check

      Returns boolean

      true if the error indicates insufficient funds

      import { isInsufficientFundsError } from 'salt-sdk';

      try {
      await publicClient.sendRawTransaction({ serializedTransaction: signedTx });
      } catch (err) {
      if (isInsufficientFundsError(err)) {
      console.error('The account needs funding on this chain');
      }
      }