Skip to content

Commit

Permalink
docs: improves docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
tuliomir committed Jan 24, 2024
1 parent bc6232b commit bb5e3ad
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/screens/Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,14 @@ function Wallet() {
initializeWalletScreen();

Check warning on line 97 in src/screens/Wallet.js

View check run for this annotation

Codecov / codecov/patch

src/screens/Wallet.js#L96-L97

Added lines #L96 - L97 were not covered by tests
}, [selectedToken]);

// The tokens history has changed, check the last timestamp to define if we should fetch the token details again
// When the tokens history changes, check the last timestamp to define if we should fetch the token details again
useEffect(() => {
const selectedTokenHistory = get(tokensHistory, selectedToken, {

Check warning on line 102 in src/screens/Wallet.js

View check run for this annotation

Codecov / codecov/patch

src/screens/Wallet.js#L101-L102

Added lines #L101 - L102 were not covered by tests
status: TOKEN_DOWNLOAD_STATUS.LOADING,
updatedAt: -1,
data: [],
});

// Check if the selected token history has changed from the last fetch
if (tokenHistoryTimestamp !== selectedTokenHistory.updatedAt) {
setTokenHistoryTimestamp(selectedTokenHistory.updatedAt);
updateTokenInfo(selectedToken);
Expand All @@ -124,19 +123,20 @@ function Wallet() {
setTransactionsCount(null);
setShouldShowAdministrativeTab(false);

Check warning on line 124 in src/screens/Wallet.js

View check run for this annotation

Codecov / codecov/patch

src/screens/Wallet.js#L120-L124

Added lines #L120 - L124 were not covered by tests

// No need to download token info and wallet info if the token is hathor
// No need to download token info and mint/melt info if the token is hathor
if (selectedToken === hathorLib.constants.HATHOR_TOKEN_CONFIG.uid) {
return;
}

// Fires the fetching of all token data for the correct exhibition on screen
// Fires the fetching of all token data
calculateShouldShowAdministrativeTab(selectedToken);
updateTokenInfo(selectedToken);
updateWalletInfo(selectedToken);

Check warning on line 134 in src/screens/Wallet.js

View check run for this annotation

Codecov / codecov/patch

src/screens/Wallet.js#L132-L134

Added lines #L132 - L134 were not covered by tests
}

/**
* Update token state after didmount or props update
* @param {string} tokenUid
*/
const updateWalletInfo = async (tokenUid) => {
const mintUtxos = await wallet.getMintAuthority(tokenUid, { many: true });
Expand All @@ -154,6 +154,11 @@ function Wallet() {
setMeltCount(meltCount);

Check warning on line 154 in src/screens/Wallet.js

View check run for this annotation

Codecov / codecov/patch

src/screens/Wallet.js#L153-L154

Added lines #L153 - L154 were not covered by tests
}

/**
* Fetches mint and melt data for a token
* @param {string} tokenUid
* @returns {Promise<void>}
*/
async function updateTokenInfo(tokenUid) {
// No need to fetch token info if the token is hathor
if (tokenUid === hathorLib.constants.HATHOR_TOKEN_CONFIG.uid) {
Expand All @@ -174,7 +179,7 @@ function Wallet() {
setTransactionsCount(totalTransactions);

Check warning on line 179 in src/screens/Wallet.js

View check run for this annotation

Codecov / codecov/patch

src/screens/Wallet.js#L175-L179

Added lines #L175 - L179 were not covered by tests
}

/*
/**
* We show the administrative tools tab only for the users that one day had an authority output, even if it was already spent
*
* This will set the shouldShowAdministrativeTab state param based on the response of getMintAuthority and getMeltAuthority
Expand Down

0 comments on commit bb5e3ad

Please sign in to comment.