@@ -6,7 +6,16 @@ import { allCoinMetas } from '~/helpers/config';
66
77const validationSchema = Yup . object ( {
88 apiKey : Yup . string ( ) . required ( ) ,
9- backupKey : Yup . string ( ) . required ( ) ,
9+ backupKey : Yup . string ( ) . when ( 'isTss' , {
10+ is : false ,
11+ then : Yup . string ( ) . required ( ) ,
12+ otherwise : Yup . string ( ) . notRequired ( ) ,
13+ } ) ,
14+ bitgoKey : Yup . string ( ) . when ( 'isTss' , {
15+ is : true ,
16+ then : Yup . string ( ) . required ( ) ,
17+ otherwise : Yup . string ( ) . notRequired ( ) ,
18+ } ) ,
1019 backupKeyId : Yup . string ( ) ,
1120 gasLimit : Yup . number ( )
1221 . typeError ( 'Gas limit must be a number' )
@@ -16,7 +25,11 @@ const validationSchema = Yup.object({
1625 maxFeePerGas : Yup . number ( ) . required ( ) ,
1726 maxPriorityFeePerGas : Yup . number ( ) . required ( ) ,
1827 recoveryDestination : Yup . string ( ) . required ( ) ,
19- userKey : Yup . string ( ) . required ( ) ,
28+ userKey : Yup . string ( ) . when ( 'isTss' , {
29+ is : false ,
30+ then : Yup . string ( ) . required ( ) ,
31+ otherwise : Yup . string ( ) . notRequired ( ) ,
32+ } ) ,
2033 userKeyId : Yup . string ( ) ,
2134 walletContractAddress : Yup . string ( ) . required ( ) ,
2235 isTss : Yup . boolean ( ) ,
@@ -39,6 +52,7 @@ export function EthLikeForm({ onSubmit, coinName }: EthLikeFormProps) {
3952 apiKey : '' ,
4053 backupKey : '' ,
4154 backupKeyId : '' ,
55+ bitgoKey : '' ,
4256 gasLimit : allCoinMetas [ coinName ] ?. defaultGasLimitNum ?? 500000 ,
4357 maxFeePerGas : 20 ,
4458 maxPriorityFeePerGas : 10 ,
@@ -57,38 +71,63 @@ export function EthLikeForm({ onSubmit, coinName }: EthLikeFormProps) {
5771 < h4 className = "tw-text-body tw-font-semibold tw-border-b-0.5 tw-border-solid tw-border-gray-700 tw-mb-4" >
5872 Self-managed cold wallet details
5973 </ h4 >
60- < div className = "tw-mb-4" >
61- < FormikTextfield
62- HelperText = "Your user public key, as found on your recovery KeyCard."
63- Label = "User Public Key"
64- name = "userKey"
65- Width = "fill"
66- />
67- </ div >
68- < div className = "tw-mb-4" >
69- < FormikTextfield
70- HelperText = "Your user Key ID, as found on your KeyCard. Most wallets will not have this and you can leave it blank."
71- Label = "User Key ID (optional)"
72- name = "userKeyId"
73- Width = "fill"
74- />
75- </ div >
76- < div className = "tw-mb-4" >
77- < FormikTextfield
78- HelperText = "The backup public key for the wallet, as found on your recovery KeyCard."
79- Label = "Backup Public Key"
80- name = "backupKey"
81- Width = "fill"
82- />
83- </ div >
84- < div className = "tw-mb-4" >
85- < FormikTextfield
86- HelperText = "Your backup Key ID, as found on your KeyCard. Most wallets will not have this and you can leave it blank."
87- Label = "Backup Key ID (optional)"
88- name = "backupKeyId"
89- Width = "fill"
90- />
91- </ div >
74+ { allCoinMetas [ coinName ] . isTssSupported && (
75+ < div className = "tw-mb-4" role = "group" >
76+ < label >
77+ < Field type = "checkbox" name = "isTss" />
78+ Is TSS recovery?
79+ </ label >
80+ </ div >
81+ ) }
82+ { formik . values . isTss ? null : (
83+ < div >
84+ < div className = "tw-mb-4" >
85+ < FormikTextfield
86+ HelperText = "Your user public key, as found on your recovery KeyCard."
87+ Label = "User Public Key"
88+ name = "userKey"
89+ Width = "fill"
90+ />
91+ </ div >
92+ < div className = "tw-mb-4" >
93+ < FormikTextfield
94+ HelperText = "Your user Key ID, as found on your KeyCard. Most wallets will not have this and you can leave it blank."
95+ Label = "User Key ID (optional)"
96+ name = "userKeyId"
97+ Width = "fill"
98+ />
99+ </ div >
100+ < div className = "tw-mb-4" >
101+ < FormikTextfield
102+ HelperText = "The backup public key for the wallet, as found on your recovery KeyCard."
103+ Label = "Backup Public Key"
104+ name = "backupKey"
105+ Width = "fill"
106+ />
107+ </ div >
108+ < div className = "tw-mb-4" >
109+ < FormikTextfield
110+ HelperText = "Your backup Key ID, as found on your KeyCard. Most wallets will not have this and you can leave it blank."
111+ Label = "Backup Key ID (optional)"
112+ name = "backupKeyId"
113+ Width = "fill"
114+ />
115+ </ div >
116+ </ div >
117+ ) }
118+ { formik . values . isTss ? (
119+ < div >
120+ < div className = "tw-mb-4" >
121+ < FormikTextfield
122+ HelperText = "Your BitGo public key, also known as the common keychain public key."
123+ Label = "BitGo Public Key"
124+ name = "bitgoKey"
125+ Width = "fill"
126+ />
127+ </ div >
128+ </ div >
129+ ) : null
130+ }
92131 < div className = "tw-mb-4" >
93132 < FormikTextfield
94133 HelperText = "The ETH address of the wallet contract. This is also the wallet's base address."
@@ -143,14 +182,6 @@ export function EthLikeForm({ onSubmit, coinName }: EthLikeFormProps) {
143182 Width = "fill"
144183 />
145184 </ div >
146- { allCoinMetas [ coinName ] . isTssSupported && (
147- < div className = "tw-mb-4" role = "group" >
148- < label >
149- < Field type = "checkbox" name = "isTss" />
150- Is TSS recovery?
151- </ label >
152- </ div >
153- ) }
154185 < div className = "tw-flex tw-flex-col-reverse sm:tw-justify-between sm:tw-flex-row tw-gap-1 tw-mt-4" >
155186 < Button Tag = { Link } to = "/" Variant = "secondary" Width = "hug" >
156187 Cancel
0 commit comments