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

cartesi / rollups-explorer / 7459483902

09 Jan 2024 09:59AM UTC coverage: 95.485%. First build
7459483902

Pull #98

github

nevendyulgerov
feat: Add coveralls badge
Pull Request #98: #97 Add build steps for generating and uploading test coverage

344 of 421 branches covered (0.0%)

Branch coverage included in aggregate %.

4858 of 5027 relevant lines covered (96.64%)

14.43 hits per line

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

94.74
/apps/web/src/components/sendTransaction.tsx
1
"use client";
1✔
2
import {
1✔
3
    ERC20DepositForm,
1✔
4
    EtherDepositForm,
1✔
5
    RawInputForm,
1✔
6
} from "@cartesi/rollups-explorer-ui";
1✔
7
import { FC, useMemo, useState } from "react";
1✔
8
import { Select } from "@mantine/core";
1✔
9
import { useApplicationsQuery, useTokensQuery } from "../graphql";
1✔
10
import { useDebouncedValue } from "@mantine/hooks";
1✔
11

1✔
12
export type DepositType =
1✔
13
    | "ether"
1✔
14
    | "erc20"
1✔
15
    | "erc721"
1✔
16
    | "erc1155"
1✔
17
    | "relay"
1✔
18
    | "input";
1✔
19

1✔
20
interface DepositProps {
1✔
21
    initialDepositType?: DepositType;
1✔
22
}
1✔
23

1✔
24
const SendTransaction: FC<DepositProps> = ({
1✔
25
    initialDepositType = "ether",
9✔
26
}) => {
9✔
27
    const [depositType, setDepositType] =
9✔
28
        useState<DepositType>(initialDepositType);
9✔
29
    const [applicationId, setApplicationId] = useState("");
9✔
30
    const [debouncedApplicationId] = useDebouncedValue(applicationId, 400);
9✔
31
    const [{ data: applicationData, fetching }] = useApplicationsQuery({
9✔
32
        variables: {
9✔
33
            limit: 10,
9✔
34
            where: {
9✔
35
                id_containsInsensitive: debouncedApplicationId ?? "",
9!
36
            },
9✔
37
        },
9✔
38
    });
9✔
39
    const applications = useMemo(
9✔
40
        () => (applicationData?.applications ?? []).map((a) => a.id),
9✔
41
        [applicationData],
9✔
42
    );
9✔
43
    const [{ data: tokenData }] = useTokensQuery({
9✔
44
        variables: {
9✔
45
            limit: 100,
9✔
46
        },
9✔
47
    });
9✔
48
    const tokens = useMemo(
9✔
49
        () =>
9✔
50
            (tokenData?.tokens ?? []).map(
9✔
51
                (a) => `${a.symbol} - ${a.name} - ${a.id}`,
9✔
52
            ),
9✔
53
        [tokenData],
9✔
54
    );
9✔
55

9✔
56
    return (
9✔
57
        <>
9✔
58
            <Select
9✔
59
                label="Type"
9✔
60
                placeholder="Select deposit type"
9✔
61
                mb={16}
9✔
62
                data={[
9✔
63
                    {
9✔
64
                        group: "Deposit",
9✔
65
                        items: [
9✔
66
                            { value: "ether", label: "Ether Deposit" },
9✔
67
                            { value: "erc20", label: "ERC-20 Deposit" },
9✔
68
                        ],
9✔
69
                    },
9✔
70
                    {
9✔
71
                        group: "Other",
9✔
72
                        items: [{ value: "input", label: "Raw Input" }],
9✔
73
                    },
9✔
74
                ]}
9✔
75
                value={depositType}
9✔
76
                onChange={(nextValue) => {
9✔
77
                    setDepositType(nextValue as DepositType);
×
78
                    setApplicationId("");
×
79
                }}
×
80
            />
9✔
81

9✔
82
            {depositType === "erc20" ? (
9✔
83
                <ERC20DepositForm
2✔
84
                    tokens={tokens}
2✔
85
                    applications={applications}
2✔
86
                    isLoadingApplications={fetching}
2✔
87
                    onSearchApplications={setApplicationId}
2✔
88
                />
2✔
89
            ) : depositType === "ether" ? (
7✔
90
                <EtherDepositForm
2✔
91
                    applications={applications}
2✔
92
                    isLoadingApplications={fetching}
2✔
93
                    onSearchApplications={setApplicationId}
2✔
94
                />
2✔
95
            ) : depositType === "input" ? (
5✔
96
                <RawInputForm
5✔
97
                    applications={applications}
5✔
98
                    isLoadingApplications={fetching}
5✔
99
                    onSearchApplications={setApplicationId}
5✔
100
                />
5!
101
            ) : null}
×
102
        </>
9✔
103
    );
9✔
104
};
9✔
105
export default SendTransaction;
1✔
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