support mass claiming tips
This commit is contained in:
parent
7c926ad8de
commit
3aee3683ef
6 changed files with 115 additions and 10 deletions
65
dist/bundle.es.js
vendored
65
dist/bundle.es.js
vendored
|
@ -103,6 +103,9 @@ const SET_DRAFT_TRANSACTION_ADDRESS = 'SET_DRAFT_TRANSACTION_ADDRESS';
|
||||||
const FETCH_UTXO_COUNT_STARTED = 'FETCH_UTXO_COUNT_STARTED';
|
const FETCH_UTXO_COUNT_STARTED = 'FETCH_UTXO_COUNT_STARTED';
|
||||||
const FETCH_UTXO_COUNT_COMPLETED = 'FETCH_UTXO_COUNT_COMPLETED';
|
const FETCH_UTXO_COUNT_COMPLETED = 'FETCH_UTXO_COUNT_COMPLETED';
|
||||||
const FETCH_UTXO_COUNT_FAILED = 'FETCH_UTXO_COUNT_FAILED';
|
const FETCH_UTXO_COUNT_FAILED = 'FETCH_UTXO_COUNT_FAILED';
|
||||||
|
const TIP_CLAIM_MASS_STARTED = 'TIP_CLAIM_MASS_STARTED';
|
||||||
|
const TIP_CLAIM_MASS_COMPLETED = 'TIP_CLAIM_MASS_COMPLETED';
|
||||||
|
const TIP_CLAIM_MASS_FAILED = 'TIP_CLAIM_MASS_FAILED';
|
||||||
const DO_UTXO_CONSOLIDATE_STARTED = 'DO_UTXO_CONSOLIDATE_STARTED';
|
const DO_UTXO_CONSOLIDATE_STARTED = 'DO_UTXO_CONSOLIDATE_STARTED';
|
||||||
const DO_UTXO_CONSOLIDATE_COMPLETED = 'DO_UTXO_CONSOLIDATE_COMPLETED';
|
const DO_UTXO_CONSOLIDATE_COMPLETED = 'DO_UTXO_CONSOLIDATE_COMPLETED';
|
||||||
const DO_UTXO_CONSOLIDATE_FAILED = 'DO_UTXO_CONSOLIDATE_FAILED';
|
const DO_UTXO_CONSOLIDATE_FAILED = 'DO_UTXO_CONSOLIDATE_FAILED';
|
||||||
|
@ -377,6 +380,9 @@ var action_types = /*#__PURE__*/Object.freeze({
|
||||||
FETCH_UTXO_COUNT_STARTED: FETCH_UTXO_COUNT_STARTED,
|
FETCH_UTXO_COUNT_STARTED: FETCH_UTXO_COUNT_STARTED,
|
||||||
FETCH_UTXO_COUNT_COMPLETED: FETCH_UTXO_COUNT_COMPLETED,
|
FETCH_UTXO_COUNT_COMPLETED: FETCH_UTXO_COUNT_COMPLETED,
|
||||||
FETCH_UTXO_COUNT_FAILED: FETCH_UTXO_COUNT_FAILED,
|
FETCH_UTXO_COUNT_FAILED: FETCH_UTXO_COUNT_FAILED,
|
||||||
|
TIP_CLAIM_MASS_STARTED: TIP_CLAIM_MASS_STARTED,
|
||||||
|
TIP_CLAIM_MASS_COMPLETED: TIP_CLAIM_MASS_COMPLETED,
|
||||||
|
TIP_CLAIM_MASS_FAILED: TIP_CLAIM_MASS_FAILED,
|
||||||
DO_UTXO_CONSOLIDATE_STARTED: DO_UTXO_CONSOLIDATE_STARTED,
|
DO_UTXO_CONSOLIDATE_STARTED: DO_UTXO_CONSOLIDATE_STARTED,
|
||||||
DO_UTXO_CONSOLIDATE_COMPLETED: DO_UTXO_CONSOLIDATE_COMPLETED,
|
DO_UTXO_CONSOLIDATE_COMPLETED: DO_UTXO_CONSOLIDATE_COMPLETED,
|
||||||
DO_UTXO_CONSOLIDATE_FAILED: DO_UTXO_CONSOLIDATE_FAILED,
|
DO_UTXO_CONSOLIDATE_FAILED: DO_UTXO_CONSOLIDATE_FAILED,
|
||||||
|
@ -2120,6 +2126,8 @@ const selectIsFetchingUtxoCounts = reselect.createSelector(selectState, state =>
|
||||||
|
|
||||||
const selectIsConsolidatingUtxos = reselect.createSelector(selectState, state => state.consolidatingUtxos);
|
const selectIsConsolidatingUtxos = reselect.createSelector(selectState, state => state.consolidatingUtxos);
|
||||||
|
|
||||||
|
const selectIsMassClaimingTips = reselect.createSelector(selectState, state => state.massClaimingTips);
|
||||||
|
|
||||||
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; };
|
||||||
|
@ -2832,15 +2840,12 @@ function doFetchUtxoCounts() {
|
||||||
type: FETCH_UTXO_COUNT_STARTED
|
type: FETCH_UTXO_COUNT_STARTED
|
||||||
});
|
});
|
||||||
|
|
||||||
let resultSets = yield Promise.all([lbryProxy.txo_list({ type: 'other', is_not_spent: true, page: 1, page_size: 1 })]
|
let resultSets = yield Promise.all([lbryProxy.txo_list({ type: 'other', is_not_spent: true, page: 1, page_size: 1 }), lbryProxy.txo_list({ type: 'support', is_not_spent: true, page: 1, page_size: 1 })]);
|
||||||
// removing until we figure out sdk load / need it
|
|
||||||
// Lbry.txo_list({ type: 'support', is_not_spent: true }),
|
|
||||||
);
|
|
||||||
const counts = {};
|
const counts = {};
|
||||||
const paymentCount = resultSets[0]['total_items'];
|
const paymentCount = resultSets[0]['total_items'];
|
||||||
// const supportCount = resultSets[1]['total_items'];
|
const supportCount = resultSets[1]['total_items'];
|
||||||
counts['other'] = typeof paymentCount === 'number' ? paymentCount : 0;
|
counts['other'] = typeof paymentCount === 'number' ? paymentCount : 0;
|
||||||
counts['support'] = 0;
|
counts['support'] = typeof supportCount === 'number' ? supportCount : 0;
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: FETCH_UTXO_COUNT_COMPLETED,
|
type: FETCH_UTXO_COUNT_COMPLETED,
|
||||||
|
@ -2882,6 +2887,33 @@ function doUtxoConsolidate() {
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doTipClaimMass() {
|
||||||
|
return (() => {
|
||||||
|
var _ref3 = _asyncToGenerator(function* (dispatch) {
|
||||||
|
dispatch({
|
||||||
|
type: TIP_CLAIM_MASS_STARTED
|
||||||
|
});
|
||||||
|
|
||||||
|
const results = yield lbryProxy.txo_spend({ type: 'support', is_not_my_input: true });
|
||||||
|
const result = results[0];
|
||||||
|
|
||||||
|
dispatch({
|
||||||
|
type: PENDING_CONSOLIDATED_TXOS_UPDATED,
|
||||||
|
data: { txids: [result.txid] }
|
||||||
|
});
|
||||||
|
|
||||||
|
dispatch({
|
||||||
|
type: TIP_CLAIM_MASS_COMPLETED
|
||||||
|
});
|
||||||
|
dispatch(doCheckPendingTxs());
|
||||||
|
});
|
||||||
|
|
||||||
|
return function (_x3) {
|
||||||
|
return _ref3.apply(this, arguments);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
function doGetNewAddress() {
|
function doGetNewAddress() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -5957,6 +5989,7 @@ const defaultState$5 = {
|
||||||
fetchingUtxoCounts: false,
|
fetchingUtxoCounts: false,
|
||||||
fetchingUtxoError: undefined,
|
fetchingUtxoError: undefined,
|
||||||
consolidatingUtxos: false,
|
consolidatingUtxos: false,
|
||||||
|
massClaimingTips: false,
|
||||||
txoPage: {},
|
txoPage: {},
|
||||||
fetchingTxos: false,
|
fetchingTxos: false,
|
||||||
fetchingTxosError: undefined,
|
fetchingTxosError: undefined,
|
||||||
|
@ -6044,6 +6077,24 @@ const walletReducer = handleActions({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
[TIP_CLAIM_MASS_STARTED]: state => {
|
||||||
|
return _extends$d({}, state, {
|
||||||
|
massClaimingTips: true
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
[TIP_CLAIM_MASS_COMPLETED]: (state, action) => {
|
||||||
|
return _extends$d({}, state, {
|
||||||
|
massClaimingTips: false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
[TIP_CLAIM_MASS_FAILED]: (state, action) => {
|
||||||
|
return _extends$d({}, state, {
|
||||||
|
massClaimingTips: false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
[PENDING_CONSOLIDATED_TXOS_UPDATED]: (state, action) => {
|
[PENDING_CONSOLIDATED_TXOS_UPDATED]: (state, action) => {
|
||||||
const pendingTxos = state.pendingConsolidateTxos;
|
const pendingTxos = state.pendingConsolidateTxos;
|
||||||
|
|
||||||
|
@ -6429,6 +6480,7 @@ exports.doSetDraftTransactionAmount = doSetDraftTransactionAmount;
|
||||||
exports.doSetFileListSort = doSetFileListSort;
|
exports.doSetFileListSort = doSetFileListSort;
|
||||||
exports.doSetTransactionListFilter = doSetTransactionListFilter;
|
exports.doSetTransactionListFilter = doSetTransactionListFilter;
|
||||||
exports.doSupportAbandonForClaim = doSupportAbandonForClaim;
|
exports.doSupportAbandonForClaim = doSupportAbandonForClaim;
|
||||||
|
exports.doTipClaimMass = doTipClaimMass;
|
||||||
exports.doToast = doToast;
|
exports.doToast = doToast;
|
||||||
exports.doUpdateBalance = doUpdateBalance;
|
exports.doUpdateBalance = doUpdateBalance;
|
||||||
exports.doUpdateBlockHeight = doUpdateBlockHeight;
|
exports.doUpdateBlockHeight = doUpdateBlockHeight;
|
||||||
|
@ -6562,6 +6614,7 @@ exports.selectIsFetchingMyPurchases = selectIsFetchingMyPurchases;
|
||||||
exports.selectIsFetchingTransactions = selectIsFetchingTransactions;
|
exports.selectIsFetchingTransactions = selectIsFetchingTransactions;
|
||||||
exports.selectIsFetchingTxos = selectIsFetchingTxos;
|
exports.selectIsFetchingTxos = selectIsFetchingTxos;
|
||||||
exports.selectIsFetchingUtxoCounts = selectIsFetchingUtxoCounts;
|
exports.selectIsFetchingUtxoCounts = selectIsFetchingUtxoCounts;
|
||||||
|
exports.selectIsMassClaimingTips = selectIsMassClaimingTips;
|
||||||
exports.selectIsResolvingPublishUris = selectIsResolvingPublishUris;
|
exports.selectIsResolvingPublishUris = selectIsResolvingPublishUris;
|
||||||
exports.selectIsSendingSupport = selectIsSendingSupport;
|
exports.selectIsSendingSupport = selectIsSendingSupport;
|
||||||
exports.selectIsStillEditing = selectIsStillEditing;
|
exports.selectIsStillEditing = selectIsStillEditing;
|
||||||
|
|
|
@ -82,6 +82,9 @@ export const SET_DRAFT_TRANSACTION_ADDRESS = 'SET_DRAFT_TRANSACTION_ADDRESS';
|
||||||
export const FETCH_UTXO_COUNT_STARTED = 'FETCH_UTXO_COUNT_STARTED';
|
export const FETCH_UTXO_COUNT_STARTED = 'FETCH_UTXO_COUNT_STARTED';
|
||||||
export const FETCH_UTXO_COUNT_COMPLETED = 'FETCH_UTXO_COUNT_COMPLETED';
|
export const FETCH_UTXO_COUNT_COMPLETED = 'FETCH_UTXO_COUNT_COMPLETED';
|
||||||
export const FETCH_UTXO_COUNT_FAILED = 'FETCH_UTXO_COUNT_FAILED';
|
export const FETCH_UTXO_COUNT_FAILED = 'FETCH_UTXO_COUNT_FAILED';
|
||||||
|
export const TIP_CLAIM_MASS_STARTED = 'TIP_CLAIM_MASS_STARTED';
|
||||||
|
export const TIP_CLAIM_MASS_COMPLETED = 'TIP_CLAIM_MASS_COMPLETED';
|
||||||
|
export const TIP_CLAIM_MASS_FAILED = 'TIP_CLAIM_MASS_FAILED';
|
||||||
export const DO_UTXO_CONSOLIDATE_STARTED = 'DO_UTXO_CONSOLIDATE_STARTED';
|
export const DO_UTXO_CONSOLIDATE_STARTED = 'DO_UTXO_CONSOLIDATE_STARTED';
|
||||||
export const DO_UTXO_CONSOLIDATE_COMPLETED = 'DO_UTXO_CONSOLIDATE_COMPLETED';
|
export const DO_UTXO_CONSOLIDATE_COMPLETED = 'DO_UTXO_CONSOLIDATE_COMPLETED';
|
||||||
export const DO_UTXO_CONSOLIDATE_FAILED = 'DO_UTXO_CONSOLIDATE_FAILED';
|
export const DO_UTXO_CONSOLIDATE_FAILED = 'DO_UTXO_CONSOLIDATE_FAILED';
|
||||||
|
|
|
@ -122,6 +122,7 @@ export {
|
||||||
doSupportAbandonForClaim,
|
doSupportAbandonForClaim,
|
||||||
doFetchUtxoCounts,
|
doFetchUtxoCounts,
|
||||||
doUtxoConsolidate,
|
doUtxoConsolidate,
|
||||||
|
doTipClaimMass,
|
||||||
} from 'redux/actions/wallet';
|
} from 'redux/actions/wallet';
|
||||||
|
|
||||||
export { doPopulateSharedUserState, doPreferenceGet, doPreferenceSet } from 'redux/actions/sync';
|
export { doPopulateSharedUserState, doPreferenceGet, doPreferenceSet } from 'redux/actions/sync';
|
||||||
|
@ -317,6 +318,7 @@ export {
|
||||||
makeSelectPendingAmountByUri,
|
makeSelectPendingAmountByUri,
|
||||||
selectIsFetchingUtxoCounts,
|
selectIsFetchingUtxoCounts,
|
||||||
selectIsConsolidatingUtxos,
|
selectIsConsolidatingUtxos,
|
||||||
|
selectIsMassClaimingTips,
|
||||||
selectUtxoCounts,
|
selectUtxoCounts,
|
||||||
selectPendingOtherTransactions,
|
selectPendingOtherTransactions,
|
||||||
} from 'redux/selectors/wallet';
|
} from 'redux/selectors/wallet';
|
||||||
|
|
|
@ -137,14 +137,13 @@ export function doFetchUtxoCounts() {
|
||||||
|
|
||||||
let resultSets = await Promise.all([
|
let resultSets = await Promise.all([
|
||||||
Lbry.txo_list({ type: 'other', is_not_spent: true, page: 1, page_size: 1 }),
|
Lbry.txo_list({ type: 'other', is_not_spent: true, page: 1, page_size: 1 }),
|
||||||
// removing until we figure out sdk load / need it
|
Lbry.txo_list({ type: 'support', is_not_spent: true, page: 1, page_size: 1 }),
|
||||||
// Lbry.txo_list({ type: 'support', is_not_spent: true }),
|
|
||||||
]);
|
]);
|
||||||
const counts = {};
|
const counts = {};
|
||||||
const paymentCount = resultSets[0]['total_items'];
|
const paymentCount = resultSets[0]['total_items'];
|
||||||
// const supportCount = resultSets[1]['total_items'];
|
const supportCount = resultSets[1]['total_items'];
|
||||||
counts['other'] = typeof paymentCount === 'number' ? paymentCount : 0;
|
counts['other'] = typeof paymentCount === 'number' ? paymentCount : 0;
|
||||||
counts['support'] = 0;
|
counts['support'] = typeof supportCount === 'number' ? supportCount : 0;
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.FETCH_UTXO_COUNT_COMPLETED,
|
type: ACTIONS.FETCH_UTXO_COUNT_COMPLETED,
|
||||||
|
@ -175,6 +174,27 @@ export function doUtxoConsolidate() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function doTipClaimMass() {
|
||||||
|
return async dispatch => {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.TIP_CLAIM_MASS_STARTED,
|
||||||
|
});
|
||||||
|
|
||||||
|
const results = await Lbry.txo_spend({ type: 'support', is_not_my_input: true });
|
||||||
|
const result = results[0];
|
||||||
|
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.PENDING_CONSOLIDATED_TXOS_UPDATED,
|
||||||
|
data: { txids: [result.txid] },
|
||||||
|
});
|
||||||
|
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.TIP_CLAIM_MASS_COMPLETED,
|
||||||
|
});
|
||||||
|
dispatch(doCheckPendingTxs());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function doGetNewAddress() {
|
export function doGetNewAddress() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
@ -91,6 +91,7 @@ const defaultState = {
|
||||||
fetchingUtxoCounts: false,
|
fetchingUtxoCounts: false,
|
||||||
fetchingUtxoError: undefined,
|
fetchingUtxoError: undefined,
|
||||||
consolidatingUtxos: false,
|
consolidatingUtxos: false,
|
||||||
|
massClaimingTips: false,
|
||||||
txoPage: {},
|
txoPage: {},
|
||||||
fetchingTxos: false,
|
fetchingTxos: false,
|
||||||
fetchingTxosError: undefined,
|
fetchingTxosError: undefined,
|
||||||
|
@ -190,6 +191,27 @@ export const walletReducer = handleActions(
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
[ACTIONS.TIP_CLAIM_MASS_STARTED]: (state: WalletState) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
massClaimingTips: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
[ACTIONS.TIP_CLAIM_MASS_COMPLETED]: (state: WalletState, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
massClaimingTips: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
[ACTIONS.TIP_CLAIM_MASS_FAILED]: (state: WalletState, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
massClaimingTips: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
[ACTIONS.PENDING_CONSOLIDATED_TXOS_UPDATED]: (state: WalletState, action) => {
|
[ACTIONS.PENDING_CONSOLIDATED_TXOS_UPDATED]: (state: WalletState, action) => {
|
||||||
const pendingTxos = state.pendingConsolidateTxos;
|
const pendingTxos = state.pendingConsolidateTxos;
|
||||||
|
|
||||||
|
|
|
@ -396,6 +396,11 @@ export const selectIsConsolidatingUtxos = createSelector(
|
||||||
state => state.consolidatingUtxos
|
state => state.consolidatingUtxos
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectIsMassClaimingTips = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.massClaimingTips
|
||||||
|
);
|
||||||
|
|
||||||
export const selectUtxoCounts = createSelector(
|
export const selectUtxoCounts = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.utxoCounts
|
state => state.utxoCounts
|
||||||
|
|
Loading…
Reference in a new issue