-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add providers for wagmi connected and prices - add generic inputs WIP🚧 - integration in Swap module - add token icons - add infura key env - eslint fix
- Loading branch information
Showing
50 changed files
with
1,284 additions
and
216 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
VITE_WALLET_CONNECT_PROJECT_ID= | ||
VITE_WALLET_CONNECT_PROJECT_ID= | ||
VITE_INFURA_ID= |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// <reference types="vite/client" /> | ||
|
||
interface ImportMetaEnv { | ||
readonly VITE_WALLET_CONNECT_PROJECT_ID: string; | ||
readonly VITE_INFURA_ID: string; | ||
} | ||
|
||
interface ImportMeta { | ||
readonly env: ImportMetaEnv; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { tokens } from '@origin/shared/contracts'; | ||
|
||
export const swapTokens = [ | ||
tokens.mainnet.ETH, | ||
tokens.mainnet.OETH, | ||
tokens.mainnet.WETH, | ||
tokens.mainnet.stETH, | ||
tokens.mainnet.frxETH, | ||
tokens.mainnet.sfrxETH, | ||
]; |
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,33 @@ | ||
import { useState } from 'react'; | ||
|
||
import { tokens } from '@origin/shared/contracts'; | ||
import { useDebouncedEffect } from '@react-hookz/web'; | ||
import { produce } from 'immer'; | ||
import { createContainer } from 'react-tracked'; | ||
|
||
import type { Token } from '@origin/shared/contracts'; | ||
|
||
export const { Provider: SwapProvider, useTracked: useSwapState } = | ||
createContainer(() => { | ||
const [state, setState] = useState({ | ||
amountIn: 0n, | ||
tokenIn: tokens.mainnet.ETH as Token, | ||
amountOut: 0n, | ||
tokenOut: tokens.mainnet.OETH as Token, | ||
slippage: 0.01, | ||
}); | ||
|
||
useDebouncedEffect( | ||
() => { | ||
setState( | ||
produce((draft) => { | ||
draft.amountOut = draft.amountIn; | ||
}), | ||
); | ||
}, | ||
[state.amountIn], | ||
1e3, | ||
); | ||
|
||
return [state, setState]; | ||
}); |
Oops, something went wrong.