@@ -6,8 +6,18 @@ 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 ( ) ,
20+ seed : Yup . string ( ) ,
1121 gasLimit : Yup . number ( )
1222 . typeError ( 'Gas limit must be a number' )
1323 . integer ( )
@@ -16,7 +26,11 @@ const validationSchema = Yup.object({
1626 maxFeePerGas : Yup . number ( ) . required ( ) ,
1727 maxPriorityFeePerGas : Yup . number ( ) . required ( ) ,
1828 recoveryDestination : Yup . string ( ) . required ( ) ,
19- userKey : Yup . string ( ) . required ( ) ,
29+ userKey : Yup . string ( ) . when ( 'isTss' , {
30+ is : false ,
31+ then : Yup . string ( ) . required ( ) ,
32+ otherwise : Yup . string ( ) . notRequired ( ) ,
33+ } ) ,
2034 userKeyId : Yup . string ( ) ,
2135 walletContractAddress : Yup . string ( ) . required ( ) ,
2236 isTss : Yup . boolean ( ) ,
@@ -39,6 +53,8 @@ export function EthLikeForm({ onSubmit, coinName }: EthLikeFormProps) {
3953 apiKey : '' ,
4054 backupKey : '' ,
4155 backupKeyId : '' ,
56+ bitgoKey : '' ,
57+ seed : '' ,
4258 gasLimit : allCoinMetas [ coinName ] ?. defaultGasLimitNum ?? 500000 ,
4359 maxFeePerGas : 20 ,
4460 maxPriorityFeePerGas : 10 ,
@@ -57,46 +73,79 @@ export function EthLikeForm({ onSubmit, coinName }: EthLikeFormProps) {
5773 < h4 className = "tw-text-body tw-font-semibold tw-border-b-0.5 tw-border-solid tw-border-gray-700 tw-mb-4" >
5874 Self-managed cold wallet details
5975 </ 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 >
92- < div className = "tw-mb-4" >
93- < FormikTextfield
94- HelperText = "The ETH address of the wallet contract. This is also the wallet's base address."
95- Label = "Wallet Contract Address"
96- name = "walletContractAddress"
97- Width = "fill"
98- />
99- </ div >
76+ { allCoinMetas [ coinName ] . isTssSupported && (
77+ < div className = "tw-mb-4" role = "group" >
78+ < label >
79+ < Field type = "checkbox" name = "isTss" />
80+ Is TSS recovery?
81+ </ label >
82+ </ div >
83+ ) }
84+ { formik . values . isTss ? null : (
85+ < div >
86+ < div className = "tw-mb-4" >
87+ < FormikTextfield
88+ HelperText = "Your user public key, as found on your recovery KeyCard."
89+ Label = "User Public Key"
90+ name = "userKey"
91+ Width = "fill"
92+ />
93+ </ div >
94+ < div className = "tw-mb-4" >
95+ < FormikTextfield
96+ HelperText = "Your user Key ID, as found on your KeyCard. Most wallets will not have this and you can leave it blank."
97+ Label = "User Key ID (optional)"
98+ name = "userKeyId"
99+ Width = "fill"
100+ />
101+ </ div >
102+ < div className = "tw-mb-4" >
103+ < FormikTextfield
104+ HelperText = "The backup public key for the wallet, as found on your recovery KeyCard."
105+ Label = "Backup Public Key"
106+ name = "backupKey"
107+ Width = "fill"
108+ />
109+ </ div >
110+ < div className = "tw-mb-4" >
111+ < FormikTextfield
112+ HelperText = "Your backup Key ID, as found on your KeyCard. Most wallets will not have this and you can leave it blank."
113+ Label = "Backup Key ID (optional)"
114+ name = "backupKeyId"
115+ Width = "fill"
116+ />
117+ </ div >
118+ < div className = "tw-mb-4" >
119+ < FormikTextfield
120+ HelperText = "The ETH address of the wallet contract. This is also the wallet's base address."
121+ Label = "Wallet Contract Address"
122+ name = "walletContractAddress"
123+ Width = "fill"
124+ />
125+ </ div >
126+ </ div >
127+ ) }
128+ { formik . values . isTss ? (
129+ < div >
130+ < div className = "tw-mb-4" >
131+ < FormikTextfield
132+ HelperText = "Your BitGo public key, also known as the common keychain public key."
133+ Label = "BitGo Public Key"
134+ name = "bitgoKey"
135+ Width = "fill"
136+ />
137+ </ div >
138+ < div className = "tw-mb-4" >
139+ < FormikTextfield
140+ HelperText = "Your user seed as found on your KeyCard as Key ID. Most wallets will not have this and you can leave it blank."
141+ Label = "Seed (optional)"
142+ name = "seed"
143+ Width = "fill"
144+ />
145+ </ div >
146+ </ div >
147+ ) : null
148+ }
100149 < div className = "tw-mb-4" >
101150 < FormikTextfield
102151 HelperText = "The address your recovery transaction will send to."
@@ -143,14 +192,6 @@ export function EthLikeForm({ onSubmit, coinName }: EthLikeFormProps) {
143192 Width = "fill"
144193 />
145194 </ 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- ) }
154195 < div className = "tw-flex tw-flex-col-reverse sm:tw-justify-between sm:tw-flex-row tw-gap-1 tw-mt-4" >
155196 < Button Tag = { Link } to = "/" Variant = "secondary" Width = "hug" >
156197 Cancel
0 commit comments