Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add solana to create project #3523

Merged
merged 35 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
83f53de
add solana to AddressInterface
RamRamez Dec 21, 2023
be7ece0
add solana to CreateProject.tsx
RamRamez Dec 21, 2023
ee208e3
add solana to CreateProjectAddAddressModal.tsx
RamRamez Dec 21, 2023
8ccbefe
add solana to WalletAddressInput.tsx
RamRamez Dec 21, 2023
9378c32
Merge branch 'develop' into add-solana-to-create-project
RamRamez Dec 21, 2023
b7b4956
add type to translations
RamRamez Dec 23, 2023
719479c
add chainType to addresses in all graphql
RamRamez Dec 23, 2023
5a15b2c
add findAddressByChain
RamRamez Dec 23, 2023
7c7874e
add solana to IWalletAddress type
RamRamez Dec 23, 2023
963e344
fix isSolanaAddress
RamRamez Dec 23, 2023
2f098c3
add solana icon
RamRamez Dec 24, 2023
1b4ebf5
add solana to config
RamRamez Dec 24, 2023
b14b354
add solana logo
RamRamez Dec 24, 2023
f55af87
rename chainNameById function
RamRamez Dec 24, 2023
87b34dc
auto add non eth chains in create project
RamRamez Dec 24, 2023
c7f0b73
update chainNameById func
RamRamez Dec 24, 2023
74ffbf4
rename NETWORKS_CONFIG and add NON_EVM_NETWORKS_CONFIG
RamRamez Dec 24, 2023
b10783d
add NON_EVM_NETWORKS_CONFIG type and config file
RamRamez Dec 24, 2023
5edb550
update develop and production config
RamRamez Dec 24, 2023
d2db20e
add solana to donations table in project view
RamRamez Dec 24, 2023
aa5461c
fix type error
RamRamez Dec 24, 2023
317e695
add solana to verification manage funds
RamRamez Dec 24, 2023
f488261
Merge branch 'develop' into add-solana-to-create-project
RamRamez Dec 24, 2023
16ab920
Merge branch 'develop' into add-solana-to-create-project
RamRamez Dec 24, 2023
0bccf8b
shorten NetworkLogo conditions
RamRamez Dec 25, 2023
03836e6
fix findAddressByChain
RamRamez Dec 25, 2023
2a31aee
revert removing onSubmit
RamRamez Dec 25, 2023
bf11bc8
use networksConfig instead of CHAINS
RamRamez Dec 25, 2023
0fee85c
Update src/components/views/verification/manageFunds/AddAddressModal.tsx
RamRamez Dec 25, 2023
a4e1653
Merge branch 'develop' into add-solana-to-create-project
RamRamez Dec 25, 2023
1347a88
add import NonEVMNetworkConfig
RamRamez Dec 25, 2023
b114379
fix storage data for addresses
RamRamez Dec 25, 2023
26007ac
add feature flag for solana
RamRamez Dec 25, 2023
2d9e499
doing some unnecessary changes
RamRamez Dec 26, 2023
cfe85b7
Merge branch 'develop' into add-solana-to-create-project
aminlatifi Dec 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lang/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"label.enter_your_phone_number_and_click_next": "Introdueix el teu número de telèfon i fes clic a Següent.",
"label.estimated_matching": "Estimated matching",
"label.ethereum_mainnet_or_gnosis_chain": "Ethereum Mainnet o Gnosis Chain",
"label.eth_addres_not_valid": "Adreça Eth no és vàlida",
"label.eth_addres_not_valid": "Adreça {type} no és vàlida",
"label.everytime_you_claim_giv_rewards": "Cada vegada que reclames les teves recompenses de GIV de GIVbacks, GIVgarden o GIVfarm, la teva taxa de flux de GIVstream augmenta. A continuació, es mostra un resum.",
"label.expected_rank_for_next_round": "This is the expected rank for the next round based on",
"label.explore_a_multiverse_of_projects": "Explora un multivers de projectes que estan canviant el món i obté recompenses proveint liquiditat.",
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"label.enter_your_phone_number_and_click_next": "Enter your phone number and click next.",
"label.estimated_matching": "Estimated matching",
"label.ethereum_mainnet_or_gnosis_chain": "Ethereum Mainnet or Gnosis Chain",
"label.eth_addres_not_valid": "Eth address not valid",
"label.eth_addres_not_valid": "{type} address not valid",
"label.everytime_you_claim_giv_rewards": "Every time you claim GIV rewards from GIVbacks, the GIVgarden, or the GIVfarm, your GIVstream flowrate increases. Below is a summary.",
"label.expected_rank_for_next_round": "This is the expected rank for the next round based on",
"label.explore_a_multiverse_of_projects": "Explore a multiverse of projects changing the world and earn rewards for staking liquidity.",
Expand Down
2 changes: 1 addition & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"label.enter_your_phone_number_and_click_next": "Ingresa tu numero de teléfono y presiona siguiente.",
"label.estimated_matching": "Estimated matching",
"label.ethereum_mainnet_or_gnosis_chain": "Ethereum Mainnet o Gnosis Chain",
"label.eth_addres_not_valid": "Dirección Eth no es válida",
"label.eth_addres_not_valid": "Dirección {type} no es válida",
"label.everytime_you_claim_giv_rewards": "Cada vez que reclamas tus recompensas en GIV desde GIVbacks, GIVgarden, o GIVfarm, tu GIVstram flowrate incrementa. A continuación un resumen.",
"label.expected_rank_for_next_round": "This is the expected rank for the next round based on",
"label.explore_a_multiverse_of_projects": "Explora un multiverso de proyectos que están cambiando al mundo y obtén recompensas proveyendo liquidez.",
Expand Down
2 changes: 1 addition & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
icons: ['https://giveth.io/images/currencies/giv/24.svg'],
};

const chains = config.CHAINS;
const chains = config.EVM_CHAINS;
const { publicClient } = configureChains(chains, [
walletConnectProvider({ projectId }),
publicProvider(),
Expand Down Expand Up @@ -193,7 +193,7 @@
}
};
asyncFunc();
}, []);

Check warning on line 196 in pages/_app.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has missing dependencies: 'asPath', 'pathname', 'query', and 'router'. Either include them or remove the dependency array

return (
<>
Expand Down
5 changes: 3 additions & 2 deletions pages/test2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import config from '@/configuration';

const YourApp = () => {
const { address, isConnected, status } = useAccount();

Check warning on line 9 in pages/test2.tsx

View workflow job for this annotation

GitHub Actions / build

'isConnected' is assigned a value but never used. Allowed unused vars must match /^_/u
const { chain } = useNetwork();
const chainId = chain?.id;
// console.log('address', address, isConnected, status, chainId);
Expand Down Expand Up @@ -41,9 +41,10 @@
approveERC20tokenTransfer(
1000000000000000000n,
address!,
config.NETWORKS_CONFIG[chainId]?.GIVPOWER
config.EVM_NETWORKS_CONFIG[chainId]?.GIVPOWER
?.LM_ADDRESS!,
config.NETWORKS_CONFIG[chainId].GIV_TOKEN_ADDRESS!,
config.EVM_NETWORKS_CONFIG[chainId]
.GIV_TOKEN_ADDRESS!,
chainId,
false,
);
Expand Down
7 changes: 7 additions & 0 deletions src/apollo/gql/gqlProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const FETCH_PROJECT_BY_SLUG = gql`
address
isRecipient
networkId
chainType
}
totalProjectUpdates
creationDate
Expand Down Expand Up @@ -203,6 +204,7 @@ export const FETCH_PROJECT_BY_ID = gql`
address
isRecipient
networkId
chainType
}
impactLocation
categories {
Expand All @@ -227,6 +229,7 @@ export const FETCH_GIVETH_PROJECT_BY_ID = gql`
address
isRecipient
networkId
chainType
}
slug
}
Expand Down Expand Up @@ -401,6 +404,7 @@ export const CREATE_PROJECT = gql`
addresses {
address
networkId
chainType
}
categories {
name
Expand Down Expand Up @@ -428,6 +432,7 @@ export const UPDATE_PROJECT = gql`
addresses {
address
networkId
chainType
}
impactLocation
categories {
Expand Down Expand Up @@ -466,6 +471,7 @@ export const ADD_RECIPIENT_ADDRESS_TO_PROJECT = gql`
address
isRecipient
networkId
chainType
}
adminUser {
id
Expand All @@ -477,6 +483,7 @@ export const ADD_RECIPIENT_ADDRESS_TO_PROJECT = gql`
address
isRecipient
networkId
chainType
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/apollo/gql/gqlUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const FETCH_USER_PROJECTS = gql`
address
isRecipient
networkId
chainType
}
projectVerificationForm {
status
Expand Down
92 changes: 1 addition & 91 deletions src/apollo/gql/gqlVerification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const gqlRes = `{
relatedAddresses {
address
networkId
chainType
title
}
}
Expand All @@ -67,97 +68,6 @@ const gqlRes = `{
lastStep
}`;

export const GET_CURRENT_PROJECT_VERIFICATION_FORM = `
query getCurrentProjectVerificationForm($projectId: Float!){
getCurrentProjectVerificationForm(projectId: $projectId) {
id
isTermAndConditionsAccepted
email
emailConfirmationToken
emailConfirmationSent
emailConfirmationSentAt
emailConfirmedAt
emailConfirmed
projectRegistry {
organizationDescription
isNonProfitOrganization
organizationCountry
organizationWebsite
}
projectContacts {
name
url
}
milestones {
mission
foundationDate
achievedMilestones
achievedMilestonesProofs
}
managingFunds {
description
relatedAddresses {
address
networkId
title
}
}
user {
id
walletAddress
}
project {
id
slug
}
status
lastStep
}
}
`;

export const FETCH_PROJECT_BY_SLUG = `
query ProjectBySlug($slug: String!, $connectedWalletUserId: Int) {
projectBySlug(
slug: $slug
connectedWalletUserId: $connectedWalletUserId
) {
id
title
image
slug
description
verified
walletAddress
totalProjectUpdates
totalDonations
creationDate
reaction {
id
userId
}
totalReactions
categories {
name
}
adminUser {
id
name
walletAddress
}
status {
id
name
}
organization {
name
label
supportCustomTokens
}
}
}
`;

export const CREATE_PROJECT_VERIFICATION = gql`
mutation createProjectVerificationForm($slug: String!) {
createProjectVerificationForm(slug: $slug)
Expand Down
4 changes: 3 additions & 1 deletion src/apollo/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
EProjectsSortBy,
} from '@/apollo/types/gqlEnums';
import { IAddress } from '@/components/views/verification/manageFunds/ManageFundsIndex';
import { ChainType } from '@/types/config';

export interface IProjectPower {
powerRank: number;
Expand Down Expand Up @@ -140,9 +141,10 @@ export interface ICampaign {
}

export interface IWalletAddress {
address?: `0x${string}`;
address?: string;
isRecipient?: boolean;
networkId?: number;
chainType?: ChainType;
}

export interface IProjectEdition {
Expand Down
6 changes: 3 additions & 3 deletions src/components/ArchiveAndNetworkCover/WrongNetworkCover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styled from 'styled-components';
import { useNetwork } from 'wagmi';
import { Cover } from './common';
import { Flex } from '../styled-components/Flex';
import { chainNameById } from '@/lib/network';
import { getChainName } from '@/lib/network';

interface IWrongNetworkCoverProps {
targetNetwork: number;
Expand All @@ -32,8 +32,8 @@ export const WrongNetworkCover: FC<IWrongNetworkCoverProps> = ({
id: 'label.wrong_network',
},
{
chainName: chainNameById(chainId || 0),
targetChain: chainNameById(targetNetwork || 0),
chainName: getChainName(chainId || 0),
targetChain: getChainName(targetNetwork || 0),
},
)}
</Content>
Expand Down
2 changes: 1 addition & 1 deletion src/components/GIVeconomyPages/GIVstream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ export const GIVstreamHistory: FC = () => {
<TxHash
as='a'
size='Big'
href={`${config.NETWORKS_CONFIG[chainId]?.blockExplorers?.default.url}/tx/${tokenAllocation.txHash}`}
href={`${config.EVM_NETWORKS_CONFIG[chainId]?.blockExplorers?.default.url}/tx/${tokenAllocation.txHash}`}
target='_blank'
>
{shortenAddress(
Expand Down
5 changes: 2 additions & 3 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from '@giveth/ui-design-system';
import { useIntl } from 'react-intl';
import { useNetwork } from 'wagmi';
import { useWeb3Modal } from '@web3modal/wagmi/react';
import { Flex, FlexSpacer } from '@/components/styled-components/Flex';
import {
ConnectButton,
Expand Down Expand Up @@ -73,7 +72,8 @@ const Header: FC<IHeader> = () => {
const chainId = chain?.id;

const networkHasGIV =
(chainId && config.NETWORKS_CONFIG[chainId]?.GIV_TOKEN_ADDRESS) ?? null;
(chainId && config.EVM_NETWORKS_CONFIG[chainId]?.GIV_TOKEN_ADDRESS) ??
null;
const dispatch = useAppDispatch();
const { isEnabled, isSignedIn, userData } = useAppSelector(
state => state.user,
Expand All @@ -87,7 +87,6 @@ const Header: FC<IHeader> = () => {
const { formatMessage } = useIntl();
const isDesktop = useMediaQuery(device.laptopL);
const isMobile = useMediaQuery(device.mobileL);
const { open: openConnectModal } = useWeb3Modal();

const isGIVeconomyRoute = checkIsGIVeconomyRoute(router.route);

Expand Down
17 changes: 17 additions & 0 deletions src/components/Icons/Solana.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React, { FC } from 'react';
import Image from 'next/image';
import { ICurrencyIconProps } from './type';

const IconSolana: FC<ICurrencyIconProps> = ({ size = 16 }) => {
return (
<Image
src={'/images/tokens/SOLANA.svg'}
alt='Solana icon'
width={size}
height={size}
loading='lazy'
/>
);
};

export default IconSolana;
26 changes: 20 additions & 6 deletions src/components/NetworkLogo.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
import config from '@/configuration';
import { ChainType } from '@/types/config';

const networkIds = Object.keys(config.NETWORKS_CONFIG).map(Number);
const networkIds = Object.keys(config.EVM_NETWORKS_CONFIG).map(Number);
const networkTypes = Object.keys(config.NON_EVM_NETWORKS_CONFIG);

const NetworkLogo = (props: { chainId?: number; logoSize?: number }) => {
const { chainId, logoSize } = props;
if (chainId && networkIds.includes(chainId)) {
return config.NETWORKS_CONFIG[chainId].chainLogo(logoSize);
} else return null;
interface INetworkLogoProps {
chainId?: number;
logoSize?: number;
chainType?: ChainType;
}

const NetworkLogo = (props: INetworkLogoProps) => {
const { chainId, logoSize, chainType } = props;
if (
(chainId && networkIds.includes(chainId)) ||
(chainType && networkTypes.includes(chainType))
) {
return config.NETWORKS_CONFIG[(chainId || chainType)!]?.chainLogo(
logoSize,
);
}
return null;
};

export default NetworkLogo;
4 changes: 2 additions & 2 deletions src/components/RewardCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { useAppSelector } from '@/features/hooks';
import { WrongNetworkInnerModal } from '@/components//modals/WrongNetworkInnerModal';
import NetworkLogo from './NetworkLogo';
import { ScaleRate, ScaleRateBig } from '@/lib/constants/constants';
import { chainNameById } from '@/lib/network';
import { getChainName } from '@/lib/network';

interface IRewardCardProps {
cardName: string;
Expand Down Expand Up @@ -84,7 +84,7 @@ export const RewardCard: FC<IRewardCardProps> = ({
<ChainInfo alignItems='center'>
<NetworkLogo chainId={network} logoSize={16} />
<ChainName styleType='Small'>
{chainNameById(network)}
{getChainName(network)}
</ChainName>
</ChainInfo>
</CardHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const StakingPoolInfoAndActions: FC<IStakingPoolInfoAndActionsProps> = ({
provideLiquidityLink,
} = poolStakingConfig;
const regenStreamConfig = regenStreamType
? config.NETWORKS_CONFIG[poolNetwork].regenStreams?.find(
? config.EVM_NETWORKS_CONFIG[poolNetwork].regenStreams?.find(
regenStream => regenStream.type === regenStreamType,
)
: undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const GIVpowerCardIntro: FC<IGIVpowerCardIntro> = ({
const { formatMessage } = useIntl();
const [showLockDetailModal, setShowLockDetailModal] = useState(false);
const { stakedAmount } = useStakingPool(
config.NETWORKS_CONFIG[poolNetwork].GIVPOWER ||
config.EVM_NETWORKS_CONFIG[poolNetwork].GIVPOWER ||
config.GNOSIS_CONFIG.GIVPOWER,
);
const currentValues = useAppSelector(state => state.subgraph.currentValues);
Expand Down
Loading
Loading