Skip to content

Commit

Permalink
GO
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Oct 9, 2024
1 parent 22a3f7f commit e38039b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions governance/pyth_staking_sdk/src/pyth-staking-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import {
type TargetAccount,
type VoterWeightAction,
type VestingSchedule,
Position,
} from "./types";
import { convertBigIntToBN, convertBNToBigInt } from "./utils/bn";
import { epochToDate, getCurrentEpoch } from "./utils/clock";
Expand Down Expand Up @@ -687,7 +686,7 @@ export class PythStakingClient {
targetWithParameters.integrityPool?.publisher.equals(publisher.pubkey),
)

const lowestEpoch = positionsWithPublisher.reduce((min, position) => (min === undefined || position.activationEpoch < min) ? position.activationEpoch : min, <bigint| undefined>undefined);
const lowestEpoch = positionsWithPublisher.reduce<bigint| undefined>((min, position) => (min === undefined || position.activationEpoch < min) ? position.activationEpoch : min, undefined);
return {
...publisher,
lowestEpoch
Expand All @@ -713,10 +712,10 @@ export class PythStakingClient {
return a > b ? a : b;
}

const lowestEpoch = publishers.reduce((min, publisher, index) => {
const lowestEpoch = publishers.reduce<bigint| undefined>((min, publisher, index) => {
const maximum = max(publisher.lowestEpoch, delegationRecords[index]?.lastEpoch);
return (min === undefined || (maximum !== undefined && maximum < min)) ? publisher.lowestEpoch : min, <bigint| undefined>undefined
}, <bigint| undefined>undefined);
return (min === undefined || (maximum !== undefined && maximum < min)) ? publisher.lowestEpoch : min, undefined as bigint| undefined
}, undefined);

const currentEpoch = await getCurrentEpoch(this.connection);

Expand Down

0 comments on commit e38039b

Please sign in to comment.