aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/blockchain.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-12-16 02:37:03 +0800
committerFabio Berger <me@fabioberger.com>2017-12-16 02:37:03 +0800
commitb46dd2e0a277340c19fa137a436981cc53c8cb80 (patch)
treed2814176fe8ffc5ec6a61534aa77487aae6bcc13 /packages/website/ts/blockchain.ts
parent484dd4c33aa5786def1f0b159f5b51f99a585aa8 (diff)
parent3eb08735d4d0fe4b046dd6b74f5ed503cf5c64e3 (diff)
downloaddexon-sol-tools-b46dd2e0a277340c19fa137a436981cc53c8cb80.tar.gz
dexon-sol-tools-b46dd2e0a277340c19fa137a436981cc53c8cb80.tar.zst
dexon-sol-tools-b46dd2e0a277340c19fa137a436981cc53c8cb80.zip
Merge branch 'development' into createWethPage
* development: (54 commits) Fix redundant spaces Fix tests Fix website unused vars Fix connect unused vars Fix 0x.js unused vars Dissallow unused vars/imports Implement first custom linter rule async-suffix Reuse intervalutils in website Add a newline Name a variable Add a comment Fix a conditional Make migrations deterministic Fix linter error Fix linter errors Add a function to init token balances Rename tokenUtils.getNonProtocolTokens to tokenUtils.getDummyTokens Add DummyToken to gitignore Add DummyToken to artifacts list Increase mocha timeout ...
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r--packages/website/ts/blockchain.ts18
1 files changed, 4 insertions, 14 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index 172ba6b52..331bafa71 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -1,7 +1,6 @@
import {
BlockParam,
DecodedLogEvent,
- ExchangeContractErrs,
ExchangeContractEventArgs,
ExchangeEvents,
IndexedFilterValues,
@@ -14,7 +13,6 @@ import {
Token as ZeroExToken,
TransactionReceiptWithDecodedLogs,
ZeroEx,
- ZeroExError,
} from '0x.js';
import {
InjectedWeb3Subprovider,
@@ -23,11 +21,8 @@ import {
LedgerWalletSubprovider,
RedundantRPCSubprovider,
} from '@0xproject/subproviders';
-import {promisify} from '@0xproject/utils';
+import {intervalUtils, promisify} from '@0xproject/utils';
import BigNumber from 'bignumber.js';
-import compareVersions = require('compare-versions');
-import ethUtil = require('ethereumjs-util');
-import findVersions = require('find-versions');
import * as _ from 'lodash';
import * as React from 'react';
import contract = require('truffle-contract');
@@ -40,7 +35,6 @@ import {
BlockchainCallErrs,
BlockchainErrs,
ContractInstance,
- ContractResponse,
EtherscanLinkSuffixes,
ProviderType,
Side,
@@ -60,7 +54,6 @@ import FilterSubprovider = require('web3-provider-engine/subproviders/filters');
import * as MintableArtifacts from '../contracts/Mintable.json';
-const ALLOWANCE_TO_ZERO_GAS_AMOUNT = 45730;
const BLOCK_NUMBER_BACK_TRACK = 50;
export class Blockchain {
@@ -70,12 +63,10 @@ export class Blockchain {
private dispatcher: Dispatcher;
private web3Wrapper?: Web3Wrapper;
private exchangeAddress: string;
- private tokenTransferProxy: ContractInstance;
- private tokenRegistry: ContractInstance;
private userAddress: string;
private cachedProvider: Web3.Provider;
private ledgerSubprovider: LedgerWalletSubprovider;
- private zrxPollIntervalId: number;
+ private zrxPollIntervalId: NodeJS.Timer;
private static async onPageLoadAsync() {
if (document.readyState === 'complete') {
return; // Already loaded
@@ -359,7 +350,7 @@ export class Blockchain {
const [currBalance] = await this.getTokenBalanceAndAllowanceAsync(this.userAddress, token.address);
- this.zrxPollIntervalId = window.setInterval(async () => {
+ this.zrxPollIntervalId = intervalUtils.setAsyncExcludingInterval(async () => {
const [balance] = await this.getTokenBalanceAndAllowanceAsync(this.userAddress, token.address);
if (!balance.eq(currBalance)) {
this.dispatcher.replaceTokenBalanceByAddress(token.address, balance);
@@ -506,8 +497,7 @@ export class Blockchain {
await this.fetchHistoricalExchangeLogFillEventsAsync(indexFilterValues);
// Start a subscription for new logs
- const exchangeAddress = this.getExchangeContractAddressIfExists();
- const subscriptionId = this.zeroEx.exchange.subscribe(
+ this.zeroEx.exchange.subscribe(
ExchangeEvents.LogFill, indexFilterValues,
async (err: Error, decodedLogEvent: DecodedLogEvent<LogFillContractEventArgs>) => {
if (err) {