Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ac803c7
fix: use blockchain timestamp and dynamic port in CLI tests
Feb 8, 2026
7b32787
This is an unrelated change (looks like it was made by the vibe-kanba…
Feb 8, 2026
f3ad997
fix: patch buffer-equal-constant-time for Node 25 compatibility
Feb 8, 2026
f243f8f
fix: increase Anvil startTimeout to prevent test failures during para…
Feb 8, 2026
16480ad
refactor: remove web3 from @celo/utils and @celo/connect
Feb 8, 2026
5b33f0a
feat: add web3 compatibility shim and fix downstream web3 usage
Feb 8, 2026
9ed36d5
style: apply prettier formatting
Feb 8, 2026
28a18df
refactor: remove web3 dependency from all remaining packages
Feb 8, 2026
f802f6e
chore: remove stale web3 resolutions from root package.json
Feb 8, 2026
77b41e4
chore: remove stale wallet-rpc build artifacts
Feb 8, 2026
c2fa8de
Revert "chore: remove stale wallet-rpc build artifacts"
Feb 8, 2026
53ce3ef
chore: remove stale wallet-rpc test artifacts that depend on web3
Feb 8, 2026
365e55d
refactor: rename web3 parameter to client and add Web3 type interface
Feb 9, 2026
47e4167
style: apply formatter fixes from pre-commit hook
Feb 9, 2026
7ce5458
merge: resolve conflicts with master
Feb 9, 2026
a405a8d
fix: fix web3 shim and test compatibility issues after merge
Feb 9, 2026
24004ca
style: apply formatter fix
Feb 9, 2026
aeefc1d
fix: add web3 compat type coercion for viem ABI encoding in shim
Feb 9, 2026
e45d385
fix: add signTransaction to web3 shim and fix wallet-local signing test
Feb 9, 2026
f0b0871
fix: remove web3 import from Accounts.test.ts, use inline constant
Feb 9, 2026
c44e50b
style: fix formatter issue in .vscode/extensions.json
Feb 9, 2026
71976fa
style: use dot notation for listeners object access in connection.ts
Feb 9, 2026
d305566
fix: remove web3 dependency from BaseWrapper and fix soliditySha3 compat
Feb 9, 2026
ff759e7
style: apply biome formatter to BaseWrapper files
Feb 9, 2026
c3f6ad3
ci: retrigger CI
Feb 9, 2026
f0fe3a8
fix: fix hashMessage to treat input as UTF-8 and handle gas:0 in send…
Feb 9, 2026
80416a0
fix: fix sourcify test mock to produce valid ABI-encoded address
Feb 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"eamodio.gitlens",
"biomejs.biome",
"redhat.vscode-yaml",
"davidanson.vscode-markdownlint",
"markis.code-coverage"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
"recommendations": ["bloop.vibe-kanban"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/index.js b/index.js
index 5462c1f830bdbe79bf2b1fcfd811cd9799b4dd11..e8fe7e61083d95714bba6f2d4544d0426749a64f 100644
--- a/index.js
+++ b/index.js
@@ -28,14 +28,19 @@ function bufferEq(a, b) {
}

bufferEq.install = function() {
- Buffer.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
+ Buffer.prototype.equal = function equal(that) {
return bufferEq(this, that);
};
+ if (SlowBuffer) {
+ SlowBuffer.prototype.equal = Buffer.prototype.equal;
+ }
};

var origBufEqual = Buffer.prototype.equal;
-var origSlowBufEqual = SlowBuffer.prototype.equal;
+var origSlowBufEqual = SlowBuffer ? SlowBuffer.prototype.equal : undefined;
bufferEq.restore = function() {
Buffer.prototype.equal = origBufEqual;
- SlowBuffer.prototype.equal = origSlowBufEqual;
+ if (SlowBuffer && origSlowBufEqual) {
+ SlowBuffer.prototype.equal = origSlowBufEqual;
+ }
};
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@
"typescript": "5.3.3"
},
"resolutions": {
"web3": "1.10.4",
"web3-utils": "1.10.4",
"blind-threshold-bls": "npm:@celo/blind-threshold-bls@1.0.0-beta",
"@types/bn.js": "4.11.6",
"bignumber.js": "9.0.0"
"bignumber.js": "9.0.0",
"buffer-equal-constant-time@npm:1.0.1": "patch:buffer-equal-constant-time@npm%3A1.0.1#~/.yarn/patches/buffer-equal-constant-time-npm-1.0.1-41826f3419.patch"
},
"dependencies": {
"@changesets/cli": "^2.29.5"
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@
"fs-extra": "^8.1.0",
"humanize-duration": "^3.32.1",
"prompts": "^2.0.1",
"viem": "^2.33.2",
"web3": "1.10.4"
"viem": "^2.33.2"
},
"devDependencies": {
"@celo/dev-utils": "workspace:^",
Expand Down
44 changes: 23 additions & 21 deletions packages/cli/src/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import http from 'http'
import { tmpdir } from 'os'
import { MethodNotFoundRpcError } from 'viem'
import { privateKeyToAddress } from 'viem/accounts'
import Web3 from 'web3'
import { BaseCommand } from './base'
import Set from './commands/config/set'
import CustomHelp from './help'
Expand Down Expand Up @@ -105,7 +104,7 @@ jest.mock('../package.json', () => ({
version: '5.2.3',
}))

testWithAnvilL2('BaseCommand', (web3: Web3) => {
testWithAnvilL2('BaseCommand', (client) => {
const logSpy = jest.spyOn(console, 'log').mockImplementation()

beforeEach(() => {
Expand All @@ -118,7 +117,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
const storedDerivationPath = readConfig(tmpdir()).derivationPath
console.info('storedDerivationPath', storedDerivationPath)
expect(storedDerivationPath).not.toBe(undefined)
await testLocallyWithWeb3Node(BasicCommand, ['--useLedger'], web3)
await testLocallyWithWeb3Node(BasicCommand, ['--useLedger'], client)
expect(WalletLedgerExports.newLedgerWalletWithSetup).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
Expand All @@ -134,8 +133,8 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
it('uses custom derivationPath', async () => {
const storedDerivationPath = readConfig(tmpdir()).derivationPath
const customPath = "m/44'/9000'/0'"
await testLocallyWithWeb3Node(Set, ['--derivationPath', customPath], web3)
await testLocallyWithWeb3Node(BasicCommand, ['--useLedger'], web3)
await testLocallyWithWeb3Node(Set, ['--derivationPath', customPath], client)
await testLocallyWithWeb3Node(BasicCommand, ['--useLedger'], client)
expect(WalletLedgerExports.newLedgerWalletWithSetup).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
Expand All @@ -147,12 +146,12 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
baseDerivationPath: customPath,
})
)
await testLocallyWithWeb3Node(Set, ['--derivationPath', storedDerivationPath], web3)
await testLocallyWithWeb3Node(Set, ['--derivationPath', storedDerivationPath], client)
})
})

it('--ledgerAddresses passes derivationPathIndexes to LedgerWallet', async () => {
await testLocallyWithWeb3Node(BasicCommand, ['--useLedger', '--ledgerAddresses', '5'], web3)
await testLocallyWithWeb3Node(BasicCommand, ['--useLedger', '--ledgerAddresses', '5'], client)

expect(WalletLedgerExports.newLedgerWalletWithSetup).toHaveBeenCalledWith(
expect.anything(),
Expand Down Expand Up @@ -200,7 +199,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
await testLocallyWithWeb3Node(
BasicCommand,
['--useLedger', '--ledgerLiveMode', '--ledgerAddresses', '5'],
web3
client
)

expect(WalletLedgerExports.newLedgerWalletWithSetup).toHaveBeenCalledWith(
Expand Down Expand Up @@ -249,7 +248,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
await testLocallyWithWeb3Node(
BasicCommand,
['--useLedger', '--ledgerLiveMode', '--ledgerCustomAddresses', '[1,8,9]'],
web3
client
)

expect(WalletLedgerExports.newLedgerWalletWithSetup).toHaveBeenCalledWith(
Expand Down Expand Up @@ -296,7 +295,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
await testLocallyWithWeb3Node(
BasicCommand,
['--useLedger', '--ledgerCustomAddresses', '[1,8,9]'],
web3
client
)

expect(WalletLedgerExports.newLedgerWalletWithSetup).toHaveBeenCalledWith(
Expand Down Expand Up @@ -350,7 +349,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
'--from',
'0x1234567890123456789012345678901234567890',
],
web3
client
)

expect(ViemAccountLedgerExports.ledgerToWalletClient).toHaveBeenCalledWith(
Expand Down Expand Up @@ -381,7 +380,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation()

await expect(
testLocallyWithWeb3Node(TestErrorCommand, [], web3)
testLocallyWithWeb3Node(TestErrorCommand, [], client)
).rejects.toThrowErrorMatchingInlineSnapshot(
`"Unable to create an RPC Wallet Client, the node is not unlocked. Did you forget to use \`--privateKey\` or \`--useLedger\`?"`
)
Expand All @@ -399,7 +398,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation()

await expect(
testLocallyWithWeb3Node(TestErrorCommand, [], web3)
testLocallyWithWeb3Node(TestErrorCommand, [], client)
).rejects.toThrowErrorMatchingInlineSnapshot(`"test error"`)

expect(errorSpy.mock.calls).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -432,7 +431,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation()

await expect(
testLocallyWithWeb3Node(TestErrorCommand, ['--output', 'csv'], web3)
testLocallyWithWeb3Node(TestErrorCommand, ['--output', 'csv'], client)
).rejects.toThrowErrorMatchingInlineSnapshot(`"test error"`)

expect(errorSpy.mock.calls).toMatchInlineSnapshot(`[]`)
Expand All @@ -453,7 +452,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
throw new Error('Mock connection stop error')
})

await testLocallyWithWeb3Node(TestConnectionStopErrorCommand, [], web3)
await testLocallyWithWeb3Node(TestConnectionStopErrorCommand, [], client)

expect(logSpy.mock.calls).toMatchInlineSnapshot(`
[
Expand Down Expand Up @@ -492,7 +491,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
testLocallyWithWeb3Node(
TestPrivateKeyCommand,
['--privateKey', privateKey, '--from', wrongFromAddress],
web3
client
)
).rejects.toThrowErrorMatchingInlineSnapshot(
`"The --from address ${wrongFromAddress} does not match the address derived from the provided private key 0x1Be31A94361a391bBaFB2a4CCd704F57dc04d4bb."`
Expand All @@ -518,7 +517,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
testLocallyWithWeb3Node(
TestPrivateKeyCommand,
['--privateKey', privateKey, '--from', correctFromAddress],
web3
client
)
).resolves.not.toThrow()
})
Expand All @@ -538,7 +537,7 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
}

await expect(
testLocallyWithWeb3Node(TestPrivateKeyCommand, ['--privateKey', privateKey], web3)
testLocallyWithWeb3Node(TestPrivateKeyCommand, ['--privateKey', privateKey], client)
).resolves.not.toThrow()
})
})
Expand Down Expand Up @@ -687,7 +686,6 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
})

delete process.env.TELEMETRY_ENABLED
process.env.TELEMETRY_URL = 'http://localhost:3000/'

const fetchSpy = jest.spyOn(global, 'fetch')

Expand All @@ -697,13 +695,17 @@ testWithAnvilL2('BaseCommand', (web3: Web3) => {
}, 5000) // Higher timeout than the telemetry logic uses
})

server.listen(3000, async () => {
server.listen(0, async () => {
const address = server.address() as { port: number }
const telemetryUrl = `http://localhost:${address.port}/`
process.env.TELEMETRY_URL = telemetryUrl

// Make sure the command actually returns
await expect(TestTelemetryCommand.run([])).resolves.toBe(EXPECTED_COMMAND_RESULT)

expect(fetchSpy.mock.calls.length).toEqual(1)

expect(fetchSpy.mock.calls[0][0]).toMatchInlineSnapshot(`"http://localhost:3000/"`)
expect(fetchSpy.mock.calls[0][0]).toEqual(telemetryUrl)
expect(fetchSpy.mock.calls[0][1]?.body).toMatchInlineSnapshot(`
"
celocli_invocation{success="true", version="5.2.3", command="test:telemetry-timeout"} 1
Expand Down
15 changes: 6 additions & 9 deletions packages/cli/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@celo/base'
import { ReadOnlyWallet } from '@celo/connect'
import { ContractKit, newKitFromWeb3 } from '@celo/contractkit'
import { getWeb3ForKit } from '@celo/contractkit/lib/setupForKits'
import { ledgerToWalletClient } from '@celo/viem-account-ledger'
import { AzureHSMWallet } from '@celo/wallet-hsm-azure'
import { AddressValidation, newLedgerWalletWithSetup } from '@celo/wallet-ledger'
Expand All @@ -16,7 +17,6 @@ import { Command, Flags, ux } from '@oclif/core'
import { CLIError } from '@oclif/core/lib/errors'
import { ArgOutput, FlagOutput, Input, ParserOutput } from '@oclif/core/lib/interfaces/parser'
import chalk from 'chalk'
import net from 'net'
import {
createPublicClient,
createWalletClient,
Expand All @@ -30,7 +30,6 @@ import {
import { privateKeyToAccount } from 'viem/accounts'
import { celo, celoSepolia } from 'viem/chains'
import { ipc } from 'viem/node'
import Web3 from 'web3'
import createRpcWalletClient from './packages-to-be/rpc-client'
import { failWith } from './utils/cli'
import { CustomFlags } from './utils/command'
Expand Down Expand Up @@ -143,7 +142,7 @@ export abstract class BaseCommand extends Command {
// useful for the LedgerWalletClient which sometimes needs user input on reads
public isOnlyReadingWallet = false

private _web3: Web3 | null = null
private _web3: any = null
private _kit: ContractKit | null = null

private publicClient: PublicCeloClient | null = null
Expand All @@ -153,7 +152,8 @@ export abstract class BaseCommand extends Command {

async getWeb3() {
if (!this._web3) {
this._web3 = await this.newWeb3()
const kit = await this.getKit()
this._web3 = kit.web3
}
return this._web3
}
Expand All @@ -174,15 +174,12 @@ export abstract class BaseCommand extends Command {

async newWeb3() {
const nodeUrl = await this.getNodeUrl()

return nodeUrl && nodeUrl.endsWith('.ipc')
? new Web3(new Web3.providers.IpcProvider(nodeUrl, net))
: new Web3(nodeUrl)
return getWeb3ForKit(nodeUrl, undefined)
}

async getKit() {
if (!this._kit) {
this._kit = newKitFromWeb3(await this.getWeb3())
this._kit = newKitFromWeb3(await this.newWeb3())
}

const res = await this.parse()
Expand Down
Loading
Loading