refactor: remove snake_case from JS code

This commit is contained in:
Vlad Stan
2022-07-05 13:24:34 +03:00
parent ee2342e1ba
commit 98366cfaf1
2 changed files with 11 additions and 11 deletions

View File

@@ -197,7 +197,7 @@ new Vue({
a.expanded = false a.expanded = false
a.accountType = type a.accountType = type
a.gapLimitExceeded = a.gapLimitExceeded =
a.branchIndex === 0 && !a.isChange &&
a.addressIndex > a.addressIndex >
lastAcctiveAddress.addressIndex + lastAcctiveAddress.addressIndex +
this.config.DEFAULT_RECEIVE_GAP_LIMIT this.config.DEFAULT_RECEIVE_GAP_LIMIT
@@ -209,7 +209,7 @@ new Vue({
try { try {
const wallet = this.g.user.wallets[0] const wallet = this.g.user.wallets[0]
addressData.amount = amount addressData.amount = amount
if (addressData.branchIndex === 0) { if (!addressData.isChange) {
const addressWallet = this.walletAccounts.find( const addressWallet = this.walletAccounts.find(
w => w.id === addressData.wallet w => w.id === addressData.wallet
) )
@@ -267,9 +267,9 @@ new Vue({
const addresses = this.addresses.data.filter( const addresses = this.addresses.data.filter(
a => a =>
(includeChangeAddrs || a.addressIndex === 0) && (includeChangeAddrs || !a.isChange) &&
(includeGapAddrs || (includeGapAddrs ||
a.addressIndex === 1 || a.isChange ||
a.addressIndex <= walletsLimit[`_${a.wallet}`]) && a.addressIndex <= walletsLimit[`_${a.wallet}`]) &&
!(excludeNoAmount && a.amount === 0) && !(excludeNoAmount && a.amount === 0) &&
(!selectedWalletId || a.wallet === selectedWalletId) (!selectedWalletId || a.wallet === selectedWalletId)
@@ -277,11 +277,12 @@ new Vue({
return addresses return addresses
}, },
openGetFreshAddressDialog: async function (walletId) { openGetFreshAddressDialog: async function (walletId) {
const {data: addressData} = await LNbits.api.request( const {data} = await LNbits.api.request(
'GET', 'GET',
`/watchonly/api/v1/address/${walletId}`, `/watchonly/api/v1/address/${walletId}`,
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
const addressData = mapAddressesData(data)
addressData.note = `Shared on ${currentDateTime()}` addressData.note = `Shared on ${currentDateTime()}`
const lastAcctiveAddress = const lastAcctiveAddress =

View File

@@ -5,7 +5,7 @@ const mapAddressesData = a => ({
wallet: a.wallet, wallet: a.wallet,
note: a.note, note: a.note,
branchIndex: a.branch_index, isChange: a.branch_index === 1,
addressIndex: a.address_index, addressIndex: a.address_index,
hasActivity: a.has_activity hasActivity: a.has_activity
}) })
@@ -14,7 +14,7 @@ const mapInputToSentHistory = (tx, addressData, vin) => ({
sent: true, sent: true,
txId: tx.txid, txId: tx.txid,
address: addressData.address, address: addressData.address,
isChange: addressData.branchIndex === 1, isChange: addressData.isChange,
amount: vin.prevout.value, amount: vin.prevout.value,
date: blockTimeToDate(tx.status.block_time), date: blockTimeToDate(tx.status.block_time),
height: tx.status.block_height, height: tx.status.block_height,
@@ -27,7 +27,7 @@ const mapOutputToReceiveHistory = (tx, addressData, vout) => ({
received: true, received: true,
txId: tx.txid, txId: tx.txid,
address: addressData.address, address: addressData.address,
isChange: addressData.branchIndex === 1, isChange: addressData.isChange,
amount: vout.value, amount: vout.value,
date: blockTimeToDate(tx.status.block_time), date: blockTimeToDate(tx.status.block_time),
height: tx.status.block_height, height: tx.status.block_height,
@@ -41,7 +41,7 @@ const mapUtxoToPsbtInput = utxo => ({
vout: utxo.vout, vout: utxo.vout,
amount: utxo.amount, amount: utxo.amount,
address: utxo.address, address: utxo.address,
branch_index: utxo.branchIndex, branch_index: utxo.isChange ? 1 : 0,
address_index: utxo.addressIndex, address_index: utxo.addressIndex,
masterpub_fingerprint: utxo.masterpubFingerprint, masterpub_fingerprint: utxo.masterpubFingerprint,
accountType: utxo.accountType, accountType: utxo.accountType,
@@ -51,9 +51,8 @@ const mapUtxoToPsbtInput = utxo => ({
const mapAddressDataToUtxo = (wallet, addressData, utxo) => ({ const mapAddressDataToUtxo = (wallet, addressData, utxo) => ({
id: addressData.id, id: addressData.id,
address: addressData.address, address: addressData.address,
isChange: addressData.branchIndex === 1, isChange: addressData.isChange,
addressIndex: addressData.addressIndex, addressIndex: addressData.addressIndex,
branchIndex: addressData.branchIndex,
wallet: addressData.wallet, wallet: addressData.wallet,
accountType: addressData.accountType, accountType: addressData.accountType,
masterpubFingerprint: wallet.fingerprint, masterpubFingerprint: wallet.fingerprint,