This file contains hidden or 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
#include <stdint.h> | |
/** | |
* A (better-coded) example of a 0-to-9 counter running on | |
* an Arduino & displaying the digits on a 7-segment LED display. | |
* | |
* Based on: https://create.arduino.cc/projecthub/akhtar/simple-0-9-counter-dcba41 | |
* | |
* Try it in a simulator: https://wokwi.com/projects/335025004843369044 | |
*/ |
This file contains hidden or 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
#ifndef DERDEC_H | |
#define DERDEC_H | |
// clang-format off | |
/**************************************************************************** | |
* | |
* MIT License | |
* | |
* Copyright (c) 2022 by pr3 (https://discord.com/users/552136433742381066 👀) |
This file contains hidden or 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
#include <bearssl.h> | |
#include <derdec.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <string.h> | |
/* (RSA-2048) | |
-----BEGIN PUBLIC KEY----- | |
MIIBITANBgkqhkiG9w0BAQEFAAOCAQ4AMIIBCQKCAQBez9MX9NzGasT/wlMKgLPL |
This file contains hidden or 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
# ===== Directory structure ===== | |
# build/ | |
# foo/ | |
# another.c.o | |
# main | |
# main.c.o | |
# other.c.o | |
# | |
# lib/ | |
# |
This file contains hidden or 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 * as raydium from "@raydium-io/raydium-sdk-v2"; | |
////////////////////////////////////////////////// | |
const RAYDIUM_CLMM_SOL_USDC_ID = "2QdhepnKRTLjjSqPL1PtKNwqrUkoLee5Gqs8bvZhRdMv"; | |
function normalizeRaydiumBetaPoolInfoResponse(response: raydium.ApiV3PoolInfoItem[] | raydium.ApiV3PageIns<raydium.ApiV3PoolInfoItem>): raydium.ApiV3PoolInfoItem[] { | |
if (response === null || typeof response !== "object") { | |
return []; | |
} |
This file contains hidden or 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 * as web3 from "@solana/web3.js"; | |
import bs58 from "bs58"; | |
////////////////////////////////////////////////// | |
function findInstructionsInTransaction( | |
tx: web3.ParsedTransactionWithMeta, | |
predicate?: (instruction: web3.ParsedInstruction | web3.PartiallyDecodedInstruction, outerInstruction: (web3.ParsedInstruction | web3.PartiallyDecodedInstruction) | null) => boolean, | |
): Array<web3.ParsedInstruction | web3.PartiallyDecodedInstruction> { | |
if (!tx || !tx.meta || !tx.transaction || !tx.transaction.message || !tx.transaction.message.instructions) { |
This file contains hidden or 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 * as web3 from "@solana/web3.js"; | |
////////////////////////////////////////////////// | |
function readBytes(buf: Buffer, offset: number, length: number): Buffer { | |
const end = offset + length; | |
if (buf.byteLength < end) throw new RangeError("range out of bounds"); | |
return buf.subarray(offset, end); | |
} |
This file contains hidden or 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
{ | |
"version": "0.1.0", | |
"name": "pump", | |
"instructions": [ | |
{ | |
"name": "initialize", | |
"docs": [ "Creates the global state." ], | |
"accounts": [ | |
{ "name": "global" , "isMut": true , "isSigner": false }, | |
{ "name": "user" , "isMut": true , "isSigner": true }, |
This file contains hidden or 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 * as web3 from "@solana/web3.js"; | |
import { | |
MPL_TOKEN_METADATA_PROGRAM_ID, | |
MetadataAccountData as MplMetadataAccountData, | |
getMetadataAccountDataSerializer, | |
} from "@metaplex-foundation/mpl-token-metadata"; | |
////////////////////////////////////////////////// | |
const METAPLEX_PROGRAM_ID = new web3.PublicKey(MPL_TOKEN_METADATA_PROGRAM_ID); |
This file contains hidden or 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 * as web3 from "@solana/web3.js"; | |
import { TOKEN_PROGRAM_ID, unpackMint, Mint } from "@solana/spl-token"; | |
////////////////////////////////////////////////// | |
async function getTokenInfo(conn: web3.Connection, tokenMint: web3.PublicKey): Promise<Mint | null> { | |
const info = await conn.getAccountInfo(tokenMint); | |
if (!info) return null; | |
try { |
OlderNewer