Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions guidebook/jetton-processing/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Toncoin Payment Processing Configuration

# Network Configuration
# Set to "false" for mainnet, leave as "true" or omit for testnet
IS_TESTNET=true

# TonCenter API Key
# Get your API key at https://toncenter.com (mainnet) or https://testnet.toncenter.com (testnet)
# Or run your own API: https://github.com/toncenter/ton-http-api
API_KEY=your_api_key_here

# Wallet Address
# Your wallet address that will receive deposits (for single-wallet examples)
# Or your HOT wallet address (for multi-wallet examples)
WALLET_ADDRESS=UQB22lH8P_P2OitCe8UYRxpuDF5GVqCfYTL7PDz3OzbuHebu
23 changes: 23 additions & 0 deletions guidebook/jetton-processing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
node_modules
temp
build
dist
.DS_Store
package.ts

# VS Code
.vscode/*
.history/
*.vsix

# IDEA files
.idea

# VIM
Session.vim
.vim/

# Other private editor folders
.nvim/
.emacs/
.helix/
1 change: 1 addition & 0 deletions guidebook/jetton-processing/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions guidebook/jetton-processing/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 120,
"tabWidth": 4,
"singleQuote": true,
"bracketSpacing": true,
"semi": true
}
62 changes: 62 additions & 0 deletions guidebook/jetton-processing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Jetton Payment Processing Examples

Educational TypeScript examples demonstrating jetton (token) payment processing on the TON blockchain.

## Libraries Used

- [@ton/ton](https://github.com/ton-org/ton) - High-level TON blockchain API client
- [@ton/core](https://github.com/ton-org/ton-core) - Core primitives for TON blockchain
- [@ton/crypto](https://github.com/ton-org/ton-crypto) - Cryptographic primitives for TON

## Examples

### 1. Single Wallet with Invoices (`src/deposits/jetton-invoices.ts`)

Demonstrates accepting jetton deposits to a single wallet using unique text comments (UUIDs) to identify each payment.

**Use case**: Payment processing where each jetton payment is tracked by a unique identifier in the transfer notification comment.

### 2. Multi-Wallet Jetton Deposits (`src/deposits/jetton-unique-addresses.ts`)

Demonstrates accepting jetton deposits where each user has their own unique deposit wallet with associated jetton wallets.

**Use case**: Exchange or service where users need permanent deposit addresses for multiple jetton types.

## Setup

1. Install dependencies:
```bash
npm install
```

2. Configure your environment:
- Copy `.env.example` to `.env`
- Set your API key and wallet address
- Configure supported jetton minters
- Choose mainnet or testnet

3. Run an example:
```bash
# Single wallet invoices example
npm start

# Multi-wallet example
npm run start:unique
```

## Development Scripts

- `npm start` - Run the single-wallet invoices example
- `npm run start:unique` - Run the multi-wallet jetton deposits example
- `npm run build` - Type-check the project (does not produce executable output)
- `npm run format` - Format code with Prettier

## ⚠️ Educational Use Only

These examples are for learning purposes. Do not deploy to production without:
- Thorough security review
- Proper error handling
- Database persistence
- Monitoring and alerting
- Rate limiting and retry strategies
- Proper jetton wallet validation
Loading
Loading