2
0
mirror of synced 2025-02-24 20:18:07 +00:00

Added support for JSON serialized BigNumbers in the constructor (#288).

This commit is contained in:
Richard Moore 2018-10-03 19:54:38 -04:00
parent d936b4cd09
commit 281bd0613d
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295

View File

@ -89,6 +89,9 @@ export class BigNumber implements Hexable {
} else if ((<any>value).toHexString) {
defineReadOnly(this, '_hex', toHex(toBN((<any>value).toHexString())));
} else if ((<any>value)._hex && isHexString((<any>value)._hex)) {
defineReadOnly(this, '_hex', (<any>value)._hex);
} else if (isArrayish(value)) {
defineReadOnly(this, '_hex', toHex(new BN.BN(hexlify(value).substring(2), 16)));