Skip to content

Instantly share code, notes, and snippets.

View belivenn's full-sized avatar

Johnny belivenn

View GitHub Profile
describe("anchor-vault-q3", () => {
// Helper function to log a message
const log = async (signature: string): Promise<string> => {
console.log(
`Your transaction signature: https://explorer.solana.com/transaction/${signature}?cluster=custom&customUrl=${connection.rpcEndpoint}\n`
);
return signature;
};
use mpl_token_metadata::{instruction::create_metadata_accounts_v3, state::Creator as creator_struct};
pub fn create_metadata(&mut self, name: String, symbol: String, uri: String) -> Result<()> {
let seeds = &[
&b"creator"[..],
&self.creator.tweet_id.to_le_bytes()[..],
&[self.creator.state_bump],
];
let program_id = self.metadata_program.key();
import { Transaction, SystemProgram, Connection, Keypair, LAMPORTS_PER_SOL, sendAndConfirmTransaction, PublicKey, ComputeBudgetProgram } from "@solana/web3.js"
import wallet from "./ji76hHmEkFAUR7oHjrascx9USXp713WijtniVC5Bs6S.json"
import bs58 from 'bs58'
// Import our dev wallet keypair from the wallet file
const from = Keypair.fromSecretKey(new Uint8Array(wallet));
// Define our WBA public key
const to = new PublicKey("HZwspWyrNGik1AcgGBqN7VaCqs4ZHob8pkYUsgCFZ5FV");
@belivenn
belivenn / berkay.rs
Last active April 8, 2024 22:02
Solana Stack Exchange Answer
use anchor_lang::prelude::*;
use anchor_spl::{
token_interface::{TokenAccount, Mint, TokenInterface, TransferChecked, transfer_checked},
associated_token::AssociatedToken}
};
declare_id!("exampleid00121312312312312312312");
#[program]
pub mod SolanStackExchange {
use super::*;
@belivenn
belivenn / dao_functionality_guide.txt
Last active December 19, 2023 00:31
description
1- Initial Configuration
1.1- Create Config Accounts
- 1.1.a) Proposal Program
- 1.1.b) Voting Program
- 1.1.c) Staking Program
- 1.1.d) Issue Program
- Initiate configuration accounts for each of these programs; Functions location: available in the IDL.
1.2 - DAO Config Initialization
Configure the DAO after setting up the mentioned programs.