mirror of
https://github.com/Xahau/xahau.js.git
synced 2026-04-29 15:37:50 +00:00
refactor: clean up getFaucetWallet starting balance (#1677)
This commit is contained in:
committed by
Mayukha Vadari
parent
5b9e3dbdc4
commit
02fd0ce323
@@ -53,23 +53,16 @@ async function generateFaucetWallet(
|
||||
destination: fundWallet.classicAddress,
|
||||
}),
|
||||
)
|
||||
// Retrieve the existing account balance
|
||||
let addressToFundBalance: undefined | string
|
||||
|
||||
let startingBalance = 0
|
||||
try {
|
||||
addressToFundBalance = await getAddressXrpBalance(
|
||||
this,
|
||||
fundWallet.classicAddress,
|
||||
startingBalance = Number(
|
||||
await getAddressXrpBalance(this, fundWallet.classicAddress),
|
||||
)
|
||||
} catch {
|
||||
/* addressToFundBalance remains undefined */
|
||||
/* startingBalance remains '0' */
|
||||
}
|
||||
|
||||
// Check the address balance is not undefined and is a number
|
||||
const startingBalance =
|
||||
addressToFundBalance && !Number.isNaN(Number(addressToFundBalance))
|
||||
? Number(addressToFundBalance)
|
||||
: 0
|
||||
|
||||
// Options to pass to https.request
|
||||
const options = getOptions(this, postBody)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user