Add negative hexstring support to getNumber.

This commit is contained in:
Richard Moore 2022-09-30 20:02:42 -04:00
parent f4d2721baf
commit 0fd2a450af

View File

@ -76,6 +76,9 @@ export function getBigInt(value: BigNumberish, name?: string): bigint {
return BigInt(value);
case "string":
try {
if (value[0] === "-" && value[1] !== "-") {
return -BigInt(value.substring(1));
}
return BigInt(value);
} catch(e: any) {
throwArgumentError(`invalid BigNumberish string: ${ e.message }`, name || "value", value);