-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
332/Store slippage info on appData (#629)
* Bumped latest cow-sdk version * Creating cow-sdk instances for all networks * Removed redundant import * Updated .env files with now mandatory env var for IPFS uploading * Added/moved appCode related consts to constants file * New hook useAppCode * Added appData/atoms using Jotai WARNING! Still needs refactoring * New utils for dealing with appData * New hook useAppData * Adding newly calculated appData to order and storing it in the to-be-uploaded queue * Added appData/updater WARNING! Still needs refactoring * Disabling affiliate data IPFS upload; will be handled on every order WARNING! Needs to review if affiliate flow is still working as before * Removing helper files no longer in use Most have been replaced by the correspondent sdk methods * Refactored state/appData/types * Refactored state/appData/atoms * Refactored state/AppData/hooks * Updater state/appData/updater does not need to be tsx file * Added state/appData/utils to handle key creation/parsing * Refactored upload queue to a flat object rather than nested by network * Removing debug loggs from state/appData/atoms * Refactored state/appData/updater * `environment` is now part of the appData rather than a metadata * Forcing all inputs in an attempt to fix cypress occasional failures * Refactor: removed redundant initial state on state/appData/atoms * Refactor: improved logging in case of appDataHash generation * 332/exponential back off (#726) * Updated stored types to contain lastAttempt rather than tryAfter * New helper function to check when we can try to upload to ipfs again * Improved logging for ipfs upload updater * Changed soft upload failures log level from debug to warn * Refactor: extracted helper function _actuallyUploadToIpfs * Refactor: Renamed BASE_TIME_BETWEEN_ATTEMPTS to BASE_FOR_EXPONENTIAL_BACKOFF * 332/update affiliate flow (#647) * Updated state/affiliate - Removed no longer needed state (appDataHash) - Added new status referralAddress.isActive - Updated associated actions, hooks and reducer - Updated AffiliateStatusCheck to use new state * Updated hooks/useAppData to use new state/affiliate state * Updated useEffect deps to prevent unecessary re-renders * Refactor: removed redundant variable * Fixed issue where invalid referral would not be tagged as so * 332/warning when pinata envs not set locally (#659) * Added `localWarning` for PINATA keys * Displaying localWarning if any * Added alternative warning display: As a permanent toast notification * Refactor: Renamed WarningPopupContent `message` to `warning` * Added warning icon to toast notification * Moved localWarning from Header to state/application * Changed warning popup key to a more generic value * Removed banner with warning in favor of the popup notification * 332/quote id on metadata (#750) * Ignore quoteId when checking if the order is unfillable * Persiste quoteId from api to redux state * Add quoteId to GpTrade class * Pass quoteId down to appData * Include quoteId on order placement * Bumped cow-sdk to 0.0.15-RC.0 * Refactor: Replaced map upload queue with arrary (#747) * Refactor: Replaced map upload queue with arrary * Refactor: Using slice(0) to clone array instead of spread operator * Refactor: using Array.some instead of Array.find As I do not need to the stored element * 332/slippage bips rather than amounts on metadata (#758) * Bumop quote metadata version * Added helper function to transfor Percent instances to bip string * Refactored appData utils functions to use new quote metadata schema Also changed the fn signature to accomodate different options if needed * Updated useAppData to use slippage in the quote metadata * Refactored useAppData interface * Removed code that is not related to slippageBips for quote metadata * Actually, _buildQuoteMetadata will never return undefined * 332/upload right away (#767) * Increased upload to IPFS queue check interval to 1m * Try to upload docs added to the upload queue right away * 332/refactor use address (#748) * Refactor: renamed useAddress to useAffiliateAddress * Typo fix on comment * Fixed issue with affiliate not valid displayed when there was no affiliate * Refeset affiliate state whenever error is reset * Referral address cannot be null, but undefined 🤦
- Loading branch information
1 parent
c756c19
commit 97887c5
Showing
42 changed files
with
650 additions
and
213 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 was deleted.
Oops, something went wrong.
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,28 @@ | ||
import { useContext } from 'react' | ||
import styled, { ThemeContext } from 'styled-components/macro' | ||
|
||
import { ThemedText } from 'theme' | ||
import { AutoColumn } from 'components/Column' | ||
import { AutoRow } from 'components/Row' | ||
import { AlertCircle } from 'react-feather' | ||
|
||
const RowNoFlex = styled(AutoRow)` | ||
flex-wrap: nowrap; | ||
` | ||
|
||
export function WarningPopup({ warning }: { warning: string | JSX.Element }) { | ||
const theme = useContext(ThemeContext) | ||
|
||
return ( | ||
<RowNoFlex> | ||
<div style={{ paddingRight: 16 }}> | ||
<AlertCircle color={theme.red1} size={24} /> | ||
</div> | ||
<AutoColumn gap="sm"> | ||
<ThemedText.Body fontWeight={'bold'} color={theme.danger}> | ||
{warning} | ||
</ThemedText.Body> | ||
</AutoColumn> | ||
</RowNoFlex> | ||
) | ||
} |
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,2 @@ | ||
export const PINATA_API_KEY = process.env.REACT_APP_PINATA_API_KEY as string | ||
export const PINATA_SECRET_API_KEY = process.env.REACT_APP_PINATA_SECRET_API_KEY as string | ||
export const PINATA_API_URL = process.env.REACT_APP_PINATA_API_URL || 'https://api.pinata.cloud' | ||
export const IPFS_URI = process.env.REACT_APP_IPFS_URI || 'https://ipfs.infura.io:5001/api/v0' |
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,15 @@ | ||
import { useIsGnosisSafeApp } from 'hooks/useWalletInfo' | ||
import { DEFAULT_APP_CODE, SAFE_APP_CODE } from 'constants/index' | ||
|
||
const APP_CODE = process.env.REACT_APP_APP_CODE | ||
|
||
export function useAppCode(): string { | ||
const isSafeApp = useIsGnosisSafeApp() | ||
|
||
if (APP_CODE) { | ||
// appCode coming from env var has priority | ||
return APP_CODE | ||
} | ||
|
||
return isSafeApp ? SAFE_APP_CODE : DEFAULT_APP_CODE | ||
} |
Oops, something went wrong.