Skip to content

Commit

Permalink
fix: delete isRebalancingEnable for addOrDiscardWalletIfRequired
Browse files Browse the repository at this point in the history
  • Loading branch information
brianUtn98 committed Dec 14, 2023
1 parent 406410f commit a46536b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion src/chain-wallet-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ export class ChainWalletManager {

for (const balance of balances) {
this.walletPool.addOrDiscardWalletIfRequired(
isRebalancingEnabled,
balance.address,
balance,
minBalanceThreshold,
Expand Down
5 changes: 1 addition & 4 deletions src/wallets/wallet-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export interface WalletPool {
discardWalletFromPool(wallet: string): void;
addWalletBackToPoolIfRequired(wallet: string): void;
addOrDiscardWalletIfRequired(
isRebalancingEnabled: boolean,
address: string,
balance: WalletBalance,
minBalanceThreshold: number,
Expand Down Expand Up @@ -46,7 +45,6 @@ export class LocalWalletPool implements WalletPool {
}
}

// TODO: AddOrDiscard wallets when calling this method
private async acquire(resourceId?: string): Promise<string> {
const resource = resourceId
? this.resources[resourceId].resource
Expand All @@ -70,15 +68,14 @@ export class LocalWalletPool implements WalletPool {
* @returns true if there is enough balance on the wallet, false otherwise
*/
public addOrDiscardWalletIfRequired(
isRebalancingEnabled: boolean,
address: string,
balance: WalletBalance,
minBalanceThreshold: number,
): boolean {
const isEnoughWalletBalance =
Number(balance.formattedBalance) >= minBalanceThreshold;

if (isRebalancingEnabled && balance.isNative) {
if (balance.isNative) {
if (isEnoughWalletBalance) {
// set's the discarded flag on the wallet to false
this.addWalletBackToPoolIfRequired(address);
Expand Down

0 comments on commit a46536b

Please sign in to comment.