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

Testnet referral #72

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
02bf948
feat: add string to bigint maths utilities
Aerilym Nov 3, 2024
cfe08ec
chore: update backend types
Aerilym Nov 4, 2024
0709069
feat: add shadcn ui slider and accordion
Aerilym Nov 4, 2024
0281f14
fix: tooltip wrap
Aerilym Nov 4, 2024
1cf80f8
fix: ui types
Aerilym Nov 4, 2024
966867d
feat: create locale-aware getDecimalDelimiter
Aerilym Nov 4, 2024
c2dda60
feat: create open node sorter
Aerilym Nov 4, 2024
313d479
feat: multi-contributor node registration and staking
Aerilym Nov 4, 2024
7622f0c
chore: fix linting issues
Aerilym Nov 4, 2024
0786293
chore: reduce contract text fuzz amount
Aerilym Nov 4, 2024
efad33a
fix: max stake amount import
Aerilym Nov 4, 2024
677ec2f
chore: fix linting
Aerilym Nov 5, 2024
14fa6f6
fix: remove mock data garbage
Aerilym Nov 5, 2024
f78983b
fix: move circle logic to its own component
Aerilym Nov 5, 2024
47d91d9
chore: add comment about tooltip buttons
Aerilym Nov 5, 2024
0b9c2ee
chore: add comment about true
Aerilym Nov 5, 2024
735c8ca
fix: localize not found strings
Aerilym Nov 5, 2024
cfdcae8
fix: refactor staked node card button and timer logic to fix deregist…
Aerilym Nov 5, 2024
3f70976
fix: bigint to string maths
Aerilym Nov 5, 2024
9974f3b
fix: show contributors on all nodes
Aerilym Nov 6, 2024
a5c2286
fix: minor list optimizations and strings
Aerilym Nov 6, 2024
3b5f7da
Merge pull request #1 from oxen-io/open_node_contract
Aerilym Nov 6, 2024
e83be47
fix: exiting awaiting node check
Aerilym Nov 6, 2024
8de74d7
fix: add is waiting to start states
Aerilym Nov 6, 2024
2a0833b
fix: add AWAITING_OPERATOR_START to enum
Aerilym Nov 6, 2024
75288bb
chore: disable eslint rule
Aerilym Nov 6, 2024
7dd8283
chore: ignore rss files
Aerilym Nov 6, 2024
c99b38b
Merge pull request #2 from session-foundation/fix/staked_card_states
Aerilym Nov 6, 2024
8498c41
Merge branch 'dev' into fix/bigint_decimal_string_maths
Aerilym Nov 6, 2024
5544a35
Merge pull request #3 from session-foundation/fix/bigint_decimal_stri…
Aerilym Nov 6, 2024
b180522
feat: referral program
Aerilym Nov 7, 2024
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ yarn-error.log*
# Databases
*.sqlite
*.sqlite3
*.db
*.db

rss.xml
3 changes: 2 additions & 1 deletion apps/staking/.env.local.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=
TELEGRAM_BOT_TOKEN=
NEXTAUTH_SECRET=
NEXTAUTH_URL=
NEXTAUTH_URL=
NEXT_PUBLIC_POINTS_PROGRAM_API=
20 changes: 15 additions & 5 deletions apps/staking/app/faucet/AuthModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ export const getFaucetFormSchema = () => {
}),
discordId: z.string().optional(),
telegramId: z.string().optional(),
code: z.string().optional(),
});
};

export type FaucetFormSchema = z.infer<ReturnType<typeof getFaucetFormSchema>>;

export const AuthModule = () => {
export const AuthModule = ({ code }: { code?: string }) => {
const dictionary = useTranslations('faucet.form');
const generalDictionary = useTranslations('general');
const [submitAttemptCounter, setSubmitAttemptCounter] = useState<number>(0);
Expand All @@ -88,6 +89,7 @@ export const AuthModule = () => {
walletAddress: '',
discordId: '',
telegramId: '',
code: code ?? '',
},
reValidateMode: 'onChange',
});
Expand Down Expand Up @@ -196,6 +198,12 @@ export const AuthModule = () => {
}
}, [address, ethAmount, form]); */

useEffect(() => {
if (code) {
toast.info(dictionary('referralCodeAdded'));
}
}, [code]);

useEffect(() => {
if (walletStatus === WALLET_STATUS.CONNECTED && address) {
form.clearErrors();
Expand Down Expand Up @@ -345,10 +353,12 @@ export const AuthModule = () => {
<>
<span className="text-center">- {generalDictionary('or')} -</span>
<WalletModalButtonWithLocales rounded="md" size="lg" className="uppercase" hideBalance />
<span className="inline-flex w-full flex-col gap-2 uppercase xl:flex-row [&>*]:flex-grow">
{!isConnected || (isConnected && discordId) ? <DiscordAuthButton /> : null}
{!isConnected || (isConnected && telegramId) ? <TelegramAuthButton /> : null}
</span>
{!code ? (
<span className="inline-flex w-full flex-col gap-2 uppercase xl:flex-row [&>*]:flex-grow">
{!isConnected || (isConnected && discordId) ? <DiscordAuthButton /> : null}
{!isConnected || (isConnected && telegramId) ? <TelegramAuthButton /> : null}
</span>
) : null}
</>
) : null}

Expand Down
44 changes: 44 additions & 0 deletions apps/staking/app/faucet/Faucet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { useTranslations } from 'next-intl';
import { NextAuthProvider } from '@session/auth/client';
import { formatDate, formatList } from '@/lib/locale-client';
import { COMMUNITY_DATE } from '@/lib/constants';
import { AuthModule } from '@/app/faucet/AuthModule';

export function Faucet({ code }: { code?: string }) {
const dictionary = useTranslations('faucet.information');
return (
<NextAuthProvider>
<div className="lg:-mt-header-displacement max-w-screen-3xl mx-auto flex w-screen flex-col-reverse items-center justify-around gap-16 px-4 py-16 align-middle xl:grid xl:h-dvh xl:grid-cols-2 xl:p-32 xl:py-0">
<div className="flex h-max flex-col gap-4 text-start">
<h1 className="text-5xl font-semibold">{dictionary('title')}</h1>
<h2 className="text-lg font-semibold">{dictionary('communityTitle')}</h2>
<p>
{dictionary.rich('communityDescription', {
connectionOptions: formatList(['Discord', 'Telegram']),
snapshotDate: formatDate(new Date(COMMUNITY_DATE.SESSION_TOKEN_COMMUNITY_SNAPSHOT), {
dateStyle: 'long',
}),
})}
</p>
<h2 className="text-lg font-semibold">{dictionary('oxenTitle')}</h2>
<p>
{dictionary.rich('oxenDescription', {
oxenRegistrationDate: formatDate(
new Date(COMMUNITY_DATE.OXEN_SERVICE_NODE_BONUS_PROGRAM),
{
dateStyle: 'long',
}
),
})}
</p>
<p>{dictionary('notEligible')}</p>
<h2 className="text-lg font-semibold">{dictionary('walletRequirementTitle')}</h2>
<p>{dictionary.rich('walletRequirementDescription')}</p>
</div>
<div className="h-max min-h-[400px]">
<AuthModule code={code} />
</div>
</div>
</NextAuthProvider>
);
}
14 changes: 14 additions & 0 deletions apps/staking/app/faucet/[code]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use client';

import { Faucet } from '@/app/faucet/Faucet';

interface FaucetCodePageParams {
params: {
code: string;
};
}

export default function FaucetCodePage({ params }: FaucetCodePageParams) {
const { code } = params;
return <Faucet code={code} />;
}
Loading
Loading