const BigNumber = require('bignumber.js')
const availableBalance = new BigNumber(10)
const currency = { transfer_rate: '1050000000' }
const one = new BigNumber(1)
const rate = new BigNumber(currency.transfer_rate).dividedBy(10000000).minus(100) // Percentage
const fee = new BigNumber(availableBalance).times(one.minus(one.dividedBy(one.plus(rate.dividedBy(100)))))
const maxCanSend = availableBalance.minus(fee).toNumber()
console.log({
rate: rate.toNumber(),
fee: fee.toNumber(),
maxCanSend
})