Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
#751 fix - Replaces decimals from backend with decimals from blockcha…
Browse files Browse the repository at this point in the history
…in (#755)

* Replaces decimals from backend with decimals from blockchain

* Removes fetching again token info from blockchain
Fixs decimals cast, now we force to move from bignumber to number
For data already wrong stored as string we remove it to force fetching again the decimals

* Fixs missing symbol

* Add description comment
  • Loading branch information
Agupane authored Apr 14, 2020
1 parent c40fa07 commit 6bdbcd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/logic/tokens/store/actions/fetchTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const getTokenInfos = async (tokenAddress: string) => {
address: tokenAddress,
name: name ? name : tokenSymbol,
symbol: tokenSymbol,
decimals: tokenDecimals,
decimals: tokenDecimals.toNumber(),
logoUri: '',
})
const newTokens = tokens.set(tokenAddress, savedToken)
Expand Down
5 changes: 4 additions & 1 deletion src/logic/tokens/store/actions/loadActiveTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import { type GlobalState } from '~/store/index'
const loadActiveTokens = () => async (dispatch: ReduxDispatch<GlobalState>) => {
try {
const tokens: Map<string, TokenProps> = await getActiveTokens()
// The filter of strings was made because of the issue #751. Please see: https://github.com/gnosis/safe-react/pull/755#issuecomment-612969340
const tokenRecordsList: List<Token> = List(
Object.values(tokens).map((token: TokenProps): Token => makeToken(token)),
Object.values(tokens)
.filter((t) => typeof t.decimals !== 'string')
.map((token: TokenProps): Token => makeToken(token)),
)

dispatch(saveTokens(tokenRecordsList))
Expand Down

0 comments on commit 6bdbcd2

Please sign in to comment.