-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove Ohmage and switch to cow swap widget on trade page * Add border and allow deadline editing * Fixed deadline * Move temple to tokenlist
- Loading branch information
1 parent
61bef5d
commit dd0edc8
Showing
13 changed files
with
167 additions
and
12 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
86 changes: 86 additions & 0 deletions
86
apps/dapp/src/components/Pages/Core/DappPages/Trade/TradeWidget.tsx
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,86 @@ | ||
import { | ||
CowSwapWidget, | ||
EthereumProvider, | ||
TradeType, | ||
} from '@cowprotocol/widget-react'; | ||
|
||
import { CowSwapWidgetParams } from '@cowprotocol/widget-react'; | ||
import { useSetChain } from '@web3-onboard/react'; | ||
import Loader from 'components/Loader/Loader'; | ||
import env from 'constants/env'; | ||
import { useWallet } from 'providers/WalletProvider'; | ||
import styled from 'styled-components'; | ||
|
||
export const TradeWidget = () => { | ||
const [{ connectedChain }] = useSetChain(); | ||
const { ethersProvider } = useWallet(); | ||
|
||
const params: CowSwapWidgetParams = { | ||
appCode: 'Temple Dapp', | ||
width: '100%', | ||
height: '640px', | ||
chainId: Number(connectedChain?.id) || 1, | ||
tokenLists: [env.tradeTokenListUrl], | ||
tradeType: TradeType.SWAP, | ||
sell: { | ||
asset: 'DAI', | ||
amount: '100', | ||
}, | ||
buy: { | ||
asset: 'TEMPLE', | ||
amount: '100', | ||
}, | ||
forcedOrderDeadline: { | ||
swap: 7, | ||
}, | ||
enabledTradeTypes: [TradeType.SWAP], | ||
theme: { | ||
baseTheme: 'dark', | ||
primary: '#bd7b4f', | ||
paper: '#0c0b0b', | ||
info: '#4a90e2', | ||
success: '#28a745', | ||
background: '#0c0b0b', | ||
danger: '#ff4343', | ||
warning: '#ffa500', | ||
alert: '#ff8c00', | ||
text: '#ffdec9', | ||
}, | ||
standaloneMode: false, | ||
disableToastMessages: false, | ||
disableProgressBar: false, | ||
hideBridgeInfo: false, | ||
hideOrdersTable: false, | ||
images: { | ||
emptyOrders: null, | ||
}, | ||
sounds: { | ||
postOrder: null, | ||
orderError: null, | ||
orderExecuted: null, | ||
}, | ||
}; | ||
|
||
return ( | ||
<> | ||
{!ethersProvider && <Loader />} | ||
{ethersProvider && ( | ||
<WidgetContainer> | ||
<CowSwapWidget | ||
params={params} | ||
provider={ethersProvider.provider as unknown as EthereumProvider} | ||
/> | ||
</WidgetContainer> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
const WidgetContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
border: 0.0625rem solid rgb(189, 123, 79); | ||
border-radius: 10px; | ||
width: 500px; | ||
`; |
34 changes: 32 additions & 2 deletions
34
apps/dapp/src/components/Pages/Core/DappPages/TradePage.tsx
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
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