This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: return reserves and fee on price preview (#190)
* feat: return reserve and fee on preview prices * chore: prevent vercel to comment * feat: add swap preview info * feat: fix swap card to top * refact: split code and improve behaviors * feat: fix isssues and improve loading * chore: prettify * chore: update contract id * fix: pass contract * config: update fuel-core version * refact: refactor based on PR comments * fix: fix exchange contract tests
- Loading branch information
1 parent
2adf84d
commit c2b8fa8
Showing
20 changed files
with
390 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM ghcr.io/fuellabs/fuel-core:v0.6.4 | ||
FROM ghcr.io/fuellabs/fuel-core:v0.7.1 | ||
|
||
ARG IP=0.0.0.0 | ||
ARG PORT=4000 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import classNames from "classnames"; | ||
import type { ReactNode } from "react"; | ||
|
||
type TableItemProps = { | ||
title: ReactNode; | ||
value: ReactNode; | ||
className?: string; | ||
}; | ||
|
||
export const PreviewItem = ({ title, value, className }: TableItemProps) => ( | ||
<div className={classNames("flex", className)}> | ||
<div>{title}</div> | ||
<div className="flex-auto text-right">{value}</div> | ||
</div> | ||
); | ||
|
||
type PreviewTableProps = { | ||
title: ReactNode; | ||
children: ReactNode; | ||
className?: string; | ||
}; | ||
|
||
export const PreviewTable = ({ | ||
title, | ||
children, | ||
className, | ||
}: PreviewTableProps) => ( | ||
<div className={className}> | ||
<div className="px-2 text-sm text-gray-50 mb-2">{title}</div> | ||
<div className="flex flex-col gap-3 p-4 text-sm text-gray-100 bg-gray-700 rounded-xl"> | ||
{children} | ||
</div> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { useQuery } from 'react-query'; | ||
|
||
import type { ExchangeContractAbi } from '~/types/contracts'; | ||
|
||
export function usePoolInfo(contract: ExchangeContractAbi) { | ||
return useQuery('PoolPage-poolInfo', () => contract.callStatic.get_info()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { SLIPPAGE_TOLERANCE } from '~/config'; | ||
|
||
export function useSlippage() { | ||
return { | ||
value: SLIPPAGE_TOLERANCE, | ||
formatted: `${SLIPPAGE_TOLERANCE * 100}%`, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import { toBigInt } from 'fuels'; | ||
|
||
export const contractABI = {}; | ||
export const contractAddress = '0xF93c18172eAba6a9F145B3FB16d2bBeA2e096477'; | ||
export const LocalStorageKey = 'swayswap'; | ||
export const LocalStorageKey = 'swayswap-v2'; | ||
export const CoinETH = '0x0000000000000000000000000000000000000000000000000000000000000000'; | ||
export const ZERO = toBigInt(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.