diff --git a/web/cashtab/src/assets/tabcash.png b/web/cashtab/src/assets/tabcash.png new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ { const ContextValue = React.useContext(WalletContext); - const { wallet } = ContextValue; + const { wallet, tokens } = ContextValue; + + const hasTab = checkForTokenById( + tokens, + '50d8292c6255cda7afc6c8566fed3cf42a2794e9619740fe8f4c95431271410e', + ); const location = useLocation(); const history = useHistory(); const selectedKey = @@ -166,6 +191,7 @@ + {hasTab && } { + it(`checkForTokenById returns 'false' if token ID is not found in wallet token list`, () => { + expect(checkForTokenById(mockTokens, 'not there')).toBe(false); + }); + it(`checkForTokenById returns 'true' if token ID is found in wallet token list`, () => { + expect( + checkForTokenById( + mockTokens, + '50d8292c6255cda7afc6c8566fed3cf42a2794e9619740fe8f4c95431271410e', + ), + ).toBe(true); + }); +}); diff --git a/web/cashtab/src/utils/tokenMethods.js b/web/cashtab/src/utils/tokenMethods.js new file mode 100644 --- /dev/null +++ b/web/cashtab/src/utils/tokenMethods.js @@ -0,0 +1,8 @@ +export const checkForTokenById = (tokenList, specifiedTokenId) => { + for (const t of tokenList) { + if (t.tokenId === specifiedTokenId) { + return true; + } + } + return false; +};