feat: add send generic input#438
feat: add send generic input#438brunomenezes wants to merge 2 commits intofeat/add-abi-encoding-and-decodingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds support in the Dave webapp to send generic inputs to an application via the Cartesi InputBox, with multiple input encoding modes (raw hex, string-to-hex, and ABI-based encoding) to reach feature parity with existing “send” flows.
Changes:
- Introduces a new
GenericInputFormwith validation, ABI/spec selection, and encoding helpers. - Wires “Input” into the Send menu/modal and passes JSON_ABI specifications into the form.
- Temporarily disables publishing Coveralls reports in CI.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/dave/src/components/transactions/GenericInputForm/index.tsx | Main generic input UI and transaction execution flow |
| apps/dave/src/components/transactions/GenericInputForm/useGenericInputForm.tsx | Form setup, validation wiring, and transformed values/spec selection |
| apps/dave/src/components/transactions/GenericInputForm/validations.ts | Field validators for app address, hex input, ABI inputs/params |
| apps/dave/src/components/transactions/GenericInputForm/utils.ts | ABI parsing/spec generation, tuple flattening, and argument encoding helpers |
| apps/dave/src/components/transactions/GenericInputForm/types.ts | Form and ABI-related types |
| apps/dave/src/components/transactions/GenericInputForm/initialValues.ts | Initial form values |
| apps/dave/src/components/transactions/GenericInputForm/context.tsx | Mantine form context for the feature |
| apps/dave/src/components/transactions/GenericInputForm/hooks/useInputBoxAddInput.tsx | Wagmi simulate/write/wait wrapper for InputBox addInput |
| apps/dave/src/components/transactions/GenericInputForm/AbiFields.tsx | ABI method/spec selection and display of encoded hex output |
| apps/dave/src/components/transactions/GenericInputForm/AbiFunctionName.tsx | Function selection UI for JSON_ABI specs |
| apps/dave/src/components/transactions/GenericInputForm/AbiFunctionParams.tsx | Function argument inputs (incl. tuple handling) |
| apps/dave/src/components/transactions/GenericInputForm/TupleComponents.tsx | Recursive tuple component rendering |
| apps/dave/src/components/transactions/GenericInputForm/AbiParameter.tsx | ABI-params entry flow for encoding without selectors |
| apps/dave/src/components/transactions/GenericInputForm/FunctionSignature.tsx | Function signature/label rendering helpers |
| apps/dave/src/components/send/SendMenu.tsx | Enables “Input” send action and forwards filtered specifications |
| apps/dave/src/components/send/SendModal.tsx | Renders GenericInputForm for generic_input transaction type |
| apps/dave/src/components/send/SendProvider.tsx | Stores specifications in send state for generic input actions |
| apps/dave/src/components/send/SendContexts.tsx | Extends send state/action types to include specifications |
| apps/dave/src/components/send/hooks.tsx | Updates sendGenericInput action signature to accept specs |
| .github/workflows/ci.yml | Disables Coveralls publish step |
Comments suppressed due to low confidence (1)
apps/dave/src/components/transactions/GenericInputForm/AbiFunctionParams.tsx:55
- Typo in
data-testid:empty-inputs-argments-alertshould beempty-inputs-arguments-alertto avoid propagating the misspelling into tests and tooling.
data-testid="empty-inputs-argments-alert"
>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
apps/dave/src/components/transactions/GenericInputForm/TupleComponents.tsx
Show resolved
Hide resolved
|
|
||
| type SendMenuProps = { application: Application }; | ||
|
|
||
| const jsonAbiOnly = (spec: DbSpecification) => spec.mode === "json_abi"; |
There was a problem hiding this comment.
jsonAbiOnly is a boolean predicate, so filter(jsonAbiOnly, ...) does not narrow the DbSpecification union type. That forces as casts later and makes it easy to accidentally pass non-JSON_ABI specs. Consider making jsonAbiOnly a proper type guard and/or mapping the list to the exact {id, name, abi} shape expected by GenericInputForm.
| const jsonAbiOnly = (spec: DbSpecification) => spec.mode === "json_abi"; | |
| const jsonAbiOnly = ( | |
| spec: DbSpecification, | |
| ): spec is Extract<DbSpecification, { mode: "json_abi" }> => | |
| spec.mode === "json_abi"; |
There was a problem hiding this comment.
The current is fine. Later there will be a refactoring and the GenericInputForm may be removed.
cc: @vfusco
| application={state.application} | ||
| specifications={ | ||
| state.specifications as GenericInputFormSpecification[] | ||
| } |
There was a problem hiding this comment.
This cast hides the fact that DbSpecification is a union (some variants do not have an abi field). If anything other than mode: "json_abi" slips into state.specifications, GenericInputForm will break at runtime. Prefer narrowing the type earlier (e.g., store only JSON_ABI specs in state) or mapping to the GenericInputFormSpecification shape without using as casts.
There was a problem hiding this comment.
It is fine by the reason above. The list of specifications from the state is expected to be already filtered by Specs with mode json_abi.
cc: @vfusco
apps/dave/src/components/transactions/GenericInputForm/useGenericInputForm.tsx
Show resolved
Hide resolved
959af0b to
6101d4d
Compare
* Support to raw hex value added. * Support to string to hex added. * Support ABI encoding added.
5d156e4 to
15ae89f
Compare
15ae89f to
e612f01
Compare
Summary
The code changes in this PR achieve feature parity in terms of a user be able to send transactions (i.e. deposits through portals and generic input through the input box).
Even though the add-input is the simplest in terms of smart contract interface, it was the last to be added as it depends on the PR #434 (ABI encoding/decoding support), since we provide ways for the user to choose how they want to send the data i.e. using a raw hex value, or a string to be converted to hex, or ABI encoding to define the input to be sent.
PS: Currently I am skipping the CI step to publish the test reports to coveralls. It is having service outage for a couple of days at the moment of writing. They don't have an ETA, more details here: https://status.coveralls.io/
closes: #435