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

cartesi / rollups-explorer / 11826960107

13 Nov 2024 10:31PM CUT coverage: 85.956% (-0.6%) from 86.605%
11826960107

Pull #256

github

nevendyulgerov
test(apps/web): Tweak layout for tuple inputs
Pull Request #256: #251 Add ABI encoding for raw input form

1368 of 1630 branches covered (83.93%)

Branch coverage included in aggregate %.

793 of 984 new or added lines in 13 files covered. (80.59%)

9465 of 10973 relevant lines covered (86.26%)

47.16 hits per line

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

75.0
/packages/ui/src/GenericInputForm/AbiFunctionParams.tsx
1
import { useFormContext } from "./context";
1✔
2
import { Alert, Stack, Text, TextInput } from "@mantine/core";
1✔
3
import { TbAlertCircle } from "react-icons/tb";
1✔
4
import { InputLabel } from "./FunctionSignature";
1✔
5
import { Fragment } from "react";
1✔
6
import { TupleComponents } from "./TupleComponents";
1✔
7
import { AbiInputParam } from "./types";
8
import { getInputIndexOffset } from "./utils";
1✔
9

10
export const AbiFunctionParams = () => {
1✔
11
    const form = useFormContext();
59✔
12
    const { abiFunction } = form.getTransformedValues();
59✔
13

14
    return (
59✔
15
        <>
59✔
16
            {abiFunction ? (
59✔
17
                <Stack>
30✔
18
                    {abiFunction.inputs.length > 0 ? (
30✔
19
                        <>
30✔
20
                            {abiFunction.inputs.map((input, index) => {
30✔
21
                                const prevInputs = abiFunction.inputs.slice(
60✔
22
                                    0,
60✔
23
                                    index,
60✔
24
                                ) as AbiInputParam[];
60✔
25
                                const indexOffset =
60✔
26
                                    getInputIndexOffset(prevInputs);
60✔
27

28
                                return (
60✔
29
                                    <Fragment
60✔
30
                                        key={`${input.name}-${input.type}`}
60✔
31
                                    >
32
                                        {input.type === "tuple" ? (
60!
NEW
33
                                            <TupleComponents
×
NEW
34
                                                input={input as AbiInputParam}
×
NEW
35
                                            />
×
36
                                        ) : (
37
                                            <TextInput
60✔
38
                                                key={`${input.name}-${input.type}`}
60✔
39
                                                label={
60✔
40
                                                    <InputLabel input={input} />
60✔
41
                                                }
42
                                                placeholder={`Enter ${input.type} value`}
60✔
43
                                                withAsterisk
60✔
44
                                                {...form.getInputProps(
60✔
45
                                                    `abiFunctionParams.${indexOffset}.value`,
60✔
46
                                                )}
60✔
47
                                            />
60✔
48
                                        )}
49
                                    </Fragment>
60✔
50
                                );
51
                            })}
30✔
52
                        </>
30!
53
                    ) : (
NEW
54
                        <Alert
×
NEW
55
                            variant="light"
×
NEW
56
                            color="blue"
×
NEW
57
                            icon={<TbAlertCircle />}
×
NEW
58
                            data-testid="empty-inputs-argments-alert"
×
NEW
59
                        >
×
NEW
60
                            No input arguments defined for{" "}
×
NEW
61
                            <Text span fz="sm" fw="bold">
×
NEW
62
                                {abiFunction.name}()
×
NEW
63
                            </Text>
×
64
                            .
NEW
65
                        </Alert>
×
66
                    )}
67
                </Stack>
30✔
68
            ) : null}
29✔
69
        </>
59✔
70
    );
71
};
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