feat(web3.js): support withdraw from Vote account (#22932)

This commit is contained in:
mooori
2022-02-04 21:37:28 +01:00
committed by GitHub
parent 96c88d1a5e
commit 4d877567dd
4 changed files with 472 additions and 0 deletions

View File

@@ -79,6 +79,21 @@ export const lockup = (property: string = 'lockup') => {
);
};
/**
* Layout for a VoteInit object
*/
export const voteInit = (property: string = 'voteInit') => {
return BufferLayout.struct(
[
publicKey('nodePubkey'),
publicKey('authorizedVoter'),
publicKey('authorizedWithdrawer'),
BufferLayout.u8('commission'),
],
property,
);
};
export function getAlloc(type: any, fields: any): number {
let alloc = 0;
type.layout.fields.forEach((item: any) => {