Merge pull request #298 from lbryio/fix-tipUnlockErrors

Fix tip unlock errors
This commit is contained in:
jessopb 2020-04-01 17:19:59 -04:00 committed by GitHub
commit fde58f6d03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 4 deletions

36
dist/bundle.es.js vendored
View file

@ -65,6 +65,7 @@ const ABANDON_SUPPORT_COMPLETED = 'ABANDON_SUPPORT_COMPLETED';
const ABANDON_CLAIM_SUPPORT_STARTED = 'ABANDON_CLAIM_SUPPORT_STARTED'; const ABANDON_CLAIM_SUPPORT_STARTED = 'ABANDON_CLAIM_SUPPORT_STARTED';
const ABANDON_CLAIM_SUPPORT_COMPLETED = 'ABANDON_CLAIM_SUPPORT_COMPLETED'; const ABANDON_CLAIM_SUPPORT_COMPLETED = 'ABANDON_CLAIM_SUPPORT_COMPLETED';
const ABANDON_CLAIM_SUPPORT_FAILED = 'ABANDON_CLAIM_SUPPORT_FAILED'; const ABANDON_CLAIM_SUPPORT_FAILED = 'ABANDON_CLAIM_SUPPORT_FAILED';
const ABANDON_CLAIM_SUPPORT_PREVIEW = 'ABANDON_CLAIM_SUPPORT_PREVIEW';
const PENDING_SUPPORTS_UPDATED = 'PENDING_SUPPORTS_UPDATED'; const PENDING_SUPPORTS_UPDATED = 'PENDING_SUPPORTS_UPDATED';
const UPDATE_BALANCE = 'UPDATE_BALANCE'; const UPDATE_BALANCE = 'UPDATE_BALANCE';
const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE'; const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE';
@ -334,6 +335,7 @@ var action_types = /*#__PURE__*/Object.freeze({
ABANDON_CLAIM_SUPPORT_STARTED: ABANDON_CLAIM_SUPPORT_STARTED, ABANDON_CLAIM_SUPPORT_STARTED: ABANDON_CLAIM_SUPPORT_STARTED,
ABANDON_CLAIM_SUPPORT_COMPLETED: ABANDON_CLAIM_SUPPORT_COMPLETED, ABANDON_CLAIM_SUPPORT_COMPLETED: ABANDON_CLAIM_SUPPORT_COMPLETED,
ABANDON_CLAIM_SUPPORT_FAILED: ABANDON_CLAIM_SUPPORT_FAILED, ABANDON_CLAIM_SUPPORT_FAILED: ABANDON_CLAIM_SUPPORT_FAILED,
ABANDON_CLAIM_SUPPORT_PREVIEW: ABANDON_CLAIM_SUPPORT_PREVIEW,
PENDING_SUPPORTS_UPDATED: PENDING_SUPPORTS_UPDATED, PENDING_SUPPORTS_UPDATED: PENDING_SUPPORTS_UPDATED,
UPDATE_BALANCE: UPDATE_BALANCE, UPDATE_BALANCE: UPDATE_BALANCE,
UPDATE_TOTAL_BALANCE: UPDATE_TOTAL_BALANCE, UPDATE_TOTAL_BALANCE: UPDATE_TOTAL_BALANCE,
@ -1801,6 +1803,8 @@ const selectWalletEncryptSucceeded = reselect.createSelector(selectState$1, stat
const selectPendingSupportTransactions = reselect.createSelector(selectState$1, state => state.pendingSupportTransactions); const selectPendingSupportTransactions = reselect.createSelector(selectState$1, state => state.pendingSupportTransactions);
const selectAbandonClaimSupportError = reselect.createSelector(selectState$1, state => state.abandonClaimSupportError);
const makeSelectPendingAmountByUri = uri => reselect.createSelector(selectClaimIdsByUri, selectPendingSupportTransactions, (claimIdsByUri, pendingSupports) => { const makeSelectPendingAmountByUri = uri => reselect.createSelector(selectClaimIdsByUri, selectPendingSupportTransactions, (claimIdsByUri, pendingSupports) => {
const uriEntry = Object.entries(claimIdsByUri).find(([u, cid]) => u === uri); const uriEntry = Object.entries(claimIdsByUri).find(([u, cid]) => u === uri);
const claimId = uriEntry && uriEntry[1]; const claimId = uriEntry && uriEntry[1];
@ -2821,11 +2825,16 @@ function doWalletUnlock(password) {
function doSupportAbandonForClaim(claimId, claimType, keep, preview) { function doSupportAbandonForClaim(claimId, claimType, keep, preview) {
return dispatch => { return dispatch => {
if (!preview) { if (preview) {
dispatch({
type: ABANDON_CLAIM_SUPPORT_PREVIEW
});
} else {
dispatch({ dispatch({
type: ABANDON_CLAIM_SUPPORT_STARTED type: ABANDON_CLAIM_SUPPORT_STARTED
}); });
} }
const params = { claim_id: claimId }; const params = { claim_id: claimId };
if (preview) params['preview'] = true; if (preview) params['preview'] = true;
if (keep) params['keep'] = keep; if (keep) params['keep'] = keep;
@ -5919,7 +5928,8 @@ const defaultState$a = {
walletLockResult: null, walletLockResult: null,
transactionListFilter: 'all', transactionListFilter: 'all',
walletReconnecting: false, walletReconnecting: false,
pendingSupportTransactions: {} pendingSupportTransactions: {},
abandonClaimSupportError: undefined
}; };
const walletReducer = handleActions({ const walletReducer = handleActions({
@ -5982,6 +5992,18 @@ const walletReducer = handleActions({
}); });
}, },
[ABANDON_CLAIM_SUPPORT_STARTED]: (state, action) => {
return _extends$i({}, state, {
abandonClaimSupportError: undefined
});
},
[ABANDON_CLAIM_SUPPORT_PREVIEW]: (state, action) => {
return _extends$i({}, state, {
abandonClaimSupportError: undefined
});
},
[ABANDON_CLAIM_SUPPORT_COMPLETED]: (state, action) => { [ABANDON_CLAIM_SUPPORT_COMPLETED]: (state, action) => {
const { claimId, type, txid, effective } = action.data; const { claimId, type, txid, effective } = action.data;
const pendingtxs = Object.assign({}, state.pendingSupportTransactions); const pendingtxs = Object.assign({}, state.pendingSupportTransactions);
@ -5989,7 +6011,14 @@ const walletReducer = handleActions({
pendingtxs[claimId] = { txid, type, effective }; pendingtxs[claimId] = { txid, type, effective };
return _extends$i({}, state, { return _extends$i({}, state, {
pendingSupportTransactions: pendingtxs pendingSupportTransactions: pendingtxs,
abandonClaimSupportError: undefined
});
},
[ABANDON_CLAIM_SUPPORT_FAILED]: (state, action) => {
return _extends$i({}, state, {
abandonClaimSupportError: action.data
}); });
}, },
@ -6466,6 +6495,7 @@ exports.regexAddress = regexAddress;
exports.regexInvalidURI = regexInvalidURI; exports.regexInvalidURI = regexInvalidURI;
exports.savePosition = savePosition; exports.savePosition = savePosition;
exports.searchReducer = searchReducer; exports.searchReducer = searchReducer;
exports.selectAbandonClaimSupportError = selectAbandonClaimSupportError;
exports.selectAbandoningIds = selectAbandoningIds; exports.selectAbandoningIds = selectAbandoningIds;
exports.selectAllClaimsByChannel = selectAllClaimsByChannel; exports.selectAllClaimsByChannel = selectAllClaimsByChannel;
exports.selectAllFetchingChannelClaims = selectAllFetchingChannelClaims; exports.selectAllFetchingChannelClaims = selectAllFetchingChannelClaims;

View file

@ -42,6 +42,7 @@ export const ABANDON_SUPPORT_COMPLETED = 'ABANDON_SUPPORT_COMPLETED';
export const ABANDON_CLAIM_SUPPORT_STARTED = 'ABANDON_CLAIM_SUPPORT_STARTED'; export const ABANDON_CLAIM_SUPPORT_STARTED = 'ABANDON_CLAIM_SUPPORT_STARTED';
export const ABANDON_CLAIM_SUPPORT_COMPLETED = 'ABANDON_CLAIM_SUPPORT_COMPLETED'; export const ABANDON_CLAIM_SUPPORT_COMPLETED = 'ABANDON_CLAIM_SUPPORT_COMPLETED';
export const ABANDON_CLAIM_SUPPORT_FAILED = 'ABANDON_CLAIM_SUPPORT_FAILED'; export const ABANDON_CLAIM_SUPPORT_FAILED = 'ABANDON_CLAIM_SUPPORT_FAILED';
export const ABANDON_CLAIM_SUPPORT_PREVIEW = 'ABANDON_CLAIM_SUPPORT_PREVIEW';
export const PENDING_SUPPORTS_UPDATED = 'PENDING_SUPPORTS_UPDATED'; export const PENDING_SUPPORTS_UPDATED = 'PENDING_SUPPORTS_UPDATED';
export const UPDATE_BALANCE = 'UPDATE_BALANCE'; export const UPDATE_BALANCE = 'UPDATE_BALANCE';
export const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE'; export const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE';

View file

@ -332,6 +332,7 @@ export {
selectFilteredTransactionCount, selectFilteredTransactionCount,
selectIsWalletReconnecting, selectIsWalletReconnecting,
selectPendingSupportTransactions, selectPendingSupportTransactions,
selectAbandonClaimSupportError,
makeSelectPendingAmountByUri, makeSelectPendingAmountByUri,
} from 'redux/selectors/wallet'; } from 'redux/selectors/wallet';

View file

@ -345,11 +345,16 @@ export function doWalletLock() {
export function doSupportAbandonForClaim(claimId, claimType, keep, preview) { export function doSupportAbandonForClaim(claimId, claimType, keep, preview) {
return dispatch => { return dispatch => {
if (!preview) { if (preview) {
dispatch({
type: ACTIONS.ABANDON_CLAIM_SUPPORT_PREVIEW,
});
} else {
dispatch({ dispatch({
type: ACTIONS.ABANDON_CLAIM_SUPPORT_STARTED, type: ACTIONS.ABANDON_CLAIM_SUPPORT_STARTED,
}); });
} }
const params = {claim_id: claimId}; const params = {claim_id: claimId};
if (preview) params['preview'] = true; if (preview) params['preview'] = true;
if (keep) params['keep'] = keep; if (keep) params['keep'] = keep;

View file

@ -46,6 +46,7 @@ type WalletState = {
walletLockResult: ?boolean, walletLockResult: ?boolean,
walletReconnecting: boolean, walletReconnecting: boolean,
pendingSupportTransactions: {}, // { claimId: {txid: 123, amount 12.3}, } pendingSupportTransactions: {}, // { claimId: {txid: 123, amount 12.3}, }
abandonClaimSupportError?: string,
}; };
const defaultState = { const defaultState = {
@ -80,6 +81,7 @@ const defaultState = {
transactionListFilter: 'all', transactionListFilter: 'all',
walletReconnecting: false, walletReconnecting: false,
pendingSupportTransactions: {}, pendingSupportTransactions: {},
abandonClaimSupportError: undefined,
}; };
export const walletReducer = handleActions( export const walletReducer = handleActions(
@ -148,6 +150,20 @@ export const walletReducer = handleActions(
}; };
}, },
[ACTIONS.ABANDON_CLAIM_SUPPORT_STARTED]: (state: WalletState, action: any): WalletState => {
return {
...state,
abandonClaimSupportError: undefined,
};
},
[ACTIONS.ABANDON_CLAIM_SUPPORT_PREVIEW]: (state: WalletState, action: any): WalletState => {
return {
...state,
abandonClaimSupportError: undefined,
};
},
[ACTIONS.ABANDON_CLAIM_SUPPORT_COMPLETED]: (state: WalletState, action: any): WalletState => { [ACTIONS.ABANDON_CLAIM_SUPPORT_COMPLETED]: (state: WalletState, action: any): WalletState => {
const { claimId, type, txid, effective }: { claimId: string, type: string, txid: string, effective: string } = action.data; const { claimId, type, txid, effective }: { claimId: string, type: string, txid: string, effective: string } = action.data;
const pendingtxs = Object.assign({}, state.pendingSupportTransactions); const pendingtxs = Object.assign({}, state.pendingSupportTransactions);
@ -157,6 +173,14 @@ export const walletReducer = handleActions(
return { return {
...state, ...state,
pendingSupportTransactions: pendingtxs, pendingSupportTransactions: pendingtxs,
abandonClaimSupportError: undefined,
};
},
[ACTIONS.ABANDON_CLAIM_SUPPORT_FAILED]: (state: WalletState, action: any): WalletState => {
return {
...state,
abandonClaimSupportError: action.data,
}; };
}, },

View file

@ -26,6 +26,11 @@ export const selectPendingSupportTransactions = createSelector(
state => state.pendingSupportTransactions state => state.pendingSupportTransactions
); );
export const selectAbandonClaimSupportError = createSelector(
selectState,
state => state.abandonClaimSupportError
);
export const makeSelectPendingAmountByUri = (uri) => createSelector( export const makeSelectPendingAmountByUri = (uri) => createSelector(
selectClaimIdsByUri, selectClaimIdsByUri,
selectPendingSupportTransactions, selectPendingSupportTransactions,