Skip to content

Commit

Permalink
Merge branch 'main' into fix_bug_report
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerilym authored Aug 29, 2024
2 parents 769d333 + 3e0578f commit 32ef6a2
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 30 deletions.
19 changes: 11 additions & 8 deletions apps/staking/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import ChainBanner from '@/components/ChainBanner';
import Header from '@/components/Header';
import { GlobalProvider } from '@/providers/global-provider';
import { TOSHandler } from '@/components/TOSHandler';
import { RegistrationPausedInfo } from '@/components/RegistrationPausedInfo';
import { Banner } from '@session/ui/components/Banner';
import { getBuildInfo } from '@session/util/build';
import { Banner } from '@session/ui/components/Banner';
import { NewTokenContractInfo } from '@/components/NewTokenContractInfo';

const wagmiConfig = createWagmiConfig({
projectId: NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID,
Expand Down Expand Up @@ -45,12 +45,15 @@ export default async function RootLayout({ children }: { children: React.ReactNo
wagmiMetadata={wagmiMetadata}
>
<body className="bg-session-black text-session-text font-atyp-text overflow-x-hidden">
<ChainBanner />
<Banner><RegistrationPausedInfo /></Banner>
<Header />
<main>{children}</main>
{!isProduction ? <DevSheet buildInfo={buildInfo}/> : null}
<TOSHandler />
<ChainBanner />
<Banner>
<NewTokenContractInfo />
</Banner>
{/*<Banner><RegistrationPausedInfo /></Banner>*/}
<Header />
<main>{children}</main>
{!isProduction ? <DevSheet buildInfo={buildInfo} /> : null}
<TOSHandler />
</body>
<Toaster />
</GlobalProvider>
Expand Down
2 changes: 1 addition & 1 deletion apps/staking/app/register/[nodeId]/NodeRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { toast } from '@session/ui/lib/sonner';
import { RegistrationPausedInfo } from '@/components/RegistrationPausedInfo';

// TODO - remove with feature flag pr
const registrationPaused = true;
const registrationPaused = false;

export default function NodeRegistration({ nodeId }: { nodeId: string }) {
const showMockRegistration = useFeatureFlag(FEATURE_FLAG.MOCK_REGISTRATION);
Expand Down
49 changes: 49 additions & 0 deletions apps/staking/components/NewTokenContractInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use client';

import Link from 'next/link';
import { BASE_URL, SOCIALS, URL } from '@/lib/constants';
import { Social } from '@session/ui/components/SocialLinkList';
import { ReactNode } from 'react';
import { useTranslations } from 'next-intl';
import { useAddSessionTokenToWallet } from '@session/wallet/hooks/wallet-hooks';

export function NewTokenContractInfo() {
const dictionary = useTranslations('banner');
const { addToken } = useAddSessionTokenToWallet(`${BASE_URL}/images/token_logo.svg`);
return (
<span>
{dictionary.rich('newTokenContract', {
'remove-token-link': (children: ReactNode) => (
<Link
className="font-medium underline"
href={URL.REMOVE_TOKEN_FROM_WATCH_LIST}
referrerPolicy="no-referrer"
target="_blank"
>
{children}
</Link>
),
'watch-token': (children: ReactNode) => (
<a
className="cursor-pointer font-medium underline"
onClick={addToken}
referrerPolicy="no-referrer"
target="_blank"
>
{children}
</a>
),
link: (children: ReactNode) => (
<Link
className="font-medium underline"
href={SOCIALS[Social.Discord].link}
referrerPolicy="no-referrer"
target="_blank"
>
{children}
</Link>
),
})}
</span>
);
}
1 change: 1 addition & 0 deletions apps/staking/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export enum URL {
BUG_BOUNTY_PROGRAM = 'https://token.getsession.org/bug-bounty-program',
BUG_BOUNTY_TOS = 'https://token.getsession.org/bug-bounty-terms',
SESSION_NODE_SOLO_SETUP_DOCS = 'https://docs.getsession.org/class-is-in-session/session-stagenet-single-contributor-node-setup',
REMOVE_TOKEN_FROM_WATCH_LIST = 'https://support.metamask.io/managing-my-tokens/custom-tokens/how-to-remove-a-token/',
}

export const LANDING_BUTTON_URL = {
Expand Down
3 changes: 2 additions & 1 deletion apps/staking/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
"testnet": "You are currently on {testnetName}."
},
"banner": {
"registrationPaused": "Stagenet node registration is temporarily paused. Apologies for any inconvenience, we expect to be able to re-enable registrations soon. For updates, visit the <link>Session Token discord</link>."
"registrationPaused": "Stagenet node registration is temporarily paused. Apologies for any inconvenience, we expect to be able to re-enable registrations soon. For updates, visit the <link>Session Token discord</link>.",
"newTokenContract": "The Session Token contract has been updated. <remove-token-link>Remove the old token</remove-token-link> and <watch-token>add the new token contract</watch-token> to your wallet watch list to continue using the Staking Portal. If you have any questions, visit the <link>Session Token Discord</link>."
},
"modules": {
"title": {
Expand Down
25 changes: 6 additions & 19 deletions packages/contracts/abis/ServiceNodeRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const ServiceNodeRewardsAbi = [
},
{
internalType: 'address',
name: 'recipient',
name: 'contributor',
type: 'address',
},
],
Expand Down Expand Up @@ -326,7 +326,7 @@ export const ServiceNodeRewardsAbi = [
},
{
internalType: 'address',
name: 'recipient',
name: 'contributor',
type: 'address',
},
],
Expand Down Expand Up @@ -402,7 +402,7 @@ export const ServiceNodeRewardsAbi = [
{
indexed: false,
internalType: 'address',
name: 'recipient',
name: 'initiator',
type: 'address',
},
{
Expand Down Expand Up @@ -580,7 +580,7 @@ export const ServiceNodeRewardsAbi = [
{
indexed: false,
internalType: 'address',
name: 'recipient',
name: 'operator',
type: 'address',
},
{
Expand Down Expand Up @@ -617,7 +617,7 @@ export const ServiceNodeRewardsAbi = [
{
indexed: false,
internalType: 'address',
name: 'recipient',
name: 'operator',
type: 'address',
},
{
Expand Down Expand Up @@ -660,7 +660,7 @@ export const ServiceNodeRewardsAbi = [
{
indexed: false,
internalType: 'address',
name: 'recipient',
name: 'contributor',
type: 'address',
},
{
Expand Down Expand Up @@ -1597,19 +1597,6 @@ export const ServiceNodeRewardsAbi = [
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
internalType: 'uint64[]',
name: 'ids',
type: 'uint64[]',
},
],
name: 'removeNodeBySNID',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'renounceOwnership',
Expand Down
27 changes: 27 additions & 0 deletions packages/contracts/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,33 @@ export type ContractName = (typeof contracts)[number];

// TODO - Replace Mainnet addresses with the correct addresses once they are available
export const addresses: Record<ContractName, Record<CHAIN, Address>> = {
SENT: {
/** @deprecated - The Mainnet value is a mock value */
[CHAIN.MAINNET]: '0x70c1f36C9cEBCa51B9344121D284D85BE36CD6bB',
/** @deprecated - The Eth value is a mock value */
[CHAIN.ETHEREUM]: '0x70c1f36C9cEBCa51B9344121D284D85BE36CD6bB',
[CHAIN.TESTNET]: '0x70c1f36C9cEBCa51B9344121D284D85BE36CD6bB',
},
ServiceNodeRewards: {
/** @deprecated - The Mainnet value is a mock value */
[CHAIN.MAINNET]: '0xb691e7C159369475D0a3d4694639ae0144c7bAB2',
/** @deprecated - The Eth value is a mock value */
[CHAIN.ETHEREUM]: '0xb691e7C159369475D0a3d4694639ae0144c7bAB2',
[CHAIN.TESTNET]: '0xb691e7C159369475D0a3d4694639ae0144c7bAB2',
},
RewardRatePool: {
/** @deprecated - The Mainnet value is a mock value */
[CHAIN.MAINNET]: '0x84a648F74Eaf037dD9558987F6179E692d5F2566',
/** @deprecated - The Eth value is a mock value */
[CHAIN.ETHEREUM]: '0x84a648F74Eaf037dD9558987F6179E692d5F2566',
[CHAIN.TESTNET]: '0x84a648F74Eaf037dD9558987F6179E692d5F2566',
},
} as const;

/**
* @deprecated - Use {@link addresses} instead
*/
export const addressesV1: Record<ContractName, Record<CHAIN, Address>> = {
SENT: {
/** @deprecated - The Mainnet value is a mock value */
[CHAIN.MAINNET]: '0x7FBDC29b81e410eB0eaE75Dca64a76d898EAc4A9',
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/scripts/generate-abis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function downloadRepository({
// Clone the repository
execSync(`git clone ${url} ${destinationPath}`);
logger.info('Repository downloaded successfully!');
execSync(`cd ${destinationPath} && git switch integration`);
execSync(`cd ${destinationPath} && git switch master`);
} catch (error) {
logger.error('Error downloading repository:', error);
}
Expand Down

0 comments on commit 32ef6a2

Please sign in to comment.