Skip to content

Commit

Permalink
Clear wallet service
Browse files Browse the repository at this point in the history
Avoids Enkrypt loading previous selected option
  • Loading branch information
lserra-iov authored and ronaldsg20 committed Dec 5, 2024
1 parent e5e780e commit 6f9a042
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
3 changes: 1 addition & 2 deletions src/common/components/exchange/SelectBitcoinWallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ export default {
}
function setBitcoinWallet(wallet: BtcWallet): void {
addBitcoinWallet(wallet);
toSendBitcoin();
addBitcoinWallet(wallet).then(toSendBitcoin);
}
return {
Expand Down
1 change: 1 addition & 0 deletions src/common/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const getClearPeginTxState = (): PegInTxState => ({
safeFee: new SatoshiBig(0, 'btc'),
},
peginType: constants.peginType.POWPEG,
walletService: undefined,
});

export const getClearPegoutTxState = (): PegOutTxState => ({
Expand Down
43 changes: 24 additions & 19 deletions src/pegin/store/PeginTx/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,30 @@ export const actions: ActionTree<PegInTxState, RootState> = {
},
[constants.PEGIN_TX_ADD_BITCOIN_WALLET]: ({ commit, state }, bitcoinWallet: BtcWallet) => {
commit(constants.PEGIN_TX_SET_BITCOIN_WALLET, bitcoinWallet);
switch (bitcoinWallet) {
case constants.WALLET_NAMES.TREZOR.long_name:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, new TrezorService());
break;
case constants.WALLET_NAMES.LEDGER.long_name:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, new LedgerService());
break;
case constants.WALLET_NAMES.LEATHER.long_name:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, new LeatherService());
break;
case constants.WALLET_NAMES.XVERSE.long_name:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, new XverseService());
break;
case constants.WALLET_NAMES.ENKRYPT.long_name:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, new EnkryptService());
break;
default:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, undefined);
break;
try {
switch (bitcoinWallet) {
case constants.WALLET_NAMES.TREZOR.long_name:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, new TrezorService());
break;
case constants.WALLET_NAMES.LEDGER.long_name:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, new LedgerService());
break;
case constants.WALLET_NAMES.LEATHER.long_name:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, new LeatherService());
break;
case constants.WALLET_NAMES.XVERSE.long_name:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, new XverseService());
break;
case constants.WALLET_NAMES.ENKRYPT.long_name:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, new EnkryptService());
break;
default:
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, undefined);
break;
}
} catch (e) {
commit(constants.PEGIN_TX_SET_WALLET_SERVICE, undefined);
return;
}
commit(
constants.PEGIN_TX_WALLET_SERVICE_SUBSCRIBE,
Expand Down

0 comments on commit 6f9a042

Please sign in to comment.