Skip to content

Commit 0078e02

Browse files
committed
Fixed topic filters for numeric types with string values (ethers-io#3013).
1 parent a71f518 commit 0078e02

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/abi/src.ts/interface.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,14 @@ export class Interface {
462462
return keccak256(hexlify(value));
463463
}
464464

465+
if (param.type === "bool" && typeof(value) === "boolean") {
466+
value = (value ? "0x01": "0x00");
467+
}
468+
469+
if (param.type.match(/^u?int/)) {
470+
value = BigNumber.from(value).toHexString();
471+
}
472+
465473
// Check addresses are valid
466474
if (param.type === "address") { this._abiCoder.encode( [ "address" ], [ value ]); }
467475
return hexZeroPad(hexlify(value), 32);

0 commit comments

Comments
 (0)