commit
3a676d474b
15 changed files with 580 additions and 397 deletions
442
dist/bundle.es.js
vendored
442
dist/bundle.es.js
vendored
|
@ -43,6 +43,10 @@ const GET_NEW_ADDRESS_STARTED = 'GET_NEW_ADDRESS_STARTED';
|
||||||
const GET_NEW_ADDRESS_COMPLETED = 'GET_NEW_ADDRESS_COMPLETED';
|
const GET_NEW_ADDRESS_COMPLETED = 'GET_NEW_ADDRESS_COMPLETED';
|
||||||
const FETCH_TRANSACTIONS_STARTED = 'FETCH_TRANSACTIONS_STARTED';
|
const FETCH_TRANSACTIONS_STARTED = 'FETCH_TRANSACTIONS_STARTED';
|
||||||
const FETCH_TRANSACTIONS_COMPLETED = 'FETCH_TRANSACTIONS_COMPLETED';
|
const FETCH_TRANSACTIONS_COMPLETED = 'FETCH_TRANSACTIONS_COMPLETED';
|
||||||
|
const FETCH_SUPPORTS_STARTED = 'FETCH_SUPPORTS_STARTED';
|
||||||
|
const FETCH_SUPPORTS_COMPLETED = 'FETCH_SUPPORTS_COMPLETED';
|
||||||
|
const ABANDON_SUPPORT_STARTED = 'ABANDON_SUPPORT_STARTED';
|
||||||
|
const ABANDON_SUPPORT_COMPLETED = 'ABANDON_SUPPORT_COMPLETED';
|
||||||
const UPDATE_BALANCE = 'UPDATE_BALANCE';
|
const UPDATE_BALANCE = 'UPDATE_BALANCE';
|
||||||
const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE';
|
const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE';
|
||||||
const CHECK_ADDRESS_IS_MINE_STARTED = 'CHECK_ADDRESS_IS_MINE_STARTED';
|
const CHECK_ADDRESS_IS_MINE_STARTED = 'CHECK_ADDRESS_IS_MINE_STARTED';
|
||||||
|
@ -254,6 +258,10 @@ var action_types = /*#__PURE__*/Object.freeze({
|
||||||
GET_NEW_ADDRESS_COMPLETED: GET_NEW_ADDRESS_COMPLETED,
|
GET_NEW_ADDRESS_COMPLETED: GET_NEW_ADDRESS_COMPLETED,
|
||||||
FETCH_TRANSACTIONS_STARTED: FETCH_TRANSACTIONS_STARTED,
|
FETCH_TRANSACTIONS_STARTED: FETCH_TRANSACTIONS_STARTED,
|
||||||
FETCH_TRANSACTIONS_COMPLETED: FETCH_TRANSACTIONS_COMPLETED,
|
FETCH_TRANSACTIONS_COMPLETED: FETCH_TRANSACTIONS_COMPLETED,
|
||||||
|
FETCH_SUPPORTS_STARTED: FETCH_SUPPORTS_STARTED,
|
||||||
|
FETCH_SUPPORTS_COMPLETED: FETCH_SUPPORTS_COMPLETED,
|
||||||
|
ABANDON_SUPPORT_STARTED: ABANDON_SUPPORT_STARTED,
|
||||||
|
ABANDON_SUPPORT_COMPLETED: ABANDON_SUPPORT_COMPLETED,
|
||||||
UPDATE_BALANCE: UPDATE_BALANCE,
|
UPDATE_BALANCE: UPDATE_BALANCE,
|
||||||
UPDATE_TOTAL_BALANCE: UPDATE_TOTAL_BALANCE,
|
UPDATE_TOTAL_BALANCE: UPDATE_TOTAL_BALANCE,
|
||||||
CHECK_ADDRESS_IS_MINE_STARTED: CHECK_ADDRESS_IS_MINE_STARTED,
|
CHECK_ADDRESS_IS_MINE_STARTED: CHECK_ADDRESS_IS_MINE_STARTED,
|
||||||
|
@ -647,6 +655,7 @@ const Lbry = {
|
||||||
address_unused: (params = {}) => daemonCallWithResult('address_unused', params),
|
address_unused: (params = {}) => daemonCallWithResult('address_unused', params),
|
||||||
transaction_list: (params = {}) => daemonCallWithResult('transaction_list', params),
|
transaction_list: (params = {}) => daemonCallWithResult('transaction_list', params),
|
||||||
utxo_release: (params = {}) => daemonCallWithResult('utxo_release', params),
|
utxo_release: (params = {}) => daemonCallWithResult('utxo_release', params),
|
||||||
|
support_abandon: (params = {}) => daemonCallWithResult('support_abandon', params),
|
||||||
|
|
||||||
sync_hash: (params = {}) => daemonCallWithResult('sync_hash', params),
|
sync_hash: (params = {}) => daemonCallWithResult('sync_hash', params),
|
||||||
sync_apply: (params = {}) => daemonCallWithResult('sync_apply', params),
|
sync_apply: (params = {}) => daemonCallWithResult('sync_apply', params),
|
||||||
|
@ -975,7 +984,7 @@ function isURIClaimable(URI) {
|
||||||
|
|
||||||
function convertToShareLink(URI) {
|
function convertToShareLink(URI) {
|
||||||
const { claimName, path, bidPosition, claimSequence, claimId } = parseURI(URI);
|
const { claimName, path, bidPosition, claimSequence, claimId } = parseURI(URI);
|
||||||
return buildURI({ claimName, path, claimSequence, bidPosition, claimId }, true, 'https://open.lbry.io/');
|
return buildURI({ claimName, path, claimSequence, bidPosition, claimId }, true, 'https://open.lbry.com/');
|
||||||
}
|
}
|
||||||
|
|
||||||
var _extends$1 = 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$1 = 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; };
|
||||||
|
@ -1421,7 +1430,9 @@ const selectBalance = reselect.createSelector(selectState$2, state => state.bala
|
||||||
|
|
||||||
const selectTotalBalance = reselect.createSelector(selectState$2, state => state.totalBalance);
|
const selectTotalBalance = reselect.createSelector(selectState$2, state => state.totalBalance);
|
||||||
|
|
||||||
const selectTransactionsById = reselect.createSelector(selectState$2, state => state.transactions);
|
const selectTransactionsById = reselect.createSelector(selectState$2, state => state.transactions || {});
|
||||||
|
|
||||||
|
const selectSupportsById = reselect.createSelector(selectState$2, state => state.supports || {});
|
||||||
|
|
||||||
const selectTransactionItems = reselect.createSelector(selectTransactionsById, byId => {
|
const selectTransactionItems = reselect.createSelector(selectTransactionsById, byId => {
|
||||||
const items = [];
|
const items = [];
|
||||||
|
@ -1608,6 +1619,7 @@ function doTotalBalanceSubscribe() {
|
||||||
|
|
||||||
function doFetchTransactions() {
|
function doFetchTransactions() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
|
dispatch(doFetchSupports());
|
||||||
dispatch({
|
dispatch({
|
||||||
type: FETCH_TRANSACTIONS_STARTED
|
type: FETCH_TRANSACTIONS_STARTED
|
||||||
});
|
});
|
||||||
|
@ -1623,6 +1635,23 @@ function doFetchTransactions() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doFetchSupports() {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch({
|
||||||
|
type: FETCH_SUPPORTS_STARTED
|
||||||
|
});
|
||||||
|
|
||||||
|
lbryProxy.support_list().then(results => {
|
||||||
|
dispatch({
|
||||||
|
type: FETCH_SUPPORTS_COMPLETED,
|
||||||
|
data: {
|
||||||
|
supports: results
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function doGetNewAddress() {
|
function doGetNewAddress() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -1966,39 +1995,43 @@ function doAbandonClaim(txid, nout) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const myClaims = selectMyClaimsRaw(state);
|
const myClaims = selectMyClaimsRaw(state);
|
||||||
const claimToAbandon = myClaims.find(claim => claim.txid === txid && claim.nout === nout);
|
const mySupports = selectSupportsById(state);
|
||||||
|
|
||||||
if (!claimToAbandon) {
|
// A user could be trying to abandon a support or one of their claims
|
||||||
console.error('No associated claim with txid: ', txid);
|
const claimToAbandon = myClaims.find(claim => claim.txid === txid && claim.nout === nout);
|
||||||
|
const supportToAbandon = mySupports[txid];
|
||||||
|
|
||||||
|
if (!claimToAbandon && !supportToAbandon) {
|
||||||
|
console.error('No associated support or claim with txid: ', txid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { claim_id: claimId, name: claimName } = claimToAbandon;
|
const data = claimToAbandon ? { claimId: claimToAbandon.claim_id } : { txid: supportToAbandon.txid };
|
||||||
|
|
||||||
|
const isClaim = !!claimToAbandon;
|
||||||
|
const startedActionType = isClaim ? ABANDON_CLAIM_STARTED : ABANDON_SUPPORT_STARTED;
|
||||||
|
const completedActionType = isClaim ? ABANDON_CLAIM_STARTED : ABANDON_SUPPORT_COMPLETED;
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ABANDON_CLAIM_STARTED,
|
type: startedActionType,
|
||||||
data: {
|
data
|
||||||
claimId
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const errorCallback = () => {
|
const errorCallback = () => {
|
||||||
dispatch(doToast({
|
dispatch(doToast({
|
||||||
message: 'Error abandoning claim',
|
message: isClaim ? 'Error abandoning your claim' : 'Error unlocking your tip',
|
||||||
isError: true
|
isError: true
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
const successCallback = () => {
|
const successCallback = () => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ABANDON_CLAIM_SUCCEEDED,
|
type: completedActionType,
|
||||||
data: {
|
data
|
||||||
claimId
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch(doToast({
|
dispatch(doToast({
|
||||||
message: 'Successfully abandoned your claim'
|
message: isClaim ? 'Successfully abandoned your claim' : 'Successfully unlocked your tip!'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// After abandoning, call claim_list to show the claim as abandoned
|
// After abandoning, call claim_list to show the claim as abandoned
|
||||||
|
@ -2013,7 +2046,19 @@ function doAbandonClaim(txid, nout) {
|
||||||
blocking: true
|
blocking: true
|
||||||
};
|
};
|
||||||
|
|
||||||
const method = claimName.startsWith('@') ? 'channel_abandon' : 'stream_abandon';
|
let method;
|
||||||
|
if (supportToAbandon) {
|
||||||
|
method = 'support_abandon';
|
||||||
|
} else if (claimToAbandon) {
|
||||||
|
const { name: claimName } = claimToAbandon;
|
||||||
|
method = claimName.startsWith('@') ? 'channel_abandon' : 'stream_abandon';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!method) {
|
||||||
|
console.error('No "method" chosen for claim or support abandon');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
lbryProxy[method](abandonParams).then(successCallback, errorCallback);
|
lbryProxy[method](abandonParams).then(successCallback, errorCallback);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2355,7 +2400,7 @@ function handleFetchResponse(response) {
|
||||||
const DEBOUNCED_SEARCH_SUGGESTION_MS = 300;
|
const DEBOUNCED_SEARCH_SUGGESTION_MS = 300;
|
||||||
|
|
||||||
// We can't use env's because they aren't passed into node_modules
|
// We can't use env's because they aren't passed into node_modules
|
||||||
let CONNECTION_STRING = 'https://lighthouse.lbry.io/';
|
let CONNECTION_STRING = 'https://lighthouse.lbry.com/';
|
||||||
|
|
||||||
const setSearchApi = endpoint => {
|
const setSearchApi = endpoint => {
|
||||||
CONNECTION_STRING = endpoint.replace(/\/*$/, '/'); // exactly one slash at the end;
|
CONNECTION_STRING = endpoint.replace(/\/*$/, '/'); // exactly one slash at the end;
|
||||||
|
@ -3094,9 +3139,8 @@ const searchReducer = handleActions({
|
||||||
}
|
}
|
||||||
}, defaultState$3);
|
}, defaultState$3);
|
||||||
|
|
||||||
//
|
var _extends$7 = 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; };
|
||||||
|
|
||||||
const reducers$2 = {};
|
|
||||||
const buildDraftTransaction = () => ({
|
const buildDraftTransaction = () => ({
|
||||||
amount: undefined,
|
amount: undefined,
|
||||||
address: undefined
|
address: undefined
|
||||||
|
@ -3109,10 +3153,12 @@ const buildDraftTransaction = () => ({
|
||||||
const defaultState$4 = {
|
const defaultState$4 = {
|
||||||
balance: undefined,
|
balance: undefined,
|
||||||
totalBalance: undefined,
|
totalBalance: undefined,
|
||||||
blocks: {},
|
|
||||||
latestBlock: undefined,
|
latestBlock: undefined,
|
||||||
transactions: {},
|
transactions: {},
|
||||||
fetchingTransactions: false,
|
fetchingTransactions: false,
|
||||||
|
supports: {},
|
||||||
|
fetchingSupports: false,
|
||||||
|
abandoningSupportsById: {},
|
||||||
gettingNewAddress: false,
|
gettingNewAddress: false,
|
||||||
draftTransaction: buildDraftTransaction(),
|
draftTransaction: buildDraftTransaction(),
|
||||||
sendingSupport: false,
|
sendingSupport: false,
|
||||||
|
@ -3132,217 +3178,234 @@ const defaultState$4 = {
|
||||||
transactionListFilter: 'all'
|
transactionListFilter: 'all'
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers$2[FETCH_TRANSACTIONS_STARTED] = state => Object.assign({}, state, {
|
const walletReducer = handleActions({
|
||||||
fetchingTransactions: true
|
[FETCH_TRANSACTIONS_STARTED]: state => _extends$7({}, state, {
|
||||||
});
|
fetchingTransactions: true
|
||||||
|
}),
|
||||||
|
|
||||||
reducers$2[FETCH_TRANSACTIONS_COMPLETED] = (state, action) => {
|
[FETCH_TRANSACTIONS_COMPLETED]: (state, action) => {
|
||||||
const byId = Object.assign({}, state.transactions);
|
const byId = _extends$7({}, state.transactions);
|
||||||
|
|
||||||
const { transactions } = action.data;
|
const { transactions } = action.data;
|
||||||
|
transactions.forEach(transaction => {
|
||||||
|
byId[transaction.txid] = transaction;
|
||||||
|
});
|
||||||
|
|
||||||
transactions.forEach(transaction => {
|
return _extends$7({}, state, {
|
||||||
byId[transaction.txid] = transaction;
|
transactions: byId,
|
||||||
});
|
fetchingTransactions: false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
[FETCH_SUPPORTS_STARTED]: state => _extends$7({}, state, {
|
||||||
transactions: byId,
|
fetchingSupports: true
|
||||||
fetchingTransactions: false
|
}),
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
reducers$2[GET_NEW_ADDRESS_STARTED] = state => Object.assign({}, state, {
|
[FETCH_SUPPORTS_COMPLETED]: (state, action) => {
|
||||||
gettingNewAddress: true
|
const byId = state.supports;
|
||||||
});
|
const { supports } = action.data;
|
||||||
|
|
||||||
reducers$2[GET_NEW_ADDRESS_COMPLETED] = (state, action) => {
|
supports.forEach(support => {
|
||||||
const { address } = action.data;
|
byId[support.txid] = support;
|
||||||
|
});
|
||||||
|
|
||||||
// Say no to localStorage!
|
return _extends$7({}, state, { supports: byId, fetchingSupports: false });
|
||||||
return Object.assign({}, state, {
|
},
|
||||||
gettingNewAddress: false,
|
|
||||||
receiveAddress: address
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
reducers$2[UPDATE_BALANCE] = (state, action) => Object.assign({}, state, {
|
[ABANDON_SUPPORT_STARTED]: (state, action) => {
|
||||||
balance: action.data.balance
|
const { txid } = action.data;
|
||||||
});
|
const abandoningById = state.abandoningSupportsById;
|
||||||
|
|
||||||
reducers$2[UPDATE_TOTAL_BALANCE] = (state, action) => Object.assign({}, state, {
|
abandoningById[txid] = true;
|
||||||
totalBalance: action.data.totalBalance
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[CHECK_ADDRESS_IS_MINE_STARTED] = state => Object.assign({}, state, {
|
return _extends$7({}, state, {
|
||||||
checkingAddressOwnership: true
|
abandoningSupportsById: abandoningById
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
reducers$2[CHECK_ADDRESS_IS_MINE_COMPLETED] = state => Object.assign({}, state, {
|
[ABANDON_SUPPORT_COMPLETED]: (state, action) => {
|
||||||
checkingAddressOwnership: false
|
const { txid } = action.data;
|
||||||
});
|
const byId = state.supports;
|
||||||
|
const abandoningById = state.abandoningSupportsById;
|
||||||
|
|
||||||
reducers$2[SET_DRAFT_TRANSACTION_AMOUNT] = (state, action) => {
|
delete abandoningById[txid];
|
||||||
const oldDraft = state.draftTransaction;
|
delete byId[txid];
|
||||||
const newDraft = Object.assign({}, oldDraft, {
|
|
||||||
amount: parseFloat(action.data.amount)
|
|
||||||
});
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
return _extends$7({}, state, {
|
||||||
draftTransaction: newDraft
|
supports: byId,
|
||||||
});
|
abandoningSupportsById: abandoningById
|
||||||
};
|
});
|
||||||
|
},
|
||||||
|
|
||||||
reducers$2[SET_DRAFT_TRANSACTION_ADDRESS] = (state, action) => {
|
[GET_NEW_ADDRESS_STARTED]: state => _extends$7({}, state, {
|
||||||
const oldDraft = state.draftTransaction;
|
gettingNewAddress: true
|
||||||
const newDraft = Object.assign({}, oldDraft, {
|
}),
|
||||||
address: action.data.address
|
|
||||||
});
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
[GET_NEW_ADDRESS_COMPLETED]: (state, action) => {
|
||||||
draftTransaction: newDraft
|
const { address } = action.data;
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
reducers$2[SEND_TRANSACTION_STARTED] = state => {
|
return _extends$7({}, state, { gettingNewAddress: false, receiveAddress: address });
|
||||||
const newDraftTransaction = Object.assign({}, state.draftTransaction, {
|
},
|
||||||
sending: true
|
|
||||||
});
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
[UPDATE_BALANCE]: (state, action) => _extends$7({}, state, {
|
||||||
draftTransaction: newDraftTransaction
|
balance: action.data.balance
|
||||||
});
|
}),
|
||||||
};
|
|
||||||
|
|
||||||
reducers$2[SEND_TRANSACTION_COMPLETED] = state => Object.assign({}, state, {
|
[UPDATE_TOTAL_BALANCE]: (state, action) => _extends$7({}, state, {
|
||||||
draftTransaction: buildDraftTransaction()
|
totalBalance: action.data.totalBalance
|
||||||
});
|
}),
|
||||||
|
|
||||||
reducers$2[SEND_TRANSACTION_FAILED] = (state, action) => {
|
[CHECK_ADDRESS_IS_MINE_STARTED]: state => _extends$7({}, state, {
|
||||||
const newDraftTransaction = Object.assign({}, state.draftTransaction, {
|
checkingAddressOwnership: true
|
||||||
sending: false,
|
}),
|
||||||
error: action.data.error
|
|
||||||
});
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
[CHECK_ADDRESS_IS_MINE_COMPLETED]: state => _extends$7({}, state, {
|
||||||
draftTransaction: newDraftTransaction
|
checkingAddressOwnership: false
|
||||||
});
|
}),
|
||||||
};
|
|
||||||
|
|
||||||
reducers$2[SUPPORT_TRANSACTION_STARTED] = state => Object.assign({}, state, {
|
[SET_DRAFT_TRANSACTION_AMOUNT]: (state, action) => {
|
||||||
sendingSupport: true
|
const oldDraft = state.draftTransaction;
|
||||||
});
|
const newDraft = _extends$7({}, oldDraft, { amount: parseFloat(action.data.amount) });
|
||||||
|
|
||||||
reducers$2[SUPPORT_TRANSACTION_COMPLETED] = state => Object.assign({}, state, {
|
return _extends$7({}, state, { draftTransaction: newDraft });
|
||||||
sendingSupport: false
|
},
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[SUPPORT_TRANSACTION_FAILED] = (state, action) => Object.assign({}, state, {
|
[SET_DRAFT_TRANSACTION_ADDRESS]: (state, action) => {
|
||||||
error: action.data.error,
|
const oldDraft = state.draftTransaction;
|
||||||
sendingSupport: false
|
const newDraft = _extends$7({}, oldDraft, { address: action.data.address });
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[WALLET_STATUS_COMPLETED] = (state, action) => Object.assign({}, state, {
|
return _extends$7({}, state, { draftTransaction: newDraft });
|
||||||
walletIsEncrypted: action.result
|
},
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[WALLET_ENCRYPT_START] = state => Object.assign({}, state, {
|
[SEND_TRANSACTION_STARTED]: state => {
|
||||||
walletEncryptPending: true,
|
const newDraftTransaction = _extends$7({}, state.draftTransaction, { sending: true });
|
||||||
walletEncryptSucceded: null,
|
|
||||||
walletEncryptResult: null
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[WALLET_ENCRYPT_COMPLETED] = (state, action) => Object.assign({}, state, {
|
return _extends$7({}, state, { draftTransaction: newDraftTransaction });
|
||||||
walletEncryptPending: false,
|
},
|
||||||
walletEncryptSucceded: true,
|
|
||||||
walletEncryptResult: action.result
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[WALLET_ENCRYPT_FAILED] = (state, action) => Object.assign({}, state, {
|
[SEND_TRANSACTION_COMPLETED]: state => Object.assign({}, state, {
|
||||||
walletEncryptPending: false,
|
draftTransaction: buildDraftTransaction()
|
||||||
walletEncryptSucceded: false,
|
}),
|
||||||
walletEncryptResult: action.result
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[WALLET_DECRYPT_START] = state => Object.assign({}, state, {
|
[SEND_TRANSACTION_FAILED]: (state, action) => {
|
||||||
walletDecryptPending: true,
|
const newDraftTransaction = Object.assign({}, state.draftTransaction, {
|
||||||
walletDecryptSucceded: null,
|
sending: false,
|
||||||
walletDecryptResult: null
|
error: action.data.error
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers$2[WALLET_DECRYPT_COMPLETED] = (state, action) => Object.assign({}, state, {
|
return _extends$7({}, state, { draftTransaction: newDraftTransaction });
|
||||||
walletDecryptPending: false,
|
},
|
||||||
walletDecryptSucceded: true,
|
|
||||||
walletDecryptResult: action.result
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[WALLET_DECRYPT_FAILED] = (state, action) => Object.assign({}, state, {
|
[SUPPORT_TRANSACTION_STARTED]: state => _extends$7({}, state, {
|
||||||
walletDecryptPending: false,
|
sendingSupport: true
|
||||||
walletDecryptSucceded: false,
|
}),
|
||||||
walletDecryptResult: action.result
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[WALLET_UNLOCK_START] = state => Object.assign({}, state, {
|
[SUPPORT_TRANSACTION_COMPLETED]: state => _extends$7({}, state, {
|
||||||
walletUnlockPending: true,
|
sendingSupport: false
|
||||||
walletUnlockSucceded: null,
|
}),
|
||||||
walletUnlockResult: null
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[WALLET_UNLOCK_COMPLETED] = (state, action) => Object.assign({}, state, {
|
[SUPPORT_TRANSACTION_FAILED]: (state, action) => _extends$7({}, state, {
|
||||||
walletUnlockPending: false,
|
error: action.data.error,
|
||||||
walletUnlockSucceded: true,
|
sendingSupport: false
|
||||||
walletUnlockResult: action.result
|
}),
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[WALLET_UNLOCK_FAILED] = (state, action) => Object.assign({}, state, {
|
[WALLET_STATUS_COMPLETED]: (state, action) => _extends$7({}, state, {
|
||||||
walletUnlockPending: false,
|
walletIsEncrypted: action.result
|
||||||
walletUnlockSucceded: false,
|
}),
|
||||||
walletUnlockResult: action.result
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers$2[WALLET_LOCK_START] = state => Object.assign({}, state, {
|
[WALLET_ENCRYPT_START]: state => _extends$7({}, state, {
|
||||||
walletLockPending: false,
|
walletEncryptPending: true,
|
||||||
walletLockSucceded: null,
|
walletEncryptSucceded: null,
|
||||||
walletLockResult: null
|
walletEncryptResult: null
|
||||||
});
|
}),
|
||||||
|
|
||||||
reducers$2[WALLET_LOCK_COMPLETED] = (state, action) => Object.assign({}, state, {
|
[WALLET_ENCRYPT_COMPLETED]: (state, action) => _extends$7({}, state, {
|
||||||
walletLockPending: false,
|
walletEncryptPending: false,
|
||||||
walletLockSucceded: true,
|
walletEncryptSucceded: true,
|
||||||
walletLockResult: action.result
|
walletEncryptResult: action.result
|
||||||
});
|
}),
|
||||||
|
|
||||||
reducers$2[WALLET_LOCK_FAILED] = (state, action) => Object.assign({}, state, {
|
[WALLET_ENCRYPT_FAILED]: (state, action) => _extends$7({}, state, {
|
||||||
walletLockPending: false,
|
walletEncryptPending: false,
|
||||||
walletLockSucceded: false,
|
walletEncryptSucceded: false,
|
||||||
walletLockResult: action.result
|
walletEncryptResult: action.result
|
||||||
});
|
}),
|
||||||
|
|
||||||
reducers$2[SET_TRANSACTION_LIST_FILTER] = (state, action) => Object.assign({}, state, {
|
[WALLET_DECRYPT_START]: state => _extends$7({}, state, {
|
||||||
transactionListFilter: action.data
|
walletDecryptPending: true,
|
||||||
});
|
walletDecryptSucceded: null,
|
||||||
|
walletDecryptResult: null
|
||||||
|
}),
|
||||||
|
|
||||||
reducers$2[UPDATE_CURRENT_HEIGHT] = (state, action) => Object.assign({}, state, {
|
[WALLET_DECRYPT_COMPLETED]: (state, action) => _extends$7({}, state, {
|
||||||
latestBlock: action.data
|
walletDecryptPending: false,
|
||||||
});
|
walletDecryptSucceded: true,
|
||||||
|
walletDecryptResult: action.result
|
||||||
|
}),
|
||||||
|
|
||||||
function walletReducer(state = defaultState$4, action) {
|
[WALLET_DECRYPT_FAILED]: (state, action) => _extends$7({}, state, {
|
||||||
const handler = reducers$2[action.type];
|
walletDecryptPending: false,
|
||||||
if (handler) return handler(state, action);
|
walletDecryptSucceded: false,
|
||||||
return state;
|
walletDecryptResult: action.result
|
||||||
}
|
}),
|
||||||
|
|
||||||
var _extends$7 = 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; };
|
[WALLET_UNLOCK_START]: state => _extends$7({}, state, {
|
||||||
|
walletUnlockPending: true,
|
||||||
|
walletUnlockSucceded: null,
|
||||||
|
walletUnlockResult: null
|
||||||
|
}),
|
||||||
|
|
||||||
const reducers$3 = {};
|
[WALLET_UNLOCK_COMPLETED]: (state, action) => _extends$7({}, state, {
|
||||||
|
walletUnlockPending: false,
|
||||||
|
walletUnlockSucceded: true,
|
||||||
|
walletUnlockResult: action.result
|
||||||
|
}),
|
||||||
|
|
||||||
|
[WALLET_UNLOCK_FAILED]: (state, action) => _extends$7({}, state, {
|
||||||
|
walletUnlockPending: false,
|
||||||
|
walletUnlockSucceded: false,
|
||||||
|
walletUnlockResult: action.result
|
||||||
|
}),
|
||||||
|
|
||||||
|
[WALLET_LOCK_START]: state => _extends$7({}, state, {
|
||||||
|
walletLockPending: false,
|
||||||
|
walletLockSucceded: null,
|
||||||
|
walletLockResult: null
|
||||||
|
}),
|
||||||
|
|
||||||
|
[WALLET_LOCK_COMPLETED]: (state, action) => _extends$7({}, state, {
|
||||||
|
walletLockPending: false,
|
||||||
|
walletLockSucceded: true,
|
||||||
|
walletLockResult: action.result
|
||||||
|
}),
|
||||||
|
|
||||||
|
[WALLET_LOCK_FAILED]: (state, action) => _extends$7({}, state, {
|
||||||
|
walletLockPending: false,
|
||||||
|
walletLockSucceded: false,
|
||||||
|
walletLockResult: action.result
|
||||||
|
}),
|
||||||
|
|
||||||
|
[SET_TRANSACTION_LIST_FILTER]: (state, action) => _extends$7({}, state, {
|
||||||
|
transactionListFilter: action.data
|
||||||
|
}),
|
||||||
|
|
||||||
|
[UPDATE_CURRENT_HEIGHT]: (state, action) => _extends$7({}, state, {
|
||||||
|
latestBlock: action.data
|
||||||
|
})
|
||||||
|
}, defaultState$4);
|
||||||
|
|
||||||
|
var _extends$8 = 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; };
|
||||||
|
|
||||||
|
const reducers$2 = {};
|
||||||
const defaultState$5 = {
|
const defaultState$5 = {
|
||||||
positions: {}
|
positions: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers$3[SET_CONTENT_POSITION] = (state, action) => {
|
reducers$2[SET_CONTENT_POSITION] = (state, action) => {
|
||||||
const { claimId, outpoint, position } = action.data;
|
const { claimId, outpoint, position } = action.data;
|
||||||
return _extends$7({}, state, {
|
return _extends$8({}, state, {
|
||||||
positions: _extends$7({}, state.positions, {
|
positions: _extends$8({}, state.positions, {
|
||||||
[claimId]: _extends$7({}, state.positions[claimId], {
|
[claimId]: _extends$8({}, state.positions[claimId], {
|
||||||
[outpoint]: position
|
[outpoint]: position
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -3350,7 +3413,7 @@ reducers$3[SET_CONTENT_POSITION] = (state, action) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
function contentReducer(state = defaultState$5, action) {
|
function contentReducer(state = defaultState$5, action) {
|
||||||
const handler = reducers$3[action.type];
|
const handler = reducers$2[action.type];
|
||||||
if (handler) return handler(state, action);
|
if (handler) return handler(state, action);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -3366,14 +3429,14 @@ const makeSelectContentPositionForUri = uri => reselect.createSelector(selectSta
|
||||||
return state.positions[id] ? state.positions[id][outpoint] : null;
|
return state.positions[id] ? state.positions[id][outpoint] : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
var _extends$8 = 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$9 = 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; };
|
||||||
|
|
||||||
const selectState$5 = state => state.notifications || {};
|
const selectState$5 = state => state.notifications || {};
|
||||||
|
|
||||||
const selectToast = reselect.createSelector(selectState$5, state => {
|
const selectToast = reselect.createSelector(selectState$5, state => {
|
||||||
if (state.toasts.length) {
|
if (state.toasts.length) {
|
||||||
const { id, params } = state.toasts[0];
|
const { id, params } = state.toasts[0];
|
||||||
return _extends$8({
|
return _extends$9({
|
||||||
id
|
id
|
||||||
}, params);
|
}, params);
|
||||||
}
|
}
|
||||||
|
@ -3537,6 +3600,7 @@ exports.selectSearchState = selectState;
|
||||||
exports.selectSearchSuggestions = selectSearchSuggestions;
|
exports.selectSearchSuggestions = selectSearchSuggestions;
|
||||||
exports.selectSearchUrisByQuery = selectSearchUrisByQuery;
|
exports.selectSearchUrisByQuery = selectSearchUrisByQuery;
|
||||||
exports.selectSearchValue = selectSearchValue;
|
exports.selectSearchValue = selectSearchValue;
|
||||||
|
exports.selectSupportsById = selectSupportsById;
|
||||||
exports.selectToast = selectToast;
|
exports.selectToast = selectToast;
|
||||||
exports.selectTotalBalance = selectTotalBalance;
|
exports.selectTotalBalance = selectTotalBalance;
|
||||||
exports.selectTotalDownloadProgress = selectTotalDownloadProgress;
|
exports.selectTotalDownloadProgress = selectTotalDownloadProgress;
|
||||||
|
|
3
dist/flow-typed/Lbry.js
vendored
3
dist/flow-typed/Lbry.js
vendored
|
@ -130,6 +130,8 @@ declare type SyncApplyResponse = {
|
||||||
data: string,
|
data: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare type SupportAbandonResponse = GenericTxResponse;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Types used in the generic Lbry object that is exported
|
// Types used in the generic Lbry object that is exported
|
||||||
//
|
//
|
||||||
|
@ -175,6 +177,7 @@ declare type LbryTypes = {
|
||||||
address_is_mine: (params: {}) => Promise<boolean>,
|
address_is_mine: (params: {}) => Promise<boolean>,
|
||||||
address_unused: (params: {}) => Promise<string>, // New address
|
address_unused: (params: {}) => Promise<string>, // New address
|
||||||
transaction_list: (params: {}) => Promise<TxListResponse>,
|
transaction_list: (params: {}) => Promise<TxListResponse>,
|
||||||
|
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
||||||
|
|
||||||
// Sync
|
// Sync
|
||||||
sync_hash: (params: {}) => Promise<string>,
|
sync_hash: (params: {}) => Promise<string>,
|
||||||
|
|
16
dist/flow-typed/Transaction.js
vendored
16
dist/flow-typed/Transaction.js
vendored
|
@ -9,3 +9,19 @@ declare type Transaction = {
|
||||||
type: string,
|
type: string,
|
||||||
date: Date,
|
date: Date,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare type Support = {
|
||||||
|
address: string,
|
||||||
|
amount: string,
|
||||||
|
claim_id: string,
|
||||||
|
confirmations: number,
|
||||||
|
height: string,
|
||||||
|
is_change: string,
|
||||||
|
is_mine: string,
|
||||||
|
name: string,
|
||||||
|
nout: string,
|
||||||
|
permanent_url: string,
|
||||||
|
timestamp: number,
|
||||||
|
txid: string,
|
||||||
|
type: string,
|
||||||
|
};
|
||||||
|
|
3
flow-typed/Lbry.js
vendored
3
flow-typed/Lbry.js
vendored
|
@ -130,6 +130,8 @@ declare type SyncApplyResponse = {
|
||||||
data: string,
|
data: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare type SupportAbandonResponse = GenericTxResponse;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Types used in the generic Lbry object that is exported
|
// Types used in the generic Lbry object that is exported
|
||||||
//
|
//
|
||||||
|
@ -175,6 +177,7 @@ declare type LbryTypes = {
|
||||||
address_is_mine: (params: {}) => Promise<boolean>,
|
address_is_mine: (params: {}) => Promise<boolean>,
|
||||||
address_unused: (params: {}) => Promise<string>, // New address
|
address_unused: (params: {}) => Promise<string>, // New address
|
||||||
transaction_list: (params: {}) => Promise<TxListResponse>,
|
transaction_list: (params: {}) => Promise<TxListResponse>,
|
||||||
|
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
||||||
|
|
||||||
// Sync
|
// Sync
|
||||||
sync_hash: (params: {}) => Promise<string>,
|
sync_hash: (params: {}) => Promise<string>,
|
||||||
|
|
16
flow-typed/Transaction.js
vendored
16
flow-typed/Transaction.js
vendored
|
@ -9,3 +9,19 @@ declare type Transaction = {
|
||||||
type: string,
|
type: string,
|
||||||
date: Date,
|
date: Date,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare type Support = {
|
||||||
|
address: string,
|
||||||
|
amount: string,
|
||||||
|
claim_id: string,
|
||||||
|
confirmations: number,
|
||||||
|
height: string,
|
||||||
|
is_change: string,
|
||||||
|
is_mine: string,
|
||||||
|
name: string,
|
||||||
|
nout: string,
|
||||||
|
permanent_url: string,
|
||||||
|
timestamp: number,
|
||||||
|
txid: string,
|
||||||
|
type: string,
|
||||||
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"lbry"
|
"lbry"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://lbry.io/",
|
"homepage": "https://lbry.com/",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/lbryio/lbry-redux/issues"
|
"url": "https://github.com/lbryio/lbry-redux/issues"
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "LBRY Inc.",
|
"name": "LBRY Inc.",
|
||||||
"email": "hello@lbry.io"
|
"email": "hello@lbry.com"
|
||||||
},
|
},
|
||||||
"main": "dist/bundle.es.js",
|
"main": "dist/bundle.es.js",
|
||||||
"module": "dist/bundle.es.js",
|
"module": "dist/bundle.es.js",
|
||||||
|
|
|
@ -33,6 +33,10 @@ export const GET_NEW_ADDRESS_STARTED = 'GET_NEW_ADDRESS_STARTED';
|
||||||
export const GET_NEW_ADDRESS_COMPLETED = 'GET_NEW_ADDRESS_COMPLETED';
|
export const GET_NEW_ADDRESS_COMPLETED = 'GET_NEW_ADDRESS_COMPLETED';
|
||||||
export const FETCH_TRANSACTIONS_STARTED = 'FETCH_TRANSACTIONS_STARTED';
|
export const FETCH_TRANSACTIONS_STARTED = 'FETCH_TRANSACTIONS_STARTED';
|
||||||
export const FETCH_TRANSACTIONS_COMPLETED = 'FETCH_TRANSACTIONS_COMPLETED';
|
export const FETCH_TRANSACTIONS_COMPLETED = 'FETCH_TRANSACTIONS_COMPLETED';
|
||||||
|
export const FETCH_SUPPORTS_STARTED = 'FETCH_SUPPORTS_STARTED';
|
||||||
|
export const FETCH_SUPPORTS_COMPLETED = 'FETCH_SUPPORTS_COMPLETED';
|
||||||
|
export const ABANDON_SUPPORT_STARTED = 'ABANDON_SUPPORT_STARTED';
|
||||||
|
export const ABANDON_SUPPORT_COMPLETED = 'ABANDON_SUPPORT_COMPLETED';
|
||||||
export const UPDATE_BALANCE = 'UPDATE_BALANCE';
|
export const UPDATE_BALANCE = 'UPDATE_BALANCE';
|
||||||
export const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE';
|
export const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE';
|
||||||
export const CHECK_ADDRESS_IS_MINE_STARTED = 'CHECK_ADDRESS_IS_MINE_STARTED';
|
export const CHECK_ADDRESS_IS_MINE_STARTED = 'CHECK_ADDRESS_IS_MINE_STARTED';
|
||||||
|
|
|
@ -183,6 +183,7 @@ export {
|
||||||
selectBalance,
|
selectBalance,
|
||||||
selectTotalBalance,
|
selectTotalBalance,
|
||||||
selectTransactionsById,
|
selectTransactionsById,
|
||||||
|
selectSupportsById,
|
||||||
selectTransactionItems,
|
selectTransactionItems,
|
||||||
selectRecentTransactions,
|
selectRecentTransactions,
|
||||||
selectHasTransactions,
|
selectHasTransactions,
|
||||||
|
|
|
@ -86,6 +86,7 @@ const Lbry: LbryTypes = {
|
||||||
address_unused: (params = {}) => daemonCallWithResult('address_unused', params),
|
address_unused: (params = {}) => daemonCallWithResult('address_unused', params),
|
||||||
transaction_list: (params = {}) => daemonCallWithResult('transaction_list', params),
|
transaction_list: (params = {}) => daemonCallWithResult('transaction_list', params),
|
||||||
utxo_release: (params = {}) => daemonCallWithResult('utxo_release', params),
|
utxo_release: (params = {}) => daemonCallWithResult('utxo_release', params),
|
||||||
|
support_abandon: (params = {}) => daemonCallWithResult('support_abandon', params),
|
||||||
|
|
||||||
sync_hash: (params = {}) => daemonCallWithResult('sync_hash', params),
|
sync_hash: (params = {}) => daemonCallWithResult('sync_hash', params),
|
||||||
sync_apply: (params = {}) => daemonCallWithResult('sync_apply', params),
|
sync_apply: (params = {}) => daemonCallWithResult('sync_apply', params),
|
||||||
|
|
|
@ -228,6 +228,6 @@ export function convertToShareLink(URI) {
|
||||||
return buildURI(
|
return buildURI(
|
||||||
{ claimName, path, claimSequence, bidPosition, claimId },
|
{ claimName, path, claimSequence, bidPosition, claimId },
|
||||||
true,
|
true,
|
||||||
'https://open.lbry.io/'
|
'https://open.lbry.com/'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { normalizeURI, parseURI } from 'lbryURI';
|
||||||
import { doToast } from 'redux/actions/notifications';
|
import { doToast } from 'redux/actions/notifications';
|
||||||
import { selectMyClaimsRaw, selectResolvingUris, selectClaimsByUri } from 'redux/selectors/claims';
|
import { selectMyClaimsRaw, selectResolvingUris, selectClaimsByUri } from 'redux/selectors/claims';
|
||||||
import { doFetchTransactions } from 'redux/actions/wallet';
|
import { doFetchTransactions } from 'redux/actions/wallet';
|
||||||
|
import { selectSupportsById } from 'redux/selectors/wallet';
|
||||||
import { creditsToString } from 'util/formatCredits';
|
import { creditsToString } from 'util/formatCredits';
|
||||||
|
|
||||||
export function doResolveUris(uris: Array<string>, returnCachedClaims: boolean = false) {
|
export function doResolveUris(uris: Array<string>, returnCachedClaims: boolean = false) {
|
||||||
|
@ -92,26 +93,38 @@ export function doAbandonClaim(txid: string, nout: number) {
|
||||||
return (dispatch: Dispatch, getState: GetState) => {
|
return (dispatch: Dispatch, getState: GetState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const myClaims: Array<ChannelClaim | StreamClaim> = selectMyClaimsRaw(state);
|
const myClaims: Array<ChannelClaim | StreamClaim> = selectMyClaimsRaw(state);
|
||||||
const claimToAbandon = myClaims.find(claim => claim.txid === txid && claim.nout === nout);
|
const mySupports: { [string]: Support } = selectSupportsById(state);
|
||||||
|
|
||||||
if (!claimToAbandon) {
|
// A user could be trying to abandon a support or one of their claims
|
||||||
console.error('No associated claim with txid: ', txid);
|
const claimToAbandon = myClaims.find(claim => claim.txid === txid && claim.nout === nout);
|
||||||
|
const supportToAbandon = mySupports[txid];
|
||||||
|
|
||||||
|
if (!claimToAbandon && !supportToAbandon) {
|
||||||
|
console.error('No associated support or claim with txid: ', txid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { claim_id: claimId, name: claimName } = claimToAbandon;
|
const data = claimToAbandon
|
||||||
|
? { claimId: claimToAbandon.claim_id }
|
||||||
|
: { txid: supportToAbandon.txid };
|
||||||
|
|
||||||
|
const isClaim = !!claimToAbandon;
|
||||||
|
const startedActionType = isClaim
|
||||||
|
? ACTIONS.ABANDON_CLAIM_STARTED
|
||||||
|
: ACTIONS.ABANDON_SUPPORT_STARTED;
|
||||||
|
const completedActionType = isClaim
|
||||||
|
? ACTIONS.ABANDON_CLAIM_STARTED
|
||||||
|
: ACTIONS.ABANDON_SUPPORT_COMPLETED;
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.ABANDON_CLAIM_STARTED,
|
type: startedActionType,
|
||||||
data: {
|
data,
|
||||||
claimId,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const errorCallback = () => {
|
const errorCallback = () => {
|
||||||
dispatch(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
message: 'Error abandoning claim',
|
message: isClaim ? 'Error abandoning your claim' : 'Error unlocking your tip',
|
||||||
isError: true,
|
isError: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -119,15 +132,15 @@ export function doAbandonClaim(txid: string, nout: number) {
|
||||||
|
|
||||||
const successCallback = () => {
|
const successCallback = () => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.ABANDON_CLAIM_SUCCEEDED,
|
type: completedActionType,
|
||||||
data: {
|
data,
|
||||||
claimId,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
message: 'Successfully abandoned your claim',
|
message: isClaim
|
||||||
|
? 'Successfully abandoned your claim'
|
||||||
|
: 'Successfully unlocked your tip!',
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -143,7 +156,19 @@ export function doAbandonClaim(txid: string, nout: number) {
|
||||||
blocking: true,
|
blocking: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const method = claimName.startsWith('@') ? 'channel_abandon' : 'stream_abandon';
|
let method;
|
||||||
|
if (supportToAbandon) {
|
||||||
|
method = 'support_abandon';
|
||||||
|
} else if (claimToAbandon) {
|
||||||
|
const { name: claimName } = claimToAbandon;
|
||||||
|
method = claimName.startsWith('@') ? 'channel_abandon' : 'stream_abandon';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!method) {
|
||||||
|
console.error('No "method" chosen for claim or support abandon');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Lbry[method](abandonParams).then(successCallback, errorCallback);
|
Lbry[method](abandonParams).then(successCallback, errorCallback);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ type Dispatch = (action: any) => any;
|
||||||
type GetState = () => { search: SearchState };
|
type GetState = () => { search: SearchState };
|
||||||
|
|
||||||
// We can't use env's because they aren't passed into node_modules
|
// We can't use env's because they aren't passed into node_modules
|
||||||
let CONNECTION_STRING = 'https://lighthouse.lbry.io/';
|
let CONNECTION_STRING = 'https://lighthouse.lbry.com/';
|
||||||
|
|
||||||
export const setSearchApi = (endpoint: string) => {
|
export const setSearchApi = (endpoint: string) => {
|
||||||
CONNECTION_STRING = endpoint.replace(/\/*$/, '/'); // exactly one slash at the end;
|
CONNECTION_STRING = endpoint.replace(/\/*$/, '/'); // exactly one slash at the end;
|
||||||
|
|
|
@ -63,6 +63,7 @@ export function doTotalBalanceSubscribe() {
|
||||||
|
|
||||||
export function doFetchTransactions() {
|
export function doFetchTransactions() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
|
dispatch(doFetchSupports());
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.FETCH_TRANSACTIONS_STARTED,
|
type: ACTIONS.FETCH_TRANSACTIONS_STARTED,
|
||||||
});
|
});
|
||||||
|
@ -80,6 +81,23 @@ export function doFetchTransactions() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function doFetchSupports() {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.FETCH_SUPPORTS_STARTED,
|
||||||
|
});
|
||||||
|
|
||||||
|
Lbry.support_list().then(results => {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.FETCH_SUPPORTS_COMPLETED,
|
||||||
|
data: {
|
||||||
|
supports: results,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function doGetNewAddress() {
|
export function doGetNewAddress() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as ACTIONS from 'constants/action_types';
|
import * as ACTIONS from 'constants/action_types';
|
||||||
|
import { handleActions } from 'util/redux-utils';
|
||||||
|
|
||||||
const reducers = {};
|
|
||||||
const buildDraftTransaction = () => ({
|
const buildDraftTransaction = () => ({
|
||||||
amount: undefined,
|
amount: undefined,
|
||||||
address: undefined,
|
address: undefined,
|
||||||
|
@ -16,9 +16,10 @@ type ActionResult = {
|
||||||
|
|
||||||
type WalletState = {
|
type WalletState = {
|
||||||
balance: any,
|
balance: any,
|
||||||
blocks: any,
|
|
||||||
latestBlock: ?number,
|
latestBlock: ?number,
|
||||||
transactions: any,
|
transactions: { [string]: Transaction },
|
||||||
|
supports: { [string]: Support },
|
||||||
|
abandoningSupportsById: { [string]: boolean },
|
||||||
fetchingTransactions: boolean,
|
fetchingTransactions: boolean,
|
||||||
gettingNewAddress: boolean,
|
gettingNewAddress: boolean,
|
||||||
draftTransaction: any,
|
draftTransaction: any,
|
||||||
|
@ -41,10 +42,12 @@ type WalletState = {
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
balance: undefined,
|
balance: undefined,
|
||||||
totalBalance: undefined,
|
totalBalance: undefined,
|
||||||
blocks: {},
|
|
||||||
latestBlock: undefined,
|
latestBlock: undefined,
|
||||||
transactions: {},
|
transactions: {},
|
||||||
fetchingTransactions: false,
|
fetchingTransactions: false,
|
||||||
|
supports: {},
|
||||||
|
fetchingSupports: false,
|
||||||
|
abandoningSupportsById: {},
|
||||||
gettingNewAddress: false,
|
gettingNewAddress: false,
|
||||||
draftTransaction: buildDraftTransaction(),
|
draftTransaction: buildDraftTransaction(),
|
||||||
sendingSupport: false,
|
sendingSupport: false,
|
||||||
|
@ -64,226 +67,250 @@ const defaultState = {
|
||||||
transactionListFilter: 'all',
|
transactionListFilter: 'all',
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers[ACTIONS.FETCH_TRANSACTIONS_STARTED] = (state: WalletState) =>
|
export const walletReducer = handleActions(
|
||||||
Object.assign({}, state, {
|
{
|
||||||
fetchingTransactions: true,
|
[ACTIONS.FETCH_TRANSACTIONS_STARTED]: (state: WalletState) => ({
|
||||||
});
|
...state,
|
||||||
|
fetchingTransactions: true,
|
||||||
|
}),
|
||||||
|
|
||||||
reducers[ACTIONS.FETCH_TRANSACTIONS_COMPLETED] = (state: WalletState, action) => {
|
[ACTIONS.FETCH_TRANSACTIONS_COMPLETED]: (state: WalletState, action) => {
|
||||||
const byId = Object.assign({}, state.transactions);
|
const byId = { ...state.transactions };
|
||||||
|
|
||||||
const { transactions } = action.data;
|
const { transactions } = action.data;
|
||||||
|
transactions.forEach(transaction => {
|
||||||
|
byId[transaction.txid] = transaction;
|
||||||
|
});
|
||||||
|
|
||||||
transactions.forEach(transaction => {
|
return {
|
||||||
byId[transaction.txid] = transaction;
|
...state,
|
||||||
});
|
transactions: byId,
|
||||||
|
fetchingTransactions: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
[ACTIONS.FETCH_SUPPORTS_STARTED]: (state: WalletState) => ({
|
||||||
transactions: byId,
|
...state,
|
||||||
fetchingTransactions: false,
|
fetchingSupports: true,
|
||||||
});
|
}),
|
||||||
};
|
|
||||||
|
|
||||||
reducers[ACTIONS.GET_NEW_ADDRESS_STARTED] = (state: WalletState) =>
|
[ACTIONS.FETCH_SUPPORTS_COMPLETED]: (state: WalletState, action) => {
|
||||||
Object.assign({}, state, {
|
const byId = state.supports;
|
||||||
gettingNewAddress: true,
|
const { supports } = action.data;
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.GET_NEW_ADDRESS_COMPLETED] = (state: WalletState, action) => {
|
supports.forEach(support => {
|
||||||
const { address } = action.data;
|
byId[support.txid] = support;
|
||||||
|
});
|
||||||
|
|
||||||
// Say no to localStorage!
|
return { ...state, supports: byId, fetchingSupports: false };
|
||||||
return Object.assign({}, state, {
|
},
|
||||||
gettingNewAddress: false,
|
|
||||||
receiveAddress: address,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
reducers[ACTIONS.UPDATE_BALANCE] = (state: WalletState, action) =>
|
[ACTIONS.ABANDON_SUPPORT_STARTED]: (state: WalletState, action: any): WalletState => {
|
||||||
Object.assign({}, state, {
|
const { txid }: { txid: string } = action.data;
|
||||||
balance: action.data.balance,
|
const abandoningById = state.abandoningSupportsById;
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.UPDATE_TOTAL_BALANCE] = (state: WalletState, action) =>
|
abandoningById[txid] = true;
|
||||||
Object.assign({}, state, {
|
|
||||||
totalBalance: action.data.totalBalance,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.CHECK_ADDRESS_IS_MINE_STARTED] = (state: WalletState) =>
|
return {
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
checkingAddressOwnership: true,
|
abandoningSupportsById: abandoningById,
|
||||||
});
|
};
|
||||||
|
},
|
||||||
|
|
||||||
reducers[ACTIONS.CHECK_ADDRESS_IS_MINE_COMPLETED] = (state: WalletState) =>
|
[ACTIONS.ABANDON_SUPPORT_COMPLETED]: (state: WalletState, action: any): WalletState => {
|
||||||
Object.assign({}, state, {
|
const { txid }: { txid: string } = action.data;
|
||||||
checkingAddressOwnership: false,
|
const byId = state.supports;
|
||||||
});
|
const abandoningById = state.abandoningSupportsById;
|
||||||
|
|
||||||
reducers[ACTIONS.SET_DRAFT_TRANSACTION_AMOUNT] = (state: WalletState, action) => {
|
delete abandoningById[txid];
|
||||||
const oldDraft = state.draftTransaction;
|
delete byId[txid];
|
||||||
const newDraft = Object.assign({}, oldDraft, {
|
|
||||||
amount: parseFloat(action.data.amount),
|
|
||||||
});
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
return {
|
||||||
draftTransaction: newDraft,
|
...state,
|
||||||
});
|
supports: byId,
|
||||||
};
|
abandoningSupportsById: abandoningById,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
reducers[ACTIONS.SET_DRAFT_TRANSACTION_ADDRESS] = (state: WalletState, action) => {
|
[ACTIONS.GET_NEW_ADDRESS_STARTED]: (state: WalletState) => ({
|
||||||
const oldDraft = state.draftTransaction;
|
...state,
|
||||||
const newDraft = Object.assign({}, oldDraft, {
|
gettingNewAddress: true,
|
||||||
address: action.data.address,
|
}),
|
||||||
});
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
[ACTIONS.GET_NEW_ADDRESS_COMPLETED]: (state: WalletState, action) => {
|
||||||
draftTransaction: newDraft,
|
const { address } = action.data;
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
reducers[ACTIONS.SEND_TRANSACTION_STARTED] = (state: WalletState) => {
|
return { ...state, gettingNewAddress: false, receiveAddress: address };
|
||||||
const newDraftTransaction = Object.assign({}, state.draftTransaction, {
|
},
|
||||||
sending: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
[ACTIONS.UPDATE_BALANCE]: (state: WalletState, action) => ({
|
||||||
draftTransaction: newDraftTransaction,
|
...state,
|
||||||
});
|
balance: action.data.balance,
|
||||||
};
|
}),
|
||||||
|
|
||||||
reducers[ACTIONS.SEND_TRANSACTION_COMPLETED] = (state: WalletState) =>
|
[ACTIONS.UPDATE_TOTAL_BALANCE]: (state: WalletState, action) => ({
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
draftTransaction: buildDraftTransaction(),
|
totalBalance: action.data.totalBalance,
|
||||||
});
|
}),
|
||||||
|
|
||||||
reducers[ACTIONS.SEND_TRANSACTION_FAILED] = (state: WalletState, action) => {
|
[ACTIONS.CHECK_ADDRESS_IS_MINE_STARTED]: (state: WalletState) => ({
|
||||||
const newDraftTransaction = Object.assign({}, state.draftTransaction, {
|
...state,
|
||||||
sending: false,
|
checkingAddressOwnership: true,
|
||||||
error: action.data.error,
|
}),
|
||||||
});
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
[ACTIONS.CHECK_ADDRESS_IS_MINE_COMPLETED]: (state: WalletState) => ({
|
||||||
draftTransaction: newDraftTransaction,
|
...state,
|
||||||
});
|
checkingAddressOwnership: false,
|
||||||
};
|
}),
|
||||||
|
|
||||||
reducers[ACTIONS.SUPPORT_TRANSACTION_STARTED] = (state: WalletState) =>
|
[ACTIONS.SET_DRAFT_TRANSACTION_AMOUNT]: (state: WalletState, action) => {
|
||||||
Object.assign({}, state, {
|
const oldDraft = state.draftTransaction;
|
||||||
sendingSupport: true,
|
const newDraft = { ...oldDraft, amount: parseFloat(action.data.amount) };
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.SUPPORT_TRANSACTION_COMPLETED] = (state: WalletState) =>
|
return { ...state, draftTransaction: newDraft };
|
||||||
Object.assign({}, state, {
|
},
|
||||||
sendingSupport: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.SUPPORT_TRANSACTION_FAILED] = (state: WalletState, action) =>
|
[ACTIONS.SET_DRAFT_TRANSACTION_ADDRESS]: (state: WalletState, action) => {
|
||||||
Object.assign({}, state, {
|
const oldDraft = state.draftTransaction;
|
||||||
error: action.data.error,
|
const newDraft = { ...oldDraft, address: action.data.address };
|
||||||
sendingSupport: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_STATUS_COMPLETED] = (state: WalletState, action) =>
|
return { ...state, draftTransaction: newDraft };
|
||||||
Object.assign({}, state, {
|
},
|
||||||
walletIsEncrypted: action.result,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_ENCRYPT_START] = (state: WalletState) =>
|
[ACTIONS.SEND_TRANSACTION_STARTED]: (state: WalletState) => {
|
||||||
Object.assign({}, state, {
|
const newDraftTransaction = { ...state.draftTransaction, sending: true };
|
||||||
walletEncryptPending: true,
|
|
||||||
walletEncryptSucceded: null,
|
|
||||||
walletEncryptResult: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = (state: WalletState, action: ActionResult) =>
|
return { ...state, draftTransaction: newDraftTransaction };
|
||||||
Object.assign({}, state, {
|
},
|
||||||
walletEncryptPending: false,
|
|
||||||
walletEncryptSucceded: true,
|
|
||||||
walletEncryptResult: action.result,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = (state: WalletState, action: ActionResult) =>
|
[ACTIONS.SEND_TRANSACTION_COMPLETED]: (state: WalletState) =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
walletEncryptPending: false,
|
draftTransaction: buildDraftTransaction(),
|
||||||
walletEncryptSucceded: false,
|
}),
|
||||||
walletEncryptResult: action.result,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_DECRYPT_START] = (state: WalletState) =>
|
[ACTIONS.SEND_TRANSACTION_FAILED]: (state: WalletState, action) => {
|
||||||
Object.assign({}, state, {
|
const newDraftTransaction = Object.assign({}, state.draftTransaction, {
|
||||||
walletDecryptPending: true,
|
sending: false,
|
||||||
walletDecryptSucceded: null,
|
error: action.data.error,
|
||||||
walletDecryptResult: null,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = (state: WalletState, action: ActionResult) =>
|
return { ...state, draftTransaction: newDraftTransaction };
|
||||||
Object.assign({}, state, {
|
},
|
||||||
walletDecryptPending: false,
|
|
||||||
walletDecryptSucceded: true,
|
|
||||||
walletDecryptResult: action.result,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = (state: WalletState, action: ActionResult) =>
|
[ACTIONS.SUPPORT_TRANSACTION_STARTED]: (state: WalletState) => ({
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
walletDecryptPending: false,
|
sendingSupport: true,
|
||||||
walletDecryptSucceded: false,
|
}),
|
||||||
walletDecryptResult: action.result,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_UNLOCK_START] = (state: WalletState) =>
|
[ACTIONS.SUPPORT_TRANSACTION_COMPLETED]: (state: WalletState) => ({
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
walletUnlockPending: true,
|
sendingSupport: false,
|
||||||
walletUnlockSucceded: null,
|
}),
|
||||||
walletUnlockResult: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = (state: WalletState, action: ActionResult) =>
|
[ACTIONS.SUPPORT_TRANSACTION_FAILED]: (state: WalletState, action) => ({
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
walletUnlockPending: false,
|
error: action.data.error,
|
||||||
walletUnlockSucceded: true,
|
sendingSupport: false,
|
||||||
walletUnlockResult: action.result,
|
}),
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = (state: WalletState, action: ActionResult) =>
|
[ACTIONS.WALLET_STATUS_COMPLETED]: (state: WalletState, action) => ({
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
walletUnlockPending: false,
|
walletIsEncrypted: action.result,
|
||||||
walletUnlockSucceded: false,
|
}),
|
||||||
walletUnlockResult: action.result,
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_LOCK_START] = (state: WalletState) =>
|
[ACTIONS.WALLET_ENCRYPT_START]: (state: WalletState) => ({
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
walletLockPending: false,
|
walletEncryptPending: true,
|
||||||
walletLockSucceded: null,
|
walletEncryptSucceded: null,
|
||||||
walletLockResult: null,
|
walletEncryptResult: null,
|
||||||
});
|
}),
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_LOCK_COMPLETED] = (state: WalletState, action: ActionResult) =>
|
[ACTIONS.WALLET_ENCRYPT_COMPLETED]: (state: WalletState, action: ActionResult) => ({
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
walletLockPending: false,
|
walletEncryptPending: false,
|
||||||
walletLockSucceded: true,
|
walletEncryptSucceded: true,
|
||||||
walletLockResult: action.result,
|
walletEncryptResult: action.result,
|
||||||
});
|
}),
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_LOCK_FAILED] = (state: WalletState, action: ActionResult) =>
|
[ACTIONS.WALLET_ENCRYPT_FAILED]: (state: WalletState, action: ActionResult) => ({
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
walletLockPending: false,
|
walletEncryptPending: false,
|
||||||
walletLockSucceded: false,
|
walletEncryptSucceded: false,
|
||||||
walletLockResult: action.result,
|
walletEncryptResult: action.result,
|
||||||
});
|
}),
|
||||||
|
|
||||||
reducers[ACTIONS.SET_TRANSACTION_LIST_FILTER] = (state: WalletState, action: { data: string }) =>
|
[ACTIONS.WALLET_DECRYPT_START]: (state: WalletState) => ({
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
transactionListFilter: action.data,
|
walletDecryptPending: true,
|
||||||
});
|
walletDecryptSucceded: null,
|
||||||
|
walletDecryptResult: null,
|
||||||
|
}),
|
||||||
|
|
||||||
reducers[ACTIONS.UPDATE_CURRENT_HEIGHT] = (state: WalletState, action: { data: number }) =>
|
[ACTIONS.WALLET_DECRYPT_COMPLETED]: (state: WalletState, action: ActionResult) => ({
|
||||||
Object.assign({}, state, {
|
...state,
|
||||||
latestBlock: action.data,
|
walletDecryptPending: false,
|
||||||
});
|
walletDecryptSucceded: true,
|
||||||
|
walletDecryptResult: action.result,
|
||||||
|
}),
|
||||||
|
|
||||||
export function walletReducer(state: WalletState = defaultState, action: ActionResult) {
|
[ACTIONS.WALLET_DECRYPT_FAILED]: (state: WalletState, action: ActionResult) => ({
|
||||||
const handler = reducers[action.type];
|
...state,
|
||||||
if (handler) return handler(state, action);
|
walletDecryptPending: false,
|
||||||
return state;
|
walletDecryptSucceded: false,
|
||||||
}
|
walletDecryptResult: action.result,
|
||||||
|
}),
|
||||||
|
|
||||||
|
[ACTIONS.WALLET_UNLOCK_START]: (state: WalletState) => ({
|
||||||
|
...state,
|
||||||
|
walletUnlockPending: true,
|
||||||
|
walletUnlockSucceded: null,
|
||||||
|
walletUnlockResult: null,
|
||||||
|
}),
|
||||||
|
|
||||||
|
[ACTIONS.WALLET_UNLOCK_COMPLETED]: (state: WalletState, action: ActionResult) => ({
|
||||||
|
...state,
|
||||||
|
walletUnlockPending: false,
|
||||||
|
walletUnlockSucceded: true,
|
||||||
|
walletUnlockResult: action.result,
|
||||||
|
}),
|
||||||
|
|
||||||
|
[ACTIONS.WALLET_UNLOCK_FAILED]: (state: WalletState, action: ActionResult) => ({
|
||||||
|
...state,
|
||||||
|
walletUnlockPending: false,
|
||||||
|
walletUnlockSucceded: false,
|
||||||
|
walletUnlockResult: action.result,
|
||||||
|
}),
|
||||||
|
|
||||||
|
[ACTIONS.WALLET_LOCK_START]: (state: WalletState) => ({
|
||||||
|
...state,
|
||||||
|
walletLockPending: false,
|
||||||
|
walletLockSucceded: null,
|
||||||
|
walletLockResult: null,
|
||||||
|
}),
|
||||||
|
|
||||||
|
[ACTIONS.WALLET_LOCK_COMPLETED]: (state: WalletState, action: ActionResult) => ({
|
||||||
|
...state,
|
||||||
|
walletLockPending: false,
|
||||||
|
walletLockSucceded: true,
|
||||||
|
walletLockResult: action.result,
|
||||||
|
}),
|
||||||
|
|
||||||
|
[ACTIONS.WALLET_LOCK_FAILED]: (state: WalletState, action: ActionResult) => ({
|
||||||
|
...state,
|
||||||
|
walletLockPending: false,
|
||||||
|
walletLockSucceded: false,
|
||||||
|
walletLockResult: action.result,
|
||||||
|
}),
|
||||||
|
|
||||||
|
[ACTIONS.SET_TRANSACTION_LIST_FILTER]: (state: WalletState, action: { data: string }) => ({
|
||||||
|
...state,
|
||||||
|
transactionListFilter: action.data,
|
||||||
|
}),
|
||||||
|
|
||||||
|
[ACTIONS.UPDATE_CURRENT_HEIGHT]: (state: WalletState, action: { data: number }) => ({
|
||||||
|
...state,
|
||||||
|
latestBlock: action.data,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
defaultState
|
||||||
|
);
|
||||||
|
|
|
@ -82,7 +82,12 @@ export const selectTotalBalance = createSelector(
|
||||||
|
|
||||||
export const selectTransactionsById = createSelector(
|
export const selectTransactionsById = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.transactions
|
state => state.transactions || {}
|
||||||
|
);
|
||||||
|
|
||||||
|
export const selectSupportsById = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.supports || {}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectTransactionItems = createSelector(
|
export const selectTransactionItems = createSelector(
|
||||||
|
|
Loading…
Reference in a new issue