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

Feat/Showing base super tokens on user recurring tab #4902

Merged
merged 5 commits into from
Dec 23, 2024
Merged
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions public/images/tokens/USDCx.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/apollo/gql/gqlUser.ts
Original file line number Diff line number Diff line change
@@ -125,6 +125,7 @@ export const FETCH_USER_RECURRING_DONATIONS = gql`
$userId: Int!
$filteredTokens: [String!]
$includeArchived: Boolean
$networkId: Int
) {
recurringDonationsByUserId(
take: $take
@@ -135,6 +136,7 @@ export const FETCH_USER_RECURRING_DONATIONS = gql`
finishStatus: $finishStatus
filteredTokens: $filteredTokens
includeArchived: $includeArchived
networkId: $networkId
) {
recurringDonations {
id
Original file line number Diff line number Diff line change
@@ -142,8 +142,6 @@ export const DepositSuperToken: FC<IDepositSuperTokenProps> = ({
.parseUnits(currentAmount.toString(), 18)
.toBigInt();
}
console.log('token', token);
console.log('supertoken', superToken);
const upgradeOperation = await superTokenAsset.upgrade({
amount: newAmount.toString(),
});
@@ -186,6 +184,7 @@ export const DepositSuperToken: FC<IDepositSuperTokenProps> = ({
amount={amount}
setAmount={setAmount}
token={token}
recurringNetworkID={recurringNetworkID}
balance={balance}
refetch={refetch}
isRefetching={isRefetching}
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ export enum EModifySectionPlace {
interface IModifySectionProps {
titleLabel: string;
token?: IToken;
recurringNetworkID: number;
amount: bigint;
setAmount: Dispatch<SetStateAction<bigint>>;
balance?: GetBalanceReturnType;
@@ -45,6 +46,7 @@ interface IModifySectionProps {
export const ModifySection: FC<IModifySectionProps> = ({
titleLabel,
token,
recurringNetworkID,
amount,
setAmount,
balance,
@@ -62,7 +64,7 @@ export const ModifySection: FC<IModifySectionProps> = ({
setAmount(balance.value); // Set the amount to the balance value
};

const _token = findTokenByAddress(token?.id);
const _token = findTokenByAddress(token?.id, recurringNetworkID);
const ProperGlink =
modifySectionPlace === EModifySectionPlace.DEPOSIT
? CustomGLink
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ const ModifySuperTokenInnerModal: FC<
let superTokens: any[] = [];
if (props.recurringNetworkID === config.OPTIMISM_NETWORK_NUMBER) {
superTokens = config.OPTIMISM_CONFIG.SUPER_FLUID_TOKENS;
} else if (props.recurringNetworkID === config.POLYGON_NETWORK_NUMBER) {
} else if (props.recurringNetworkID === config.BASE_NETWORK_NUMBER) {
superTokens = config.BASE_CONFIG.SUPER_FLUID_TOKENS;
}

Original file line number Diff line number Diff line change
@@ -154,6 +154,7 @@ export const WithDrawSuperToken: FC<IWithDrawSuperTokenProps> = ({
amount={amount}
setAmount={setAmount}
token={superToken}
recurringNetworkID={recurringNetworkID}
// try to put in modified value in place of SuperTokenBalance.value
refetch={refetch}
balance={modifiedValue}
Original file line number Diff line number Diff line change
@@ -141,6 +141,7 @@ const SelectTokenInnerModal: FC<ISelectTokenModalProps> = ({
<StreamInfo
key={tokenId}
stream={tokenStreams[tokenId.toLowerCase()]}
recurringNetworkId={chain?.id}
superToken={token}
balance={balances[token.symbol]}
disable={
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ import { TokenIconWithGIVBack } from '../../TokenIcon/TokenIconWithGIVBack';

interface IStreamInfoProps {
stream: ISuperfluidStream[];
recurringNetworkId?: number;
superToken: IToken;
balance: bigint;
disable: boolean;
@@ -20,6 +21,7 @@ interface IStreamInfoProps {

export const StreamInfo: FC<IStreamInfoProps> = ({
stream,
recurringNetworkId,
balance,
superToken,
disable,
@@ -36,7 +38,7 @@ export const StreamInfo: FC<IStreamInfoProps> = ({
? balance / totalFlowRate / 2628000n
: 0n;

const token = findTokenByAddress(stream[0].token.id);
const token = findTokenByAddress(stream[0].token.id, recurringNetworkId);
const underlyingToken = token?.underlyingToken;
const activeStreamCount = countActiveStreams(stream);
return (
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ export const ActiveProjectsSection = () => {
const [loading, setLoading] = useState(false);
const [donations, setDonations] = useState<IWalletRecurringDonation[]>([]);
const [totalDonations, setTotalDonations] = useState<number>(0);
const [networkIds, setNetworkIds] = useState<number[]>([]);
const [page, setPage] = useState(0);
const [order, setOrder] = useState<IOrder>({
by: ERecurringDonationSortField.createdAt,
@@ -82,6 +83,7 @@ export const ActiveProjectsSection = () => {
finishStatus: statusFilters,
filteredTokens: tokenFilters,
includeArchived: myAccount ? showArchive : true,
networkId: networkIds.length === 1 ? networkIds[0] : 0,
},
});
setLoading(false);
@@ -103,7 +105,9 @@ export const ActiveProjectsSection = () => {
statusFilters,
tokenFilters,
trigger,
networkIds,
]);

return (
<Wrapper>
<Flex $justifyContent='space-between'>
@@ -122,6 +126,8 @@ export const ActiveProjectsSection = () => {
setStatusFilters={setStatusFilters}
tokenFilters={tokenFilters}
setTokenFilters={setTokenFilters}
networkIds={networkIds}
setNetworkIds={setNetworkIds}
/>
</Flex>
)}
Original file line number Diff line number Diff line change
@@ -52,6 +52,13 @@ export const ActiveStreamsSection: FC = () => {
})}
</B>
</TableHeader>
<TableHeader>
<B>
{formatMessage({
id: 'label.network',
})}
</B>
</TableHeader>
<TableHeader>
<B>
{formatMessage({
@@ -95,7 +102,7 @@ const DonationTableContainer = styled.div<{ $myAccount?: boolean }>`
grid-template-columns: ${props =>
props.$myAccount
? '1fr 4fr 1fr 1.5fr 1fr 1fr'
: 'auto auto auto auto auto'};
: 'auto auto auto auto auto auto'};
overflow: auto;
`;

Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ import { ISuperToken } from '@/types/superFluid';
import { PinkyColoredNumber } from '@/components/styled-components/PinkyColoredNumber';
import { TokenIcon } from '@/components/views/donate/TokenIcon/TokenIcon';
import { IRecurringDonationFiltersButtonProps } from './RecurringDonationFiltersButton';
import NetworkLogo from '@/components/NetworkLogo';

interface IFilterMenuProps extends IRecurringDonationFiltersButtonProps {
handleClose: (e?: any) => void;
@@ -33,6 +34,8 @@ export const FilterMenu = forwardRef<HTMLDivElement, IFilterMenuProps>(
setStatusFilters,
tokenFilters,
setTokenFilters,
networkIds,
setNetworkIds,
},
ref,
) => {
@@ -81,6 +84,83 @@ export const FilterMenu = forwardRef<HTMLDivElement, IFilterMenuProps>(
</FlexCenter>
</Header>
<Section>
<B>{formatMessage({ id: 'label.network' })}</B>
<FeatureItem>
<CheckBox
onChange={() => {
if (
networkIds.includes(
config.OPTIMISM_NETWORK_NUMBER,
)
) {
setNetworkIds(prev =>
prev.filter(
id =>
id !==
config.OPTIMISM_NETWORK_NUMBER,
),
);
} else {
setNetworkIds(prev => [
...prev,
config.OPTIMISM_NETWORK_NUMBER,
]);
}

handleClose();
}}
checked={networkIds.includes(
config.OPTIMISM_NETWORK_NUMBER,
)}
size={14}
>
<Flex $alignItems='center' gap='4px'>
<NetworkLogo
chainId={config.OPTIMISM_NETWORK_NUMBER}
logoSize={16}
/>
<GLink size='Medium'>Optimism</GLink>
</Flex>
</CheckBox>
</FeatureItem>
<FeatureItem>
<CheckBox
onChange={() => {
if (
networkIds.includes(
config.BASE_NETWORK_NUMBER,
)
) {
setNetworkIds(prev =>
prev.filter(
id =>
id !==
config.BASE_NETWORK_NUMBER,
),
);
} else {
setNetworkIds(prev => [
...prev,
config.BASE_NETWORK_NUMBER,
]);
}

handleClose();
}}
checked={networkIds.includes(
config.BASE_NETWORK_NUMBER,
)}
size={14}
>
<Flex $alignItems='center' gap='4px'>
<NetworkLogo
chainId={config.BASE_NETWORK_NUMBER}
logoSize={16}
/>
<GLink size='Medium'>Base</GLink>
</Flex>
</CheckBox>
</FeatureItem>
<B>{formatMessage({ id: 'label.tokens' })}</B>
{config.OPTIMISM_CONFIG.SUPER_FLUID_TOKENS.map(token => (
<FeatureItem key={token.id}>
@@ -105,6 +185,34 @@ export const FilterMenu = forwardRef<HTMLDivElement, IFilterMenuProps>(
</CheckBox>
</FeatureItem>
))}
{config.BASE_CONFIG.SUPER_FLUID_TOKENS.filter(
token =>
token.underlyingToken.symbol !== 'USDC' &&
token.underlyingToken.symbol !== 'DAI' &&
token.underlyingToken.symbol !== 'ETH',
).map(token => (
<FeatureItem key={token.id}>
<CheckBox
onChange={e => {
handleSelectFilter(e, token);
}}
checked={tokenFilters.includes(
token.underlyingToken.symbol,
)}
size={14}
>
<Flex $alignItems='center' gap='4px'>
<TokenIcon
symbol={token.underlyingToken.symbol}
size={16}
/>
<GLink size='Medium'>
{token.underlyingToken.symbol}
</GLink>
</Flex>
</CheckBox>
</FeatureItem>
))}
</Section>
<Section>
<B>{formatMessage({ id: 'label.state' })}</B>
Original file line number Diff line number Diff line change
@@ -22,6 +22,8 @@ export interface IRecurringDonationFiltersButtonProps {
setTokenFilters: Dispatch<SetStateAction<string[]>>;
statusFilters: IFinishStatus;
setStatusFilters: Dispatch<SetStateAction<IFinishStatus>>;
networkIds: number[];
setNetworkIds: Dispatch<SetStateAction<number[]>>;
}

export const RecurringDonationFiltersButton: FC<
@@ -64,6 +66,8 @@ export const RecurringDonationFiltersButton: FC<
isOpen={isFilterOpen}
handleClose={handleFilterClose}
ref={filterMenuRef}
networkIds={props.networkIds}
setNetworkIds={props.setNetworkIds}
/>
)}
</Relative>
Loading

Unchanged files with check annotations Beta

!isBypassingMaintenance;
useEffect(() => {
const handleStart = (url: string) => {

Check warning on line 128 in pages/_app.tsx

GitHub Actions / build

'url' is defined but never used. Allowed unused args must match /^_/u
NProgress.start();
};
const handleChangeComplete = (url: string) => {
}
};
asyncFunc();
}, []);

Check warning on line 185 in pages/_app.tsx

GitHub Actions / build

React Hook useEffect has missing dependencies: 'asPath', 'pathname', 'query', and 'router'. Either include them or remove the dependency array
return (
<>
return () => {
dispatch(setShowFooter(true));
};
}, []);

Check warning on line 28 in pages/donate/[slug].tsx

GitHub Actions / build

React Hook useEffect has a missing dependency: 'dispatch'. Either include it or remove the dependency array
return (
<DonateProvider project={project}>
target='_blank'
rel='noopener noreferrer'
>
<img

Check warning on line 21 in pages/gitcoingrants.tsx

GitHub Actions / build

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
alt='gitcoin alpha is here'
style={{ objectFit: 'cover' }}
src={
/>
</Link>
</Description>
<img

Check warning on line 73 in pages/gitcoingrants.tsx

GitHub Actions / build

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
alt='gitcoin alpha is here'
src='/images/banners/giveth-gitcoin-alpha.png'
/>
/>
</Link>
</Description>
<img

Check warning on line 102 in pages/gitcoingrants.tsx

GitHub Actions / build

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
alt='gitcoin alpha is here'
src='/images/banners/refi-gitcoin-alpha.png'
/>
useEffect(() => {
dispatch(setShowFooter(false));
}, []);

Check warning on line 20 in pages/notifications/settings.tsx

GitHub Actions / build

React Hook useEffect has a missing dependency: 'dispatch'. Either include it or remove the dependency array
if (isLoading) {
return <WrappedSpinner />;
});
const fetchProjects = async () => {
const res = await client.query({

Check warning on line 69 in pages/test1.tsx

GitHub Actions / build

'res' is assigned a value but never used. Allowed unused vars must match /^_/u
query: FETCH_ALL_PROJECTS,
fetchPolicy: 'no-cache',
});
console.log({ underlyingToken });
const erc20Contract = new ethers.Contract(

Check warning on line 256 in pages/test2.tsx

GitHub Actions / build

'erc20Contract' is assigned a value but never used. Allowed unused vars must match /^_/u
selectedToken, // Underlying ERC-20 token address
[
'function approve(address spender, uint256 amount) public returns (bool)',
return () => {
dispatch(setShowFooter(true));
};
}, []);

Check warning on line 15 in pages/verification/[slug]/[token].tsx

GitHub Actions / build

React Hook useEffect has a missing dependency: 'dispatch'. Either include it or remove the dependency array
return <EmailVerificationIndex />;
}