Skip to content

Commit 4de51d4

Browse files
committed
web-validator and web-utils removed frmo remix-lib
1 parent 967c425 commit 4de51d4

File tree

6 files changed

+10
-15
lines changed

6 files changed

+10
-15
lines changed

libs/remix-lib/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
"solc": "0.8.26",
3131
"string-similarity": "^4.0.4",
3232
"viem": "2.22.3",
33-
"web3": "^4.1.1",
34-
"web3-validator": "^2.0.0"
33+
"web3": "^4.1.1"
3534
},
3635
"devDependencies": {
3736
"@babel/core": "^7.4.5",

libs/remix-lib/src/execution/txRunnerWeb3.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
import { EventManager } from '../eventManager'
33
import type { Transaction as InternalTransaction } from './txRunner'
44
import { Web3 } from 'web3'
5-
import { BrowserProvider } from 'ethers'
5+
import { BrowserProvider, getAddress } from 'ethers'
66
import { normalizeHexAddress } from '../helpers/uiHelper'
77
import { aaSupportedNetworks, aaLocalStorageKey, getPimlicoBundlerURL, aaDeterminiticProxyAddress } from '../helpers/aaConstants'
8-
import { toBigInt, toHex, toChecksumAddress } from 'web3-utils'
98
import { randomBytes } from 'crypto'
109
import "viem/window"
11-
import { custom, http, createWalletClient, createPublicClient, encodePacked, getContractAddress } from "viem"
10+
import { custom, http, createWalletClient, createPublicClient, encodePacked, getContractAddress, toHex } from "viem"
1211
import * as chains from "viem/chains"
1312
import { entryPoint07Address } from "viem/account-abstraction"
1413
const { createSmartAccountClient } = require("permissionless")
@@ -70,7 +69,7 @@ export class TxRunnerWeb3 {
7069
if (receipt.logs && receipt.logs.length) {
7170
receipt.logs.map((log) => {
7271
if (log.topics[0] === '0xa1fb700aaee2ae4a2ff6f91ce7eba292f89c2f5488b8ec4c5c5c8150692595c3') {
73-
(receipt as any).contractAddress = toChecksumAddress(normalizeHexAddress(toHex(log.topics[2])))
72+
(receipt as any).contractAddress = getAddress(normalizeHexAddress(toHex(log.topics[2])))
7473
}
7574
})
7675
}
@@ -165,7 +164,7 @@ export class TxRunnerWeb3 {
165164
// the sending stack (web3.js / metamask need to have the type defined)
166165
// this is to avoid the following issue: https://github.com/MetaMask/metamask-extension/issues/11824
167166
txCopy.type = '0x2'
168-
txCopy.maxFeePerGas = Math.ceil(Number((toBigInt(network.lastBlock.baseFeePerGas) + toBigInt(network.lastBlock.baseFeePerGas) / BigInt(3)).toString()))
167+
txCopy.maxFeePerGas = Math.ceil(Number((BigInt(network.lastBlock.baseFeePerGas) + BigInt(network.lastBlock.baseFeePerGas) / BigInt(3)).toString()))
169168
} else {
170169
txCopy.type = '0x1'
171170
txCopy.gasPrice = undefined

libs/remix-lib/src/execution/typeConversion.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
'use strict'
22
import { BN } from 'bn.js'
33
import { bytesToHex } from '@ethereumjs/util'
4-
import { isBigInt } from 'web3-validator'
54

65
export function toInt (h) {
76
if (h.indexOf && h.indexOf('0x') === 0) {
87
return (new BN(h.replace('0x', ''), 16)).toString(10)
9-
} else if ((h.constructor && h.constructor.name === 'BigNumber') || BN.isBN(h) || isBigInt(h)) {
8+
} else if ((h.constructor && h.constructor.name === 'BigNumber') || BN.isBN(h) || (typeof h === 'bigint')) {
109
return h.toString(10)
1110
}
1211
return h
@@ -22,7 +21,7 @@ function convertToString (v) {
2221
ret.push(convertToString(v[k]))
2322
}
2423
return ret
25-
} else if (BN.isBN(v) || (v.constructor && v.constructor.name === 'BigNumber') || isBigInt(v)) {
24+
} else if (BN.isBN(v) || (v.constructor && v.constructor.name === 'BigNumber') || (typeof v === 'bigint')) {
2625
return v.toString(10)
2726
} else if (v._isBigNumber) {
2827
return toInt(v._hex)

libs/remix-lib/src/helpers/txResultHelper.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
import { bytesToHex } from '@ethereumjs/util'
33
import { isHexString } from 'ethjs-util'
44
import { BN } from 'bn.js'
5-
import { isBigInt } from 'web3-validator'
65

76
function convertToPrefixedHex (input) {
87
if (input === undefined || input === null || isHexString(input)) {
98
return input
109
}
1110
if ((input.constructor && input.constructor.name === 'BigNumber')
1211
|| BN.isBN(input)
13-
|| isBigInt(input)
12+
|| (typeof input === 'bigint')
1413
|| typeof input === 'number') {
1514
return '0x' + input.toString(16)
1615
}

libs/remix-lib/src/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22
import { Web3, Web3PluginBase } from 'web3'
3-
import { toNumber } from 'web3-utils'
3+
import { toNumber } from 'ethers'
44

55
export function extendWeb3 (web3) {
66
if (!web3.debug){

libs/remix-lib/src/util.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { hash } from '@remix-project/remix-lib'
33
import { setLengthLeft, toBytes, addHexPrefix } from '@ethereumjs/util'
44
import stringSimilarity from 'string-similarity'
55
import { BN } from 'bn.js'
6-
import { isBigInt } from 'web3-validator'
76

87
/*
98
contains misc util: @TODO should be split
@@ -174,7 +173,7 @@ export function buildCallPath (index, rootCall) {
174173
*/
175174
// eslint-disable-next-line camelcase
176175
export function sha3_256 (value) {
177-
if ((value.constructor && value.constructor.name === 'BigNumber') || BN.isBN(value) || isBigInt(value)) {
176+
if ((value.constructor && value.constructor.name === 'BigNumber') || BN.isBN(value) || (typeof value === 'bigint')) {
178177
value = value.toString(16)
179178
}
180179
if (typeof value === 'number') {

0 commit comments

Comments
 (0)