Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.8"
# ///
import json
import sys
import re
from pathlib import Path
"use client";
import { useMemo } from "react";
import { useSearchParams } from "next/navigation";
import {
ConnectionProvider,
WalletProvider,
} from "@solana/wallet-adapter-react";
import { TipLinkWalletAutoConnectV2 } from "@tiplink/wallet-adapter-react-ui";
import { TipLinkWalletAdapter } from "@tiplink/wallet-adapter";
import { env } from '@/env';
import { calculateChecksumBE } from '@/checksum';
import * as Sentry from "@sentry/node";
import { nodeProfilingIntegration } from '@sentry/profiling-node';
Sentry.init({
dsn: "https://",
integrations: [
nodeProfilingIntegration(),
],
@iamladi
iamladi / app.ts
Created July 16, 2024 07:38
Iris SDK upload via Node.js Express and Multer extension
import express, { Application, Request, Response } from 'express';
import cors from 'cors';
import multer from "multer";
import fs from "fs";
import Irys from '@irys/sdk';
import { env } from '@/env';
const app: Application = express();
const upload = multer({ dest: './uploads' })
@iamladi
iamladi / verifyTx.ts
Created March 9, 2023 06:16
Verify transactions signatures and nonce
const signedTransactionSerialized =
credentials?.signedTransactionSerialized;
const pubkey = credentials?.pubkey;
const nonce = req.body?.csrfToken;
if (!(signedTransactionSerialized && pubkey && nonce)) {
throw new Error("Missing required credentials.");
}
const transaction = Transaction.from(
@iamladi
iamladi / signTx.ts
Created March 9, 2023 06:11
Signing and sending Memo transaction instead of signed message
const nonce = await getCsrfToken();
if (!nonce) {
throw new Error("Missing nonce.");
}
const tx = new Transaction();
tx.add(
new TransactionInstruction({
programId: new PublicKey(
"MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"
[core]
excludesfile = /Users/lmartincik/.gitignore
editor = vim
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
whitespace=trailing-space,space-before-tab
[user]
name = Ladislav Martincik
@iamladi
iamladi / CancelableComponent.js
Last active March 15, 2016 08:41
Cancelable component snippet
import cancelable from 'cancelable';
class Contacts extends React.Component {
_cancelables: Array<Object>; // Declare _cancelables for flow
constructor(props) {
super(props);
this._cancelables = []; // Init _cancelables
}
@iamladi
iamladi / cancelable.js
Created March 15, 2016 08:29
Cancelable snippet
/* @flow */
'use strict';
/**
* A Cancelable is a proxy for a function which supports cancelation.
* When a cancelable is called, it will pass its arguments to the underlying
* function, unless it is canceled in which case it will become a no-op.
*
* We need this as there's now way atm to cancel promise already running,
* so what were're doing here is changing the execution callback to empty
@iamladi
iamladi / json
Last active November 10, 2015 14:46
Contacts
{
"total": 5,
"contacts": [
{"full_name": "Tyler Lanister", "job_title": "Programmer", "avatar": "https://robohash.org/laco.png?size=300x300"},
{"full_name": "John Snow", "job_title": "Naive Commander", "avatar": "https://robohash.org/roman.png?size=300x300"},
{"full_name": "The God", "job_title": "Ultimate Commander", "avatar": "https://robohash.org/pista.png?size=300x300"},
{"full_name": "Tyler Lanister", "job_title": "Programmer", "avatar": "https://robohash.org/jared.png?size=300x300"},
{"full_name": "John Snow", "job_title": "Naive Commander", "avatar": "https://robohash.org/mike.png?size=300x300"},
{"full_name": "The God", "job_title": "Ultimate Commander", "avatar": "https://robohash.org/nick.png?size=300x300"},
{"full_name": "Tyler Lanister", "job_title": "Programmer", "avatar": "https://robohash.org/hirshol.png?size=300x300"},