Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion packages/web3-eth/src/web3_eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
HexString8Bytes,
Numbers,
BlockNumberOrTag,
toChecksumAddress,
} from 'web3-utils';
import * as rpcMethods from './rpc_methods';
import * as rpcMethodsWrappers from './rpc_method_wrappers';
Expand Down Expand Up @@ -122,7 +123,8 @@ export class Web3Eth extends Web3Context<Web3EthExecutionAPI, RegisteredSubscrip
}

public async getAccounts() {
return rpcMethods.getAccounts(this.requestManager);
const hexAddresses = (await rpcMethods.getAccounts(this.requestManager)) ?? [];
return hexAddresses.map(address => toChecksumAddress(address));
}

public async getBlockNumber<ReturnFormat extends DataFormat = typeof DEFAULT_RETURN_FORMAT>(
Expand Down
9 changes: 5 additions & 4 deletions packages/web3-eth/test/integration/rpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ describe('rpc', () => {

it('getAccounts', async () => {
const account = await createNewAccount({ unlock: true });
const accList = await web3Eth.getAccounts();
expect(accList).toContain(accounts[0].toLowerCase());
expect(accList).toContain(accounts[1].toLowerCase());
expect(accList).toContain(account.address.toLowerCase());
const accList = await web3Eth.getAccounts()
const accListLowerCase = accList.map((add: string)=>add.toLowerCase());
expect(accListLowerCase).toContain(accounts[0].toLowerCase());
expect(accListLowerCase).toContain(accounts[1].toLowerCase());
expect(accListLowerCase).toContain(account.address.toLowerCase());
});

it.each(Object.values(FMT_NUMBER))('getBlockNumber', async format => {
Expand Down