Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Revert "Merge pull request #2558 from trufflesuite/update-web3-types"
Browse files Browse the repository at this point in the history
This reverts commit c3c6c03, reversing
changes made to 60babc3.
  • Loading branch information
CruzMolina committed Dec 10, 2019
1 parent b16fba0 commit 1dcfb41
Show file tree
Hide file tree
Showing 38 changed files with 127 additions and 362 deletions.
2 changes: 1 addition & 1 deletion packages/artifactor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"temp": "^0.8.3",
"ts-node": "^8.3.0",
"typescript": "^3.6.3",
"web3": "1.2.2"
"web3": "1.2.1"
},
"publishConfig": {
"access": "public"
Expand Down
7 changes: 6 additions & 1 deletion packages/artifactor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
"outDir": "dist",
"baseUrl": ".",
"lib": ["es2017"],
"paths": {},
"paths": {
"web3": [
"../../node_modules/@types/web3/index",
"node_modules/web3/index"
]
},
"rootDir": ".",
"typeRoots": [
"./typings",
Expand Down
14 changes: 7 additions & 7 deletions packages/blockchain-utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Provider, Callback, JsonRPCResponse } from "web3/providers";
import { parsedUriObject } from "typings";
import { Callback, JsonRpcResponse, Provider } from "@truffle/provider";

const Blockchain = {
getBlockByNumber(
blockNumber: string,
provider: Provider,
callback: Callback<JsonRpcResponse>
callback: Callback<JsonRPCResponse>
) {
const params = [blockNumber, true];
provider.send(
Expand All @@ -22,7 +22,7 @@ const Blockchain = {
getBlockByHash(
blockHash: string,
provider: Provider,
callback: Callback<JsonRpcResponse>
callback: Callback<JsonRPCResponse>
) {
const params = [blockHash, true];
provider.send(
Expand Down Expand Up @@ -56,14 +56,14 @@ const Blockchain = {
this.getBlockByNumber(
"0x0",
provider,
(err: Error, { result }: JsonRpcResponse) => {
(err: Error, { result }: JsonRPCResponse) => {
if (err) return callback(err);
genesis = result;

this.getBlockByNumber(
"latest",
provider,
(err: Error, { result }: JsonRpcResponse) => {
(err: Error, { result }: JsonRPCResponse) => {
if (err) return callback(err);
latest = result;
const url = `blockchain://${genesis.hash.replace(
Expand All @@ -86,15 +86,15 @@ const Blockchain = {
this.getBlockByNumber(
"0x0",
provider,
(err: Error, { result }: JsonRpcResponse) => {
(err: Error, { result }: JsonRPCResponse) => {
if (err) return callback(err);
const block = result;
if (block.hash !== expected_genesis) return callback(null, false);

this.getBlockByHash(
expected_block,
provider,
(err: Error, { result }: JsonRpcResponse) => {
(err: Error, { result }: JsonRPCResponse) => {
// Treat an error as if the block didn't exist. This is because
// some clients respond differently.
const block = result;
Expand Down
4 changes: 1 addition & 3 deletions packages/blockchain-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@types/assert": "^1.4.2",
"@types/mocha": "^5.2.7",
"@types/node": "^12.12.5",
"@types/web3": "1.0.19",
"mocha": "5.2.0",
"ts-node": "^8.3.0",
"typescript": "^3.6.3"
Expand All @@ -31,8 +32,5 @@
],
"publishConfig": {
"access": "public"
},
"dependencies": {
"@truffle/provider": "^0.2.3"
}
}
11 changes: 6 additions & 5 deletions packages/blockchain-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
"baseUrl": ".",
"lib": ["es2017"],
"paths": {
"net": [
"../../node_modules/@types/node",
"node_modules/@types/node"
"web3": [
"../../node_modules/@types/web3/index",
"node_modules/web3/index"
]
},
"rootDir": ".",
"typeRoots": [
"./typings",
"../../**/node_modules/@types/mocha",
"../../**/node_modules/@types/assert"
"../../node_modules/@types/mocha",
"../../node_modules/@types/web3",
"../../node_modules/@types/assert"
]
},
"include": [
Expand Down
7 changes: 6 additions & 1 deletion packages/box/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
"outDir": "dist",
"baseUrl": ".",
"lib": ["es2017"],
"paths": {},
"paths": {
"web3": [
"../../node_modules/@types/web3/index",
"node_modules/web3/index"
]
},
"rootDir": ".",
"typeRoots": [
"./typings",
Expand Down
7 changes: 6 additions & 1 deletion packages/code-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
"outDir": "dist",
"baseUrl": ".",
"lib": ["es2017"],
"paths": {},
"paths": {
"web3": [
"../../node_modules/@types/web3/index",
"node_modules/web3/index"
]
},
"rootDir": ".",
"typeRoots": [
"./typings",
Expand Down
8 changes: 4 additions & 4 deletions packages/contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"bignumber.js": "^7.2.1",
"ethereum-ens": "^0.7.7",
"ethers": "^4.0.0-beta.1",
"web3": "1.2.2",
"web3-core-promievent": "1.2.2",
"web3-eth-abi": "1.2.2",
"web3-utils": "1.2.2"
"web3": "1.2.1",
"web3-core-promievent": "1.2.1",
"web3-eth-abi": "1.2.1",
"web3-utils": "1.2.1"
},
"devDependencies": {
"@truffle/compile-solidity": "^4.2.13",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
"spawn-args": "^0.1.0",
"temp": "^0.8.3",
"universal-analytics": "^0.4.17",
"web3": "1.2.2",
"web3-utils": "1.2.2",
"web3": "1.2.1",
"web3-utils": "1.2.1",
"xregexp": "^4.2.4",
"yargs": "^8.0.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"redux-saga": "1.0.0",
"remote-redux-devtools": "^0.5.12",
"reselect-tree": "^1.3.1",
"web3": "1.2.2",
"web3-eth-abi": "1.2.2"
"web3": "1.2.1",
"web3-eth-abi": "1.2.1"
},
"devDependencies": {
"@truffle/artifactor": "^4.0.40",
Expand Down
2 changes: 1 addition & 1 deletion packages/decoder/lib/decoders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as DecoderTypes from "./types";
import Web3 from "web3";
import { ContractObject as Artifact } from "@truffle/contract-schema/spec";
import BN from "bn.js";
import { Provider } from "@truffle/provider";
import { Provider } from "web3/providers";
import {
ContractBeingDecodedHasNoNodeError,
ContractAllocationFailedError,
Expand Down
2 changes: 1 addition & 1 deletion packages/decoder/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export {
BlockSpecifier
} from "./types";

import { Provider } from "@truffle/provider";
import { Provider } from "web3/providers";
import { ContractObject as Artifact } from "@truffle/contract-schema/spec";
import { ContractConstructorObject, ContractInstanceObject } from "./types";

Expand Down
13 changes: 7 additions & 6 deletions packages/decoder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"start": "node_modules/.bin/tsc --watch",
"test": "cd test && npx truffle test"
},
"dependencies": {
"@truffle/codec": "^0.2.0",
"bn.js": "^4.11.8",
"debug": "^4.1.0",
"web3": "1.2.1"
},
"repository": "https://github.com/trufflesuite/truffle/tree/master/packages/codec",
"keywords": [
"ethereum",
Expand Down Expand Up @@ -42,14 +48,9 @@
"@types/lodash.isequal": "^4.5.4",
"@types/lodash.merge": "^4.6.4",
"@types/utf8": "^2.1.6",
"@types/web3": "1.0.19",
"typescript": "^3.6.3"
},
"dependencies": {
"@truffle/codec": "^0.2.0",
"bn.js": "^4.11.8",
"debug": "^4.1.0",
"web3": "1.2.2"
},
"peerDependencies": {
"truffle": "^5.0.14"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/decoder/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"outDir": "dist",
"baseUrl": ".",
"lib": ["es2017"],
"paths": {
"web3": ["../../node_modules/@types/web3/index", "node_modules/web3/index"],
"web3/types": ["../../node_modules/@types/web3/types", "node_modules/web3/types"],
"web3/eth/types": ["../../node_modules/@types/web3/eth/types", "node_modules/web3/eth/types"]
},
"rootDir": "lib",
"typeRoots": [
"./typings",
Expand Down
2 changes: 1 addition & 1 deletion packages/deployer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"ganache-core": "2.8.0",
"mocha": "5.2.0",
"sinon": "^7.3.2",
"web3": "1.2.2"
"web3": "1.2.1"
},
"keywords": [
"contracts",
Expand Down
2 changes: 1 addition & 1 deletion packages/environment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@truffle/resolver": "^5.0.22",
"ganache-core": "2.8.0",
"node-ipc": "^9.1.1",
"web3": "1.2.2"
"web3": "1.2.1"
},
"devDependencies": {
"debug": "^4.1.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/external-compile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@truffle/expect": "^0.0.13",
"debug": "^4.1.0",
"glob": "^7.1.2",
"web3-utils": "1.2.2"
"web3-utils": "1.2.1"
},
"devDependencies": {
"chai": "4.2.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/hdwallet-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
},
"types": "dist/index.d.ts",
"dependencies": {
"@truffle/provider": "^0.2.3",
"any-promise": "^1.3.0",
"bindings": "^1.5.0",
"bip39": "^2.4.2",
"ethereum-protocol": "^1.0.1",
"ethereumjs-tx": "^1.0.0",
"ethereumjs-util": "^6.1.0",
"ethereumjs-wallet": "^0.6.3",
"web3": "1.2.2",
"web3": "1.2.1",
"web3-provider-engine": "https://github.com/trufflesuite/provider-engine#web3-one"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/hdwallet-provider/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ProviderSubprovider from "web3-provider-engine/subproviders/provider";
import Url from "url";
import Web3 from "web3";
import { JSONRPCRequestPayload, JSONRPCErrorCallback } from "ethereum-protocol";
import { Callback, JsonRpcResponse } from "@truffle/provider";
import { Callback, JsonRPCResponse } from "web3/providers";

// Important: do not use debug module. Reason: https://github.com/trufflesuite/truffle/issues/2374#issuecomment-536109086

Expand Down Expand Up @@ -175,14 +175,14 @@ class HDWalletProvider {

public send(
payload: JSONRPCRequestPayload,
callback: JSONRPCErrorCallback | Callback<JsonRpcResponse>
callback: JSONRPCErrorCallback | Callback<JsonRPCResponse>
): void {
return this.engine.send.call(this.engine, payload, callback);
}

public sendAsync(
payload: JSONRPCRequestPayload,
callback: JSONRPCErrorCallback | Callback<JsonRpcResponse>
callback: JSONRPCErrorCallback | Callback<JsonRPCResponse>
): void {
this.engine.sendAsync.call(this.engine, payload, callback);
}
Expand Down
7 changes: 3 additions & 4 deletions packages/hdwallet-provider/test/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import WalletProvider from "../dist";
import { describe, it } from "mocha";

describe("HD Wallet Provider", function() {
// @ts-ignore
const web3 = new Web3();
const port = 8545;
let server: any;
Expand Down Expand Up @@ -47,7 +46,7 @@ describe("HD Wallet Provider", function() {
assert.deepEqual(provider.getAddresses(), truffleDevAccounts);
web3.setProvider(provider);

web3.eth.getBlockNumber((err: Error, number: number) => {
web3.eth.getBlockNumber((err, number) => {
assert(number === 0);
done();
});
Expand Down Expand Up @@ -78,7 +77,7 @@ describe("HD Wallet Provider", function() {
assert(EthUtil.isValidAddress(address), "invalid address");
});

web3.eth.getBlockNumber((err: Error, number: number) => {
web3.eth.getBlockNumber((err, number) => {
assert(number === 0);
done();
});
Expand Down Expand Up @@ -119,7 +118,7 @@ describe("HD Wallet Provider", function() {
);
});

web3.eth.getBlockNumber((err: Error, number: number) => {
web3.eth.getBlockNumber((err, number) => {
assert(number === 0);
done();
});
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-provider/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
]
},
"typeRoots": [
"../../node_modules/@types/mocha",
"../../node_modules/@truffle/provider/typings"
"./typings",
"../../node_modules/@types/mocha"
]
},
"include": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
JSONRPCRequestPayload,
JSONRPCErrorCallback
} from "ethereum-protocol";
import { Callback, JsonRpcResponse } from "@truffle/provider";
import { Callback, JsonRPCResponse } from "web3/providers";

interface Web3ProviderEngineOptions {
pollingInterval?: number;
Expand All @@ -15,11 +15,11 @@ declare class Web3ProviderEngine implements Provider {
on(event: string, handler: () => void): void;
send(
payload: JSONRPCRequestPayload,
callback?: JSONRPCErrorCallback | Callback<JsonRpcResponse>
callback?: JSONRPCErrorCallback | Callback<JsonRPCResponse>
): void;
sendAsync(
payload: JSONRPCRequestPayload,
callback: JSONRPCErrorCallback | Callback<JsonRpcResponse>
callback: JSONRPCErrorCallback | Callback<JsonRPCResponse>
): void;
addProvider(provider: any): void;
// start block polling
Expand Down
1 change: 0 additions & 1 deletion packages/interface-adapter/lib/adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Web3InterfaceAdapter, Web3InterfaceAdapterOptions } from "./web3";

import { InterfaceAdapter } from "./types";

// type union of supported network types
export type InterfaceAdapterOptions = Web3InterfaceAdapterOptions;

const getNetworkTypeClass = (networkType = "ethereum") => {
Expand Down
Loading

0 comments on commit 1dcfb41

Please sign in to comment.