import type { BN, IdlAccounts, IdlTypes } from "@coral-xyz/anchor"; import { PublicKey } from "@solana/web3.js"; import type { IntegrityPool } from "../types/integrity-pool"; import type { Staking } from "../types/staking"; // This type converts all From types to To types in a given object. export type Convert = T extends From ? To : T extends (infer U)[] ? Convert[] : T extends Record ? { [K in keyof T]: Convert; } : T; export type ConvertBNToBigInt = Convert; export type ConvertBigIntToBN = Convert; export type PositionAnchor = IdlTypes["position"]; export type Position = ConvertBNToBigInt; export type GlobalConfigAnchor = IdlAccounts["globalConfig"]; export type GlobalConfig = ConvertBNToBigInt; export type PoolConfigAnchor = IdlAccounts["poolConfig"]; export type PoolConfig = ConvertBNToBigInt; export type PoolDataAccountAnchor = IdlAccounts["poolData"]; export type PoolDataAccount = ConvertBNToBigInt; export type TargetWithParameters = IdlTypes["targetWithParameters"]; export type VestingScheduleAnchor = IdlTypes["vestingSchedule"]; export type VestingSchedule = ConvertBNToBigInt; export type TargetAccountAnchor = IdlAccounts["targetMetadata"]; export type TargetAccount = ConvertBNToBigInt; export type VoterWeightAction = IdlTypes["voterWeightAction"]; export type UnlockSchedule = { type: "fullyUnlocked" | "periodicUnlockingAfterListing" | "periodicUnlocking"; schedule: { date: Date; amount: bigint; }[]; }; export type StakeAccountPositions = { address: PublicKey; data: { owner: PublicKey; positions: Position[]; }; }; export type PublisherData = { pubkey: PublicKey; stakeAccount: PublicKey | null; totalDelegation: bigint; totalDelegationDelta: bigint; selfDelegation: bigint; selfDelegationDelta: bigint; delegationFee: bigint; apyHistory: { epoch: bigint; apy: number; selfApy: number }[]; }[]; export enum PositionState { UNLOCKED, LOCKING, LOCKED, PREUNLOCKING, UNLOCKING, }