Skip to content

Commit

Permalink
update opensea api query params to exclude currencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchung committed Sep 30, 2019
1 parent 258bc30 commit e88cd33
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/handlers/opensea-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const api = axios.create({
*/
export const apiGetAccountUniqueTokens = async (address = '') => {
try {
const data = await api.get(`/assets?owner=${address}&limit=300`);
const data = await api.get(
`/assets?exclude_currencies=true&owner=${address}&limit=300`
);
return parseAccountUniqueTokens(data);
} catch (error) {
console.log('Error getting unique tokens', error);
Expand Down
3 changes: 1 addition & 2 deletions src/parsers/uniqueTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import {
*/
/* eslint-disable camelcase */
export const parseAccountUniqueTokens = data => {
const assets = get(data, 'data.assets', []);
const erc721s = filter(assets, asset => get(asset, 'asset_contract.schema_name') === 'ERC721');
const erc721s = get(data, 'data.assets', []);
return erc721s.map(({
asset_contract,
background_color,
Expand Down
10 changes: 4 additions & 6 deletions src/redux/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,10 @@ const assetsReceived = (message, append = false, change = false) => (dispatch, g

const { accountAddress, network } = getState().settings;
const assets = get(message, 'payload.assets', []);
if (!assets.length) return;

const liquidityTokens = remove(assets, (asset) => {
const symbol = get(asset, 'asset.symbol', '');
return symbol === 'uni-v1';
});
const liquidityTokens = remove(
assets,
asset => get(asset, 'asset.symbol', '') === 'UNI'
);
if (append) {
dispatch(uniswapAddLiquidityTokens(liquidityTokens));
}
Expand Down
8 changes: 6 additions & 2 deletions src/redux/uniswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ export const uniswapClearState = () => (dispatch, getState) => {
dispatch({ type: UNISWAP_CLEAR_STATE });
};

export const uniswapUpdateLiquidityTokens = (liquidityTokens) => (dispatch, getState) => {
if (isEmpty(liquidityTokens)) return;
export const uniswapUpdateLiquidityTokens = liquidityTokens => (
dispatch,
getState
) => {
const { liquidityTokens: existingLiquidityTokens } = getState().uniswap;
if (isEmpty(liquidityTokens) && isEmpty(existingLiquidityTokens)) return;
const { accountAddress, network } = getState().settings;
dispatch({
payload: liquidityTokens,
Expand Down

0 comments on commit e88cd33

Please sign in to comment.