diff --git a/package-lock.json b/package-lock.json index 8b84957..ec1dacd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -262,9 +262,9 @@ "integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==" }, "blakejs": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz", - "integrity": "sha1-ad+S75U6qIylGjLfarHFShVfx6U=" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.2.tgz", + "integrity": "sha512-c482YFKvFRGlG2JshSIpKkek3WGn0qvhXAFcdZ0En9OgFFt2Ybu5urcnEHN3iQAz4wlLN6MBBVDDRkp8RfrjJg==" }, "bn.js": { "version": "4.11.8", @@ -537,9 +537,9 @@ "dev": true }, "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "find-cache-dir": { "version": "2.1.0", diff --git a/package.json b/package.json index 659800f..197f451 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,13 @@ "main": "dist/index.js", "module": "esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./esm/index.js", + "types": "./dist/index.d.ts" + } + }, "files": [ "dist", "esm" @@ -74,9 +81,9 @@ "dependencies": { "@vechain/ethers": "^4.0.27-5", "bignumber.js": "^7.2.1", - "blakejs": "^1.1.0", + "blakejs": "^1.1.2", "elliptic": "6.5.4", - "fast-json-stable-stringify": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", "js-sha3": "0.5.7", "rlp": "^2.0.0" }, diff --git a/src/blake2b.ts b/src/blake2b.ts index ca22417..cbd835b 100644 --- a/src/blake2b.ts +++ b/src/blake2b.ts @@ -1,11 +1,11 @@ -const blake = require('blakejs') +import blake from 'blakejs' /** * computes blake2b 256bit hash of given data * @param data one or more Buffer | string */ export function blake2b256(...data: Array) { - const ctx = blake.blake2bInit(32, null) + const ctx = blake.blake2bInit(32) data.forEach(d => { if (Buffer.isBuffer(d)) { blake.blake2bUpdate(ctx, d) diff --git a/src/certificate.ts b/src/certificate.ts index 80db3ee..0a98569 100644 --- a/src/certificate.ts +++ b/src/certificate.ts @@ -1,8 +1,7 @@ import { address } from './address' import { blake2b256 } from './blake2b' import { secp256k1 } from './secp256k1' - -const fastJsonStableStringify = require('fast-json-stable-stringify') +import fastJsonStableStringify from 'fast-json-stable-stringify' /** * Client side self-signed certificate diff --git a/tsconfig.json b/tsconfig.json index d22221d..5648901 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,7 @@ "inlineSourceMap": true, "moduleResolution": "node", "allowSyntheticDefaultImports": true, + "esModuleInterop": true, "skipLibCheck": true }, "include": [