Skip to content

Commit

Permalink
Make bn to hex use ethers toHexString (#81)
Browse files Browse the repository at this point in the history
* Make bn to hex use ethers toHexString

* Update package.json
  • Loading branch information
ilanolkies authored Sep 8, 2022
1 parent 33e58b1 commit 593d5d4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion dist/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ var _rskUtils = require("@rsksmart/rsk-utils");
Object.keys(_rskUtils).forEach(function (key) {if (key === "default" || key === "__esModule") return;if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;if (key in exports && exports[key] === _rskUtils[key]) return;Object.defineProperty(exports, key, { enumerable: true, get: function () {return _rskUtils[key];} });});var _crypto = _interopRequireDefault(require("crypto"));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}

const bigNumberDoc = bigNumber => {
return '0x' + bigNumber.toString(16);
return typeof bigNumber.toHexString !== 'undefined' ?
bigNumber.toHexString() :
'0x' + bigNumber.toString(16);
};exports.bigNumberDoc = bigNumberDoc;

const isBigNumber = value => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rsk-explorer-api",
"version": "1.2.2",
"version": "1.2.3",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import crypto from 'crypto'
export * from '@rsksmart/rsk-utils'

export const bigNumberDoc = bigNumber => {
return '0x' + bigNumber.toString(16)
return typeof bigNumber.toHexString !== 'undefined'
? bigNumber.toHexString()
: '0x' + bigNumber.toString(16)
}

export const isBigNumber = value => {
Expand Down

0 comments on commit 593d5d4

Please sign in to comment.