mirror of https://github.com/trezor/trezor-wallet
parent
1e316ea9d2
commit
60ead5a452
@ -0,0 +1,24 @@
|
|||||||
|
/* @flow */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import * as NOTIFICATION from './constants/notification';
|
||||||
|
|
||||||
|
|
||||||
|
// called from RouterService
|
||||||
|
export const clear = (currentParams, requestedParams): any => {
|
||||||
|
return async (dispatch, getState) => {
|
||||||
|
// if route has been changed from device view into something else (like other device, settings...)
|
||||||
|
// try to remove all Notifications which are linked to previous device (they are not cancelable by user)
|
||||||
|
if (currentParams.device !== requestedParams.device || currentParams.deviceInstance !== requestedParams.deviceInstance) {
|
||||||
|
const entries = getState().notifications.filter(entry => typeof entry.devicePath === 'string');
|
||||||
|
entries.forEach(entry => {
|
||||||
|
dispatch({
|
||||||
|
type: NOTIFICATION.CLOSE,
|
||||||
|
payload: {
|
||||||
|
devicePath: entry.devicePath
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
/* @flow */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
export const ON_BEFORE_UNLOAD: string = 'wallet__on_before_unload';
|
||||||
|
export const TOGGLE_DEVICE_DROPDOWN: string = 'wallet_toggle_dropdown';
|
||||||
|
export const SET_INITIAL_URL: string = 'wallet_set_initial_url';
|
@ -1,45 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
export const CLOSE_MODAL: string = 'action__close_modal';
|
|
||||||
|
|
||||||
export const ON_PIN_SUBMIT: string = 'action__on_pin_submit';
|
|
||||||
|
|
||||||
export const ON_PASSPHRASE_SUBMIT: string = 'action__on_passphrase_submit';
|
|
||||||
|
|
||||||
|
|
||||||
export const ON_ADDRESS_CHANGE: string = 'send__on_address_change';
|
|
||||||
export const ON_AMOUNT_CHANGE: string = 'send__on_amount_change';
|
|
||||||
export const ON_FEE_LEVEL_CHANGE: string = 'send__on_fee_level_change';
|
|
||||||
export const ON_GAS_PRICE_CHANGE: string = 'send__on_gas_price_change';
|
|
||||||
export const ON_GAS_LIMIT_CHANGE: string = 'send__on_gas_limit_change';
|
|
||||||
export const ON_TX_DATA_CHANGE: string = 'send__on_data_change';
|
|
||||||
export const ON_TX_SEND: string = 'send__on_send';
|
|
||||||
export const ON_GAS_PRICE_UPDATE: string = 'send__on_gas_price_update';
|
|
||||||
|
|
||||||
|
|
||||||
export const ADDRESS_CREATE: string = 'address__create';
|
|
||||||
export const ADDRESS_DELETE: string = 'address__delete';
|
|
||||||
export const ADDRESS_SET_BALANCE: string = 'address2__set_balance';
|
|
||||||
export const ADDRESS_SET_HISTORY: string = 'address__set_history';
|
|
||||||
export const ADDRESS_UPDATE_BALANCE: string = 'address__update_balance';
|
|
||||||
export const ADDRESS_ADD_TO_HISTORY: string = 'address__add_to_history';
|
|
||||||
|
|
||||||
export const TX_STATUS_OK: string = 'tx__status_ok';
|
|
||||||
export const TX_STATUS_ERROR: string = 'tx__status_error';
|
|
||||||
export const TX_STATUS_UNKNOWN: string = 'tx__status_unknown';
|
|
||||||
export const TX_CONFIRMED: string = 'tx__confirmed';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const TOKENS_TOGGLE_SUMMARY: string = 'tokens_toggle_summary';
|
|
||||||
|
|
||||||
export const TOKENS_SEARCH: string = 'tokens_search';
|
|
||||||
|
|
||||||
|
|
||||||
export const TOKENS_CUSTOM_TOGGLE: string = 'tokens_custom_toggle';
|
|
||||||
export const TOKENS_CUSTOM_ADDRESS_CHANGE: string = 'tokens_custom_address_change';
|
|
||||||
export const TOKENS_CUSTOM_NAME_CHANGE: string = 'tokens_custom_name_change';
|
|
||||||
export const TOKENS_CUSTOM_SHORTCUT_CHANGE: string = 'tokens_custom_shortcut_change';
|
|
||||||
export const TOKENS_CUSTOM_DECIMAL_CHANGE: string = 'tokens_custom_decimal_change';
|
|
||||||
export const TOKENS_CUSTOM_ADD: string = 'tokens_custom_add';
|
|
@ -1,24 +1,24 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React from 'react';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import LandingPage from '../components/landing/LandingPage';
|
import LandingPage from './LandingPage';
|
||||||
import * as LogActions from '../actions/LogActions';
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
const mapStateToProps = (state, own) => {
|
||||||
return {
|
return {
|
||||||
localStorage: state.localStorage,
|
localStorage: state.localStorage,
|
||||||
modal: state.modal,
|
modal: state.modal,
|
||||||
web3: state.web3,
|
web3: state.web3,
|
||||||
|
wallet: state.wallet,
|
||||||
connect: state.connect,
|
connect: state.connect,
|
||||||
router: state.router
|
router: state.router
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
};
|
};
|
@ -0,0 +1,27 @@
|
|||||||
|
/* @flow */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
|
export const DeviceSettings = (props: any): any => {
|
||||||
|
return (
|
||||||
|
<section className="settings">
|
||||||
|
Device settings
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapStateToProps = (state, own) => {
|
||||||
|
return {
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => {
|
||||||
|
return {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(DeviceSettings);
|
@ -1,12 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export default (props: any): any => {
|
|
||||||
return (
|
|
||||||
<section className="settings">
|
|
||||||
Settings
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
}
|
|
@ -0,0 +1,27 @@
|
|||||||
|
/* @flow */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
|
export const WalletSettings = (props: any): any => {
|
||||||
|
return (
|
||||||
|
<section className="settings">
|
||||||
|
Wallet settings
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapStateToProps = (state, own) => {
|
||||||
|
return {
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => {
|
||||||
|
return {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(WalletSettings);
|
@ -0,0 +1,58 @@
|
|||||||
|
/* @flow */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { Route, withRouter } from 'react-router-dom';
|
||||||
|
|
||||||
|
import Header from '../common/Header';
|
||||||
|
import Footer from '../common/Footer';
|
||||||
|
import AccountTabs from './account/AccountTabs';
|
||||||
|
import AsideContainer from './aside';
|
||||||
|
import ModalContainer from '../modal';
|
||||||
|
import Notifications from '../common/Notification';
|
||||||
|
import Log from '../common/Log';
|
||||||
|
|
||||||
|
const Content = (props) => {
|
||||||
|
return (
|
||||||
|
<article>
|
||||||
|
<nav>
|
||||||
|
<Route path="/device/:device/network/:network/address/:address" component={ AccountTabs } />
|
||||||
|
</nav>
|
||||||
|
<Notifications />
|
||||||
|
<Log />
|
||||||
|
{ props.children }
|
||||||
|
<Footer />
|
||||||
|
</article>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Wallet = (props: any): any => {
|
||||||
|
return (
|
||||||
|
<div className="app">
|
||||||
|
<Header />
|
||||||
|
<main>
|
||||||
|
<AsideContainer />
|
||||||
|
<Content>
|
||||||
|
{ props.children }
|
||||||
|
</Content>
|
||||||
|
</main>
|
||||||
|
<ModalContainer />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapStateToProps = (state, own) => {
|
||||||
|
return {
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => {
|
||||||
|
return { };
|
||||||
|
}
|
||||||
|
|
||||||
|
export default withRouter(
|
||||||
|
connect(mapStateToProps, mapDispatchToProps)(Wallet)
|
||||||
|
);
|
@ -1,23 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
|
||||||
import { bindActionCreators } from 'redux';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
|
|
||||||
import Acquire from '../components/wallet/Acquire';
|
|
||||||
import * as TrezorConnectActions from '../actions/TrezorConnectActions';
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
|
||||||
return {
|
|
||||||
connect: state.connect
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return {
|
|
||||||
acquireDevice: bindActionCreators(TrezorConnectActions.acquire, dispatch),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Acquire);
|
|
@ -1,21 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
|
||||||
import { bindActionCreators } from 'redux';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
|
|
||||||
import Bootloader from '../components/wallet/Bootloader';
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
|
||||||
return {
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Bootloader);
|
|
@ -1,46 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import { Route } from 'react-router-dom';
|
|
||||||
|
|
||||||
import { bindActionCreators } from 'redux';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { withRouter } from 'react-router-dom';
|
|
||||||
import Log from '../components/common/Log';
|
|
||||||
import Notifications from '../components/common/Notification';
|
|
||||||
import Footer from '../components/common/Footer';
|
|
||||||
import AccountTabs from '../components/wallet/account/AccountTabs';
|
|
||||||
|
|
||||||
import * as TrezorConnectActions from '../actions/TrezorConnectActions';
|
|
||||||
import * as LogActions from '../actions/LogActions';
|
|
||||||
|
|
||||||
const Article = (props) => {
|
|
||||||
return (
|
|
||||||
<article>
|
|
||||||
<nav>
|
|
||||||
<Route path="/device/:device/network/:network/address/:address" component={ AccountTabs } />
|
|
||||||
</nav>
|
|
||||||
<Notifications />
|
|
||||||
<Log />
|
|
||||||
{ props.children }
|
|
||||||
<Footer />
|
|
||||||
</article>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
|
||||||
return {
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return {
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default withRouter(
|
|
||||||
connect(mapStateToProps, mapDispatchToProps)(Article)
|
|
||||||
);
|
|
@ -1,21 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
|
||||||
import { bindActionCreators } from 'redux';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
|
|
||||||
import Dashboard from '../components/wallet/Dashboard';
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
|
||||||
return {
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Dashboard);
|
|
@ -1,23 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
|
||||||
import { bindActionCreators } from 'redux';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
|
|
||||||
import History from '../components/wallet/History';
|
|
||||||
import * as SendFormActions from '../actions/SendFormActions';
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
|
||||||
return {
|
|
||||||
web3: state.web3.web3,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return {
|
|
||||||
//sendFormActions: bindActionCreators(SendFormActions, dispatch),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(History);
|
|
@ -1,31 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
|
||||||
import { bindActionCreators } from 'redux';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
|
|
||||||
import Receive from '../components/wallet/Receive';
|
|
||||||
import * as ReceiveActions from '../actions/ReceiveActions';
|
|
||||||
import { getAddress } from '../actions/TrezorConnectActions';
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
|
||||||
return {
|
|
||||||
location: state.router.location,
|
|
||||||
devices: state.connect.devices,
|
|
||||||
accounts: state.accounts,
|
|
||||||
discovery: state.discovery,
|
|
||||||
receive: state.receive
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return {
|
|
||||||
initAccount: bindActionCreators(ReceiveActions.init, dispatch),
|
|
||||||
updateAccount: bindActionCreators(ReceiveActions.update, dispatch),
|
|
||||||
disposeAccount: bindActionCreators(ReceiveActions.dispose, dispatch),
|
|
||||||
showAddress: bindActionCreators(ReceiveActions.showAddress, dispatch),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Receive);
|
|
@ -1,20 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
|
||||||
import { bindActionCreators } from 'redux';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
|
|
||||||
import Settings from '../components/wallet/Settings';
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
|
||||||
return {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Settings);
|
|
@ -1,20 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
|
||||||
import { bindActionCreators } from 'redux';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
|
|
||||||
import SignVerify from '../components/wallet/SignVerify';
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
|
||||||
return {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(SignVerify);
|
|
@ -1,31 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
|
||||||
import { bindActionCreators } from 'redux';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { withRouter } from 'react-router-dom';
|
|
||||||
|
|
||||||
import TopNavigation from '../components/TopNavigation';
|
|
||||||
import * as TrezorConnectActions from '../actions/TrezorConnectActions';
|
|
||||||
import { resizeAppContainer, toggleDeviceDropdown } from '../actions/AppActions';
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
|
||||||
return {
|
|
||||||
connect: state.connect
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return {
|
|
||||||
toggleDeviceDropdown: bindActionCreators(toggleDeviceDropdown, dispatch),
|
|
||||||
resizeAppContainer: bindActionCreators(resizeAppContainer, dispatch),
|
|
||||||
acquireDevice: bindActionCreators(TrezorConnectActions.acquire, dispatch),
|
|
||||||
onSelectDevice: bindActionCreators(TrezorConnectActions.onSelectDevice, dispatch),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// export default connect(mapStateToProps, mapDispatchToProps)(TopNavigation);
|
|
||||||
export default withRouter(
|
|
||||||
connect(mapStateToProps, mapDispatchToProps)(TopNavigation)
|
|
||||||
);
|
|
@ -1,40 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { withRouter } from 'react-router-dom';
|
|
||||||
|
|
||||||
import Header from '../components/common/Header';
|
|
||||||
import AsideContainer from './AsideContainer';
|
|
||||||
import ContentContainer from './ContentContainer';
|
|
||||||
import ModalContainer from '../components/modal/ModalContainer';
|
|
||||||
|
|
||||||
const Wallet = (props: any): any => {
|
|
||||||
return (
|
|
||||||
<div className="app">
|
|
||||||
<Header />
|
|
||||||
<main>
|
|
||||||
<AsideContainer />
|
|
||||||
<ContentContainer>
|
|
||||||
{ props.children }
|
|
||||||
</ContentContainer>
|
|
||||||
</main>
|
|
||||||
<ModalContainer />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapStateToProps(state, own) {
|
|
||||||
return {
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return { };
|
|
||||||
}
|
|
||||||
|
|
||||||
export default withRouter(
|
|
||||||
connect(mapStateToProps, mapDispatchToProps)(Wallet)
|
|
||||||
);
|
|
@ -1,19 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// wrapper layouts
|
|
||||||
export { default as LandingPageContainer } from './LandingPageContainer';
|
|
||||||
export { default as WalletContainer } from './WalletContainer';
|
|
||||||
|
|
||||||
// wallet sections
|
|
||||||
export { default as AcquireContainer } from './AcquireContainer';
|
|
||||||
export { default as BootloaderContainer } from './BootloaderContainer';
|
|
||||||
|
|
||||||
export { default as DashboardContainer } from './DashboardContainer';
|
|
||||||
export { default as HistoryContainer } from './HistoryContainer';
|
|
||||||
export { default as SendFormContainer } from './SendFormContainer';
|
|
||||||
export { default as ReceiveContainer } from './ReceiveContainer';
|
|
||||||
export { default as SignVerifyContainer } from './SignVerifyContainer';
|
|
||||||
|
|
||||||
|
|
||||||
export { default as SettingsContainer } from './SettingsContainer';
|
|
@ -1,49 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { ON_RESIZE, TOGGLE_DEVICE_DROPDOWN, RESIZE_CONTAINER } from '../actions/AppActions';
|
|
||||||
import * as WEB3 from '../actions/constants/Web3';
|
|
||||||
|
|
||||||
const WIDTH: number = 1080;
|
|
||||||
const HEIGHT: number = 1920;
|
|
||||||
|
|
||||||
const initialState: Object = {
|
|
||||||
orginalWidth: WIDTH,
|
|
||||||
orginalHeight: HEIGHT,
|
|
||||||
width: window.innerWidth,
|
|
||||||
height: window.innerHeight,
|
|
||||||
scale: Math.min(window.innerWidth / WIDTH, window.innerHeight / HEIGHT),
|
|
||||||
coinDropdownOpened: false,
|
|
||||||
deviceDropdownOpened: false,
|
|
||||||
initialized: false,
|
|
||||||
landingPage: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function DOM(state: Object = initialState, action: Object): any {
|
|
||||||
switch(action.type) {
|
|
||||||
case ON_RESIZE :
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
scale: Math.min(window.innerWidth / WIDTH, window.innerHeight / HEIGHT),
|
|
||||||
}
|
|
||||||
case RESIZE_CONTAINER :
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
coinDropdownOpened: action.opened
|
|
||||||
}
|
|
||||||
case TOGGLE_DEVICE_DROPDOWN :
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
deviceDropdownOpened: action.opened
|
|
||||||
}
|
|
||||||
|
|
||||||
case WEB3.READY :
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
initialized: true
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,174 +0,0 @@
|
|||||||
/* @flo */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
//http://ropsten.etherscan.io/api?module=account&action=txlist&address=0x98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad&startblock=0&endblock=99999999&sort=asc&apikey=89IZG471H8ITVXY377I2QWJIT2D62DGG9Z
|
|
||||||
|
|
||||||
import { LOCATION_CHANGE, push } from 'react-router-redux';
|
|
||||||
import { httpRequest } from '../utils/networkUtils';
|
|
||||||
import * as ACTIONS from '../actions/index';
|
|
||||||
import { getBalance } from '../actions/Web3Actions';
|
|
||||||
|
|
||||||
const API_KEY: string = '89IZG471H8ITVXY377I2QWJIT2D62DGG9Z';
|
|
||||||
//const API: string = `http://ropsten.etherscan.io/api?module=account&action=txlist&startblock=0&endblock=99999999&sort=asc&apikey=89IZG471H8ITVXY377I2QWJIT2D62DGG9Z`;
|
|
||||||
const API: string = `http://ropsten.etherscan.io/api?module=account&action=txlist&startblock=0&endblock=99999999&sort=desc&apikey=${API_KEY}`;
|
|
||||||
|
|
||||||
export const getTransactionHistory = async (address: string): Promise<Array<any>> => {
|
|
||||||
const json = await httpRequest(`${API}&address=${address}`);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
const getTransactionStatus = async (txid: string): Promise<Array<any>> => {
|
|
||||||
//https://ropsten.etherscan.io/api?module=proxy&action=eth_getTransactionByHash&txhash=0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1&apikey=YourApiKeyToken
|
|
||||||
const url: string = `https://ropsten.etherscan.io/api?module=proxy&action=eth_getTransactionByHash&apikey=${API_KEY}`
|
|
||||||
//const url: string = `https://ropsten.etherscan.io/api?module=transaction&action=getstatus&apikey=${API_KEY}`
|
|
||||||
const json = await httpRequest(`${url}&txhash=${txid}`);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
const getTokenHistory = async (tokenAddress, address) => {
|
|
||||||
|
|
||||||
// 0x58cda554935e4a1f2acbe15f8757400af275e084
|
|
||||||
// 0x000000000000000000000000 + 98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad
|
|
||||||
let url: string = 'https://ropsten.etherscan.io/api?module=logs&action=getLogs';
|
|
||||||
url += '&fromBlock=0&toBlock=latest';
|
|
||||||
url += `&address=${tokenAddress}`;
|
|
||||||
url += '&topic0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef';
|
|
||||||
url += `&topic2=${ address }`;
|
|
||||||
// https://api.etherscan.io/api?module=logs&action=getLogs
|
|
||||||
// &fromBlock=0
|
|
||||||
// &toBlock=latest
|
|
||||||
// &address=[Token Contract Address]
|
|
||||||
// &topic0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
|
|
||||||
// &topic1=[From Address, padded to 32 bytes - optional]
|
|
||||||
// &topic2=[To Address, padded to 32 bytes - optional]
|
|
||||||
|
|
||||||
console.log("TOKENURL", url);
|
|
||||||
const json = await httpRequest(url);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const loadTokenHistory = (address): Promise<any> => {
|
|
||||||
// https://ropsten.etherscan.io/apis#logs
|
|
||||||
return async (dispatch, getState): Promise<any> => {
|
|
||||||
const tkn = '0x58cda554935e4a1f2acbe15f8757400af275e084';
|
|
||||||
const ad = '0x00000000000000000000000098ead4bd2fbbb0cf0b49459aa0510ef53faa6cad';
|
|
||||||
const incoming = await getTokenHistory(tkn, ad);
|
|
||||||
|
|
||||||
console.log("TOKEN HIST!", JSON.parse(incoming) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const loadTransactionStatus = (txid): Promise<any> => {
|
|
||||||
return async (dispatch, getState): Promise<any> => {
|
|
||||||
const json = await getTransactionStatus(txid);
|
|
||||||
const status = JSON.parse(json);
|
|
||||||
|
|
||||||
console.error("TXSTAT", status)
|
|
||||||
|
|
||||||
if (status.result.blockHash) {
|
|
||||||
// find address with pending tx
|
|
||||||
const { addresses } = getState().addresses;
|
|
||||||
for (let addr of addresses) {
|
|
||||||
if (addr.findPendingTx(txid)) {
|
|
||||||
dispatch( getBalance(addr) );
|
|
||||||
|
|
||||||
const txType = status.result.from === addr.address ? 'out' : 'in';
|
|
||||||
const txAddress = txType === 'out' ? status.result.to : status.result.from;
|
|
||||||
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.ADDRESS_ADD_TO_HISTORY,
|
|
||||||
address: addr,
|
|
||||||
entry: {
|
|
||||||
txid: status.result.hash,
|
|
||||||
type: txType,
|
|
||||||
timestamp: '0',
|
|
||||||
address: txAddress,
|
|
||||||
value: status.result.value
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//dispatch( loadHistory(addr, 3000) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.TX_STATUS_OK,
|
|
||||||
txid
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (status.status === "1" && status.message === "OK") {
|
|
||||||
// if (status.result.isError === "0") {
|
|
||||||
// dispatch({
|
|
||||||
// type: ACTIONS.TX_STATUS_OK,
|
|
||||||
// txid
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// dispatch({
|
|
||||||
// type: ACTIONS.TX_STATUS_ERROR,
|
|
||||||
// txid,
|
|
||||||
// error: status.errDescription
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// dispatch({
|
|
||||||
// type: ACTIONS.TX_STATUS_UNKNOWN,
|
|
||||||
// txid,
|
|
||||||
// status
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const loadHistory = (address, delay): void => {
|
|
||||||
return async (dispatch, getState) => {
|
|
||||||
|
|
||||||
// const json = await getTransactionStatus('0x2113e578497f3486944566e2417b5ac3b31d7e76f71557ae0626e2a6fe191e58');
|
|
||||||
// console.log("JSON!", json)
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (delay) {
|
|
||||||
console.warn("-----PRELOAD with delay", address)
|
|
||||||
await new Promise(resolve => {
|
|
||||||
setTimeout(resolve, delay);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const history = await getTransactionHistory(address.address);
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.ADDRESS_SET_HISTORY,
|
|
||||||
address,
|
|
||||||
history
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const EtherscanService = store => next => action => {
|
|
||||||
|
|
||||||
next(action);
|
|
||||||
|
|
||||||
if (action.type === LOCATION_CHANGE) {
|
|
||||||
|
|
||||||
const { location } = store.getState().router;
|
|
||||||
const { addresses } = store.getState().addresses;
|
|
||||||
|
|
||||||
if (location) {
|
|
||||||
const parts = location.pathname.split("/");
|
|
||||||
if (parts.length === 3 && parts[1] === "address") {
|
|
||||||
const addressId = parseInt(parts[2]);
|
|
||||||
|
|
||||||
if (!isNaN(addressId) && addresses[addressId]) {
|
|
||||||
//store.dispatch( loadHistory( addresses[addressId] ) );
|
|
||||||
//store.dispatch( loadTokenHistory( addresses[addressId] ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
//console.error("ETH", parts, "id", parts.length, parts.length === 3 && parts[1] === "address");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default EtherscanService;
|
|
@ -1,238 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import Web3 from 'web3';
|
|
||||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
||||||
import * as ACTIONS from '../actions/index';
|
|
||||||
import { getBalance, getGasPrice, getTransactionReceipt } from '../actions/Web3Actions';
|
|
||||||
import { loadTransactionStatus } from './EtherscanService';
|
|
||||||
import BigNumber from 'bignumber.js';
|
|
||||||
|
|
||||||
let web3: Web3;
|
|
||||||
|
|
||||||
// export const getGasPrice = (): Promise<BigNumber> => {
|
|
||||||
// return (dispatch, getState) => {
|
|
||||||
// web3.eth.getGasPrice((error, gasPrice) => {
|
|
||||||
// if (!error) {
|
|
||||||
// dispatch({
|
|
||||||
// type: 'update_gas',
|
|
||||||
// gasPrice: web3.fromWei(gasPrice.toString(), 'gwei')
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Web3Service = store => next => action => {
|
|
||||||
|
|
||||||
next(action);
|
|
||||||
|
|
||||||
switch (action.type) {
|
|
||||||
|
|
||||||
case 'WEB_2_START' :
|
|
||||||
if (web3) break;
|
|
||||||
|
|
||||||
//web3 = new Web3(window.web3.currentProvider);
|
|
||||||
//web3 = new Web3(new Web3.providers.HttpProvider("https://api.myetherapi.com/rop"));
|
|
||||||
web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io2/QGyVKozSUEh2YhL4s2G4"));
|
|
||||||
//web3 = new Web3( new Web3.providers.HttpProvider("ws://34.230.234.51:30303") );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*store.dispatch( getGasPrice() );
|
|
||||||
|
|
||||||
|
|
||||||
const latestBlockFilter = web3.eth.filter('latest');
|
|
||||||
latestBlockFilter.watch((error, blockHash) => {
|
|
||||||
|
|
||||||
const { addresses, pendingTxs } = store.getState().addresses;
|
|
||||||
|
|
||||||
for (const addr of addresses) {
|
|
||||||
store.dispatch( getBalance(addr) );
|
|
||||||
}
|
|
||||||
|
|
||||||
store.dispatch( getGasPrice() );
|
|
||||||
|
|
||||||
if (pendingTxs.length > 0) {
|
|
||||||
for (const tx of pendingTxs) {
|
|
||||||
store.dispatch( getTransactionReceipt(tx) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// store.dispatch({
|
|
||||||
// type: 'web3__init',
|
|
||||||
// web3
|
|
||||||
// });
|
|
||||||
|
|
||||||
// store.dispatch({
|
|
||||||
// type: 'update_gas',
|
|
||||||
// gasPrice: web3.fromWei(web3.eth.gasPrice, 'gwei')
|
|
||||||
// })
|
|
||||||
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
"dd62ed3e": "allowance(address,address)",
|
|
||||||
"095ea7b3": "approve(address,uint256)",
|
|
||||||
"cae9ca51": "approveAndCall(address,uint256,bytes)",
|
|
||||||
"70a08231": "balanceOf(address)",
|
|
||||||
"313ce567": "decimals()",
|
|
||||||
"06fdde03": "name()",
|
|
||||||
"95d89b41": "symbol()",
|
|
||||||
"18160ddd": "totalSupply()",
|
|
||||||
"a9059cbb": "transfer(address,uint256)",
|
|
||||||
"23b872dd": "transferFrom(address,address,uint256)",
|
|
||||||
"54fd4d50": "version()"
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// var balanceHex = "06fdde03"; // I believe this is the hex for balance
|
|
||||||
// var contractAddress = "0x58cda554935e4a1f2acbe15f8757400af275e084";
|
|
||||||
// var userAddress = "0x5DBB9793537515398A1176d365b636A5321D9e39";
|
|
||||||
// var balanceCall = getDataObj(contractAddress, balanceHex);
|
|
||||||
// var balance = web3.eth.call(balanceCall);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const abiArray = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}];
|
|
||||||
//const contr = web3.eth.contract(abiArray, '0x58cda554935e4a1f2acbe15f8757400af275e084');
|
|
||||||
const contr = web3.eth.contract(abiArray).at('0x58cda554935e4a1f2acbe15f8757400af275e084');
|
|
||||||
console.log("contr", contr );
|
|
||||||
|
|
||||||
contr.name.call((e,r) => {
|
|
||||||
console.log("nameeeee", e, r)
|
|
||||||
})
|
|
||||||
|
|
||||||
contr.symbol.call((e,r) => {
|
|
||||||
console.log("symboll", e, r)
|
|
||||||
})
|
|
||||||
|
|
||||||
//console.log( const.name )
|
|
||||||
|
|
||||||
// contr.balanceOf('0x98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad', (e, r) => {
|
|
||||||
// console.warn('contrR', e, r.toString(10));
|
|
||||||
// });
|
|
||||||
|
|
||||||
let cntrData = contr.transfer.getData("0x98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad", 1, {
|
|
||||||
from: "0x98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad",
|
|
||||||
gasLimit: 36158,
|
|
||||||
gasPrice: "0x0ee6b28000"
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log("contr", cntrData);
|
|
||||||
// const data = contr.transferFrom(
|
|
||||||
// '0x98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad',
|
|
||||||
// '0x98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad',
|
|
||||||
// 1
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const data = contr.transferFrom(
|
|
||||||
// '0x98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad',
|
|
||||||
// {
|
|
||||||
// from: '0x7314e0f1c0e28474bdb6be3e2c3e0453255188f8',
|
|
||||||
// value: 1
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const data = contr.transferFrom(
|
|
||||||
// '0x00000000000000000000000098ead4bd2fbbb0cf0b49459aa0510ef53faa6cad',
|
|
||||||
// '0x000000000000000000000000a738ea40b69d87f4f9ac94c9a0763f96248df23b',
|
|
||||||
// 2
|
|
||||||
// );
|
|
||||||
//console.log("contr", contr, data)
|
|
||||||
|
|
||||||
// var addr1 = '0x98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad';
|
|
||||||
// var contractAddr = '0x58cda554935e4a1f2acbe15f8757400af275e084';
|
|
||||||
// var tknAddress = (addr1).substring(2);
|
|
||||||
// var contractData = ('0x70a08231000000000000000000000000' + tknAddress);
|
|
||||||
|
|
||||||
// console.warn("ADDDDDDDD", web3.toHex('0x98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad'));
|
|
||||||
// console.warn("ADDDDDDDD", web3.toHex('98ead4bd2fbbb0cf0b49459aa0510ef53faa6cad'));
|
|
||||||
|
|
||||||
// web3.eth.call({
|
|
||||||
// to: contractAddr,
|
|
||||||
// data: contractData
|
|
||||||
// }, function(err, result) {
|
|
||||||
// if (result) {
|
|
||||||
// console.log("---------result", result, web3);
|
|
||||||
// //var tokens = web3.toBN(result).toString();
|
|
||||||
// //console.log('Tokens Owned: ' + web3.utils.fromWei(tokens, 'ether'));
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// console.log(err); // Dump errors here
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
const pendingBlockFilter = web3.eth.filter('pending');
|
|
||||||
pendingBlockFilter.watch((error, txid) => {
|
|
||||||
//console.warn("Watch pending block", txid, error)
|
|
||||||
if (!error) {
|
|
||||||
|
|
||||||
if (pendingTx.length > 0) {
|
|
||||||
console.error("Watch pending block", pendingTx.indexOf(txid))
|
|
||||||
}
|
|
||||||
|
|
||||||
web3.eth.getTransactionReceipt(txid, async (error, tx) => {
|
|
||||||
if (!error && typeof tx === 'object') {
|
|
||||||
const { addresses } = store.getState().addresses;
|
|
||||||
const receiver = addresses.find(a => a.address === tx.to);
|
|
||||||
if (receiver) {
|
|
||||||
console.error("PendingTX RECV", txid, tx, receiver)
|
|
||||||
const balance = await getBalance(receiver.address);
|
|
||||||
store.dispatch({
|
|
||||||
type: ACTIONS.ADDRESS_SET_BALANCE,
|
|
||||||
txid,
|
|
||||||
address: receiver,
|
|
||||||
balance: web3.fromWei(balance.toString(), 'ether')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const sender = addresses.find(a => a.address === tx.from);
|
|
||||||
if (sender) {
|
|
||||||
const balance = await getBalance(sender.address);
|
|
||||||
store.dispatch({
|
|
||||||
type: ACTIONS.ADDRESS_SET_BALANCE,
|
|
||||||
txid,
|
|
||||||
address: sender,
|
|
||||||
balance: web3.fromWei(balance.toString(), 'ether')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//console.log("PendingTX", txid, tx, receiver, sender)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
//"web3": "^0.19.0"
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Web3Service;
|
|
||||||
|
|
||||||
|
|
||||||
export const estimateGas = (gasOptions): Promise<any> => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
web3.eth.estimateGas(gasOptions, (error, result) => {
|
|
||||||
if (error) {
|
|
||||||
reject(error);
|
|
||||||
} else {
|
|
||||||
resolve(result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
|
Loading…
Reference in new issue