Add encryption flow to redux
This commit is contained in:
parent
177ef2c191
commit
378f0513bf
8 changed files with 569 additions and 48 deletions
378
dist/bundle.js
vendored
378
dist/bundle.js
vendored
|
@ -46,34 +46,19 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
|
@ -104,8 +89,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.makeSelectBlockDate = exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectNavLinks = exports.selectActiveHistoryEntry = exports.selectHistoryStack = exports.selectHistoryIndex = exports.selectIsForwardDisabled = exports.selectIsBackDisabled = exports.selectPathAfterAuth = exports.selectPageTitle = exports.selectHeaderLinks = exports.selectCurrentParams = exports.selectCurrentPage = exports.selectCurrentPath = exports.makeSelectCurrentParam = exports.computePageFromPath = exports.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = undefined;
|
||||
exports.makeSelectFetchingCostInfoForUri = exports.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountFromUris = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForPage = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectSnack = exports.selectNotificationProps = exports.selectNotification = exports.selectBlackListedOutpoints = exports.blacklistReducer = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doSendSupport = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doBlackListedOutpointsSubscribe = exports.doBlurSearchInput = exports.doFocusSearchInput = exports.doUpdateSearchQuery = exports.doSearch = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchRewardedContent = exports.doFetchTrendingUris = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doFetchClaimCountByChannel = exports.doFetchClaimsByChannel = exports.doHideNotification = exports.doNotify = exports.convertToShareLink = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.SETTINGS = exports.SEARCH_TYPES = exports.THUMBNAIL_STATUSES = exports.MODALS = exports.ACTIONS = exports.Notification = undefined;
|
||||
exports.selectWalletUnlockSucceeded = exports.selectWalletUnlockPending = exports.selectWalletDecryptSucceeded = exports.selectWalletDecryptPending = exports.selectWalletEncryptSucceeded = exports.selectWalletEncryptPending = exports.selectWalletState = exports.selectWalletIsEncrypted = exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.makeSelectBlockDate = exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectNavLinks = exports.selectActiveHistoryEntry = exports.selectHistoryStack = exports.selectHistoryIndex = exports.selectIsForwardDisabled = exports.selectIsBackDisabled = exports.selectPathAfterAuth = exports.selectPageTitle = exports.selectHeaderLinks = exports.selectCurrentParams = exports.selectCurrentPage = exports.selectCurrentPath = exports.makeSelectCurrentParam = exports.computePageFromPath = exports.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = exports.makeSelectFetchingCostInfoForUri = exports.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = undefined;
|
||||
exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountFromUris = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForPage = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectSnack = exports.selectNotificationProps = exports.selectNotification = exports.selectBlackListedOutpoints = exports.blacklistReducer = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doWalletStatus = exports.doWalletUnlock = exports.doWalletDecrypt = exports.doWalletEncrypt = exports.doSendSupport = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doBlackListedOutpointsSubscribe = exports.doBlurSearchInput = exports.doFocusSearchInput = exports.doUpdateSearchQuery = exports.doSearch = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchRewardedContent = exports.doFetchTrendingUris = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doFetchClaimCountByChannel = exports.doFetchClaimsByChannel = exports.doHideNotification = exports.doNotify = exports.convertToShareLink = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.SETTINGS = exports.SEARCH_TYPES = exports.THUMBNAIL_STATUSES = exports.MODALS = exports.ACTIONS = exports.Notification = undefined;
|
||||
|
||||
var _Notification = __webpack_require__(1);
|
||||
|
||||
|
@ -373,6 +358,30 @@ Object.defineProperty(exports, 'doSendSupport', {
|
|||
return _wallet.doSendSupport;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'doWalletEncrypt', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet.doWalletEncrypt;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'doWalletDecrypt', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet.doWalletDecrypt;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'doWalletUnlock', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet.doWalletUnlock;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'doWalletStatus', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet.doWalletStatus;
|
||||
}
|
||||
});
|
||||
|
||||
var _batchActions = __webpack_require__(19);
|
||||
|
||||
|
@ -1057,6 +1066,54 @@ Object.defineProperty(exports, 'selectBlocks', {
|
|||
return _wallet3.selectBlocks;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectWalletIsEncrypted', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet3.selectWalletIsEncrypted;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectWalletState', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet3.selectWalletState;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectWalletEncryptPending', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet3.selectWalletEncryptPending;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectWalletEncryptSucceeded', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet3.selectWalletEncryptSucceeded;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectWalletDecryptPending', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet3.selectWalletDecryptPending;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectWalletDecryptSucceeded', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet3.selectWalletDecryptSucceeded;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectWalletUnlockPending', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet3.selectWalletUnlockPending;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectWalletUnlockSucceeded', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _wallet3.selectWalletUnlockSucceeded;
|
||||
}
|
||||
});
|
||||
|
||||
var _action_types = __webpack_require__(4);
|
||||
|
||||
|
@ -1480,6 +1537,18 @@ var FETCH_BLOCK_SUCCESS = exports.FETCH_BLOCK_SUCCESS = 'FETCH_BLOCK_SUCCESS';
|
|||
var SUPPORT_TRANSACTION_STARTED = exports.SUPPORT_TRANSACTION_STARTED = 'SUPPORT_TRANSACTION_STARTED';
|
||||
var SUPPORT_TRANSACTION_COMPLETED = exports.SUPPORT_TRANSACTION_COMPLETED = 'SUPPORT_TRANSACTION_COMPLETED';
|
||||
var SUPPORT_TRANSACTION_FAILED = exports.SUPPORT_TRANSACTION_FAILED = 'SUPPORT_TRANSACTION_FAILED';
|
||||
var WALLET_ENCRYPT_START = exports.WALLET_ENCRYPT_START = 'WALLET_ENCRYPT_START';
|
||||
var WALLET_ENCRYPT_COMPLETED = exports.WALLET_ENCRYPT_COMPLETED = 'WALLET_ENCRYPT_COMPLETED';
|
||||
var WALLET_UNLOCK_START = exports.WALLET_UNLOCK_START = 'WALLET_UNLOCK_START';
|
||||
var WALLET_UNLOCK_COMPLETED = exports.WALLET_UNLOCK_COMPLETED = 'WALLET_UNLOCK_COMPLETED';
|
||||
var WALLET_UNLOCK_FAILED = exports.WALLET_UNLOCK_FAILED = 'WALLET_UNLOCK_FAILED';
|
||||
var WALLET_DECRYPT_START = exports.WALLET_DECRYPT_START = 'WALLET_DECRYPT_START';
|
||||
var WALLET_DECRYPT_COMPLETED = exports.WALLET_DECRYPT_COMPLETED = 'WALLET_DECRYPT_COMPLETED';
|
||||
var WALLET_LOCK_START = exports.WALLET_LOCK_START = 'WALLET_LOCK_START';
|
||||
var WALLET_LOCK_COMPLETED = exports.WALLET_LOCK_COMPLETED = 'WALLET_LOCK_COMPLETED';
|
||||
var WALLET_STATUS_START = exports.WALLET_STATUS_START = 'WALLET_STATUS_START';
|
||||
var WALLET_STATUS_COMPLETED = exports.WALLET_STATUS_COMPLETED = 'WALLET_STATUS_COMPLETED';
|
||||
var WALLET_STATUS_FAILED = exports.WALLET_STATUS_FAILED = 'WALLET_STATUS_FAILED';
|
||||
|
||||
// Claims
|
||||
var FETCH_FEATURED_CONTENT_STARTED = exports.FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
||||
|
@ -2071,6 +2140,9 @@ Lbry.wallet_unlock = function () {
|
|||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
return daemonCallWithResult('wallet_unlock', params);
|
||||
};
|
||||
Lbry.wallet_lock = function () {
|
||||
return daemonCallWithResult('wallet_lock', {});
|
||||
};
|
||||
|
||||
// transactions
|
||||
Lbry.transaction_list = function () {
|
||||
|
@ -2374,26 +2446,26 @@ exports.default = lbryProxy;
|
|||
/* 8 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var g;
|
||||
|
||||
// This works in non-strict mode
|
||||
g = (function() {
|
||||
return this;
|
||||
})();
|
||||
|
||||
try {
|
||||
// This works if eval is allowed (see CSP)
|
||||
g = g || Function("return this")() || (1, eval)("this");
|
||||
} catch (e) {
|
||||
// This works if the window reference is available
|
||||
if (typeof window === "object") g = window;
|
||||
}
|
||||
|
||||
// g can still be undefined, but nothing to do about it...
|
||||
// We return undefined, instead of nothing here, so it's
|
||||
// easier to handle this case. if(!global) { ...}
|
||||
|
||||
module.exports = g;
|
||||
var g;
|
||||
|
||||
// This works in non-strict mode
|
||||
g = (function() {
|
||||
return this;
|
||||
})();
|
||||
|
||||
try {
|
||||
// This works if eval is allowed (see CSP)
|
||||
g = g || Function("return this")() || (1, eval)("this");
|
||||
} catch (e) {
|
||||
// This works if the window reference is available
|
||||
if (typeof window === "object") g = window;
|
||||
}
|
||||
|
||||
// g can still be undefined, but nothing to do about it...
|
||||
// We return undefined, instead of nothing here, so it's
|
||||
// easier to handle this case. if(!global) { ...}
|
||||
|
||||
module.exports = g;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -3080,7 +3152,7 @@ var selectMyChannelClaims = exports.selectMyChannelClaims = (0, _reselect.create
|
|||
|
||||
ids.forEach(function (id) {
|
||||
if (byId[id]) {
|
||||
// I'm not sure why this check is necessary, but it ought to be a quick fix for https://github.com/lbryio/lbry-app/issues/544
|
||||
// I'm not sure why this check is necessary, but it ought to be a quick fix for https://github.com/lbryio/lbry-desktop/issues/544
|
||||
claims.push(byId[id]);
|
||||
}
|
||||
});
|
||||
|
@ -4377,6 +4449,11 @@ exports.doSendDraftTransaction = doSendDraftTransaction;
|
|||
exports.doSetDraftTransactionAmount = doSetDraftTransactionAmount;
|
||||
exports.doSetDraftTransactionAddress = doSetDraftTransactionAddress;
|
||||
exports.doSendSupport = doSendSupport;
|
||||
exports.doWalletEncrypt = doWalletEncrypt;
|
||||
exports.doWalletUnlock = doWalletUnlock;
|
||||
exports.doWalletLock = doWalletLock;
|
||||
exports.doWalletDecrypt = doWalletDecrypt;
|
||||
exports.doWalletStatus = doWalletStatus;
|
||||
|
||||
var _action_types = __webpack_require__(4);
|
||||
|
||||
|
@ -4622,6 +4699,108 @@ function doSendSupport(amount, claimId, uri, successCallback, errorCallback) {
|
|||
};
|
||||
}
|
||||
|
||||
function doWalletEncrypt(newPassword) {
|
||||
return function (dispatch) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_ENCRYPT_START
|
||||
});
|
||||
|
||||
_lbry2.default.wallet_encrypt({ new_password: newPassword }).then(function (result) {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_ENCRYPT_COMPLETED,
|
||||
result: result
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_ENCRYPT_FAILED,
|
||||
result: result
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function doWalletUnlock(password) {
|
||||
return function (dispatch) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_UNLOCK_START
|
||||
});
|
||||
|
||||
_lbry2.default.wallet_unlock({ password: password }).then(function (result) {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_UNLOCK_COMPLETED,
|
||||
result: result
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_UNLOCK_FAILED,
|
||||
result: result
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function doWalletLock() {
|
||||
return function (dispatch) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_LOCK_START
|
||||
});
|
||||
|
||||
_lbry2.default.wallet_lock().then(function (result) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_LOCK_COMPLETED
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function doWalletDecrypt() {
|
||||
return function (dispatch) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_DECRYPT_START
|
||||
});
|
||||
|
||||
_lbry2.default.wallet_decrypt().then(function (result) {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_DECRYPT_COMPLETED,
|
||||
result: result
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_DECRYPT_FAILED,
|
||||
result: result
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function doWalletStatus() {
|
||||
return function (dispatch) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_STATUS_START
|
||||
});
|
||||
|
||||
_lbry2.default.status().then(function (result) {
|
||||
if (result && !result.error) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_STATUS_COMPLETED,
|
||||
result: result
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_STATUS_FAILED,
|
||||
result: result
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 29 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
@ -4632,7 +4811,7 @@ function doSendSupport(amount, claimId, uri, successCallback, errorCallback) {
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeSelectBlockDate = exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.selectState = undefined;
|
||||
exports.makeSelectBlockDate = exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.selectWalletUnlockSucceeded = exports.selectWalletUnlockPending = exports.selectWalletDecryptSucceeded = exports.selectWalletDecryptPending = exports.selectWalletEncryptSucceeded = exports.selectWalletEncryptPending = exports.selectWalletIsEncrypted = exports.selectWalletState = exports.selectState = undefined;
|
||||
|
||||
var _reselect = __webpack_require__(16);
|
||||
|
||||
|
@ -4642,6 +4821,36 @@ var selectState = exports.selectState = function selectState(state) {
|
|||
return state.wallet || {};
|
||||
};
|
||||
|
||||
var selectWalletState = exports.selectWalletState = selectState;
|
||||
|
||||
var selectWalletIsEncrypted = exports.selectWalletIsEncrypted = function selectWalletIsEncrypted(state) {
|
||||
return selectWalletState(state).walletIsEncrypted === true;
|
||||
};
|
||||
|
||||
var selectWalletEncryptPending = exports.selectWalletEncryptPending = (0, _reselect.createSelector)(selectState, function (state) {
|
||||
return state.walletEncryptPending;
|
||||
});
|
||||
|
||||
var selectWalletEncryptSucceeded = exports.selectWalletEncryptSucceeded = (0, _reselect.createSelector)(selectState, function (state) {
|
||||
return state.walletEncryptSucceded;
|
||||
});
|
||||
|
||||
var selectWalletDecryptPending = exports.selectWalletDecryptPending = (0, _reselect.createSelector)(selectState, function (state) {
|
||||
return state.walletDecryptPending;
|
||||
});
|
||||
|
||||
var selectWalletDecryptSucceeded = exports.selectWalletDecryptSucceeded = (0, _reselect.createSelector)(selectState, function (state) {
|
||||
return state.walletDecryptSucceded;
|
||||
});
|
||||
|
||||
var selectWalletUnlockPending = exports.selectWalletUnlockPending = (0, _reselect.createSelector)(selectState, function (state) {
|
||||
return state.walletUnlockPending;
|
||||
});
|
||||
|
||||
var selectWalletUnlockSucceeded = exports.selectWalletUnlockSucceeded = (0, _reselect.createSelector)(selectState, function (state) {
|
||||
return state.walletUnlockSucceded;
|
||||
});
|
||||
|
||||
var selectBalance = exports.selectBalance = (0, _reselect.createSelector)(selectState, function (state) {
|
||||
return state.balance;
|
||||
});
|
||||
|
@ -5502,6 +5711,9 @@ var PUBLISH = exports.PUBLISH = 'publish';
|
|||
var SEARCH = exports.SEARCH = 'search';
|
||||
var CONFIRM_TRANSACTION = exports.CONFIRM_TRANSACTION = 'confirm_transaction';
|
||||
var CONFIRM_THUMBNAIL_UPLOAD = exports.CONFIRM_THUMBNAIL_UPLOAD = 'confirm_thumbnail_upload';
|
||||
var WALLET_ENCRYPT = exports.WALLET_ENCRYPT = 'wallet_encrypt';
|
||||
var WALLET_DECRYPT = exports.WALLET_DECRYPT = 'wallet_decrypt';
|
||||
var WALLET_UNLOCK = exports.WALLET_UNLOCK = 'wallet_unlock';
|
||||
|
||||
/***/ }),
|
||||
/* 36 */
|
||||
|
@ -5693,7 +5905,14 @@ var defaultState = {
|
|||
fetchingTransactions: false,
|
||||
gettingNewAddress: false,
|
||||
draftTransaction: buildDraftTransaction(),
|
||||
sendingSupport: false
|
||||
sendingSupport: false,
|
||||
walletIsEncrypted: false,
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: null,
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: null,
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: null
|
||||
};
|
||||
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_STARTED] = function (state) {
|
||||
|
@ -5833,6 +6052,75 @@ reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = function (state, action) {
|
|||
return Object.assign({}, state, { blocks: blocks });
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_STATUS_COMPLETED] = function (state, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletIsEncrypted: !!action.result.wallet_is_encrypted
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_START] = function (state, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletEncryptPending: true,
|
||||
walletEncryptSucceded: null
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = function (state, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: true
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = function (state, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: false
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_START] = function (state, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletDecryptPending: true,
|
||||
walletDecryptSucceded: null
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = function (state, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: true
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = function (state, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: false
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_START] = function (state, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletUnlockPending: true,
|
||||
walletUnlockSucceded: null
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = function (state, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: true
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = function (state, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: false
|
||||
});
|
||||
};
|
||||
|
||||
function walletReducer() {
|
||||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
|
||||
var action = arguments[1];
|
||||
|
|
|
@ -42,6 +42,18 @@ export const FETCH_BLOCK_SUCCESS = 'FETCH_BLOCK_SUCCESS';
|
|||
export const SUPPORT_TRANSACTION_STARTED = 'SUPPORT_TRANSACTION_STARTED';
|
||||
export const SUPPORT_TRANSACTION_COMPLETED = 'SUPPORT_TRANSACTION_COMPLETED';
|
||||
export const SUPPORT_TRANSACTION_FAILED = 'SUPPORT_TRANSACTION_FAILED';
|
||||
export const WALLET_ENCRYPT_START = 'WALLET_ENCRYPT_START';
|
||||
export const WALLET_ENCRYPT_COMPLETED = 'WALLET_ENCRYPT_COMPLETED';
|
||||
export const WALLET_UNLOCK_START = 'WALLET_UNLOCK_START';
|
||||
export const WALLET_UNLOCK_COMPLETED = 'WALLET_UNLOCK_COMPLETED';
|
||||
export const WALLET_UNLOCK_FAILED = 'WALLET_UNLOCK_FAILED';
|
||||
export const WALLET_DECRYPT_START = 'WALLET_DECRYPT_START';
|
||||
export const WALLET_DECRYPT_COMPLETED = 'WALLET_DECRYPT_COMPLETED';
|
||||
export const WALLET_LOCK_START = 'WALLET_LOCK_START';
|
||||
export const WALLET_LOCK_COMPLETED = 'WALLET_LOCK_COMPLETED';
|
||||
export const WALLET_STATUS_START = 'WALLET_STATUS_START';
|
||||
export const WALLET_STATUS_COMPLETED = 'WALLET_STATUS_COMPLETED';
|
||||
export const WALLET_STATUS_FAILED = 'WALLET_STATUS_FAILED';
|
||||
|
||||
// Claims
|
||||
export const FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
||||
|
|
|
@ -23,3 +23,6 @@ export const PUBLISH = 'publish';
|
|||
export const SEARCH = 'search';
|
||||
export const CONFIRM_TRANSACTION = 'confirm_transaction';
|
||||
export const CONFIRM_THUMBNAIL_UPLOAD = 'confirm_thumbnail_upload';
|
||||
export const WALLET_ENCRYPT = 'wallet_encrypt';
|
||||
export const WALLET_DECRYPT = 'wallet_decrypt';
|
||||
export const WALLET_UNLOCK = 'wallet_unlock';
|
||||
|
|
12
src/index.js
12
src/index.js
|
@ -70,6 +70,10 @@ export {
|
|||
doSetDraftTransactionAmount,
|
||||
doSetDraftTransactionAddress,
|
||||
doSendSupport,
|
||||
doWalletEncrypt,
|
||||
doWalletDecrypt,
|
||||
doWalletUnlock,
|
||||
doWalletStatus,
|
||||
} from 'redux/actions/wallet';
|
||||
|
||||
// utils
|
||||
|
@ -201,4 +205,12 @@ export {
|
|||
selectDraftTransactionAddress,
|
||||
selectDraftTransactionError,
|
||||
selectBlocks,
|
||||
selectWalletIsEncrypted,
|
||||
selectWalletState,
|
||||
selectWalletEncryptPending,
|
||||
selectWalletEncryptSucceeded,
|
||||
selectWalletDecryptPending,
|
||||
selectWalletDecryptSucceeded,
|
||||
selectWalletUnlockPending,
|
||||
selectWalletUnlockSucceeded,
|
||||
} from 'redux/selectors/wallet';
|
||||
|
|
|
@ -79,6 +79,7 @@ Lbry.wallet_send = (params = {}) => daemonCallWithResult('wallet_send', params);
|
|||
Lbry.wallet_encrypt = (params = {}) => daemonCallWithResult('wallet_encrypt', params);
|
||||
Lbry.wallet_decrypt = () => daemonCallWithResult('wallet_decrypt', {});
|
||||
Lbry.wallet_unlock = (params = {}) => daemonCallWithResult('wallet_unlock', params);
|
||||
Lbry.wallet_lock = () => daemonCallWithResult('wallet_lock', {});
|
||||
|
||||
// transactions
|
||||
Lbry.transaction_list = (params = {}) => daemonCallWithResult('transaction_list', params);
|
||||
|
@ -128,7 +129,7 @@ Lbry.getMediaType = (contentType, extname) => {
|
|||
return res === extname ? 'unknown' : res;
|
||||
} else if (contentType) {
|
||||
return /^[^/]+/.exec(contentType)[0];
|
||||
}
|
||||
}
|
||||
return 'unknown';
|
||||
};
|
||||
|
||||
|
|
|
@ -242,3 +242,105 @@ export function doSendSupport(amount, claimId, uri, successCallback, errorCallba
|
|||
}).then(success, error);
|
||||
};
|
||||
}
|
||||
|
||||
export function doWalletEncrypt(newPassword) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_ENCRYPT_START,
|
||||
});
|
||||
|
||||
Lbry.wallet_encrypt({ new_password: newPassword }).then(result => {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_ENCRYPT_COMPLETED,
|
||||
result,
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_ENCRYPT_FAILED,
|
||||
result,
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doWalletUnlock(password) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_UNLOCK_START,
|
||||
});
|
||||
|
||||
Lbry.wallet_unlock({ password }).then(result => {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_UNLOCK_COMPLETED,
|
||||
result,
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_UNLOCK_FAILED,
|
||||
result,
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doWalletLock() {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_LOCK_START,
|
||||
});
|
||||
|
||||
Lbry.wallet_lock().then(() => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_LOCK_COMPLETED,
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doWalletDecrypt() {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_DECRYPT_START,
|
||||
});
|
||||
|
||||
Lbry.wallet_decrypt().then(result => {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_DECRYPT_COMPLETED,
|
||||
result,
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_DECRYPT_FAILED,
|
||||
result,
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doWalletStatus() {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_STATUS_START,
|
||||
});
|
||||
|
||||
Lbry.status().then(result => {
|
||||
if (result && !result.error) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_STATUS_COMPLETED,
|
||||
result,
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_STATUS_FAILED,
|
||||
result,
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,6 +14,13 @@ const defaultState = {
|
|||
gettingNewAddress: false,
|
||||
draftTransaction: buildDraftTransaction(),
|
||||
sendingSupport: false,
|
||||
walletIsEncrypted: false,
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: null,
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: null,
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: null,
|
||||
};
|
||||
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_STARTED] = state =>
|
||||
|
@ -131,7 +138,10 @@ reducers[ACTIONS.SUPPORT_TRANSACTION_FAILED] = (state, action) =>
|
|||
});
|
||||
|
||||
reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = (state, action) => {
|
||||
const { block, block: { height } } = action.data;
|
||||
const {
|
||||
block,
|
||||
block: { height },
|
||||
} = action.data;
|
||||
const blocks = Object.assign({}, state.blocks);
|
||||
|
||||
blocks[height] = block;
|
||||
|
@ -139,6 +149,65 @@ reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = (state, action) => {
|
|||
return Object.assign({}, state, { blocks });
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_STATUS_COMPLETED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
walletIsEncrypted: !!action.result.wallet_is_encrypted,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_START] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletEncryptPending: true,
|
||||
walletEncryptSucceded: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: true,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: false,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_START] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletDecryptPending: true,
|
||||
walletDecryptSucceded: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: true,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: false,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_START] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletUnlockPending: true,
|
||||
walletUnlockSucceded: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: true,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: false,
|
||||
});
|
||||
|
||||
export function walletReducer(state = defaultState, action) {
|
||||
const handler = reducers[action.type];
|
||||
if (handler) return handler(state, action);
|
||||
|
|
|
@ -2,6 +2,40 @@ import { createSelector } from 'reselect';
|
|||
|
||||
export const selectState = state => state.wallet || {};
|
||||
|
||||
export const selectWalletState = selectState;
|
||||
|
||||
export const selectWalletIsEncrypted = state => selectWalletState(state).walletIsEncrypted === true;
|
||||
|
||||
export const selectWalletEncryptPending = createSelector(
|
||||
selectState,
|
||||
state => state.walletEncryptPending
|
||||
);
|
||||
|
||||
export const selectWalletEncryptSucceeded = createSelector(
|
||||
selectState,
|
||||
state => state.walletEncryptSucceded
|
||||
);
|
||||
|
||||
export const selectWalletDecryptPending = createSelector(
|
||||
selectState,
|
||||
state => state.walletDecryptPending
|
||||
);
|
||||
|
||||
export const selectWalletDecryptSucceeded = createSelector(
|
||||
selectState,
|
||||
state => state.walletDecryptSucceded
|
||||
);
|
||||
|
||||
export const selectWalletUnlockPending = createSelector(
|
||||
selectState,
|
||||
state => state.walletUnlockPending
|
||||
);
|
||||
|
||||
export const selectWalletUnlockSucceeded = createSelector(
|
||||
selectState,
|
||||
state => state.walletUnlockSucceded
|
||||
);
|
||||
|
||||
export const selectBalance = createSelector(selectState, state => state.balance);
|
||||
|
||||
export const selectTransactionsById = createSelector(selectState, state => state.transactions);
|
||||
|
@ -61,7 +95,7 @@ export const selectTransactionItems = createSelector(selectTransactionsById, byI
|
|||
txid,
|
||||
date: tx.timestamp ? new Date(Number(tx.timestamp) * 1000) : null,
|
||||
amount,
|
||||
fee: amount < 0 ? (-1 * tx.fee) / append.length : 0,
|
||||
fee: amount < 0 ? -1 * tx.fee / append.length : 0,
|
||||
claim_id: item.claim_id,
|
||||
claim_name: item.claim_name,
|
||||
type: item.type || 'send',
|
||||
|
|
Loading…
Add table
Reference in a new issue