estimate claim date with block height
This commit is contained in:
parent
aa10240bc1
commit
6f1e3b054f
6 changed files with 144 additions and 72 deletions
124
dist/bundle.js
vendored
124
dist/bundle.js
vendored
|
@ -46,34 +46,19 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
/******/ // define getter function for harmony exports
|
/******/ // define getter function for harmony exports
|
||||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
/******/ 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
|
/******/ // define __esModule on exports
|
||||||
/******/ __webpack_require__.r = function(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 });
|
/******/ 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
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
/******/ __webpack_require__.n = function(module) {
|
/******/ __webpack_require__.n = function(module) {
|
||||||
/******/ var getter = module && module.__esModule ?
|
/******/ var getter = module && module.__esModule ?
|
||||||
|
@ -104,8 +89,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, "__esModule", {
|
||||||
value: true
|
value: true
|
||||||
});
|
});
|
||||||
exports.selectTransactionListFilter = exports.selectWalletUnlockResult = exports.selectWalletUnlockSucceeded = exports.selectWalletUnlockPending = exports.selectWalletDecryptResult = exports.selectWalletDecryptSucceeded = exports.selectWalletDecryptPending = exports.selectWalletEncryptResult = 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.selectSearchSuggestions = exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = 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.selectFileListPublishedSort = exports.selectFileListDownloadedSort = 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.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = undefined;
|
exports.selectTransactionListFilter = exports.selectWalletUnlockResult = exports.selectWalletUnlockSucceeded = exports.selectWalletUnlockPending = exports.selectWalletDecryptResult = exports.selectWalletDecryptSucceeded = exports.selectWalletDecryptPending = exports.selectWalletEncryptResult = 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.selectSearchSuggestions = exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = 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.selectFileListPublishedSort = exports.selectFileListDownloadedSort = 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.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 = undefined;
|
||||||
exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.selectPendingById = exports.makeSelectPendingByUri = exports.makeSelectClaimIsPending = exports.makeSelectChannelForClaimUri = exports.makeSelectRecommendedContentForUri = 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.creditsToString = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doSetTransactionListFilter = exports.doWalletStatus = exports.doWalletUnlock = exports.doWalletDecrypt = exports.doWalletEncrypt = exports.doSendTip = 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.doSetFileListSort = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = 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.PAGES = exports.SORT_OPTIONS = exports.TRANSACTIONS = exports.SETTINGS = exports.SEARCH_TYPES = exports.THUMBNAIL_STATUSES = exports.MODALS = exports.ACTIONS = exports.Notification = undefined;
|
exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.selectPendingById = exports.makeSelectPendingByUri = exports.makeSelectClaimIsPending = exports.makeSelectChannelForClaimUri = exports.makeSelectRecommendedContentForUri = 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.creditsToString = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doUpdateBlockHeight = exports.doSetTransactionListFilter = exports.doWalletStatus = exports.doWalletUnlock = exports.doWalletDecrypt = exports.doWalletEncrypt = exports.doSendTip = 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.doSetFileListSort = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = 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.PAGES = exports.SORT_OPTIONS = exports.TRANSACTIONS = exports.SETTINGS = exports.SEARCH_TYPES = exports.THUMBNAIL_STATUSES = exports.MODALS = exports.ACTIONS = exports.Notification = undefined;
|
||||||
|
|
||||||
var _Notification = __webpack_require__(1);
|
var _Notification = __webpack_require__(1);
|
||||||
|
|
||||||
|
@ -403,6 +388,12 @@ Object.defineProperty(exports, 'doSetTransactionListFilter', {
|
||||||
return _wallet.doSetTransactionListFilter;
|
return _wallet.doSetTransactionListFilter;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Object.defineProperty(exports, 'doUpdateBlockHeight', {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _wallet.doUpdateBlockHeight;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var _batchActions = __webpack_require__(21);
|
var _batchActions = __webpack_require__(21);
|
||||||
|
|
||||||
|
@ -1647,6 +1638,7 @@ var WALLET_LOCK_FAILED = exports.WALLET_LOCK_FAILED = 'WALLET_LOCK_FAILED';
|
||||||
var WALLET_STATUS_START = exports.WALLET_STATUS_START = 'WALLET_STATUS_START';
|
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_COMPLETED = exports.WALLET_STATUS_COMPLETED = 'WALLET_STATUS_COMPLETED';
|
||||||
var SET_TRANSACTION_LIST_FILTER = exports.SET_TRANSACTION_LIST_FILTER = 'SET_TRANSACTION_LIST_FILTER';
|
var SET_TRANSACTION_LIST_FILTER = exports.SET_TRANSACTION_LIST_FILTER = 'SET_TRANSACTION_LIST_FILTER';
|
||||||
|
var UPDATE_CURRENT_HEIGHT = exports.UPDATE_CURRENT_HEIGHT = 'UPDATE_CURRENT_HEIGHT';
|
||||||
|
|
||||||
// Claims
|
// Claims
|
||||||
var FETCH_FEATURED_CONTENT_STARTED = exports.FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
var FETCH_FEATURED_CONTENT_STARTED = exports.FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
||||||
|
@ -2537,26 +2529,26 @@ exports.default = lbryProxy;
|
||||||
/* 8 */
|
/* 8 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
var g;
|
var g;
|
||||||
|
|
||||||
// This works in non-strict mode
|
// This works in non-strict mode
|
||||||
g = (function() {
|
g = (function() {
|
||||||
return this;
|
return this;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// This works if eval is allowed (see CSP)
|
// This works if eval is allowed (see CSP)
|
||||||
g = g || Function("return this")() || (1, eval)("this");
|
g = g || Function("return this")() || (1, eval)("this");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// This works if the window reference is available
|
// This works if the window reference is available
|
||||||
if (typeof window === "object") g = window;
|
if (typeof window === "object") g = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
// g can still be undefined, but nothing to do about it...
|
// g can still be undefined, but nothing to do about it...
|
||||||
// We return undefined, instead of nothing here, so it's
|
// We return undefined, instead of nothing here, so it's
|
||||||
// easier to handle this case. if(!global) { ...}
|
// easier to handle this case. if(!global) { ...}
|
||||||
|
|
||||||
module.exports = g;
|
module.exports = g;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -4524,6 +4516,7 @@ exports.doWalletLock = doWalletLock;
|
||||||
exports.doWalletDecrypt = doWalletDecrypt;
|
exports.doWalletDecrypt = doWalletDecrypt;
|
||||||
exports.doWalletStatus = doWalletStatus;
|
exports.doWalletStatus = doWalletStatus;
|
||||||
exports.doSetTransactionListFilter = doSetTransactionListFilter;
|
exports.doSetTransactionListFilter = doSetTransactionListFilter;
|
||||||
|
exports.doUpdateBlockHeight = doUpdateBlockHeight;
|
||||||
|
|
||||||
var _action_types = __webpack_require__(4);
|
var _action_types = __webpack_require__(4);
|
||||||
|
|
||||||
|
@ -4883,6 +4876,19 @@ function doSetTransactionListFilter(filterOption) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doUpdateBlockHeight() {
|
||||||
|
return function (dispatch) {
|
||||||
|
return _lbry2.default.status().then(function (status) {
|
||||||
|
if (status.wallet) {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.UPDATE_CURRENT_HEIGHT,
|
||||||
|
data: status.wallet.blocks
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 29 */
|
/* 29 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
@ -4893,7 +4899,7 @@ function doSetTransactionListFilter(filterOption) {
|
||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, "__esModule", {
|
||||||
value: true
|
value: true
|
||||||
});
|
});
|
||||||
exports.selectTransactionListFilter = 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.selectWalletLockResult = exports.selectWalletLockSucceeded = exports.selectWalletLockPending = exports.selectWalletUnlockResult = exports.selectWalletUnlockSucceeded = exports.selectWalletUnlockPending = exports.selectWalletDecryptResult = exports.selectWalletDecryptSucceeded = exports.selectWalletDecryptPending = exports.selectWalletEncryptResult = exports.selectWalletEncryptSucceeded = exports.selectWalletEncryptPending = exports.selectWalletIsEncrypted = exports.selectWalletState = exports.selectState = undefined;
|
exports.selectTransactionListFilter = exports.makeSelectBlockDate = exports.selectCurrentHeight = 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.selectWalletLockResult = exports.selectWalletLockSucceeded = exports.selectWalletLockPending = exports.selectWalletUnlockResult = exports.selectWalletUnlockSucceeded = exports.selectWalletUnlockPending = exports.selectWalletDecryptResult = exports.selectWalletDecryptSucceeded = exports.selectWalletDecryptPending = exports.selectWalletEncryptResult = exports.selectWalletEncryptSucceeded = exports.selectWalletEncryptPending = exports.selectWalletIsEncrypted = exports.selectWalletState = exports.selectState = undefined;
|
||||||
|
|
||||||
var _reselect = __webpack_require__(16);
|
var _reselect = __webpack_require__(16);
|
||||||
|
|
||||||
|
@ -5093,9 +5099,29 @@ var selectBlocks = exports.selectBlocks = (0, _reselect.createSelector)(selectSt
|
||||||
return state.blocks;
|
return state.blocks;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var selectCurrentHeight = exports.selectCurrentHeight = (0, _reselect.createSelector)(selectState, function (state) {
|
||||||
|
return state.latestBlock;
|
||||||
|
});
|
||||||
|
|
||||||
var makeSelectBlockDate = exports.makeSelectBlockDate = function makeSelectBlockDate(block) {
|
var makeSelectBlockDate = exports.makeSelectBlockDate = function makeSelectBlockDate(block) {
|
||||||
return (0, _reselect.createSelector)(selectBlocks, function (blocks) {
|
return (0, _reselect.createSelector)(selectBlocks, selectCurrentHeight, function (blocks, latestBlock) {
|
||||||
return blocks && blocks[block] ? new Date(blocks[block].time * 1000) : undefined;
|
// If we have the block data, look at the actual date,
|
||||||
|
// If not, try to simulate it based on 2.5 minute blocks
|
||||||
|
// Adding this on 11/7/2018 because caling block_show for every claim is causing
|
||||||
|
// performance issues.
|
||||||
|
if (blocks && blocks[block]) {
|
||||||
|
return new Date(blocks[block].time * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pending claim
|
||||||
|
if (block < 1) {
|
||||||
|
return new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
var difference = latestBlock - block;
|
||||||
|
var msSincePublish = difference * 2.5 * 60 * 1000; // Number of blocks * 2.5 minutes in ms
|
||||||
|
var publishDate = Date.now() - msSincePublish;
|
||||||
|
return new Date(publishDate);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6158,6 +6184,7 @@ var buildDraftTransaction = function buildDraftTransaction() {
|
||||||
/*:: type WalletState = {
|
/*:: type WalletState = {
|
||||||
balance: any,
|
balance: any,
|
||||||
blocks: any,
|
blocks: any,
|
||||||
|
latestBlock: number,
|
||||||
transactions: any,
|
transactions: any,
|
||||||
fetchingTransactions: boolean,
|
fetchingTransactions: boolean,
|
||||||
gettingNewAddress: boolean,
|
gettingNewAddress: boolean,
|
||||||
|
@ -6182,6 +6209,7 @@ var buildDraftTransaction = function buildDraftTransaction() {
|
||||||
var defaultState = {
|
var defaultState = {
|
||||||
balance: undefined,
|
balance: undefined,
|
||||||
blocks: {},
|
blocks: {},
|
||||||
|
latestBlock: undefined,
|
||||||
transactions: {},
|
transactions: {},
|
||||||
fetchingTransactions: false,
|
fetchingTransactions: false,
|
||||||
gettingNewAddress: false,
|
gettingNewAddress: false,
|
||||||
|
@ -6448,6 +6476,12 @@ reducers[ACTIONS.SET_TRANSACTION_LIST_FILTER] = function (state /*: WalletState*
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
reducers[ACTIONS.UPDATE_CURRENT_HEIGHT] = function (state /*: WalletState*/, action /*: { data: number }*/) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
latestBlock: action.data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function walletReducer() {
|
function walletReducer() {
|
||||||
var state /*: WalletState*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
|
var state /*: WalletState*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
|
||||||
var action /*: ActionResult*/ = arguments[1];
|
var action /*: ActionResult*/ = arguments[1];
|
||||||
|
|
|
@ -58,6 +58,7 @@ export const WALLET_LOCK_FAILED = 'WALLET_LOCK_FAILED';
|
||||||
export const WALLET_STATUS_START = 'WALLET_STATUS_START';
|
export const WALLET_STATUS_START = 'WALLET_STATUS_START';
|
||||||
export const WALLET_STATUS_COMPLETED = 'WALLET_STATUS_COMPLETED';
|
export const WALLET_STATUS_COMPLETED = 'WALLET_STATUS_COMPLETED';
|
||||||
export const SET_TRANSACTION_LIST_FILTER = 'SET_TRANSACTION_LIST_FILTER';
|
export const SET_TRANSACTION_LIST_FILTER = 'SET_TRANSACTION_LIST_FILTER';
|
||||||
|
export const UPDATE_CURRENT_HEIGHT = 'UPDATE_CURRENT_HEIGHT';
|
||||||
|
|
||||||
// Claims
|
// Claims
|
||||||
export const FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
export const FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
||||||
|
|
|
@ -88,6 +88,7 @@ export {
|
||||||
doWalletUnlock,
|
doWalletUnlock,
|
||||||
doWalletStatus,
|
doWalletStatus,
|
||||||
doSetTransactionListFilter,
|
doSetTransactionListFilter,
|
||||||
|
doUpdateBlockHeight,
|
||||||
} from 'redux/actions/wallet';
|
} from 'redux/actions/wallet';
|
||||||
|
|
||||||
// utils
|
// utils
|
||||||
|
|
|
@ -9,7 +9,7 @@ export function doUpdateBalance() {
|
||||||
const {
|
const {
|
||||||
wallet: { balance: balanceInStore },
|
wallet: { balance: balanceInStore },
|
||||||
} = getState();
|
} = getState();
|
||||||
Lbry.account_balance().then(balance => {
|
Lbry.account_balance().then((balance) => {
|
||||||
if (balanceInStore !== balance) {
|
if (balanceInStore !== balance) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPDATE_BALANCE,
|
type: ACTIONS.UPDATE_BALANCE,
|
||||||
|
@ -23,19 +23,19 @@ export function doUpdateBalance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doBalanceSubscribe() {
|
export function doBalanceSubscribe() {
|
||||||
return dispatch => {
|
return (dispatch) => {
|
||||||
dispatch(doUpdateBalance());
|
dispatch(doUpdateBalance());
|
||||||
setInterval(() => dispatch(doUpdateBalance()), 5000);
|
setInterval(() => dispatch(doUpdateBalance()), 5000);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doFetchTransactions() {
|
export function doFetchTransactions() {
|
||||||
return dispatch => {
|
return (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.FETCH_TRANSACTIONS_STARTED,
|
type: ACTIONS.FETCH_TRANSACTIONS_STARTED,
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbry.transaction_list().then(results => {
|
Lbry.transaction_list().then((results) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.FETCH_TRANSACTIONS_COMPLETED,
|
type: ACTIONS.FETCH_TRANSACTIONS_COMPLETED,
|
||||||
data: {
|
data: {
|
||||||
|
@ -47,8 +47,8 @@ export function doFetchTransactions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doFetchBlock(height) {
|
export function doFetchBlock(height) {
|
||||||
return dispatch => {
|
return (dispatch) => {
|
||||||
Lbry.block_show({ height }).then(block => {
|
Lbry.block_show({ height }).then((block) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.FETCH_BLOCK_SUCCESS,
|
type: ACTIONS.FETCH_BLOCK_SUCCESS,
|
||||||
data: { block },
|
data: { block },
|
||||||
|
@ -58,13 +58,13 @@ export function doFetchBlock(height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doGetNewAddress() {
|
export function doGetNewAddress() {
|
||||||
return dispatch => {
|
return (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.GET_NEW_ADDRESS_STARTED,
|
type: ACTIONS.GET_NEW_ADDRESS_STARTED,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Removed localStorage use, since address is expected to be stored in redux store
|
// Removed localStorage use, since address is expected to be stored in redux store
|
||||||
Lbry.address_unused().then(address => {
|
Lbry.address_unused().then((address) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.GET_NEW_ADDRESS_COMPLETED,
|
type: ACTIONS.GET_NEW_ADDRESS_COMPLETED,
|
||||||
data: { address },
|
data: { address },
|
||||||
|
@ -74,12 +74,12 @@ export function doGetNewAddress() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doCheckAddressIsMine(address) {
|
export function doCheckAddressIsMine(address) {
|
||||||
return dispatch => {
|
return (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.CHECK_ADDRESS_IS_MINE_STARTED,
|
type: ACTIONS.CHECK_ADDRESS_IS_MINE_STARTED,
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbry.address_is_mine({ address }).then(isMine => {
|
Lbry.address_is_mine({ address }).then((isMine) => {
|
||||||
if (!isMine) dispatch(doGetNewAddress());
|
if (!isMine) dispatch(doGetNewAddress());
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -110,7 +110,7 @@ export function doSendDraftTransaction(address, amount) {
|
||||||
type: ACTIONS.SEND_TRANSACTION_STARTED,
|
type: ACTIONS.SEND_TRANSACTION_STARTED,
|
||||||
});
|
});
|
||||||
|
|
||||||
const successCallback = response => {
|
const successCallback = (response) => {
|
||||||
if (response.txid) {
|
if (response.txid) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.SEND_TRANSACTION_COMPLETED,
|
type: ACTIONS.SEND_TRANSACTION_COMPLETED,
|
||||||
|
@ -141,7 +141,7 @@ export function doSendDraftTransaction(address, amount) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const errorCallback = error => {
|
const errorCallback = (error) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.SEND_TRANSACTION_FAILED,
|
type: ACTIONS.SEND_TRANSACTION_FAILED,
|
||||||
data: { error: error.message },
|
data: { error: error.message },
|
||||||
|
@ -213,7 +213,7 @@ export function doSendTip(amount, claimId, uri, successCallback, errorCallback)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const error = err => {
|
const error = (err) => {
|
||||||
dispatch(
|
dispatch(
|
||||||
doNotify({
|
doNotify({
|
||||||
message: __(`There was an error sending support funds.`),
|
message: __(`There was an error sending support funds.`),
|
||||||
|
@ -245,12 +245,12 @@ export function doSendTip(amount, claimId, uri, successCallback, errorCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doWalletEncrypt(newPassword) {
|
export function doWalletEncrypt(newPassword) {
|
||||||
return dispatch => {
|
return (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.WALLET_ENCRYPT_START,
|
type: ACTIONS.WALLET_ENCRYPT_START,
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbry.account_encrypt({ new_password: newPassword }).then(result => {
|
Lbry.account_encrypt({ new_password: newPassword }).then((result) => {
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.WALLET_ENCRYPT_COMPLETED,
|
type: ACTIONS.WALLET_ENCRYPT_COMPLETED,
|
||||||
|
@ -267,12 +267,12 @@ export function doWalletEncrypt(newPassword) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doWalletUnlock(password) {
|
export function doWalletUnlock(password) {
|
||||||
return dispatch => {
|
return (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.WALLET_UNLOCK_START,
|
type: ACTIONS.WALLET_UNLOCK_START,
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbry.account_unlock({ password }).then(result => {
|
Lbry.account_unlock({ password }).then((result) => {
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.WALLET_UNLOCK_COMPLETED,
|
type: ACTIONS.WALLET_UNLOCK_COMPLETED,
|
||||||
|
@ -289,12 +289,12 @@ export function doWalletUnlock(password) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doWalletLock() {
|
export function doWalletLock() {
|
||||||
return dispatch => {
|
return (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.WALLET_LOCK_START,
|
type: ACTIONS.WALLET_LOCK_START,
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbry.wallet_lock().then(result => {
|
Lbry.wallet_lock().then((result) => {
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.WALLET_LOCK_COMPLETED,
|
type: ACTIONS.WALLET_LOCK_COMPLETED,
|
||||||
|
@ -311,12 +311,12 @@ export function doWalletLock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doWalletDecrypt() {
|
export function doWalletDecrypt() {
|
||||||
return dispatch => {
|
return (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.WALLET_DECRYPT_START,
|
type: ACTIONS.WALLET_DECRYPT_START,
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbry.account_decrypt().then(result => {
|
Lbry.account_decrypt().then((result) => {
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.WALLET_DECRYPT_COMPLETED,
|
type: ACTIONS.WALLET_DECRYPT_COMPLETED,
|
||||||
|
@ -333,12 +333,12 @@ export function doWalletDecrypt() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doWalletStatus() {
|
export function doWalletStatus() {
|
||||||
return dispatch => {
|
return (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.WALLET_STATUS_START,
|
type: ACTIONS.WALLET_STATUS_START,
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbry.status().then(status => {
|
Lbry.status().then((status) => {
|
||||||
if (status && status.wallet) {
|
if (status && status.wallet) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.WALLET_STATUS_COMPLETED,
|
type: ACTIONS.WALLET_STATUS_COMPLETED,
|
||||||
|
@ -355,3 +355,15 @@ export function doSetTransactionListFilter(filterOption) {
|
||||||
data: filterOption,
|
data: filterOption,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function doUpdateBlockHeight() {
|
||||||
|
return (dispatch) =>
|
||||||
|
Lbry.status().then((status) => {
|
||||||
|
if (status.wallet) {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.UPDATE_CURRENT_HEIGHT,
|
||||||
|
data: status.wallet.blocks,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ type ActionResult = {
|
||||||
type WalletState = {
|
type WalletState = {
|
||||||
balance: any,
|
balance: any,
|
||||||
blocks: any,
|
blocks: any,
|
||||||
|
latestBlock: number,
|
||||||
transactions: any,
|
transactions: any,
|
||||||
fetchingTransactions: boolean,
|
fetchingTransactions: boolean,
|
||||||
gettingNewAddress: boolean,
|
gettingNewAddress: boolean,
|
||||||
|
@ -40,6 +41,7 @@ type WalletState = {
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
balance: undefined,
|
balance: undefined,
|
||||||
blocks: {},
|
blocks: {},
|
||||||
|
latestBlock: undefined,
|
||||||
transactions: {},
|
transactions: {},
|
||||||
fetchingTransactions: false,
|
fetchingTransactions: false,
|
||||||
gettingNewAddress: false,
|
gettingNewAddress: false,
|
||||||
|
@ -281,6 +283,11 @@ reducers[ACTIONS.SET_TRANSACTION_LIST_FILTER] = (state: WalletState, action: {})
|
||||||
transactionListFilter: action.data,
|
transactionListFilter: action.data,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.UPDATE_CURRENT_HEIGHT] = (state: WalletState, action: { data: number }) =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
latestBlock: action.data,
|
||||||
|
});
|
||||||
|
|
||||||
export function walletReducer(state: WalletState = defaultState, action: ActionResult) {
|
export function walletReducer(state: WalletState = defaultState, action: ActionResult) {
|
||||||
const handler = reducers[action.type];
|
const handler = reducers[action.type];
|
||||||
if (handler) return handler(state, action);
|
if (handler) return handler(state, action);
|
||||||
|
|
|
@ -211,11 +211,28 @@ export const selectDraftTransactionError = createSelector(
|
||||||
|
|
||||||
export const selectBlocks = createSelector(selectState, (state) => state.blocks);
|
export const selectBlocks = createSelector(selectState, (state) => state.blocks);
|
||||||
|
|
||||||
|
export const selectCurrentHeight = createSelector(selectState, (state) => state.latestBlock);
|
||||||
|
|
||||||
export const makeSelectBlockDate = (block) =>
|
export const makeSelectBlockDate = (block) =>
|
||||||
createSelector(
|
createSelector(selectBlocks, selectCurrentHeight, (blocks, latestBlock) => {
|
||||||
selectBlocks,
|
// If we have the block data, look at the actual date,
|
||||||
(blocks) => (blocks && blocks[block] ? new Date(blocks[block].time * 1000) : undefined)
|
// If not, try to simulate it based on 2.5 minute blocks
|
||||||
);
|
// Adding this on 11/7/2018 because caling block_show for every claim is causing
|
||||||
|
// performance issues.
|
||||||
|
if (blocks && blocks[block]) {
|
||||||
|
return new Date(blocks[block].time * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pending claim
|
||||||
|
if (block < 1) {
|
||||||
|
return new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
const difference = latestBlock - block;
|
||||||
|
const msSincePublish = difference * 2.5 * 60 * 1000; // Number of blocks * 2.5 minutes in ms
|
||||||
|
const publishDate = Date.now() - msSincePublish;
|
||||||
|
return new Date(publishDate);
|
||||||
|
});
|
||||||
|
|
||||||
export const selectTransactionListFilter = createSelector(
|
export const selectTransactionListFilter = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
|
|
Loading…
Reference in a new issue