-
Notifications
You must be signed in to change notification settings - Fork 34
chore: demo features script deloyer #356
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
base: master
Are you sure you want to change the base?
Conversation
ashuralyk
commented
Jan 27, 2026
- I have read the Contributing Guidelines
|
✅ Deploy Preview for docsccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for liveccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for apiccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary of ChangesHello @ashuralyk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates a new "Deploy Script" tool into the demo application, empowering users to interact with the CKB blockchain by deploying files as Type ID cells. This enhancement provides a robust mechanism for both initial deployment and subsequent updates of on-chain data, complete with comprehensive UI feedback and validation. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
✅ Deploy Preview for appccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Code Review
This pull request introduces a new feature for deploying scripts, which is a great addition to the demo application. The main component, DeployScript, is well-structured but has grown quite large. For future maintainability, consider breaking it down into smaller components and custom hooks. For instance, the file upload UI and the Type ID checking logic could be extracted. I've provided a couple of specific suggestions to improve error handling and reduce code duplication in the new component. The other changes in the pull request are solid, including a necessary fix in the Message component to ensure valid HTML.
| signer.getRecommendedAddress().then((addr) => { | ||
| setUserAddress(addr); | ||
| }); |
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.
The promise returned by signer.getRecommendedAddress() doesn't handle potential rejections. If this promise fails, it will result in an unhandled promise rejection in the application. It's a good practice to add a .catch() block to handle such errors gracefully, for instance by logging the error and notifying the user.
signer.getRecommendedAddress().then((addr) => {
setUserAddress(addr);
}).catch((e) => {
console.error("Failed to get recommended address:", e);
error("Failed to get user address.");
});
| try { | ||
| const typeIdBytes = ccc.bytesFrom(normalizedTypeIdArgs); | ||
| if (typeIdBytes.length !== 32) { | ||
| setFoundCell(null); | ||
| setFoundCellAddress(""); | ||
| setIsAddressMatch(null); | ||
| setCellCheckError( | ||
| "Type ID args must be 32 bytes (64 hex characters)", | ||
| ); | ||
| isCheckingRef.current = false; | ||
| return; | ||
| } | ||
| } catch { | ||
| setFoundCell(null); | ||
| setFoundCellAddress(""); | ||
| setIsAddressMatch(null); | ||
| setCellCheckError("Invalid Type ID args format"); | ||
| isCheckingRef.current = false; | ||
| return; | ||
| } |
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.
The state reset logic for foundCell, foundCellAddress, etc., is duplicated in this try...catch block and in other places within the useEffect hook. This duplication makes the code harder to read and maintain. You can refactor this by consolidating the error handling and state reset logic into a single catch block, which will make the code cleaner and less error-prone.
try {
const typeIdBytes = ccc.bytesFrom(normalizedTypeIdArgs);
if (typeIdBytes.length !== 32) {
throw new Error(
"Type ID args must be 32 bytes (64 hex characters)",
);
}
} catch (e: unknown) {
const message =
e instanceof Error && e.message.startsWith("Type ID")
? e.message
: "Invalid Type ID args format";
setFoundCell(null);
setFoundCellAddress("");
setIsAddressMatch(null);
setCellCheckError(message);
isCheckingRef.current = false;
return;
}
