Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit 2d817ca

Browse files
committed
Remove dollar signs since balance is in units not dollars
1 parent ee52103 commit 2d817ca

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

token-balances-parsed-from-alchemyWeb3.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ const metadata = await web3.alchemy.getTokenMetadata( tokenContractAddresses[0])
3030
//Forming the name of the token that comprises of the Name and the Symbol of the token
3131
const tokenName = metadata.name + "(" + metadata.symbol + ")";
3232

33-
/* Calculating the tokenBalance in USD. The "decimals" field in the token metadata on line 21 tells us
33+
/* Calculating the tokenBalance in decimal. The "decimals" field in the token metadata on line 21 tells us
3434
how many digits at the end of the tokenBalance in Line 17 are to the right of the decimal.
3535
so we divide the Full tokenBalance with 10 to the power of the decimal value of the token
3636
*/
37-
const tokenBalance = "$"+ data["tokenBalances"][0]["tokenBalance"]/Math.pow(10, metadata.decimals)
37+
const tokenBalance = data["tokenBalances"][0]["tokenBalance"]/Math.pow(10, metadata.decimals)
3838
console.log("Token balance for", tokenName, "is", tokenBalance);

token-balances-parsed-from-axios.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ axios(metadataConfig)
7878
//Forming the name of the token that comprises of the Name and the Symbol of the token
7979
const tokenName = metadata.name + "(" + metadata.symbol + ")";
8080

81-
/* Calculating the tokenBalance in USD. The "decimals" field in the token metadata on line 21 tells us
81+
/* Calculating the tokenBalance in decimal. The "decimals" field in the token metadata on line 21 tells us
8282
how many digits at the end of the tokenBalance in Line 17 are to the right of the decimal.
8383
so we divide the Full tokenBalance with 10 to the power of the decimal value of the token
8484
*/
85-
const tokenBalance = "$"+ data["tokenBalances"][0]["tokenBalance"]/Math.pow(10, metadata.decimals)
85+
const tokenBalance = data["tokenBalances"][0]["tokenBalance"]/Math.pow(10, metadata.decimals)
8686
console.log("Token balance for", tokenName, "is", tokenBalance);
8787
})

token-balances-parsed-from-fetch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ fetch(fetchURL, metadataRequestOptions)
7777
//Forming the name of the token that comprises of the Name and the Symbol of the token
7878
const tokenName = metadata.name + "(" + metadata.symbol + ")";
7979

80-
/* Calculating the tokenBalance in USD. The "decimals" field in the token metadata on line 21 tells us
80+
/* Calculating the tokenBalance in decimal. The "decimals" field in the token metadata on line 21 tells us
8181
how many digits at the end of the tokenBalance in Line 17 are to the right of the decimal.
8282
so we divide the Full tokenBalance with 10 to the power of the decimal value of the token
8383
*/
84-
const tokenBalance = "$"+ data["tokenBalances"][0]["tokenBalance"]/Math.pow(10, metadata.decimals)
84+
const tokenBalance = data["tokenBalances"][0]["tokenBalance"]/Math.pow(10, metadata.decimals)
8585
console.log("Token balance for", tokenName, "is", tokenBalance);
8686
})
8787
.catch(error => console.log('error', error));

0 commit comments

Comments
 (0)