Skip to content

Commit c5a53d6

Browse files
committed
Force TypedData numbers to be in decimal (#1193).
1 parent bcda16d commit c5a53d6

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

packages/hash/src.ts/typed-data.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { TypedDataDomain, TypedDataField } from "@ethersproject/abstract-signer";
22
import { getAddress } from "@ethersproject/address";
33
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
4-
import { arrayify, BytesLike, hexConcat, hexlify, hexValue, hexZeroPad, isHexString } from "@ethersproject/bytes";
4+
import { arrayify, BytesLike, hexConcat, hexlify, hexZeroPad, isHexString } from "@ethersproject/bytes";
55
import { keccak256 } from "@ethersproject/keccak256";
66
import { deepCopy, defineReadOnly, shallowCopy } from "@ethersproject/properties";
77

@@ -484,13 +484,7 @@ export class TypedDataEncoder {
484484

485485
// uint or int
486486
if (type.match(/^u?int/)) {
487-
let prefix = "";
488-
let v = BigNumber.from(value);
489-
if (v.isNegative()) {
490-
prefix = "-";
491-
v = v.mul(-1);
492-
}
493-
return prefix + hexValue(v.toHexString());
487+
return BigNumber.from(value).toString();
494488
}
495489

496490
switch (type) {

0 commit comments

Comments
 (0)