Skip to content

Conversation

@shazzzam
Copy link
Contributor

@shazzzam shazzzam commented Dec 29, 2025

Description

Automatically prefill inputs for arguments according the type

Type of change

  • New feature

Screenshots

image

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

  • My code follows the project's style guidelines
  • I have added tests that prove my fix/feature works
  • All tests pass locally and in CI
  • I have run build:info script to update build information
  • CI/CD checks pass
  • I have included screenshots for protocol screens (if applicable)

Additional 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.

  • Behavior:
    • Automatically prefill inputs for arguments based on type in InteractInstruction.tsx.
    • Supports scalar, vector, and array types, with default values defined in argument-data-types-prefill-provider.ts.
    • Handles nested accounts and PDA generation in pda-prefill-provider.ts.
  • Form Prefill:
    • Adds useFormPrefill hook to manage form prefill logic, watching external dependencies and form values.
    • Introduces createHardcodedAccountsPrefillDependency, createPdaPrefillDependency, and createWalletPrefillDependency for automatic field filling.
  • Testing:
    • Comprehensive tests added for new prefill logic in argument-data-types-prefill-provider.test.ts, hardcoded-accounts-prefill-provider.test.ts, pda-prefill-provider.test.ts, and wallet-prefill-provider.test.ts.
    • Tests for ArgumentInput component in ArgumentInput.spec.tsx to ensure correct rendering and behavior.
  • Misc:
    • Updates to programs.ts and BUILD.md to reflect new functionality and dependencies.

This description was created by Ellipsis for f7a6d08. You can customize this summary. It will automatically update as commits are pushed.

askov and others added 9 commits December 22, 2025 17:19
* 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]>
@vercel
Copy link

vercel bot commented Dec 29, 2025

@shazzzam is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 4340 lines of code in 28 files
  • Skipped 0 files when reviewing.
  • Skipped posting 19 draft 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% None

Workflow ID: wflow_KA26Tr0OYnZIdy3P

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@vercel
Copy link

vercel bot commented Dec 29, 2025

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: explorer.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@vercel
Copy link

vercel bot commented Dec 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
explorer Ready Ready Preview, Comment Dec 30, 2025 11:54am

@Woody4618 Woody4618 merged commit 8afc069 into solana-foundation:master Dec 30, 2025
6 checks passed
@rogaldh rogaldh deleted the development-feat-prefil-inputs-for-arguments branch December 30, 2025 18:39
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.

4 participants