generated from scaffold-eth/scaffold-eth-2
-
Notifications
You must be signed in to change notification settings - Fork 4
Fetch builders and user roles data from SRE #148
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4574fd5
Fetch builders and users data from SRE
Pabl0cks 3ce9d53
Use type
Pabl0cks 199aa5b
Fix lint errors
Pabl0cks fb82146
Add new service for sre api and refactor
Pabl0cks 324ff40
Fix SocialLinks import
Pabl0cks 526ea7a
Merge branch 'main' into builderdata-origin-sre
Pabl0cks 84d8100
Merge branch 'main' into builderdata-origin-sre
Pabl0cks 0ddef3c
Delete unused types
Pabl0cks ce96464
Update schema to match SRE api response
Pabl0cks e6f63dc
Add try catch and tweak field naming
Pabl0cks 59c729c
Delete intermediate api and delete isBuilderPresent
Pabl0cks 999854d
Update field naming
Pabl0cks eb27a38
Delete isBuilderPresent logic
Pabl0cks c8fa676
Delete unsed useBGBuilderData
Pabl0cks 2f33fe5
Extract SRE ENDPOINT
carletex 9ac344e
Twitter => x. Links and Icon
carletex 2f506ef
Remove cohort commented out
carletex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,24 @@ | ||
| import { BuilderData, SocialLinks } from "./schema"; | ||
|
|
||
| export async function fetchBuilderData(address: string): Promise<BuilderData | undefined> { | ||
| const res = await fetch(`https://speedrunethereum.com/api/users/${address}`); | ||
Pabl0cks marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (!res.ok) return undefined; | ||
| const apiData = await res.json(); | ||
| const user = apiData.user; | ||
| const socialLinks: SocialLinks = { | ||
| telegram: user.socialTelegram, | ||
| twitter: user.socialX, | ||
| github: user.socialGithub, | ||
| instagram: user.socialInstagram, | ||
| discord: user.socialDiscord, | ||
| email: user.socialEmail, | ||
| }; | ||
Pabl0cks marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return { | ||
| id: user.userAddress, | ||
| role: user.role ? user.role.toLowerCase() : undefined, | ||
| socialLinks, | ||
| batch: user.batchId | ||
| ? { number: String(Number(user.batchId) - 1), status: user.batchStatus } | ||
| : undefined, | ||
| }; | ||
| } | ||
This file contains hidden or 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,20 @@ | ||
| export type SocialLinks = { | ||
| twitter?: string; | ||
| github?: string; | ||
| discord?: string; | ||
| telegram?: string; | ||
| instagram?: string; | ||
| email?: string; | ||
| }; | ||
Pabl0cks marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export type BuilderData = { | ||
| id: string; | ||
| role?: "anonymous" | "user" | "admin"; | ||
| socialLinks?: SocialLinks; | ||
| batch?: { number: string; status: string }; | ||
| }; | ||
|
|
||
| export type BuilderDataResponse = { | ||
| exists: boolean; | ||
| data?: BuilderData; | ||
| }; | ||
This file contains hidden or 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
Pabl0cks marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.