adds abandonClaiSupportError to wallet reducer
This commit is contained in:
parent
90ba18d060
commit
de41f6bb8e
5 changed files with 50 additions and 12 deletions
30
dist/bundle.es.js
vendored
30
dist/bundle.es.js
vendored
|
@ -1801,6 +1801,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 +2823,10 @@ function doWalletUnlock(password) {
|
|||
|
||||
function doSupportAbandonForClaim(claimId, claimType, keep, preview) {
|
||||
return dispatch => {
|
||||
if (!preview) {
|
||||
dispatch({
|
||||
type: ABANDON_CLAIM_SUPPORT_STARTED
|
||||
});
|
||||
}
|
||||
dispatch({
|
||||
type: ABANDON_CLAIM_SUPPORT_STARTED
|
||||
});
|
||||
|
||||
const params = { claim_id: claimId };
|
||||
if (preview) params['preview'] = true;
|
||||
if (keep) params['keep'] = keep;
|
||||
|
@ -5919,7 +5920,8 @@ const defaultState$a = {
|
|||
walletLockResult: null,
|
||||
transactionListFilter: 'all',
|
||||
walletReconnecting: false,
|
||||
pendingSupportTransactions: {}
|
||||
pendingSupportTransactions: {},
|
||||
abandonClaimSupportError: undefined
|
||||
};
|
||||
|
||||
const walletReducer = handleActions({
|
||||
|
@ -5982,6 +5984,12 @@ const walletReducer = handleActions({
|
|||
});
|
||||
},
|
||||
|
||||
[ABANDON_CLAIM_SUPPORT_STARTED]: (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 +5997,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 +6481,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;
|
||||
|
|
|
@ -332,6 +332,7 @@ export {
|
|||
selectFilteredTransactionCount,
|
||||
selectIsWalletReconnecting,
|
||||
selectPendingSupportTransactions,
|
||||
selectAbandonClaimSupportError,
|
||||
makeSelectPendingAmountByUri,
|
||||
} from 'redux/selectors/wallet';
|
||||
|
||||
|
|
|
@ -345,11 +345,10 @@ export function doWalletLock() {
|
|||
|
||||
export function doSupportAbandonForClaim(claimId, claimType, keep, preview) {
|
||||
return dispatch => {
|
||||
if (!preview) {
|
||||
dispatch({
|
||||
type: ACTIONS.ABANDON_CLAIM_SUPPORT_STARTED,
|
||||
});
|
||||
}
|
||||
dispatch({
|
||||
type: ACTIONS.ABANDON_CLAIM_SUPPORT_STARTED,
|
||||
});
|
||||
|
||||
const params = {claim_id: claimId};
|
||||
if (preview) params['preview'] = true;
|
||||
if (keep) params['keep'] = keep;
|
||||
|
|
|
@ -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,13 @@ export const walletReducer = handleActions(
|
|||
};
|
||||
},
|
||||
|
||||
[ACTIONS.ABANDON_CLAIM_SUPPORT_STARTED]: (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 +166,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,
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue