Skip to content

Commit

Permalink
feat: Add extra support erc20 tokens (#388)
Browse files Browse the repository at this point in the history
* feat: add support for extra ERC20 tokens

* lint fixes

* Fix case for contract
  • Loading branch information
AdamREQ committed Dec 21, 2020
1 parent 75300ba commit 6fe92a1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
18 changes: 17 additions & 1 deletion packages/request-client.js/src/api/currency/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,23 @@ interface ITokenMap {
[address: string]: ITokenDescription;
}

const supportedERC20Tokens = require('@metamask/contract-metadata') as ITokenMap;
/* eslint-disable spellcheck/spell-checker */
const extraERC20Tokens = {
// INDA
'0x433d86336dB759855A66cCAbe4338313a8A7fc77': {
name: 'Indacoin',
erc20: true,
logo: 'inda.svg',
symbol: 'INDA',
decimals: 2,
address: '0x433d86336dB759855A66cCAbe4338313a8A7fc77'
}
} as ITokenMap;
/* eslint-enable spellcheck/spell-checker */
const supportedERC20Tokens = {
...require('@metamask/contract-metadata') as ITokenMap,
...extraERC20Tokens
};

/**
* Returns a Currency object for an ERC20, if found
Expand Down
9 changes: 9 additions & 0 deletions packages/request-client.js/test/api/currency.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ describe('api/currency', () => {
});
});

it('returns INDA', () => {
expect(getAllSupportedCurrencies().ERC20.find(({ symbol }) => symbol === 'INDA')).toEqual({
address: '0x433d86336dB759855A66cCAbe4338313a8A7fc77',
decimals: 2,
name: 'Indacoin',
symbol: 'INDA',
});
});

it('returns CTBK', () => {
expect(
getAllSupportedCurrencies().ERC20.find(({ symbol }) => symbol === 'CTBK-rinkeby')
Expand Down

0 comments on commit 6fe92a1

Please sign in to comment.