Skip to content

Commit

Permalink
fix: move currencies to common package
Browse files Browse the repository at this point in the history
  • Loading branch information
aramalipoor committed Dec 24, 2022
1 parent db6173c commit 4f8375d
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ChainId } from '@flair-sdk/common';

import { BaseCurrency, CryptoCurrency } from '../types';
import { BaseCurrency, CryptoCurrency } from '../types/currencies';
import { ChainId } from './chain-id';

export const KNOWN_BASE_CURRENCIES: BaseCurrency[] = ['USD'];

Expand Down
1 change: 1 addition & 0 deletions packages/common/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './chain-id';
export * from './currencies';
export * from './erc20s';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from '@flair-sdk/common';
import { ChainId } from '../constants/chain-id';

export type CryptoSymbol = 'ETH' | 'MATIC' | string;

Expand Down
1 change: 1 addition & 0 deletions packages/common/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './currencies';
export * from './env';
export * from './error';
export * from './transactions';
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BaseCurrency, CryptoSymbol, CryptoUnits } from '@flair-sdk/common';
import { BigNumberish, ethers } from 'ethers';
import { useMemo } from 'react';

import { useCryptoCurrency } from '../../hooks';
import { BaseCurrency, CryptoSymbol, CryptoUnits } from '../../types';

type Props = {
value?: string | BigNumberish;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CryptoSymbol, CryptoUnits } from '@flair-sdk/common';
import { BigNumber, BigNumberish, ethers } from 'ethers';
import { ReactNode, useMemo } from 'react';

import { useCryptoCurrency } from '../../hooks';
import { CryptoSymbol, CryptoUnits } from '../../types';
import { CryptoPrice } from '../CryptoPrice/CryptoPrice';

type Props = {
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/core/crypto-currency/constants/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { DOLLAR_STABLECOIN_SYMBOLS } from '@flair-sdk/common';
import {
BaseCurrency,
CryptoSymbol,
DOLLAR_STABLECOIN_SYMBOLS,
} from '@flair-sdk/common';

import { BaseCurrency, CryptoSymbol } from '../types';
import { useCryptoInfo } from './useCryptoInfo';
import { useCryptoPrice } from './useCryptoPrice';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { KNOWN_CRYPTO_CURRENCIES } from '../constants/currencies';
import { KNOWN_CRYPTO_CURRENCIES } from '@flair-sdk/common';

export const useCryptoInfo = (symbol?: string) => {
return KNOWN_CRYPTO_CURRENCIES.find((c) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BaseCurrency, CryptoSymbol } from '@flair-sdk/common';
import { BigNumberish, ethers } from 'ethers';

import { useCryptoPricesContext } from '../providers';
import { BaseCurrency, CryptoSymbol } from '../types';

type Config = {
amount?: BigNumberish;
Expand Down
2 changes: 0 additions & 2 deletions packages/react/src/core/crypto-currency/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export * from './components';
export * from './constants';
export * from './hooks';
export * from './providers';
export * from './types';
15 changes: 6 additions & 9 deletions packages/react/src/core/crypto-currency/providers/coingecko.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { DOLLAR_STABLECOIN_SYMBOLS } from '@flair-sdk/common';
import axios from 'axios';
import React from 'react';

import {
KNOWN_BASE_CURRENCIES,
KNOWN_CRYPTO_CURRENCIES,
} from '../constants/currencies';
import {
BaseCurrency,
CryptoCurrency,
CryptoPriceDictionary,
CryptoSymbol,
} from '../types';
DOLLAR_STABLECOIN_SYMBOLS,
KNOWN_BASE_CURRENCIES,
KNOWN_CRYPTO_CURRENCIES,
} from '@flair-sdk/common';
import axios from 'axios';
import React from 'react';

type PricesDictionariesBySymbol = Record<CryptoSymbol, CryptoPriceDictionary>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { classNames } from '@flair-sdk/common';
import { classNames, CryptoSymbol } from '@flair-sdk/common';
import { RadioGroup } from '@headlessui/react';
import { CheckCircleIcon } from '@heroicons/react/solid/esm/index.js';
import { Chain } from '@wagmi/chains';
Expand All @@ -7,7 +7,6 @@ import { ReactNode, useEffect } from 'react';

import { useChainInfo } from '../../../../common';
import {
CryptoSymbol,
CryptoValue,
IfWalletConnected,
useRemoteJsonReader,
Expand Down

0 comments on commit 4f8375d

Please sign in to comment.