@qso-soft/shared
Version:
Shared library for QSO-soft
29 lines • 1.17 kB
JavaScript
import { getCurrentBalanceByContract, getCurrentSymbolByContract, getSavedCheckersMessage, saveCheckerDataToCSV, transactionWorker, } from '../../helpers';
export const execCheckBalance = async (params) => transactionWorker({
...params,
startLogMessage: `Execute check balance of ${params.contractAddress} in ${params.network}...`,
transactionCallback: makeCheckBalance,
});
const makeCheckBalance = async (props) => {
const { client, network, wallet, contractAddress } = props;
const { int: intBalance } = await getCurrentBalanceByContract({ client, contractAddress });
const { symbol } = await getCurrentSymbolByContract({ client, contractAddress });
const fileName = 'balance-checker';
const dataToSave = {
id: wallet.id,
walletAddress: wallet.walletAddress,
amount: intBalance,
currency: symbol,
network,
};
await saveCheckerDataToCSV({
data: dataToSave,
fileName,
additionalFilterFields: ['network', 'currency'],
});
return {
status: 'success',
message: getSavedCheckersMessage(fileName),
};
};
//# sourceMappingURL=check-balance.js.map