From a0d6730e317ab97fa4983c09880a0a1d01af9b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamilcan=20=C3=87elik?= <56474929+kmlcnclk@users.noreply.github.com> Date: Mon, 23 Oct 2023 17:35:53 +0300 Subject: [PATCH] Bug Fixing ERR_UNSUPPORTED_DIR_IMPORT in web3-eth-abi/lib/esm/coders/encode.js with node >18 (#6537) * Update encode.ts * Fixing route bugs * Update CHANGELOG.md * update changelog.md --- CHANGELOG.md | 8 +++++++- packages/web3-eth-abi/CHANGELOG.md | 6 +++++- packages/web3-eth-abi/src/coders/base/array.ts | 2 +- packages/web3-eth-abi/src/coders/base/tuple.ts | 2 +- packages/web3-eth-abi/src/coders/encode.ts | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4e6ec38695..0dabf072034 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2199,4 +2199,10 @@ If there are any bugs, improvements, optimizations or any new feature proposal f - Dependencies updated -## [Unreleased] \ No newline at end of file +## [Unreleased] + +### Fixed + +#### web3-eth-abi + +- Bug fix of `ERR_UNSUPPORTED_DIR_IMPORT` in ABI (#6535) \ No newline at end of file diff --git a/packages/web3-eth-abi/CHANGELOG.md b/packages/web3-eth-abi/CHANGELOG.md index 5cf1be481b8..a24f03944a9 100644 --- a/packages/web3-eth-abi/CHANGELOG.md +++ b/packages/web3-eth-abi/CHANGELOG.md @@ -148,4 +148,8 @@ Documentation: - Fix issue with default config with babel (and React): "TypeError: Cannot convert a BigInt value to a number #6187" (#6506) -## [Unreleased] \ No newline at end of file +## [Unreleased] + +### Fixed + +- Bug fix of `ERR_UNSUPPORTED_DIR_IMPORT` in ABI (#6535) \ No newline at end of file diff --git a/packages/web3-eth-abi/src/coders/base/array.ts b/packages/web3-eth-abi/src/coders/base/array.ts index 26fab5049cd..0c23ac4e287 100644 --- a/packages/web3-eth-abi/src/coders/base/array.ts +++ b/packages/web3-eth-abi/src/coders/base/array.ts @@ -18,7 +18,7 @@ import { AbiError } from 'web3-errors'; import { AbiParameter } from 'web3-types'; import { uint8ArrayConcat } from 'web3-utils'; // eslint-disable-next-line import/no-cycle -import { decodeParamFromAbiParameter, encodeNumber, encodeParamFromAbiParameter } from '.'; +import { decodeParamFromAbiParameter, encodeNumber, encodeParamFromAbiParameter } from './index.js'; import { DecoderResult, EncoderResult } from '../types.js'; import { extractArrayType, isDynamic, WORD_SIZE } from '../utils.js'; import { decodeNumber } from './number.js'; diff --git a/packages/web3-eth-abi/src/coders/base/tuple.ts b/packages/web3-eth-abi/src/coders/base/tuple.ts index 4e086d41e43..89ccff48cf3 100644 --- a/packages/web3-eth-abi/src/coders/base/tuple.ts +++ b/packages/web3-eth-abi/src/coders/base/tuple.ts @@ -19,7 +19,7 @@ import { AbiParameter } from 'web3-types'; import { uint8ArrayConcat } from 'web3-utils'; import { DecoderResult, EncoderResult } from '../types.js'; // eslint-disable-next-line import/no-cycle -import { decodeParamFromAbiParameter, encodeParamFromAbiParameter } from '.'; +import { decodeParamFromAbiParameter, encodeParamFromAbiParameter } from './index.js'; import { encodeDynamicParams } from './utils.js'; import { isDynamic } from '../utils.js'; import { decodeNumber } from './number.js'; diff --git a/packages/web3-eth-abi/src/coders/encode.ts b/packages/web3-eth-abi/src/coders/encode.ts index 254496dfbeb..d0d8260db16 100644 --- a/packages/web3-eth-abi/src/coders/encode.ts +++ b/packages/web3-eth-abi/src/coders/encode.ts @@ -17,7 +17,7 @@ along with web3.js. If not, see . import { AbiError } from 'web3-errors'; import { AbiInput } from 'web3-types'; import { utils } from 'web3-validator'; -import { encodeTuple } from './base'; +import { encodeTuple } from './base/index.js'; import { toAbiParams } from './utils.js'; export function encodeParameters(abi: ReadonlyArray, params: unknown[]): string {