import { z as t } from "zod";
import a from "lodash.once";
import { logger as c } from "../../logger.js";
import { nearFailoverRpcProvider as i } from "./rpc.js";
const s = a((r) => i({
  urls: r
})), g = async (r, n) => {
  try {
    const o = await s(n).query({
      request_type: "view_account",
      account_id: r,
      finality: "optimistic"
    });
    return t.object({ amount: t.string() }).parse(o).amount;
  } catch (e) {
    return c.error(
      new Error("error fetching native near balance", { cause: e })
    ), null;
  }
};
export {
  g as getNativeNearBalance
};
//# sourceMappingURL=getNativeNearBalance.js.map
