File tree Expand file tree Collapse file tree 8 files changed +49
-262
lines changed
extension/src/background/keyring Expand file tree Collapse file tree 8 files changed +49
-262
lines changed Original file line number Diff line number Diff line change @@ -722,10 +722,11 @@ export class KeyRing {
722
722
: await this . getSigningKey ( signer ) ;
723
723
724
724
// If disposable key is provided, use it to map real address to spending key
725
- const spendingKeys =
726
- disposableKey ?
727
- [ await this . getSpendingKey ( disposableKey . realAddress ) ]
728
- : [ ] ;
725
+ const spendingKeys = [
726
+ await this . getSpendingKey (
727
+ disposableKey ? disposableKey . realAddress : signer
728
+ ) ,
729
+ ] ;
729
730
730
731
const { signing } = this . sdkService . getSdk ( ) ;
731
732
Original file line number Diff line number Diff line change 2
2
ActionButton ,
3
3
AmountInput ,
4
4
Modal ,
5
+ Stack ,
5
6
StyledSelectBox ,
7
+ ToggleButton ,
6
8
} from "@namada/components" ;
7
9
import { chainAssetsMapAtom , nativeTokenAddressAtom } from "atoms/chain" ;
8
10
import { GasPriceTable , GasPriceTableItem } from "atoms/fees/atoms" ;
@@ -92,8 +94,10 @@ export const GasFeeModal = ({
92
94
gasConfig,
93
95
gasEstimate,
94
96
gasPriceTable,
97
+ gasSource,
95
98
onChangeGasLimit,
96
99
onChangeGasToken,
100
+ onChangeGasSource,
97
101
} = feeProps ;
98
102
99
103
const sortByNativeToken = useSortByNativeToken ( ) ;
@@ -165,7 +169,28 @@ export const GasFeeModal = ({
165
169
} ) }
166
170
</ div >
167
171
168
- < div className = "text-sm mt-4 mb-1" > Fee Token</ div >
172
+ < Stack
173
+ direction = "horizontal"
174
+ className = "justify-between align-middle mt-4 mb-1"
175
+ >
176
+ < 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
+ />
193
+ </ Stack >
169
194
< StyledSelectBox
170
195
id = "fee-token-select"
171
196
value = { gasConfig . gasToken }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -122,11 +122,6 @@ export const createUnshieldingTransferAtom = atomWithMutation((get) => {
122
122
signer,
123
123
memo,
124
124
} : BuildTxAtomParams < UnshieldingTransferMsgValue > ) => {
125
- invariant (
126
- signer ,
127
- "Disposable signer is required for unshielding transfers"
128
- ) ;
129
-
130
125
await sync (
131
126
allViewingKeys ,
132
127
chainId ,
@@ -187,12 +182,11 @@ const sync = async (
187
182
invariant ( chainId , "Chain ID is required for shielded sync" ) ;
188
183
invariant ( namTokenAddress , "NAM token address is required for shielded sync" ) ;
189
184
invariant ( rpcUrl , "RPC URL is required for shielded sync" ) ;
190
- invariant ( maspIndexerUrl , "Masp indexer URL is required for shielded sync" ) ;
191
185
192
186
const { set } = getDefaultStore ( ) ;
193
187
await shieldedSync ( {
194
188
rpcUrl,
195
- maspIndexerUrl,
189
+ maspIndexerUrl : maspIndexerUrl || "" ,
196
190
token : namTokenAddress ,
197
191
viewingKeys : allViewingKeys ,
198
192
chainId,
Original file line number Diff line number Diff line change @@ -176,13 +176,15 @@ export const createUnshieldingTransferTx = async (
176
176
props : UnshieldingTransferMsgValue [ ] ,
177
177
gasConfig : GasConfig ,
178
178
rpcUrl : string ,
179
- disposableSigner : GenDisposableSignerResponse ,
179
+ signer ? : GenDisposableSignerResponse ,
180
180
memo ?: string
181
181
) : Promise < EncodedTxData < UnshieldingTransferProps > | undefined > => {
182
182
const source = props [ 0 ] ?. source ;
183
183
const destination = props [ 0 ] ?. data [ 0 ] ?. target ;
184
184
const token = props [ 0 ] ?. data [ 0 ] ?. token ;
185
185
const amount = props [ 0 ] ?. data [ 0 ] ?. amount ;
186
+ const accountWithSigner =
187
+ signer ? { ...account , publicKey : signer . publicKey } : account ;
186
188
187
189
return await workerBuildTxPair ( {
188
190
rpcUrl,
@@ -196,10 +198,7 @@ export const createUnshieldingTransferTx = async (
196
198
const msg : Unshield = {
197
199
type : "unshield" ,
198
200
payload : {
199
- account : {
200
- ...account ,
201
- publicKey : disposableSigner . publicKey ,
202
- } ,
201
+ account : accountWithSigner ,
203
202
gasConfig,
204
203
props : [ msgValue ] ,
205
204
chain,
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export type UseTransactionPropsEvents<T> = {
44
44
export type UseTransactionProps < T > = {
45
45
params : T [ ] ;
46
46
createTxAtom : AtomType < T > ;
47
- useDisposableSigner ?: boolean ;
47
+ canUseDisposableSigner ?: boolean ;
48
48
eventType : TransactionEventsClasses ;
49
49
parsePendingTxNotification ?: ( tx : TransactionPair < T > ) => PartialNotification ;
50
50
parseErrorTxNotification ?: ( ) => PartialNotification ;
@@ -66,7 +66,7 @@ export type UseTransactionOutput<T> = {
66
66
export const useTransaction = < T , > ( {
67
67
params,
68
68
createTxAtom,
69
- useDisposableSigner ,
69
+ canUseDisposableSigner ,
70
70
eventType,
71
71
parsePendingTxNotification,
72
72
parseErrorTxNotification,
@@ -126,6 +126,8 @@ export const useTransaction = <T,>({
126
126
) ;
127
127
128
128
const txAdditionalParams = { ...additionalParams } ;
129
+ const useDisposableSigner =
130
+ canUseDisposableSigner && feeProps . gasSource === "shielded" ;
129
131
if ( useDisposableSigner ) {
130
132
onBeforeCreateDisposableSigner ?.( ) ;
131
133
txAdditionalParams . signer = await getDisposableSigner ( ) ;
You can’t perform that action at this time.
0 commit comments