Skip to content

Commit

Permalink
Merge pull request #15 from cryptoalgebra/fix/initial-price
Browse files Browse the repository at this point in the history
fix: swap prices
  • Loading branch information
lilchizh authored Mar 29, 2024
2 parents c9a3d8a + 6edc9cf commit caecc4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
13 changes: 7 additions & 6 deletions src/components/create-pool/SelectPair/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ const SelectPair = ({ mintInfo, currencyA, currencyB }: ISelectPair) => {
return (
<div className="relative flex flex-col gap-2 items-center">
<TokenCard
disabled
showBalance={false}
value={startPriceTypedValue}
handleTokenSelection={handleInputSelect}
value={'1'}
currency={currencyA}
otherCurrency={currencyB}
handleValueChange={handleTypeInput}
handleTokenSelection={handleInputSelect}
/>

<button
Expand All @@ -60,13 +60,14 @@ const SelectPair = ({ mintInfo, currencyA, currencyB }: ISelectPair) => {
</button>

<TokenCard
disabled
showBalance={false}
value={'1'}
value={startPriceTypedValue}
handleTokenSelection={handleOutputSelect}
currency={currencyB}
otherCurrency={currencyA}
handleTokenSelection={handleOutputSelect}
handleValueChange={handleTypeInput}
/>

</div>
);
};
Expand Down
12 changes: 6 additions & 6 deletions src/components/create-pool/Summary/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CurrencyLogo from '@/components/common/CurrencyLogo';
import { Skeleton } from '@/components/ui/skeleton';
import { useSingleTokenQuery } from '@/graphql/generated/graphql';
import { useSwapState } from '@/state/swapStore';
import { useMintState } from '@/state/mintStore';
import { Currency } from '@cryptoalgebra/integral-sdk';
import { useEffect, useState } from 'react';
import { Address } from 'viem';
Expand All @@ -13,7 +13,7 @@ interface ISummary {

const Summary = ({ currencyA, currencyB }: ISummary) => {
const [suggestedPrice, setSuggestedPrice] = useState(0);
const { typedValue } = useSwapState();
const { startPriceTypedValue } = useMintState();

const token0 = currencyA?.wrapped.address.toLowerCase() as Address;
const token1 = currencyB?.wrapped.address.toLowerCase() as Address;
Expand Down Expand Up @@ -67,15 +67,15 @@ const Summary = ({ currencyA, currencyB }: ISummary) => {
)}

<div>
{`1 ${currencyB?.symbol} = ${typedValue || 0} ${
currencyA?.symbol
{`1 ${currencyA?.symbol} = ${startPriceTypedValue || 0} ${
currencyB?.symbol
}`}
</div>
</div>
{suggestedPrice > 0 && (
<div className="text-left ml-2 flex justify-between">
<p className="opacity-50">Suggested price:</p>
<p className="opacity-50">{` 1 ${currencyB?.symbol} = ${suggestedPrice} ${currencyA?.symbol}`}</p>
<p className="opacity-50">Suggested price:</p>
<p className="opacity-50">{` 1 ${currencyA?.symbol} = ${suggestedPrice} ${currencyB?.symbol}`}</p>
</div>
)}
</div>
Expand Down

0 comments on commit caecc4a

Please sign in to comment.