This repository was archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 357
(Feature) [xDai] - Use tx service for loading token info #1435
Merged
fernandomg
merged 7 commits into
feature/#1353-xDai-compatibility
from
feature/#1407-use-tx-service-loading-token
Oct 8, 2020
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c0c4449
Replaces getRelayUrl with getTxServiceUrl
Agupane b7ac7f3
Filter erc721 collectibles when fetching tokens
Agupane 92f58ed
Renames fetchTokenList to fetchErc20AndErc721AssetsList
Agupane bb1de62
Fix routes starting by /
a425163
Removes default export
Agupane d305eb4
Type fetchErc20AndErc721AssetsList
Agupane a233785
Optional parameter
Agupane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import axios, { AxiosResponse } from 'axios' | ||
|
|
||
| import { getTxServiceUrl } from 'src/config/index' | ||
|
|
||
| type TokenResult = { | ||
| address: string | ||
| decimals?: number | ||
| logoUri: string | ||
| name: string | ||
| symbol: string | ||
| type: string | ||
| } | ||
|
|
||
| export const fetchErc20AndErc721AssetsList = async (): Promise<AxiosResponse<{ results: TokenResult[] }>> => { | ||
| const apiUrl = getTxServiceUrl() | ||
|
|
||
| const url = `${apiUrl}/tokens/` | ||
|
|
||
| return axios.get<{ results: TokenResult[] }>(url, { | ||
| params: { | ||
| limit: 3000, | ||
| }, | ||
| }) | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| export { default as fetchTokenList } from './fetchTokenList' | ||
| export { default as fetchToken } from './fetchToken' | ||
| export { fetchErc20AndErc721AssetsList } from './fetchErc20AndErc721AssetsList' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ import contract from 'truffle-contract' | |
| import saveTokens from './saveTokens' | ||
|
|
||
| import generateBatchRequests from 'src/logic/contracts/generateBatchRequests' | ||
| import { fetchTokenList } from 'src/logic/tokens/api' | ||
| import { fetchErc20AndErc721AssetsList } from 'src/logic/tokens/api' | ||
| import { makeToken, Token } from 'src/logic/tokens/store/model/token' | ||
| import { tokensSelector } from 'src/logic/tokens/store/selectors' | ||
| import { getWeb3 } from 'src/logic/wallets/getWeb3' | ||
|
|
@@ -98,13 +98,15 @@ export const fetchTokens = () => async ( | |
|
|
||
| const { | ||
| data: { results: tokenList }, | ||
| } = await fetchTokenList() | ||
| } = await fetchErc20AndErc721AssetsList() | ||
|
|
||
| if (currentSavedTokens && currentSavedTokens.size === tokenList.length) { | ||
| const erc20Tokens = tokenList.filter((token) => token.type.toLowerCase() === 'erc20') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we move
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's mandatory now. Probably when we work on #1408 we'll address this in a most consistent way. |
||
|
|
||
| if (currentSavedTokens?.size === erc20Tokens.length) { | ||
| return | ||
| } | ||
|
|
||
| const tokens = List(tokenList.map((token) => makeToken(token))) | ||
| const tokens = List(erc20Tokens.map((token) => makeToken(token))) | ||
|
|
||
| dispatch(saveTokens(tokens)) | ||
| } catch (err) { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.