Skip to content

Commit 7ffea49

Browse files
chore: update getCurrentValidator & getPendingValidator response type
1 parent fb31092 commit 7ffea49

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

examples/c-chain/export.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ import { evmapi } from '../chain_apis';
77
import { getEnvVars } from '../utils/getEnvVars';
88

99
const main = async () => {
10-
const { AVAX_PUBLIC_URL, C_CHAIN_ADDRESS, PRIVATE_KEY, X_CHAIN_ADDRESS } =
10+
const { AVAX_PUBLIC_URL, C_CHAIN_ADDRESS, PRIVATE_KEY, P_CHAIN_ADDRESS } =
1111
getEnvVars();
1212

1313
const provider = new JsonRpcProvider(AVAX_PUBLIC_URL + '/ext/bc/C/rpc');
1414

1515
const context = await getContextFromURI(AVAX_PUBLIC_URL);
1616
const txCount = await provider.getTransactionCount(C_CHAIN_ADDRESS);
1717
const baseFee = await evmapi.getBaseFee();
18-
const xAddressBytes = bech32ToBytes(X_CHAIN_ADDRESS);
18+
const pAddressBytes = bech32ToBytes(P_CHAIN_ADDRESS);
1919

2020
const tx = newExportTxFromBaseFee(
2121
context,
2222
baseFee / BigInt(1e9),
2323
BigInt(0.1 * 1e9),
24-
context.xBlockchainID,
24+
context.pBlockchainID,
2525
hexToBuffer(C_CHAIN_ADDRESS),
26-
[xAddressBytes],
26+
[pAddressBytes],
2727
BigInt(txCount),
2828
);
2929

src/vms/pvm/models.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type GetAssetDescriptionResponse = {
1010
denomination: number;
1111
};
1212

13+
// https://docs.avax.network/api-reference/p-chain/api#platformgetcurrentvalidators
1314
export type GetCurrentValidatorsResponse = {
1415
validators: {
1516
accruedDelegateeReward: string;
@@ -24,6 +25,15 @@ export type GetCurrentValidatorsResponse = {
2425
threshold: string;
2526
addresses: string[];
2627
};
28+
delegationRewardOwner: {
29+
locktime: string;
30+
threshold: string;
31+
addresses: string[];
32+
};
33+
signer: {
34+
publicKey: string;
35+
proofOfPosession: string;
36+
};
2737
delegatorCount: string;
2838
delegatorWeight: string;
2939
potentialReward: string;
@@ -36,7 +46,7 @@ export type GetCurrentValidatorsResponse = {
3646
endTime: string;
3747
stakeAmount: string;
3848
nodeID: string;
39-
delegationRewardOwner: {
49+
rewardOwner: {
4050
locktime: string;
4151
threshold: string;
4252
addresses: string[];
@@ -51,6 +61,7 @@ export type GetPendingValidatorsParams = {
5161
nodeIDs?: string[];
5262
};
5363

64+
// https://docs.avax.network/api-reference/p-chain/api#platformgetpendingvalidators
5465
export type GetPendingValidatorsResponse = {
5566
validators: {
5667
txID: string;
@@ -61,6 +72,10 @@ export type GetPendingValidatorsResponse = {
6172
delegationFee: string;
6273
connected: boolean;
6374
weight: string;
75+
signer: {
76+
publicKey: string;
77+
proofOfPosession: string;
78+
};
6479
}[];
6580
delegators: {
6681
txID: string;
@@ -319,7 +334,6 @@ export interface GetL1ValidatorResponse {
319334
deactivationOwner: {
320335
addresses: string[];
321336
locktime: string;
322-
threshold: string;
323337
};
324338
startTime: string;
325339
weight: string;

0 commit comments

Comments
 (0)