Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addressesLoadedUpdate = (data) => {
// Update the version of the wallet that the data was loaded
hathorLib.storage.setItem('wallet:version', VERSION);
// Check api version everytime we load address history
version.checkApiVersion();
// Update redux with loaded data
store.dispatch(dataLoaded({ addressesFound: data.addressesFound, transactionsFound: Object.keys(data.historyTransactions).length }));
}
afterLoadAddressHistory() {
store.dispatch(loadingAddresses(false));
const data = hathorLib.wallet.getWalletData();
// Update historyTransactions with new one
const historyTransactions = 'historyTransactions' in data ? data['historyTransactions'] : {};
const allTokens = 'allTokens' in data ? data['allTokens'] : [];
const transactionsFound = Object.keys(historyTransactions).length;
const address = hathorLib.storage.getItem('wallet:address');
const lastSharedIndex = hathorLib.storage.getItem('wallet:lastSharedIndex');
const lastGeneratedIndex = hathorLib.wallet.getLastGeneratedIndex();
store.dispatch(historyUpdate({historyTransactions, allTokens, lastSharedIndex, lastSharedAddress: address, addressesFound: lastGeneratedIndex + 1, transactionsFound}));
},
import version from './utils/version';
import wallet from './utils/wallet';
import { connect } from "react-redux";
import RequestErrorModal from './components/RequestError';
import DashboardTx from './screens/DashboardTx';
import DecodeTx from './screens/DecodeTx';
import PushTx from './screens/PushTx';
import { dataLoaded, isOnlineUpdate } from "./actions/index";
import store from './store/index';
import createRequestInstance from './api/axiosInstance';
import hathorLib from '@hathor/wallet-lib';
import { DEFAULT_SERVER, VERSION } from './constants';
import LocalStorageStore from './storage.js';
hathorLib.network.setNetwork('mainnet');
hathorLib.storage.setStore(new LocalStorageStore());
// set default server to bravo testnet
hathorLib.wallet.setDefaultServer(DEFAULT_SERVER);
const mapDispatchToProps = dispatch => {
return {
dataLoaded: (data) => dispatch(dataLoaded(data)),
isOnlineUpdate: (data) => dispatch(isOnlineUpdate(data)),
};
};
const mapStateToProps = (state) => {
return {
isVersionAllowed: state.isVersionAllowed,
loadingAddresses: state.loadingAddresses,
};
(key) => scope.setExtra(key, hathorLib.storage.getItem(key))
)
saveTokenRedux(uid) {
const storageTokens = hathorLib.storage.getItem('wallet:tokens');
store.dispatch(newTokens({tokens: storageTokens, uid: uid}));
},