(
- payload: JsonRpcPayload,
- cb: (err: Error | undefined, response: JsonRpcResponse) => void,
- ) => void;
-};
-
-export type LegacySendProvider = {
- send: (
- payload: JsonRpcPayload,
- // Used "null" value to match the legacy version
- // eslint-disable-next-line @typescript-eslint/ban-types
- cb: (err?: Error | null, response?: JsonRpcResponse) => void,
- ) => void;
-};
-
-export type LegacySendAsyncProvider = {
- sendAsync: (
- payload: JsonRpcPayload,
- ) => Promise>;
-};
-
-export type SupportedProviders =
- | Web3BaseProvider
- | LegacyRequestProvider
- | LegacySendProvider
- | LegacySendAsyncProvider;
-
-export type Web3BaseProviderConstructor = new (
- url: string,
- net?: Socket,
-) => Web3BaseProvider;
+import { HexString } from 'web3-types';
// TODO: When we have `web3-types` package we can share TransactionType
export type TransactionTypeParser = (transaction: Record) => HexString | undefined;
diff --git a/packages/web3-core/src/utils.ts b/packages/web3-core/src/utils.ts
index e63b6c981fb..238bfe215e8 100644
--- a/packages/web3-core/src/utils.ts
+++ b/packages/web3-core/src/utils.ts
@@ -15,13 +15,14 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Web3APISpec, Web3BaseProvider } from 'web3-common';
import {
+ Web3APISpec,
+ Web3BaseProvider,
LegacyRequestProvider,
LegacySendAsyncProvider,
LegacySendProvider,
SupportedProviders,
-} from './types';
+} from 'web3-types';
export const isWeb3Provider = (
provider: SupportedProviders,
diff --git a/packages/web3-core/src/web3_batch_request.ts b/packages/web3-core/src/web3_batch_request.ts
index 8a672733ac1..5529895df05 100644
--- a/packages/web3-core/src/web3_batch_request.ts
+++ b/packages/web3-core/src/web3_batch_request.ts
@@ -15,15 +15,9 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import {
- JsonRpcBatchResponse,
- JsonRpcOptionalRequest,
- DeferredPromise,
- jsonRpc,
- JsonRpcRequest,
- ResponseError,
-} from 'web3-common';
-import { OperationAbortError, OperationTimeoutError } from 'web3-errors';
+import { JsonRpcBatchResponse, JsonRpcOptionalRequest, JsonRpcRequest } from 'web3-types';
+import { jsonRpc, Web3DeferredPromise } from 'web3-utils';
+import { OperationAbortError, OperationTimeoutError, ResponseError } from 'web3-errors';
import { Web3RequestManager } from './web3_request_manager';
export const DEFAULT_BATCH_REQUEST_TIMEOUT = 1000;
@@ -32,7 +26,7 @@ export class Web3BatchRequest {
private readonly _requestManager: Web3RequestManager;
private readonly _requests: Map<
number,
- { payload: JsonRpcRequest; promise: DeferredPromise }
+ { payload: JsonRpcRequest; promise: Web3DeferredPromise }
>;
public constructor(requestManager: Web3RequestManager) {
@@ -46,7 +40,7 @@ export class Web3BatchRequest {
public add(request: JsonRpcOptionalRequest) {
const payload = jsonRpc.toPayload(request) as JsonRpcRequest;
- const promise = new DeferredPromise();
+ const promise = new Web3DeferredPromise();
this._requests.set(payload.id as number, { payload, promise });
@@ -59,7 +53,7 @@ export class Web3BatchRequest {
return Promise.resolve([]);
}
- const request = new DeferredPromise>({
+ const request = new Web3DeferredPromise>({
timeout: DEFAULT_BATCH_REQUEST_TIMEOUT,
eagerStart: true,
timeoutMessage: 'Batch request timeout',
@@ -79,7 +73,7 @@ export class Web3BatchRequest {
}
private async _processBatchRequest(
- promise: DeferredPromise>,
+ promise: Web3DeferredPromise>,
) {
const response = await this._requestManager.sendBatch(
[...this._requests.values()].map(r => r.payload),
diff --git a/packages/web3-core/src/web3_config.ts b/packages/web3-core/src/web3_config.ts
index 9981b1c7fbd..98c47825d72 100644
--- a/packages/web3-core/src/web3_config.ts
+++ b/packages/web3-core/src/web3_config.ts
@@ -15,11 +15,12 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Web3EventEmitter } from 'web3-common';
-import { Numbers, HexString, toHex, BlockNumberOrTag } from 'web3-utils';
+import { Numbers, HexString, BlockNumberOrTag } from 'web3-types';
+import { toHex } from 'web3-utils';
import { TransactionTypeParser } from './types';
// eslint-disable-next-line import/no-cycle
import { TransactionBuilder } from './web3_context';
+import { Web3EventEmitter } from './web3_event_emitter';
// To avoid cycle dependency declare this
export interface Web3ConfigOptions {
diff --git a/packages/web3-core/src/web3_context.ts b/packages/web3-core/src/web3_context.ts
index 805a4b56d20..459071f1733 100644
--- a/packages/web3-core/src/web3_context.ts
+++ b/packages/web3-core/src/web3_context.ts
@@ -20,9 +20,10 @@ import {
Web3BaseWallet,
Web3BaseWalletAccount,
Web3AccountProvider,
-} from 'web3-common';
-import { HexString, isNullish } from 'web3-utils';
-import { SupportedProviders } from './types';
+ SupportedProviders,
+ HexString,
+} from 'web3-types';
+import { isNullish } from 'web3-utils';
import { isSupportedProvider } from './utils';
// eslint-disable-next-line import/no-cycle
import { Web3Config, Web3ConfigEvent, Web3ConfigOptions } from './web3_config';
diff --git a/packages/web3-common/src/web3_event_emitter.ts b/packages/web3-core/src/web3_event_emitter.ts
similarity index 100%
rename from packages/web3-common/src/web3_event_emitter.ts
rename to packages/web3-core/src/web3_event_emitter.ts
diff --git a/packages/web3-common/src/web3_promi_event.ts b/packages/web3-core/src/web3_promi_event.ts
similarity index 100%
rename from packages/web3-common/src/web3_promi_event.ts
rename to packages/web3-core/src/web3_promi_event.ts
diff --git a/packages/web3-core/src/web3_request_manager.ts b/packages/web3-core/src/web3_request_manager.ts
index ec9de7438b6..8d445c1ffd7 100644
--- a/packages/web3-core/src/web3_request_manager.ts
+++ b/packages/web3-core/src/web3_request_manager.ts
@@ -16,34 +16,32 @@ along with web3.js. If not, see .
*/
import { Socket } from 'net';
-import { ProviderError } from 'web3-errors';
+import { InvalidResponseError, ProviderError, ResponseError } from 'web3-errors';
+import HttpProvider from 'web3-providers-http';
+import IpcProvider from 'web3-providers-ipc';
+import WSProvider from 'web3-providers-ws';
import {
EthExecutionAPI,
- InvalidResponseError,
- jsonRpc,
JsonRpcBatchRequest,
JsonRpcBatchResponse,
JsonRpcPayload,
JsonRpcResponse,
- ResponseError,
+ SupportedProviders,
Web3APIMethod,
Web3APIPayload,
Web3APIRequest,
Web3APIReturnType,
Web3APISpec,
- Web3EventEmitter,
-} from 'web3-common';
-import HttpProvider from 'web3-providers-http';
-import WSProvider from 'web3-providers-ws';
-import IpcProvider from 'web3-providers-ipc';
-import { isNullish } from 'web3-utils';
-import { SupportedProviders, Web3BaseProviderConstructor } from './types';
+ Web3BaseProviderConstructor,
+} from 'web3-types';
+import { isNullish, jsonRpc } from 'web3-utils';
import {
isLegacyRequestProvider,
isLegacySendAsyncProvider,
isLegacySendProvider,
isWeb3Provider,
} from './utils';
+import { Web3EventEmitter } from './web3_event_emitter';
export enum Web3RequestManagerEvent {
PROVIDER_CHANGED = 'PROVIDER_CHANGED',
diff --git a/packages/web3-core/src/web3_subscription_manager.ts b/packages/web3-core/src/web3_subscription_manager.ts
index 9bd6efc11e8..f87481721f3 100644
--- a/packages/web3-core/src/web3_subscription_manager.ts
+++ b/packages/web3-core/src/web3_subscription_manager.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Web3APISpec } from 'web3-common';
+import { Web3APISpec } from 'web3-types';
import { ProviderError, SubscriptionError } from 'web3-errors';
import { isNullish } from 'web3-utils';
import { isSupportSubscriptions } from './utils';
diff --git a/packages/web3-core/src/web3_subscriptions.ts b/packages/web3-core/src/web3_subscriptions.ts
index 45cb89642bd..1ca0e04b4f9 100644
--- a/packages/web3-core/src/web3_subscriptions.ts
+++ b/packages/web3-core/src/web3_subscriptions.ts
@@ -19,17 +19,16 @@ along with web3.js. If not, see .
import {
BlockOutput,
Web3BaseProvider,
- Web3EventEmitter,
- Web3EventMap,
Web3APISpec,
Web3APIParams,
EthExecutionAPI,
Log,
JsonRpcNotification,
JsonRpcSubscriptionResult,
- jsonRpc,
-} from 'web3-common';
-import { HexString } from 'web3-utils';
+ HexString,
+} from 'web3-types';
+import { jsonRpc } from 'web3-utils';
+import { Web3EventEmitter, Web3EventMap } from './web3_event_emitter';
import { Web3RequestManager } from './web3_request_manager';
export abstract class Web3Subscription<
diff --git a/packages/web3-common/test/unit/formatters.test.ts b/packages/web3-core/test/unit/formatters.test.ts
similarity index 99%
rename from packages/web3-common/test/unit/formatters.test.ts
rename to packages/web3-core/test/unit/formatters.test.ts
index 8930bcd8d8f..2fd4161c958 100644
--- a/packages/web3-common/test/unit/formatters.test.ts
+++ b/packages/web3-core/test/unit/formatters.test.ts
@@ -16,6 +16,7 @@ along with web3.js. If not, see .
*/
import * as utils from 'web3-utils';
+import { BlockTags } from 'web3-types';
import { Iban } from 'web3-eth-iban';
import {
inputAddressFormatter,
@@ -94,7 +95,7 @@ describe('formatters', () => {
expect(inputBlockNumberFormatter(undefined)).toBeUndefined();
});
- it.each([utils.BlockTags.EARLIEST, utils.BlockTags.LATEST, utils.BlockTags.PENDING])(
+ it.each([BlockTags.EARLIEST, BlockTags.LATEST, BlockTags.PENDING])(
'should return "%s" values for "%s" block numbers',
blockNumber => {
expect(inputBlockNumberFormatter(blockNumber)).toEqual(blockNumber);
diff --git a/packages/web3-core/test/unit/web3_batch_request.test.ts b/packages/web3-core/test/unit/web3_batch_request.test.ts
index 52803530544..7f5fc20ee24 100644
--- a/packages/web3-core/test/unit/web3_batch_request.test.ts
+++ b/packages/web3-core/test/unit/web3_batch_request.test.ts
@@ -15,13 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import {
- jsonRpc,
- JsonRpcBatchRequest,
- JsonRpcBatchResponse,
- JsonRpcOptionalRequest,
- DeferredPromise,
-} from 'web3-common';
+import { JsonRpcBatchRequest, JsonRpcBatchResponse, JsonRpcOptionalRequest } from 'web3-types';
+import { jsonRpc, Web3DeferredPromise } from 'web3-utils';
import { OperationAbortError, OperationTimeoutError } from 'web3-errors';
import { Web3BatchRequest } from '../../src/web3_batch_request';
@@ -75,7 +70,7 @@ describe('Web3BatchRequest', () => {
]);
const result = batchRequest.add({ id: 1, method: 'my_method', params: [] });
- expect(result).toBeInstanceOf(DeferredPromise);
+ expect(result).toBeInstanceOf(Web3DeferredPromise);
// Make sure request didn't timeout
await batchRequest.execute();
diff --git a/packages/web3-common/test/unit/web3_promi_event.test.ts b/packages/web3-core/test/unit/web3_promi_event.test.ts
similarity index 100%
rename from packages/web3-common/test/unit/web3_promi_event.test.ts
rename to packages/web3-core/test/unit/web3_promi_event.test.ts
diff --git a/packages/web3-core/test/unit/web3_request_manager.test.ts b/packages/web3-core/test/unit/web3_request_manager.test.ts
index 571abd691ca..5b2106937ee 100644
--- a/packages/web3-core/test/unit/web3_request_manager.test.ts
+++ b/packages/web3-core/test/unit/web3_request_manager.test.ts
@@ -16,15 +16,15 @@ along with web3.js. If not, see .
*/
import {
- InvalidResponseError,
Web3BaseProvider,
- jsonRpc,
JsonRpcPayload,
JsonRpcBatchRequest,
JsonRpcBatchResponse,
JsonRpcResponseWithError,
JsonRpcResponseWithResult,
-} from 'web3-common';
+} from 'web3-types';
+import { jsonRpc } from 'web3-utils';
+import { InvalidResponseError } from 'web3-errors';
import HttpProvider from 'web3-providers-http';
import WSProvider from 'web3-providers-ws';
import IpcProvider from 'web3-providers-ipc';
diff --git a/packages/web3-errors/package.json b/packages/web3-errors/package.json
index 1688cf00416..0dfb864978a 100644
--- a/packages/web3-errors/package.json
+++ b/packages/web3-errors/package.json
@@ -24,6 +24,9 @@
"test:unit": "jest --config=./test/unit/jest.config.js",
"test:integration": "jest --config=./test/integration/jest.config.js --runInBand --passWithNoTests"
},
+ "dependencies": {
+ "web3-types": "1.0.0-alpha.0"
+ },
"devDependencies": {
"@types/jest": "^27.0.3",
"@typescript-eslint/eslint-plugin": "^5.4.0",
diff --git a/packages/web3-errors/src/errors/connection_errors.ts b/packages/web3-errors/src/errors/connection_errors.ts
index 0b37523f586..4f36098cdc1 100644
--- a/packages/web3-errors/src/errors/connection_errors.ts
+++ b/packages/web3-errors/src/errors/connection_errors.ts
@@ -17,6 +17,7 @@ along with web3.js. If not, see .
/* eslint-disable max-classes-per-file */
+import { ConnectionEvent } from 'web3-types';
import {
ERR_CONN,
ERR_CONN_INVALID,
@@ -27,7 +28,6 @@ import {
ERR_CONN_PENDING_REQUESTS,
ERR_REQ_ALREADY_SENT,
} from '../error_codes';
-import { ConnectionEvent } from '../types';
import { Web3Error } from '../web3_error_base';
export class ConnectionError extends Web3Error {
diff --git a/packages/web3-common/src/errors.ts b/packages/web3-errors/src/errors/response_errors.ts
similarity index 67%
rename from packages/web3-common/src/errors.ts
rename to packages/web3-errors/src/errors/response_errors.ts
index b9580a6a52b..efc461f07f5 100644
--- a/packages/web3-common/src/errors.ts
+++ b/packages/web3-errors/src/errors/response_errors.ts
@@ -1,4 +1,4 @@
-/*
+/*
This file is part of web3.js.
web3.js is free software: you can redistribute it and/or modify
@@ -15,11 +15,23 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-/* eslint-disable max-classes-per-file */
+// eslint-disable-next-line max-classes-per-file
+import { JsonRpcResponse, JsonRpcResponseWithError } from 'web3-types';
+import { Web3Error } from '../web3_error_base';
+import { ERR_INVALID_RESPONSE, ERR_RESPONSE } from '../error_codes';
-import { ERR_INVALID_RESPONSE, ERR_RESPONSE, Web3Error } from 'web3-errors';
-import { isResponseWithError } from './json_rpc';
-import { JsonRpcResponse } from './types';
+// To avoid circular package dependency, copied to code here. If you update this please update same function in `json_rpc.ts`
+const isResponseWithError = (
+ response: JsonRpcResponse,
+): response is JsonRpcResponseWithError =>
+ !Array.isArray(response) &&
+ response.jsonrpc === '2.0' &&
+ !!response &&
+ // eslint-disable-next-line no-null/no-null
+ (response.result === undefined || response.result === null) &&
+ // JSON RPC consider "null" as valid response
+ 'error' in response &&
+ (typeof response.id === 'number' || typeof response.id === 'string');
const buildErrorMessage = (response: JsonRpcResponse): string =>
isResponseWithError(response) ? response.error.message : '';
diff --git a/packages/web3-errors/src/errors/transaction_errors.ts b/packages/web3-errors/src/errors/transaction_errors.ts
index db00bddeb45..a4183d04447 100644
--- a/packages/web3-errors/src/errors/transaction_errors.ts
+++ b/packages/web3-errors/src/errors/transaction_errors.ts
@@ -17,6 +17,7 @@ along with web3.js. If not, see .
/* eslint-disable max-classes-per-file */
+import { TransactionReceipt } from 'web3-types';
import {
ERR_RAW_TX_UNDEFINED,
ERR_TX,
@@ -28,7 +29,6 @@ import {
ERR_TX_REVERT_WITHOUT_REASON,
ERR_TX_NOT_FOUND,
} from '../error_codes';
-import { TransactionReceipt } from '../types';
import { Web3Error } from '../web3_error_base';
export class TransactionError extends Web3Error {
diff --git a/packages/web3-errors/src/index.ts b/packages/web3-errors/src/index.ts
index a881ca47072..d5af982ae7f 100644
--- a/packages/web3-errors/src/index.ts
+++ b/packages/web3-errors/src/index.ts
@@ -17,7 +17,6 @@ along with web3.js. If not, see .
export * from './error_codes';
export * from './web3_error_base';
-export * from './types';
export * from './errors/account_errors';
export * from './errors/connection_errors';
export * from './errors/contract_errors';
@@ -27,3 +26,4 @@ export * from './errors/provider_errors';
export * from './errors/signature_errors';
export * from './errors/transaction_errors';
export * from './errors/utils_errors';
+export * from './errors/response_errors';
diff --git a/packages/web3-errors/src/types.ts b/packages/web3-errors/src/types.ts
deleted file mode 100644
index 866b1c435f8..00000000000
--- a/packages/web3-errors/src/types.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-This file is part of web3.js.
-
-web3.js is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-web3.js is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with web3.js. If not, see .
-*/
-
-// duplicate types from web3-common for avoiding cyclic dep between web3-errors and web3-common
-export type ConnectionEvent = {
- code: number;
- reason: string;
- wasClean?: boolean; // if WS connection was closed properly
-};
-
-// To avoid dependency of `web3-common` have to use fixed types
-export type Log = {
- readonly removed?: boolean;
- readonly logIndex?: bigint;
- readonly transactionIndex?: bigint;
- readonly transactionHash?: string;
- readonly blockHash?: string;
- readonly blockNumber?: bigint;
- readonly address?: string;
- readonly data?: string;
- readonly topics?: string[];
-};
-
-export type TransactionReceipt = {
- readonly logs: Record[];
- readonly [key: string]: unknown;
-};
diff --git a/packages/web3-errors/src/web3_error_base.ts b/packages/web3-errors/src/web3_error_base.ts
index 6c4e546a40c..dabaf8c05ca 100644
--- a/packages/web3-errors/src/web3_error_base.ts
+++ b/packages/web3-errors/src/web3_error_base.ts
@@ -17,7 +17,9 @@ along with web3.js. If not, see .
/* eslint-disable max-classes-per-file */
-export abstract class Web3Error extends Error {
+import { Web3Error as ErrorInterface } from 'web3-types';
+
+export abstract class Web3Error extends Error implements ErrorInterface {
public readonly name: string;
public abstract readonly code: number;
public stack: string | undefined;
diff --git a/packages/web3-errors/test/unit/__snapshots__/errors.test.ts.snap b/packages/web3-errors/test/unit/__snapshots__/errors.test.ts.snap
index a54bd99ff9b..974cbc16369 100644
--- a/packages/web3-errors/test/unit/__snapshots__/errors.test.ts.snap
+++ b/packages/web3-errors/test/unit/__snapshots__/errors.test.ts.snap
@@ -140,6 +140,18 @@ Object {
}
`;
+exports[`errors InvalidResponseError should have valid json structure 1`] = `
+Object {
+ "code": 101,
+ "data": Object {
+ "a": "10",
+ "b": "20",
+ },
+ "message": "Returned error: error message",
+ "name": "InvalidResponseError",
+}
+`;
+
exports[`errors MaxAttemptsReachedOnReconnectingError should have valid json structure 1`] = `
Object {
"code": 505,
@@ -180,6 +192,27 @@ Object {
}
`;
+exports[`errors ResponseError should have valid json structure with data 1`] = `
+Object {
+ "code": 100,
+ "data": Object {
+ "a": "10",
+ "b": "20",
+ },
+ "message": "Returned error: error message",
+ "name": "ResponseError",
+}
+`;
+
+exports[`errors ResponseError should have valid json structure without data 1`] = `
+Object {
+ "code": 100,
+ "data": undefined,
+ "message": "Returned error: error message",
+ "name": "ResponseError",
+}
+`;
+
exports[`errors RevertInstructionError should have valid json structure 1`] = `
Object {
"code": 401,
diff --git a/packages/web3-errors/test/unit/errors.test.ts b/packages/web3-errors/test/unit/errors.test.ts
index 43cf976c563..7300fb9d924 100644
--- a/packages/web3-errors/test/unit/errors.test.ts
+++ b/packages/web3-errors/test/unit/errors.test.ts
@@ -24,9 +24,10 @@ import * as providerErrors from '../../src/errors/provider_errors';
import * as signatureErrors from '../../src/errors/signature_errors';
import * as transactionErrors from '../../src/errors/transaction_errors';
import * as utilsErrors from '../../src/errors/utils_errors';
+import * as responseErrors from '../../src/errors/response_errors';
import { ConvertValueToString } from '../fixtures/errors';
-import { Web3Error } from '../../dist/web3_error_base';
+import { Web3Error } from '../../src/web3_error_base';
describe('errors', () => {
describe('error convertToString', () => {
@@ -266,4 +267,38 @@ describe('errors', () => {
).toMatchSnapshot();
});
});
+
+ describe('ResponseError', () => {
+ it('should have valid json structure with data', () => {
+ expect(
+ new responseErrors.ResponseError({
+ id: 1,
+ jsonrpc: '2.0',
+ error: { code: 123, message: 'error message', data: { a: '10', b: '20' } },
+ }).toJSON(),
+ ).toMatchSnapshot();
+ });
+
+ it('should have valid json structure without data', () => {
+ expect(
+ new responseErrors.ResponseError({
+ id: 1,
+ jsonrpc: '2.0',
+ error: { code: 123, message: 'error message', data: undefined },
+ }).toJSON(),
+ ).toMatchSnapshot();
+ });
+ });
+
+ describe('InvalidResponseError', () => {
+ it('should have valid json structure', () => {
+ expect(
+ new responseErrors.InvalidResponseError({
+ id: 1,
+ jsonrpc: '2.0',
+ error: { code: 123, message: 'error message', data: { a: '10', b: '20' } },
+ }).toJSON(),
+ ).toMatchSnapshot();
+ });
+ });
});
diff --git a/packages/web3-eth-abi/package.json b/packages/web3-eth-abi/package.json
index e574fb99868..b664aab2b5c 100644
--- a/packages/web3-eth-abi/package.json
+++ b/packages/web3-eth-abi/package.json
@@ -27,7 +27,7 @@
"dependencies": {
"web3-errors": "1.0.0-alpha.0",
"@ethersproject/abi": "^5.0.7",
- "web3-common": "^1.0.0-alpha.0",
+ "web3-types": "^1.0.0-alpha.0",
"web3-utils": "^4.0.0-alpha.1"
},
"devDependencies": {
diff --git a/packages/web3-eth-abi/src/api/logs_api.ts b/packages/web3-eth-abi/src/api/logs_api.ts
index 92e6bfbffff..7a0848913e2 100644
--- a/packages/web3-eth-abi/src/api/logs_api.ts
+++ b/packages/web3-eth-abi/src/api/logs_api.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString } from 'web3-utils';
+import { HexString } from 'web3-types';
import { AbiParameter } from '../types';
import { decodeParameter, decodeParametersWith } from './parameters_api';
diff --git a/packages/web3-eth-abi/src/api/parameters_api.ts b/packages/web3-eth-abi/src/api/parameters_api.ts
index 8fd701f2b63..4f41261b2be 100644
--- a/packages/web3-eth-abi/src/api/parameters_api.ts
+++ b/packages/web3-eth-abi/src/api/parameters_api.ts
@@ -17,7 +17,7 @@ along with web3.js. If not, see .
import { AbiError } from 'web3-errors';
import { ParamType } from '@ethersproject/abi';
-import { HexString } from 'web3-utils';
+import { HexString } from 'web3-types';
import ethersAbiCoder from '../ethers_abi_coder';
import { AbiInput } from '../types';
import { formatParam, isAbiFragment, mapTypes, modifyParams } from '../utils';
diff --git a/packages/web3-eth-abi/src/types.ts b/packages/web3-eth-abi/src/types.ts
index 9ac5fa4c65a..89bf69b3964 100644
--- a/packages/web3-eth-abi/src/types.ts
+++ b/packages/web3-eth-abi/src/types.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, Bytes, FixedSizeArray, Numbers } from 'web3-utils';
+import { Address, Bytes, FixedSizeArray, Numbers } from 'web3-types';
import { ConvertToNumber } from './number_map_type';
export interface AbiStruct {
diff --git a/packages/web3-eth-abi/test/unit/types.test.ts b/packages/web3-eth-abi/test/unit/types.test.ts
index 07c3dd7a6e7..773ab6e7ede 100644
--- a/packages/web3-eth-abi/test/unit/types.test.ts
+++ b/packages/web3-eth-abi/test/unit/types.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, Bytes, Numbers } from 'web3-utils';
+import { Address, Bytes, Numbers } from 'web3-types';
import { expectTypeOf, typecheck } from '@humeris/espresso-shot';
import { MatchPrimitiveType } from '../../src/types';
diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json
index ec28624b803..f02e94137cd 100644
--- a/packages/web3-eth-accounts/package.json
+++ b/packages/web3-eth-accounts/package.json
@@ -43,7 +43,7 @@
"web3-errors": "1.0.0-alpha.0",
"@ethereumjs/tx": "^3.4.0",
"ethereum-cryptography": "^1.1.0",
- "web3-common": "^1.0.0-alpha.0",
+ "web3-types": "^1.0.0-alpha.0",
"web3-utils": "^4.0.0-alpha.1",
"web3-validator": "^0.1.0-alpha.0"
}
diff --git a/packages/web3-eth-accounts/src/account.ts b/packages/web3-eth-accounts/src/account.ts
index 214821e8596..be7907640cd 100644
--- a/packages/web3-eth-accounts/src/account.ts
+++ b/packages/web3-eth-accounts/src/account.ts
@@ -33,12 +33,10 @@ import {
SignerError,
UndefinedRawTransactionError,
} from 'web3-errors';
+import { Address, Bytes, HexString } from 'web3-types';
import {
- Address,
- Bytes,
bytesToBuffer,
bytesToHex,
- HexString,
hexToBytes,
isHexStrict,
numberToHex,
diff --git a/packages/web3-eth-accounts/src/types.ts b/packages/web3-eth-accounts/src/types.ts
index dcb3f00dc58..90b3de55115 100644
--- a/packages/web3-eth-accounts/src/types.ts
+++ b/packages/web3-eth-accounts/src/types.ts
@@ -16,8 +16,7 @@ along with web3.js. If not, see .
*/
import { FeeMarketEIP1559TxData, AccessListEIP2930TxData, TxData } from '@ethereumjs/tx';
-import { Web3BaseWalletAccount } from 'web3-common';
-import { HexString } from 'web3-utils';
+import { Web3BaseWalletAccount, HexString } from 'web3-types';
export type SignatureObject = {
messageHash: string;
diff --git a/packages/web3-eth-accounts/src/wallet.ts b/packages/web3-eth-accounts/src/wallet.ts
index 32e1751a692..babf0c5a85f 100644
--- a/packages/web3-eth-accounts/src/wallet.ts
+++ b/packages/web3-eth-accounts/src/wallet.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Web3BaseWallet, Web3BaseWalletAccount, Web3EncryptedWallet } from 'web3-common';
+import { Web3BaseWallet, Web3BaseWalletAccount, Web3EncryptedWallet } from 'web3-types';
import { isNullish } from 'web3-validator';
import { WebStorage } from './types';
diff --git a/packages/web3-eth-accounts/test/unit/account.test.ts b/packages/web3-eth-accounts/test/unit/account.test.ts
index a51cc57c080..ddb6d6ce9d0 100644
--- a/packages/web3-eth-accounts/test/unit/account.test.ts
+++ b/packages/web3-eth-accounts/test/unit/account.test.ts
@@ -16,7 +16,8 @@ along with web3.js. If not, see .
*/
import { TransactionFactory } from '@ethereumjs/tx';
-import { Address, isHexStrict } from 'web3-utils';
+import { Address } from 'web3-types';
+import { isHexStrict } from 'web3-utils';
import { Web3ValidatorError } from 'web3-validator';
import {
create,
diff --git a/packages/web3-eth-accounts/test/unit/wallet.test.ts b/packages/web3-eth-accounts/test/unit/wallet.test.ts
index 40cbe6a2612..4373a71305a 100644
--- a/packages/web3-eth-accounts/test/unit/wallet.test.ts
+++ b/packages/web3-eth-accounts/test/unit/wallet.test.ts
@@ -18,7 +18,7 @@ along with web3.js. If not, see .
/* eslint-disable @typescript-eslint/no-magic-numbers */
import { when } from 'jest-when';
-import { Web3AccountProvider, Web3BaseWalletAccount } from 'web3-common';
+import { Web3AccountProvider, Web3BaseWalletAccount } from 'web3-types';
import { Wallet } from '../../src/wallet';
describe('Wallet', () => {
diff --git a/packages/web3-eth-contract/package.json b/packages/web3-eth-contract/package.json
index 66e0b7ecff2..ec541a96402 100644
--- a/packages/web3-eth-contract/package.json
+++ b/packages/web3-eth-contract/package.json
@@ -29,7 +29,7 @@
},
"dependencies": {
"web3-errors": "1.0.0-alpha.0",
- "web3-common": "1.0.0-alpha.0",
+ "web3-types": "1.0.0-alpha.0",
"web3-core": "4.0.0-alpha.0",
"web3-eth-abi": "4.0.0-alpha.0",
"web3-utils": "4.0.0-alpha.1",
diff --git a/packages/web3-eth-contract/src/contract.ts b/packages/web3-eth-contract/src/contract.ts
index 895f0af0388..2c979ea6f7e 100644
--- a/packages/web3-eth-contract/src/contract.ts
+++ b/packages/web3-eth-contract/src/contract.ts
@@ -16,20 +16,13 @@ along with web3.js. If not, see .
*/
import {
- DataFormat,
- DEFAULT_RETURN_FORMAT,
- EthExecutionAPI,
- format,
inputAddressFormatter,
inputLogFormatter,
- isDataFormat,
- LogsInput,
- Mutable,
- TransactionReceipt,
+ Web3Context,
Web3EventEmitter,
Web3PromiEvent,
-} from 'web3-common';
-import { Web3Context } from 'web3-core';
+} from 'web3-core';
+import { SubscriptionError } from 'web3-errors';
import {
call,
estimateGas,
@@ -60,12 +53,20 @@ import {
BlockNumberOrTag,
BlockTags,
Bytes,
+ EthExecutionAPI,
Filter,
HexString,
+ LogsInput,
+ Mutable,
+} from 'web3-types';
+import {
+ DataFormat,
+ DEFAULT_RETURN_FORMAT,
+ format,
+ isDataFormat,
toChecksumAddress,
} from 'web3-utils';
import { isNullish, validator } from 'web3-validator';
-import { SubscriptionError } from 'web3-errors';
import { ALL_EVENTS_ABI } from './constants';
import { decodeEventABI, decodeMethodReturn, encodeEventABI, encodeMethodABI } from './encoding';
import { Web3ContractError } from './errors';
@@ -998,10 +999,7 @@ export class Contract
return sendTransaction(this, tx, DEFAULT_RETURN_FORMAT, {
transactionResolver: receipt => {
if (receipt.status === BigInt(0)) {
- throw new Web3ContractError(
- "code couldn't be stored",
- receipt as TransactionReceipt,
- );
+ throw new Web3ContractError("code couldn't be stored", receipt);
}
const newContract = this.clone();
diff --git a/packages/web3-eth-contract/src/encoding.ts b/packages/web3-eth-contract/src/encoding.ts
index b4104337657..7fe947de3cd 100644
--- a/packages/web3-eth-contract/src/encoding.ts
+++ b/packages/web3-eth-contract/src/encoding.ts
@@ -15,7 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { inputBlockNumberFormatter, LogsInput, outputLogFormatter } from 'web3-common';
+import { LogsInput, BlockNumberOrTag, Filter, HexString, Topic } from 'web3-types';
+import { inputBlockNumberFormatter, outputLogFormatter } from 'web3-core';
import {
AbiConstructorFragment,
AbiEventFragment,
@@ -29,7 +30,7 @@ import {
isAbiConstructorFragment,
jsonInterfaceMethodToString,
} from 'web3-eth-abi';
-import { BlockNumberOrTag, Filter, HexString, isNullish, Topic } from 'web3-utils';
+import { isNullish } from 'web3-utils';
import { Web3ContractError } from './errors';
// eslint-disable-next-line import/no-cycle
import { ContractAbiWithSignature, ContractOptions, EventLog } from './types';
diff --git a/packages/web3-eth-contract/src/errors.ts b/packages/web3-eth-contract/src/errors.ts
index 3a968fb32b6..115e3aabd5e 100644
--- a/packages/web3-eth-contract/src/errors.ts
+++ b/packages/web3-eth-contract/src/errors.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { TransactionReceipt } from 'web3-common';
+import { TransactionReceipt } from 'web3-types';
import { ERR_CONTRACT, Web3Error } from 'web3-errors';
export class Web3ContractError extends Web3Error {
diff --git a/packages/web3-eth-contract/src/log_subscription.ts b/packages/web3-eth-contract/src/log_subscription.ts
index e1539cda841..bd8a10dd239 100644
--- a/packages/web3-eth-contract/src/log_subscription.ts
+++ b/packages/web3-eth-contract/src/log_subscription.ts
@@ -15,10 +15,9 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { LogsInput } from 'web3-common';
+import { LogsInput, HexString, Topic } from 'web3-types';
import { Web3RequestManager, Web3Subscription } from 'web3-core';
import { AbiEventFragment } from 'web3-eth-abi';
-import { HexString, Topic } from 'web3-utils';
// eslint-disable-next-line import/no-cycle
import { decodeEventABI } from './encoding';
// eslint-disable-next-line import/no-cycle
diff --git a/packages/web3-eth-contract/src/types.ts b/packages/web3-eth-contract/src/types.ts
index 7785ae723f9..b63ce7841cf 100644
--- a/packages/web3-eth-contract/src/types.ts
+++ b/packages/web3-eth-contract/src/types.ts
@@ -15,29 +15,26 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import {
- DataFormat,
- DEFAULT_RETURN_FORMAT,
- EthExecutionAPI,
- FormatType,
- Web3PromiEvent,
-} from 'web3-common';
-import { SupportedProviders, Web3ContextInitOptions } from 'web3-core';
+import { Web3ContextInitOptions, Web3PromiEvent } from 'web3-core';
+import { NewHeadsSubscription, SendTransactionEvents } from 'web3-eth';
import { AbiFragment } from 'web3-eth-abi';
-import { SendTransactionEvents, TransactionReceipt, NewHeadsSubscription } from 'web3-eth';
import {
Address,
BlockNumberOrTag,
Bytes,
+ EthExecutionAPI,
HexString,
HexString32Bytes,
Numbers,
+ SupportedProviders,
+ TransactionReceipt,
Uint,
-} from 'web3-utils';
+} from 'web3-types';
+import { DataFormat, DEFAULT_RETURN_FORMAT, FormatType } from 'web3-utils';
// eslint-disable-next-line import/no-cycle
import { LogsSubscription } from './log_subscription';
-export type { TransactionReceipt } from 'web3-common';
+export type { TransactionReceipt } from 'web3-types';
export type ContractAbiWithSignature = ReadonlyArray;
export interface EventLog {
diff --git a/packages/web3-eth-contract/src/utils.ts b/packages/web3-eth-contract/src/utils.ts
index a2d584f9cea..ade3d19d700 100644
--- a/packages/web3-eth-contract/src/utils.ts
+++ b/packages/web3-eth-contract/src/utils.ts
@@ -15,10 +15,9 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { TransactionWithSender } from 'web3-common';
+import { TransactionWithSenderAPI, TransactionCall, HexString } from 'web3-types';
import { AbiFunctionFragment } from 'web3-eth-abi';
-import { HexString, isNullish, mergeDeep } from 'web3-utils';
-import { TransactionCall } from 'web3-eth';
+import { isNullish, mergeDeep } from 'web3-utils';
import { encodeMethodABI } from './encoding';
import { Web3ContractError } from './errors';
import {
@@ -116,7 +115,7 @@ export const getEstimateGasParams = ({
params: unknown[];
options?: PayableCallOptions | NonPayableCallOptions;
contractOptions: ContractOptions;
-}): Partial => {
+}): Partial => {
let txParams = mergeDeep(
{
to: contractOptions.address,
@@ -135,7 +134,7 @@ export const getEstimateGasParams = ({
};
}
- return txParams as TransactionWithSender;
+ return txParams as TransactionWithSenderAPI;
};
export const isContractInitOptions = (options: unknown): options is ContractOptions =>
diff --git a/packages/web3-eth-contract/test/fixtures/encoding.ts b/packages/web3-eth-contract/test/fixtures/encoding.ts
index b7bd50c46e9..21e12dcb012 100644
--- a/packages/web3-eth-contract/test/fixtures/encoding.ts
+++ b/packages/web3-eth-contract/test/fixtures/encoding.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { AbiEventFragment } from 'web3-eth-abi';
-import { LogsInput } from 'web3-common';
+import { LogsInput } from 'web3-types';
export const decodeEventABIData: [AbiEventFragment & { signature: string }, LogsInput, any][] = [
[
diff --git a/packages/web3-eth-contract/test/fixtures/erc20.ts b/packages/web3-eth-contract/test/fixtures/erc20.ts
index c00b0141b54..cf4b595ec8d 100644
--- a/packages/web3-eth-contract/test/fixtures/erc20.ts
+++ b/packages/web3-eth-contract/test/fixtures/erc20.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, Numbers } from 'web3-utils';
+import { Address, Numbers } from 'web3-types';
import { LogsSubscription } from '../../src/log_subscription';
import { ContractEventOptions, PayableMethodObject, NonPayableMethodObject } from '../../src/types';
diff --git a/packages/web3-eth-contract/test/fixtures/erc721.ts b/packages/web3-eth-contract/test/fixtures/erc721.ts
index 789ac8e6b47..36c87289c24 100644
--- a/packages/web3-eth-contract/test/fixtures/erc721.ts
+++ b/packages/web3-eth-contract/test/fixtures/erc721.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, Numbers } from 'web3-utils';
+import { Address, Numbers } from 'web3-types';
import { LogsSubscription } from '../../src/log_subscription';
import { ContractEventOptions, NonPayableMethodObject, PayableMethodObject } from '../../src/types';
diff --git a/packages/web3-eth-contract/test/integration/contract_defaults.test.ts b/packages/web3-eth-contract/test/integration/contract_defaults.test.ts
index f4193545053..1233409b054 100644
--- a/packages/web3-eth-contract/test/integration/contract_defaults.test.ts
+++ b/packages/web3-eth-contract/test/integration/contract_defaults.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Web3BaseProvider } from 'web3-common';
+import { Web3BaseProvider } from 'web3-types';
import { Contract } from '../../src';
import { GreeterBytecode, GreeterAbi } from '../shared_fixtures/build/Greeter';
import { getSystemTestProvider, getSystemTestAccounts } from '../fixtures/system_test_utils';
diff --git a/packages/web3-eth-contract/test/unit/encoding.ts b/packages/web3-eth-contract/test/unit/encoding.ts
index 9959fab7e27..36f465f2870 100644
--- a/packages/web3-eth-contract/test/unit/encoding.ts
+++ b/packages/web3-eth-contract/test/unit/encoding.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { AbiEventFragment } from 'web3-eth-abi';
-import { LogsInput } from 'web3-common';
+import { LogsInput } from 'web3-types';
import { decodeEventABI } from '../../src/encoding';
import { decodeEventABIData } from '../fixtures/encoding';
diff --git a/packages/web3-eth-ens/package.json b/packages/web3-eth-ens/package.json
index 871522fbb22..773ea6e154d 100644
--- a/packages/web3-eth-ens/package.json
+++ b/packages/web3-eth-ens/package.json
@@ -43,7 +43,7 @@
"dependencies": {
"web3-errors": "1.0.0-alpha.0",
"idna-uts46-hx": "^3.4.0",
- "web3-common": "^1.0.0-alpha.0",
+ "web3-types": "^1.0.0-alpha.0",
"web3-core": "^4.0.0-alpha.0",
"web3-eth": "^4.0.0-alpha.1",
"web3-eth-contract": "^4.0.0-alpha.0",
diff --git a/packages/web3-eth-ens/src/ens.ts b/packages/web3-eth-ens/src/ens.ts
index 3def9025174..878095216b1 100644
--- a/packages/web3-eth-ens/src/ens.ts
+++ b/packages/web3-eth-ens/src/ens.ts
@@ -15,16 +15,16 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { getBlock, TransactionReceipt } from 'web3-eth';
+import { getBlock } from 'web3-eth';
import {
RevertInstructionError,
ENSNetworkNotSyncedError,
ENSUnsupportedNetworkError,
} from 'web3-errors';
-import { Web3Context, SupportedProviders, Web3ContextObject } from 'web3-core';
+import { Web3Context, Web3ContextObject } from 'web3-core';
import { getId, Web3NetAPI } from 'web3-net';
-import { Address } from 'web3-utils';
-import { EthExecutionAPI, DEFAULT_RETURN_FORMAT, FormatType, FMT_NUMBER } from 'web3-common';
+import { Address, SupportedProviders, EthExecutionAPI, TransactionReceipt } from 'web3-types';
+import { DEFAULT_RETURN_FORMAT, FormatType, FMT_NUMBER } from 'web3-utils';
import { NonPayableCallOptions, Contract } from 'web3-eth-contract';
import { RESOLVER } from './abi/resolver';
import { Registry } from './registry';
diff --git a/packages/web3-eth-ens/src/registry.ts b/packages/web3-eth-ens/src/registry.ts
index 93ce61b5262..9805ae0c255 100644
--- a/packages/web3-eth-ens/src/registry.ts
+++ b/packages/web3-eth-ens/src/registry.ts
@@ -15,9 +15,10 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { inputAddressFormatter } from 'web3-common';
+import { inputAddressFormatter } from 'web3-core';
import { Contract, NonPayableCallOptions } from 'web3-eth-contract';
-import { Address, isHexStrict, sha3Raw } from 'web3-utils';
+import { isHexStrict, sha3Raw } from 'web3-utils';
+import { Address } from 'web3-types';
import REGISTRY from './abi/registry';
import { RESOLVER } from './abi/resolver';
import { registryAddresses } from './config';
diff --git a/packages/web3-eth-ens/src/resolver.ts b/packages/web3-eth-ens/src/resolver.ts
index 35b32be5d52..f1c42af3b09 100644
--- a/packages/web3-eth-ens/src/resolver.ts
+++ b/packages/web3-eth-ens/src/resolver.ts
@@ -15,10 +15,11 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, sha3, isHexStrict, isNullish } from 'web3-utils';
+import { sha3, isHexStrict, isNullish } from 'web3-utils';
import { Contract, NonPayableCallOptions } from 'web3-eth-contract';
-import { inputAddressFormatter } from 'web3-common';
+import { inputAddressFormatter } from 'web3-core';
import { ResolverMethodMissingError } from 'web3-errors';
+import { Address } from 'web3-types';
import { interfaceIds, methodsInInterface } from './config';
import { Registry } from './registry';
import { RESOLVER } from './abi/resolver';
diff --git a/packages/web3-eth-iban/package.json b/packages/web3-eth-iban/package.json
index c1c2d45b524..4d271a0d088 100644
--- a/packages/web3-eth-iban/package.json
+++ b/packages/web3-eth-iban/package.json
@@ -40,6 +40,7 @@
},
"dependencies": {
"web3-errors": "1.0.0-alpha.0",
- "web3-utils": "4.0.0-alpha.1"
+ "web3-utils": "4.0.0-alpha.1",
+ "web3-types": "1.0.0-alpha.0"
}
}
diff --git a/packages/web3-eth-iban/src/iban.ts b/packages/web3-eth-iban/src/iban.ts
index 2dee4210e3e..9ecf3892d80 100644
--- a/packages/web3-eth-iban/src/iban.ts
+++ b/packages/web3-eth-iban/src/iban.ts
@@ -15,7 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { toChecksumAddress, isAddress, leftPad, hexToNumber, HexString } from 'web3-utils';
+import { HexString } from 'web3-types';
+import { toChecksumAddress, isAddress, leftPad, hexToNumber } from 'web3-utils';
import { InvalidAddressError } from 'web3-errors';
import { IbanOptions } from './types';
diff --git a/packages/web3-eth-personal/package.json b/packages/web3-eth-personal/package.json
index e52865930c5..09c3e89f579 100644
--- a/packages/web3-eth-personal/package.json
+++ b/packages/web3-eth-personal/package.json
@@ -25,7 +25,7 @@
"test:integration": "jest --config=./test/integration/jest.config.js --runInBand"
},
"dependencies": {
- "web3-common": "1.0.0-alpha.0",
+ "web3-types": "1.0.0-alpha.0",
"web3-core": "4.0.0-alpha.0",
"web3-utils": "4.0.0-alpha.1",
"web3-eth": "4.0.0-alpha.1",
diff --git a/packages/web3-eth-personal/src/eth_personal_api.ts b/packages/web3-eth-personal/src/eth_personal_api.ts
index b17b335ee8f..f89f821eff2 100644
--- a/packages/web3-eth-personal/src/eth_personal_api.ts
+++ b/packages/web3-eth-personal/src/eth_personal_api.ts
@@ -15,8 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, HexString } from 'web3-utils';
-import { Transaction } from 'web3-eth';
+import { Address, HexString, Transaction } from 'web3-types';
export type EthPersonalAPI = {
personal_listAccounts: () => Address[];
diff --git a/packages/web3-eth-personal/src/personal.ts b/packages/web3-eth-personal/src/personal.ts
index 0981bf9ae80..11b8c9623f4 100644
--- a/packages/web3-eth-personal/src/personal.ts
+++ b/packages/web3-eth-personal/src/personal.ts
@@ -16,8 +16,7 @@ along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { Transaction } from 'web3-eth';
-import { Address, HexString } from 'web3-utils';
+import { Address, HexString, Transaction } from 'web3-types';
import { EthPersonalAPI } from './eth_personal_api';
import * as rpcWrappers from './rpc_method_wrappers';
diff --git a/packages/web3-eth-personal/src/rcp_methods.ts b/packages/web3-eth-personal/src/rcp_methods.ts
index 14431375755..ba2a5b14965 100644
--- a/packages/web3-eth-personal/src/rcp_methods.ts
+++ b/packages/web3-eth-personal/src/rcp_methods.ts
@@ -15,8 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Transaction } from 'web3-eth';
-import { Address, HexString } from 'web3-utils';
+import { Address, HexString, Transaction } from 'web3-types';
import { EthPersonalAPIManager } from './types';
export const getAccounts = async (requestManager: EthPersonalAPIManager) =>
diff --git a/packages/web3-eth-personal/src/rpc_method_wrappers.ts b/packages/web3-eth-personal/src/rpc_method_wrappers.ts
index b840defee53..9102af06350 100644
--- a/packages/web3-eth-personal/src/rpc_method_wrappers.ts
+++ b/packages/web3-eth-personal/src/rpc_method_wrappers.ts
@@ -15,9 +15,9 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { ETH_DATA_FORMAT } from 'web3-common';
-import { formatTransaction, Transaction } from 'web3-eth';
-import { Address, HexString, isHexStrict, toChecksumAddress, utf8ToHex } from 'web3-utils';
+import { ETH_DATA_FORMAT, isHexStrict, toChecksumAddress, utf8ToHex } from 'web3-utils';
+import { formatTransaction } from 'web3-eth';
+import { Address, HexString, Transaction } from 'web3-types';
import { validator } from 'web3-validator';
import {
getAccounts as rpcGetAccounts,
diff --git a/packages/web3-eth-personal/test/unit/eth_personal.test.ts b/packages/web3-eth-personal/test/unit/eth_personal.test.ts
index cfb0fbcaaf9..7e747a9b535 100644
--- a/packages/web3-eth-personal/test/unit/eth_personal.test.ts
+++ b/packages/web3-eth-personal/test/unit/eth_personal.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { ETH_DATA_FORMAT } from 'web3-common';
+import { ETH_DATA_FORMAT } from 'web3-utils';
import * as utils from 'web3-utils';
import * as eth from 'web3-eth';
import { validator } from 'web3-validator';
diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json
index 16b2e7de5a5..c66846b01d8 100644
--- a/packages/web3-eth/package.json
+++ b/packages/web3-eth/package.json
@@ -47,7 +47,7 @@
"dependencies": {
"@ethereumjs/common": "^2.6.1",
"@ethereumjs/tx": "^3.4.0",
- "web3-common": "1.0.0-alpha.0",
+ "web3-types": "1.0.0-alpha.0",
"web3-core": "4.0.0-alpha.0",
"web3-errors": "1.0.0-alpha.0",
"web3-eth-accounts": "4.0.0-alpha.0",
diff --git a/packages/web3-eth/src/constants.ts b/packages/web3-eth/src/constants.ts
index bceb0ed21ae..28671a898d7 100644
--- a/packages/web3-eth/src/constants.ts
+++ b/packages/web3-eth/src/constants.ts
@@ -14,6 +14,6 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { FMT_BYTES, FMT_NUMBER } from 'web3-common';
+import { FMT_BYTES, FMT_NUMBER } from 'web3-utils';
export const NUMBER_DATA_FORMAT = { bytes: FMT_BYTES.HEX, number: FMT_NUMBER.NUMBER } as const;
diff --git a/packages/web3-eth/src/errors.ts b/packages/web3-eth/src/errors.ts
index 4f1153eb459..7b11b2bd5ac 100644
--- a/packages/web3-eth/src/errors.ts
+++ b/packages/web3-eth/src/errors.ts
@@ -42,9 +42,7 @@ import {
ERR_SIGNATURE_FAILED,
InvalidValueError,
} from 'web3-errors';
-import { Bytes, HexString, Numbers } from 'web3-utils';
-
-import { TransactionReceipt } from './types';
+import { Bytes, HexString, Numbers, TransactionReceipt } from 'web3-types';
export class InvalidTransactionWithSender extends InvalidValueError {
public code = ERR_TX_INVALID_SENDER;
diff --git a/packages/web3-eth/src/rpc_method_wrappers.ts b/packages/web3-eth/src/rpc_method_wrappers.ts
index df16307aebe..4b7dee6522c 100644
--- a/packages/web3-eth/src/rpc_method_wrappers.ts
+++ b/packages/web3-eth/src/rpc_method_wrappers.ts
@@ -18,20 +18,11 @@ along with web3.js. If not, see .
// Disabling because returnTypes must be last param to match 1.x params
/* eslint-disable default-param-last */
import {
- DataFormat,
EthExecutionAPI,
- format,
- Web3PromiEvent,
- DEFAULT_RETURN_FORMAT,
TransactionInfo,
- TransactionWithSender,
- FormatType,
- SignedTransactionInfo,
- ETH_DATA_FORMAT,
+ TransactionWithSenderAPI,
+ SignedTransactionInfoAPI,
Web3BaseWalletAccount,
-} from 'web3-common';
-import { Web3Context } from 'web3-core';
-import {
Address,
BlockTag,
BlockNumberOrTag,
@@ -40,7 +31,17 @@ import {
HexString,
Numbers,
HexStringBytes,
-} from 'web3-utils';
+ AccountObject,
+ Block,
+ FeeHistory,
+ Log,
+ TransactionReceipt,
+ Transaction,
+ TransactionCall,
+ TransactionWithLocalWalletIndex,
+} from 'web3-types';
+import { Web3Context, Web3PromiEvent } from 'web3-core';
+import { ETH_DATA_FORMAT, FormatType, DataFormat, DEFAULT_RETURN_FORMAT, format } from 'web3-utils';
import { isBlockTag, isBytes, isNullish, isString } from 'web3-validator';
import { TransactionError } from 'web3-errors';
import { SignatureError } from './errors';
@@ -54,18 +55,10 @@ import {
transactionInfoSchema,
} from './schemas';
import {
- AccountObject,
- Block,
- FeeHistory,
- Log,
- TransactionReceipt,
SendSignedTransactionEvents,
SendSignedTransactionOptions,
SendTransactionEvents,
SendTransactionOptions,
- Transaction,
- TransactionCall,
- TransactionWithLocalWalletIndex,
} from './types';
// eslint-disable-next-line import/no-cycle
import { getTransactionFromAttr } from './utils/transaction_builder';
@@ -550,7 +543,7 @@ export function sendTransaction<
} else {
transactionHash = await rpcMethods.sendTransaction(
web3Context.requestManager,
- transactionFormatted as Partial,
+ transactionFormatted as Partial,
);
}
@@ -825,7 +818,7 @@ export async function signTransaction(
const unformattedResponse = isString(response as HexStringBytes)
? { raw: response, tx: transaction }
- : (response as SignedTransactionInfo);
+ : (response as SignedTransactionInfoAPI);
return {
raw: format({ eth: 'bytes' }, unformattedResponse.raw, returnFormat),
diff --git a/packages/web3-eth/src/rpc_methods.ts b/packages/web3-eth/src/rpc_methods.ts
index 83fab56759a..6b1e540e5f4 100644
--- a/packages/web3-eth/src/rpc_methods.ts
+++ b/packages/web3-eth/src/rpc_methods.ts
@@ -15,18 +15,20 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { TransactionWithSender, TransactionCall } from 'web3-common';
import { Web3RequestManager } from 'web3-core';
import {
Address,
- Uint256,
+ BlockNumberOrTag,
+ Filter,
HexString32Bytes,
+ HexString8Bytes,
HexStringBytes,
+ TransactionCallAPI,
+ TransactionWithSenderAPI,
Uint,
- Filter,
- HexString8Bytes,
-} from 'web3-utils';
-import { BlockNumberOrTag, validator } from 'web3-validator';
+ Uint256,
+} from 'web3-types';
+import { validator } from 'web3-validator';
import { Web3EthExecutionAPI } from './web3_eth_execution_api';
/**
@@ -293,7 +295,7 @@ export async function sign(
*/
export async function signTransaction(
requestManager: Web3RequestManager,
- transaction: TransactionWithSender | Partial,
+ transaction: TransactionWithSenderAPI | Partial,
) {
return requestManager.send({
method: 'eth_signTransaction',
@@ -312,7 +314,7 @@ export async function signTransaction(
*/
export async function sendTransaction(
requestManager: Web3RequestManager,
- transaction: TransactionWithSender | Partial,
+ transaction: TransactionWithSenderAPI | Partial,
) {
return requestManager.send({
method: 'eth_sendTransaction',
@@ -346,7 +348,7 @@ export async function sendRawTransaction(
*/
export async function call(
requestManager: Web3RequestManager,
- transaction: TransactionCall,
+ transaction: TransactionCallAPI,
blockNumber: BlockNumberOrTag,
) {
// validateTransactionCall(transaction);
@@ -367,7 +369,7 @@ export async function call(
*/
export async function estimateGas(
requestManager: Web3RequestManager,
- transaction: Partial,
+ transaction: Partial,
blockNumber: BlockNumberOrTag,
) {
validator.validate(['blockNumberOrTag'], [blockNumber]);
diff --git a/packages/web3-eth/src/types.ts b/packages/web3-eth/src/types.ts
index 42fc113df63..c5d55cf1108 100644
--- a/packages/web3-eth/src/types.ts
+++ b/packages/web3-eth/src/types.ts
@@ -15,180 +15,12 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import {
- AccessList,
- TransactionHash,
- Uncles,
- FormatType,
- ETH_DATA_FORMAT,
- DataFormat,
-} from 'web3-common';
import { TransactionError } from 'web3-errors';
-import { Address, Bytes, Numbers, Uint } from 'web3-utils';
-
-export type ValidChains = 'goerli' | 'kovan' | 'mainnet' | 'rinkeby' | 'ropsten' | 'sepolia';
-export type Hardfork =
- | 'arrowGlacier'
- | 'berlin'
- | 'byzantium'
- | 'chainstart'
- | 'constantinople'
- | 'dao'
- | 'homestead'
- | 'istanbul'
- | 'london'
- | 'merge'
- | 'muirGlacier'
- | 'petersburg'
- | 'shanghai'
- | 'spuriousDragon'
- | 'tangerineWhistle';
-
-export interface Log {
- readonly removed?: boolean;
- readonly logIndex?: Numbers;
- readonly transactionIndex?: Numbers;
- readonly transactionHash?: Bytes;
- readonly blockHash?: Bytes;
- readonly blockNumber?: Numbers;
- readonly address?: Address;
- readonly data?: Bytes;
- readonly topics?: Bytes[];
- readonly id?: string;
-}
-
-export interface TransactionReceipt {
- readonly transactionHash: Bytes;
- readonly transactionIndex: Numbers;
- readonly blockHash: Bytes;
- readonly blockNumber: Numbers;
- readonly from: Address;
- readonly to: Address;
- readonly cumulativeGasUsed: Numbers;
- readonly gasUsed: Numbers;
- readonly effectiveGasPrice?: Numbers;
- readonly contractAddress?: Address;
- readonly logs: Log[];
- readonly logsBloom: Bytes;
- readonly root: Bytes;
- readonly status: Numbers;
- readonly type?: Numbers;
-}
-
-export interface CustomChain {
- name?: string;
- networkId: Numbers;
- chainId: Numbers;
-}
-
-export interface Common {
- customChain: CustomChain;
- baseChain?: ValidChains;
- hardfork?: Hardfork;
-}
-
-interface TransactionBase {
- value?: Numbers;
- accessList?: AccessList;
- common?: Common;
- // eslint-disable-next-line @typescript-eslint/ban-types
- to?: Address | null;
- gas?: Numbers;
- gasPrice?: Numbers;
- type?: Numbers;
- maxFeePerGas?: Numbers;
- maxPriorityFeePerGas?: Numbers;
- data?: Bytes;
- input?: Bytes;
- nonce?: Numbers;
- chain?: ValidChains;
- hardfork?: Hardfork;
- chainId?: Numbers;
- networkId?: Numbers;
- gasLimit?: Numbers;
- yParity?: Uint;
- v?: Numbers;
- r?: Bytes;
- s?: Bytes;
-}
-
-export interface Transaction extends TransactionBase {
- from?: Address;
-}
-
-export interface TransactionWithLocalWalletIndex extends TransactionBase {
- from?: Numbers;
-}
-
-export interface TransactionInfo extends Transaction {
- readonly blockHash?: Bytes;
- readonly blockNumber?: Numbers;
- readonly from: Address;
- readonly hash: Bytes;
- readonly transactionIndex?: Numbers;
-}
+import { Bytes, Numbers, Transaction, TransactionReceipt } from 'web3-types';
+import { DataFormat, ETH_DATA_FORMAT, FormatType } from 'web3-utils';
export type InternalTransaction = FormatType;
-export interface TransactionCall extends Transaction {
- to: Address;
-}
-
-export interface PopulatedUnsignedBaseTransaction {
- from: Address;
- to?: Address;
- value: Numbers;
- gas?: Numbers;
- gasPrice: Numbers;
- type: Numbers;
- data: Bytes;
- nonce: Numbers;
- networkId: Numbers;
- chain: ValidChains;
- hardfork: Hardfork;
- chainId: Numbers;
- common: Common;
- gasLimit: Numbers;
-}
-
-export interface PopulatedUnsignedEip2930Transaction extends PopulatedUnsignedBaseTransaction {
- accessList: AccessList;
-}
-
-export interface PopulatedUnsignedEip1559Transaction extends PopulatedUnsignedEip2930Transaction {
- gasPrice: never;
- maxFeePerGas: Numbers;
- maxPriorityFeePerGas: Numbers;
-}
-export type PopulatedUnsignedTransaction =
- | PopulatedUnsignedBaseTransaction
- | PopulatedUnsignedEip2930Transaction
- | PopulatedUnsignedEip1559Transaction;
-
-export interface Block {
- readonly parentHash: Bytes;
- readonly sha3Uncles: Bytes;
- readonly miner: Bytes;
- readonly stateRoot: Bytes;
- readonly transactionsRoot: Bytes;
- readonly receiptsRoot: Bytes;
- readonly logsBloom?: Bytes;
- readonly difficulty?: Numbers;
- readonly number: Numbers;
- readonly gasLimit: Numbers;
- readonly gasUsed: Numbers;
- readonly timestamp: Numbers;
- readonly extraData: Bytes;
- readonly mixHash: Bytes;
- readonly nonce: Numbers;
- readonly totalDifficulty: Numbers;
- readonly baseFeePerGas?: Numbers;
- readonly size: Numbers;
- readonly transactions: TransactionHash[] | TransactionInfo[];
- readonly uncles: Uncles;
- readonly hash?: Bytes;
-}
-
export type SendTransactionEvents = {
sending: FormatType;
sent: FormatType;
@@ -223,24 +55,3 @@ export interface SendTransactionOptions {
export interface SendSignedTransactionOptions {
transactionResolver?: (receipt: TransactionReceipt) => ResolveType;
}
-
-export interface FeeHistory {
- readonly oldestBlock: Numbers;
- readonly baseFeePerGas: Numbers;
- readonly reward: Numbers[][];
-}
-
-export interface StorageProof {
- readonly key: Bytes;
- readonly value: Numbers;
- readonly proof: Bytes[];
-}
-
-export interface AccountObject {
- readonly balance: Numbers;
- readonly codeHash: Bytes;
- readonly nonce: Numbers;
- readonly storageHash: Bytes;
- readonly accountProof: Bytes[];
- readonly storageProof: StorageProof[];
-}
diff --git a/packages/web3-eth/src/utils/detect_transaction_type.ts b/packages/web3-eth/src/utils/detect_transaction_type.ts
index 910522f7d76..5c8c4583f38 100644
--- a/packages/web3-eth/src/utils/detect_transaction_type.ts
+++ b/packages/web3-eth/src/utils/detect_transaction_type.ts
@@ -15,10 +15,11 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { EthExecutionAPI, ETH_DATA_FORMAT, format } from 'web3-common';
+import { ETH_DATA_FORMAT, format } from 'web3-utils';
import { TransactionTypeParser, Web3Context } from 'web3-core';
+import { EthExecutionAPI, Transaction } from 'web3-types';
import { isNullish } from 'web3-validator';
-import { InternalTransaction, Transaction } from '../types';
+import { InternalTransaction } from '../types';
export const defaultTransactionTypeParser: TransactionTypeParser = transaction => {
const tx = transaction as unknown as Transaction;
diff --git a/packages/web3-eth/src/utils/format_transaction.ts b/packages/web3-eth/src/utils/format_transaction.ts
index e3bbffe3499..27e658a8632 100644
--- a/packages/web3-eth/src/utils/format_transaction.ts
+++ b/packages/web3-eth/src/utils/format_transaction.ts
@@ -15,12 +15,18 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DataFormat, DEFAULT_RETURN_FORMAT, format, FormatType } from 'web3-common';
-import { bytesToBuffer, mergeDeep } from 'web3-utils';
+import {
+ bytesToBuffer,
+ mergeDeep,
+ DataFormat,
+ DEFAULT_RETURN_FORMAT,
+ format,
+ FormatType,
+} from 'web3-utils';
+import { Transaction } from 'web3-types';
import { isNullish } from 'web3-validator';
import { TransactionDataAndInputError } from '../errors';
import { transactionSchema } from '../schemas';
-import { Transaction } from '../types';
/**
*
diff --git a/packages/web3-eth/src/utils/get_transaction_gas_pricing.ts b/packages/web3-eth/src/utils/get_transaction_gas_pricing.ts
index f2262224882..fe55b3eb637 100644
--- a/packages/web3-eth/src/utils/get_transaction_gas_pricing.ts
+++ b/packages/web3-eth/src/utils/get_transaction_gas_pricing.ts
@@ -15,14 +15,14 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { EthExecutionAPI, FormatType, DataFormat, format, ETH_DATA_FORMAT } from 'web3-common';
+import { FormatType, DataFormat, format, ETH_DATA_FORMAT } from 'web3-utils';
import { Web3Context } from 'web3-core';
-import { Numbers } from 'web3-utils';
+import { EthExecutionAPI, Numbers, Transaction } from 'web3-types';
import { isNullish } from 'web3-validator';
import { Eip1559NotSupportedError, UnsupportedTransactionTypeError } from '../errors';
// eslint-disable-next-line import/no-cycle
import { getBlock, getGasPrice } from '../rpc_method_wrappers';
-import { InternalTransaction, Transaction } from '../types';
+import { InternalTransaction } from '../types';
// eslint-disable-next-line import/no-cycle
import { getTransactionType } from './transaction_builder';
diff --git a/packages/web3-eth/src/utils/prepare_transaction_for_signing.ts b/packages/web3-eth/src/utils/prepare_transaction_for_signing.ts
index 32a145cd3da..7cc24afea97 100644
--- a/packages/web3-eth/src/utils/prepare_transaction_for_signing.ts
+++ b/packages/web3-eth/src/utils/prepare_transaction_for_signing.ts
@@ -17,16 +17,17 @@ along with web3.js. If not, see .
import Common from '@ethereumjs/common';
import { TransactionFactory, TxOptions } from '@ethereumjs/tx';
-import { EthExecutionAPI, FormatType, ETH_DATA_FORMAT } from 'web3-common';
-import { Web3Context } from 'web3-core';
-import { HexString, toNumber } from 'web3-utils';
-import { isNullish } from 'web3-validator';
import {
+ EthExecutionAPI,
+ HexString,
PopulatedUnsignedEip1559Transaction,
PopulatedUnsignedEip2930Transaction,
PopulatedUnsignedTransaction,
Transaction,
-} from '../types';
+} from 'web3-types';
+import { Web3Context } from 'web3-core';
+import { FormatType, ETH_DATA_FORMAT, toNumber } from 'web3-utils';
+import { isNullish } from 'web3-validator';
import { validateTransactionForSigning } from '../validation';
import { formatTransaction } from './format_transaction';
import { transactionBuilder } from './transaction_builder';
diff --git a/packages/web3-eth/src/utils/transaction_builder.ts b/packages/web3-eth/src/utils/transaction_builder.ts
index 01d2af6ff4b..430690d894c 100644
--- a/packages/web3-eth/src/utils/transaction_builder.ts
+++ b/packages/web3-eth/src/utils/transaction_builder.ts
@@ -16,17 +16,25 @@ along with web3.js. If not, see .
*/
import {
- EthExecutionAPI,
DEFAULT_RETURN_FORMAT,
ETH_DATA_FORMAT,
FormatType,
format,
DataFormat,
-} from 'web3-common';
+ isAddress,
+} from 'web3-utils';
+import {
+ EthExecutionAPI,
+ Address,
+ HexString,
+ ValidChains,
+ Hardfork,
+ Transaction,
+ TransactionWithLocalWalletIndex,
+} from 'web3-types';
import { Web3Context } from 'web3-core';
import { privateKeyToAddress } from 'web3-eth-accounts';
import { getId, Web3NetAPI } from 'web3-net';
-import { Address, HexString, isAddress } from 'web3-utils';
import { isNullish, isNumber } from 'web3-validator';
import { NUMBER_DATA_FORMAT } from '../constants';
import {
@@ -37,17 +45,11 @@ import {
} from '../errors';
// eslint-disable-next-line import/no-cycle
import { getChainId, getTransactionCount } from '../rpc_method_wrappers';
-import {
- ValidChains,
- Hardfork,
- Transaction,
- InternalTransaction,
- TransactionWithLocalWalletIndex,
-} from '../types';
import { detectTransactionType } from './detect_transaction_type';
// eslint-disable-next-line import/no-cycle
import { getTransactionGasPricing } from './get_transaction_gas_pricing';
import { transactionSchema } from '../schemas';
+import { InternalTransaction } from '../types';
export const getTransactionFromAttr = (
web3Context: Web3Context,
diff --git a/packages/web3-eth/src/utils/wait_for_transaction_receipt.ts b/packages/web3-eth/src/utils/wait_for_transaction_receipt.ts
index 10e650a31cf..4249233fa5a 100644
--- a/packages/web3-eth/src/utils/wait_for_transaction_receipt.ts
+++ b/packages/web3-eth/src/utils/wait_for_transaction_receipt.ts
@@ -14,11 +14,10 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DataFormat, EthExecutionAPI } from 'web3-common';
+import { EthExecutionAPI, Bytes, TransactionReceipt } from 'web3-types';
import { Web3Context } from 'web3-core';
-import { Bytes, isNullish } from 'web3-utils';
+import { DataFormat, isNullish } from 'web3-utils';
-import { TransactionReceipt } from '../types';
// eslint-disable-next-line import/no-cycle
import { getTransactionReceipt } from '../rpc_method_wrappers';
import { TransactionPollingTimeoutError } from '../errors';
diff --git a/packages/web3-eth/src/utils/watch_transaction_for_confirmations.ts b/packages/web3-eth/src/utils/watch_transaction_for_confirmations.ts
index 39ac3623f84..489e38c9621 100644
--- a/packages/web3-eth/src/utils/watch_transaction_for_confirmations.ts
+++ b/packages/web3-eth/src/utils/watch_transaction_for_confirmations.ts
@@ -15,23 +15,23 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import {
- DataFormat,
+ Bytes,
+ Numbers,
EthExecutionAPI,
- format,
- Web3PromiEvent,
Web3BaseProvider,
BlockHeaderOutput,
-} from 'web3-common';
+ TransactionReceipt,
+} from 'web3-types';
import { SubscriptionError } from 'web3-errors';
-import { Web3Context } from 'web3-core';
-import { Bytes, Numbers, numberToHex } from 'web3-utils';
+import { Web3Context, Web3PromiEvent } from 'web3-core';
+import { DataFormat, format, numberToHex } from 'web3-utils';
import { isNullish } from 'web3-validator';
import {
TransactionMissingReceiptOrBlockHashError,
TransactionReceiptMissingBlockNumberError,
} from '../errors';
-import { TransactionReceipt, SendSignedTransactionEvents, SendTransactionEvents } from '../types';
+import { SendSignedTransactionEvents, SendTransactionEvents } from '../types';
import { getBlockByNumber } from '../rpc_methods';
import { NewHeadsSubscription } from '../web3_subscriptions';
import { transactionReceiptSchema } from '../schemas';
diff --git a/packages/web3-eth/src/validation.ts b/packages/web3-eth/src/validation.ts
index f2396ef3bfc..4f780c52ec7 100644
--- a/packages/web3-eth/src/validation.ts
+++ b/packages/web3-eth/src/validation.ts
@@ -18,14 +18,15 @@ along with web3.js. If not, see .
import {
AccessList,
AccessListEntry,
- BaseTransaction,
- ETH_DATA_FORMAT,
- Transaction1559Unsigned,
- Transaction2930Unsigned,
+ BaseTransactionAPI,
+ Transaction1559UnsignedAPI,
+ Transaction2930UnsignedAPI,
TransactionCall,
- TransactionLegacyUnsigned,
- TransactionWithSender,
-} from 'web3-common';
+ TransactionLegacyUnsignedAPI,
+ Transaction,
+ TransactionWithSenderAPI,
+} from 'web3-types';
+import { ETH_DATA_FORMAT } from 'web3-utils';
import { isAddress, isHexStrict, isHexString32Bytes, isNullish, isUInt } from 'web3-validator';
import {
ChainIdMismatchError,
@@ -45,13 +46,13 @@ import {
UnsupportedFeeMarketError,
} from './errors';
import { formatTransaction } from './utils/format_transaction';
-import { InternalTransaction, Transaction } from './types';
+import { InternalTransaction } from './types';
/**
*
* @param value
*/
-export function isBaseTransaction(value: BaseTransaction): boolean {
+export function isBaseTransaction(value: BaseTransactionAPI): boolean {
if (!isNullish(value.to) && !isAddress(value.to)) return false;
if (!isHexStrict(value.type) && !isNullish(value.type) && value.type.length !== 2) return false;
if (!isHexStrict(value.nonce)) return false;
@@ -96,7 +97,7 @@ export function isAccessList(value: AccessList): boolean {
*
* @param value
*/
-export function isTransaction1559Unsigned(value: Transaction1559Unsigned): boolean {
+export function isTransaction1559Unsigned(value: Transaction1559UnsignedAPI): boolean {
if (!isBaseTransaction(value)) return false;
if (!isHexStrict(value.maxFeePerGas)) return false;
if (!isHexStrict(value.maxPriorityFeePerGas)) return false;
@@ -109,7 +110,7 @@ export function isTransaction1559Unsigned(value: Transaction1559Unsigned): boole
*
* @param value
*/
-export function isTransaction2930Unsigned(value: Transaction2930Unsigned): boolean {
+export function isTransaction2930Unsigned(value: Transaction2930UnsignedAPI): boolean {
if (!isBaseTransaction(value)) return false;
if (!isHexStrict(value.gasPrice)) return false;
if (!isAccessList(value.accessList)) return false;
@@ -121,7 +122,7 @@ export function isTransaction2930Unsigned(value: Transaction2930Unsigned): boole
*
* @param value
*/
-export function isTransactionLegacyUnsigned(value: TransactionLegacyUnsigned): boolean {
+export function isTransactionLegacyUnsigned(value: TransactionLegacyUnsignedAPI): boolean {
if (!isBaseTransaction(value)) return false;
if (!isHexStrict(value.gasPrice)) return false;
@@ -132,13 +133,13 @@ export function isTransactionLegacyUnsigned(value: TransactionLegacyUnsigned): b
*
* @param value
*/
-export function isTransactionWithSender(value: TransactionWithSender): boolean {
+export function isTransactionWithSender(value: TransactionWithSenderAPI): boolean {
if (!isAddress(value.from)) return false;
if (!isBaseTransaction(value)) return false;
if (
- !isTransaction1559Unsigned(value as Transaction1559Unsigned) &&
- !isTransaction2930Unsigned(value as Transaction2930Unsigned) &&
- !isTransactionLegacyUnsigned(value as TransactionLegacyUnsigned)
+ !isTransaction1559Unsigned(value as Transaction1559UnsignedAPI) &&
+ !isTransaction2930Unsigned(value as Transaction2930UnsignedAPI) &&
+ !isTransactionLegacyUnsigned(value as TransactionLegacyUnsignedAPI)
)
return false;
@@ -149,7 +150,7 @@ export function isTransactionWithSender(value: TransactionWithSender): boolean {
*
* @param value
*/
-export function validateTransactionWithSender(value: TransactionWithSender) {
+export function validateTransactionWithSender(value: TransactionWithSenderAPI) {
if (!isTransactionWithSender(value)) throw new InvalidTransactionWithSender(value);
}
@@ -165,8 +166,8 @@ export function isTransactionCall(value: TransactionCall): boolean {
if (!isNullish(value.value) && !isHexStrict(value.value)) return false;
if (!isNullish(value.data) && !isHexStrict(value.data)) return false;
if (!isNullish(value.type)) return false;
- if (isTransaction1559Unsigned(value as Transaction1559Unsigned)) return false;
- if (isTransaction2930Unsigned(value as Transaction2930Unsigned)) return false;
+ if (isTransaction1559Unsigned(value as Transaction1559UnsignedAPI)) return false;
+ if (isTransaction2930Unsigned(value as Transaction2930UnsignedAPI)) return false;
return true;
}
diff --git a/packages/web3-eth/src/web3_eth.ts b/packages/web3-eth/src/web3_eth.ts
index 4d88d19c1cb..4b6d05ada45 100644
--- a/packages/web3-eth/src/web3_eth.ts
+++ b/packages/web3-eth/src/web3_eth.ts
@@ -17,15 +17,9 @@ along with web3.js. If not, see .
// Disabling because returnTypes must be last param to match 1.x params
/* eslint-disable default-param-last */
-import { DataFormat, DEFAULT_RETURN_FORMAT, LogsInput } from 'web3-common';
+
import {
- isSupportedProvider,
SupportedProviders,
- Web3Context,
- Web3ContextInitOptions,
-} from 'web3-core';
-import { TransactionNotFound } from 'web3-errors';
-import {
Address,
Bytes,
Filter,
@@ -33,16 +27,17 @@ import {
HexString8Bytes,
Numbers,
BlockNumberOrTag,
- toChecksumAddress,
-} from 'web3-utils';
-import * as rpcMethods from './rpc_methods';
-import * as rpcMethodsWrappers from './rpc_method_wrappers';
-import {
- SendTransactionOptions,
+ LogsInput,
Transaction,
TransactionCall,
TransactionWithLocalWalletIndex,
-} from './types';
+} from 'web3-types';
+import { isSupportedProvider, Web3Context, Web3ContextInitOptions } from 'web3-core';
+import { TransactionNotFound } from 'web3-errors';
+import { toChecksumAddress, DataFormat, DEFAULT_RETURN_FORMAT } from 'web3-utils';
+import * as rpcMethods from './rpc_methods';
+import * as rpcMethodsWrappers from './rpc_method_wrappers';
+import { SendTransactionOptions } from './types';
import { Web3EthExecutionAPI } from './web3_eth_execution_api';
import {
LogsSubscription,
diff --git a/packages/web3-eth/src/web3_eth_execution_api.ts b/packages/web3-eth/src/web3_eth_execution_api.ts
index 911a176f8b3..a8e1161a90b 100644
--- a/packages/web3-eth/src/web3_eth_execution_api.ts
+++ b/packages/web3-eth/src/web3_eth_execution_api.ts
@@ -15,8 +15,14 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { EthExecutionAPI, TransactionInfo } from 'web3-common';
-import { Address, BlockNumberOrTag, HexString32Bytes, Uint } from 'web3-utils';
+import {
+ Address,
+ BlockNumberOrTag,
+ HexString32Bytes,
+ Uint,
+ EthExecutionAPI,
+ TransactionInfo,
+} from 'web3-types';
export interface StorageProof {
readonly key: HexString32Bytes;
diff --git a/packages/web3-eth/src/web3_subscriptions.ts b/packages/web3-eth/src/web3_subscriptions.ts
index 5d59843db3e..4ce20c4fa14 100644
--- a/packages/web3-eth/src/web3_subscriptions.ts
+++ b/packages/web3-eth/src/web3_subscriptions.ts
@@ -17,16 +17,17 @@ along with web3.js. If not, see .
// eslint-disable-next-line max-classes-per-file
import {
+ SyncOutput,
+ Address,
+ BlockNumberOrTag,
+ HexString,
+ Topic,
BlockHeaderOutput,
LogsInput,
LogsOutput,
- outputLogFormatter,
- outputSyncingFormatter,
SyncInput,
- SyncOutput,
-} from 'web3-common';
-import { Address, BlockNumberOrTag, HexString, Topic } from 'web3-utils';
-import { Web3Subscription } from 'web3-core';
+} from 'web3-types';
+import { Web3Subscription, outputLogFormatter, outputSyncingFormatter } from 'web3-core';
type CommonSubscriptionEvents = {
error: Error;
diff --git a/packages/web3-eth/test/fixtures/detect_transaction_type.ts b/packages/web3-eth/test/fixtures/detect_transaction_type.ts
index 78c7934fcee..632a3a2244d 100644
--- a/packages/web3-eth/test/fixtures/detect_transaction_type.ts
+++ b/packages/web3-eth/test/fixtures/detect_transaction_type.ts
@@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { ETH_DATA_FORMAT, FormatType } from 'web3-common';
-import { Transaction } from '../../src/types';
+import { ETH_DATA_FORMAT, FormatType } from 'web3-utils';
+import { Transaction } from 'web3-types';
export const transactionType0x0: FormatType[] = [
{
diff --git a/packages/web3-eth/test/fixtures/format_transaction.ts b/packages/web3-eth/test/fixtures/format_transaction.ts
index 422913b8cac..81754ef5443 100644
--- a/packages/web3-eth/test/fixtures/format_transaction.ts
+++ b/packages/web3-eth/test/fixtures/format_transaction.ts
@@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { FMT_BYTES, FMT_NUMBER, FormatType, DEFAULT_RETURN_FORMAT } from 'web3-common';
-import { Transaction } from '../../src/types';
+import { FMT_BYTES, FMT_NUMBER, FormatType, DEFAULT_RETURN_FORMAT } from 'web3-utils';
+import { Transaction } from 'web3-types';
export const bytesAsHexStringTransaction: FormatType<
Transaction,
diff --git a/packages/web3-eth/test/fixtures/prepare_transaction_for_signing.ts b/packages/web3-eth/test/fixtures/prepare_transaction_for_signing.ts
index 590a6df9840..d559da9ac9c 100644
--- a/packages/web3-eth/test/fixtures/prepare_transaction_for_signing.ts
+++ b/packages/web3-eth/test/fixtures/prepare_transaction_for_signing.ts
@@ -15,9 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { AccessList, Block } from 'web3-common';
-import { HexString } from 'web3-utils';
-import { Common, Transaction } from '../../src/types';
+import { AccessList, Block, HexString, Common, Transaction } from 'web3-types';
export const preEip1559Block: Block = {
parentHash: '0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54',
diff --git a/packages/web3-eth/test/fixtures/rpc_methods_wrappers.ts b/packages/web3-eth/test/fixtures/rpc_methods_wrappers.ts
index 0c6d010fee2..8b7c72abceb 100644
--- a/packages/web3-eth/test/fixtures/rpc_methods_wrappers.ts
+++ b/packages/web3-eth/test/fixtures/rpc_methods_wrappers.ts
@@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DataFormat, DEFAULT_RETURN_FORMAT, FMT_NUMBER, TransactionWithSender } from 'web3-common';
-import { Numbers, Uint } from 'web3-utils';
+import { DataFormat, DEFAULT_RETURN_FORMAT, FMT_NUMBER } from 'web3-utils';
+import { Numbers, Uint, TransactionWithSenderAPI } from 'web3-types';
// Array consists of: returnType parameter, mock RPC result, expected output
export const getHashRateValidData: [DataFormat, Numbers, Numbers][] = [
@@ -42,7 +42,7 @@ export const getBlockNumberValidData: [DataFormat, any, any][] = [
[{ ...DEFAULT_RETURN_FORMAT, number: FMT_NUMBER.BIGINT }, '0x4b7', BigInt('0x4b7')],
];
-export const transactionWithSender: TransactionWithSender = {
+export const transactionWithSender: TransactionWithSenderAPI = {
to: '0x407d73d8a49eeb85d32cf465507dd71d507100c1',
type: '0x0',
nonce: '0x1',
diff --git a/packages/web3-eth/test/fixtures/validate_transaction_for_signing.ts b/packages/web3-eth/test/fixtures/validate_transaction_for_signing.ts
index c26b52ba991..cbe8e4b0ef0 100644
--- a/packages/web3-eth/test/fixtures/validate_transaction_for_signing.ts
+++ b/packages/web3-eth/test/fixtures/validate_transaction_for_signing.ts
@@ -15,7 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { FMT_BYTES, FMT_NUMBER, FormatType } from 'web3-common';
+import { Transaction } from 'web3-types';
+import { FMT_BYTES, FMT_NUMBER, FormatType } from 'web3-utils';
import {
ChainIdMismatchError,
CommonOrChainAndHardforkError,
@@ -30,7 +31,6 @@ import {
TransactionGasMismatchError,
UnsupportedFeeMarketError,
} from '../../src/errors';
-import { Transaction } from '../../src/types';
// eslint-disable-next-line @typescript-eslint/no-empty-function
export const invalidTransactionObject: any[] = ['42', false, '0x0', BigInt(42), () => {}];
diff --git a/packages/web3-eth/test/fixtures/validation.ts b/packages/web3-eth/test/fixtures/validation.ts
index ec43c0863c9..e559821d763 100644
--- a/packages/web3-eth/test/fixtures/validation.ts
+++ b/packages/web3-eth/test/fixtures/validation.ts
@@ -18,16 +18,16 @@ along with web3.js. If not, see .
import {
AccessList,
AccessListEntry,
- BaseTransaction,
- Transaction1559Unsigned,
- Transaction2930Unsigned,
+ BaseTransactionAPI,
+ Transaction1559UnsignedAPI,
+ Transaction2930UnsignedAPI,
+ TransactionLegacyUnsignedAPI,
TransactionCall,
- TransactionLegacyUnsigned,
- TransactionWithSender,
-} from 'web3-common';
+ TransactionWithSenderAPI,
+} from 'web3-types';
import { InvalidTransactionCall, InvalidTransactionWithSender } from '../../src/errors';
-export const isBaseTransactionValidData: [BaseTransaction, true][] = [
+export const isBaseTransactionValidData: [BaseTransactionAPI, true][] = [
[
{
type: '0x0',
@@ -85,7 +85,7 @@ export const isAccessListValidData = (): [AccessList, true][] => [
[isAccessListEntryValidData.map(entry => entry[0]), true],
];
-export const isTransaction1559UnsignedValidData = (): [Transaction1559Unsigned, true][] =>
+export const isTransaction1559UnsignedValidData = (): [Transaction1559UnsignedAPI, true][] =>
isBaseTransactionValidData.map(transaction => {
return [
{
@@ -98,7 +98,7 @@ export const isTransaction1559UnsignedValidData = (): [Transaction1559Unsigned,
];
});
-export const isTransactionLegacyUnsignedValidData = (): [TransactionLegacyUnsigned, true][] =>
+export const isTransactionLegacyUnsignedValidData = (): [TransactionLegacyUnsignedAPI, true][] =>
isBaseTransactionValidData.map(transaction => {
return [
{
@@ -109,7 +109,7 @@ export const isTransactionLegacyUnsignedValidData = (): [TransactionLegacyUnsign
];
});
-export const isTransaction2930UnsignedValidData = (): [Transaction2930Unsigned, true][] =>
+export const isTransaction2930UnsignedValidData = (): [Transaction2930UnsignedAPI, true][] =>
isTransactionLegacyUnsignedValidData().map(transaction => {
return [
{
@@ -120,7 +120,7 @@ export const isTransaction2930UnsignedValidData = (): [Transaction2930Unsigned,
];
});
-export const isTransactionWithSenderValidData = (): [TransactionWithSender, true][] => {
+export const isTransactionWithSenderValidData = (): [TransactionWithSenderAPI, true][] => {
const transactions = [
...isTransaction1559UnsignedValidData(),
...isTransactionLegacyUnsignedValidData(),
diff --git a/packages/web3-eth/test/fixtures/web3_eth_methods_with_parameters.ts b/packages/web3-eth/test/fixtures/web3_eth_methods_with_parameters.ts
index 6152e6e33f0..7e018cf504b 100644
--- a/packages/web3-eth/test/fixtures/web3_eth_methods_with_parameters.ts
+++ b/packages/web3-eth/test/fixtures/web3_eth_methods_with_parameters.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DataFormat, DEFAULT_RETURN_FORMAT, FMT_NUMBER, TransactionWithSender } from 'web3-common';
+import { DataFormat, DEFAULT_RETURN_FORMAT, FMT_NUMBER } from 'web3-utils';
import {
Address,
BlockNumberOrTag,
@@ -26,9 +26,10 @@ import {
HexStringBytes,
Uint,
Uint256,
-} from 'web3-utils';
+ TransactionWithSenderAPI,
+ TransactionReceipt,
+} from 'web3-types';
import { transactionWithSender } from './rpc_methods_wrappers';
-import { TransactionReceipt } from '../../src/types';
/**
* Array consists of:
@@ -1079,11 +1080,15 @@ export const getTransactionCountValidData: [
*/
export const estimateGasValidData: [
[
- Partial,
+ Partial,
HexString32Bytes | BlockNumberOrTag | undefined,
DataFormat | undefined,
],
- [Partial, HexString32Bytes | BlockNumberOrTag, DataFormat | undefined],
+ [
+ Partial,
+ HexString32Bytes | BlockNumberOrTag,
+ DataFormat | undefined,
+ ],
][] = [
// All possible undefined values
[
diff --git a/packages/web3-eth/test/integration/defaults.test.ts b/packages/web3-eth/test/integration/defaults.test.ts
index ac2d84f7cb7..8e5e6c5408a 100644
--- a/packages/web3-eth/test/integration/defaults.test.ts
+++ b/packages/web3-eth/test/integration/defaults.test.ts
@@ -17,12 +17,11 @@ along with web3.js. If not, see .
import WebSocketProvider from 'web3-providers-ws';
// eslint-disable-next-line import/no-extraneous-dependencies
import { Contract } from 'web3-eth-contract';
-import { hexToNumber, numberToHex } from 'web3-utils';
-import { TransactionBuilder, TransactionTypeParser, Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, Web3PromiEvent } from 'web3-common';
+import { hexToNumber, numberToHex, DEFAULT_RETURN_FORMAT } from 'web3-utils';
+import { TransactionBuilder, TransactionTypeParser, Web3Context, Web3PromiEvent } from 'web3-core';
+import { TransactionReceipt } from 'web3-types';
import {
prepareTransactionForSigning,
- TransactionReceipt,
SendTransactionEvents,
transactionBuilder,
Web3Eth,
diff --git a/packages/web3-eth/test/integration/eth.test.ts b/packages/web3-eth/test/integration/eth.test.ts
index abf4af52c9f..6be37927551 100644
--- a/packages/web3-eth/test/integration/eth.test.ts
+++ b/packages/web3-eth/test/integration/eth.test.ts
@@ -19,7 +19,7 @@ import HttpProvider from 'web3-providers-http';
// eslint-disable-next-line import/no-extraneous-dependencies
import { Contract } from 'web3-eth-contract';
// eslint-disable-next-line import/no-extraneous-dependencies
-import { SupportedProviders } from 'web3-core';
+import { SupportedProviders } from 'web3-types';
// eslint-disable-next-line import/no-extraneous-dependencies
import IpcProvider from 'web3-providers-ipc';
import { Web3Eth } from '../../src';
diff --git a/packages/web3-eth/test/integration/helper.ts b/packages/web3-eth/test/integration/helper.ts
index 1579f2cef36..768f1fd4309 100644
--- a/packages/web3-eth/test/integration/helper.ts
+++ b/packages/web3-eth/test/integration/helper.ts
@@ -14,9 +14,11 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Block, DEFAULT_RETURN_FORMAT, FMT_NUMBER, Web3PromiEvent } from 'web3-common';
+import { Block, TransactionInfo, TransactionReceipt } from 'web3-types';
+import { DEFAULT_RETURN_FORMAT, FMT_NUMBER } from 'web3-utils';
+import { Web3PromiEvent } from 'web3-core';
import { AbiEventFragment } from 'web3-eth-abi';
-import { TransactionReceipt, SendTransactionEvents, TransactionInfo, Web3Eth } from '../../src';
+import { SendTransactionEvents, Web3Eth } from '../../src';
import { BasicAbi } from '../shared_fixtures/build/Basic';
type SendFewTxParams = {
diff --git a/packages/web3-eth/test/integration/rpc.block.test.ts b/packages/web3-eth/test/integration/rpc.block.test.ts
index a4c61966ef8..655ef518217 100644
--- a/packages/web3-eth/test/integration/rpc.block.test.ts
+++ b/packages/web3-eth/test/integration/rpc.block.test.ts
@@ -15,12 +15,13 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import WebSocketProvider from 'web3-providers-ws';
-import { Block, FMT_BYTES, FMT_NUMBER } from 'web3-common';
+import { FMT_BYTES, FMT_NUMBER } from 'web3-utils';
+import { Block, TransactionInfo, TransactionReceipt } from 'web3-types';
// eslint-disable-next-line import/no-extraneous-dependencies
import { Contract } from 'web3-eth-contract';
// eslint-disable-next-line import/no-extraneous-dependencies
import IpcProvider from 'web3-providers-ipc';
-import { TransactionReceipt, Web3Eth, TransactionInfo } from '../../src';
+import { Web3Eth } from '../../src';
import {
getSystemTestBackend,
diff --git a/packages/web3-eth/test/integration/rpc.test.ts b/packages/web3-eth/test/integration/rpc.test.ts
index 164ca272f4f..9438ce51454 100644
--- a/packages/web3-eth/test/integration/rpc.test.ts
+++ b/packages/web3-eth/test/integration/rpc.test.ts
@@ -14,17 +14,18 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
+
+import { TransactionReceipt, TransactionInfo } from 'web3-types';
import WebSocketProvider from 'web3-providers-ws';
-import { FMT_BYTES, FMT_NUMBER } from 'web3-common';
// eslint-disable-next-line import/no-extraneous-dependencies
import { Contract, decodeEventABI } from 'web3-eth-contract';
-import { hexToNumber, hexToString, numberToHex } from 'web3-utils';
+import { hexToNumber, hexToString, numberToHex, FMT_BYTES, FMT_NUMBER } from 'web3-utils';
// eslint-disable-next-line import/no-extraneous-dependencies
import { AbiEventFragment } from 'web3-eth-abi';
import { getStorageSlotNumForLongString } from 'web3-utils/src';
// eslint-disable-next-line import/no-extraneous-dependencies
import IpcProvider from 'web3-providers-ipc';
-import { TransactionReceipt, Web3Eth, TransactionInfo } from '../../src';
+import { Web3Eth } from '../../src';
import {
getSystemTestBackend,
diff --git a/packages/web3-eth/test/integration/subscribe.test.ts b/packages/web3-eth/test/integration/subscribe.test.ts
index c559e89698f..5988e810461 100644
--- a/packages/web3-eth/test/integration/subscribe.test.ts
+++ b/packages/web3-eth/test/integration/subscribe.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import WebSocketProvider from 'web3-providers-ws';
-import { Web3BaseProvider } from 'web3-common';
+import { Web3BaseProvider } from 'web3-types';
/* eslint-disable import/no-named-as-default */
import Web3Eth from '../../src/index';
import {
diff --git a/packages/web3-eth/test/integration/subscription_heads.test.ts b/packages/web3-eth/test/integration/subscription_heads.test.ts
index 74d18b5339b..edd9f924ed1 100644
--- a/packages/web3-eth/test/integration/subscription_heads.test.ts
+++ b/packages/web3-eth/test/integration/subscription_heads.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import WebSocketProvider from 'web3-providers-ws';
-import { BlockHeaderOutput, Web3BaseProvider } from 'web3-common';
+import { BlockHeaderOutput, Web3BaseProvider } from 'web3-types';
import { Web3Eth } from '../../src';
import { sendFewTxes, Resolve } from './helper';
import { NewHeadsSubscription } from '../../src/web3_subscriptions';
diff --git a/packages/web3-eth/test/integration/subscription_logs.test.ts b/packages/web3-eth/test/integration/subscription_logs.test.ts
index 04086f7ed41..35d7710de33 100644
--- a/packages/web3-eth/test/integration/subscription_logs.test.ts
+++ b/packages/web3-eth/test/integration/subscription_logs.test.ts
@@ -19,7 +19,7 @@ import WebSocketProvider from 'web3-providers-ws';
import { Contract, decodeEventABI } from 'web3-eth-contract';
// eslint-disable-next-line import/no-extraneous-dependencies
import { AbiEventFragment } from 'web3-eth-abi';
-import { Web3BaseProvider } from 'web3-common';
+import { Web3BaseProvider } from 'web3-types';
import { Web3Eth } from '../../src';
import { BasicAbi, BasicBytecode } from '../shared_fixtures/build/Basic';
import { eventAbi, Resolve } from './helper';
diff --git a/packages/web3-eth/test/integration/subscription_logs_block.test.ts b/packages/web3-eth/test/integration/subscription_logs_block.test.ts
index 1be6bf777b1..d4037a0de88 100644
--- a/packages/web3-eth/test/integration/subscription_logs_block.test.ts
+++ b/packages/web3-eth/test/integration/subscription_logs_block.test.ts
@@ -19,7 +19,7 @@ import WebSocketProvider from 'web3-providers-ws';
import { Contract, decodeEventABI } from 'web3-eth-contract';
// eslint-disable-next-line import/no-extraneous-dependencies
import { AbiEventFragment } from 'web3-eth-abi';
-import { Web3BaseProvider } from 'web3-common';
+import { Web3BaseProvider } from 'web3-types';
import { numberToHex } from 'web3-utils';
import { Web3Eth } from '../../src';
import { BasicAbi, BasicBytecode } from '../shared_fixtures/build/Basic';
diff --git a/packages/web3-eth/test/integration/subscription_logs_clear.test.ts b/packages/web3-eth/test/integration/subscription_logs_clear.test.ts
index 85f442878e2..0b7261f6bf9 100644
--- a/packages/web3-eth/test/integration/subscription_logs_clear.test.ts
+++ b/packages/web3-eth/test/integration/subscription_logs_clear.test.ts
@@ -18,7 +18,7 @@ import WebSocketProvider from 'web3-providers-ws';
// eslint-disable-next-line import/no-extraneous-dependencies
import { Contract } from 'web3-eth-contract';
// eslint-disable-next-line import/no-extraneous-dependencies
-import { Web3BaseProvider } from 'web3-common';
+import { Web3BaseProvider } from 'web3-types';
import { Web3Eth } from '../../src';
import { BasicAbi, BasicBytecode } from '../shared_fixtures/build/Basic';
import { LogsSubscription } from '../../src/web3_subscriptions';
diff --git a/packages/web3-eth/test/integration/subscription_new_pending_tx.test.ts b/packages/web3-eth/test/integration/subscription_new_pending_tx.test.ts
index 30f0f4c0262..24543a98915 100644
--- a/packages/web3-eth/test/integration/subscription_new_pending_tx.test.ts
+++ b/packages/web3-eth/test/integration/subscription_new_pending_tx.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import WebSocketProvider from 'web3-providers-ws';
-import { Web3BaseProvider } from 'web3-common';
+import { Web3BaseProvider } from 'web3-types';
import { Web3Eth } from '../../src';
import { sendFewTxes, Resolve } from './helper';
import { NewPendingTransactionsSubscription } from '../../src/web3_subscriptions';
diff --git a/packages/web3-eth/test/integration/unsubscribe.test.ts b/packages/web3-eth/test/integration/unsubscribe.test.ts
index e565b43d760..941f62a6ab9 100644
--- a/packages/web3-eth/test/integration/unsubscribe.test.ts
+++ b/packages/web3-eth/test/integration/unsubscribe.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import WebSocketProvider from 'web3-providers-ws/dist';
-import { Web3BaseProvider } from 'web3-common';
+import { Web3BaseProvider } from 'web3-types';
/* eslint-disable import/no-named-as-default */
import Web3Eth from '../../src/index';
import { NewHeadsSubscription, SyncingSubscription } from '../../src/web3_subscriptions';
diff --git a/packages/web3-eth/test/integration/watch_transaction.test.ts b/packages/web3-eth/test/integration/watch_transaction.test.ts
index 8607e7559aa..986776e04a9 100644
--- a/packages/web3-eth/test/integration/watch_transaction.test.ts
+++ b/packages/web3-eth/test/integration/watch_transaction.test.ts
@@ -15,8 +15,10 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import WebSocketProvider from 'web3-providers-ws';
-import { Web3PromiEvent, Web3BaseProvider, DEFAULT_RETURN_FORMAT } from 'web3-common';
-import { Web3Eth, SendTransactionEvents, TransactionReceipt } from '../../src';
+import { DEFAULT_RETURN_FORMAT } from 'web3-utils';
+import { Web3BaseProvider, TransactionReceipt } from 'web3-types';
+import { Web3PromiEvent } from 'web3-core';
+import { Web3Eth, SendTransactionEvents } from '../../src';
import { sendFewTxes } from './helper';
import {
diff --git a/packages/web3-eth/test/integration/watch_transaction_polling.test.ts b/packages/web3-eth/test/integration/watch_transaction_polling.test.ts
index c4b7a1fe2b9..01885cf5316 100644
--- a/packages/web3-eth/test/integration/watch_transaction_polling.test.ts
+++ b/packages/web3-eth/test/integration/watch_transaction_polling.test.ts
@@ -14,8 +14,10 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DEFAULT_RETURN_FORMAT, Web3PromiEvent } from 'web3-common';
-import { Web3Eth, SendTransactionEvents, TransactionReceipt } from '../../src';
+import { DEFAULT_RETURN_FORMAT } from 'web3-utils';
+import { Web3PromiEvent } from 'web3-core';
+import { TransactionReceipt } from 'web3-types';
+import { Web3Eth, SendTransactionEvents } from '../../src';
import { sendFewTxes } from './helper';
import {
diff --git a/packages/web3-eth/test/integration/web3_eth/call.test.ts b/packages/web3-eth/test/integration/web3_eth/call.test.ts
index c2de462415c..b0fb7a6db35 100644
--- a/packages/web3-eth/test/integration/web3_eth/call.test.ts
+++ b/packages/web3-eth/test/integration/web3_eth/call.test.ts
@@ -14,12 +14,11 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { TransactionCall } from 'web3-common';
+import { TransactionCall, Address, BlockTags, Transaction } from 'web3-types';
import { decodeParameters } from 'web3-eth-abi';
import WebSocketProvider from 'web3-providers-ws';
-import { Address, BlockTags } from 'web3-utils';
-import Web3Eth, { Transaction } from '../../../src';
+import Web3Eth from '../../../src';
import {
getSystemTestAccounts,
getSystemTestProvider,
diff --git a/packages/web3-eth/test/integration/web3_eth/estimate_gas.test.ts b/packages/web3-eth/test/integration/web3_eth/estimate_gas.test.ts
index af55a3d01ed..992a48f28ff 100644
--- a/packages/web3-eth/test/integration/web3_eth/estimate_gas.test.ts
+++ b/packages/web3-eth/test/integration/web3_eth/estimate_gas.test.ts
@@ -16,9 +16,9 @@ along with web3.js. If not, see .
*/
import WebSocketProvider from 'web3-providers-ws';
-import { Address } from 'web3-utils';
+import { Address, Transaction } from 'web3-types';
-import Web3Eth, { Transaction } from '../../../src';
+import Web3Eth from '../../../src';
import {
getSystemTestAccounts,
getSystemTestProvider,
diff --git a/packages/web3-eth/test/integration/web3_eth/send_signed_transaction.test.ts b/packages/web3-eth/test/integration/web3_eth/send_signed_transaction.test.ts
index 6a72e60c00f..7895d713d74 100644
--- a/packages/web3-eth/test/integration/web3_eth/send_signed_transaction.test.ts
+++ b/packages/web3-eth/test/integration/web3_eth/send_signed_transaction.test.ts
@@ -16,17 +16,10 @@ along with web3.js. If not, see .
*/
import WebSocketProvider from 'web3-providers-ws';
-import { Address, Bytes, hexToNumber } from 'web3-utils';
-
-import {
- DEFAULT_RETURN_FORMAT,
- FMT_BYTES,
- FMT_NUMBER,
- format,
- SignedTransactionInfo,
-} from 'web3-common';
+import { Address, Bytes, SignedTransactionInfoAPI, Transaction } from 'web3-types';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format, hexToNumber } from 'web3-utils';
import { isHexStrict } from 'web3-validator';
-import Web3Eth, { InternalTransaction, Transaction } from '../../../src';
+import Web3Eth, { InternalTransaction } from '../../../src';
import {
getSystemTestAccounts,
getSystemTestProvider,
@@ -201,7 +194,7 @@ describe('Web3Eth.sendSignedTransaction', () => {
describe('Transaction PromiEvents', () => {
let transaction: Transaction;
- let signedTransaction: SignedTransactionInfo;
+ let signedTransaction: SignedTransactionInfoAPI;
beforeEach(async () => {
const accountNonce = await web3Eth.getTransactionCount(accounts[0]);
diff --git a/packages/web3-eth/test/integration/web3_eth/send_transaction.test.ts b/packages/web3-eth/test/integration/web3_eth/send_transaction.test.ts
index 1486166c88e..5f5609b1e75 100644
--- a/packages/web3-eth/test/integration/web3_eth/send_transaction.test.ts
+++ b/packages/web3-eth/test/integration/web3_eth/send_transaction.test.ts
@@ -15,12 +15,12 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
+import { Address, Transaction, TransactionWithLocalWalletIndex } from 'web3-types';
import { Wallet } from 'web3-eth-accounts';
import WebSocketProvider from 'web3-providers-ws';
-import { Address } from 'web3-utils';
import { isHexStrict } from 'web3-validator';
-import Web3Eth, { Transaction, TransactionWithLocalWalletIndex } from '../../../src';
+import Web3Eth from '../../../src';
import {
createAccountProvider,
getSystemTestAccounts,
diff --git a/packages/web3-eth/test/integration/web3_eth/sign.test.ts b/packages/web3-eth/test/integration/web3_eth/sign.test.ts
index cb01726f2d5..2cb1235c417 100644
--- a/packages/web3-eth/test/integration/web3_eth/sign.test.ts
+++ b/packages/web3-eth/test/integration/web3_eth/sign.test.ts
@@ -16,7 +16,7 @@ along with web3.js. If not, see .
*/
import WebSocketProvider from 'web3-providers-ws';
-import { Address } from 'web3-utils';
+import { Address } from 'web3-types';
import { isHexStrict } from 'web3-validator';
import Web3Eth from '../../../src';
diff --git a/packages/web3-eth/test/integration/web3_eth/sign_transaction.test.ts b/packages/web3-eth/test/integration/web3_eth/sign_transaction.test.ts
index 50536c4f499..25cf2cd8ec3 100644
--- a/packages/web3-eth/test/integration/web3_eth/sign_transaction.test.ts
+++ b/packages/web3-eth/test/integration/web3_eth/sign_transaction.test.ts
@@ -16,9 +16,9 @@ along with web3.js. If not, see .
*/
import WebSocketProvider from 'web3-providers-ws';
-import { Address } from 'web3-utils';
+import { Address, Transaction } from 'web3-types';
-import Web3Eth, { Transaction } from '../../../src';
+import Web3Eth from '../../../src';
import {
getSystemTestAccounts,
getSystemTestProvider,
diff --git a/packages/web3-eth/test/unit/default_transaction_builder.test.ts b/packages/web3-eth/test/unit/default_transaction_builder.test.ts
index 77f4cd8a576..ac5f09a19ba 100644
--- a/packages/web3-eth/test/unit/default_transaction_builder.test.ts
+++ b/packages/web3-eth/test/unit/default_transaction_builder.test.ts
@@ -14,7 +14,12 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { EthExecutionAPI } from 'web3-common';
+import {
+ EthExecutionAPI,
+ PopulatedUnsignedEip1559Transaction,
+ PopulatedUnsignedEip2930Transaction,
+ Transaction,
+} from 'web3-types';
import { Web3Context } from 'web3-core';
import HttpProvider from 'web3-providers-http';
import { isNullish } from 'web3-validator';
@@ -25,11 +30,6 @@ import {
} from '../../src/errors';
import { defaultTransactionBuilder } from '../../src/utils/transaction_builder';
import * as rpcMethods from '../../src/rpc_methods';
-import {
- PopulatedUnsignedEip1559Transaction,
- PopulatedUnsignedEip2930Transaction,
- Transaction,
-} from '../../src/types';
jest.mock('../../src/rpc_methods');
diff --git a/packages/web3-eth/test/unit/format_transaction.test.ts b/packages/web3-eth/test/unit/format_transaction.test.ts
index 227cffd62d1..bea26fddd18 100644
--- a/packages/web3-eth/test/unit/format_transaction.test.ts
+++ b/packages/web3-eth/test/unit/format_transaction.test.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER } from 'web3-utils';
import { formatTransaction } from '../../src/utils/format_transaction';
import {
bytesAsHexStringTransaction,
diff --git a/packages/web3-eth/test/unit/prepare_transaction_for_signing.test.ts b/packages/web3-eth/test/unit/prepare_transaction_for_signing.test.ts
index 851a0639463..8d2c6c916e7 100644
--- a/packages/web3-eth/test/unit/prepare_transaction_for_signing.test.ts
+++ b/packages/web3-eth/test/unit/prepare_transaction_for_signing.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { EthExecutionAPI } from 'web3-common';
+import { EthExecutionAPI } from 'web3-types';
import { Web3Context } from 'web3-core';
import HttpProvider from 'web3-providers-http';
import { isNullish } from 'web3-validator';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/call.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/call.test.ts
index 630b088f1fb..795723318f1 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/call.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/call.test.ts
@@ -16,7 +16,7 @@ along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
import { isNullish } from 'web3-validator';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { call as rpcMethodsCall } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/estimate_gas.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/estimate_gas.test.ts
index b6b4e20b6c1..4d6b06a9038 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/estimate_gas.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/estimate_gas.test.ts
@@ -16,7 +16,7 @@ along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
import { isNullish } from 'web3-validator';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { estimateGas as rpcMethodsEstimateGas } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/call.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/call.ts
index e0152bddc75..e6c34ec3897 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/call.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/call.ts
@@ -14,9 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag, BlockTags } from 'web3-utils';
-
-import { TransactionCall } from '../../../../src/types';
+import { BlockNumberOrTag, BlockTags, TransactionCall } from 'web3-types';
export const mockRpcResponse = '0x000000000000000000000000000000000000000000000000000000000000000a';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/estimate_gas.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/estimate_gas.ts
index 3e1d8c3f142..1f78413a656 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/estimate_gas.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/estimate_gas.ts
@@ -14,9 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag, BlockTags } from 'web3-utils';
-
-import { Transaction } from '../../../../src/types';
+import { BlockNumberOrTag, BlockTags, Transaction } from 'web3-types';
export const mockRpcResponse = '0x5208';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_balance.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_balance.ts
index 56e79f1864d..d687354b4f9 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_balance.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_balance.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, BlockNumberOrTag, BlockTags } from 'web3-utils';
+import { Address, BlockNumberOrTag, BlockTags } from 'web3-types';
export const mockRpcResponse = '0xe8d4a51000';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block.ts
index 89c72531b87..55755902021 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Block, TransactionInfo } from 'web3-common';
-import { BlockNumberOrTag, BlockTags, Bytes } from 'web3-utils';
+import { Block, TransactionInfo, BlockNumberOrTag, BlockTags, Bytes } from 'web3-types';
export const mockRpcResponse: Block = {
parentHash: '0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54',
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block_transaction_count.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block_transaction_count.ts
index b077dd9e1ec..4747a1eb2d1 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block_transaction_count.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block_transaction_count.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag, BlockTags, Bytes } from 'web3-utils';
+import { BlockNumberOrTag, BlockTags, Bytes } from 'web3-types';
export const mockRpcResponse = '0xb';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block_uncle_count.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block_uncle_count.ts
index b077dd9e1ec..4747a1eb2d1 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block_uncle_count.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_block_uncle_count.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag, BlockTags, Bytes } from 'web3-utils';
+import { BlockNumberOrTag, BlockTags, Bytes } from 'web3-types';
export const mockRpcResponse = '0xb';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_code.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_code.ts
index e26f70fc8c7..3122f74453c 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_code.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_code.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, BlockNumberOrTag, BlockTags } from 'web3-utils';
+import { Address, BlockNumberOrTag, BlockTags } from 'web3-types';
export const mockRpcResponse =
'0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_fee_history.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_fee_history.ts
index c146aec6989..e1dbe41c205 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_fee_history.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_fee_history.ts
@@ -14,10 +14,9 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { FeeHistoryResult } from 'web3-common';
-import { BlockNumberOrTag, BlockTags, Numbers } from 'web3-utils';
+import { FeeHistoryResultAPI, BlockNumberOrTag, BlockTags, Numbers } from 'web3-types';
-export const mockRpcResponse: FeeHistoryResult = {
+export const mockRpcResponse: FeeHistoryResultAPI = {
oldestBlock: '0xa30950',
baseFeePerGas: '0x9',
reward: [],
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_logs.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_logs.ts
index 409186306c5..e38527f2b9a 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_logs.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_logs.ts
@@ -14,10 +14,9 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { FilterResults } from 'web3-common';
-import { Filter } from 'web3-utils';
+import { FilterResultsAPI, Filter } from 'web3-types';
-export const mockRpcResponse: FilterResults = [
+export const mockRpcResponse: FilterResultsAPI = [
{
logIndex: '0x1',
blockNumber: '0x1b4',
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_pending_transactions.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_pending_transactions.ts
index 9f100804db5..2084cf18f3d 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_pending_transactions.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_pending_transactions.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Transaction } from '../../../../src/types';
+import { Transaction } from 'web3-types';
const transaction: Transaction = {
from: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_proof.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_proof.ts
index e2635e84740..c29e1b58a53 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_proof.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_proof.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, BlockNumberOrTag, BlockTags, Bytes } from 'web3-utils';
+import { Address, BlockNumberOrTag, BlockTags, Bytes } from 'web3-types';
export const mockRpcResponse = {
accountProof: [
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_storage_at.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_storage_at.ts
index 0020ec39365..7fef3e1ecf8 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_storage_at.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_storage_at.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, BlockNumberOrTag, BlockTags, Numbers } from 'web3-utils';
+import { Address, BlockNumberOrTag, BlockTags, Numbers } from 'web3-types';
export const mockRpcResponse = '0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction.ts
index e19b097f1c8..c64bb34d0cc 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction.ts
@@ -14,9 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Bytes } from 'web3-utils';
-
-import { Transaction } from '../../../../src/types';
+import { Bytes, Transaction } from 'web3-types';
export const mockRpcResponse: Transaction = {
from: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_count.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_count.ts
index 56e79f1864d..d687354b4f9 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_count.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_count.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, BlockNumberOrTag, BlockTags } from 'web3-utils';
+import { Address, BlockNumberOrTag, BlockTags } from 'web3-types';
export const mockRpcResponse = '0xe8d4a51000';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_from_block.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_from_block.ts
index e0e198142dc..b607b6c8386 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_from_block.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_from_block.ts
@@ -14,9 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag, BlockTags, Bytes, Numbers } from 'web3-utils';
-
-import { Transaction } from '../../../../src/types';
+import { BlockNumberOrTag, BlockTags, Bytes, Numbers, Transaction } from 'web3-types';
export const mockRpcResponse: Transaction = {
from: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_receipt.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_receipt.ts
index 02348cae834..d2e4f1fba1d 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_receipt.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_transaction_receipt.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { TransactionReceipt } from 'web3-common';
-import { Bytes } from 'web3-utils';
+import { TransactionReceipt, Bytes } from 'web3-types';
export const mockRpcResponse: TransactionReceipt = {
transactionHash: '0xe21194c9509beb01be7e90c2bcefff2804cd85836ae12134f22ad4acda0fc547',
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_uncle.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_uncle.ts
index 32bddcd36b1..f2a57bc8085 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_uncle.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/get_uncle.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Block } from 'web3-common';
-import { BlockNumberOrTag, BlockTags, Bytes, Numbers } from 'web3-utils';
+import { BlockNumberOrTag, BlockTags, Bytes, Numbers, Block } from 'web3-types';
export const mockRpcResponse: Block = {
parentHash: '0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54',
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/return_formats.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/return_formats.ts
index f65dfabce3e..0109e7d093e 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/return_formats.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/return_formats.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DataFormat, FMT_BYTES, FMT_NUMBER } from 'web3-common';
+import { DataFormat, FMT_BYTES, FMT_NUMBER } from 'web3-utils';
export const returnFormats: DataFormat[] = [
{ number: FMT_NUMBER.NUMBER, bytes: FMT_BYTES.HEX },
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/send_signed_transaction.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/send_signed_transaction.ts
index 3fd401f188e..0a4656be696 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/send_signed_transaction.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/send_signed_transaction.ts
@@ -14,9 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Bytes } from 'web3-utils';
-
-import { TransactionReceipt } from '../../../../src/types';
+import { Bytes, TransactionReceipt } from 'web3-types';
export const expectedTransactionHash =
'0xe21194c9509beb01be7e90c2bcefff2804cd85836ae12134f22ad4acda0fc547';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/send_transaction.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/send_transaction.ts
index 12f3cf9b074..05bc02d2c31 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/send_transaction.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/send_transaction.ts
@@ -15,7 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { SendTransactionOptions, Transaction, TransactionReceipt } from '../../../../src/types';
+import { Transaction, TransactionReceipt } from 'web3-types';
+import { SendTransactionOptions } from '../../../../src/types';
export const expectedTransactionHash =
'0xe21194c9509beb01be7e90c2bcefff2804cd85836ae12134f22ad4acda0fc547';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/sign.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/sign.ts
index c6db02820b0..1565b822153 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/sign.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/sign.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, Bytes } from 'web3-utils';
+import { Address, Bytes } from 'web3-types';
export const mockRpcResponse = '0x736f796c656e7420677265656e2069732070656f706c65';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/sign_transaction.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/sign_transaction.ts
index 8d1f9a7b0cf..dc4516e6708 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/sign_transaction.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/fixtures/sign_transaction.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Transaction } from '../../../../src/types';
+import { Transaction } from 'web3-types';
const transaction: Transaction = {
from: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_balance.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_balance.test.ts
index 507c598e202..57b1e31fd8e 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_balance.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_balance.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { isNullish } from 'web3-validator';
import { getBalance as rpcMethodsGetBalance } from '../../../src/rpc_methods';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_block.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_block.test.ts
index c7af128c43c..db3a0bcffca 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_block.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_block.test.ts
@@ -15,9 +15,9 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { isBytes, isNullish } from 'web3-validator';
-import { Bytes } from 'web3-utils';
+import { Bytes } from 'web3-types';
import { getBlockByHash, getBlockByNumber } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_number.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_number.test.ts
index ff75c2c9cc5..1fdb0843748 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_number.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_number.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { getBlockNumber as rpcMethodsGetBlockNumber } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_transaction_count.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_transaction_count.test.ts
index d07b127ba93..3f875750f19 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_transaction_count.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_transaction_count.test.ts
@@ -15,9 +15,9 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { isBytes, isNullish } from 'web3-validator';
-import { Bytes } from 'web3-utils';
+import { Bytes } from 'web3-types';
import {
getBlockTransactionCountByHash,
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_uncle_count.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_uncle_count.test.ts
index f3ad477ce44..c3db67ccb89 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_uncle_count.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_block_uncle_count.test.ts
@@ -15,9 +15,9 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { isBytes, isNullish } from 'web3-validator';
-import { Bytes } from 'web3-utils';
+import { Bytes } from 'web3-types';
import { getUncleCountByBlockHash, getUncleCountByBlockNumber } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_chain_id.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_chain_id.test.ts
index 5d89b862937..6adefc7616f 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_chain_id.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_chain_id.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { getChainId as rpcMethodsGetChainId } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_code.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_code.test.ts
index e003b5902d1..597a598c7d4 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_code.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_code.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { isNullish } from 'web3-validator';
import { getCode as rpcMethodsGetCode } from '../../../src/rpc_methods';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_fee_history.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_fee_history.test.ts
index 322a6c1080c..ac7b16277a0 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_fee_history.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_fee_history.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { isNullish } from 'web3-validator';
import { getFeeHistory as rpcMethodsGetFeeHistory } from '../../../src/rpc_methods';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_gas_price.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_gas_price.test.ts
index 83e2b7d24fc..29e67bbf7a1 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_gas_price.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_gas_price.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { getGasPrice as rpcMethodsGetGasPrice } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_hash_rate.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_hash_rate.test.ts
index 1548857793a..3c506326525 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_hash_rate.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_hash_rate.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { getHashRate as rpcMethodsGetHashRate } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_logs.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_logs.test.ts
index 8f54beb2617..2f5354ecebf 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_logs.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_logs.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { getLogs as rpcMethodsGetLogs } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_pending_transactions.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_pending_transactions.test.ts
index b2e6a4e4235..d0ef11ce082 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_pending_transactions.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_pending_transactions.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER } from 'web3-utils';
import { getPendingTransactions as rpcMethodsGetPendingTransactions } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_proof.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_proof.test.ts
index 70b6a8af15d..f8d5b6469e8 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_proof.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_proof.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { isNullish } from 'web3-validator';
import { getProof as rpcMethodsGetProof } from '../../../src/rpc_methods';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_storage_at.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_storage_at.test.ts
index 13aafec3d93..38d90d51d0c 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_storage_at.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_storage_at.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { isNullish } from 'web3-validator';
import { getStorageAt as rpcMethodsGetStorageAt } from '../../../src/rpc_methods';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction.test.ts
index dba794de4bf..1cbac1163a6 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { getTransactionByHash } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_count.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_count.test.ts
index 20749b99221..3f9febf2298 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_count.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_count.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { isNullish } from 'web3-validator';
import { getTransactionCount as rpcMethodsGetTransactionCount } from '../../../src/rpc_methods';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_from_block.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_from_block.test.ts
index 75c0aef8991..6b67aa9d2cf 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_from_block.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_from_block.test.ts
@@ -15,9 +15,9 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
+import { Bytes } from 'web3-types';
import { isBytes, isNullish } from 'web3-validator';
-import { Bytes } from 'web3-utils';
import {
getTransactionByBlockHashAndIndex,
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_receipt.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_receipt.test.ts
index 814458fd5e8..3124ac05e92 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_receipt.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_transaction_receipt.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { getTransactionReceipt as rpcMethodsGetTransactionReceipt } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/get_uncle.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/get_uncle.test.ts
index fa4f9dee060..ceaebd5027e 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/get_uncle.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/get_uncle.test.ts
@@ -15,9 +15,9 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { isBytes, isNullish } from 'web3-validator';
-import { Bytes } from 'web3-utils';
+import { Bytes } from 'web3-types';
import {
getUncleByBlockHashAndIndex,
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/send_signed_transaction.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/send_signed_transaction.test.ts
index 0361edba9c2..fb64ded6dca 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/send_signed_transaction.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/send_signed_transaction.test.ts
@@ -16,7 +16,7 @@ along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, format } from 'web3-utils';
import * as rpcMethods from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
import { sendSignedTransaction } from '../../../src/rpc_method_wrappers';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/send_transaction.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/send_transaction.test.ts
index 2ce5e1dbd43..2dc7f4a34b3 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/send_transaction.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/send_transaction.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, format } from 'web3-utils';
import { isNullish } from 'web3-validator';
import * as rpcMethods from '../../../src/rpc_methods';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/sign.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/sign.test.ts
index a2d52deb65f..141c7cd59c3 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/sign.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/sign.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { sign as rpcMethodsSign } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_method_wrappers/sign_transaction.test.ts b/packages/web3-eth/test/unit/rpc_method_wrappers/sign_transaction.test.ts
index cf15c94ff5d..62738a8a397 100644
--- a/packages/web3-eth/test/unit/rpc_method_wrappers/sign_transaction.test.ts
+++ b/packages/web3-eth/test/unit/rpc_method_wrappers/sign_transaction.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { Web3Context } from 'web3-core';
-import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-common';
+import { DEFAULT_RETURN_FORMAT, ETH_DATA_FORMAT, FMT_BYTES, FMT_NUMBER, format } from 'web3-utils';
import { signTransaction as rpcMethodsSignTransaction } from '../../../src/rpc_methods';
import { Web3EthExecutionAPI } from '../../../src/web3_eth_execution_api';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/call.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/call.ts
index ef53df374a8..33d5decd414 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/call.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/call.ts
@@ -15,13 +15,11 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { TransactionCall } from 'web3-common';
-import { BlockTags } from 'web3-utils';
-import { BlockNumberOrTag } from 'web3-validator';
+import { TransactionCallAPI, BlockTags, BlockNumberOrTag } from 'web3-types';
export const mockRpcResponse = '0x5208';
-const transaction: TransactionCall = {
+const transaction: TransactionCallAPI = {
from: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
to: '0x3535353535353535353535353535353535353535',
value: '0x174876e800',
@@ -40,7 +38,7 @@ const transaction: TransactionCall = {
* - transaction
* - blockNumber
*/
-type TestData = [string, [TransactionCall, BlockNumberOrTag]];
+type TestData = [string, [TransactionCallAPI, BlockNumberOrTag]];
export const testData: TestData[] = [
[
`${JSON.stringify(transaction)}\nblockNumber = BlockTags.LATEST`,
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/estimate_gas.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/estimate_gas.ts
index 4e2356def21..e41e11faabd 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/estimate_gas.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/estimate_gas.ts
@@ -14,13 +14,11 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { TransactionWithSender } from 'web3-common';
-import { BlockTags } from 'web3-utils';
-import { BlockNumberOrTag } from 'web3-validator';
+import { TransactionWithSenderAPI, BlockTags, BlockNumberOrTag } from 'web3-types';
export const mockRpcResponse = '0x5208';
-const transaction: Partial = {
+const transaction: Partial = {
from: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
to: '0x3535353535353535353535353535353535353535',
value: '0x174876e800',
@@ -41,7 +39,7 @@ const transaction: Partial = {
* - transaction
* - blockNumber
*/
-type TestData = [string, [Partial, BlockNumberOrTag]];
+type TestData = [string, [Partial, BlockNumberOrTag]];
export const testData: TestData[] = [
[
`${JSON.stringify(transaction)}\nblockNumber = BlockTags.LATEST`,
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_balance.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_balance.ts
index 4ba2e9ddc03..bbb5147b559 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_balance.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_balance.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, BlockTags } from 'web3-utils';
-import { BlockNumberOrTag } from 'web3-validator';
+import { Address, BlockTags, BlockNumberOrTag } from 'web3-types';
export const mockRpcResponse = '0xe8d4a51000';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_by_hash.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_by_hash.ts
index b4aeecca439..081b1192cd9 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_by_hash.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_by_hash.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString32Bytes } from 'web3-utils';
+import { HexString32Bytes } from 'web3-types';
export const mockRpcResponse = '0xb';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_by_number.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_by_number.ts
index c789d933a1c..e4a85204ebf 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_by_number.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_by_number.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag } from 'web3-validator';
-import { BlockTags } from 'web3-utils';
+import { BlockNumberOrTag, BlockTags } from 'web3-types';
export const mockRpcResponse = '0xb';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_transaction_count_by_hash.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_transaction_count_by_hash.ts
index 852226c67f8..a6b485b1f86 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_transaction_count_by_hash.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_transaction_count_by_hash.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString32Bytes } from 'web3-utils';
+import { HexString32Bytes } from 'web3-types';
export const mockRpcResponse = '0xb';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_transaction_count_by_number.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_transaction_count_by_number.ts
index 2ebf4fa083f..41200c9b427 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_transaction_count_by_number.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_block_transaction_count_by_number.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag } from 'web3-validator';
-import { BlockTags } from 'web3-utils';
+import { BlockTags, BlockNumberOrTag } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_code.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_code.ts
index 34fdea9240a..c1d52fce751 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_code.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_code.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag } from 'web3-validator';
-import { Address, BlockTags } from 'web3-utils';
+import { Address, BlockTags, BlockNumberOrTag } from 'web3-types';
export const mockRpcResponse = '0xb';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_fee_history.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_fee_history.ts
index 5b534b4e463..2dd72a97a76 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_fee_history.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_fee_history.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag } from 'web3-validator';
-import { BlockTags, Uint } from 'web3-utils';
+import { BlockNumberOrTag, BlockTags, Uint } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_filter_changes.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_filter_changes.ts
index 6cbe99cb4cc..34d9698d645 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_filter_changes.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_filter_changes.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Uint } from 'web3-utils';
+import { Uint } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_filter_logs.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_filter_logs.ts
index 6cbe99cb4cc..34d9698d645 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_filter_logs.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_filter_logs.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Uint } from 'web3-utils';
+import { Uint } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_logs.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_logs.ts
index fa02001b489..c64dee22c6d 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_logs.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_logs.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Filter } from 'web3-utils';
+import { Filter } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_proof.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_proof.ts
index d5d3fdc2d2f..e3963c3ece9 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_proof.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_proof.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, HexString32Bytes, Uint } from 'web3-utils';
+import { Address, HexString32Bytes, Uint } from 'web3-types';
const address = '0x407d73d8a49eeb85d32cf465507dd71d507100c1';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_storage_at.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_storage_at.ts
index b30ad5e6dd9..23c01cfcce6 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_storage_at.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_storage_at.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag } from 'web3-validator';
-import { Address, BlockTags, Uint256 } from 'web3-utils';
+import { BlockNumberOrTag, Address, BlockTags, Uint256 } from 'web3-types';
export const mockRpcResponse = '0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_block_hash_and_index.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_block_hash_and_index.ts
index fac0b08ff8d..ea70cfce63b 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_block_hash_and_index.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_block_hash_and_index.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString32Bytes, Uint } from 'web3-utils';
+import { HexString32Bytes, Uint } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_block_number_and_index.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_block_number_and_index.ts
index 66dd8d91588..8b6e709be95 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_block_number_and_index.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_block_number_and_index.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag } from 'web3-validator';
-import { BlockTags, Uint } from 'web3-utils';
+import { BlockNumberOrTag, BlockTags, Uint } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_hash.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_hash.ts
index 7968eee331e..daede4bf5d6 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_hash.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_by_hash.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString32Bytes } from 'web3-utils';
+import { HexString32Bytes } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_count.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_count.ts
index 4c77392e74a..18c472568c8 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_count.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_count.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag } from 'web3-validator';
-import { Address, BlockTags } from 'web3-utils';
+import { BlockNumberOrTag, Address, BlockTags } from 'web3-types';
export const mockRpcResponse = '0xe8d4a51000';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_receipt.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_receipt.ts
index 4c20d464084..68b9639fe4f 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_receipt.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_transaction_receipt.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString32Bytes } from 'web3-utils';
+import { HexString32Bytes } from 'web3-types';
export const mockRpcResponse = '0xb';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_by_block_hash_and_index.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_by_block_hash_and_index.ts
index d62002a8cec..8577efe646b 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_by_block_hash_and_index.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_by_block_hash_and_index.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString32Bytes, Uint } from 'web3-utils';
+import { HexString32Bytes, Uint } from 'web3-types';
export const mockRpcResponse = '0xb';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_count_by_block_hash.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_count_by_block_hash.ts
index 3a921f9c0b3..612ef639dce 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_count_by_block_hash.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_count_by_block_hash.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag } from 'web3-validator';
+import { HexString32Bytes } from 'web3-types';
export const mockRpcResponse = '0xb';
@@ -24,7 +24,7 @@ export const mockRpcResponse = '0xb';
* - Input parameters:
* - blockHash
*/
-type TestData = [string, [BlockNumberOrTag]];
+type TestData = [string, [HexString32Bytes]];
export const testData: TestData[] = [
[
'blockHash = "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"',
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_count_by_block_number.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_count_by_block_number.ts
index 2f4a1c3d6ca..2e010f371fc 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_count_by_block_number.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/get_uncle_count_by_block_number.ts
@@ -14,8 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockNumberOrTag } from 'web3-validator';
-import { BlockTags } from 'web3-utils';
+import { BlockNumberOrTag, BlockTags } from 'web3-types';
export const mockRpcResponse = '0xb';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/new_filter.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/new_filter.ts
index fa02001b489..c64dee22c6d 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/new_filter.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/new_filter.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Filter } from 'web3-utils';
+import { Filter } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/send_raw_transaction.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/send_raw_transaction.ts
index 228d3a4c346..1cc49936062 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/send_raw_transaction.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/send_raw_transaction.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexStringBytes } from 'web3-utils';
+import { HexStringBytes } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/send_transaction.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/send_transaction.ts
index 90534ab525d..936b846966b 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/send_transaction.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/send_transaction.ts
@@ -14,11 +14,11 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { TransactionWithSender } from 'web3-common';
+import { TransactionWithSenderAPI } from 'web3-types';
export const mockRpcResponse = '0x5208';
-const transaction: Partial = {
+const transaction: Partial = {
from: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
to: '0x3535353535353535353535353535353535353535',
value: '0x174876e800',
@@ -36,5 +36,5 @@ const transaction: Partial = {
* - Input parameters:
* - transaction
*/
-type TestData = [string, [TransactionWithSender | Partial]];
+type TestData = [string, [TransactionWithSenderAPI | Partial]];
export const testData: TestData[] = [[`${JSON.stringify(transaction)}`, [transaction]]];
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/sign.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/sign.ts
index c2262de2b28..a56832aac05 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/sign.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/sign.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, HexStringBytes } from 'web3-utils';
+import { Address, HexStringBytes } from 'web3-types';
export const mockRpcResponse = '0xb';
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/sign_transaction.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/sign_transaction.ts
index 90534ab525d..936b846966b 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/sign_transaction.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/sign_transaction.ts
@@ -14,11 +14,11 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { TransactionWithSender } from 'web3-common';
+import { TransactionWithSenderAPI } from 'web3-types';
export const mockRpcResponse = '0x5208';
-const transaction: Partial = {
+const transaction: Partial = {
from: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
to: '0x3535353535353535353535353535353535353535',
value: '0x174876e800',
@@ -36,5 +36,5 @@ const transaction: Partial = {
* - Input parameters:
* - transaction
*/
-type TestData = [string, [TransactionWithSender | Partial]];
+type TestData = [string, [TransactionWithSenderAPI | Partial]];
export const testData: TestData[] = [[`${JSON.stringify(transaction)}`, [transaction]]];
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/submit_hashrate.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/submit_hashrate.ts
index 3d7a3bcbe66..c41243ca1f3 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/submit_hashrate.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/submit_hashrate.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString32Bytes } from 'web3-utils';
+import { HexString32Bytes } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/submit_work.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/submit_work.ts
index d238ddeaac2..3757f663920 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/submit_work.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/submit_work.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString32Bytes, HexString8Bytes } from 'web3-utils';
+import { HexString32Bytes, HexString8Bytes } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-eth/test/unit/rpc_methods/fixtures/uninstall_filter.ts b/packages/web3-eth/test/unit/rpc_methods/fixtures/uninstall_filter.ts
index 6cbe99cb4cc..34d9698d645 100644
--- a/packages/web3-eth/test/unit/rpc_methods/fixtures/uninstall_filter.ts
+++ b/packages/web3-eth/test/unit/rpc_methods/fixtures/uninstall_filter.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Uint } from 'web3-utils';
+import { Uint } from 'web3-types';
/**
* Array consists of:
diff --git a/packages/web3-net/package.json b/packages/web3-net/package.json
index 2f040a28790..dfef729ec5c 100644
--- a/packages/web3-net/package.json
+++ b/packages/web3-net/package.json
@@ -39,7 +39,7 @@
"typescript": "^4.5.2"
},
"dependencies": {
- "web3-common": "1.0.0-alpha.0",
+ "web3-types": "1.0.0-alpha.0",
"web3-core": "4.0.0-alpha.0",
"web3-utils": "4.0.0-alpha.1"
}
diff --git a/packages/web3-net/src/net.ts b/packages/web3-net/src/net.ts
index 8620cad0b04..e93d950c030 100644
--- a/packages/web3-net/src/net.ts
+++ b/packages/web3-net/src/net.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DataFormat, DEFAULT_RETURN_FORMAT } from 'web3-common';
+import { DataFormat, DEFAULT_RETURN_FORMAT } from 'web3-utils';
import { Web3Context } from 'web3-core';
import * as rpcMethodsWrappers from './rpc_method_wrappers';
import { Web3NetAPI } from './web3_net_api';
diff --git a/packages/web3-net/src/rpc_method_wrappers.ts b/packages/web3-net/src/rpc_method_wrappers.ts
index e26f2533268..2d055a20b8d 100644
--- a/packages/web3-net/src/rpc_method_wrappers.ts
+++ b/packages/web3-net/src/rpc_method_wrappers.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DataFormat, format } from 'web3-common';
+import { DataFormat, format } from 'web3-utils';
import { Web3Context } from 'web3-core';
import * as rpcMethods from './rpc_methods';
import { Web3NetAPI } from './web3_net_api';
diff --git a/packages/web3-net/src/web3_net_api.ts b/packages/web3-net/src/web3_net_api.ts
index cafc28e6d8a..93794657729 100644
--- a/packages/web3-net/src/web3_net_api.ts
+++ b/packages/web3-net/src/web3_net_api.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString } from 'web3-utils';
+import { HexString } from 'web3-types';
export type Web3NetAPI = {
net_version: () => string; // https://eth.wiki/json-rpc/API#net_version
diff --git a/packages/web3-net/test/fixtures/rpc_method_wrappers.ts b/packages/web3-net/test/fixtures/rpc_method_wrappers.ts
index 54fb33a7057..123ce56e437 100644
--- a/packages/web3-net/test/fixtures/rpc_method_wrappers.ts
+++ b/packages/web3-net/test/fixtures/rpc_method_wrappers.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DataFormat, FMT_BYTES, FMT_NUMBER } from 'web3-common';
+import { DataFormat, FMT_BYTES, FMT_NUMBER } from 'web3-utils';
export const getIdValidData: [DataFormat, any, any][] = [
[{ number: FMT_NUMBER.HEX, bytes: FMT_BYTES.HEX }, '3', '0x3'],
diff --git a/packages/web3-net/test/fixtures/web3_net_methods.ts b/packages/web3-net/test/fixtures/web3_net_methods.ts
index 5bdcf10393b..3d74b3f9d5a 100644
--- a/packages/web3-net/test/fixtures/web3_net_methods.ts
+++ b/packages/web3-net/test/fixtures/web3_net_methods.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { DataFormat, FMT_BYTES, FMT_NUMBER } from 'web3-common';
+import { DataFormat, FMT_BYTES, FMT_NUMBER } from 'web3-utils';
export const getDataFormat: DataFormat[] = [
{ number: FMT_NUMBER.HEX, bytes: FMT_BYTES.HEX },
diff --git a/packages/web3-providers-http/package.json b/packages/web3-providers-http/package.json
index da4e5bc3d20..cf11376fe1a 100644
--- a/packages/web3-providers-http/package.json
+++ b/packages/web3-providers-http/package.json
@@ -46,7 +46,7 @@
"dependencies": {
"web3-errors": "1.0.0-alpha.0",
"cross-fetch": "^3.1.4",
- "web3-common": "1.0.0-alpha.0",
+ "web3-types": "1.0.0-alpha.0",
"web3-utils": "4.0.0-alpha.1"
}
}
diff --git a/packages/web3-providers-http/src/index.ts b/packages/web3-providers-http/src/index.ts
index 7382e3d3eb6..50406c326f7 100644
--- a/packages/web3-providers-http/src/index.ts
+++ b/packages/web3-providers-http/src/index.ts
@@ -19,15 +19,14 @@ import fetch from 'cross-fetch';
import {
EthExecutionAPI,
JsonRpcResponseWithResult,
- ResponseError,
Web3APIMethod,
Web3APIPayload,
Web3APIReturnType,
Web3APISpec,
Web3BaseProvider,
Web3ProviderStatus,
-} from 'web3-common';
-import { InvalidClientError, MethodNotImplementedError } from 'web3-errors';
+} from 'web3-types';
+import { InvalidClientError, MethodNotImplementedError, ResponseError } from 'web3-errors';
import { HttpProviderOptions } from './types';
export { HttpProviderOptions } from './types';
diff --git a/packages/web3-providers-http/test/integration/request.test.ts b/packages/web3-providers-http/test/integration/request.test.ts
index b7f2e2c93b3..09270f30a49 100644
--- a/packages/web3-providers-http/test/integration/request.test.ts
+++ b/packages/web3-providers-http/test/integration/request.test.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { EthExecutionAPI, Web3APIPayload, JsonRpcResponseWithResult } from 'web3-common';
+import { EthExecutionAPI, Web3APIPayload, JsonRpcResponseWithResult } from 'web3-types';
import HttpProvider from '../../src/index';
import {
getSystemTestAccounts,
diff --git a/packages/web3-providers-http/test/unit/implemented_methods.test.ts b/packages/web3-providers-http/test/unit/implemented_methods.test.ts
index 41e9d021a45..892af84607b 100644
--- a/packages/web3-providers-http/test/unit/implemented_methods.test.ts
+++ b/packages/web3-providers-http/test/unit/implemented_methods.test.ts
@@ -21,7 +21,9 @@ import fetchMock from 'jest-fetch-mock';
jest.setMock('cross-fetch', fetchMock);
/* eslint-disable-next-line import/first */
-import { ResponseError, Web3APIPayload, EthExecutionAPI } from 'web3-common';
+import { Web3APIPayload, EthExecutionAPI } from 'web3-types';
+/* eslint-disable-next-line import/first */
+import { ResponseError } from 'web3-errors';
/* eslint-disable-next-line import/first */
import HttpProvider from '../../src/index';
/* eslint-disable-next-line import/first */
diff --git a/packages/web3-providers-ipc/package.json b/packages/web3-providers-ipc/package.json
index fe8cc2d120d..ab3c2ab8ef7 100644
--- a/packages/web3-providers-ipc/package.json
+++ b/packages/web3-providers-ipc/package.json
@@ -40,7 +40,7 @@
},
"dependencies": {
"web3-errors": "1.0.0-alpha.0",
- "web3-common": "1.0.0-alpha.0",
+ "web3-types": "1.0.0-alpha.0",
"web3-utils": "4.0.0-alpha.1"
}
}
diff --git a/packages/web3-providers-ipc/src/index.ts b/packages/web3-providers-ipc/src/index.ts
index eb8c6c9a511..eb81962b661 100644
--- a/packages/web3-providers-ipc/src/index.ts
+++ b/packages/web3-providers-ipc/src/index.ts
@@ -19,15 +19,12 @@ import { EventEmitter } from 'events';
import { existsSync } from 'fs';
import { Socket } from 'net';
import {
- DeferredPromise,
EthExecutionAPI,
- jsonRpc,
JsonRpcId,
JsonRpcNotification,
JsonRpcResponse,
JsonRpcResponseWithResult,
JsonRpcResult,
- ResponseError,
Web3APIMethod,
Web3APIPayload,
Web3APIReturnType,
@@ -35,9 +32,14 @@ import {
Web3BaseProvider,
Web3ProviderEventCallback,
Web3ProviderStatus,
-} from 'web3-common';
-import { ConnectionNotOpenError, InvalidClientError, InvalidConnectionError } from 'web3-errors';
-import { isNullish } from 'web3-utils';
+} from 'web3-types';
+import {
+ ConnectionNotOpenError,
+ InvalidClientError,
+ InvalidConnectionError,
+ ResponseError,
+} from 'web3-errors';
+import { isNullish, Web3DeferredPromise, jsonRpc } from 'web3-utils';
type WaitOptions = {
timeOutTime: number;
@@ -53,7 +55,7 @@ export default class IpcProvider<
private waitOptions: WaitOptions;
private _connectionStatus: Web3ProviderStatus;
- private readonly _requestQueue: Map>;
+ private readonly _requestQueue: Map>;
public constructor(socketPath: string) {
super();
@@ -62,7 +64,7 @@ export default class IpcProvider<
this._socketPath = socketPath;
this._socket = new Socket();
- this._requestQueue = new Map>();
+ this._requestQueue = new Map>();
this.connect();
this.waitOptions = {
@@ -167,7 +169,7 @@ export default class IpcProvider<
}
try {
- const defPromise = new DeferredPromise>();
+ const defPromise = new Web3DeferredPromise>();
this._requestQueue.set(request.id, defPromise);
this._socket.write(JSON.stringify(request));
@@ -215,7 +217,7 @@ export default class IpcProvider<
private _clearQueues(event?: CloseEvent) {
if (this._requestQueue.size > 0) {
- this._requestQueue.forEach((request: DeferredPromise, key: JsonRpcId) => {
+ this._requestQueue.forEach((request: Web3DeferredPromise, key: JsonRpcId) => {
request.reject(new ConnectionNotOpenError(event));
this._requestQueue.delete(key);
});
diff --git a/packages/web3-providers-ws/package.json b/packages/web3-providers-ws/package.json
index 5ceca480a1b..f757f97e895 100644
--- a/packages/web3-providers-ws/package.json
+++ b/packages/web3-providers-ws/package.json
@@ -45,7 +45,7 @@
},
"dependencies": {
"isomorphic-ws": "^4.0.1",
- "web3-common": "1.0.0-alpha.0",
+ "web3-types": "1.0.0-alpha.0",
"web3-errors": "1.0.0-alpha.0",
"web3-utils": "4.0.0-alpha.1",
"ws": "^8.2.3"
diff --git a/packages/web3-providers-ws/src/index.ts b/packages/web3-providers-ws/src/index.ts
index 10a0e6ebef1..0660c23fbb4 100644
--- a/packages/web3-providers-ws/src/index.ts
+++ b/packages/web3-providers-ws/src/index.ts
@@ -31,11 +31,9 @@ import {
Web3BaseProvider,
Web3ProviderEventCallback,
Web3ProviderStatus,
- DeferredPromise,
- jsonRpc,
- ResponseError,
JsonRpcResponseWithResult,
-} from 'web3-common';
+} from 'web3-types';
+import { jsonRpc, isNullish, Web3DeferredPromise } from 'web3-utils';
import {
InvalidClientError,
InvalidConnectionError,
@@ -43,8 +41,8 @@ import {
PendingRequestsOnReconnectingError,
Web3WSProviderError,
RequestAlreadySentError,
+ ResponseError,
} from 'web3-errors';
-import { isNullish } from 'web3-utils';
import { EventEmittedCallback, OnCloseEvent, ReconnectOptions, WSRequestItem } from './types';
export { ClientRequestArgs } from 'http';
@@ -204,7 +202,7 @@ export default class WebSocketProvider<
throw new RequestAlreadySentError(requestId);
}
- const deferredPromise = new DeferredPromise>();
+ const deferredPromise = new Web3DeferredPromise>();
const reqItem: WSRequestItem> = {
payload: request,
diff --git a/packages/web3-providers-ws/src/types.ts b/packages/web3-providers-ws/src/types.ts
index 054bfe9f078..ad6cd2b0745 100644
--- a/packages/web3-providers-ws/src/types.ts
+++ b/packages/web3-providers-ws/src/types.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Web3APIMethod, Web3APIPayload, Web3APISpec, DeferredPromise } from 'web3-common';
+import { Web3APIMethod, Web3APIPayload, Web3APISpec, Web3DeferredPromise } from 'web3-types';
export type ReconnectOptions = {
autoReconnect: boolean;
@@ -29,7 +29,7 @@ export interface WSRequestItem<
ResponseType,
> {
payload: Web3APIPayload;
- deferredPromise: DeferredPromise;
+ deferredPromise: Web3DeferredPromise;
}
export type OnCloseEvent = {
diff --git a/packages/web3-providers-ws/test/integration/web_socket_provider_integration.test.ts b/packages/web3-providers-ws/test/integration/web_socket_provider_integration.test.ts
index 184d21c3c2d..2a229b444b9 100644
--- a/packages/web3-providers-ws/test/integration/web_socket_provider_integration.test.ts
+++ b/packages/web3-providers-ws/test/integration/web_socket_provider_integration.test.ts
@@ -21,9 +21,9 @@ import {
JsonRpcNotification,
JsonRpcSubscriptionResult,
JsonRpcId,
- DeferredPromise,
JsonRpcResponse,
-} from 'web3-common';
+} from 'web3-types';
+import { Web3DeferredPromise } from 'web3-utils';
import { Web3WSProviderError } from 'web3-errors';
import WebSocketProvider from '../../src/index';
@@ -183,7 +183,7 @@ describeIf(isWs)('WebSocketProvider - implemented methods', () => {
await waitForOpenConnection(testResetProvider, currentAttempt);
- const defPromise = new DeferredPromise>();
+ const defPromise = new Web3DeferredPromise>();
const reqItem: WSRequestItem = {
payload: jsonRpcPayload,
diff --git a/packages/web3-providers-ws/test/unit/web_socket_provider.test.ts b/packages/web3-providers-ws/test/unit/web_socket_provider.test.ts
index 1c74af1ff4a..d2f2ea204cf 100644
--- a/packages/web3-providers-ws/test/unit/web_socket_provider.test.ts
+++ b/packages/web3-providers-ws/test/unit/web_socket_provider.test.ts
@@ -15,7 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import WebSocket from 'isomorphic-ws';
-import { EthExecutionAPI, ResponseError, Web3APIPayload } from 'web3-common';
+import { EthExecutionAPI, JsonRpcResponse, Web3APIPayload } from 'web3-types';
+import { ResponseError } from 'web3-errors';
import WebSocketProvider from '../../src/index';
import {
invalidConnectionStrings,
@@ -114,7 +115,7 @@ describe('WebSocketProvider', () => {
const payload = { ...jsonRpcPayload, error: 'my-error' };
await expect(wsProvider.request(payload)).rejects.toThrow(
- new ResponseError(payload as any),
+ new ResponseError(payload as unknown as JsonRpcResponse),
);
});
diff --git a/packages/web3-common/.eslintignore b/packages/web3-types/.eslintignore
similarity index 100%
rename from packages/web3-common/.eslintignore
rename to packages/web3-types/.eslintignore
diff --git a/packages/web3-common/.eslintrc.js b/packages/web3-types/.eslintrc.js
similarity index 100%
rename from packages/web3-common/.eslintrc.js
rename to packages/web3-types/.eslintrc.js
diff --git a/packages/web3-common/.gitignore b/packages/web3-types/.gitignore
similarity index 100%
rename from packages/web3-common/.gitignore
rename to packages/web3-types/.gitignore
diff --git a/packages/web3-common/.npmignore b/packages/web3-types/.npmignore
similarity index 100%
rename from packages/web3-common/.npmignore
rename to packages/web3-types/.npmignore
diff --git a/packages/web3-common/.prettierignore b/packages/web3-types/.prettierignore
similarity index 100%
rename from packages/web3-common/.prettierignore
rename to packages/web3-types/.prettierignore
diff --git a/packages/web3-common/.prettierrc.json b/packages/web3-types/.prettierrc.json
similarity index 100%
rename from packages/web3-common/.prettierrc.json
rename to packages/web3-types/.prettierrc.json
diff --git a/packages/web3-common/CHANGELOG.md b/packages/web3-types/CHANGELOG.md
similarity index 100%
rename from packages/web3-common/CHANGELOG.md
rename to packages/web3-types/CHANGELOG.md
diff --git a/packages/web3-common/README.md b/packages/web3-types/README.md
similarity index 85%
rename from packages/web3-common/README.md
rename to packages/web3-types/README.md
index 2e99d5b08cc..19d2325d5c5 100644
--- a/packages/web3-common/README.md
+++ b/packages/web3-types/README.md
@@ -2,7 +2,7 @@
-# web3-common
+# web3-types


@@ -12,12 +12,12 @@
This is a sub-package of [web3.js][repo].
-`web3-common` contains the common data structures and interfaces used in [web3.js][repo].
+`web3-types` contains the common data structures and interfaces used in [web3.js][repo].
###### Get it from the NPM Registry
```bash
-yarn add web3-common
+yarn add web3-types
```
## Getting Started
@@ -45,9 +45,9 @@ yarn add web3-common
[docs]: http://web3js.readthedocs.io/en/4.0/
[repo]: https://github.com/ethereum/web3.js
-[npm-image]: https://img.shields.io/npm/v/web3-common.svg
-[npm-url]: https://npmjs.org/packages/web3-common
-[deps-image]: https://david-dm.org/ethereum/web3.js/4.x/status.svg?path=packages/web3-common
-[deps-url]: https://david-dm.org/ethereum/web3.js/4.x?path=packages/web3-common
-[deps-dev-image]: https://david-dm.org/ethereum/web3.js/4.x/dev-status.svg?path=packages/web3-common
-[deps-dev-url]: https://david-dm.org/ethereum/web3.js/4.x?type=dev&path=packages/web3-common
+[npm-image]: https://img.shields.io/npm/v/web3-types.svg
+[npm-url]: https://npmjs.org/packages/web3-types
+[deps-image]: https://david-dm.org/ethereum/web3.js/4.x/status.svg?path=packages/web3-types
+[deps-url]: https://david-dm.org/ethereum/web3.js/4.x?path=packages/web3-types
+[deps-dev-image]: https://david-dm.org/ethereum/web3.js/4.x/dev-status.svg?path=packages/web3-types
+[deps-dev-url]: https://david-dm.org/ethereum/web3.js/4.x?type=dev&path=packages/web3-types
diff --git a/packages/web3-common/assets/logo/web3js.ai b/packages/web3-types/assets/logo/web3js.ai
similarity index 100%
rename from packages/web3-common/assets/logo/web3js.ai
rename to packages/web3-types/assets/logo/web3js.ai
diff --git a/packages/web3-common/assets/logo/web3js.jpg b/packages/web3-types/assets/logo/web3js.jpg
similarity index 100%
rename from packages/web3-common/assets/logo/web3js.jpg
rename to packages/web3-types/assets/logo/web3js.jpg
diff --git a/packages/web3-common/assets/logo/web3js.svg b/packages/web3-types/assets/logo/web3js.svg
similarity index 100%
rename from packages/web3-common/assets/logo/web3js.svg
rename to packages/web3-types/assets/logo/web3js.svg
diff --git a/packages/web3-common/package.json b/packages/web3-types/package.json
similarity index 84%
rename from packages/web3-common/package.json
rename to packages/web3-types/package.json
index 14038466bc5..e1882c81e8e 100644
--- a/packages/web3-common/package.json
+++ b/packages/web3-types/package.json
@@ -1,5 +1,5 @@
{
- "name": "web3-common",
+ "name": "web3-types",
"version": "1.0.0-alpha.0",
"description": "Provide the common data structures and interfaces for web3 modules.",
"main": "dist/index.js",
@@ -21,15 +21,10 @@
"test:coverage": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
- "test:unit": "jest --config=./test/unit/jest.config.js",
+ "test:unit": "jest --config=./test/unit/jest.config.js --passWithNoTests",
"test:integration": "jest --config=./test/integration/jest.config.js --runInBand --passWithNoTests"
},
- "dependencies": {
- "web3-utils": "4.0.0-alpha.1",
- "web3-validator": "^0.1.0-alpha.0",
- "web3-eth-iban": "4.0.0-alpha.0",
- "web3-errors": "1.0.0-alpha.0"
- },
+ "dependencies": {},
"devDependencies": {
"@humeris/espresso-shot": "^4.0.0",
"@types/jest": "^27.0.3",
diff --git a/packages/web3-validator/src/private_types.ts b/packages/web3-types/src/error_types.ts
similarity index 73%
rename from packages/web3-validator/src/private_types.ts
rename to packages/web3-types/src/error_types.ts
index 324e56e1140..5fca52cdeae 100644
--- a/packages/web3-validator/src/private_types.ts
+++ b/packages/web3-types/src/error_types.ts
@@ -1,4 +1,4 @@
-/*
+/*
This file is part of web3.js.
web3.js is free software: you can redistribute it and/or modify
@@ -15,11 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-// To avoid package dependency we have to copy these types
-
-// https://docs.soliditylang.org/en/latest/abi-spec.html#json
-export type AbiParameter = {
+export interface Web3Error extends Error {
readonly name: string;
- readonly type: string;
- readonly components?: ReadonlyArray;
-};
+ readonly code: number;
+ readonly stack?: string;
+}
diff --git a/packages/web3-common/src/eth_execution_api.ts b/packages/web3-types/src/eth_execution_api.ts
similarity index 78%
rename from packages/web3-common/src/eth_execution_api.ts
rename to packages/web3-types/src/eth_execution_api.ts
index b82940996fe..f3d8bbfeb08 100644
--- a/packages/web3-common/src/eth_execution_api.ts
+++ b/packages/web3-types/src/eth_execution_api.ts
@@ -17,31 +17,25 @@ along with web3.js. If not, see .
import {
Address,
- HexString,
- HexString256Bytes,
- HexString8Bytes,
HexString32Bytes,
+ Uint,
HexStringBytes,
HexStringSingleByte,
- Uint,
- Uint256,
+ HexString256Bytes,
Topic,
+ HexString8Bytes,
+ Uint256,
+ BlockNumberOrTag,
Filter,
-} from 'web3-utils';
-import { BlockNumberOrTag } from 'web3-validator';
+ AccessList,
+ TransactionHash,
+ Uncles,
+} from './eth_types';
+import { HexString } from './primitives_types';
// The types are generated manually by referring to following doc
// https://github.com/ethereum/execution-apis
-
-export interface AccessListEntry {
- readonly address?: Address;
- readonly storageKeys?: HexString32Bytes[];
-}
-export type AccessList = AccessListEntry[];
-export type TransactionHash = HexString;
-export type Uncles = HexString32Bytes[];
-
-export interface TransactionCall {
+export interface TransactionCallAPI {
readonly from?: Address;
readonly to: Address;
readonly gas?: Uint;
@@ -54,7 +48,7 @@ export interface TransactionCall {
readonly accessList?: AccessList;
}
-export interface BaseTransaction {
+export interface BaseTransactionAPI {
// eslint-disable-next-line @typescript-eslint/ban-types
readonly to?: Address | null;
readonly type: HexStringSingleByte;
@@ -67,53 +61,53 @@ export interface BaseTransaction {
readonly chainId?: Uint;
}
-export interface Transaction1559Unsigned extends BaseTransaction {
+export interface Transaction1559UnsignedAPI extends BaseTransactionAPI {
readonly maxFeePerGas: Uint;
readonly maxPriorityFeePerGas: Uint;
readonly accessList: AccessList;
}
-export interface Transaction1559Signed extends Transaction1559Unsigned {
+export interface Transaction1559SignedAPI extends Transaction1559UnsignedAPI {
readonly yParity: Uint;
readonly r: Uint;
readonly s: Uint;
}
-export interface Transaction2930Unsigned extends BaseTransaction {
+export interface Transaction2930UnsignedAPI extends BaseTransactionAPI {
readonly gasPrice: Uint;
readonly accessList: AccessList;
}
-export interface Transaction2930Signed extends Transaction2930Unsigned {
+export interface Transaction2930SignedAPI extends Transaction2930UnsignedAPI {
readonly yParity: Uint;
readonly r: Uint;
readonly s: Uint;
}
-export interface TransactionLegacyUnsigned extends BaseTransaction {
+export interface TransactionLegacyUnsignedAPI extends BaseTransactionAPI {
readonly gasPrice: Uint;
}
-export interface TransactionLegacySigned extends TransactionLegacyUnsigned {
+export interface TransactionLegacySignedAPI extends TransactionLegacyUnsignedAPI {
readonly v: Uint;
readonly r: Uint;
readonly s: Uint;
}
// https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.json#L178
-export type TransactionUnsigned =
- | Transaction1559Unsigned
- | Transaction2930Unsigned
- | TransactionLegacyUnsigned;
+export type TransactionUnsignedAPI =
+ | Transaction1559UnsignedAPI
+ | Transaction2930UnsignedAPI
+ | TransactionLegacyUnsignedAPI;
// https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.json#L262
-export type TransactionSigned =
- | Transaction1559Signed
- | Transaction2930Signed
- | TransactionLegacySigned;
+export type TransactionSignedAPI =
+ | Transaction1559SignedAPI
+ | Transaction2930SignedAPI
+ | TransactionLegacySignedAPI;
// https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.json#L269
-export type TransactionInfo = TransactionSigned & {
+export type TransactionInfoAPI = TransactionSignedAPI & {
readonly blockHash?: HexString32Bytes;
readonly blockNumber?: Uint;
readonly from: Address;
@@ -121,16 +115,16 @@ export type TransactionInfo = TransactionSigned & {
readonly transactionIndex?: Uint;
};
-export interface SignedTransactionInfo {
+export interface SignedTransactionInfoAPI {
raw: HexStringBytes;
- tx: TransactionSigned;
+ tx: TransactionSignedAPI;
}
// https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.json#L24
-export type TransactionWithSender = TransactionUnsigned & { from: Address };
+export type TransactionWithSenderAPI = TransactionUnsignedAPI & { from: Address };
// https://github.com/ethereum/execution-apis/blob/main/src/schemas/block.json#L2
-export interface Block {
+export interface BlockAPI {
readonly parentHash: HexString32Bytes;
readonly sha3Uncles: HexString32Bytes;
readonly miner: HexString;
@@ -149,13 +143,13 @@ export interface Block {
readonly totalDifficulty: Uint;
readonly baseFeePerGas?: Uint;
readonly size: Uint;
- readonly transactions: TransactionHash[] | TransactionInfo[];
+ readonly transactions: TransactionHash[] | TransactionInfoAPI[];
readonly uncles: Uncles;
readonly hash?: HexString32Bytes;
}
// https://github.com/ethereum/execution-apis/blob/main/src/schemas/receipt.json#L2
-export interface Log {
+export interface LogAPI {
readonly removed?: boolean;
readonly logIndex?: Uint;
readonly transactionIndex?: Uint;
@@ -168,7 +162,7 @@ export interface Log {
}
// https://github.com/ethereum/execution-apis/blob/main/src/schemas/receipt.json#L44
-export interface TransactionReceipt {
+export interface TransactionReceiptAPI {
readonly transactionHash: HexString32Bytes;
readonly transactionIndex: Uint;
readonly blockHash: HexString32Bytes;
@@ -178,7 +172,7 @@ export interface TransactionReceipt {
readonly cumulativeGasUsed: Uint;
readonly gasUsed: Uint;
readonly contractAddress?: Address;
- readonly logs: Log[];
+ readonly logs: LogAPI[];
readonly logsBloom: HexString256Bytes;
readonly root: HexString32Bytes;
readonly status: '0x1' | '0x0';
@@ -186,21 +180,21 @@ export interface TransactionReceipt {
}
// https://github.com/ethereum/execution-apis/blob/main/src/schemas/client.json#L2
-export type SyncingStatus =
+export type SyncingStatusAPI =
| { startingBlock: Uint; currentBlock: Uint; highestBlock: Uint }
| boolean;
// https://github.com/ethereum/execution-apis/blob/main/src/eth/fee_market.json#L53
-export interface FeeHistoryResult {
+export interface FeeHistoryResultAPI {
readonly oldestBlock: Uint;
readonly baseFeePerGas: Uint;
readonly reward: number[][];
}
// https://github.com/ethereum/execution-apis/blob/main/src/schemas/filter.json#L2
-export type FilterResults = HexString32Bytes[] | Log[];
+export type FilterResultsAPI = HexString32Bytes[] | LogAPI[];
-export interface CompileResult {
+export interface CompileResultAPI {
readonly code: HexStringBytes;
readonly info: {
readonly source: string;
@@ -220,40 +214,43 @@ export interface CompileResult {
/* eslint-disable camelcase */
export type EthExecutionAPI = {
// https://github.com/ethereum/execution-apis/blob/main/src/eth/block.json
- eth_getBlockByHash: (blockHash: HexString32Bytes, hydrated: boolean) => Block;
- eth_getBlockByNumber: (blockNumber: BlockNumberOrTag, hydrated: boolean) => Block;
+ eth_getBlockByHash: (blockHash: HexString32Bytes, hydrated: boolean) => BlockAPI;
+ eth_getBlockByNumber: (blockNumber: BlockNumberOrTag, hydrated: boolean) => BlockAPI;
eth_getBlockTransactionCountByHash: (blockHash: HexString32Bytes) => Uint;
eth_getBlockTransactionCountByNumber: (blockNumber: BlockNumberOrTag) => Uint;
eth_getUncleCountByBlockHash: (blockHash: HexString32Bytes) => Uint;
eth_getUncleCountByBlockNumber: (blockNumber: BlockNumberOrTag) => Uint;
- eth_getUncleByBlockHashAndIndex: (blockHash: HexString32Bytes, uncleIndex: Uint) => Block;
- eth_getUncleByBlockNumberAndIndex: (blockNumber: BlockNumberOrTag, uncleIndex: Uint) => Block;
+ eth_getUncleByBlockHashAndIndex: (blockHash: HexString32Bytes, uncleIndex: Uint) => BlockAPI;
+ eth_getUncleByBlockNumberAndIndex: (
+ blockNumber: BlockNumberOrTag,
+ uncleIndex: Uint,
+ ) => BlockAPI;
// https://github.com/ethereum/execution-apis/blob/main/src/eth/transaction.json
- eth_getTransactionByHash: (transactionHash: HexString32Bytes) => TransactionInfo | undefined;
+ eth_getTransactionByHash: (transactionHash: HexString32Bytes) => TransactionInfoAPI | undefined;
eth_getTransactionByBlockHashAndIndex: (
blockHash: HexString32Bytes,
transactionIndex: Uint,
- ) => TransactionInfo | undefined;
+ ) => TransactionInfoAPI | undefined;
eth_getTransactionByBlockNumberAndIndex: (
blockNumber: BlockNumberOrTag,
transactionIndex: Uint,
- ) => TransactionInfo | undefined;
+ ) => TransactionInfoAPI | undefined;
eth_getTransactionReceipt: (
transactionHash: HexString32Bytes,
- ) => TransactionReceipt | undefined;
+ ) => TransactionReceiptAPI | undefined;
// https://github.com/ethereum/execution-apis/blob/main/src/eth/client.json
eth_protocolVersion: () => string;
- eth_syncing: () => SyncingStatus;
+ eth_syncing: () => SyncingStatusAPI;
eth_coinbase: () => Address;
eth_accounts: () => Address[];
eth_blockNumber: () => Uint;
// https://github.com/ethereum/execution-apis/blob/main/src/eth/execute.json
- eth_call: (transaction: TransactionCall, blockNumber: BlockNumberOrTag) => HexStringBytes;
+ eth_call: (transaction: TransactionCallAPI, blockNumber: BlockNumberOrTag) => HexStringBytes;
eth_estimateGas: (
- transaction: Partial,
+ transaction: Partial,
blockNumber: BlockNumberOrTag,
) => Uint;
@@ -263,16 +260,16 @@ export type EthExecutionAPI = {
blockCount: Uint,
newestBlock: BlockNumberOrTag,
rewardPercentiles: number[],
- ) => FeeHistoryResult;
+ ) => FeeHistoryResultAPI;
// https://github.com/ethereum/execution-apis/blob/main/src/eth/filter.json
eth_newFilter: (filter: Filter) => Uint;
eth_newBlockFilter: () => Uint;
eth_newPendingTransactionFilter: () => Uint;
eth_uninstallFilter: (filterIdentifier: Uint) => boolean;
- eth_getFilterChanges: (filterIdentifier: Uint) => FilterResults;
- eth_getFilterLogs: (filterIdentifier: Uint) => FilterResults;
- eth_getLogs: (filter: Filter) => FilterResults;
+ eth_getFilterChanges: (filterIdentifier: Uint) => FilterResultsAPI;
+ eth_getFilterLogs: (filterIdentifier: Uint) => FilterResultsAPI;
+ eth_getLogs: (filter: Filter) => FilterResultsAPI;
// https://github.com/ethereum/execution-apis/blob/main/src/eth/mining.json
eth_mining: () => boolean;
@@ -288,8 +285,8 @@ export type EthExecutionAPI = {
// https://github.com/ethereum/execution-apis/blob/main/src/eth/sign.json
eth_sign: (address: Address, message: HexStringBytes) => HexString256Bytes;
eth_signTransaction: (
- transaction: TransactionWithSender | Partial,
- ) => HexStringBytes | SignedTransactionInfo;
+ transaction: TransactionWithSenderAPI | Partial,
+ ) => HexStringBytes | SignedTransactionInfoAPI;
// https://github.com/ethereum/execution-apis/blob/main/src/eth/state.json
eth_getBalance: (address: Address, blockNumber: BlockNumberOrTag) => Uint;
@@ -303,7 +300,7 @@ export type EthExecutionAPI = {
// https://github.com/ethereum/execution-apis/blob/main/src/eth/submit.json
eth_sendTransaction: (
- transaction: TransactionWithSender | Partial,
+ transaction: TransactionWithSenderAPI | Partial,
) => HexString32Bytes;
eth_sendRawTransaction: (transaction: HexStringBytes) => HexString32Bytes;
@@ -319,7 +316,7 @@ export type EthExecutionAPI = {
eth_clearSubscriptions: (keepSyncing?: boolean) => void;
// Non-supported by execution-apis specs
eth_getCompilers: () => string[];
- eth_compileSolidity: (code: string) => CompileResult;
+ eth_compileSolidity: (code: string) => CompileResultAPI;
eth_compileLLL: (code: string) => HexStringBytes;
eth_compileSerpent: (code: string) => HexStringBytes;
};
diff --git a/packages/web3-types/src/eth_types.ts b/packages/web3-types/src/eth_types.ts
new file mode 100644
index 00000000000..1cbcee1fb0a
--- /dev/null
+++ b/packages/web3-types/src/eth_types.ts
@@ -0,0 +1,456 @@
+/*
+This file is part of web3.js.
+
+web3.js is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+web3.js is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with web3.js. If not, see .
+*/
+import { Bytes, HexString, Numbers } from './primitives_types';
+
+export type ValueTypes = 'address' | 'bool' | 'string' | 'int256' | 'uint256' | 'bytes' | 'bigint';
+// Hex encoded 32 bytes
+export type HexString32Bytes = HexString;
+// Hex encoded 16 bytes
+export type HexString16Bytes = HexString;
+// Hex encoded 8 bytes
+export type HexString8Bytes = HexString;
+// Hex encoded 1 byte
+export type HexStringSingleByte = HexString;
+// Hex encoded 1 byte
+export type HexStringBytes = HexString;
+// Hex encoded 256 byte
+export type HexString256Bytes = HexString;
+// Hex encoded unsigned integer
+export type Uint = HexString;
+// Hex encoded unsigned integer 32 bytes
+export type Uint256 = HexString;
+// Hex encoded address
+export type Address = HexString;
+
+// https://github.com/ethereum/execution-apis/blob/main/src/schemas/filter.json#L59
+export type Topic = HexString32Bytes;
+
+export type TransactionHash = HexString;
+export type Uncles = HexString32Bytes[];
+export enum BlockTags {
+ EARLIEST = 'earliest',
+ LATEST = 'latest',
+ PENDING = 'pending',
+}
+export type BlockTag = 'earliest' | 'latest' | 'pending';
+export type BlockNumberOrTag = Numbers | BlockTag;
+
+export interface Proof {
+ readonly address: HexString;
+ readonly nonce: string;
+ readonly balance: string;
+}
+
+export interface TransactionInput {
+ readonly [key: string]: unknown;
+ readonly to?: HexString; // If its a contract creation tx then no address wil be specified.
+ readonly from?: HexString;
+ readonly data?: string;
+ readonly input?: string;
+ readonly gas: HexString;
+ readonly gasLimit?: string;
+ readonly gasPrice?: string;
+ readonly maxPriorityFeePerGas?: string;
+ readonly maxFeePerGas?: string;
+ readonly nonce: string;
+ readonly value: string;
+ readonly blockNumber?: HexString;
+ readonly transactionIndex?: HexString;
+ readonly type?: HexString;
+ readonly chainId?: HexString;
+}
+
+export type TransactionOutput = {
+ readonly [key: string]: unknown;
+ readonly to?: HexString; // If its a contract creation tx then no address wil be specified.
+ readonly from?: HexString;
+ readonly data: string;
+ readonly gas?: bigint | number;
+ readonly gasLimit?: string;
+ readonly nonce: bigint | number;
+ readonly value: bigint | number;
+ readonly blockNumber?: bigint | number;
+ readonly transactionIndex?: bigint | number;
+} & (
+ | { maxPriorityFeePerGas: bigint | number; maxFeePerGas: bigint | number; gasPrice?: never }
+ | { maxPriorityFeePerGas?: never; maxFeePerGas?: never; gasPrice: bigint | number }
+);
+
+export interface LogsInput {
+ readonly blockHash?: HexString;
+ readonly transactionHash?: HexString;
+ readonly logIndex?: HexString;
+ readonly id?: string;
+ readonly blockNumber?: HexString;
+ readonly transactionIndex?: HexString;
+ readonly address: HexString;
+ readonly topics: HexString[];
+ readonly data: HexString;
+}
+export interface LogsOutput {
+ readonly id?: string;
+ readonly removed: boolean;
+ readonly logIndex?: bigint | number;
+ readonly transactionIndex?: bigint | number;
+ readonly transactionHash?: HexString32Bytes;
+ readonly blockHash?: HexString32Bytes;
+ readonly blockNumber?: bigint | number;
+ readonly address: string;
+ readonly topics: HexString[];
+ readonly data: HexString;
+}
+
+export interface BlockInput {
+ readonly gasLimit: HexString;
+ readonly gasUsed: HexString;
+ readonly size: HexString;
+ readonly timestamp: HexString;
+ readonly number?: HexString;
+ readonly difficulty?: HexString;
+ readonly totalDifficulty?: HexString;
+ readonly transactions?: TransactionInput[];
+ readonly miner?: HexString;
+ readonly baseFeePerGas?: HexString;
+}
+
+export interface BlockOutput {
+ readonly gasLimit: bigint | number;
+ readonly gasUsed: bigint | number;
+ readonly size: bigint | number;
+ readonly timestamp: bigint | number;
+ readonly number?: bigint | number;
+ readonly difficulty?: bigint | number;
+ readonly totalDifficulty?: bigint | number;
+ readonly transactions?: TransactionOutput[];
+ readonly miner?: HexString;
+ readonly baseFeePerGas?: bigint | number;
+ readonly parentHash?: HexString32Bytes;
+}
+
+export interface BlockHeaderOutput {
+ readonly gasLimit: bigint | number;
+ readonly gasUsed: bigint | number;
+ readonly timestamp: bigint | number;
+ readonly number?: bigint | number;
+ readonly difficulty?: bigint | number;
+ readonly totalDifficulty?: bigint | number;
+ readonly transactions?: TransactionOutput[];
+ readonly miner?: HexString;
+ readonly baseFeePerGas?: bigint | number;
+ readonly parentHash?: HexString32Bytes;
+ readonly sha3Uncles: HexString32Bytes[];
+}
+
+export interface ReceiptInput {
+ readonly [x: string]: unknown;
+ readonly blockNumber?: HexString;
+ readonly transactionIndex?: HexString;
+ readonly cumulativeGasUsed: HexString;
+ readonly gasUsed: HexString;
+ readonly logs?: LogsInput[];
+ readonly contractAddress?: HexString;
+ readonly status?: string;
+ readonly effectiveGasPrice?: HexString;
+}
+
+export interface ReceiptOutput {
+ readonly blockNumber?: bigint | number;
+ readonly transactionIndex?: bigint | number;
+ readonly cumulativeGasUsed: bigint | number;
+ readonly gasUsed: bigint | number;
+ readonly logs?: LogsOutput[];
+ readonly contractAddress?: HexString;
+ readonly status: boolean;
+ readonly effectiveGasPrice?: bigint | number;
+}
+
+export interface PostInput {
+ readonly ttl?: HexString;
+ readonly workToProve?: HexString;
+ readonly priority?: HexString;
+ readonly expiry?: HexString;
+ readonly sent?: HexString;
+ readonly workProved?: HexString;
+ readonly topics?: HexString[];
+}
+
+export interface PostOutput {
+ readonly ttl?: bigint | number;
+ readonly workToProve?: bigint | number;
+ readonly priority?: bigint | number;
+ readonly expiry?: bigint | number;
+ readonly sent?: bigint | number;
+ readonly workProved?: bigint | number;
+ readonly topics?: string[];
+}
+
+export interface SyncInput {
+ readonly startingBlock: HexString;
+ readonly currentBlock: HexString;
+ readonly highestBlock: HexString;
+ readonly knownStates?: HexString;
+ readonly pulledStates?: HexString;
+}
+
+export interface SyncOutput {
+ readonly startingBlock: bigint | number;
+ readonly currentBlock: bigint | number;
+ readonly highestBlock: bigint | number;
+ readonly knownStates?: bigint | number;
+ readonly pulledStates?: bigint | number;
+}
+
+export type Receipt = Record;
+
+export type Components = {
+ name: string;
+ type: string;
+ indexed?: boolean;
+ components?: Components[];
+};
+
+export type AbiInput = {
+ name: string;
+ type: string;
+ components?: Components;
+ index?: boolean;
+ internalType?: string;
+};
+
+// https://docs.soliditylang.org/en/develop/abi-spec.html#json
+export type JsonFunctionInterface = {
+ type: 'function';
+ name: string;
+ inputs: Components[];
+ outputs?: AbiInput[];
+ stateMutability?: string;
+};
+
+export type JsonEventInterface = {
+ type: 'event';
+ name: string;
+ inputs: Components[];
+ indexed: boolean;
+ anonymous: boolean;
+};
+
+// https://github.com/ethereum/execution-apis/blob/main/src/schemas/filter.json#L28
+export interface Filter {
+ readonly fromBlock?: BlockNumberOrTag;
+ readonly toBlock?: BlockNumberOrTag;
+ readonly address?: Address | Address[];
+
+ // Using "null" type intentionally to match specifications
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ readonly topics?: (null | Topic | Topic[])[];
+}
+
+// https://docs.soliditylang.org/en/latest/abi-spec.html#json
+export type AbiParameter = {
+ readonly name: string;
+ readonly type: string;
+ readonly components?: ReadonlyArray;
+};
+
+export interface AccessListEntry {
+ readonly address?: Address;
+ readonly storageKeys?: HexString32Bytes[];
+}
+export type AccessList = AccessListEntry[];
+
+export type ValidChains = 'goerli' | 'kovan' | 'mainnet' | 'rinkeby' | 'ropsten' | 'sepolia';
+
+export type Hardfork =
+ | 'arrowGlacier'
+ | 'berlin'
+ | 'byzantium'
+ | 'chainstart'
+ | 'constantinople'
+ | 'dao'
+ | 'homestead'
+ | 'istanbul'
+ | 'london'
+ | 'merge'
+ | 'muirGlacier'
+ | 'petersburg'
+ | 'shanghai'
+ | 'spuriousDragon'
+ | 'tangerineWhistle';
+
+export interface Log {
+ readonly removed?: boolean;
+ readonly logIndex?: Numbers;
+ readonly transactionIndex?: Numbers;
+ readonly transactionHash?: Bytes;
+ readonly blockHash?: Bytes;
+ readonly blockNumber?: Numbers;
+ readonly address?: Address;
+ readonly data?: Bytes;
+ readonly topics?: Bytes[];
+ readonly id?: string;
+}
+
+export interface TransactionReceipt {
+ readonly transactionHash: Bytes;
+ readonly transactionIndex: Numbers;
+ readonly blockHash: Bytes;
+ readonly blockNumber: Numbers;
+ readonly from: Address;
+ readonly to: Address;
+ readonly cumulativeGasUsed: Numbers;
+ readonly gasUsed: Numbers;
+ readonly effectiveGasPrice?: Numbers;
+ readonly contractAddress?: Address;
+ readonly logs: Log[];
+ readonly logsBloom: Bytes;
+ readonly root: Bytes;
+ readonly status: Numbers;
+ readonly type?: Numbers;
+}
+
+export interface CustomChain {
+ name?: string;
+ networkId: Numbers;
+ chainId: Numbers;
+}
+
+export interface Common {
+ customChain: CustomChain;
+ baseChain?: ValidChains;
+ hardfork?: Hardfork;
+}
+
+interface TransactionBase {
+ value?: Numbers;
+ accessList?: AccessList;
+ common?: Common;
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ to?: Address | null;
+ gas?: Numbers;
+ gasPrice?: Numbers;
+ type?: Numbers;
+ maxFeePerGas?: Numbers;
+ maxPriorityFeePerGas?: Numbers;
+ data?: Bytes;
+ input?: Bytes;
+ nonce?: Numbers;
+ chain?: ValidChains;
+ hardfork?: Hardfork;
+ chainId?: Numbers;
+ networkId?: Numbers;
+ gasLimit?: Numbers;
+ yParity?: Uint;
+ v?: Numbers;
+ r?: Bytes;
+ s?: Bytes;
+}
+
+export interface Transaction extends TransactionBase {
+ from?: Address;
+}
+
+export interface TransactionCall extends Transaction {
+ to: Address;
+}
+
+export interface TransactionWithLocalWalletIndex extends TransactionBase {
+ from?: Numbers;
+}
+
+export interface TransactionInfo extends Transaction {
+ readonly blockHash?: Bytes;
+ readonly blockNumber?: Numbers;
+ readonly from: Address;
+ readonly hash: Bytes;
+ readonly transactionIndex?: Numbers;
+}
+
+export interface PopulatedUnsignedBaseTransaction {
+ from: Address;
+ to?: Address;
+ value: Numbers;
+ gas?: Numbers;
+ gasPrice: Numbers;
+ type: Numbers;
+ data: Bytes;
+ nonce: Numbers;
+ networkId: Numbers;
+ chain: ValidChains;
+ hardfork: Hardfork;
+ chainId: Numbers;
+ common: Common;
+ gasLimit: Numbers;
+}
+
+export interface PopulatedUnsignedEip2930Transaction extends PopulatedUnsignedBaseTransaction {
+ accessList: AccessList;
+}
+
+export interface PopulatedUnsignedEip1559Transaction extends PopulatedUnsignedEip2930Transaction {
+ gasPrice: never;
+ maxFeePerGas: Numbers;
+ maxPriorityFeePerGas: Numbers;
+}
+export type PopulatedUnsignedTransaction =
+ | PopulatedUnsignedBaseTransaction
+ | PopulatedUnsignedEip2930Transaction
+ | PopulatedUnsignedEip1559Transaction;
+
+export interface Block {
+ readonly parentHash: Bytes;
+ readonly sha3Uncles: Bytes;
+ readonly miner: Bytes;
+ readonly stateRoot: Bytes;
+ readonly transactionsRoot: Bytes;
+ readonly receiptsRoot: Bytes;
+ readonly logsBloom?: Bytes;
+ readonly difficulty?: Numbers;
+ readonly number: Numbers;
+ readonly gasLimit: Numbers;
+ readonly gasUsed: Numbers;
+ readonly timestamp: Numbers;
+ readonly extraData: Bytes;
+ readonly mixHash: Bytes;
+ readonly nonce: Numbers;
+ readonly totalDifficulty: Numbers;
+ readonly baseFeePerGas?: Numbers;
+ readonly size: Numbers;
+ readonly transactions: TransactionHash[] | TransactionInfo[];
+ readonly uncles: Uncles;
+ readonly hash?: Bytes;
+}
+
+export interface FeeHistory {
+ readonly oldestBlock: Numbers;
+ readonly baseFeePerGas: Numbers;
+ readonly reward: Numbers[][];
+}
+
+export interface StorageProof {
+ readonly key: Bytes;
+ readonly value: Numbers;
+ readonly proof: Bytes[];
+}
+
+export interface AccountObject {
+ readonly balance: Numbers;
+ readonly codeHash: Bytes;
+ readonly nonce: Numbers;
+ readonly storageHash: Bytes;
+ readonly accountProof: Bytes[];
+ readonly storageProof: StorageProof[];
+}
diff --git a/packages/web3-common/src/index.ts b/packages/web3-types/src/index.ts
similarity index 71%
rename from packages/web3-common/src/index.ts
rename to packages/web3-types/src/index.ts
index c4d263976a4..902b6ca9c42 100644
--- a/packages/web3-common/src/index.ts
+++ b/packages/web3-types/src/index.ts
@@ -15,15 +15,13 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-export * from './errors';
-export * from './types';
+export * from './error_types';
+export * from './eth_execution_api';
+export * from './eth_types';
+export * from './json_rpc_types';
+export * from './primitives_types';
+export * from './utility_types';
+export * from './web3_api_types';
export * from './web3_base_provider';
export * from './web3_base_wallet';
-export * from './web3_event_emitter';
-export * from './eth_execution_api';
-export * from './deferred_promise';
-export * from './web3_promi_event';
-export * from './formatters';
-export * as formatters from './formatters';
-export * from './formatter';
-export * as jsonRpc from './json_rpc';
+export * from './web3_deferred_promise_type';
diff --git a/packages/web3-types/src/json_rpc_types.ts b/packages/web3-types/src/json_rpc_types.ts
new file mode 100644
index 00000000000..f85bd38f5fc
--- /dev/null
+++ b/packages/web3-types/src/json_rpc_types.ts
@@ -0,0 +1,84 @@
+/*
+This file is part of web3.js.
+
+web3.js is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+web3.js is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with web3.js. If not, see .
+*/
+export type JsonRpcId = string | number | undefined;
+export type JsonRpcResult = string | number | boolean | Record;
+export type JsonRpcIdentifier = string & ('2.0' | '1.0');
+
+export interface JsonRpcError {
+ readonly code: number;
+ readonly message: string;
+ readonly data?: T;
+}
+
+export interface JsonRpcResponseWithError {
+ readonly id: JsonRpcId;
+ readonly jsonrpc: JsonRpcIdentifier;
+ readonly error: JsonRpcError;
+ readonly result?: never;
+}
+
+export interface JsonRpcResponseWithResult {
+ readonly id: JsonRpcId;
+ readonly jsonrpc: JsonRpcIdentifier;
+ readonly error?: never;
+ readonly result: T;
+}
+
+export interface SubscriptionParams {
+ readonly subscription: string; // for subscription id
+ readonly result: T;
+}
+export interface JsonRpcNotification {
+ readonly id?: JsonRpcId;
+ readonly jsonrpc: JsonRpcIdentifier;
+ readonly method: string; // for subscription
+ readonly params: SubscriptionParams; // for subscription results
+ readonly result: never;
+}
+
+export interface JsonRpcSubscriptionResult {
+ readonly id: number;
+ readonly jsonrpc: string;
+ readonly result: string;
+ readonly method: never;
+ readonly params: never;
+}
+
+export interface JsonRpcRequest {
+ readonly id: JsonRpcId;
+ readonly jsonrpc: JsonRpcIdentifier;
+ readonly method: string;
+ readonly params?: T;
+}
+
+export interface JsonRpcOptionalRequest
+ extends Omit, 'id' | 'jsonrpc'> {
+ readonly id?: JsonRpcId;
+ readonly jsonrpc?: JsonRpcIdentifier;
+}
+
+export type JsonRpcBatchRequest = JsonRpcRequest[];
+
+export type JsonRpcPayload = JsonRpcRequest | JsonRpcBatchRequest;
+
+export type JsonRpcBatchResponse =
+ | (JsonRpcResponseWithError | JsonRpcResponseWithResult)[];
+
+export type JsonRpcResponse =
+ | JsonRpcResponseWithError
+ | JsonRpcResponseWithResult
+ | JsonRpcBatchResponse;
diff --git a/packages/web3-types/src/primitives_types.ts b/packages/web3-types/src/primitives_types.ts
new file mode 100644
index 00000000000..e9bb8d0064e
--- /dev/null
+++ b/packages/web3-types/src/primitives_types.ts
@@ -0,0 +1,20 @@
+/*
+This file is part of web3.js.
+
+web3.js is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+web3.js is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with web3.js. If not, see .
+*/
+
+export type HexString = string;
+export type Bytes = Buffer | Uint8Array | ArrayBuffer | HexString;
+export type Numbers = number | bigint | string | HexString;
diff --git a/packages/web3-types/src/utility_types.ts b/packages/web3-types/src/utility_types.ts
new file mode 100644
index 00000000000..84ed479bacb
--- /dev/null
+++ b/packages/web3-types/src/utility_types.ts
@@ -0,0 +1,57 @@
+/*
+This file is part of web3.js.
+
+web3.js is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+web3.js is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with web3.js. If not, see .
+*/
+
+import { Numbers } from './primitives_types';
+
+// Make each attribute mutable by removing `readonly`
+export type Mutable = {
+ -readonly [P in keyof T]: T[P];
+};
+
+export type ConnectionEvent = {
+ code: number;
+ reason: string;
+ wasClean?: boolean; // if WS connection was closed properly
+};
+
+export type Optional = Pick, K> & Omit;
+export type EncodingTypes = Numbers | boolean | Numbers[] | boolean[];
+export type TypedObject = {
+ type: string;
+ value: EncodingTypes;
+};
+export type TypedObjectAbbreviated = {
+ t: string;
+ v: EncodingTypes;
+};
+
+export type IndexKeysForArray = Exclude;
+
+export type ArrayToIndexObject> = {
+ [K in IndexKeysForArray]: T[K];
+};
+
+type _Grow> = ((x: T, ...xs: A) => void) extends (...a: infer X) => void
+ ? X
+ : never;
+
+export type GrowToSize, N extends number> = {
+ 0: A;
+ 1: GrowToSize, N>;
+}[A['length'] extends N ? 0 : 1];
+
+export type FixedSizeArray = GrowToSize;
diff --git a/packages/web3-types/src/web3_api_types.ts b/packages/web3-types/src/web3_api_types.ts
new file mode 100644
index 00000000000..a316e342e79
--- /dev/null
+++ b/packages/web3-types/src/web3_api_types.ts
@@ -0,0 +1,40 @@
+/*
+This file is part of web3.js.
+
+web3.js is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+web3.js is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with web3.js. If not, see .
+*/
+
+import { JsonRpcId, JsonRpcIdentifier } from './json_rpc_types';
+
+export type Web3APISpec = Record any>;
+export type Web3APIMethod = string & keyof T;
+export type Web3APIParams> = Parameters<
+ API[Method]
+>;
+
+export interface Web3APIRequest> {
+ method: Method;
+ params: Web3APIParams;
+}
+
+export interface Web3APIPayload>
+ extends Web3APIRequest {
+ readonly jsonrpc?: JsonRpcIdentifier;
+ readonly id?: JsonRpcId;
+}
+
+export type Web3APIReturnType<
+ API extends Web3APISpec,
+ Method extends Web3APIMethod,
+> = ReturnType;
diff --git a/packages/web3-common/src/web3_base_provider.ts b/packages/web3-types/src/web3_base_provider.ts
similarity index 54%
rename from packages/web3-common/src/web3_base_provider.ts
rename to packages/web3-types/src/web3_base_provider.ts
index 11a7acdffd9..1bf438078a6 100644
--- a/packages/web3-common/src/web3_base_provider.ts
+++ b/packages/web3-types/src/web3_base_provider.ts
@@ -15,25 +15,71 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Web3Error } from 'web3-errors';
+import { Socket } from 'net';
+import { Web3Error } from './error_types';
import { EthExecutionAPI } from './eth_execution_api';
import {
+ JsonRpcNotification,
+ JsonRpcPayload,
+ JsonRpcResponse,
+ JsonRpcResponseWithError,
JsonRpcResponseWithResult,
JsonRpcResult,
- Web3APIMethod,
- Web3APIPayload,
- Web3APIReturnType,
- Web3APISpec,
- Web3ProviderStatus,
- Web3ProviderEventCallback,
- Web3ProviderRequestCallback,
-} from './types';
+ JsonRpcSubscriptionResult,
+} from './json_rpc_types';
+import { Web3APISpec, Web3APIMethod, Web3APIReturnType, Web3APIPayload } from './web3_api_types';
const symbol = Symbol.for('web3/base-provider');
+// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#connectivity
+export type Web3ProviderStatus = 'connecting' | 'connected' | 'disconnected';
+
+export type Web3ProviderEventCallback = (
+ error: Error | undefined,
+ result?: JsonRpcSubscriptionResult | JsonRpcNotification,
+) => void;
+
+export type Web3ProviderRequestCallback = (
+ // Used "null" value to match the legacy version
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ err?: Error | Web3Error | null | JsonRpcResponseWithError,
+ response?: JsonRpcResponseWithResult,
+) => void;
+
+export interface LegacySendProvider {
+ send(
+ payload: JsonRpcPayload,
+ // Used "null" value to match the legacy version
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ callback: (err?: Error | null, response?: JsonRpcResponse) => void,
+ ): void;
+}
+
+export interface LegacySendAsyncProvider {
+ sendAsync(
+ payload: JsonRpcPayload,
+ ): Promise>;
+}
+
+export interface LegacyRequestProvider {
+ request(
+ payload: JsonRpcPayload,
+ callback: (err: Error | undefined, response: JsonRpcResponse) => void,
+ ): void;
+}
+
+export interface EIP1193Provider {
+ request, ResponseType = Web3APIReturnType>(
+ request: Web3APIPayload,
+ requestOptions?: unknown,
+ ): Promise>;
+}
+
// Provider interface compatible with EIP-1193
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md
-export abstract class Web3BaseProvider {
+export abstract class Web3BaseProvider
+ implements LegacySendProvider, LegacySendAsyncProvider, EIP1193Provider
+{
public static isWeb3Provider(provider: unknown) {
return (
provider instanceof Web3BaseProvider ||
@@ -58,11 +104,12 @@ export abstract class Web3BaseProvider, ResponseType = Web3APIReturnType>(
- payload: Web3APIPayload,
- callback: Web3ProviderRequestCallback,
+ public send(
+ payload: JsonRpcPayload,
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ callback: (err?: Error | null, response?: JsonRpcResponse) => void,
) {
- this.request(payload)
+ this.request(payload as Web3APIPayload)
.then(response => {
callback(undefined, response);
})
@@ -74,19 +121,9 @@ export abstract class Web3BaseProvider,
- ResponseType = Web3APIReturnType,
- >(payload: Web3APIPayload, callback: Web3ProviderRequestCallback) {
- this.request(payload)
- .then(response => {
- callback(undefined, response);
- })
- .catch((err: Error | Web3Error) => {
- callback(err);
- });
+ public async sendAsync(payload: JsonRpcPayload) {
+ return this.request(payload as Web3APIPayload) as Promise>;
}
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#request
@@ -128,3 +165,14 @@ export abstract class Web3BaseProvider =
+ | Web3BaseProvider
+ | LegacyRequestProvider
+ | LegacySendProvider
+ | LegacySendAsyncProvider;
+
+export type Web3BaseProviderConstructor = new (
+ url: string,
+ net?: Socket,
+) => Web3BaseProvider;
diff --git a/packages/web3-common/src/web3_base_wallet.ts b/packages/web3-types/src/web3_base_wallet.ts
similarity index 98%
rename from packages/web3-common/src/web3_base_wallet.ts
rename to packages/web3-types/src/web3_base_wallet.ts
index 7aa47495495..5db5ed234d0 100644
--- a/packages/web3-common/src/web3_base_wallet.ts
+++ b/packages/web3-types/src/web3_base_wallet.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString } from 'web3-utils';
+import { HexString } from './primitives_types';
export type Web3EncryptedWallet = string;
diff --git a/packages/web3-types/src/web3_deferred_promise_type.ts b/packages/web3-types/src/web3_deferred_promise_type.ts
new file mode 100644
index 00000000000..2a4a3198f10
--- /dev/null
+++ b/packages/web3-types/src/web3_deferred_promise_type.ts
@@ -0,0 +1,23 @@
+/*
+This file is part of web3.js.
+
+web3.js is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+web3.js is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with web3.js. If not, see .
+*/
+
+export interface Web3DeferredPromise extends Promise {
+ state: 'pending' | 'fulfilled' | 'rejected';
+ resolve(value: T | PromiseLike): void;
+ reject(reason?: unknown): void;
+ startTimer(): void;
+}
diff --git a/packages/web3-common/test/.eslintrc.js b/packages/web3-types/test/.eslintrc.js
similarity index 100%
rename from packages/web3-common/test/.eslintrc.js
rename to packages/web3-types/test/.eslintrc.js
diff --git a/packages/web3-common/test/config/jest.config.js b/packages/web3-types/test/config/jest.config.js
similarity index 100%
rename from packages/web3-common/test/config/jest.config.js
rename to packages/web3-types/test/config/jest.config.js
diff --git a/packages/web3-common/test/config/setup.js b/packages/web3-types/test/config/setup.js
similarity index 100%
rename from packages/web3-common/test/config/setup.js
rename to packages/web3-types/test/config/setup.js
diff --git a/packages/web3-common/test/integration/jest.config.js b/packages/web3-types/test/integration/jest.config.js
similarity index 100%
rename from packages/web3-common/test/integration/jest.config.js
rename to packages/web3-types/test/integration/jest.config.js
diff --git a/packages/web3-common/test/integration/setup.js b/packages/web3-types/test/integration/setup.js
similarity index 100%
rename from packages/web3-common/test/integration/setup.js
rename to packages/web3-types/test/integration/setup.js
diff --git a/packages/web3-common/test/tsconfig.json b/packages/web3-types/test/tsconfig.json
similarity index 100%
rename from packages/web3-common/test/tsconfig.json
rename to packages/web3-types/test/tsconfig.json
diff --git a/packages/web3-common/test/unit/jest.config.js b/packages/web3-types/test/unit/jest.config.js
similarity index 100%
rename from packages/web3-common/test/unit/jest.config.js
rename to packages/web3-types/test/unit/jest.config.js
diff --git a/packages/web3-common/tsconfig.json b/packages/web3-types/tsconfig.json
similarity index 100%
rename from packages/web3-common/tsconfig.json
rename to packages/web3-types/tsconfig.json
diff --git a/packages/web3-utils/package.json b/packages/web3-utils/package.json
index 8111b24d807..8e66a971e93 100644
--- a/packages/web3-utils/package.json
+++ b/packages/web3-utils/package.json
@@ -37,9 +37,11 @@
"js-sha3": "^0.8.0",
"prettier": "^2.4.1",
"ts-jest": "^27.0.7",
- "typescript": "^4.5.2"
+ "typescript": "^4.5.2",
+ "@humeris/espresso-shot": "^4.0.0"
},
"dependencies": {
+ "web3-types": "1.0.0-alpha.0",
"web3-errors": "1.0.0-alpha.0",
"web3-validator": "^0.1.0-alpha.0",
"ethereum-cryptography": "^1.1.0"
diff --git a/packages/web3-utils/src/converters.ts b/packages/web3-utils/src/converters.ts
index dc6401f3cb9..eb723f2a46b 100644
--- a/packages/web3-utils/src/converters.ts
+++ b/packages/web3-utils/src/converters.ts
@@ -15,6 +15,16 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
+import {
+ Address,
+ Bytes,
+ HexString,
+ Numbers,
+ ValueTypes,
+ JsonFunctionInterface,
+ JsonEventInterface,
+ Components,
+} from 'web3-types';
import {
validator,
isAddress,
@@ -32,16 +42,6 @@ import {
InvalidTypeAbiInputError,
InvalidNumberError,
} from 'web3-errors';
-import {
- Address,
- Bytes,
- HexString,
- Numbers,
- ValueTypes,
- JsonFunctionInterface,
- JsonEventInterface,
- Components,
-} from './types';
const base = BigInt(10);
const expo10 = (expo: number) => base ** BigInt(expo);
diff --git a/packages/web3-common/src/formatter.ts b/packages/web3-utils/src/formatter.ts
similarity index 97%
rename from packages/web3-common/src/formatter.ts
rename to packages/web3-utils/src/formatter.ts
index 262b9c70182..f7a04dc3ac4 100644
--- a/packages/web3-common/src/formatter.ts
+++ b/packages/web3-utils/src/formatter.ts
@@ -15,17 +15,10 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { FormatterError } from 'web3-errors';
-import {
- Bytes,
- bytesToBuffer,
- bytesToHex,
- HexString,
- mergeDeep,
- Numbers,
- numberToHex,
- toBigInt,
-} from 'web3-utils';
+import { Bytes, HexString, Numbers } from 'web3-types';
import { isNullish, isObject, JsonSchema, utils, ValidationSchemaInput } from 'web3-validator';
+import { bytesToBuffer, bytesToHex, numberToHex, toBigInt } from './converters';
+import { mergeDeep } from './objects';
const { parseBaseType } = utils;
diff --git a/packages/web3-utils/src/hash.ts b/packages/web3-utils/src/hash.ts
index b8f95bccb1a..2b83e6c3fcc 100644
--- a/packages/web3-utils/src/hash.ts
+++ b/packages/web3-utils/src/hash.ts
@@ -27,7 +27,7 @@ import {
} from 'web3-errors';
import { keccak256 } from 'ethereum-cryptography/keccak';
import { isAddress, isHexStrict, isNullish } from 'web3-validator';
-import { Numbers, TypedObject, TypedObjectAbbreviated, EncodingTypes, Bytes } from './types';
+import { Numbers, TypedObject, TypedObjectAbbreviated, EncodingTypes, Bytes } from 'web3-types';
import { leftPad, rightPad, toTwosComplement } from './string_manipulation';
import { utf8ToHex, hexToBytes, toNumber, bytesToHex } from './converters';
diff --git a/packages/web3-utils/src/index.ts b/packages/web3-utils/src/index.ts
index 89378cb2ffc..dda00f69904 100644
--- a/packages/web3-utils/src/index.ts
+++ b/packages/web3-utils/src/index.ts
@@ -17,8 +17,11 @@ along with web3.js. If not, see .
export * from './converters';
export * from './validation';
-export * from './types';
+export * from './formatter';
export * from './hash';
export * from './random';
export * from './string_manipulation';
export * from './objects';
+export * from './json_rpc';
+export * as jsonRpc from './json_rpc';
+export * from './web3_deferred_promise';
diff --git a/packages/web3-common/src/json_rpc.ts b/packages/web3-utils/src/json_rpc.ts
similarity index 96%
rename from packages/web3-common/src/json_rpc.ts
rename to packages/web3-utils/src/json_rpc.ts
index 5b0e3d24bd2..1105e0b1456 100644
--- a/packages/web3-common/src/json_rpc.ts
+++ b/packages/web3-utils/src/json_rpc.ts
@@ -27,7 +27,7 @@ import {
JsonRpcRequest,
JsonRpcBatchResponse,
JsonRpcSubscriptionResult,
-} from './types';
+} from 'web3-types';
let messageId = 0;
@@ -42,6 +42,7 @@ export const isResponseWithResult = (
isNullish(response.error) &&
(typeof response.id === 'number' || typeof response.id === 'string');
+// To avoid circular package dependency, copied to code here. If you update this please update same function in `response_errors.ts`
export const isResponseWithError = (
response: JsonRpcResponse,
): response is JsonRpcResponseWithError =>
diff --git a/packages/web3-utils/src/string_manipulation.ts b/packages/web3-utils/src/string_manipulation.ts
index 861c7d36653..8ed83a055f6 100644
--- a/packages/web3-utils/src/string_manipulation.ts
+++ b/packages/web3-utils/src/string_manipulation.ts
@@ -15,10 +15,10 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
+import { Numbers } from 'web3-types';
import { NibbleWidthError } from 'web3-errors';
import { isHexStrict, validator, utils as validatorUtils } from 'web3-validator';
import { numberToHex, toHex, toNumber } from './converters';
-import { Numbers } from './types';
/**
* Adds a padding on the left of a string, if value is a integer or bigInt will be converted to a hex string.
diff --git a/packages/web3-utils/src/types.ts b/packages/web3-utils/src/types.ts
deleted file mode 100644
index 12e414039e0..00000000000
--- a/packages/web3-utils/src/types.ts
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-This file is part of web3.js.
-
-web3.js is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-web3.js is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with web3.js. If not, see .
-*/
-
-export type HexString = string;
-export type ValueTypes = 'address' | 'bool' | 'string' | 'int256' | 'uint256' | 'bytes' | 'bigint';
-export type Bytes = Buffer | Uint8Array | ArrayBuffer | HexString;
-export type Numbers = number | bigint | string | HexString;
-// Hex encoded 32 bytes
-export type HexString32Bytes = HexString;
-// Hex encoded 16 bytes
-export type HexString16Bytes = HexString;
-// Hex encoded 8 bytes
-export type HexString8Bytes = HexString;
-// Hex encoded 1 byte
-export type HexStringSingleByte = HexString;
-// Hex encoded 1 byte
-export type HexStringBytes = HexString;
-// Hex encoded 256 byte
-export type HexString256Bytes = HexString;
-// Hex encoded unsigned integer
-export type Uint = HexString;
-// Hex encoded unsigned integer 32 bytes
-export type Uint256 = HexString;
-// Hex encoded address
-export type Address = HexString;
-
-// https://github.com/ethereum/execution-apis/blob/main/src/schemas/filter.json#L59
-export type Topic = HexString32Bytes;
-
-export enum BlockTags {
- EARLIEST = 'earliest',
- LATEST = 'latest',
- PENDING = 'pending',
-}
-export type BlockTag = 'earliest' | 'latest' | 'pending';
-export type BlockNumberOrTag = Numbers | BlockTag;
-
-export type Optional = Pick, K> & Omit;
-export type EncodingTypes = Numbers | boolean | Numbers[] | boolean[];
-export type TypedObject = {
- type: string;
- value: EncodingTypes;
-};
-export type TypedObjectAbbreviated = {
- t: string;
- v: EncodingTypes;
-};
-
-export type IndexKeysForArray = Exclude;
-
-export type ArrayToIndexObject> = {
- [K in IndexKeysForArray]: T[K];
-};
-
-type _Grow> = ((x: T, ...xs: A) => void) extends (...a: infer X) => void
- ? X
- : never;
-
-export type GrowToSize, N extends number> = {
- 0: A;
- 1: GrowToSize, N>;
-}[A['length'] extends N ? 0 : 1];
-
-export type FixedSizeArray = GrowToSize;
-
-export type Components = {
- name: string;
- type: string;
- indexed?: boolean;
- components?: Components[];
-};
-
-export type AbiInput = {
- name: string;
- type: string;
- components?: Components;
- index?: boolean;
- internalType?: string;
-};
-
-// https://docs.soliditylang.org/en/develop/abi-spec.html#json
-export type JsonFunctionInterface = {
- type: 'function';
- name: string;
- inputs: Components[];
- outputs?: AbiInput[];
- stateMutability?: string;
-};
-
-export type JsonEventInterface = {
- type: 'event';
- name: string;
- inputs: Components[];
- indexed: boolean;
- anonymous: boolean;
-};
-
-// https://github.com/ethereum/execution-apis/blob/main/src/schemas/filter.json#L28
-export interface Filter {
- readonly fromBlock?: BlockNumberOrTag;
- readonly toBlock?: BlockNumberOrTag;
- readonly address?: Address | Address[];
-
- // Using "null" type intentionally to match specifications
- // eslint-disable-next-line @typescript-eslint/ban-types
- readonly topics?: (null | Topic | Topic[])[];
-}
diff --git a/packages/web3-utils/src/validation.ts b/packages/web3-utils/src/validation.ts
index b6762df7a4b..144c493ece3 100644
--- a/packages/web3-utils/src/validation.ts
+++ b/packages/web3-utils/src/validation.ts
@@ -29,7 +29,7 @@ import {
isUserEthereumAddressInBloom as isUserEthereumAddressInBloomValidator,
isNullish as isNullishValidator,
} from 'web3-validator';
-import { Numbers } from './types';
+import { Numbers } from 'web3-types';
/**
* @deprecated Will be removed in next release. Please use `web3-validator` package instead.
diff --git a/packages/web3-common/src/deferred_promise.ts b/packages/web3-utils/src/web3_deferred_promise.ts
similarity index 94%
rename from packages/web3-common/src/deferred_promise.ts
rename to packages/web3-utils/src/web3_deferred_promise.ts
index 9d01ab785ab..482ef3a7d71 100644
--- a/packages/web3-common/src/deferred_promise.ts
+++ b/packages/web3-utils/src/web3_deferred_promise.ts
@@ -16,8 +16,9 @@ along with web3.js. If not, see .
*/
import { OperationTimeoutError } from 'web3-errors';
+import { Web3DeferredPromise as Web3DeferredPromiseInterface } from 'web3-types';
-export class DeferredPromise implements Promise {
+export class Web3DeferredPromise implements Promise, Web3DeferredPromiseInterface {
// public tag to treat object as promise by different libs
public [Symbol.toStringTag]: 'Promise';
diff --git a/packages/web3-utils/test/fixtures/converters.ts b/packages/web3-utils/test/fixtures/converters.ts
index ad90c87af35..7831993fce0 100644
--- a/packages/web3-utils/test/fixtures/converters.ts
+++ b/packages/web3-utils/test/fixtures/converters.ts
@@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
+import { Address, Bytes, HexString, Numbers, ValueTypes } from 'web3-types';
import { EtherUnits } from '../../src/converters';
-import { Address, Bytes, HexString, Numbers, ValueTypes } from '../../src/types';
export const bytesToHexValidData: [Bytes, HexString][] = [
[new Uint8Array([72]), '0x48'],
diff --git a/packages/web3-utils/test/fixtures/hash.ts b/packages/web3-utils/test/fixtures/hash.ts
index dae4d8f0011..34ca586fba6 100644
--- a/packages/web3-utils/test/fixtures/hash.ts
+++ b/packages/web3-utils/test/fixtures/hash.ts
@@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
+import { TypedObject, TypedObjectAbbreviated } from 'web3-types';
import { hexToBytes } from '../../src/converters';
-import { TypedObject, TypedObjectAbbreviated } from '../../src/types';
export const sha3Data: [string, string | undefined][] = [
['test123', '0xf81b517a242b218999ec8eec0ea6e2ddbef2a367a14e93f4a32a39e260f686ad'],
diff --git a/packages/web3-utils/test/fixtures/string_manipulation.ts b/packages/web3-utils/test/fixtures/string_manipulation.ts
index df12fc40f1d..d127f22bcf8 100644
--- a/packages/web3-utils/test/fixtures/string_manipulation.ts
+++ b/packages/web3-utils/test/fixtures/string_manipulation.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { HexString, Numbers } from '../../src/types';
+import { HexString, Numbers } from 'web3-types';
export const padLeftData: [[Numbers, number, string], HexString][] = [
[[0, 10, '0'], '0x0000000000'],
diff --git a/packages/web3-utils/test/fixtures/validation.ts b/packages/web3-utils/test/fixtures/validation.ts
index 3d85fe5ef6f..6b19273ef78 100644
--- a/packages/web3-utils/test/fixtures/validation.ts
+++ b/packages/web3-utils/test/fixtures/validation.ts
@@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
+import { Numbers } from 'web3-types';
import { InvalidBlockError } from 'web3-errors';
-import { Numbers } from '../../src/types';
export const compareBlockNumbersValidData: [[Numbers, Numbers], number][] = [
[[1, 1], 0],
diff --git a/packages/web3-common/test/unit/formatter.test.ts b/packages/web3-utils/test/unit/formatter.test.ts
similarity index 99%
rename from packages/web3-common/test/unit/formatter.test.ts
rename to packages/web3-utils/test/unit/formatter.test.ts
index 56ab254e96f..52a09da2dee 100644
--- a/packages/web3-common/test/unit/formatter.test.ts
+++ b/packages/web3-utils/test/unit/formatter.test.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Address, Bytes, HexString, Numbers } from 'web3-utils';
+import { Address, Bytes, HexString, Numbers } from 'web3-types';
import { expectTypeOf, typecheck } from '@humeris/espresso-shot';
import {
DEFAULT_RETURN_FORMAT,
diff --git a/packages/web3-validator/package.json b/packages/web3-validator/package.json
index ca101916946..a5d5f718a8d 100644
--- a/packages/web3-validator/package.json
+++ b/packages/web3-validator/package.json
@@ -28,6 +28,7 @@
},
"dependencies": {
"ajv": "^8.11.0",
+ "web3-types": "1.0.0-alpha.0",
"ethereum-cryptography": "^1.1.0"
},
"devDependencies": {
diff --git a/packages/web3-validator/src/keywords/eth.ts b/packages/web3-validator/src/keywords/eth.ts
index ce622c8150f..9b550911ba7 100644
--- a/packages/web3-validator/src/keywords/eth.ts
+++ b/packages/web3-validator/src/keywords/eth.ts
@@ -15,9 +15,10 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
+import { Filter } from 'web3-types';
import { AnySchemaObject, FuncKeywordDefinition, SchemaCxt } from 'ajv';
import { Web3ValidatorError } from '../errors';
-import { DataValidateFunction, Filter, ValidInputTypes, Web3ValidationErrorObject } from '../types';
+import { DataValidateFunction, ValidInputTypes, Web3ValidationErrorObject } from '../types';
import { parseBaseType } from '../utils';
import {
isAddress,
diff --git a/packages/web3-validator/src/types.ts b/packages/web3-validator/src/types.ts
index a26c04955dc..9290e554a07 100644
--- a/packages/web3-validator/src/types.ts
+++ b/packages/web3-validator/src/types.ts
@@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
+import { AbiParameter, Optional } from 'web3-types';
import { ErrorObject, JSONSchemaType } from 'ajv';
-import { AbiParameter } from './private_types';
export { JSONSchemaType } from 'ajv';
export { DataValidateFunction, DataValidationCxt } from 'ajv/dist/types';
@@ -62,30 +62,6 @@ export type Web3ValidationOptions = {
readonly silent: boolean;
};
-// Some duplicate types introduced to avoid circular dependency to avoid
-// breaking changes in "web3-utils" package.
-export enum BlockTags {
- EARLIEST = 'earliest',
- LATEST = 'latest',
- PENDING = 'pending',
-}
-
-export type BlockTag = 'earliest' | 'latest' | 'pending';
-
-export type BlockNumberOrTag = string | BlockTag;
-
-export interface Filter {
- readonly fromBlock?: BlockNumberOrTag;
- readonly toBlock?: BlockNumberOrTag;
- readonly address?: string | string[];
- // Using "null" type intentionally to match specifications
- // eslint-disable-next-line @typescript-eslint/ban-types
- readonly topics?: (null | string | string[])[];
-}
-
-// To avoid circular dependency to avoid breaking changes in "web3-utils" package.
-export type Optional = Pick, K> & Omit;
-
// In `JSONSchemaType` from `ajv` the `type` is required
// We need to make it optional
export type JsonSchema = Optional, 'type'> & {
diff --git a/packages/web3-validator/src/validation/abi.ts b/packages/web3-validator/src/validation/abi.ts
index e67d0c0d611..5fb26e9a276 100644
--- a/packages/web3-validator/src/validation/abi.ts
+++ b/packages/web3-validator/src/validation/abi.ts
@@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
+import { AbiParameter } from 'web3-types';
import { ShortValidationSchema } from '../types';
-import { AbiParameter } from '../private_types';
export const isAbiParameterSchema = (
schema: string | ShortValidationSchema | AbiParameter,
diff --git a/packages/web3-validator/src/validation/block.ts b/packages/web3-validator/src/validation/block.ts
index 6f273c6c9ca..acc9fec1cb3 100644
--- a/packages/web3-validator/src/validation/block.ts
+++ b/packages/web3-validator/src/validation/block.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { BlockTags } from '../types';
+import { BlockTags } from 'web3-types';
import { isUInt } from './numbers';
export const isBlockNumber = (value: string | number | bigint): boolean => isUInt(value);
diff --git a/packages/web3-validator/src/validation/filter.ts b/packages/web3-validator/src/validation/filter.ts
index b5fc494fec5..b8a5da79569 100644
--- a/packages/web3-validator/src/validation/filter.ts
+++ b/packages/web3-validator/src/validation/filter.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Filter } from '../types';
+import { Filter } from 'web3-types';
import { isAddress } from './address';
import { isBlockNumberOrTag } from './block';
import { isNullish } from './object';
diff --git a/packages/web3-validator/test/fixtures/validation.ts b/packages/web3-validator/test/fixtures/validation.ts
index 403fc9b8be7..64ac4e968ee 100644
--- a/packages/web3-validator/test/fixtures/validation.ts
+++ b/packages/web3-validator/test/fixtures/validation.ts
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { Filter } from '../../src/types';
+import { Filter } from 'web3-types';
export const validUintData: any[] = [
'0x48',
diff --git a/packages/web3/package.json b/packages/web3/package.json
index c8479773351..4f09d8a0fc1 100644
--- a/packages/web3/package.json
+++ b/packages/web3/package.json
@@ -53,7 +53,7 @@
"web3-providers-ipc": "4.0.0-alpha.0"
},
"dependencies": {
- "web3-common": "1.0.0-alpha.0",
+ "web3-types": "1.0.0-alpha.0",
"web3-core": "4.0.0-alpha.0",
"web3-errors": "1.0.0-alpha.0",
"web3-eth": "4.0.0-alpha.1",
diff --git a/packages/web3/src/accounts.ts b/packages/web3/src/accounts.ts
index 1b93a613c29..c4b3a4b6077 100644
--- a/packages/web3/src/accounts.ts
+++ b/packages/web3/src/accounts.ts
@@ -15,9 +15,10 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { EthExecutionAPI, ETH_DATA_FORMAT, format } from 'web3-common';
+import { EthExecutionAPI, Bytes, Transaction } from 'web3-types';
+import { ETH_DATA_FORMAT, format } from 'web3-utils';
import { Web3Context } from 'web3-core';
-import { prepareTransactionForSigning, Transaction } from 'web3-eth';
+import { prepareTransactionForSigning } from 'web3-eth';
import {
create,
decrypt,
@@ -30,7 +31,6 @@ import {
sign,
Wallet,
} from 'web3-eth-accounts';
-import { Bytes } from 'web3-utils';
/**
* Initialize the accounts module for the given context.
diff --git a/packages/web3/src/types.ts b/packages/web3/src/types.ts
index aed712cbdac..352161125d2 100644
--- a/packages/web3/src/types.ts
+++ b/packages/web3/src/types.ts
@@ -15,9 +15,8 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { EthExecutionAPI } from 'web3-common';
-import { SupportedProviders } from 'web3-core';
-import Eth, { Transaction } from 'web3-eth';
+import { EthExecutionAPI, SupportedProviders, Address, Bytes, Transaction } from 'web3-types';
+import Eth from 'web3-eth';
import {
ContractAbi,
decodeLog,
@@ -42,7 +41,6 @@ import Contract, { ContractInitOptions } from 'web3-eth-contract';
import { ENS } from 'web3-eth-ens';
import Net from 'web3-net';
import { Iban } from 'web3-eth-iban';
-import { Address, Bytes } from 'web3-utils';
export type Web3ContractConstructor = Omit & {
new (jsonInterface: Abi, address?: Address, options?: ContractInitOptions): Contract;
diff --git a/packages/web3/src/web3.ts b/packages/web3/src/web3.ts
index 59e69ee71e5..3ab2cc02344 100644
--- a/packages/web3/src/web3.ts
+++ b/packages/web3/src/web3.ts
@@ -16,8 +16,7 @@ along with web3.js. If not, see .
*/
// eslint-disable-next-line max-classes-per-file
import { readFileSync } from 'fs';
-import { EthExecutionAPI } from 'web3-common';
-import { SupportedProviders, Web3Context } from 'web3-core';
+import { Web3Context } from 'web3-core';
import Web3Eth from 'web3-eth';
import { ContractAbi } from 'web3-eth-abi';
import Contract, { ContractInitOptions } from 'web3-eth-contract';
@@ -26,7 +25,8 @@ import Iban from 'web3-eth-iban';
import Personal from 'web3-eth-personal';
import Net from 'web3-net';
import * as utils from 'web3-utils';
-import { Address, isNullish } from 'web3-utils';
+import { isNullish } from 'web3-utils';
+import { EthExecutionAPI, Address, SupportedProviders } from 'web3-types';
import abi from './abi';
import { initAccountsForContext } from './accounts';
import { Web3EthInterface } from './types';
diff --git a/packages/web3/test/integration/web3.test.ts b/packages/web3/test/integration/web3.test.ts
index 742fc1e96c9..0e3e9b7b895 100644
--- a/packages/web3/test/integration/web3.test.ts
+++ b/packages/web3/test/integration/web3.test.ts
@@ -15,8 +15,7 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { JsonRpcOptionalRequest, Web3BaseProvider } from 'web3-common';
-import { SupportedProviders } from 'web3-core';
+import { JsonRpcOptionalRequest, Web3BaseProvider, SupportedProviders } from 'web3-types';
import Contract from 'web3-eth-contract';
import { Web3EthExecutionAPI } from 'web3-eth/dist/web3_eth_execution_api';
import HttpProvider from 'web3-providers-http';
diff --git a/scripts/system_tests_utils.ts b/scripts/system_tests_utils.ts
index ca9c557221a..cd49dea3a62 100644
--- a/scripts/system_tests_utils.ts
+++ b/scripts/system_tests_utils.ts
@@ -19,7 +19,7 @@ along with web3.js. If not, see .
import fetch from 'cross-fetch';
// eslint-disable-next-line import/no-extraneous-dependencies
-import { Bytes } from 'web3-utils';
+import { ETH_DATA_FORMAT, format } from 'web3-utils';
// eslint-disable-next-line import/no-extraneous-dependencies
import { Personal } from 'web3-eth-personal';
@@ -34,12 +34,12 @@ import {
} from 'web3-eth-accounts';
// eslint-disable-next-line import/no-extraneous-dependencies
-import { prepareTransactionForSigning, Transaction, Web3Eth } from 'web3-eth';
+import { prepareTransactionForSigning, Web3Eth } from 'web3-eth';
// eslint-disable-next-line import/no-extraneous-dependencies
import { Web3Context } from 'web3-core';
// eslint-disable-next-line import/no-extraneous-dependencies
-import { EthExecutionAPI, ETH_DATA_FORMAT, format, Web3BaseProvider } from 'web3-common';
+import { EthExecutionAPI, Web3BaseProvider, Bytes, Transaction } from 'web3-types';
let _accounts: string[] = [];