{"size": 1114, "ext": "js", "max_stars_repo_path": "stacking/utils.js", "max_stars_repo_name": "rachit2501/StackingDashboard-Server", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "stacking/utils.js", "max_issues_repo_name": "rachit2501/StackingDashboard-Server", "max_issues_repo_issues_event_min_datetime": "2021-09-02T19:54:14.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-14T02:08:22.000Z", "max_forks_repo_path": "stacking/utils.js", "max_forks_repo_name": "rachit2501/StackingDashboard-Server", "max_forks_repo_forks_event_min_datetime": "2021-05-12T11:00:30.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-12T11:00:30.000Z"}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": 1, "avg_line_length": 25.3181818182, "max_line_length": 77, "alphanum_fraction": 0.7378815081}
import client from "./generateAccount.js";
import config from "../config.js";
import { secondsUntilNextCycle, cycleDuration } from "./displayStaking.js";

export async function isUserEligible() {
  const hasMinStxAmount = await client.hasMinimumStx();
  return hasMinStxAmount;
}

export function numberOfCycles() {
  let numberOfCycles = 3;
  const unlockingAt = new Date(new Date().getTime() + secondsUntilNextCycle);
  unlockingAt.setSeconds(
    unlockingAt.getSeconds() + cycleDuration * numberOfCycles
  );
}

export async function stackingEligibility() {
  // user supplied parameters
  let btcAddress = config.keyInfo.btcAddress;
  let numberOfCycles = 3;

  const stackingEligibility = await client.canStack({
    poxAddress: btcAddress,
    cycles: numberOfCycles,
  });

  console.log(stackingEligibility);
  return stackingEligibility;

  // this assumes user is stacking is entire balance
}

export async function getStatus() {
  const status = await client.getStatus();
  console.log(status);
  return status;
}

// isUserEligible();
// // numberOfCycles();
// stackingEligibility();
// getStatus();
