-
Notifications
You must be signed in to change notification settings - Fork 516
feat: Prefill inputs for arguments according the type #799
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: Prefill inputs for arguments according the type #799
Conversation
* add prefil for program idl arguments * update default value picking logic to match existing pattern * quickfix revert feature flag * nit: fix eslint directive * fix: set use client * fix: revert use client as we have onSubmit callback * refactor prefill logic * updated arguments prefil logic & added tests * quickfix prettier error --------- Co-authored-by: Sergo <[email protected]>
|
@shazzzam is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
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.
Caution
Changes requested ❌
Reviewed everything up to f7a6d08 in 3 minutes and 8 seconds. Click for details.
- Reviewed
4340lines of code in28files - Skipped
0files when reviewing. - Skipped posting
19draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. app/entities/idl/model/formatted-idl.d.ts:68
- Draft comment:
Good use of optional rawType to store the original IdlType. The types are clearly documented and cover the necessary cases. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
2. app/entities/idl/model/use-format-anchor-idl.ts:29
- Draft comment:
parseStructFields helper uses camelCase for field names; ensure it applies correctly for all IDL definitions. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
3. app/entities/idl/model/use-format-anchor-idl.ts:87
- Draft comment:
parseIdlType handles defined, array, vec, option, and coption cases explicitly; fallback to JSON.stringify is acceptable for unknown types. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
4. app/features/idl/formatted-idl/ui/BaseFormattedIdl.tsx:21
- Draft comment:
Consider memoizing the 'tabs' dependency to avoid repeated renders if the tabs array is recreated. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
5. app/features/idl/interactive-idl/lib/instruction-args.ts:18
- Draft comment:
The regex in getArrayMaxLength works for tested patterns but may fail with non-word characters in type aliases. Ensure the pattern remains robust. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
6. app/features/idl/interactive-idl/model/form-prefill/providers/argument-data-types-prefill-provider.ts:29
- Draft comment:
DEFAULT_VALUES_PER_TYPE mapping is clear and the recursive calls for wrapped types are structured well. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
7. app/features/idl/interactive-idl/model/form-prefill/providers/hardcoded-accounts-prefill-provider.ts:65
- Draft comment:
Effective use of traverseInstructionAccounts with case-insensitive matching. The implementation fills only empty fields, preserving user input. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
8. app/features/idl/interactive-idl/model/form-prefill/providers/pda-prefill-provider.ts:48
- Draft comment:
PDA prefill dependency properly triggers PDA computation using computePdas. Consider adding detailed logging in the catch block for better error diagnosis. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
9. app/features/idl/interactive-idl/model/form-prefill/providers/wallet-prefill-provider.ts:33
- Draft comment:
Good use of 'instanceof PublicKey' to verify the wallet. The traversal for signer accounts is clear. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
10. app/features/idl/interactive-idl/model/form-prefill/use-form-prefill.ts:15
- Draft comment:
The useEffect iterates over external dependencies using a ref to track changes; consider a deep equality check to avoid redundant calls. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
11. app/features/idl/interactive-idl/model/pda-generator/compute-pdas.ts:58
- Draft comment:
The try-catch around PublicKey.findProgramAddressSync is appropriate; it ensures graceful degradation when PDA generation fails. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
12. app/features/idl/interactive-idl/model/use-instruction-form.ts:109
- Draft comment:
Default values for arguments are set using findDefaultValueForArgumentType, reducing uncontrolled-to-controlled warnings. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
13. app/features/idl/interactive-idl/model/use-pdas.ts:16
- Draft comment:
Effective useWatch hook usage to obtain form values for PDA computations. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
14. app/features/idl/interactive-idl/ui/ArgumentInput.tsx:8
- Draft comment:
Separation of SingleArgumentInput and ArrayArgumentInput based on type check is clean. Consider refactoring inline hooks (useStableIds, useInputRefs) if reused elsewhere. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
15. app/features/idl/interactive-idl/ui/InteractInstruction.tsx:53
- Draft comment:
Multiple prefill dependencies (wallet, hardcoded accounts, PDA) are created and passed to useFormPrefill, allowing flexible extension. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
16. app/features/idl/interactive-idl/ui/__tests__/ArgumentInput.spec.tsx:8
- Draft comment:
Tests for ArgumentInput cover both single and array inputs effectively. The helper createArgField enhances readability. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
17. app/features/idl/interactive-idl/ui/__tests__/InteractInstruction.spec.tsx:11
- Draft comment:
Mocks for wallet adapter and usePdas are correctly set up, effectively isolating the InteractInstruction component. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
18. app/utils/programs.ts:125
- Draft comment:
Program information mapping is extensive and well organized; use of readonly types improves reliability. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
19. bench/BUILD.md:3
- Draft comment:
The build output table is updated with accurate size metrics and reflects the recent improvements well. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
Workflow ID: wflow_KA26Tr0OYnZIdy3P
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
...l/interactive-idl/model/form-prefill/providers/ argument-data-types-prefill-provider.test.ts
Outdated
Show resolved
Hide resolved
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
… argument-data-types-prefill-provider.test.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Description
Automatically prefill inputs for arguments according the type
Type of change
Screenshots
Testing
Visit lint http://localhost:3000/address/AXcxp15oz1L4YYtqZo6Qt6EkUj1jtLR6wXYqaJvn4oye/idl?cluster=devnet
On IDL Program Metadata navigate to Interact tab
Arguments should be prefilled according to its types
Related Issues
HOO-223
Checklist
build:infoscript to update build informationAdditional Notes
Important
Add feature to automatically prefill inputs for arguments based on type, with comprehensive test coverage and support for various data types and dependencies.
InteractInstruction.tsx.argument-data-types-prefill-provider.ts.pda-prefill-provider.ts.useFormPrefillhook to manage form prefill logic, watching external dependencies and form values.createHardcodedAccountsPrefillDependency,createPdaPrefillDependency, andcreateWalletPrefillDependencyfor automatic field filling.argument-data-types-prefill-provider.test.ts,hardcoded-accounts-prefill-provider.test.ts,pda-prefill-provider.test.ts, andwallet-prefill-provider.test.ts.ArgumentInputcomponent inArgumentInput.spec.tsxto ensure correct rendering and behavior.programs.tsandBUILD.mdto reflect new functionality and dependencies.This description was created by
for f7a6d08. You can customize this summary. It will automatically update as commits are pushed.