Skip to content

Instantly share code, notes, and snippets.

View codebender828's full-sized avatar
⚡️
Writing history

Jonathan Bakebwa codebender828

⚡️
Writing history
View GitHub Profile
@codebender828
codebender828 / signTransaction.ts
Last active May 30, 2022 10:09
Sign Solana transaction from back end and send to chain
import { Transaction, Connection, clusterApiUrl } from "@solana/web3.js";
const connection = new Connection(clusterApiUrl("devnet"));
// Get the wallet object from your wallet provider
const wallet = useWallet()
export async function signTransaction(transaction) {
// 1. Get transaction form back end and construct buffer form it.
const serializedTransaction = Buffer.from(transaction, "base64");
@codebender828
codebender828 / vue-jsx.tsx
Last active September 20, 2022 18:38
Panda TSX Vue
import { DOMElements } from "@chakra-ui/vue-system"
import { computed, defineComponent } from "vue"
function cx(...args: any[]) {
return args.filter(Boolean).join(" ")
}
function splitProps(props: any) {
const styleProps = {}
const elementProps = {}
@codebender828
codebender828 / execute_airdrop.ts
Last active April 24, 2024 16:55
Airdrop Script
async function executeAirdropTransaction() {
const connectionManager = await createConnection("mainnet-beta");
// Generate Transactions
// const instructions: TransactionInstruction[] = [];
// const transactions: Transaction[] = [];
const airdropTransactionEntries = Object.values(airdropTransactionsLogs);
const lastSuccessfulIndex = airdropTransactionEntries.findLastIndex(
(value) => !value.signature
@codebender828
codebender828 / 3.1.interoperability-interface.ts
Created September 3, 2024 02:41
Binance DD Code Snippets
// Creates Instruction layout for syncing state
function createInstructionData(index: number) {
const dataLayout = BufferLayout.struct([BufferLayout.u32('instruction')]);
const data = Buffer.alloc(dataLayout.span);
dataLayout.encode({ instruction: index }, data);
return data;
}
// Creates synchronize state instruction
function createSynchronizeProgramInstruction(source: PublicKey, target: PublicKey) {
@codebender828
codebender828 / createSetUpgradeAuthorityInstruction.ts
Created January 28, 2025 13:46
Programmatically Change the Upgrade Authority of a Solana Program
export async function createSetUpgradeAuthority(
programId: PublicKey,
upgradeAuthority: PublicKey,
newUpgradeAuthority: PublicKey
) {
const bpfUpgradableLoaderId = new PublicKey(
"BPFLoaderUpgradeab1e11111111111111111111111"
);
const [programDataAddress] = await PublicKey.findProgramAddress(
@codebender828
codebender828 / deserialize_base64_transaction.ts
Created May 23, 2025 15:05
Deserialize Base 64 Transaction
import { Transaction } from '@solana/web3.js';
const transactionBuffer = Buffer.from(<BASE_64_TRANSACTION_PAYLOAD>, 'base64');
const transaction = Transaction.from(transactionBuffer);
// proceed with transaction signing and sending
@codebender828
codebender828 / output.log
Last active August 6, 2025 13:25
Donut Wallet Service Access Token Verification
bun run verify-access-token.ts
// ============================
Token is valid: {
aid: "cmberb48q023yjo0leuwu63tw",
att: "pat",
sid: "cmd4ibkcy000ljz0my8vpmm2d",
iss: "privy.io",
iat: 1753864509,