Skip to content

feat: add script for fetching TRX balance that can be consolidated #6517

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

Merged
merged 1 commit into from
Jul 25, 2025

Conversation

Vijay-Jagannathan
Copy link
Contributor

Ticket: COIN-00000

@Vijay-Jagannathan Vijay-Jagannathan force-pushed the add-trx-consolidation-amount-script branch from 5b6481b to 7d42b9b Compare July 24, 2025 10:08
@Vijay-Jagannathan Vijay-Jagannathan marked this pull request as ready for review July 24, 2025 10:18
@Vijay-Jagannathan Vijay-Jagannathan requested a review from a team as a code owner July 24, 2025 10:18
@@ -0,0 +1,51 @@
/**
* Copyright 2024, BitGo, Inc. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 2025

console.log('TRX balance: ', spendableBalanceString);

if (usdtBalance > 0 && spendableBalanceString > 36000000) {
const data = `${address}, USDT balance: ${usdtBalance}, TRX balance: ${spendableBalanceString}, V1: ${needsConsolidation}, V2: ${tokenConsolidationState['trx']}\n`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V2: ${tokenConsolidationState['trx']
why console v2 flag related to trx and not token, trying to understand the reason

Copy link
Contributor Author

@Vijay-Jagannathan Vijay-Jagannathan Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're only printing the flag states for TRX because we're finding the TRX balance that can be consolidated

if incase there's some TRX that can be consolidated but V2 flag is false, we need to reset, hence TRX

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, my only concern is that if client is having some other supported token, then this won't be able to fetch the correct addresses as more amount will be blocked

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, this was written for a specific case, but we can tweak this to work on any token; can do that as a followup

fs.appendFileSync('addresses-with-usdt-balance-and-trx-greater-than-36.txt', data);
}

if ((!usdtBalance || usdtBalance <= 0) && spendableBalanceString > 1000000) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what list of addresses are you trying to get here? Should we check addresses having no tokens and spendable greater than 1000000?

Copy link
Contributor Author

@Vijay-Jagannathan Vijay-Jagannathan Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for addresses which don't have USDT (this code is specific to a client usecase who had only USDT and TRX, hence we only have these 2 conditions, but can be adapted to other tokens or multiple tokens as well) but TRX

we want this because, we've already checked the addresses which have both USDT and TRX prior

@Vijay-Jagannathan Vijay-Jagannathan merged commit 07fe382 into master Jul 25, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants