forked from BitGo/wallet-recovery-wizard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCardanoForm.tsx
More file actions
86 lines (81 loc) · 2.48 KB
/
CardanoForm.tsx
File metadata and controls
86 lines (81 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { Form, FormikHelpers, FormikProvider, useFormik } from 'formik';
import { Link } from 'react-router-dom';
import * as Yup from 'yup';
import {
Button,
FormikSelectfield,
FormikTextarea,
FormikTextfield,
Icon,
Notice,
} from '~/components';
const validationSchema = Yup.object({
bitgoKey: Yup.string().required(),
recoveryDestination: Yup.string().required(),
seed: Yup.string(),
}).required();
export type CardanoFormProps = {
onSubmit: (
values: CardanoFormValues,
formikHelpers: FormikHelpers<CardanoFormValues>
) => void | Promise<void>;
};
type CardanoFormValues = Yup.Asserts<typeof validationSchema>;
export function CardanoForm({ onSubmit }: CardanoFormProps) {
const formik = useFormik<CardanoFormValues>({
onSubmit,
initialValues: {
bitgoKey: '',
recoveryDestination: '',
seed: undefined,
},
validationSchema,
});
return (
<FormikProvider value={formik}>
<Form>
<h4 className="tw-text-body tw-font-semibold tw-border-b-0.5 tw-border-solid tw-border-gray-700 tw-mb-4">
Self-managed cold wallet details
</h4>
<div className="tw-mb-4">
<FormikTextfield
HelperText="Your bitgo public key, as found on your recovery KeyCard."
Label="Bitgo Public Key"
name="bitgoKey"
Width="fill"
/>
</div>
<div className="tw-mb-4">
<FormikTextfield
HelperText="Your user seed as found on your KeyCard as Key ID. Most wallets will not have this and you can leave it blank."
Label="Seed (optional)"
name="seed"
Width="fill"
/>
</div>
<div className="tw-mb-4">
<FormikTextfield
HelperText="The address your recovery transaction will send to."
Label="Destination Address"
name="recoveryDestination"
Width="fill"
/>
</div>
<div className="tw-flex tw-flex-col-reverse sm:tw-justify-between sm:tw-flex-row tw-gap-1 tw-mt-4">
<Button Tag={Link} to="/" Variant="secondary" Width="hug">
Cancel
</Button>
<Button
Variant="primary"
Width="hug"
type="submit"
Disabled={formik.isSubmitting}
disabled={formik.isSubmitting}
>
{formik.isSubmitting ? 'Recovering...' : 'Recover Funds'}
</Button>
</div>
</Form>
</FormikProvider>
);
}