better track txids for large wallet operations #380
5 changed files with 102 additions and 15 deletions
52
dist/bundle.es.js
vendored
52
dist/bundle.es.js
vendored
|
@ -1931,7 +1931,7 @@ const selectWalletEncryptSucceeded = reselect.createSelector(selectState, state
|
||||||
|
|
||||||
const selectPendingSupportTransactions = reselect.createSelector(selectState, state => state.pendingSupportTransactions);
|
const selectPendingSupportTransactions = reselect.createSelector(selectState, state => state.pendingSupportTransactions);
|
||||||
|
|
||||||
const selectPendingOtherTransactions = reselect.createSelector(selectState, state => state.pendingConsolidateTxos);
|
const selectPendingOtherTransactions = reselect.createSelector(selectState, state => state.pendingTxos);
|
||||||
|
|
||||||
const selectAbandonClaimSupportError = reselect.createSelector(selectState, state => state.abandonClaimSupportError);
|
const selectAbandonClaimSupportError = reselect.createSelector(selectState, state => state.abandonClaimSupportError);
|
||||||
|
|
||||||
|
@ -2128,6 +2128,10 @@ const selectIsConsolidatingUtxos = reselect.createSelector(selectState, state =>
|
||||||
|
|
||||||
const selectIsMassClaimingTips = reselect.createSelector(selectState, state => state.massClaimingTips);
|
const selectIsMassClaimingTips = reselect.createSelector(selectState, state => state.massClaimingTips);
|
||||||
|
|
||||||
|
const selectPendingConsolidateTxid = reselect.createSelector(selectState, state => state.pendingConsolidateTxid);
|
||||||
|
|
||||||
|
const selectPendingMassClaimTxid = reselect.createSelector(selectState, state => state.pendingMassClaimTxid);
|
||||||
|
|
||||||
const selectUtxoCounts = reselect.createSelector(selectState, state => state.utxoCounts);
|
const selectUtxoCounts = reselect.createSelector(selectState, state => state.utxoCounts);
|
||||||
|
|
||||||
var _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
var _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||||
|
@ -2876,7 +2880,8 @@ function doUtxoConsolidate() {
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: DO_UTXO_CONSOLIDATE_COMPLETED
|
type: DO_UTXO_CONSOLIDATE_COMPLETED,
|
||||||
|
data: { txid: result.txid }
|
||||||
});
|
});
|
||||||
dispatch(doCheckPendingTxs());
|
dispatch(doCheckPendingTxs());
|
||||||
});
|
});
|
||||||
|
@ -2903,7 +2908,8 @@ function doTipClaimMass() {
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: TIP_CLAIM_MASS_COMPLETED
|
type: TIP_CLAIM_MASS_COMPLETED,
|
||||||
|
data: { txid: result.txid }
|
||||||
});
|
});
|
||||||
dispatch(doCheckPendingTxs());
|
dispatch(doCheckPendingTxs());
|
||||||
});
|
});
|
||||||
|
@ -3257,6 +3263,8 @@ const doCheckPendingTxs = () => (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const pendingSupportTxs = selectPendingSupportTransactions(state); // {}
|
const pendingSupportTxs = selectPendingSupportTransactions(state); // {}
|
||||||
const pendingConsolidateTxes = selectPendingOtherTransactions(state);
|
const pendingConsolidateTxes = selectPendingOtherTransactions(state);
|
||||||
|
const pendingConsTxid = selectPendingConsolidateTxid(state);
|
||||||
|
const pendingMassCLaimTxid = selectPendingMassClaimTxid(state);
|
||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
const newPendingTxes = {};
|
const newPendingTxes = {};
|
||||||
|
@ -3302,6 +3310,18 @@ const doCheckPendingTxs = () => (dispatch, getState) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (noLongerPendingConsolidate.length) {
|
if (noLongerPendingConsolidate.length) {
|
||||||
|
if (noLongerPendingConsolidate.includes(pendingConsTxid)) {
|
||||||
|
dispatch(doToast({
|
||||||
|
title: __('Wallet Job'),
|
||||||
|
message: __('Your wallet is finished consolidating')
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (noLongerPendingConsolidate.includes(pendingMassCLaimTxid)) {
|
||||||
|
dispatch(doToast({
|
||||||
|
title: __('Wallet Job'),
|
||||||
|
message: __('Your tips have been collected')
|
||||||
|
}));
|
||||||
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: PENDING_CONSOLIDATED_TXOS_UPDATED,
|
type: PENDING_CONSOLIDATED_TXOS_UPDATED,
|
||||||
data: { txids: noLongerPendingConsolidate, remove: true }
|
data: { txids: noLongerPendingConsolidate, remove: true }
|
||||||
|
@ -5989,12 +6009,14 @@ const defaultState$5 = {
|
||||||
fetchingUtxoCounts: false,
|
fetchingUtxoCounts: false,
|
||||||
fetchingUtxoError: undefined,
|
fetchingUtxoError: undefined,
|
||||||
consolidatingUtxos: false,
|
consolidatingUtxos: false,
|
||||||
|
pendingConsolidateTxid: null,
|
||||||
massClaimingTips: false,
|
massClaimingTips: false,
|
||||||
|
pendingMassClaimTxid: null,
|
||||||
txoPage: {},
|
txoPage: {},
|
||||||
fetchingTxos: false,
|
fetchingTxos: false,
|
||||||
fetchingTxosError: undefined,
|
fetchingTxosError: undefined,
|
||||||
pendingSupportTransactions: {},
|
pendingSupportTransactions: {},
|
||||||
pendingConsolidateTxos: [],
|
pendingTxos: [],
|
||||||
|
|
||||||
abandonClaimSupportError: undefined
|
abandonClaimSupportError: undefined
|
||||||
};
|
};
|
||||||
|
@ -6066,8 +6088,10 @@ const walletReducer = handleActions({
|
||||||
},
|
},
|
||||||
|
|
||||||
[DO_UTXO_CONSOLIDATE_COMPLETED]: (state, action) => {
|
[DO_UTXO_CONSOLIDATE_COMPLETED]: (state, action) => {
|
||||||
|
const { txid } = action.data;
|
||||||
return _extends$d({}, state, {
|
return _extends$d({}, state, {
|
||||||
consolidatingUtxos: false
|
consolidatingUtxos: false,
|
||||||
|
pendingConsolidateTxid: txid
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -6084,8 +6108,10 @@ const walletReducer = handleActions({
|
||||||
},
|
},
|
||||||
|
|
||||||
[TIP_CLAIM_MASS_COMPLETED]: (state, action) => {
|
[TIP_CLAIM_MASS_COMPLETED]: (state, action) => {
|
||||||
|
const { txid } = action.data;
|
||||||
return _extends$d({}, state, {
|
return _extends$d({}, state, {
|
||||||
massClaimingTips: false
|
massClaimingTips: false,
|
||||||
|
pendingMassClaimTxid: txid
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -6096,16 +6122,22 @@ const walletReducer = handleActions({
|
||||||
},
|
},
|
||||||
|
|
||||||
[PENDING_CONSOLIDATED_TXOS_UPDATED]: (state, action) => {
|
[PENDING_CONSOLIDATED_TXOS_UPDATED]: (state, action) => {
|
||||||
const pendingTxos = state.pendingConsolidateTxos;
|
const { pendingTxos, pendingMassClaimTxid, pendingConsolidateTxid } = state;
|
||||||
|
|
||||||
const { txids, remove } = action.data;
|
const { txids, remove } = action.data;
|
||||||
|
|
||||||
if (remove) {
|
if (remove) {
|
||||||
const newTxos = pendingTxos.filter(txo => !txids.includes(txo));
|
const newTxos = pendingTxos.filter(txo => !txids.includes(txo));
|
||||||
return _extends$d({}, state, { pendingConsolidateTxos: newTxos });
|
const newPendingMassClaimTxid = txids.includes(pendingMassClaimTxid) ? undefined : pendingMassClaimTxid;
|
||||||
|
const newPendingConsolidateTxid = txids.includes(pendingConsolidateTxid) ? undefined : pendingConsolidateTxid;
|
||||||
|
return _extends$d({}, state, {
|
||||||
|
pendingTxos: newTxos,
|
||||||
|
pendingMassClaimTxid: newPendingMassClaimTxid,
|
||||||
|
pendingConsolidateTxid: newPendingConsolidateTxid
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
const newPendingSet = new Set([...pendingTxos, ...txids]);
|
const newPendingSet = new Set([...pendingTxos, ...txids]);
|
||||||
return _extends$d({}, state, { pendingConsolidateTxos: Array.from(newPendingSet) });
|
return _extends$d({}, state, { pendingTxos: Array.from(newPendingSet) });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -6634,7 +6666,9 @@ exports.selectMyClaimsWithoutChannels = selectMyClaimsWithoutChannels;
|
||||||
exports.selectMyPurchases = selectMyPurchases;
|
exports.selectMyPurchases = selectMyPurchases;
|
||||||
exports.selectMyPurchasesCount = selectMyPurchasesCount;
|
exports.selectMyPurchasesCount = selectMyPurchasesCount;
|
||||||
exports.selectMyStreamUrlsCount = selectMyStreamUrlsCount;
|
exports.selectMyStreamUrlsCount = selectMyStreamUrlsCount;
|
||||||
|
exports.selectPendingConsolidateTxid = selectPendingConsolidateTxid;
|
||||||
exports.selectPendingIds = selectPendingIds;
|
exports.selectPendingIds = selectPendingIds;
|
||||||
|
exports.selectPendingMassClaimTxid = selectPendingMassClaimTxid;
|
||||||
exports.selectPendingOtherTransactions = selectPendingOtherTransactions;
|
exports.selectPendingOtherTransactions = selectPendingOtherTransactions;
|
||||||
exports.selectPendingSupportTransactions = selectPendingSupportTransactions;
|
exports.selectPendingSupportTransactions = selectPendingSupportTransactions;
|
||||||
exports.selectPlayingUri = selectPlayingUri;
|
exports.selectPlayingUri = selectPlayingUri;
|
||||||
|
|
|
@ -321,4 +321,6 @@ export {
|
||||||
selectIsMassClaimingTips,
|
selectIsMassClaimingTips,
|
||||||
selectUtxoCounts,
|
selectUtxoCounts,
|
||||||
selectPendingOtherTransactions,
|
selectPendingOtherTransactions,
|
||||||
|
selectPendingConsolidateTxid,
|
||||||
|
selectPendingMassClaimTxid,
|
||||||
} from 'redux/selectors/wallet';
|
} from 'redux/selectors/wallet';
|
||||||
|
|
|
@ -6,6 +6,8 @@ import {
|
||||||
selectPendingSupportTransactions,
|
selectPendingSupportTransactions,
|
||||||
selectTxoPageParams,
|
selectTxoPageParams,
|
||||||
selectPendingOtherTransactions,
|
selectPendingOtherTransactions,
|
||||||
|
selectPendingConsolidateTxid,
|
||||||
|
selectPendingMassClaimTxid,
|
||||||
} from 'redux/selectors/wallet';
|
} from 'redux/selectors/wallet';
|
||||||
import { creditsToString } from 'util/format-credits';
|
import { creditsToString } from 'util/format-credits';
|
||||||
import { selectMyClaimsRaw } from 'redux/selectors/claims';
|
import { selectMyClaimsRaw } from 'redux/selectors/claims';
|
||||||
|
@ -169,6 +171,7 @@ export function doUtxoConsolidate() {
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.DO_UTXO_CONSOLIDATE_COMPLETED,
|
type: ACTIONS.DO_UTXO_CONSOLIDATE_COMPLETED,
|
||||||
|
data: { txid: result.txid },
|
||||||
});
|
});
|
||||||
dispatch(doCheckPendingTxs());
|
dispatch(doCheckPendingTxs());
|
||||||
};
|
};
|
||||||
|
@ -190,6 +193,7 @@ export function doTipClaimMass() {
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.TIP_CLAIM_MASS_COMPLETED,
|
type: ACTIONS.TIP_CLAIM_MASS_COMPLETED,
|
||||||
|
data: { txid: result.txid },
|
||||||
});
|
});
|
||||||
dispatch(doCheckPendingTxs());
|
dispatch(doCheckPendingTxs());
|
||||||
};
|
};
|
||||||
|
@ -585,6 +589,8 @@ export const doCheckPendingTxs = () => (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const pendingSupportTxs = selectPendingSupportTransactions(state); // {}
|
const pendingSupportTxs = selectPendingSupportTransactions(state); // {}
|
||||||
const pendingConsolidateTxes = selectPendingOtherTransactions(state);
|
const pendingConsolidateTxes = selectPendingOtherTransactions(state);
|
||||||
|
const pendingConsTxid = selectPendingConsolidateTxid(state);
|
||||||
|
const pendingMassCLaimTxid = selectPendingMassClaimTxid(state);
|
||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
const newPendingTxes = {};
|
const newPendingTxes = {};
|
||||||
|
@ -630,6 +636,20 @@ export const doCheckPendingTxs = () => (dispatch, getState) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (noLongerPendingConsolidate.length) {
|
if (noLongerPendingConsolidate.length) {
|
||||||
|
if (noLongerPendingConsolidate.includes(pendingConsTxid)) {
|
||||||
|
dispatch(
|
||||||
|
doToast({
|
||||||
|
message: __('Your wallet is finished consolidating'),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (noLongerPendingConsolidate.includes(pendingMassCLaimTxid)) {
|
||||||
|
dispatch(
|
||||||
|
doToast({
|
||||||
|
message: __('Your tips have been collected'),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.PENDING_CONSOLIDATED_TXOS_UPDATED,
|
type: ACTIONS.PENDING_CONSOLIDATED_TXOS_UPDATED,
|
||||||
data: { txids: noLongerPendingConsolidate, remove: true },
|
data: { txids: noLongerPendingConsolidate, remove: true },
|
||||||
|
|
|
@ -49,8 +49,12 @@ type WalletState = {
|
||||||
txoPage: any,
|
txoPage: any,
|
||||||
fetchingTxos: boolean,
|
fetchingTxos: boolean,
|
||||||
fetchingTxosError?: string,
|
fetchingTxosError?: string,
|
||||||
|
consolidatingUtxos: boolean,
|
||||||
|
pendingConsolidateTxid?: string,
|
||||||
|
massClaimingTips: boolean,
|
||||||
|
pendingMassClaimTxid?: string,
|
||||||
pendingSupportTransactions: {}, // { claimId: {txid: 123, amount 12.3}, }
|
pendingSupportTransactions: {}, // { claimId: {txid: 123, amount 12.3}, }
|
||||||
pendingConsolidateTxos: Array<string>,
|
pendingTxos: Array<string>,
|
||||||
abandonClaimSupportError?: string,
|
abandonClaimSupportError?: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,12 +95,14 @@ const defaultState = {
|
||||||
fetchingUtxoCounts: false,
|
fetchingUtxoCounts: false,
|
||||||
fetchingUtxoError: undefined,
|
fetchingUtxoError: undefined,
|
||||||
consolidatingUtxos: false,
|
consolidatingUtxos: false,
|
||||||
|
pendingConsolidateTxid: null,
|
||||||
massClaimingTips: false,
|
massClaimingTips: false,
|
||||||
|
pendingMassClaimTxid: null,
|
||||||
txoPage: {},
|
txoPage: {},
|
||||||
fetchingTxos: false,
|
fetchingTxos: false,
|
||||||
fetchingTxosError: undefined,
|
fetchingTxosError: undefined,
|
||||||
pendingSupportTransactions: {},
|
pendingSupportTransactions: {},
|
||||||
pendingConsolidateTxos: [],
|
pendingTxos: [],
|
||||||
|
|
||||||
abandonClaimSupportError: undefined,
|
abandonClaimSupportError: undefined,
|
||||||
};
|
};
|
||||||
|
@ -178,9 +184,11 @@ export const walletReducer = handleActions(
|
||||||
},
|
},
|
||||||
|
|
||||||
[ACTIONS.DO_UTXO_CONSOLIDATE_COMPLETED]: (state: WalletState, action) => {
|
[ACTIONS.DO_UTXO_CONSOLIDATE_COMPLETED]: (state: WalletState, action) => {
|
||||||
|
const { txid } = action.data;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
consolidatingUtxos: false,
|
consolidatingUtxos: false,
|
||||||
|
pendingConsolidateTxid: txid,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -199,9 +207,11 @@ export const walletReducer = handleActions(
|
||||||
},
|
},
|
||||||
|
|
||||||
[ACTIONS.TIP_CLAIM_MASS_COMPLETED]: (state: WalletState, action) => {
|
[ACTIONS.TIP_CLAIM_MASS_COMPLETED]: (state: WalletState, action) => {
|
||||||
|
const { txid } = action.data;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
massClaimingTips: false,
|
massClaimingTips: false,
|
||||||
|
pendingMassClaimTxid: txid,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -213,16 +223,27 @@ export const walletReducer = handleActions(
|
||||||
},
|
},
|
||||||
|
|
||||||
[ACTIONS.PENDING_CONSOLIDATED_TXOS_UPDATED]: (state: WalletState, action) => {
|
[ACTIONS.PENDING_CONSOLIDATED_TXOS_UPDATED]: (state: WalletState, action) => {
|
||||||
const pendingTxos = state.pendingConsolidateTxos;
|
const { pendingTxos, pendingMassClaimTxid, pendingConsolidateTxid } = state;
|
||||||
|
|
||||||
const { txids, remove } = action.data;
|
const { txids, remove } = action.data;
|
||||||
|
|
||||||
if (remove) {
|
if (remove) {
|
||||||
const newTxos = pendingTxos.filter(txo => !txids.includes(txo));
|
const newTxos = pendingTxos.filter(txo => !txids.includes(txo));
|
||||||
return { ...state, pendingConsolidateTxos: newTxos };
|
const newPendingMassClaimTxid = txids.includes(pendingMassClaimTxid)
|
||||||
|
? undefined
|
||||||
|
: pendingMassClaimTxid;
|
||||||
|
const newPendingConsolidateTxid = txids.includes(pendingConsolidateTxid)
|
||||||
|
? undefined
|
||||||
|
: pendingConsolidateTxid;
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
pendingTxos: newTxos,
|
||||||
|
pendingMassClaimTxid: newPendingMassClaimTxid,
|
||||||
|
pendingConsolidateTxid: newPendingConsolidateTxid,
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
const newPendingSet = new Set([...pendingTxos, ...txids]);
|
const newPendingSet = new Set([...pendingTxos, ...txids]);
|
||||||
return { ...state, pendingConsolidateTxos: Array.from(newPendingSet) };
|
return { ...state, pendingTxos: Array.from(newPendingSet) };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ export const selectPendingSupportTransactions = createSelector(
|
||||||
|
|
||||||
export const selectPendingOtherTransactions = createSelector(
|
export const selectPendingOtherTransactions = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.pendingConsolidateTxos
|
state => state.pendingTxos
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectAbandonClaimSupportError = createSelector(
|
export const selectAbandonClaimSupportError = createSelector(
|
||||||
|
@ -401,6 +401,16 @@ export const selectIsMassClaimingTips = createSelector(
|
||||||
state => state.massClaimingTips
|
state => state.massClaimingTips
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectPendingConsolidateTxid = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.pendingConsolidateTxid
|
||||||
|
);
|
||||||
|
|
||||||
|
export const selectPendingMassClaimTxid = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.pendingMassClaimTxid
|
||||||
|
);
|
||||||
|
|
||||||
export const selectUtxoCounts = createSelector(
|
export const selectUtxoCounts = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.utxoCounts
|
state => state.utxoCounts
|
||||||
|
|
Loading…
Reference in a new issue