Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: drop normalization in address resolver
  • Loading branch information
mathieuartu committed Nov 21, 2025
commit 594b75efbb0a4436dfa7e7517c636c8bdbd38aaf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

expect(typeof id).toBe('string');

const resolvedAddress = resolver.getAddress(id);
expect(resolvedAddress).toBe(address.toLowerCase());
const resolvedAddress = resolver.getAddress(id);

Check failure on line 12 in packages/keyring-api/src/api/v2/wrapper/keyring-address-resolver.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (22.x)

Delete `··`
expect(resolvedAddress).toBe(address);

Check failure on line 13 in packages/keyring-api/src/api/v2/wrapper/keyring-address-resolver.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (22.x)

Delete `··`

const resolvedId = resolver.getAccountId(address);
expect(resolvedId).toBe(id);
Expand All @@ -21,7 +21,7 @@

const address = '0xaBc';
const firstId = resolver.register(address);
const secondId = resolver.register(address.toUpperCase());
const secondId = resolver.register(address);

expect(firstId).toBe(secondId);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,18 @@ export class InMemoryKeyringAddressResolver implements KeyringAddressResolver {
}

getAccountId(address: string): AccountId | undefined {
return this.#idByAddress.get(address.toLowerCase());
return this.#idByAddress.get(address);
}

register(address: string): AccountId {
const normalized = address.toLowerCase();
const existing = this.#idByAddress.get(normalized);
const existing = this.#idByAddress.get(address);
if (existing) {
return existing;
}
const id = uuidv4();

this.#idByAddress.set(normalized, id);
this.#addressById.set(id, normalized);
this.#idByAddress.set(address, id);
this.#addressById.set(id, address);

return id;
}
Expand Down
Loading