From 19f4cf10bb7ae3d37747e7a23f2a18531a5e78ff Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Thu, 26 Sep 2019 16:00:32 -0600 Subject: [PATCH] fix: update VoteAccount format --- web3.js/src/vote-account.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/web3.js/src/vote-account.js b/web3.js/src/vote-account.js index 6a011cfd5f..fbedb511e9 100644 --- a/web3.js/src/vote-account.js +++ b/web3.js/src/vote-account.js @@ -28,6 +28,10 @@ export type EpochCredits = {| * @private */ const VoteAccountLayout = BufferLayout.struct([ + Layout.publicKey('nodePubkey'), + Layout.publicKey('authorizedVoterPubkey'), + Layout.publicKey('authorizedWithdrawerPubkey'), + BufferLayout.u8('commission'), BufferLayout.nu64(), // votes.length BufferLayout.seq( BufferLayout.struct([ @@ -37,9 +41,6 @@ const VoteAccountLayout = BufferLayout.struct([ BufferLayout.offset(BufferLayout.u32(), -8), 'votes', ), - Layout.publicKey('nodePubkey'), - Layout.publicKey('authorizedVoterPubkey'), - BufferLayout.u8('commission'), BufferLayout.u8('rootSlotValid'), BufferLayout.nu64('rootSlot'), BufferLayout.nu64('epoch'), @@ -61,10 +62,11 @@ const VoteAccountLayout = BufferLayout.struct([ * VoteAccount class */ export class VoteAccount { - votes: Array; nodePubkey: PublicKey; authorizedVoterPubkey: PublicKey; + authorizedWithdrawerPubkey: PublicKey; commission: number; + votes: Array; rootSlot: number | null; epoch: number; credits: number; @@ -81,6 +83,9 @@ export class VoteAccount { const va = VoteAccountLayout.decode(buffer, 0); va.nodePubkey = new PublicKey(va.nodePubkey); va.authorizedVoterPubkey = new PublicKey(va.authorizedVoterPubkey); + va.authorizedWithdrawerPubkey = new PublicKey( + va.authorizedWithdrawerPubkey, + ); if (!va.rootSlotValid) { va.rootSlot = null; }