-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into releases/mainnet/v1.1.0
- Loading branch information
Showing
16 changed files
with
459 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useEffect } from "react" | ||
import { useDispatch } from "react-redux" | ||
import { setMinStake } from "../store/staking" | ||
import { useTStakingContract } from "../web3/hooks" | ||
import { useStakingState } from "./useStakingState" | ||
|
||
export const useMinStakeAmount = () => { | ||
const tStakingContract = useTStakingContract() | ||
const { minStakeAmount } = useStakingState() | ||
const dispatch = useDispatch() | ||
|
||
useEffect(() => { | ||
const fetchMinStakeAmount = async () => { | ||
try { | ||
const minStakeAmount = await tStakingContract?.minTStakeAmount() | ||
dispatch(setMinStake({ amount: minStakeAmount.toString() })) | ||
} catch (error) { | ||
console.error("Could not fetch the min stake amount: ", error) | ||
} | ||
} | ||
if (minStakeAmount === "0" && tStakingContract) fetchMinStakeAmount() | ||
}, [tStakingContract, dispatch, minStakeAmount]) | ||
|
||
return minStakeAmount | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { FC, ComponentProps } from "react" | ||
import { List, ListItem } from "@chakra-ui/react" | ||
import Card from "../../../components/Card" | ||
import { Label3 } from "../../../components/Typography" | ||
import BoxLabel from "../../../components/BoxLabel" | ||
|
||
export const AboutAddressesCard: FC<ComponentProps<typeof Card>> = (props) => { | ||
return ( | ||
<Card {...props}> | ||
<Label3>about the Addresses you need to provide</Label3> | ||
<List mt="5" spacing="6"> | ||
{aboutAddresses.map((action) => ( | ||
<ListItem key={action.sectionName}> | ||
<BoxLabel w="fit-content" mb="5"> | ||
{action.sectionName} | ||
</BoxLabel> | ||
<List spacing="4"> | ||
{action.items.map((item, index) => ( | ||
<ListItem key={`${action.sectionName}-${index}`}> | ||
{item} | ||
</ListItem> | ||
))} | ||
</List> | ||
</ListItem> | ||
))} | ||
</List> | ||
</Card> | ||
) | ||
} | ||
|
||
const aboutAddresses = [ | ||
{ | ||
sectionName: "Provider Address", | ||
items: [ | ||
"It’s the address that will be used to set up your nodes. One Provider Address per Stake.", | ||
], | ||
}, | ||
{ | ||
sectionName: "Beneficiary Address", | ||
items: [ | ||
"This is the address where your rewards will be sent when claimed. You can have the same Beneficiary Address for multiple stakes.", | ||
], | ||
}, | ||
|
||
{ | ||
sectionName: "Authorizer Address", | ||
items: [ | ||
"This address authorizes which applications can use the funds from your staking pool. It can be the same as your Beneficiary Address. You can have the same Authorizer Address for multiple stakes.", | ||
], | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { FC, ComponentProps } from "react" | ||
import { Box } from "@chakra-ui/react" | ||
import Card from "../../../components/Card" | ||
import { | ||
PreSetupSteps, | ||
LegacyStakesDepositSteps, | ||
} from "../../../components/StakingChecklist" | ||
import { Body2, Label3 } from "../../../components/Typography" | ||
import ViewInBlockExplorer from "../../../components/ViewInBlockExplorer" | ||
import { ExplorerDataType } from "../../../utils/createEtherscanLink" | ||
|
||
export const LegacyStakesCard: FC< | ||
ComponentProps<typeof Card> & { tStakingContractAddress: string } | ||
> = ({ tStakingContractAddress, ...props }) => { | ||
return ( | ||
<Card {...props}> | ||
<Label3>legacy stakes</Label3> | ||
<Body2 mt="5" mb="5"> | ||
If you have an active stake on NuCypher or on Keep Network you can | ||
authorize the{" "} | ||
<ViewInBlockExplorer | ||
id={tStakingContractAddress} | ||
type={ExplorerDataType.ADDRESS} | ||
text="Threshold Staking Contract" | ||
/>{" "} | ||
on the legacy dashboard. | ||
</Body2> | ||
<LegacyStakesDepositSteps /> | ||
<Box mt="6"> | ||
<PreSetupSteps /> | ||
</Box> | ||
</Card> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { FC, ComponentProps } from "react" | ||
import Card from "../../../components/Card" | ||
import { Body2, Label3 } from "../../../components/Typography" | ||
import StakingChecklist from "../../../components/StakingChecklist" | ||
|
||
export const NewTStakesCard: FC<ComponentProps<typeof Card>> = (props) => { | ||
return ( | ||
<Card {...props}> | ||
<Label3>new threshold stakes</Label3> | ||
<Body2 mt="5" mb="5"> | ||
Before you start staking on Threshold Network, make sure you are aware | ||
of the following requirements: | ||
</Body2> | ||
<StakingChecklist /> | ||
</Card> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import { FC, ComponentProps } from "react" | ||
import { Box, List, ListItem, HStack } from "@chakra-ui/react" | ||
import Card from "../../../components/Card" | ||
import { Body1, Body3, Label3 } from "../../../components/Typography" | ||
import BoxLabel from "../../../components/BoxLabel" | ||
import ExternalLink from "../../../components/ExternalLink" | ||
import { ExternalHref } from "../../../enums" | ||
|
||
export const ProvidersCard: FC<ComponentProps<typeof Card>> = (props) => { | ||
return ( | ||
<Card {...props}> | ||
<Label3>threshold and pre staking providers</Label3> | ||
<List mt="6" spacing="4"> | ||
{providers.map(renderProviderListItem)} | ||
</List> | ||
|
||
<BoxLabel my="5" w="fit-content"> | ||
PRE Only | ||
</BoxLabel> | ||
<List mt="6" spacing="4"> | ||
{preOnlyProviders.map(renderProviderListItem)} | ||
</List> | ||
</Card> | ||
) | ||
} | ||
|
||
type ProviderItem = { | ||
name: string | ||
email: string | ||
link: ExternalHref | ||
} | ||
|
||
const ProviderListItem: FC<ProviderItem> = ({ name, email, link }) => ( | ||
<ListItem as={HStack} spacing="4" bg="gray.50" p="4" borderRadius="2"> | ||
<Box bg="brand.500" borderRadius="8px" w="48px" height="48px" /> | ||
<Box> | ||
<Body1>{name}</Body1> | ||
<Body3>{email}</Body3> | ||
</Box> | ||
<ExternalLink | ||
fontWeight="600" | ||
color="gray.700" | ||
ml="auto !important" | ||
text="Learn more" | ||
href={link} | ||
withArrow | ||
/> | ||
</ListItem> | ||
) | ||
|
||
const renderProviderListItem = (provider: ProviderItem) => ( | ||
<ProviderListItem key={provider.name} {...provider} /> | ||
) | ||
|
||
const providers = [ | ||
{ | ||
name: "Staked", | ||
email: "[email protected]", | ||
link: ExternalHref.stakedUs, | ||
}, | ||
{ | ||
name: "BisonTrails", | ||
email: "[email protected]", | ||
link: ExternalHref.bisonTrails, | ||
}, | ||
{ | ||
name: "BlockDaemon", | ||
email: "[email protected]", | ||
link: ExternalHref.blackDaemon, | ||
}, | ||
{ | ||
name: "Boar", | ||
email: "[email protected]", | ||
link: ExternalHref.boar, | ||
}, | ||
{ | ||
name: "Figment", | ||
email: "[email protected]", | ||
link: ExternalHref.figment, | ||
}, | ||
{ | ||
name: "Low Fee Validation", | ||
email: "[email protected]", | ||
link: ExternalHref.lowFeeValidation, | ||
}, | ||
] | ||
|
||
const preOnlyProviders = [ | ||
{ | ||
name: "Ankr", | ||
email: "[email protected]", | ||
link: ExternalHref.ankr, | ||
}, | ||
{ | ||
name: "P2P Validator", | ||
email: "[email protected]", | ||
link: ExternalHref.p2pValidator, | ||
}, | ||
{ | ||
name: "InfStones", | ||
email: "[email protected]", | ||
link: ExternalHref.infStones, | ||
}, | ||
] |
Oops, something went wrong.