Skip to content

Commit

Permalink
more private methods
Browse files Browse the repository at this point in the history
  • Loading branch information
panleone committed Nov 21, 2024
1 parent a3ee8b3 commit 15fb9f1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class Wallet {
this.#highestUsedIndices.set(i, 0);
this.#loadedIndexes.set(i, 0);
}
this.subscribeToNetworkEvents();
this.#subscribeToNetworkEvents();
}

/**
Expand Down Expand Up @@ -654,7 +654,7 @@ export class Wallet {
* Return the output addresses for a given transaction
* @param {import('./transaction.js').Transaction} tx
*/
getOutAddress(tx) {
#getOutAddress(tx) {
return tx.vout.reduce(
(acc, vout) => [
...acc,
Expand Down Expand Up @@ -683,7 +683,7 @@ export class Wallet {
const nShieldAmount = (shieldCredit - shieldDebit) / COIN;
const ownAllShield = shieldDebit - shieldCredit === tx.valueBalance;
// The receiver addresses, if any
let arrReceivers = this.getOutAddress(tx);
let arrReceivers = this.#getOutAddress(tx);
const getFilteredCredit = (filter) => {
return tx.vout
.filter((_, i) => {
Expand Down Expand Up @@ -935,7 +935,7 @@ export class Wallet {
`syncShield rust internal ${handleBlocksTime} ms`
);
// At this point it should be safe to assume that shield is ready to use
await this.saveShieldOnDisk();
await this.#saveShieldOnDisk();
} catch (e) {
debugError(DebugTopics.WALLET, e);
}
Expand Down Expand Up @@ -977,7 +977,7 @@ export class Wallet {
});
}

subscribeToNetworkEvents() {
#subscribeToNetworkEvents() {
getEventEmitter().on('new-block', async (block) => {
if (this.#isSynced) {
await this.#getLatestBlocks(block);
Expand Down Expand Up @@ -1017,7 +1017,7 @@ export class Wallet {
!(await this.#checkShieldSaplingRoot(saplingRoot))
)
return;
await this.saveShieldOnDisk();
await this.#saveShieldOnDisk();
}
}
);
Expand All @@ -1042,7 +1042,7 @@ export class Wallet {
/**
* Save shield data on database
*/
async saveShieldOnDisk() {
async #saveShieldOnDisk() {
const cDB = await Database.getInstance();
const cAccount = await cDB.getAccount();
// If the account has not been created yet (for example no encryption) return
Expand Down Expand Up @@ -1084,7 +1084,7 @@ export class Wallet {
async #resetShield() {
// TODO: take the wallet creation height in input from users
await this.#shield.reloadFromCheckpoint(4200000);
await this.saveShieldOnDisk();
await this.#saveShieldOnDisk();
}

/**
Expand Down

0 comments on commit 15fb9f1

Please sign in to comment.