-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feat(tokens): add helpers for fetching metadata #77
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 36bb9f1 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Change: +4.3 kB (+18%) Total Size: 27.8 kB
ℹ️ View Unchanged
|
* @returns {Promise<any>} The action parameters extracted from the quest data. | ||
*/ | ||
export async function fetchQuestActionParams(uuid: string): Promise<any> { | ||
const endpoint = `https://api.rabbithole.gg/v1.2/quest/public/${uuid}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would add a TODO or open up an issue to update this endpoint to a Boost API in the near future
} | ||
|
||
/** | ||
* Fetches the media URL from ERC1155 token metadata and performs basic validation or sanitization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think there's "basic validation or sanitization"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's not - I'll change this comment we discussed using a service for this but I think we're just going to handle it with the dom purify in the front-end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth purifying on the BE wherever we serve the info to prevent passing dangerous data to third party clients or w/e
* @param {string} uuid The UUID of the quest. | ||
* @returns {Promise<any>} The metadata of the ERC1155 token associated with the quest. | ||
*/ | ||
export async function fetchERC1155MetadataByUUID( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Wonder if it makes sense to rename function to fetchERC1155MetadataByQuestUUID
? I don't like the long variable name I suggested though lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it, rather a more specific long name
tokenId: number, | ||
): Promise<string | undefined> { | ||
const metadata = await fetchERC721Metadata(client, contractAddress, tokenId) | ||
// Here, you'd add logic to sanitize or validate the URL? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh did we want to actually add validation / sanitization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I don't think so, was considering it but as mentioned above I think we handle this in the FE
Any updates on this @Quazia ? Going to need this for dynamic boost names |
@JamieLottering Just pushed the PR blocking this up for review but I'm going to re-open this PR into the other repo now that all this code has been ported over. Top priority is getting this upstream. Also are you going to need protocol specific dynamic name generation for Sound? If so I can export that from the plug-in, I'm guessing yes. |
yes, we need sound and mirror |
Adds helpers to get metadata given a contract address, or a UUID as well as a client wrapper that lets us pass in a single RPC and get back a client instance to perform calls against. We probably want to put these functions behind API routes.