diff --git a/package.json b/package.json index 135fa52b87..364644e574 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "givethdapp", - "version": "2.15.1", + "version": "2.15.2", "private": true, "scripts": { "build": "next build", diff --git a/public/images/tokens/op.png b/public/images/tokens/op.png new file mode 100644 index 0000000000..815092789b Binary files /dev/null and b/public/images/tokens/op.png differ diff --git a/public/images/tokens/snx.png b/public/images/tokens/snx.png new file mode 100644 index 0000000000..2d0873a3b8 Binary files /dev/null and b/public/images/tokens/snx.png differ diff --git a/public/images/tokens/wbtc.png b/public/images/tokens/wbtc.png index a7978eaddf..a340710487 100644 Binary files a/public/images/tokens/wbtc.png and b/public/images/tokens/wbtc.png differ diff --git a/public/images/tokens/weth.png b/public/images/tokens/weth.png index 6da446976d..038c12411d 100644 Binary files a/public/images/tokens/weth.png and b/public/images/tokens/weth.png differ diff --git a/src/components/NetworkLogo.tsx b/src/components/NetworkLogo.tsx index f62ed95dfd..0b902e70dd 100644 --- a/src/components/NetworkLogo.tsx +++ b/src/components/NetworkLogo.tsx @@ -4,6 +4,7 @@ import { IconEthereum } from '@/components/Icons/Eth'; import { IconGnosisChain } from '@/components/Icons/GnosisChain'; import { IconPolygon } from '@/components/Icons/Polygon'; import { IconCelo } from './Icons/Celo'; +import { IconOptimism } from './Icons/Optimism'; const NetworkLogo = (props: { chainId?: number; logoSize?: number }) => { const { chainId, logoSize } = props; @@ -13,8 +14,8 @@ const NetworkLogo = (props: { chainId?: number; logoSize?: number }) => { return ; } else if (chainId === config.POLYGON_NETWORK_NUMBER) { return ; - //TODO: Uncomment Optimism } else if (chainId === config.OPTIMISM_NETWORK_NUMBER) { - // return ; + } else if (chainId === config.OPTIMISM_NETWORK_NUMBER) { + return ; } else if (chainId === config.CELO_NETWORK_NUMBER) { return ; } else return null; diff --git a/src/components/modals/DonateModal.tsx b/src/components/modals/DonateModal.tsx index 2f63e2f484..d7937c86fd 100644 --- a/src/components/modals/DonateModal.tsx +++ b/src/components/modals/DonateModal.tsx @@ -70,7 +70,7 @@ const DonateModal: FC = props => { const isMainnet = chainId === config.MAINNET_NETWORK_NUMBER; const isGnosis = chainId === config.XDAI_NETWORK_NUMBER; const isPolygon = chainId === config.POLYGON_NETWORK_NUMBER; - //TODO: Uncomment Optimism const isOptimism = chainId === config.OPTIMISM_NETWORK_NUMBER; + const isOptimism = chainId === config.OPTIMISM_NETWORK_NUMBER; const isCelo = chainId === config.CELO_NETWORK_NUMBER; const [donating, setDonating] = useState(false); @@ -204,9 +204,9 @@ const DonateModal: FC = props => { ? config.XDAI_NETWORK_NUMBER : isCelo ? config.CELO_NETWORK_NUMBER - : config.POLYGON_NETWORK_NUMBER; - //TODO: Uncomment Optimism ? config.POLYGON_NETWORK_NUMBER - // : config.OPTIMISM_NETWORK_NUMBER; + : isPolygon + ? config.POLYGON_NETWORK_NUMBER + : config.OPTIMISM_NETWORK_NUMBER; const fetchedPrice = await fetchPrice( coingeckoChainId, tokenAddress, diff --git a/src/components/modals/DonateWrongNetwork.tsx b/src/components/modals/DonateWrongNetwork.tsx index 10e0d4c8c6..5806591297 100644 --- a/src/components/modals/DonateWrongNetwork.tsx +++ b/src/components/modals/DonateWrongNetwork.tsx @@ -35,7 +35,7 @@ const networks = [ config.XDAI_CONFIG, config.POLYGON_CONFIG, config.CELO_CONFIG, - //TODO: Uncomment Optimism config.OPTIMISM_CONFIG, + config.OPTIMISM_CONFIG, ]; export const DonateWrongNetwork: FC = props => { diff --git a/src/components/modals/ManageProjectAddresses/ManageProjectAddressesModal.tsx b/src/components/modals/ManageProjectAddresses/ManageProjectAddressesModal.tsx index bac95c5972..7a70e45845 100644 --- a/src/components/modals/ManageProjectAddresses/ManageProjectAddressesModal.tsx +++ b/src/components/modals/ManageProjectAddresses/ManageProjectAddressesModal.tsx @@ -47,9 +47,9 @@ export const ManageProjectAddressesModal: FC = ({ WalletAddr[config.CELO_NETWORK_NUMBER] = { networkId: config.CELO_NETWORK_NUMBER, }; - //TODO: Uncomment Optimism WalletAddr[config.OPTIMISM_NETWORK_NUMBER] = { - // networkId: config.OPTIMISM_NETWORK_NUMBER, - // }; + WalletAddr[config.OPTIMISM_NETWORK_NUMBER] = { + networkId: config.OPTIMISM_NETWORK_NUMBER, + }; const { addresses } = project; if (!addresses) return; for (let i = 0; i < addresses.length; i++) { diff --git a/src/components/modals/SwitchNetwork.tsx b/src/components/modals/SwitchNetwork.tsx index de62b6652d..c0c794b7a7 100644 --- a/src/components/modals/SwitchNetwork.tsx +++ b/src/components/modals/SwitchNetwork.tsx @@ -23,7 +23,7 @@ const networks = [ config.XDAI_CONFIG, config.POLYGON_CONFIG, config.CELO_CONFIG, - //TODO: Uncomment Optimism config.OPTIMISM_CONFIG, + config.OPTIMISM_CONFIG, ]; const SwitchNetwork: FC = ({ setShowModal }) => { diff --git a/src/components/views/create/CreateProject.tsx b/src/components/views/create/CreateProject.tsx index 9c744570dc..054e189fe6 100644 --- a/src/components/views/create/CreateProject.tsx +++ b/src/components/views/create/CreateProject.tsx @@ -59,7 +59,7 @@ const { XDAI_NETWORK_NUMBER, POLYGON_NETWORK_NUMBER, CELO_NETWORK_NUMBER, - //TODO: Uncomment Optimism OPTIMISM_NETWORK_NUMBER, + OPTIMISM_NETWORK_NUMBER, } = config; interface ICreateProjectProps { project?: IProjectEdition; @@ -76,7 +76,7 @@ export enum EInputs { gnosisAddress = 'gnosisAddress', polygonAddress = 'polygonAddress', celoAddress = 'celoAddress', - //TODO: Uncomment Optimism optimismAddress = 'optimismAddress', + optimismAddress = 'optimismAddress', } export type TInputs = { @@ -90,7 +90,7 @@ export type TInputs = { [EInputs.gnosisAddress]: string; [EInputs.polygonAddress]: string; [EInputs.celoAddress]: string; - //TODO: Uncomment Optimism [EInputs.optimismAddress]: string; + [EInputs.optimismAddress]: string; }; const CreateProject: FC = ({ project }) => { @@ -118,15 +118,15 @@ const CreateProject: FC = ({ project }) => { const prevCeloAddress = addresses?.find( a => a.isRecipient && a.networkId === CELO_NETWORK_NUMBER, )?.address; - //TODO: Uncomment Optimism const prevOptimismAddress = addresses?.find( - // a => a.isRecipient && a.networkId === OPTIMISM_NETWORK_NUMBER, - // )?.address; + const prevOptimismAddress = addresses?.find( + a => a.isRecipient && a.networkId === OPTIMISM_NETWORK_NUMBER, + )?.address; const isSamePrevAddresses = compareAddressesArray([ prevMainAddress, prevGnosisAddress, prevPolygonAddress, prevCeloAddress, - //TODO: Uncomment Optimism prevOptimismAddress, + prevOptimismAddress, ]); const userAddresses: string[] = []; if (isSamePrevAddresses) userAddresses.push(prevMainAddress!); @@ -135,7 +135,7 @@ const CreateProject: FC = ({ project }) => { if (prevGnosisAddress) userAddresses.push(prevGnosisAddress); if (prevPolygonAddress) userAddresses.push(prevPolygonAddress); if (prevCeloAddress) userAddresses.push(prevCeloAddress); - //TODO: Uncomment Optimism if (prevOptimismAddress) userAddresses.push(prevOptimismAddress); + if (prevOptimismAddress) userAddresses.push(prevOptimismAddress); } const formMethods = useForm({ @@ -151,7 +151,7 @@ const CreateProject: FC = ({ project }) => { [EInputs.gnosisAddress]: prevGnosisAddress || '', [EInputs.polygonAddress]: prevPolygonAddress || '', [EInputs.celoAddress]: prevCeloAddress || '', - //TODO: Uncomment Optimism [EInputs.optimismAddress]: prevOptimismAddress || '', + [EInputs.optimismAddress]: prevOptimismAddress || '', }, }); @@ -170,9 +170,9 @@ const CreateProject: FC = ({ project }) => { const [celoAddressActive, setCeloAddressActive] = useState( isEditMode ? !!prevCeloAddress : true, ); - //TODO: Uncomment Optimism const [optimismAddressActive, setOptimismAddressActive] = useState( - // isEditMode ? !!prevOptimismAddress : true, - // ); + const [optimismAddressActive, setOptimismAddressActive] = useState( + isEditMode ? !!prevOptimismAddress : true, + ); const [isSameAddress, setIsSameAddress] = useState( isEditMode ? isSamePrevAddresses : true, ); @@ -190,7 +190,7 @@ const CreateProject: FC = ({ project }) => { gnosisAddress, polygonAddress, celoAddress, - //TODO: Uncomment Optimism optimismAddress, + optimismAddress, name, description, categories, @@ -221,10 +221,10 @@ const CreateProject: FC = ({ project }) => { address: checksumAddress, networkId: CELO_NETWORK_NUMBER, }, - //TODO: Uncomment Optimism { - // address: checksumAddress, - // networkId: OPTIMISM_NETWORK_NUMBER, - // }, + { + address: checksumAddress, + networkId: OPTIMISM_NETWORK_NUMBER, + }, ); } else { if (mainnetAddressActive) { @@ -258,13 +258,13 @@ const CreateProject: FC = ({ project }) => { networkId: CELO_NETWORK_NUMBER, }); } - //TODO: Uncomment Optimism if (optimismAddressActive) { - // const checksumAddress = utils.getAddress(optimismAddress); - // addresses.push({ - // address: checksumAddress, - // networkId: OPTIMISM_NETWORK_NUMBER, - // }); - // } + if (optimismAddressActive) { + const checksumAddress = utils.getAddress(optimismAddress); + addresses.push({ + address: checksumAddress, + networkId: OPTIMISM_NETWORK_NUMBER, + }); + } } const projectData: IProjectCreation = { @@ -389,8 +389,8 @@ const CreateProject: FC = ({ project }) => { !e && !gnosisAddressActive && !polygonAddressActive && - !celoAddressActive - //TODO: Uncomment Optimism !optimismAddressActive + !celoAddressActive && + !optimismAddressActive ) return showToastError( formatMessage({ @@ -412,8 +412,8 @@ const CreateProject: FC = ({ project }) => { !e && !mainnetAddressActive && !polygonAddressActive && - !celoAddressActive - //TODO: Uncomment Optimism !optimismAddressActive + !celoAddressActive && + !optimismAddressActive ) return showToastError( formatMessage({ @@ -435,8 +435,8 @@ const CreateProject: FC = ({ project }) => { !e && !mainnetAddressActive && !gnosisAddressActive && - !celoAddressActive - //TODO: Uncomment Optimism !optimismAddressActive + !celoAddressActive && + !optimismAddressActive ) return showToastError( formatMessage({ @@ -458,8 +458,8 @@ const CreateProject: FC = ({ project }) => { !e && !mainnetAddressActive && !gnosisAddressActive && - !polygonAddressActive - //TODO: Uncomment Optimism !optimismAddressActive + !polygonAddressActive && + !optimismAddressActive ) return showToastError( formatMessage({ @@ -470,7 +470,7 @@ const CreateProject: FC = ({ project }) => { setCeloAddressActive(e); }} /> - {/*TODO: Uncomment Optimism = ({ project }) => { if (!e) unregister(EInputs.optimismAddress); setOptimismAddressActive(e); }} - /> */} + /> {isEditMode ? formatMessage({ diff --git a/src/components/views/create/WalletAddressInput.tsx b/src/components/views/create/WalletAddressInput.tsx index 27a787e9b1..6046e52dd5 100644 --- a/src/components/views/create/WalletAddressInput.tsx +++ b/src/components/views/create/WalletAddressInput.tsx @@ -65,16 +65,16 @@ const WalletAddressInput: FC = ({ const isGnosis = networkId === config.XDAI_NETWORK_NUMBER; const isPolygon = networkId === config.POLYGON_NETWORK_NUMBER; const isCelo = networkId === config.CELO_NETWORK_NUMBER; - //TODO: Uncomment Optimism const isOptimism = networkId === config.OPTIMISM_NETWORK_NUMBER; + const isOptimism = networkId === config.OPTIMISM_NETWORK_NUMBER; const inputName = isGnosis ? EInputs.gnosisAddress : isPolygon ? EInputs.polygonAddress : isCelo ? EInputs.celoAddress - : //TODO: Uncomment Optimism : isOptimism - // ? EInputs.optimismAddress - EInputs.mainAddress; + : isOptimism + ? EInputs.optimismAddress + : EInputs.mainAddress; const value = getValues(inputName); const isDefaultAddress = compareAddresses(value, user?.walletAddress); const error = errors[inputName]; @@ -108,9 +108,9 @@ const WalletAddressInput: FC = ({ ? 'Polygon Mainnet' : isCelo ? 'Celo Mainnet' - : //TODO: Uncomment Optimism : isOptimism - // ? 'Optimism' - 'Mainnet' + : isOptimism + ? 'Optimism' + : 'Mainnet' }.`; } @@ -200,7 +200,7 @@ const WalletAddressInput: FC = ({ - {/*TODO: Uncomment Optimism */} + ) : isGnosis ? ( @@ -208,9 +208,9 @@ const WalletAddressInput: FC = ({ ) : isCelo ? ( + ) : isOptimism ? ( + ) : ( - //TODO: Uncomment Optimism ) : isOptimism ? ( - // )} @@ -230,9 +230,9 @@ const WalletAddressInput: FC = ({ ? 'Polygon Mainnet' : isCelo ? 'Celo Mainnet' - : //TODO: Uncomment Optimism : isOptimism - // ? 'Optimism Mainnet' - 'Mainnet', + : isOptimism + ? 'Optimism Mainnet' + : 'Mainnet', }, ) } diff --git a/src/components/views/verification/manageFunds/AddAddressModal.tsx b/src/components/views/verification/manageFunds/AddAddressModal.tsx index bd6eac60dd..9b636b738a 100644 --- a/src/components/views/verification/manageFunds/AddAddressModal.tsx +++ b/src/components/views/verification/manageFunds/AddAddressModal.tsx @@ -42,11 +42,11 @@ const networkOptions = [ label: 'Celo Mainnet', id: config.CELO_NETWORK_NUMBER, }, - // TODO: Uncomment Optimism { - // value: config.OPTIMISM_NETWORK_NUMBER, - // label: 'Optimism', - // id: config.OPTIMISM_NETWORK_NUMBER, - // }, + { + value: config.OPTIMISM_NETWORK_NUMBER, + label: 'Optimism', + id: config.OPTIMISM_NETWORK_NUMBER, + }, ]; export interface IAddressForm { diff --git a/src/services/token.ts b/src/services/token.ts index 94804ff6b5..2ae5b6afe1 100644 --- a/src/services/token.ts +++ b/src/services/token.ts @@ -51,9 +51,9 @@ export const fetchPrice = async (chainId: number, tokenAddress?: string) => { case config.CELO_NETWORK_NUMBER: chain = 'celo'; break; - //TODO: Uncomment Optimism case config.OPTIMISM_NETWORK_NUMBER: - // chain = 'optimistic-ethereum'; - // break; + case config.OPTIMISM_NETWORK_NUMBER: + chain = 'optimistic-ethereum'; + break; case config.POLYGON_NETWORK_NUMBER: chain = 'polygon-pos'; break;