@@ -196,7 +196,6 @@ export class ContractWrapper {
|
|||||||
}
|
}
|
||||||
private async _reconcileBlockAsync(): Promise<void> {
|
private async _reconcileBlockAsync(): Promise<void> {
|
||||||
const latestBlock = await this._web3Wrapper.getBlockAsync(BlockParamLiteral.Latest);
|
const latestBlock = await this._web3Wrapper.getBlockAsync(BlockParamLiteral.Latest);
|
||||||
console.log('latestBlock', latestBlock.number);
|
|
||||||
// We need to coerce to Block type cause Web3.Block includes types for mempool blocks
|
// We need to coerce to Block type cause Web3.Block includes types for mempool blocks
|
||||||
if (!_.isUndefined(this._blockAndLogStreamerIfExists)) {
|
if (!_.isUndefined(this._blockAndLogStreamerIfExists)) {
|
||||||
// If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined
|
// If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
FROM node
|
|
||||||
|
|
||||||
WORKDIR /src
|
|
||||||
|
|
||||||
COPY package.json .
|
|
||||||
RUN yarn install
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
CMD ["./lib/index.js"]
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "long-lived-subscriptions-test",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"description": "",
|
|
||||||
"scripts": {
|
|
||||||
"build:watch": "tsc -w",
|
|
||||||
"build": "tsc",
|
|
||||||
"start": "node lib/index.js",
|
|
||||||
"clean": "shx rm -rf lib",
|
|
||||||
"lint": "tslint --project . 'src/**/*.ts'"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"0x.js": "^0.31.1",
|
|
||||||
"lodash": "^4.17.4",
|
|
||||||
"web3": "^0.20.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@0xproject/tslint-config": "^0.4.6",
|
|
||||||
"@types/lodash": "^4.14.86",
|
|
||||||
"shx": "^0.2.2",
|
|
||||||
"tslint": "5.8.0",
|
|
||||||
"typescript": "2.7.1",
|
|
||||||
"web3-typescript-typings": "^0.9.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import { DecodedLogEvent, ExchangeEvents, LogFillContractEventArgs, ZeroEx } from '0x.js';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
const zeroExConfig = {
|
|
||||||
networkId: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
const RPC_URL = 'https://mainnet.infura.io/T5WSC8cautR4KXyYgsRs';
|
|
||||||
// const RPC_URL = 'https://mainnet.0xproject.com';
|
|
||||||
|
|
||||||
const web3 = new Web3(new Web3.providers.HttpProvider(RPC_URL));
|
|
||||||
const zeroEx = new ZeroEx(web3.currentProvider, zeroExConfig);
|
|
||||||
|
|
||||||
const subscribe = () => {
|
|
||||||
console.log('subscribing...');
|
|
||||||
zeroEx.exchange.subscribe<LogFillContractEventArgs>(
|
|
||||||
ExchangeEvents.LogFill,
|
|
||||||
{},
|
|
||||||
(err: Error | null, event?: DecodedLogEvent<LogFillContractEventArgs>) => {
|
|
||||||
if (_.isNull(err)) {
|
|
||||||
console.log('EVENT');
|
|
||||||
console.log(event);
|
|
||||||
} else {
|
|
||||||
console.log('ERROR');
|
|
||||||
console.log(err);
|
|
||||||
subscribe();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
};
|
|
||||||
subscribe();
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../tsconfig",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "lib"
|
|
||||||
},
|
|
||||||
"include": ["./src/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"]
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["@0xproject/tslint-config"]
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user