Skip to content

Instantly share code, notes, and snippets.

View crypt0miester's full-sized avatar

Cryptomiester crypt0miester

View GitHub Profile
/**
* @module all-domain-service
* utility functions for managing svm domain names
*/
import {
ANS_PROGRAM_ID,
TLD_HOUSE_PROGRAM_ID,
getHashedName,
NameRecordHeader,
import { Keypair, PublicKey } from '@solana/web3.js';
import * as argon2 from 'argon2';
import crypto from 'crypto';
import { sign } from 'tweetnacl';
interface KeygenParams {
passCode: string;
appName: string;
userId?: string; // Optional unique identifier
export type RetryConfig = {
maxAttempts?: number;
initialDelay?: number;
maxDelay?: number;
backoffFactor?: number;
onRetry?: (error: Error, attempt: number) => void;
};
export async function retryOnFailure<T>(
operation: () => Promise<T>,
import { AccountInfo, Connection, PublicKey } from "@solana/web3.js";
import { deserialize, Schema } from "borsh";
/**
* Holds the data for the {@link NameRecordHeader} Account and provides de/serialization
* functionality for that data
*/
export class NameRecordHeaderRaw {
// only for normal domains, tld name record might not be working.
static async create(
import {
Commitment,
Connection,
Context,
RpcResponseAndContext,
SignatureResult,
SignatureStatus,
TransactionSignature,
} from "@solana/web3.js";
import {
ANS_PROGRAM_ID,
findNameHouse,
findNftRecord,
getHashedName,
getNameAccountKeyWithBump,
getParentAccountFromTldHouseAccountInfo,
getTldFromTldHouseAccountInfo,
NameRecordHeader,
NftRecord,
@crypt0miester
crypt0miester / getAllDomainOwner.ts
Created October 14, 2024 06:59
set of functions that allows you to integrate domain names and have them show up where wallet ady is normally displayed
import { MainDomain, NameAccountAndDomain, TldParser } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";
/**
* Validates and resolves an Eclipse address or domain to a PublicKey.
* Mostly used in searches.
* Ideally the value is debounced on typing
*
* This function can handle two types of input:
* 1. An Eclipse domain (e.g., "miester.turbo")
@crypt0miester
crypt0miester / dynamicComputes.ts
Last active November 11, 2024 08:09
Dynamic Compute Units and priority fees calculation.
import {
AddressLookupTableAccount,
Blockhash,
ComputeBudgetProgram,
Connection,
Keypair,
PublicKey,
Transaction,
TransactionError,
TransactionInstruction,
@crypt0miester
crypt0miester / confirmTransaction.ts
Last active November 11, 2024 08:13
confirms the transaction via websocket race vs getBlockheight.
import {
Commitment,
Connection,
Context,
RpcResponseAndContext,
SignatureResult,
SignatureStatus,
TransactionSignature,
} from "@solana/web3.js";
@crypt0miester
crypt0miester / sol_devnet_airdroper.sh
Created January 25, 2023 13:26
solana devnet airdropper. airdrops 199.991 sols to the receiver address.
#!/bin/bash
# Airdrop amount
amount=2
# Number of addresses to generate
num_addresses=10
# Address to transfer all tokens to
receiver_address="CHANGE ME"