Skip to content

Commit

Permalink
feat(kyve): add exported isTokenType helper PE-6448
Browse files Browse the repository at this point in the history
  • Loading branch information
fedellen committed Aug 28, 2024
1 parent b2864b3 commit bf70d59
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/common/token/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import BigNumber from 'bignumber.js';
import { BigNumber } from 'bignumber.js';

import { TokenConfig, TokenFactory } from '../../types.js';
import {
TokenConfig,
TokenFactory,
TokenType,
tokenTypes,
} from '../../types.js';
import { ARToTokenAmount, ArweaveToken } from './arweave.js';
import { ETHToTokenAmount, EthereumToken } from './ethereum.js';
import { KYVEToTokenAmount, KyveToken } from './kyve.js';
Expand All @@ -30,12 +35,16 @@ export const defaultTokenMap: TokenFactory = {
} as const;

export const tokenToBaseMap = {
arweave: (a: BigNumber.BigNumber.Value) => ARToTokenAmount(a),
solana: (a: BigNumber.BigNumber.Value) => SOLToTokenAmount(a),
ethereum: (a: BigNumber.BigNumber.Value) => ETHToTokenAmount(a),
kyve: (a: BigNumber.BigNumber.Value) => KYVEToTokenAmount(a),
arweave: (a: BigNumber.Value) => ARToTokenAmount(a),
solana: (a: BigNumber.Value) => SOLToTokenAmount(a),
ethereum: (a: BigNumber.Value) => ETHToTokenAmount(a),
kyve: (a: BigNumber.Value) => KYVEToTokenAmount(a),
} as const;

export function isTokenType(token: string): token is TokenType {
return token in tokenTypes;
}

export * from './arweave.js';
export * from './solana.js';
export * from './ethereum.js';
Expand Down

0 comments on commit bf70d59

Please sign in to comment.