Skip to content

Instantly share code, notes, and snippets.

View TheFredStar1's full-sized avatar

fredbuilds TheFredStar1

  • Proofpoint
  • Los Angeles, CA
View GitHub Profile
@TheFredStar1
TheFredStar1 / getKeypairFromFile.js
Last active February 21, 2022 20:12
Solana - Get keypair from config json
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);
};
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;