feat: add stake program methods; refactor instruction type handling
This commit is contained in:
committed by
Michael Vines
parent
fc77e55920
commit
532b28e96e
@ -54,6 +54,26 @@ export const rustString = (property: string = 'string') => {
|
||||
return rsl;
|
||||
};
|
||||
|
||||
/**
|
||||
* Layout for an Authorized object
|
||||
*/
|
||||
export const authorized = (property: string = 'authorized') => {
|
||||
return BufferLayout.struct(
|
||||
[publicKey('staker'), publicKey('withdrawer')],
|
||||
property,
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Layout for a Lockup object
|
||||
*/
|
||||
export const lockup = (property: string = 'lockup') => {
|
||||
return BufferLayout.struct(
|
||||
[BufferLayout.ns64('epoch'), publicKey('custodian')],
|
||||
property,
|
||||
);
|
||||
};
|
||||
|
||||
export function getAlloc(type: Object, fields: Object): number {
|
||||
let alloc = 0;
|
||||
type.layout.fields.forEach(item => {
|
||||
|
Reference in New Issue
Block a user