From 03f00f4cf1a8ed055066b822cbc059049e5f8ef5 Mon Sep 17 00:00:00 2001 From: LucasL160 Date: Sat, 24 Jan 2026 22:20:25 -0600 Subject: [PATCH 1/4] Add deposit monitoring script for HighloadWalletV3 This script monitors deposits for a specified contract address, polling for incoming transactions and handling deposits with a placeholder function. --- scripts/monitor-deposits.ts | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 scripts/monitor-deposits.ts diff --git a/scripts/monitor-deposits.ts b/scripts/monitor-deposits.ts new file mode 100644 index 0000000000..589504cdaa --- /dev/null +++ b/scripts/monitor-deposits.ts @@ -0,0 +1,50 @@ +/** + * Template deposit monitor for HighloadWalletV3 + * - Computes contract address from config + * - Polls the RPC (or subscribes) for transactions to that address + * - Detects incoming native TON transfers and calls a placeholder `onDeposit` handler + * + * Replace the placeholder code with your TonClient RPC calls and DB/business logic. + */ + +import 'dotenv/config'; +import { contractAddress } from '@ton/core'; +import { HighloadWalletV3Code } from '../wrappers/compiled'; +import { highloadWalletV3ConfigToCell } from '../wrappers/HighloadWalletV3'; + +const RPC_URL = process.env.RPC_URL || 'https://net.ton.dev'; +const WORKCHAIN = Number(process.env.WORKCHAIN || 0); +const SUBWALLET_ID = Number(process.env.SUBWALLET_ID || 0x10ad); +const TIMEOUT = Number(process.env.TIMEOUT || 3600); + +const publicKeyPlaceholder = Buffer.alloc(32, 0); +const data = highloadWalletV3ConfigToCell({ publicKey: publicKeyPlaceholder, subwalletId: SUBWALLET_ID, timeout: TIMEOUT }); +const init = { code: HighloadWalletV3Code, data }; +const address = contractAddress(WORKCHAIN, init); + +console.log('Monitoring deposits for address:', address.toString({ urlSafe: true, bounceable: true })); + +async function onDeposit(tx: any) { + // TODO: implement mapping from tx -> user (memo, query_id, off-chain mapping) + console.log('Deposit detected:', tx); + // Example: credit internal DB, notify user, etc. +} + +async function pollOnce() { + try { + // TODO: Replace with TonClient or provider calls to fetch transactions for `address` + // Example pseudocode: + // const { TonClient } = require('@ton/ton'); + // const client = new TonClient({ endpoint: RPC_URL }); + // const txs = await client.getTransactions(address); + // for (const tx of txs) { if (tx.incoming && tx.value > 0) await onDeposit(tx); } + + console.log('Polling (template) — implement RPC polling/subscription here.'); + } catch (e) { + console.error('Polling error:', e); + } +} + +setInterval(() => { + pollOnce().catch(console.error); +}, 15_000); From 89ae03d668c8d916149b6c600bf7311c673276f1 Mon Sep 17 00:00:00 2001 From: LucasL160 Date: Sat, 24 Jan 2026 22:30:12 -0600 Subject: [PATCH 2/4] Update scripts/monitor-deposits.ts updatescripts/monitor -deposts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- scripts/monitor-deposits.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/monitor-deposits.ts b/scripts/monitor-deposits.ts index 589504cdaa..5fcdcfd0d0 100644 --- a/scripts/monitor-deposits.ts +++ b/scripts/monitor-deposits.ts @@ -34,7 +34,7 @@ async function pollOnce() { try { // TODO: Replace with TonClient or provider calls to fetch transactions for `address` // Example pseudocode: - // const { TonClient } = require('@ton/ton'); + // import { TonClient } from '@ton/ton'; // const client = new TonClient({ endpoint: RPC_URL }); // const txs = await client.getTransactions(address); // for (const tx of txs) { if (tx.incoming && tx.value > 0) await onDeposit(tx); } From d4a7f1b67761c03381dfad411ceb780edd33d7f5 Mon Sep 17 00:00:00 2001 From: LucasL160 Date: Sat, 24 Jan 2026 22:30:49 -0600 Subject: [PATCH 3/4] Update scripts/monitor-deposits.ts updates to TON RPC endpoint Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- scripts/monitor-deposits.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/monitor-deposits.ts b/scripts/monitor-deposits.ts index 5fcdcfd0d0..0ea72f3838 100644 --- a/scripts/monitor-deposits.ts +++ b/scripts/monitor-deposits.ts @@ -12,7 +12,8 @@ import { contractAddress } from '@ton/core'; import { HighloadWalletV3Code } from '../wrappers/compiled'; import { highloadWalletV3ConfigToCell } from '../wrappers/HighloadWalletV3'; -const RPC_URL = process.env.RPC_URL || 'https://net.ton.dev'; +// Default to a well-known public TON RPC endpoint; override via the RPC_URL environment variable. +const RPC_URL = process.env.RPC_URL || 'https://toncenter.com/api/v2/jsonRPC'; const WORKCHAIN = Number(process.env.WORKCHAIN || 0); const SUBWALLET_ID = Number(process.env.SUBWALLET_ID || 0x10ad); const TIMEOUT = Number(process.env.TIMEOUT || 3600); From ea10d1347475a7b7f3ede3f7d6996aa9620faf21 Mon Sep 17 00:00:00 2001 From: LucasL160 Date: Sat, 24 Jan 2026 22:32:08 -0600 Subject: [PATCH 4/4] Update scripts/monitor-deposits.ts i added wrong info to wrong repo, this change is to fix scripts to correct repo structure Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- scripts/monitor-deposits.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/monitor-deposits.ts b/scripts/monitor-deposits.ts index 0ea72f3838..9ee4ecb17c 100644 --- a/scripts/monitor-deposits.ts +++ b/scripts/monitor-deposits.ts @@ -10,17 +10,17 @@ import 'dotenv/config'; import { contractAddress } from '@ton/core'; import { HighloadWalletV3Code } from '../wrappers/compiled'; -import { highloadWalletV3ConfigToCell } from '../wrappers/HighloadWalletV3'; +import { beginCell } from '@ton/core'; -// Default to a well-known public TON RPC endpoint; override via the RPC_URL environment variable. -const RPC_URL = process.env.RPC_URL || 'https://toncenter.com/api/v2/jsonRPC'; + +const RPC_URL = process.env.RPC_URL || 'https://net.ton.dev'; const WORKCHAIN = Number(process.env.WORKCHAIN || 0); const SUBWALLET_ID = Number(process.env.SUBWALLET_ID || 0x10ad); const TIMEOUT = Number(process.env.TIMEOUT || 3600); -const publicKeyPlaceholder = Buffer.alloc(32, 0); -const data = highloadWalletV3ConfigToCell({ publicKey: publicKeyPlaceholder, subwalletId: SUBWALLET_ID, timeout: TIMEOUT }); -const init = { code: HighloadWalletV3Code, data }; +const code = beginCell().endCell(); +const data = beginCell().endCell(); +const init = { code, data }; const address = contractAddress(WORKCHAIN, init); console.log('Monitoring deposits for address:', address.toString({ urlSafe: true, bounceable: true }));