Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/web sdk/9 #401

Merged
merged 21 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add missing fields to pool info types
soerenbf committed Jan 13, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 46e01f9199de96c1d9b743202ec6f4e2e843e904
3 changes: 3 additions & 0 deletions packages/sdk/src/grpc/translation.ts
Original file line number Diff line number Diff line change
@@ -326,6 +326,8 @@ function transPaydayStatus(status: v2.PoolCurrentPaydayInfo): v1.CurrentPaydayBa
bakerEquityCapital: CcdAmount.fromProto(unwrap(status.bakerEquityCapital)),
delegatedCapital: CcdAmount.fromProto(unwrap(status.delegatedCapital)),
commissionRates: trCommissionRates(status.commissionRates),
isPrimedForSuspension: status.isPrimedForSuspension ?? false,
missedRounds: status.missedRounds ?? 0n,
};
}

@@ -594,6 +596,7 @@ export function bakerPoolInfo(info: v2.PoolInfoResponse): v1.BakerPoolStatus {
currentPaydayStatus:
info.currentPaydayInfo !== undefined ? transPaydayStatus(info.currentPaydayInfo) : undefined,
allPoolTotalCapital: CcdAmount.fromProto(unwrap(info.allPoolTotalCapital)),
isSuspended: info.isSuspended ?? false,
};
}

18 changes: 18 additions & 0 deletions packages/sdk/src/types.ts
Original file line number Diff line number Diff line change
@@ -891,15 +891,28 @@ export interface CommissionRates {
finalizationCommission: number;
}

/** Information about a baker pool in the current reward period. */
export interface CurrentPaydayBakerPoolStatus {
/** The number of blocks baked in the current reward period. */
blocksBaked: bigint;
/** The number of blocks baked in the current reward period. */
finalizationLive: boolean;
/** The transaction fees accruing to the pool in the current reward period. */
transactionFeesEarned: CcdAmount.Type;
/** The effective stake of the baker in the current reward period. */
effectiveStake: CcdAmount.Type;
/** The lottery power of the baker in the current reward period. */
lotteryPower: number;
/** The effective equity capital of the baker for the current reward period. */
bakerEquityCapital: CcdAmount.Type;
/** The effective delegated capital to the pool for the current reward period. */
delegatedCapital: CcdAmount.Type;
/** The commission rates that apply for the current reward period. */
commissionRates: CommissionRates;
/** A flag indicating whether the pool owner is primed for suspension. Will always be `false` if the protocol version does not support validator suspension. */
isPrimedForSuspension: boolean;
/** The number of missed rounds in the current reward period. Will always be `0n` if the protocol version does not support validator suspension. */
missedRounds:bigint;
}

export enum BakerPoolPendingChangeType {
@@ -979,6 +992,11 @@ export interface BakerPoolStatusDetails {
currentPaydayStatus?: CurrentPaydayBakerPoolStatus;
/** Total capital staked across all pools, including passive delegation. */
allPoolTotalCapital: CcdAmount.Type;
/**
* A flag indicating whether the pool owner is suspended.
* Will always be `false` if the protocol version does not support validator suspension.
*/
isSuspended: boolean;
}

/**