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_COMPLETED = 'ABANDON_CLAIM_SUPPORT_COMPLETED';
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 UPDATE_BALANCE = 'UPDATE_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_COMPLETED: ABANDON_CLAIM_SUPPORT_COMPLETED,
ABANDON_CLAIM_SUPPORT_FAILED: ABANDON_CLAIM_SUPPORT_FAILED,
ABANDON_CLAIM_SUPPORT_PREVIEW: ABANDON_CLAIM_SUPPORT_PREVIEW,
PENDING_SUPPORTS_UPDATED: PENDING_SUPPORTS_UPDATED,
UPDATE_BALANCE: UPDATE_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 selectAbandonClaimSupportError = reselect.createSelector(selectState$1, state => state.abandonClaimSupportError);
const makeSelectPendingAmountByUri = uri => reselect.createSelector(selectClaimIdsByUri, selectPendingSupportTransactions, (claimIdsByUri, pendingSupports) => {
const uriEntry = Object.entries(claimIdsByUri).find(([u, cid]) => u === uri);
const claimId = uriEntry && uriEntry[1];
@ -2821,11 +2825,16 @@ function doWalletUnlock(password) {
function doSupportAbandonForClaim(claimId, claimType, keep, preview) {
return dispatch => {
if (!preview) {
if (preview) {
dispatch({
type: ABANDON_CLAIM_SUPPORT_PREVIEW
});
} else {
dispatch({
type: ABANDON_CLAIM_SUPPORT_STARTED
});
}
const params = { claim_id: claimId };
if (preview) params['preview'] = true;
if (keep) params['keep'] = keep;
@ -5919,7 +5928,8 @@ const defaultState$a = {
walletLockResult: null,
transactionListFilter: 'all',
walletReconnecting: false,
pendingSupportTransactions: {}
pendingSupportTransactions: {},
abandonClaimSupportError: undefined
};
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) => {
const { claimId, type, txid, effective } = action.data;
const pendingtxs = Object.assign({}, state.pendingSupportTransactions);
@ -5989,7 +6011,14 @@ const walletReducer = handleActions({
pendingtxs[claimId] = { txid, type, effective };
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.savePosition = savePosition;
exports.searchReducer = searchReducer;
exports.selectAbandonClaimSupportError = selectAbandonClaimSupportError;
exports.selectAbandoningIds = selectAbandoningIds;
exports.selectAllClaimsByChannel = selectAllClaimsByChannel;
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_COMPLETED = 'ABANDON_CLAIM_SUPPORT_COMPLETED';
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 UPDATE_BALANCE = 'UPDATE_BALANCE';
export const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE';

View file

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

View file

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

View file

@ -46,6 +46,7 @@ type WalletState = {
walletLockResult: ?boolean,
walletReconnecting: boolean,
pendingSupportTransactions: {}, // { claimId: {txid: 123, amount 12.3}, }
abandonClaimSupportError?: string,
};
const defaultState = {
@ -80,6 +81,7 @@ const defaultState = {
transactionListFilter: 'all',
walletReconnecting: false,
pendingSupportTransactions: {},
abandonClaimSupportError: undefined,
};
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 => {
const { claimId, type, txid, effective }: { claimId: string, type: string, txid: string, effective: string } = action.data;
const pendingtxs = Object.assign({}, state.pendingSupportTransactions);
@ -157,6 +173,14 @@ export const walletReducer = handleActions(
return {
...state,
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
);
export const selectAbandonClaimSupportError = createSelector(
selectState,
state => state.abandonClaimSupportError
);
export const makeSelectPendingAmountByUri = (uri) => createSelector(
selectClaimIdsByUri,
selectPendingSupportTransactions,