• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cartesi / rollups-explorer / 12057905436

27 Nov 2024 08:38PM UTC coverage: 86.088% (-0.5%) from 86.605%
12057905436

push

github

web-flow
#251 Add ABI encoding for raw input form (#256)

1385 of 1647 branches covered (84.09%)

Branch coverage included in aggregate %.

846 of 1029 new or added lines in 13 files covered. (82.22%)

9518 of 11018 relevant lines covered (86.39%)

47.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

10.87
/packages/ui/src/GenericInputForm/TupleComponents.tsx
1
import React, { FC, Fragment } from "react";
1✔
2
import { InputLabel } from "./FunctionSignature";
1✔
3
import { Fieldset, FieldsetProps, TextInput } from "@mantine/core";
1✔
4
import { useFormContext } from "./context";
1✔
5
import { AbiInputParam } from "./types";
6

7
interface TupleComponentsProps extends FieldsetProps {
8
    input: AbiInputParam;
9
}
10

11
export const TupleComponents: FC<TupleComponentsProps> = (props) => {
1✔
NEW
12
    const { input, ...restProps } = props;
×
NEW
13
    const form = useFormContext();
×
NEW
14
    const abiFunctionParams = form.getInputProps("abiFunctionParams");
×
NEW
15
    const firstStandardInput = input.components.find((c) => c.type !== "tuple");
×
NEW
16
    const firstStandardInputIndex = input.components.findIndex(
×
NEW
17
        (c) =>
×
NEW
18
            c.name == firstStandardInput?.name &&
×
NEW
19
            c.type === firstStandardInput?.type,
×
NEW
20
    );
×
21

NEW
22
    return (
×
NEW
23
        <Fieldset {...restProps} legend={<InputLabel input={input} />}>
×
NEW
24
            {input.components.map((component, componentIndex) => {
×
NEW
25
                const isFirstStandardInput =
×
NEW
26
                    componentIndex === firstStandardInputIndex;
×
NEW
27
                const inputIndex = abiFunctionParams.value.findIndex(
×
NEW
28
                    (p: AbiInputParam) => p.id === component.id,
×
NEW
29
                );
×
30

NEW
31
                return (
×
NEW
32
                    <Fragment key={component.id}>
×
NEW
33
                        {component.type === "tuple" ? (
×
NEW
34
                            <TupleComponents
×
NEW
35
                                input={component}
×
NEW
36
                                mt={componentIndex > 0 ? 16 : 0}
×
NEW
37
                                mb={
×
NEW
38
                                    input.components[componentIndex + 1]
×
NEW
39
                                        ? 16
×
NEW
40
                                        : 0
×
41
                                }
NEW
42
                            />
×
43
                        ) : (
NEW
44
                            <TextInput
×
NEW
45
                                label={<InputLabel input={component} />}
×
NEW
46
                                placeholder={`Enter ${component.type} value`}
×
NEW
47
                                mt={isFirstStandardInput ? 0 : 16}
×
NEW
48
                                withAsterisk
×
NEW
49
                                {...form.getInputProps(
×
NEW
50
                                    `abiFunctionParams.${inputIndex}.value`,
×
NEW
51
                                )}
×
NEW
52
                            />
×
53
                        )}
NEW
54
                    </Fragment>
×
55
                );
NEW
56
            })}
×
NEW
57
        </Fieldset>
×
58
    );
NEW
59
};
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc