Skip to content

Instantly share code, notes, and snippets.

View mrruby's full-sized avatar

mrruby mrruby

View GitHub Profile
interface BiometricFlow extends Action {
type: 'BIOMETRIC_FLOW';
payload: BiometricTransitions;
}
function* refreshToken() {
try {
const getRefreshToken = (state: ApplicationState) =>
state.signedIn.refreshToken;
const refreshTokenValue = yield select(getRefreshToken);
import { GatsbyFunctionRequest, GatsbyFunctionResponse } from "gatsby"
import { OpenAIEmbeddings, ChatOpenAI } from "@langchain/openai"
import { RecursiveCharacterTextSplitter } from "@langchain/textsplitters"
import { MemoryVectorStore } from "langchain/vectorstores/memory"
import {
RunnableSequence,
RunnablePassthrough,
} from "@langchain/core/runnables"
import { PromptTemplate } from "@langchain/core/prompts"
import { StringOutputParser } from "@langchain/core/output_parsers"
import { TonClient, toNano, WalletContractV4, Cell } from "@ton/ton";
import { mnemonicToPrivateKey } from "@ton/crypto";
import { DEX } from "@ston-fi/sdk"; // import the pieces you actually use
import * as dotenv from "dotenv";
async function main() {
dotenv.config();
const apiKey = process.env.TONCENTER_API_KEY;
const mnemonicsString = process.env.MNEMONIC;
{
"url": "https://ton.vote",
"name": "TON Vote",
"iconUrl": "https://ton.vote/logo.png"
}

Below is a minimal end‑to‑end example that shows how you can: 1. Query STON.fi REST endpoints to discover assets. 2. Simulate a swap to get the expected output amount and the router address. 3. Prepare a transaction that your TON wallet (or a head‑less TON client) can sign and broadcast.

Because STON.fi does not yet publish an official Python SDK, everything is done with plain requests and well‑known TON helper libraries.

1  Prerequisites

@mrruby
mrruby / GEMINI.md
Last active September 24, 2025 13:12

Note for the agent: When following this guide, implement the entire application as described but DO NOT run the dev server (pnpm dev). After completing the implementation, end the task and inform the user to test the application by running pnpm dev themselves.

Omniston Quickstart Guide

This guide will walk you through creating a basic token swap app using the Omniston protocol to swap assets across different DEXes (STON.fi V1, STON.fi V2, DeDust, etc.). We'll integrate wallet connectivity with TonConnect (via @tonconnect/ui-react) to allow users to connect their TON wallet and perform a swap. The guide is beginner-friendly and assumes minimal React experience.

Note: In this demo, we will leverage Tailwind CSS for styling instead of using custom CSS. The setup for Tailwind CSS is already included in the instructions below, so you don't need to set it up separately.

Note: You can use any package manager (npm, yarn, pnpm, or bun) to set up your React project. In this tut

interface SwapTransaction {
hash: string;
utime: number;
in_msg?: {
value: string;
decoded_body?: {
left_amount?: string;
right_amount?: string;
from_user?: string;
dex_payload?: {

Getting started with Privy and TON (Vite + React)

This guide demonstrates how to integrate Privy with the TON blockchain in a Vite + React app to enable wallet login as well as message and transaction signing.

Resources

Learn how to use Privy embedded wallets with TON for signing messages and transactions.
@mrruby
mrruby / swap-with-omniston.md
Last active August 29, 2025 16:31
Swapping crypto using Privy and Omniston

Swapping crypto using Privy and Omniston

This guide extends the Getting started with Privy and TON application by adding token swap functionality using Omniston - a protocol that aggregates liquidity from multiple DEXes including STON.fi and DeDust.

Prerequisites

Before starting this guide, ensure you have:

  • Completed the Getting started with Privy and TON guide
  • A working React app with Privy authentication for TON
  • A deployed and funded TON wallet (minimum 0.05 TON for gas fees)