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 people parachain #124

Merged
merged 24 commits into from
Sep 25, 2024
Merged

Add people parachain #124

merged 24 commits into from
Sep 25, 2024

Conversation

wirednkod
Copy link
Member

@wirednkod wirednkod commented Sep 10, 2024

closes #123


Submission checklist:

Functionality

  • Connect the people parachain based on the relay chain that is currently connected

Layout

  • Add information on the Delegators card

Copy link

cloudflare-workers-and-pages bot commented Sep 10, 2024

Deploying delegit with  Cloudflare Pages  Cloudflare Pages

Latest commit: d8db388
Status: ✅  Deploy successful!
Preview URL: https://1313b942.delegit.pages.dev
Branch Preview URL: https://nik-prepare-people-parachain.delegit.pages.dev

View logs

@wirednkod wirednkod marked this pull request as ready for review September 23, 2024 17:56
@wirednkod wirednkod requested a review from Tbaut as a code owner September 23, 2024 17:56
@wirednkod
Copy link
Member Author

Screenshot 2024-09-23 at 20 53 35
Screenshot 2024-09-23 at 20 55 24
Screenshot 2024-09-23 at 20 55 46

Copy link
Contributor

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I didn't play with it yet and just went through the code.
I see a lot of useEffect with the retrieveidentity where it could have been done probably nicely in a custom useidentity(address) hook, that returns the identity.

I see you're not fetching the judgement yet. it can be added later, but I would show no checkmark then for the mean time.

src/components/IdentityInfo.tsx Outdated Show resolved Hide resolved
src/components/IdentityInfo.tsx Outdated Show resolved Hide resolved
src/components/IdentityInfo.tsx Outdated Show resolved Hide resolved
src/components/ui/address-display.tsx Outdated Show resolved Hide resolved
src/contexts/NetworkContext.tsx Outdated Show resolved Hide resolved
src/lib/utils.ts Outdated Show resolved Hide resolved
src/lib/utils.ts Outdated Show resolved Hide resolved
src/lib/utils.ts Outdated Show resolved Hide resolved
src/pages/Delegate/index.tsx Outdated Show resolved Hide resolved
src/pages/Delegate/index.tsx Outdated Show resolved Hide resolved
@wirednkod wirednkod requested a review from Tbaut September 24, 2024 08:55
src/contexts/AccountsContext.tsx Outdated Show resolved Hide resolved
src/contexts/NetworkContext.tsx Outdated Show resolved Hide resolved
src/contexts/NetworkContext.tsx Outdated Show resolved Hide resolved
src/hooks/useIdentity.tsx Outdated Show resolved Hide resolved
src/hooks/useIdentity.tsx Outdated Show resolved Hide resolved
src/hooks/useIdentity.tsx Outdated Show resolved Hide resolved
src/lib/utils.ts Outdated Show resolved Hide resolved
src/pages/Delegate/index.tsx Outdated Show resolved Hide resolved
@wirednkod wirednkod requested a review from Tbaut September 24, 2024 18:34
Comment on lines +24 to +27
type AccountAddressType = {
address: string
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix this in a subsequent PR

@@ -50,7 +54,7 @@ const AccountContextProvider = ({ children }: AccountContextProps) => {
useEffect(() => {
if (localStorageAccount) {
const account = accounts.find(
(account) => account.address === localStorageAccount,
({ address }: AccountAddressType) => address === localStorageAccount,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accounts is of type PolkadotAccount[] so the type is inferred. You don't need to declare anything.

Suggested change
({ address }: AccountAddressType) => address === localStorageAccount,
({ address }) => address === localStorageAccount,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not needed any more is it? I'd put the network wss in the networks.json file, under the other networks. But I can do this in another PR.

}

const descriptor = descriptorName[network]
const typedApi = client.getTypedApi(descriptor)

const descriptorPeople = descriptorPeopleName[peopleNetwork!]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need of an assertion here, it's set in any case.

Suggested change
const descriptorPeople = descriptorPeopleName[peopleNetwork!]
const descriptorPeople = descriptorPeopleName[peopleNetwork]

src/lib/types.ts Outdated
Comment on lines 46 to 49
export type PeopleNetworkType = {
nodes: NameUrl[]
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May not be needed if removed.

src/lib/utils.ts Outdated
@@ -24,6 +32,16 @@ export const getChainInformation = (networkName: NetworksFromConfig) => {
}
}

export const getPeopleChainInformation = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used any more

src/lib/utils.ts Outdated
import { DEFAULT_TIME, lockPeriod, ONE_DAY, THRESHOLD } from './constants'
import { bnMin } from './bnMin'

const randomFromInterval = (min: number, max: number) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used any more

@@ -101,6 +101,8 @@ export const Delegate = () => {
setAmountVisible('0')
}, [api])

if (!delegate || !api) return <div>No delegate found</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove, unless you're fixing a known bug, there is no need for this, this is handled below.

@Tbaut Tbaut merged commit 7eeb699 into main Sep 25, 2024
3 checks passed
@Tbaut Tbaut deleted the nik-prepare-people-parachain branch September 25, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add people parachain connection
2 participants