This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Keypair } from '@solana/web3.js'; | |
import fs from 'fs/promises'; | |
export const getKeypairFromFile: Promise<Keypair> = async (path) => { | |
const keypairString = await fs.readFile(path, {encoding: 'utf-8'}); | |
const keyPairBuffer = Buffer.from(JSON.parse(keypairString)); | |
return Keypair.fromSecretKey(keyPairBuffer); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use anchor_lang::prelude::*; | |
declare_id!("GofNwzpGJNLTk5m2ME9iYbdT2X9ofuzrDPmio8Kg6oG1"); | |
#[program] | |
pub mod crunchy_vs_smooth { | |
use super::*; | |
pub fn initialize(ctx: Context<Initialize>, vote_account_bump: u8) -> ProgramResult { | |
ctx.accounts.voteting_state.bump = vote_account_bump; |