-
Notifications
You must be signed in to change notification settings - Fork 0
Add deposit monitoring script for HighloadWalletV3 #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||||||||
| /** | ||||||||||||
| * 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 { beginCell } from '@ton/core'; | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| 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 SUBWALLET_ID = Number(process.env.SUBWALLET_ID || 0x10ad); | |
| // Default subwallet id for this template; override via SUBWALLET_ID env var for your deployment. | |
| const SUBWALLET_ID = Number(process.env.SUBWALLET_ID || 0); |
This conversation was marked as resolved.
Show resolved
Hide resolved
This conversation was marked as resolved.
Show resolved
Hide resolved
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected any. Specify a different type.
| async function onDeposit(tx: any) { | |
| async function onDeposit(tx: unknown) { |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'onDeposit' is defined but never used.
| 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. | |
| } |
This conversation was marked as resolved.
Show resolved
Hide resolved
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The polling starts only after the first 15-second interval. Consider calling pollOnce() immediately after the setInterval to begin monitoring right away when the script starts, rather than waiting for the first interval to elapse.
| }, 15_000); | |
| }, 15_000); | |
| // Perform an initial poll immediately so monitoring starts without waiting for the first interval. | |
| pollOnce().catch(console.error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RPC_URL default 'https://net.ton.dev' may not be a valid or current TON RPC endpoint. This should be verified and updated to a known, working endpoint (such as from the TON documentation), or the script should require this environment variable to be set explicitly to avoid confusion.