Add flow types and fix windows flow issues
This commit is contained in:
parent
9bf654d007
commit
7a91c7d883
6 changed files with 10056 additions and 98 deletions
92
dist/bundle.js
vendored
92
dist/bundle.js
vendored
|
@ -5982,6 +5982,35 @@ var buildDraftTransaction = function buildDraftTransaction() {
|
|||
};
|
||||
};
|
||||
|
||||
// TODO: Split into common success and failure types
|
||||
// See details in https://github.com/lbryio/lbry/issues/1307
|
||||
/*:: type ActionResult = {
|
||||
result: any,
|
||||
};*/
|
||||
/*:: type WalletState = {
|
||||
balance: any,
|
||||
blocks: any,
|
||||
transactions: any,
|
||||
fetchingTransactions: boolean,
|
||||
gettingNewAddress: boolean,
|
||||
draftTransaction: any,
|
||||
sendingSupport: boolean,
|
||||
walletIsEncrypted: boolean,
|
||||
walletEncryptPending: boolean,
|
||||
walletEncryptSucceded: ?boolean,
|
||||
walletEncryptResult: ?boolean,
|
||||
walletDecryptPending: boolean,
|
||||
walletDecryptSucceded: ?boolean,
|
||||
walletDecryptResult: ?boolean,
|
||||
walletUnlockPending: boolean,
|
||||
walletUnlockSucceded: ?boolean,
|
||||
walletUnlockResult: ?boolean,
|
||||
walletLockPending: boolean,
|
||||
walletLockSucceded: ?boolean,
|
||||
walletLockResult: ?boolean,
|
||||
}*/
|
||||
|
||||
|
||||
var defaultState = {
|
||||
balance: undefined,
|
||||
blocks: {},
|
||||
|
@ -5993,20 +6022,25 @@ var defaultState = {
|
|||
walletIsEncrypted: false,
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: null,
|
||||
walletEncryptResult: null,
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: null,
|
||||
walletDecryptResult: null,
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: null,
|
||||
walletUnlockResult: null,
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: null,
|
||||
walletLockResult: null
|
||||
};
|
||||
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_STARTED] = function (state) {
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_STARTED] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
fetchingTransactions: true
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_COMPLETED] = function (state, action) {
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_COMPLETED] = function (state /*: WalletState*/, action) {
|
||||
var byId = Object.assign({}, state.transactions);
|
||||
|
||||
var transactions = action.data.transactions;
|
||||
|
@ -6022,13 +6056,13 @@ reducers[ACTIONS.FETCH_TRANSACTIONS_COMPLETED] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.GET_NEW_ADDRESS_STARTED] = function (state) {
|
||||
reducers[ACTIONS.GET_NEW_ADDRESS_STARTED] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
gettingNewAddress: true
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.GET_NEW_ADDRESS_COMPLETED] = function (state, action) {
|
||||
reducers[ACTIONS.GET_NEW_ADDRESS_COMPLETED] = function (state /*: WalletState*/, action) {
|
||||
var address = action.data.address;
|
||||
|
||||
// Say no to localStorage!
|
||||
|
@ -6039,25 +6073,25 @@ reducers[ACTIONS.GET_NEW_ADDRESS_COMPLETED] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.UPDATE_BALANCE] = function (state, action) {
|
||||
reducers[ACTIONS.UPDATE_BALANCE] = function (state /*: WalletState*/, action) {
|
||||
return Object.assign({}, state, {
|
||||
balance: action.data.balance
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.CHECK_ADDRESS_IS_MINE_STARTED] = function (state) {
|
||||
reducers[ACTIONS.CHECK_ADDRESS_IS_MINE_STARTED] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
checkingAddressOwnership: true
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.CHECK_ADDRESS_IS_MINE_COMPLETED] = function (state) {
|
||||
reducers[ACTIONS.CHECK_ADDRESS_IS_MINE_COMPLETED] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
checkingAddressOwnership: false
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SET_DRAFT_TRANSACTION_AMOUNT] = function (state, action) {
|
||||
reducers[ACTIONS.SET_DRAFT_TRANSACTION_AMOUNT] = function (state /*: WalletState*/, action) {
|
||||
var oldDraft = state.draftTransaction;
|
||||
var newDraft = Object.assign({}, oldDraft, {
|
||||
amount: parseFloat(action.data.amount)
|
||||
|
@ -6068,7 +6102,7 @@ reducers[ACTIONS.SET_DRAFT_TRANSACTION_AMOUNT] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SET_DRAFT_TRANSACTION_ADDRESS] = function (state, action) {
|
||||
reducers[ACTIONS.SET_DRAFT_TRANSACTION_ADDRESS] = function (state /*: WalletState*/, action) {
|
||||
var oldDraft = state.draftTransaction;
|
||||
var newDraft = Object.assign({}, oldDraft, {
|
||||
address: action.data.address
|
||||
|
@ -6079,7 +6113,7 @@ reducers[ACTIONS.SET_DRAFT_TRANSACTION_ADDRESS] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SEND_TRANSACTION_STARTED] = function (state) {
|
||||
reducers[ACTIONS.SEND_TRANSACTION_STARTED] = function (state /*: WalletState*/) {
|
||||
var newDraftTransaction = Object.assign({}, state.draftTransaction, {
|
||||
sending: true
|
||||
});
|
||||
|
@ -6089,13 +6123,13 @@ reducers[ACTIONS.SEND_TRANSACTION_STARTED] = function (state) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SEND_TRANSACTION_COMPLETED] = function (state) {
|
||||
reducers[ACTIONS.SEND_TRANSACTION_COMPLETED] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
draftTransaction: buildDraftTransaction()
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SEND_TRANSACTION_FAILED] = function (state, action) {
|
||||
reducers[ACTIONS.SEND_TRANSACTION_FAILED] = function (state /*: WalletState*/, action) {
|
||||
var newDraftTransaction = Object.assign({}, state.draftTransaction, {
|
||||
sending: false,
|
||||
error: action.data.error
|
||||
|
@ -6106,26 +6140,26 @@ reducers[ACTIONS.SEND_TRANSACTION_FAILED] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_STARTED] = function (state) {
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_STARTED] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
sendingSupport: true
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_COMPLETED] = function (state) {
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_COMPLETED] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
sendingSupport: false
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_FAILED] = function (state, action) {
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_FAILED] = function (state /*: WalletState*/, action) {
|
||||
return Object.assign({}, state, {
|
||||
error: action.data.error,
|
||||
sendingSupport: false
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = function (state, action) {
|
||||
reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = function (state /*: WalletState*/, action) {
|
||||
var _action$data = action.data,
|
||||
block = _action$data.block,
|
||||
height = _action$data.block.height;
|
||||
|
@ -6137,13 +6171,13 @@ reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = function (state, action) {
|
|||
return Object.assign({}, state, { blocks: blocks });
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_STATUS_COMPLETED] = function (state, action) {
|
||||
reducers[ACTIONS.WALLET_STATUS_COMPLETED] = function (state /*: WalletState*/, action) {
|
||||
return Object.assign({}, state, {
|
||||
walletIsEncrypted: !!action.result.wallet_is_encrypted
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_START] = function (state) {
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_START] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletEncryptPending: true,
|
||||
walletEncryptSucceded: null,
|
||||
|
@ -6151,7 +6185,7 @@ reducers[ACTIONS.WALLET_ENCRYPT_START] = function (state) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = function (state, action) {
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = function (state /*: WalletState*/, action /*: ActionResult*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: true,
|
||||
|
@ -6159,7 +6193,7 @@ reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = function (state, action) {
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = function (state /*: WalletState*/, action /*: ActionResult*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: false,
|
||||
|
@ -6167,7 +6201,7 @@ reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_START] = function (state) {
|
||||
reducers[ACTIONS.WALLET_DECRYPT_START] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletDecryptPending: true,
|
||||
walletDecryptSucceded: null,
|
||||
|
@ -6175,7 +6209,7 @@ reducers[ACTIONS.WALLET_DECRYPT_START] = function (state) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = function (state, action) {
|
||||
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = function (state /*: WalletState*/, action /*: ActionResult*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: true,
|
||||
|
@ -6183,7 +6217,7 @@ reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = function (state, action) {
|
||||
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = function (state /*: WalletState*/, action /*: ActionResult*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: false,
|
||||
|
@ -6191,7 +6225,7 @@ reducers[ACTIONS.WALLET_DECRYPT_FAILED] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_START] = function (state) {
|
||||
reducers[ACTIONS.WALLET_UNLOCK_START] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletUnlockPending: true,
|
||||
walletUnlockSucceded: null,
|
||||
|
@ -6199,7 +6233,7 @@ reducers[ACTIONS.WALLET_UNLOCK_START] = function (state) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = function (state, action) {
|
||||
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = function (state /*: WalletState*/, action /*: ActionResult*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: true,
|
||||
|
@ -6207,7 +6241,7 @@ reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = function (state, action) {
|
||||
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = function (state /*: WalletState*/, action /*: ActionResult*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: false,
|
||||
|
@ -6215,7 +6249,7 @@ reducers[ACTIONS.WALLET_UNLOCK_FAILED] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_LOCK_START] = function (state) {
|
||||
reducers[ACTIONS.WALLET_LOCK_START] = function (state /*: WalletState*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: null,
|
||||
|
@ -6223,7 +6257,7 @@ reducers[ACTIONS.WALLET_LOCK_START] = function (state) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_LOCK_COMPLETED] = function (state, action) {
|
||||
reducers[ACTIONS.WALLET_LOCK_COMPLETED] = function (state /*: WalletState*/, action /*: ActionResult*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: true,
|
||||
|
@ -6231,7 +6265,7 @@ reducers[ACTIONS.WALLET_LOCK_COMPLETED] = function (state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_LOCK_FAILED] = function (state, action) {
|
||||
reducers[ACTIONS.WALLET_LOCK_FAILED] = function (state /*: WalletState*/, action /*: ActionResult*/) {
|
||||
return Object.assign({}, state, {
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: false,
|
||||
|
|
9849
package-lock.json
generated
Normal file
9849
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -34,6 +34,7 @@
|
|||
"babel-eslint": "^8.0.3",
|
||||
"babel-loader": "^7.1.4",
|
||||
"babel-plugin-module-resolver": "^3.0.0",
|
||||
"babel-plugin-transform-flow-comments": "^6.17.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-stage-2": "^6.18.0",
|
||||
"eslint": "^4.19.1",
|
||||
|
@ -43,9 +44,9 @@
|
|||
"eslint-plugin-flowtype": "^2.40.1",
|
||||
"eslint-plugin-import": "^2.10.0",
|
||||
"eslint-plugin-prettier": "^2.4.0",
|
||||
"flow-babel-webpack-plugin": "^1.1.1",
|
||||
"flow-bin": "^0.69.0",
|
||||
"flow-typed": "^2.4.0",
|
||||
"flow-typed": "^2.5.1",
|
||||
"flow-webpack-plugin": "^1.2.0",
|
||||
"husky": "^0.14.3",
|
||||
"lint-staged": "^7.0.4",
|
||||
"prettier": "^1.4.2",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
const reducers = {};
|
||||
|
@ -6,6 +7,36 @@ const buildDraftTransaction = () => ({
|
|||
address: undefined,
|
||||
});
|
||||
|
||||
// TODO: Split into common success and failure types
|
||||
// See details in https://github.com/lbryio/lbry/issues/1307
|
||||
type ActionResult = {
|
||||
type: any,
|
||||
result: any,
|
||||
};
|
||||
|
||||
type WalletState = {
|
||||
balance: any,
|
||||
blocks: any,
|
||||
transactions: any,
|
||||
fetchingTransactions: boolean,
|
||||
gettingNewAddress: boolean,
|
||||
draftTransaction: any,
|
||||
sendingSupport: boolean,
|
||||
walletIsEncrypted: boolean,
|
||||
walletEncryptPending: boolean,
|
||||
walletEncryptSucceded: ?boolean,
|
||||
walletEncryptResult: ?boolean,
|
||||
walletDecryptPending: boolean,
|
||||
walletDecryptSucceded: ?boolean,
|
||||
walletDecryptResult: ?boolean,
|
||||
walletUnlockPending: boolean,
|
||||
walletUnlockSucceded: ?boolean,
|
||||
walletUnlockResult: ?boolean,
|
||||
walletLockPending: boolean,
|
||||
walletLockSucceded: ?boolean,
|
||||
walletLockResult: ?boolean,
|
||||
};
|
||||
|
||||
const defaultState = {
|
||||
balance: undefined,
|
||||
blocks: {},
|
||||
|
@ -17,19 +48,24 @@ const defaultState = {
|
|||
walletIsEncrypted: false,
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: null,
|
||||
walletEncryptResult: null,
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: null,
|
||||
walletDecryptResult: null,
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: null,
|
||||
walletUnlockResult: null,
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: null,
|
||||
walletLockResult: null,
|
||||
};
|
||||
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_STARTED] = state =>
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_STARTED] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
fetchingTransactions: true,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_COMPLETED] = (state, action) => {
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_COMPLETED] = (state: WalletState, action) => {
|
||||
const byId = Object.assign({}, state.transactions);
|
||||
|
||||
const { transactions } = action.data;
|
||||
|
@ -44,12 +80,12 @@ reducers[ACTIONS.FETCH_TRANSACTIONS_COMPLETED] = (state, action) => {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.GET_NEW_ADDRESS_STARTED] = state =>
|
||||
reducers[ACTIONS.GET_NEW_ADDRESS_STARTED] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
gettingNewAddress: true,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.GET_NEW_ADDRESS_COMPLETED] = (state, action) => {
|
||||
reducers[ACTIONS.GET_NEW_ADDRESS_COMPLETED] = (state: WalletState, action) => {
|
||||
const { address } = action.data;
|
||||
|
||||
// Say no to localStorage!
|
||||
|
@ -59,22 +95,22 @@ reducers[ACTIONS.GET_NEW_ADDRESS_COMPLETED] = (state, action) => {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.UPDATE_BALANCE] = (state, action) =>
|
||||
reducers[ACTIONS.UPDATE_BALANCE] = (state: WalletState, action) =>
|
||||
Object.assign({}, state, {
|
||||
balance: action.data.balance,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.CHECK_ADDRESS_IS_MINE_STARTED] = state =>
|
||||
reducers[ACTIONS.CHECK_ADDRESS_IS_MINE_STARTED] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
checkingAddressOwnership: true,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.CHECK_ADDRESS_IS_MINE_COMPLETED] = state =>
|
||||
reducers[ACTIONS.CHECK_ADDRESS_IS_MINE_COMPLETED] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
checkingAddressOwnership: false,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.SET_DRAFT_TRANSACTION_AMOUNT] = (state, action) => {
|
||||
reducers[ACTIONS.SET_DRAFT_TRANSACTION_AMOUNT] = (state: WalletState, action) => {
|
||||
const oldDraft = state.draftTransaction;
|
||||
const newDraft = Object.assign({}, oldDraft, {
|
||||
amount: parseFloat(action.data.amount),
|
||||
|
@ -85,7 +121,7 @@ reducers[ACTIONS.SET_DRAFT_TRANSACTION_AMOUNT] = (state, action) => {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SET_DRAFT_TRANSACTION_ADDRESS] = (state, action) => {
|
||||
reducers[ACTIONS.SET_DRAFT_TRANSACTION_ADDRESS] = (state: WalletState, action) => {
|
||||
const oldDraft = state.draftTransaction;
|
||||
const newDraft = Object.assign({}, oldDraft, {
|
||||
address: action.data.address,
|
||||
|
@ -96,7 +132,7 @@ reducers[ACTIONS.SET_DRAFT_TRANSACTION_ADDRESS] = (state, action) => {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SEND_TRANSACTION_STARTED] = state => {
|
||||
reducers[ACTIONS.SEND_TRANSACTION_STARTED] = (state: WalletState) => {
|
||||
const newDraftTransaction = Object.assign({}, state.draftTransaction, {
|
||||
sending: true,
|
||||
});
|
||||
|
@ -106,12 +142,12 @@ reducers[ACTIONS.SEND_TRANSACTION_STARTED] = state => {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SEND_TRANSACTION_COMPLETED] = state =>
|
||||
reducers[ACTIONS.SEND_TRANSACTION_COMPLETED] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
draftTransaction: buildDraftTransaction(),
|
||||
});
|
||||
|
||||
reducers[ACTIONS.SEND_TRANSACTION_FAILED] = (state, action) => {
|
||||
reducers[ACTIONS.SEND_TRANSACTION_FAILED] = (state: WalletState, action) => {
|
||||
const newDraftTransaction = Object.assign({}, state.draftTransaction, {
|
||||
sending: false,
|
||||
error: action.data.error,
|
||||
|
@ -122,23 +158,23 @@ reducers[ACTIONS.SEND_TRANSACTION_FAILED] = (state, action) => {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_STARTED] = state =>
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_STARTED] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
sendingSupport: true,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_COMPLETED] = state =>
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_COMPLETED] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
sendingSupport: false,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_FAILED] = (state, action) =>
|
||||
reducers[ACTIONS.SUPPORT_TRANSACTION_FAILED] = (state: WalletState, action) =>
|
||||
Object.assign({}, state, {
|
||||
error: action.data.error,
|
||||
sendingSupport: false,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = (state, action) => {
|
||||
reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = (state: WalletState, action) => {
|
||||
const {
|
||||
block,
|
||||
block: { height },
|
||||
|
@ -150,89 +186,89 @@ reducers[ACTIONS.FETCH_BLOCK_SUCCESS] = (state, action) => {
|
|||
return Object.assign({}, state, { blocks });
|
||||
};
|
||||
|
||||
reducers[ACTIONS.WALLET_STATUS_COMPLETED] = (state, action) =>
|
||||
reducers[ACTIONS.WALLET_STATUS_COMPLETED] = (state: WalletState, action) =>
|
||||
Object.assign({}, state, {
|
||||
walletIsEncrypted: !!action.result.wallet_is_encrypted,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_START] = state =>
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_START] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
walletEncryptPending: true,
|
||||
walletEncryptSucceded: null,
|
||||
walletEncryptResult: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = (state, action) =>
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = (state: WalletState, action: ActionResult) =>
|
||||
Object.assign({}, state, {
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: true,
|
||||
walletEncryptResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = (state, action) =>
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = (state: WalletState, action: ActionResult) =>
|
||||
Object.assign({}, state, {
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: false,
|
||||
walletEncryptResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_START] = state =>
|
||||
reducers[ACTIONS.WALLET_DECRYPT_START] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
walletDecryptPending: true,
|
||||
walletDecryptSucceded: null,
|
||||
walletDecryptResult: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = (state, action) =>
|
||||
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = (state: WalletState, action: ActionResult) =>
|
||||
Object.assign({}, state, {
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: true,
|
||||
walletDecryptResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = (state, action) =>
|
||||
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = (state: WalletState, action: ActionResult) =>
|
||||
Object.assign({}, state, {
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: false,
|
||||
walletDecryptResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_START] = state =>
|
||||
reducers[ACTIONS.WALLET_UNLOCK_START] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
walletUnlockPending: true,
|
||||
walletUnlockSucceded: null,
|
||||
walletUnlockResult: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = (state, action) =>
|
||||
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = (state: WalletState, action: ActionResult) =>
|
||||
Object.assign({}, state, {
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: true,
|
||||
walletUnlockResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = (state, action) =>
|
||||
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = (state: WalletState, action: ActionResult) =>
|
||||
Object.assign({}, state, {
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: false,
|
||||
walletUnlockResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_LOCK_START] = state =>
|
||||
reducers[ACTIONS.WALLET_LOCK_START] = (state: WalletState) =>
|
||||
Object.assign({}, state, {
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: null,
|
||||
walletLockResult: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_LOCK_COMPLETED] = (state, action) =>
|
||||
reducers[ACTIONS.WALLET_LOCK_COMPLETED] = (state: WalletState, action: ActionResult) =>
|
||||
Object.assign({}, state, {
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: true,
|
||||
walletLockResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_LOCK_FAILED] = (state, action) =>
|
||||
reducers[ACTIONS.WALLET_LOCK_FAILED] = (state: WalletState, action: ActionResult) =>
|
||||
Object.assign({}, state, {
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: false,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* eslint-disable import/no-commonjs */
|
||||
const path = require('path');
|
||||
const FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin');
|
||||
//const FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin');
|
||||
const FlowWebpackPlugin = require('flow-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
mode: 'none',
|
||||
|
@ -22,5 +23,5 @@ module.exports = {
|
|||
resolve: {
|
||||
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
|
||||
},
|
||||
plugins: [new FlowBabelWebpackPlugin()],
|
||||
plugins: [new FlowWebpackPlugin()],
|
||||
};
|
||||
|
|
109
yarn.lock
109
yarn.lock
|
@ -99,6 +99,19 @@
|
|||
call-me-maybe "^1.0.1"
|
||||
glob-to-regexp "^0.3.0"
|
||||
|
||||
"@octokit/rest@^15.2.6":
|
||||
version "15.9.4"
|
||||
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-15.9.4.tgz#c6cf0f483275d9c798b18419b7c9d417493bb70f"
|
||||
dependencies:
|
||||
before-after-hook "^1.1.0"
|
||||
btoa-lite "^1.0.0"
|
||||
debug "^3.1.0"
|
||||
http-proxy-agent "^2.1.0"
|
||||
https-proxy-agent "^2.2.0"
|
||||
lodash "^4.17.4"
|
||||
node-fetch "^2.1.1"
|
||||
url-template "^2.0.8"
|
||||
|
||||
"@sindresorhus/is@^0.7.0":
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
|
||||
|
@ -248,6 +261,12 @@ acorn@^5.0.0, acorn@^5.3.0, acorn@^5.5.0:
|
|||
version "5.5.3"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.3.tgz#f473dd47e0277a08e28e9bec5aeeb04751f0b8c9"
|
||||
|
||||
agent-base@4, agent-base@^4.1.0:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
|
||||
dependencies:
|
||||
es6-promisify "^5.0.0"
|
||||
|
||||
ajv-keywords@^2.1.0:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762"
|
||||
|
@ -1153,6 +1172,10 @@ bcrypt-pbkdf@^1.0.0:
|
|||
dependencies:
|
||||
tweetnacl "^0.14.3"
|
||||
|
||||
before-after-hook@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-1.1.0.tgz#83165e15a59460d13702cb8febd6a1807896db5a"
|
||||
|
||||
big-integer@^1.6.17:
|
||||
version "1.6.28"
|
||||
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.28.tgz#8cef0fda3ccde8759c2c66efcfacc35aea658283"
|
||||
|
@ -1303,6 +1326,10 @@ browserslist@^2.1.2:
|
|||
caniuse-lite "^1.0.30000792"
|
||||
electron-to-chromium "^1.3.30"
|
||||
|
||||
btoa-lite@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337"
|
||||
|
||||
buffer-from@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.0.0.tgz#4cb8832d23612589b0406e9e2956c17f06fdf531"
|
||||
|
@ -1828,15 +1855,15 @@ dateformat@^3.0.3:
|
|||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
|
||||
|
||||
debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
debug@3.1.0, debug@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||
debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
|
@ -2070,6 +2097,16 @@ error@^7.0.2:
|
|||
string-template "~0.2.1"
|
||||
xtend "~4.0.0"
|
||||
|
||||
es6-promise@^4.0.3:
|
||||
version "4.2.4"
|
||||
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.4.tgz#dc4221c2b16518760bd8c39a52d8f356fc00ed29"
|
||||
|
||||
es6-promisify@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
|
||||
dependencies:
|
||||
es6-promise "^4.0.3"
|
||||
|
||||
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
|
@ -2504,18 +2541,6 @@ flat-cache@^1.2.1:
|
|||
graceful-fs "^4.1.2"
|
||||
write "^0.2.1"
|
||||
|
||||
flow-babel-webpack-plugin@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/flow-babel-webpack-plugin/-/flow-babel-webpack-plugin-1.1.1.tgz#7dd41110b96045eab8d8af6df48883310de54e91"
|
||||
dependencies:
|
||||
babel-plugin-transform-flow-comments "^6.17.0"
|
||||
flow-bin ">=0.44.2 <1"
|
||||
lodash.merge "^4.6.0"
|
||||
|
||||
"flow-bin@>=0.44.2 <1":
|
||||
version "0.72.0"
|
||||
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.72.0.tgz#12051180fb2db7ccb728fefe67c77e955e92a44d"
|
||||
|
||||
flow-bin@^0.69.0:
|
||||
version "0.69.0"
|
||||
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.69.0.tgz#053159a684a6051fcbf0b71a2eb19a9679082da6"
|
||||
|
@ -2524,14 +2549,14 @@ flow-parser@^0.*:
|
|||
version "0.72.0"
|
||||
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.72.0.tgz#6c8041e76ac7d0be1a71ce29c00cd1435fb6013c"
|
||||
|
||||
flow-typed@^2.4.0:
|
||||
version "2.4.0"
|
||||
resolved "https://registry.yarnpkg.com/flow-typed/-/flow-typed-2.4.0.tgz#3d2f48cf85df29df3bca6745b623726496ff4788"
|
||||
flow-typed@^2.5.1:
|
||||
version "2.5.1"
|
||||
resolved "https://registry.yarnpkg.com/flow-typed/-/flow-typed-2.5.1.tgz#0ff565cc94d2af8c557744ba364b6f14726a6b9f"
|
||||
dependencies:
|
||||
"@octokit/rest" "^15.2.6"
|
||||
babel-polyfill "^6.26.0"
|
||||
colors "^1.1.2"
|
||||
fs-extra "^5.0.0"
|
||||
github "0.2.4"
|
||||
glob "^7.1.2"
|
||||
got "^7.1.0"
|
||||
md5 "^2.1.0"
|
||||
|
@ -2544,6 +2569,10 @@ flow-typed@^2.4.0:
|
|||
which "^1.3.0"
|
||||
yargs "^4.2.0"
|
||||
|
||||
flow-webpack-plugin@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/flow-webpack-plugin/-/flow-webpack-plugin-1.2.0.tgz#1958821d16135028e391cad5ee2f3a4fa78197ec"
|
||||
|
||||
flush-write-stream@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd"
|
||||
|
@ -2689,12 +2718,6 @@ github-username@^4.0.0:
|
|||
dependencies:
|
||||
gh-got "^6.0.0"
|
||||
|
||||
github@0.2.4:
|
||||
version "0.2.4"
|
||||
resolved "https://registry.yarnpkg.com/github/-/github-0.2.4.tgz#24fa7f0e13fa11b946af91134c51982a91ce538b"
|
||||
dependencies:
|
||||
mime "^1.2.11"
|
||||
|
||||
glob-all@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/glob-all/-/glob-all-3.1.0.tgz#8913ddfb5ee1ac7812656241b03d5217c64b02ab"
|
||||
|
@ -2981,6 +3004,13 @@ http-cache-semantics@3.8.1:
|
|||
version "3.8.1"
|
||||
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2"
|
||||
|
||||
http-proxy-agent@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405"
|
||||
dependencies:
|
||||
agent-base "4"
|
||||
debug "3.1.0"
|
||||
|
||||
http-signature@~1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
|
||||
|
@ -2993,6 +3023,13 @@ https-browserify@^1.0.0:
|
|||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
|
||||
|
||||
https-proxy-agent@^2.2.0:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0"
|
||||
dependencies:
|
||||
agent-base "^4.1.0"
|
||||
debug "^3.1.0"
|
||||
|
||||
husky@^0.14.3:
|
||||
version "0.14.3"
|
||||
resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3"
|
||||
|
@ -3896,10 +3933,6 @@ lodash.get@^4.4.2:
|
|||
version "4.4.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
|
||||
|
||||
lodash.merge@^4.6.0:
|
||||
version "4.6.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.1.tgz#adc25d9cb99b9391c59624f379fbba60d7111d54"
|
||||
|
||||
lodash.sortby@^4.7.0:
|
||||
version "4.7.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
|
||||
|
@ -4085,10 +4118,6 @@ mime-types@^2.1.12, mime-types@~2.1.17:
|
|||
dependencies:
|
||||
mime-db "~1.33.0"
|
||||
|
||||
mime@^1.2.11:
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
|
||||
|
||||
mimic-fn@^1.0.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
|
||||
|
@ -4237,6 +4266,10 @@ node-dir@0.1.8:
|
|||
version "0.1.8"
|
||||
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.8.tgz#55fb8deb699070707fb67f91a460f0448294c77d"
|
||||
|
||||
node-fetch@^2.1.1:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.2.0.tgz#4ee79bde909262f9775f731e3656d0db55ced5b5"
|
||||
|
||||
"node-libs-browser@^1.0.0 || ^2.0.0", node-libs-browser@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.1.0.tgz#5f94263d404f6e44767d726901fff05478d600df"
|
||||
|
@ -5909,6 +5942,10 @@ url-parse-lax@^3.0.0:
|
|||
dependencies:
|
||||
prepend-http "^2.0.0"
|
||||
|
||||
url-template@^2.0.8:
|
||||
version "2.0.8"
|
||||
resolved "https://registry.yarnpkg.com/url-template/-/url-template-2.0.8.tgz#fc565a3cccbff7730c775f5641f9555791439f21"
|
||||
|
||||
url-to-options@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9"
|
||||
|
|
Loading…
Add table
Reference in a new issue