import { getMainAccount } from "@ledgerhq/ledger-wallet-framework/account/index";
import { getAccountBridge } from "../bridge";
import type { Account, AccountLike } from "@ledgerhq/types-live";

export {
  getReceiveFlowError,
  checkAccountSupported,
} from "@ledgerhq/ledger-wallet-framework/account/support";

export function canSend(account: AccountLike, parentAccount: Account | null | undefined): boolean {
  try {
    getAccountBridge(account, parentAccount).createTransaction(
      getMainAccount(account, parentAccount),
    );
    return true;
  } catch {
    return false;
  }
}
