Add deposit monitoring script for HighloadWalletV3#21
Conversation
This script monitors deposits for a specified contract address, polling for incoming transactions and handling deposits with a placeholder function.
There was a problem hiding this comment.
Pull request overview
This PR adds a template TypeScript monitoring script for tracking deposits to HighloadWalletV3 contracts. The script provides a skeleton implementation that computes contract addresses from configuration and sets up polling infrastructure, though the actual RPC interaction and transaction processing logic remains to be implemented.
Changes:
- Adds a new monitoring script template with configuration via environment variables
- Includes placeholder functions for deposit detection and transaction polling
- Sets up a 15-second polling interval with basic error handling
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| setInterval(() => { | ||
| pollOnce().catch(console.error); | ||
| }, 15_000); |
There was a problem hiding this comment.
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); |
| import { HighloadWalletV3Code } from '../wrappers/compiled'; | ||
| import { highloadWalletV3ConfigToCell } from '../wrappers/HighloadWalletV3'; | ||
|
|
||
| const RPC_URL = process.env.RPC_URL || 'https://net.ton.dev'; |
There was a problem hiding this comment.
'RPC_URL' is assigned a value but never used.
updatescripts/monitor -deposts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
updates to TON RPC endpoint Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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>
|
@LucasL160 I've opened a new pull request, #23, to work on those changes. Once the pull request is ready, I'll request review from you. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { HighloadWalletV3Code } from '../wrappers/compiled'; | ||
| import { beginCell } from '@ton/core'; | ||
|
|
||
|
|
There was a problem hiding this comment.
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.
|
|
||
| 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); |
There was a problem hiding this comment.
The SUBWALLET_ID default value 0x10ad (4269) appears to be an arbitrary constant. For better clarity in a template script, consider adding a comment explaining what this value represents and whether users should customize it, or use a more conventional default like 0.
| 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); |
| 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. | ||
| } | ||
|
|
There was a problem hiding this comment.
'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. | |
| } |
|
|
||
| console.log('Monitoring deposits for address:', address.toString({ urlSafe: true, bounceable: true })); | ||
|
|
||
| async function onDeposit(tx: any) { |
There was a problem hiding this comment.
Unexpected any. Specify a different type.
| async function onDeposit(tx: any) { | |
| async function onDeposit(tx: unknown) { |
|
Copilot open a new pull request to apply changes based on the comments in this thread |
This script monitors deposits for a specified contract address, polling for incoming transactions and handling deposits with a placeholder function.