Fix address coder to prepare non-hexdatastring addresses as hexdatastring (#1906).
This commit is contained in:
parent
accb85268c
commit
017b1feba2
@ -17,7 +17,7 @@ export class AddressCoder extends Coder {
|
|||||||
|
|
||||||
encode(writer: Writer, value: string): number {
|
encode(writer: Writer, value: string): number {
|
||||||
try {
|
try {
|
||||||
getAddress(value);
|
value = getAddress(value)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._throwError(error.message, value);
|
this._throwError(error.message, value);
|
||||||
}
|
}
|
||||||
|
@ -659,3 +659,14 @@ describe('Test EIP-838 Error Codes', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Additional test cases", function() {
|
||||||
|
// See: #1906
|
||||||
|
it("allows addresses without the 0x", function() {
|
||||||
|
const iface = new ethers.utils.Interface([
|
||||||
|
"function test(address foo) view returns (bool)"
|
||||||
|
]);
|
||||||
|
const tx = iface.encodeFunctionData("test", [ "c1912fee45d61c87cc5ea59dae31190fffff232d" ]);
|
||||||
|
console.log(tx);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user