diff options
author | Fabio Berger <me@fabioberger.com> | 2018-01-31 03:45:09 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-01-31 03:45:09 +0800 |
commit | 16ea0348a9776c99bf50013fca65deb2ba2d698e (patch) | |
tree | cfe98e292ad2cfc80e70a981ea10a8536283df10 /packages/website | |
parent | 57acb8db5c48df994f106f8e4b369f7e780f7c9c (diff) | |
download | dexon-sol-tools-16ea0348a9776c99bf50013fca65deb2ba2d698e.tar dexon-sol-tools-16ea0348a9776c99bf50013fca65deb2ba2d698e.tar.gz dexon-sol-tools-16ea0348a9776c99bf50013fca65deb2ba2d698e.tar.bz2 dexon-sol-tools-16ea0348a9776c99bf50013fca65deb2ba2d698e.tar.lz dexon-sol-tools-16ea0348a9776c99bf50013fca65deb2ba2d698e.tar.xz dexon-sol-tools-16ea0348a9776c99bf50013fca65deb2ba2d698e.tar.zst dexon-sol-tools-16ea0348a9776c99bf50013fca65deb2ba2d698e.zip |
Fix linter errors
Diffstat (limited to 'packages/website')
21 files changed, 20 insertions, 72 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index d7c23205d..38d405033 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -41,7 +41,6 @@ import { SignatureData, Token, TokenByAddress, - TokenStateByAddress, } from 'ts/types'; import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; @@ -220,7 +219,7 @@ export class Blockchain { this._web3Wrapper = new Web3Wrapper(this._dispatcher, provider, this.networkId, shouldPollUserAddress); this._zeroEx.setProvider(provider, this.networkId); await this._postInstantiationOrUpdatingProviderZeroExAsync(); - this._web3Wrapper.startEmittingNetworkConnectionAndUserBalanceStateAsync(); + this._web3Wrapper.startEmittingNetworkConnectionAndUserBalanceState(); this._dispatcher.updateProviderType(ProviderType.Ledger); } public async updateProviderToInjectedAsync() { @@ -244,7 +243,7 @@ export class Blockchain { await this._postInstantiationOrUpdatingProviderZeroExAsync(); await this.fetchTokenInformationAsync(); - this._web3Wrapper.startEmittingNetworkConnectionAndUserBalanceStateAsync(); + this._web3Wrapper.startEmittingNetworkConnectionAndUserBalanceState(); this._dispatcher.updateProviderType(ProviderType.Injected); delete this._ledgerSubprovider; delete this._cachedProvider; @@ -264,7 +263,6 @@ export class Blockchain { }, ); await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash); - const allowance = amountInBaseUnits; } public async transferAsync(token: Token, toAddress: string, amountInBaseUnits: BigNumber): Promise<void> { this._showFlashMessageIfLedger(); @@ -451,7 +449,6 @@ export class Blockchain { from: this._userAddress, gasPrice: this._defaultGasPrice, }); - const balanceDelta = constants.MINT_AMOUNT; } public async getBalanceInEthAsync(owner: string): Promise<BigNumber> { const balance = await this._web3Wrapper.getBalanceInEthAsync(owner); @@ -762,7 +759,7 @@ export class Blockchain { this._userAddress = await this._web3Wrapper.getFirstAccountIfExistsAsync(); this._dispatcher.updateUserAddress(this._userAddress); await this.fetchTokenInformationAsync(); - this._web3Wrapper.startEmittingNetworkConnectionAndUserBalanceStateAsync(); + this._web3Wrapper.startEmittingNetworkConnectionAndUserBalanceState(); await this._rehydrateStoreWithContractEvents(); } // This method should always be run after instantiating or updating the provider diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx index 5b7e20671..bc5f05241 100644 --- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx +++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx @@ -10,7 +10,7 @@ import { Blockchain } from 'ts/blockchain'; import { NetworkDropDown } from 'ts/components/dropdowns/network_drop_down'; import { LifeCycleRaisedButton } from 'ts/components/ui/lifecycle_raised_button'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { Networks, ProviderType } from 'ts/types'; +import { ProviderType } from 'ts/types'; import { colors } from 'ts/utils/colors'; import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; diff --git a/packages/website/ts/components/eth_weth_conversion_button.tsx b/packages/website/ts/components/eth_weth_conversion_button.tsx index 52240fd0f..62bafdba7 100644 --- a/packages/website/ts/components/eth_weth_conversion_button.tsx +++ b/packages/website/ts/components/eth_weth_conversion_button.tsx @@ -6,7 +6,7 @@ import * as React from 'react'; import { Blockchain } from 'ts/blockchain'; import { EthWethConversionDialog } from 'ts/components/dialogs/eth_weth_conversion_dialog'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { BlockchainCallErrs, Side, Token, TokenState } from 'ts/types'; +import { BlockchainCallErrs, Side, Token } from 'ts/types'; import { constants } from 'ts/utils/constants'; import { errorReporter } from 'ts/utils/error_reporter'; import { utils } from 'ts/utils/utils'; @@ -16,7 +16,6 @@ interface EthWethConversionButtonProps { networkId: number; direction: Side; ethToken: Token; - ethTokenState: TokenState; dispatcher: Dispatcher; blockchain: Blockchain; userEtherBalance: BigNumber; @@ -93,7 +92,6 @@ export class EthWethConversionButton extends React.Component< }); this._toggleConversionDialog(); const token = this.props.ethToken; - const tokenState = this.props.ethTokenState; try { if (direction === Side.Deposit) { await this.props.blockchain.convertEthToWrappedEthTokensAsync(token.address, value); @@ -105,7 +103,7 @@ export class EthWethConversionButton extends React.Component< this.props.dispatcher.showFlashMessage(`Successfully unwrapped ${tokenAmount.toString()} WETH to ETH`); } if (!this.props.isOutdatedWrappedEther) { - this.props.refetchEthTokenStateAsync(); + await this.props.refetchEthTokenStateAsync(); } this.props.onConversionSuccessful(); } catch (err) { diff --git a/packages/website/ts/components/eth_wrappers.tsx b/packages/website/ts/components/eth_wrappers.tsx index 90d2c0514..db1ceecb5 100644 --- a/packages/website/ts/components/eth_wrappers.tsx +++ b/packages/website/ts/components/eth_wrappers.tsx @@ -16,7 +16,6 @@ import { Token, TokenByAddress, TokenState, - TokenStateByAddress, } from 'ts/types'; import { colors } from 'ts/utils/colors'; import { configs } from 'ts/utils/configs'; @@ -163,7 +162,6 @@ export class EthWrappers extends React.Component<EthWrappersProps, EthWrappersSt isOutdatedWrappedEther={false} direction={Side.Deposit} ethToken={etherToken} - ethTokenState={this.state.ethTokenState} dispatcher={this.props.dispatcher} blockchain={this.props.blockchain} userEtherBalance={this.props.userEtherBalance} @@ -191,7 +189,6 @@ export class EthWrappers extends React.Component<EthWrappersProps, EthWrappersSt direction={Side.Receive} isDisabled={!this.state.isWethStateLoaded} ethToken={etherToken} - ethTokenState={this.state.ethTokenState} dispatcher={this.props.dispatcher} blockchain={this.props.blockchain} userEtherBalance={this.props.userEtherBalance} diff --git a/packages/website/ts/components/generate_order/asset_picker.tsx b/packages/website/ts/components/generate_order/asset_picker.tsx index 8d4eaab40..69fb32a21 100644 --- a/packages/website/ts/components/generate_order/asset_picker.tsx +++ b/packages/website/ts/components/generate_order/asset_picker.tsx @@ -8,7 +8,7 @@ import { TrackTokenConfirmation } from 'ts/components/track_token_confirmation'; import { TokenIcon } from 'ts/components/ui/token_icon'; import { trackedTokenStorage } from 'ts/local_storage/tracked_token_storage'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { DialogConfigs, Token, TokenByAddress, TokenState, TokenVisibility } from 'ts/types'; +import { DialogConfigs, Token, TokenByAddress, TokenVisibility } from 'ts/types'; const TOKEN_ICON_DIMENSION = 100; const TILE_DIMENSION = 146; diff --git a/packages/website/ts/components/generate_order/generate_order_form.tsx b/packages/website/ts/components/generate_order/generate_order_form.tsx index 1f6b4c6c0..df1241d8d 100644 --- a/packages/website/ts/components/generate_order/generate_order_form.tsx +++ b/packages/website/ts/components/generate_order/generate_order_form.tsx @@ -27,7 +27,6 @@ import { SignatureData, Token, TokenByAddress, - TokenStateByAddress, } from 'ts/types'; import { colors } from 'ts/utils/colors'; import { errorReporter } from 'ts/utils/error_reporter'; diff --git a/packages/website/ts/components/generate_order/new_token_form.tsx b/packages/website/ts/components/generate_order/new_token_form.tsx index 44712b27b..f76830a49 100644 --- a/packages/website/ts/components/generate_order/new_token_form.tsx +++ b/packages/website/ts/components/generate_order/new_token_form.tsx @@ -1,4 +1,3 @@ -import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import TextField from 'material-ui/TextField'; import * as React from 'react'; @@ -7,7 +6,7 @@ import { AddressInput } from 'ts/components/inputs/address_input'; import { Alert } from 'ts/components/ui/alert'; import { LifeCycleRaisedButton } from 'ts/components/ui/lifecycle_raised_button'; import { RequiredLabel } from 'ts/components/ui/required_label'; -import { AlertTypes, Token, TokenByAddress, TokenState } from 'ts/types'; +import { AlertTypes, Token, TokenByAddress } from 'ts/types'; import { colors } from 'ts/utils/colors'; interface NewTokenFormProps { diff --git a/packages/website/ts/components/inputs/token_amount_input.tsx b/packages/website/ts/components/inputs/token_amount_input.tsx index 9078f7fe1..2b167d875 100644 --- a/packages/website/ts/components/inputs/token_amount_input.tsx +++ b/packages/website/ts/components/inputs/token_amount_input.tsx @@ -5,7 +5,7 @@ import * as React from 'react'; import { Link } from 'react-router-dom'; import { Blockchain } from 'ts/blockchain'; import { BalanceBoundedInput } from 'ts/components/inputs/balance_bounded_input'; -import { InputErrMsg, Token, TokenState, ValidatedBigNumberCallback, WebsitePaths } from 'ts/types'; +import { InputErrMsg, Token, ValidatedBigNumberCallback, WebsitePaths } from 'ts/types'; import { colors } from 'ts/utils/colors'; interface TokenAmountInputProps { @@ -55,6 +55,7 @@ export class TokenAmountInput extends React.Component<TokenAmountInputProps, Tok nextProps.token.address !== this.props.token.address || nextProps.lastForceTokenStateRefetch !== this.props.lastForceTokenStateRefetch ) { + // tslint:disable-next-line:no-floating-promises this._fetchBalanceAndAllowanceAsync(nextProps.token.address, nextProps.userAddress); } } diff --git a/packages/website/ts/components/portal.tsx b/packages/website/ts/components/portal.tsx index 0182a91f7..1c4937654 100644 --- a/packages/website/ts/components/portal.tsx +++ b/packages/website/ts/components/portal.tsx @@ -21,7 +21,6 @@ import { FlashMessage } from 'ts/components/ui/flash_message'; import { GenerateOrderForm } from 'ts/containers/generate_order_form'; import { localStorage } from 'ts/local_storage/local_storage'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { State } from 'ts/redux/reducer'; import { orderSchema } from 'ts/schemas/order_schema'; import { SchemaValidator } from 'ts/schemas/validator'; import { @@ -30,9 +29,7 @@ import { Order, ProviderType, ScreenWidths, - Token, TokenByAddress, - TokenStateByAddress, WebsitePaths, } from 'ts/types'; import { colors } from 'ts/utils/colors'; diff --git a/packages/website/ts/components/send_button.tsx b/packages/website/ts/components/send_button.tsx index f13e8ecce..ffa165f60 100644 --- a/packages/website/ts/components/send_button.tsx +++ b/packages/website/ts/components/send_button.tsx @@ -5,7 +5,7 @@ import * as React from 'react'; import { Blockchain } from 'ts/blockchain'; import { SendDialog } from 'ts/components/dialogs/send_dialog'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { BlockchainCallErrs, Token, TokenState } from 'ts/types'; +import { BlockchainCallErrs, Token } from 'ts/types'; import { errorReporter } from 'ts/utils/error_reporter'; import { utils } from 'ts/utils/utils'; @@ -13,7 +13,6 @@ interface SendButtonProps { userAddress: string; networkId: number; token: Token; - tokenState: TokenState; dispatcher: Dispatcher; blockchain: Blockchain; onError: () => void; @@ -69,10 +68,9 @@ export class SendButton extends React.Component<SendButtonProps, SendButtonState }); this._toggleSendDialog(); const token = this.props.token; - const tokenState = this.props.tokenState; try { await this.props.blockchain.transferAsync(token, recipient, value); - this.props.refetchTokenStateAsync(token.address); + await this.props.refetchTokenStateAsync(token.address); } catch (err) { const errMsg = `${err}`; if (_.includes(errMsg, BlockchainCallErrs.UserHasNoAssociatedAddresses)) { diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx index c0df285cf..9b9304e23 100644 --- a/packages/website/ts/components/token_balances.tsx +++ b/packages/website/ts/components/token_balances.tsx @@ -107,8 +107,8 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala }; } public componentWillMount() { - // tslint:disable-next-line:no-floating-promises const trackedTokenAddresses = _.keys(this.state.trackedTokenStateByAddress); + // tslint:disable-next-line:no-floating-promises this._fetchBalancesAndAllowancesAsync(trackedTokenAddresses); } public componentWillUnmount() { @@ -152,6 +152,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala trackedTokenStateByAddress, }); // Fetch the actual balance/allowance. + // tslint:disable-next-line:no-floating-promises this._fetchBalancesAndAllowancesAsync(newTokenAddresses); } } @@ -433,7 +434,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala blockchain={this.props.blockchain} dispatcher={this.props.dispatcher} token={token} - tokenState={tokenState} onError={this._onSendFailed.bind(this)} lastForceTokenStateRefetch={this.props.lastForceTokenStateRefetch} refetchTokenStateAsync={this._refetchTokenStateAsync.bind(this, token.address)} diff --git a/packages/website/ts/components/top_bar/provider_display.tsx b/packages/website/ts/components/top_bar/provider_display.tsx index e132f9cee..39e7f2a8c 100644 --- a/packages/website/ts/components/top_bar/provider_display.tsx +++ b/packages/website/ts/components/top_bar/provider_display.tsx @@ -1,10 +1,6 @@ import * as _ from 'lodash'; -import Menu from 'material-ui/Menu'; -import MenuItem from 'material-ui/MenuItem'; -import { RadioButton, RadioButtonGroup } from 'material-ui/RadioButton'; import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { Blockchain } from 'ts/blockchain'; import { ProviderPicker } from 'ts/components/top_bar/provider_picker'; import { DropDown } from 'ts/components/ui/drop_down'; diff --git a/packages/website/ts/components/top_bar/provider_picker.tsx b/packages/website/ts/components/top_bar/provider_picker.tsx index 98678dee6..be7e57d6f 100644 --- a/packages/website/ts/components/top_bar/provider_picker.tsx +++ b/packages/website/ts/components/top_bar/provider_picker.tsx @@ -1,19 +1,11 @@ import * as _ from 'lodash'; -import Menu from 'material-ui/Menu'; -import MenuItem from 'material-ui/MenuItem'; import { RadioButton, RadioButtonGroup } from 'material-ui/RadioButton'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { Blockchain } from 'ts/blockchain'; -import { DropDown } from 'ts/components/ui/drop_down'; -import { Identicon } from 'ts/components/ui/identicon'; import { Dispatcher } from 'ts/redux/dispatcher'; import { ProviderType } from 'ts/types'; import { colors } from 'ts/utils/colors'; import { constants } from 'ts/utils/constants'; -import { utils } from 'ts/utils/utils'; - -const IDENTICON_DIAMETER = 32; interface ProviderPickerProps { networkId: number; diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 652da5435..1a0691e83 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -14,9 +14,8 @@ import { Identicon } from 'ts/components/ui/identicon'; import { DocsInfo } from 'ts/pages/documentation/docs_info'; import { NestedSidebarMenu } from 'ts/pages/shared/nested_sidebar_menu'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { DocsMenu, MenuSubsectionsBySection, ProviderType, Styles, TypeDocNode, WebsitePaths } from 'ts/types'; +import { DocsMenu, MenuSubsectionsBySection, ProviderType, Styles, WebsitePaths } from 'ts/types'; import { colors } from 'ts/utils/colors'; -import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; interface TopBarProps { @@ -189,7 +188,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { </div> )} {this.props.blockchainIsLoaded && ( - <div className="col col-5"> + <div className="sm-hide xs-hide col col-5"> <ProviderDisplay dispatcher={this.props.dispatcher} userAddress={this.props.userAddress} diff --git a/packages/website/ts/components/ui/drop_down.tsx b/packages/website/ts/components/ui/drop_down.tsx index 31a67f0d7..63b9eec0b 100644 --- a/packages/website/ts/components/ui/drop_down.tsx +++ b/packages/website/ts/components/ui/drop_down.tsx @@ -1,9 +1,7 @@ import * as _ from 'lodash'; -import Menu from 'material-ui/Menu'; import Popover, { PopoverAnimationVertical } from 'material-ui/Popover'; import * as React from 'react'; -import { MaterialUIPosition, Styles, WebsitePaths } from 'ts/types'; -import { colors } from 'ts/utils/colors'; +import { MaterialUIPosition } from 'ts/types'; const CHECK_CLOSE_POPOVER_INTERVAL_MS = 300; const DEFAULT_STYLE = { diff --git a/packages/website/ts/containers/generate_order_form.tsx b/packages/website/ts/containers/generate_order_form.tsx index af9f0da01..57863dbae 100644 --- a/packages/website/ts/containers/generate_order_form.tsx +++ b/packages/website/ts/containers/generate_order_form.tsx @@ -6,14 +6,7 @@ import { Blockchain } from 'ts/blockchain'; import { GenerateOrderForm as GenerateOrderFormComponent } from 'ts/components/generate_order/generate_order_form'; import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; -import { - BlockchainErrs, - HashData, - SideToAssetToken, - SignatureData, - TokenByAddress, - TokenStateByAddress, -} from 'ts/types'; +import { BlockchainErrs, HashData, SideToAssetToken, SignatureData, TokenByAddress } from 'ts/types'; interface GenerateOrderFormProps { blockchain: Blockchain; diff --git a/packages/website/ts/containers/portal.tsx b/packages/website/ts/containers/portal.tsx index 9afe7fca3..bcca0d70f 100644 --- a/packages/website/ts/containers/portal.tsx +++ b/packages/website/ts/containers/portal.tsx @@ -6,16 +6,7 @@ import { Dispatch } from 'redux'; import { Portal as PortalComponent, PortalAllProps as PortalComponentAllProps } from 'ts/components/portal'; import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; -import { - BlockchainErrs, - HashData, - Order, - ProviderType, - ScreenWidths, - Side, - TokenByAddress, - TokenStateByAddress, -} from 'ts/types'; +import { BlockchainErrs, HashData, Order, ProviderType, ScreenWidths, Side, TokenByAddress } from 'ts/types'; import { constants } from 'ts/utils/constants'; interface ConnectedState { diff --git a/packages/website/ts/redux/dispatcher.ts b/packages/website/ts/redux/dispatcher.ts index aae7683ff..87415b285 100644 --- a/packages/website/ts/redux/dispatcher.ts +++ b/packages/website/ts/redux/dispatcher.ts @@ -13,7 +13,6 @@ import { SignatureData, Token, TokenByAddress, - TokenStateByAddress, } from 'ts/types'; export class Dispatcher { diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts index 4b5a9138f..7b0b03dae 100644 --- a/packages/website/ts/redux/reducer.ts +++ b/packages/website/ts/redux/reducer.ts @@ -13,8 +13,6 @@ import { SideToAssetToken, SignatureData, TokenByAddress, - TokenState, - TokenStateByAddress, } from 'ts/types'; import { utils } from 'ts/utils/utils'; diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 1c14c1435..29eebcfe8 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -25,10 +25,6 @@ export interface TokenState { balance: BigNumber; } -export interface TokenStateByAddress { - [address: string]: TokenState; -} - export interface AssetToken { address?: string; amount?: BigNumber; diff --git a/packages/website/ts/web3_wrapper.ts b/packages/website/ts/web3_wrapper.ts index 1e2f8ff5d..9d8d771af 100644 --- a/packages/website/ts/web3_wrapper.ts +++ b/packages/website/ts/web3_wrapper.ts @@ -87,7 +87,7 @@ export class Web3Wrapper { public updatePrevUserAddress(userAddress: string) { this._prevUserAddress = userAddress; } - public async startEmittingNetworkConnectionAndUserBalanceStateAsync() { + public startEmittingNetworkConnectionAndUserBalanceState() { if (!_.isUndefined(this._watchNetworkAndBalanceIntervalId)) { return; // we are already emitting the state } |