File tree Expand file tree Collapse file tree 2 files changed +35
-17
lines changed Expand file tree Collapse file tree 2 files changed +35
-17
lines changed Original file line number Diff line number Diff line change 4
4
Modal ,
5
5
Stack ,
6
6
StyledSelectBox ,
7
+ Text ,
7
8
ToggleButton ,
8
9
} from "@namada/components" ;
9
10
import { chainAssetsMapAtom , nativeTokenAddressAtom } from "atoms/chain" ;
@@ -95,6 +96,7 @@ export const GasFeeModal = ({
95
96
gasEstimate,
96
97
gasPriceTable,
97
98
gasSource,
99
+ gasSourceSwitch,
98
100
onChangeGasLimit,
99
101
onChangeGasToken,
100
102
onChangeGasSource,
@@ -168,28 +170,38 @@ export const GasFeeModal = ({
168
170
) ;
169
171
} ) }
170
172
</ div >
171
-
173
+ { gasSourceSwitch && gasSource !== "shielded" && (
174
+ < Text className = "text-red-600 text-sm" >
175
+ Warning! Using fees from your transparent account will reveal data.
176
+ < br />
177
+ To keep your data protected we recommend moving assets to the
178
+ < br />
179
+ shield pool to pay fees.
180
+ </ Text >
181
+ ) }
172
182
< Stack
173
183
direction = "horizontal"
174
184
className = "justify-between align-middle mt-4 mb-1"
175
185
>
176
186
< div className = "text-sm" > Fee Token</ div >
177
- < ToggleButton
178
- label = {
179
- gasSource === "shielded" ? "Shielded Balance" : (
180
- "Transparent Balance"
181
- )
182
- }
183
- color = "white"
184
- activeColor = "yellow"
185
- checked = { gasSource === "shielded" }
186
- onChange = { ( ) =>
187
- onChangeGasSource (
188
- gasSource === "shielded" ? "transparent" : "shielded"
189
- )
190
- }
191
- containerProps = { { className : "gap-3 text-xs" } }
192
- />
187
+ { gasSourceSwitch && (
188
+ < ToggleButton
189
+ label = {
190
+ gasSource === "shielded" ? "Shielded Balance" : (
191
+ "Transparent Balance"
192
+ )
193
+ }
194
+ color = "white"
195
+ activeColor = "yellow"
196
+ checked = { gasSource === "shielded" }
197
+ onChange = { ( ) =>
198
+ onChangeGasSource (
199
+ gasSource === "shielded" ? "transparent" : "shielded"
200
+ )
201
+ }
202
+ containerProps = { { className : "gap-3 text-xs" } }
203
+ />
204
+ ) }
193
205
</ Stack >
194
206
< StyledSelectBox
195
207
id = "fee-token-select"
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export type TransactionFeeProps = {
18
18
gasEstimate : GasEstimate | undefined ;
19
19
gasPriceTable : GasPriceTable | undefined ;
20
20
gasSource : "shielded" | "transparent" ;
21
+ gasSourceSwitch : boolean ;
21
22
onChangeGasLimit : ( value : BigNumber ) => void ;
22
23
onChangeGasToken : ( value : string ) => void ;
23
24
onChangeGasSource : ( value : "shielded" | "transparent" ) => void ;
@@ -57,12 +58,17 @@ export const useTransactionFee = (txKinds: TxKind[]): TransactionFeeProps => {
57
58
const isLoading =
58
59
isLoadingNativeToken || isLoadingGasEstimate || isLoadingGasPriceTable ;
59
60
61
+ const gasSourceSwitch =
62
+ txKinds . includes ( "ShieldedTransfer" ) ||
63
+ txKinds . includes ( "UnshieldingTransfer" ) ;
64
+
60
65
return {
61
66
gasConfig,
62
67
isLoading,
63
68
gasEstimate,
64
69
gasPriceTable,
65
70
gasSource,
71
+ gasSourceSwitch,
66
72
onChangeGasLimit : setGasLimitValue ,
67
73
onChangeGasToken : setGasTokenValue ,
68
74
onChangeGasSource : setGasSource ,
You can’t perform that action at this time.
0 commit comments