Remove unnecessary getTokenMetaForDenom
This commit is contained in:
parent
a224a09904
commit
6bb5dcc221
@ -29,11 +29,9 @@ export class TokenManager {
|
||||
const amountFromEnv = process.env[`FAUCET_CREDIT_AMOUNT_${denom.toUpperCase()}`];
|
||||
const amount = amountFromEnv ? Uint53.fromString(amountFromEnv).toNumber() : defaultCreditAmount;
|
||||
const value = new Uint53(amount * factor.toNumber());
|
||||
|
||||
const meta = this.getTokenMetaForDenom(denom);
|
||||
return {
|
||||
amount: value.toString(),
|
||||
denom: meta.denom,
|
||||
denom: denom,
|
||||
};
|
||||
}
|
||||
|
||||
@ -51,9 +49,7 @@ export class TokenManager {
|
||||
|
||||
/** true iff the distributor account needs a refill */
|
||||
public needsRefill(account: MinimalAccount, denom: string): boolean {
|
||||
const meta = this.getTokenMetaForDenom(denom);
|
||||
|
||||
const balanceAmount = account.balance.find((b) => b.denom === meta.denom);
|
||||
const balanceAmount = account.balance.find((b) => b.denom === denom);
|
||||
|
||||
const balance = Decimal.fromAtomics(balanceAmount ? balanceAmount.amount : "0", 0);
|
||||
const thresholdAmount = this.refillThreshold(denom);
|
||||
@ -61,10 +57,4 @@ export class TokenManager {
|
||||
|
||||
return balance.isLessThan(threshold);
|
||||
}
|
||||
|
||||
private getTokenMetaForDenom(denom: string): BankTokenMeta {
|
||||
const match = this.config.bankTokens.find((token) => token.denom === denom);
|
||||
if (!match) throw new Error(`No token found for denom: ${denom}`);
|
||||
return match;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user