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_COMPLETED = 'FETCH_UTXO_COUNT_COMPLETED';
|
||||
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_COMPLETED = 'DO_UTXO_CONSOLIDATE_COMPLETED';
|
||||
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_COMPLETED: FETCH_UTXO_COUNT_COMPLETED,
|
||||
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_COMPLETED: DO_UTXO_CONSOLIDATE_COMPLETED,
|
||||
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 selectIsMassClaimingTips = reselect.createSelector(selectState, state => state.massClaimingTips);
|
||||
|
||||
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; };
|
||||
|
@ -2832,15 +2840,12 @@ function doFetchUtxoCounts() {
|
|||
type: FETCH_UTXO_COUNT_STARTED
|
||||
});
|
||||
|
||||
let resultSets = yield Promise.all([lbryProxy.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 }),
|
||||
);
|
||||
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 })]);
|
||||
const counts = {};
|
||||
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['support'] = 0;
|
||||
counts['support'] = typeof supportCount === 'number' ? supportCount : 0;
|
||||
|
||||
dispatch({
|
||||
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() {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
|
@ -5957,6 +5989,7 @@ const defaultState$5 = {
|
|||
fetchingUtxoCounts: false,
|
||||
fetchingUtxoError: undefined,
|
||||
consolidatingUtxos: false,
|
||||
massClaimingTips: false,
|
||||
txoPage: {},
|
||||
fetchingTxos: false,
|
||||
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) => {
|
||||
const pendingTxos = state.pendingConsolidateTxos;
|
||||
|
||||
|
@ -6429,6 +6480,7 @@ exports.doSetDraftTransactionAmount = doSetDraftTransactionAmount;
|
|||
exports.doSetFileListSort = doSetFileListSort;
|
||||
exports.doSetTransactionListFilter = doSetTransactionListFilter;
|
||||
exports.doSupportAbandonForClaim = doSupportAbandonForClaim;
|
||||
exports.doTipClaimMass = doTipClaimMass;
|
||||
exports.doToast = doToast;
|
||||
exports.doUpdateBalance = doUpdateBalance;
|
||||
exports.doUpdateBlockHeight = doUpdateBlockHeight;
|
||||
|
@ -6562,6 +6614,7 @@ exports.selectIsFetchingMyPurchases = selectIsFetchingMyPurchases;
|
|||
exports.selectIsFetchingTransactions = selectIsFetchingTransactions;
|
||||
exports.selectIsFetchingTxos = selectIsFetchingTxos;
|
||||
exports.selectIsFetchingUtxoCounts = selectIsFetchingUtxoCounts;
|
||||
exports.selectIsMassClaimingTips = selectIsMassClaimingTips;
|
||||
exports.selectIsResolvingPublishUris = selectIsResolvingPublishUris;
|
||||
exports.selectIsSendingSupport = selectIsSendingSupport;
|
||||
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_COMPLETED = 'FETCH_UTXO_COUNT_COMPLETED';
|
||||
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_COMPLETED = 'DO_UTXO_CONSOLIDATE_COMPLETED';
|
||||
export const DO_UTXO_CONSOLIDATE_FAILED = 'DO_UTXO_CONSOLIDATE_FAILED';
|
||||
|
|
|
@ -122,6 +122,7 @@ export {
|
|||
doSupportAbandonForClaim,
|
||||
doFetchUtxoCounts,
|
||||
doUtxoConsolidate,
|
||||
doTipClaimMass,
|
||||
} from 'redux/actions/wallet';
|
||||
|
||||
export { doPopulateSharedUserState, doPreferenceGet, doPreferenceSet } from 'redux/actions/sync';
|
||||
|
@ -317,6 +318,7 @@ export {
|
|||
makeSelectPendingAmountByUri,
|
||||
selectIsFetchingUtxoCounts,
|
||||
selectIsConsolidatingUtxos,
|
||||
selectIsMassClaimingTips,
|
||||
selectUtxoCounts,
|
||||
selectPendingOtherTransactions,
|
||||
} from 'redux/selectors/wallet';
|
||||
|
|
|
@ -137,14 +137,13 @@ export function doFetchUtxoCounts() {
|
|||
|
||||
let resultSets = await Promise.all([
|
||||
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 }),
|
||||
Lbry.txo_list({ type: 'support', is_not_spent: true, page: 1, page_size: 1 }),
|
||||
]);
|
||||
const counts = {};
|
||||
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['support'] = 0;
|
||||
counts['support'] = typeof supportCount === 'number' ? supportCount : 0;
|
||||
|
||||
dispatch({
|
||||
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() {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
|
|
|
@ -91,6 +91,7 @@ const defaultState = {
|
|||
fetchingUtxoCounts: false,
|
||||
fetchingUtxoError: undefined,
|
||||
consolidatingUtxos: false,
|
||||
massClaimingTips: false,
|
||||
txoPage: {},
|
||||
fetchingTxos: false,
|
||||
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) => {
|
||||
const pendingTxos = state.pendingConsolidateTxos;
|
||||
|
||||
|
|
|
@ -396,6 +396,11 @@ export const selectIsConsolidatingUtxos = createSelector(
|
|||
state => state.consolidatingUtxos
|
||||
);
|
||||
|
||||
export const selectIsMassClaimingTips = createSelector(
|
||||
selectState,
|
||||
state => state.massClaimingTips
|
||||
);
|
||||
|
||||
export const selectUtxoCounts = createSelector(
|
||||
selectState,
|
||||
state => state.utxoCounts
|
||||
|
|
Loading…
Reference in a new issue