diff --git a/components/instructions/programs/stake.tsx b/components/instructions/programs/stake.tsx index 87618f40b9..e7f2944235 100644 --- a/components/instructions/programs/stake.tsx +++ b/components/instructions/programs/stake.tsx @@ -1,9 +1,44 @@ -import { Connection, LAMPORTS_PER_SOL } from '@solana/web3.js' +import { Connection, LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js' import { AccountMetaData } from '@solana/spl-governance' import * as BufferLayout from '@solana/buffer-layout' export const STAKE_INSTRUCTIONS = { Stake11111111111111111111111111111111111111: { + 0: { + name: 'Stake Program - Initialize', + accounts: [{ name: 'Stake Account' }], + getDataUI: async ( + _connection: Connection, + _data: Uint8Array, + _accounts: AccountMetaData[] + ) => { + const layout = BufferLayout.struct([ + BufferLayout.u32('type'), + BufferLayout.struct( + [ + BufferLayout.blob(32, 'staker'), + BufferLayout.blob(32, 'withdrawer'), + ], + 'authorized' + ), + ]) + + const decodedLayout = layout.decode(Buffer.from(_data)) + + return ( + <> +

+ Staker Authority:{' '} + {new PublicKey(decodedLayout.authorized.staker).toString()} +

+

+ Withdrawer Authority:{' '} + {new PublicKey(decodedLayout.authorized.withdrawer).toString()} +

+ + ) + }, + }, 3: { name: 'Stake Program - Split', accounts: [],