diff --git a/package-lock.json b/package-lock.json index b1477865..ab788228 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,8 +27,8 @@ "@typescript-eslint/parser": "^5.20.0", "body-parser": "^1.19.0", "dotenv": "^16.0.0", - "eslint": "^8.13.0", - "eslint-plugin-jest": "^26.1.4", + "eslint": "^8.14.0", + "eslint-plugin-jest": "^26.1.5", "ethers": "^5.6.4", "express": "^4.17.1", "husky": "^7.0.4", @@ -949,9 +949,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.1.tgz", - "integrity": "sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.2.tgz", + "integrity": "sha512-lTVWHs7O2hjBFZunXTZYnYqtB9GakA1lnxIf+gKq2nY5gxkkNi/lQvveW6t8gFdOHTg6nG50Xs95PrLqVpcaLg==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -1014,9 +1014,9 @@ } }, "node_modules/@ethereumjs/common": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.3.tgz", - "integrity": "sha512-mQwPucDL7FDYIg9XQ8DL31CnIYZwGhU5hyOO5E+BMmT71G0+RHvIT5rIkLBirJEKxV6+Rcf9aEIY0kXInxUWpQ==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.4.tgz", + "integrity": "sha512-RDJh/R/EAr+B7ZRg5LfJ0BIpf/1LydFgYdvZEuTraojCbVypO2sQ+QnpP5u2wJf9DASyooKqu8O4FJEWUV6NXw==", "dev": true, "dependencies": { "crc-32": "^1.2.0", @@ -1870,9 +1870,9 @@ ] }, "node_modules/@ethersproject/networks": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.1.tgz", - "integrity": "sha512-b2rrupf3kCTcc3jr9xOWBuHylSFtbpJf79Ga7QR98ienU2UqGimPGEsYMgbI29KHJfA5Us89XwGVmxrlxmSrMg==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.2.tgz", + "integrity": "sha512-9uEzaJY7j5wpYGTojGp8U89mSsgQLc40PCMJLMCnFXTs7nhBveZ0t7dbqWUNrepWTszDbFkYD6WlL8DKx5huHA==", "dev": true, "funding": [ { @@ -5330,12 +5330,6 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, "node_modules/emittery": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.8.1.tgz", @@ -5431,9 +5425,9 @@ } }, "node_modules/es5-ext": { - "version": "0.10.60", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.60.tgz", - "integrity": "sha512-jpKNXIt60htYG59/9FGf2PYT3pwMpnEbNKysU+k/4FGwyGtMotOvcZOuW+EmXXYASRqYSXQfGL5cVIthOTgbkg==", + "version": "0.10.61", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.61.tgz", + "integrity": "sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -5513,12 +5507,12 @@ } }, "node_modules/eslint": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.13.0.tgz", - "integrity": "sha512-D+Xei61eInqauAyTJ6C0q6x9mx7kTUC1KZ0m0LSEexR0V+e94K12LmWX076ZIsldwfQ2RONdaJe0re0TRGQbRQ==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.14.0.tgz", + "integrity": "sha512-3/CE4aJX7LNEiE3i6FeodHmI/38GZtWCsAtsymScmzYapx8q1nVVb+eLcLSzATmCPXw5pT4TqVs1E0OmxAd9tw==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.2.1", + "@eslint/eslintrc": "^1.2.2", "@humanwhocodes/config-array": "^0.9.2", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -5565,9 +5559,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "26.1.4", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-26.1.4.tgz", - "integrity": "sha512-wgqxujmqc2qpvZqMFWCh6Cniqc8lWpapvXt9j/19DmBDqeDaYhJrSRezYR1SKyemvjx+9e9kny/dgRahraHImA==", + "version": "26.1.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-26.1.5.tgz", + "integrity": "sha512-su89aDuljL9bTjEufTXmKUMSFe2kZUL9bi7+woq+C2ukHZordhtfPm4Vg+tdioHBaKf8v3/FXW9uV0ksqhYGFw==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^5.10.0" @@ -6088,25 +6082,6 @@ } ] }, - "node_modules/ethers/node_modules/@ethersproject/networks": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.2.tgz", - "integrity": "sha512-9uEzaJY7j5wpYGTojGp8U89mSsgQLc40PCMJLMCnFXTs7nhBveZ0t7dbqWUNrepWTszDbFkYD6WlL8DKx5huHA==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.6.0" - } - }, "node_modules/ethers/node_modules/js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", @@ -12118,9 +12093,9 @@ } }, "node_modules/web3-bzz/node_modules/@types/node": { - "version": "12.20.47", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.47.tgz", - "integrity": "sha512-BzcaRsnFuznzOItW1WpQrDHM7plAa7GIDMZ6b5pnMbkqEtM/6WCOhvZar39oeMQP79gwvFUWjjptE7/KGcNqFg==", + "version": "12.20.48", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.48.tgz", + "integrity": "sha512-4kxzqkrpwYtn6okJUcb2lfUu9ilnb3yhUOH6qX3nug8D2DupZ2drIkff2yJzYcNJVl3begnlcaBJ7tqiTTzjnQ==", "dev": true }, "node_modules/web3-core": { @@ -12212,9 +12187,9 @@ } }, "node_modules/web3-core/node_modules/@types/node": { - "version": "12.20.47", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.47.tgz", - "integrity": "sha512-BzcaRsnFuznzOItW1WpQrDHM7plAa7GIDMZ6b5pnMbkqEtM/6WCOhvZar39oeMQP79gwvFUWjjptE7/KGcNqFg==", + "version": "12.20.48", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.48.tgz", + "integrity": "sha512-4kxzqkrpwYtn6okJUcb2lfUu9ilnb3yhUOH6qX3nug8D2DupZ2drIkff2yJzYcNJVl3begnlcaBJ7tqiTTzjnQ==", "dev": true }, "node_modules/web3-eth": { @@ -12382,9 +12357,9 @@ } }, "node_modules/web3-eth-personal/node_modules/@types/node": { - "version": "12.20.47", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.47.tgz", - "integrity": "sha512-BzcaRsnFuznzOItW1WpQrDHM7plAa7GIDMZ6b5pnMbkqEtM/6WCOhvZar39oeMQP79gwvFUWjjptE7/KGcNqFg==", + "version": "12.20.48", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.48.tgz", + "integrity": "sha512-4kxzqkrpwYtn6okJUcb2lfUu9ilnb3yhUOH6qX3nug8D2DupZ2drIkff2yJzYcNJVl3begnlcaBJ7tqiTTzjnQ==", "dev": true }, "node_modules/web3-net": { @@ -13497,9 +13472,9 @@ } }, "@eslint/eslintrc": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.1.tgz", - "integrity": "sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.2.tgz", + "integrity": "sha512-lTVWHs7O2hjBFZunXTZYnYqtB9GakA1lnxIf+gKq2nY5gxkkNi/lQvveW6t8gFdOHTg6nG50Xs95PrLqVpcaLg==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -13546,9 +13521,9 @@ } }, "@ethereumjs/common": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.3.tgz", - "integrity": "sha512-mQwPucDL7FDYIg9XQ8DL31CnIYZwGhU5hyOO5E+BMmT71G0+RHvIT5rIkLBirJEKxV6+Rcf9aEIY0kXInxUWpQ==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.4.tgz", + "integrity": "sha512-RDJh/R/EAr+B7ZRg5LfJ0BIpf/1LydFgYdvZEuTraojCbVypO2sQ+QnpP5u2wJf9DASyooKqu8O4FJEWUV6NXw==", "dev": true, "requires": { "crc-32": "^1.2.0", @@ -14014,9 +13989,9 @@ "dev": true }, "@ethersproject/networks": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.1.tgz", - "integrity": "sha512-b2rrupf3kCTcc3jr9xOWBuHylSFtbpJf79Ga7QR98ienU2UqGimPGEsYMgbI29KHJfA5Us89XwGVmxrlxmSrMg==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.2.tgz", + "integrity": "sha512-9uEzaJY7j5wpYGTojGp8U89mSsgQLc40PCMJLMCnFXTs7nhBveZ0t7dbqWUNrepWTszDbFkYD6WlL8DKx5huHA==", "dev": true, "requires": { "@ethersproject/logger": "^5.6.0" @@ -16577,14 +16552,6 @@ "inherits": "^2.0.4", "minimalistic-assert": "^1.0.1", "minimalistic-crypto-utils": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } } }, "emittery": { @@ -16661,9 +16628,9 @@ } }, "es5-ext": { - "version": "0.10.60", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.60.tgz", - "integrity": "sha512-jpKNXIt60htYG59/9FGf2PYT3pwMpnEbNKysU+k/4FGwyGtMotOvcZOuW+EmXXYASRqYSXQfGL5cVIthOTgbkg==", + "version": "0.10.61", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.61.tgz", + "integrity": "sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA==", "dev": true, "requires": { "es6-iterator": "^2.0.3", @@ -16724,12 +16691,12 @@ } }, "eslint": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.13.0.tgz", - "integrity": "sha512-D+Xei61eInqauAyTJ6C0q6x9mx7kTUC1KZ0m0LSEexR0V+e94K12LmWX076ZIsldwfQ2RONdaJe0re0TRGQbRQ==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.14.0.tgz", + "integrity": "sha512-3/CE4aJX7LNEiE3i6FeodHmI/38GZtWCsAtsymScmzYapx8q1nVVb+eLcLSzATmCPXw5pT4TqVs1E0OmxAd9tw==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.2.1", + "@eslint/eslintrc": "^1.2.2", "@humanwhocodes/config-array": "^0.9.2", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -16872,9 +16839,9 @@ } }, "eslint-plugin-jest": { - "version": "26.1.4", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-26.1.4.tgz", - "integrity": "sha512-wgqxujmqc2qpvZqMFWCh6Cniqc8lWpapvXt9j/19DmBDqeDaYhJrSRezYR1SKyemvjx+9e9kny/dgRahraHImA==", + "version": "26.1.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-26.1.5.tgz", + "integrity": "sha512-su89aDuljL9bTjEufTXmKUMSFe2kZUL9bi7+woq+C2ukHZordhtfPm4Vg+tdioHBaKf8v3/FXW9uV0ksqhYGFw==", "dev": true, "requires": { "@typescript-eslint/utils": "^5.10.0" @@ -17152,15 +17119,6 @@ "integrity": "sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg==", "dev": true }, - "@ethersproject/networks": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.2.tgz", - "integrity": "sha512-9uEzaJY7j5wpYGTojGp8U89mSsgQLc40PCMJLMCnFXTs7nhBveZ0t7dbqWUNrepWTszDbFkYD6WlL8DKx5huHA==", - "dev": true, - "requires": { - "@ethersproject/logger": "^5.6.0" - } - }, "js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", @@ -21809,9 +21767,9 @@ }, "dependencies": { "@types/node": { - "version": "12.20.47", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.47.tgz", - "integrity": "sha512-BzcaRsnFuznzOItW1WpQrDHM7plAa7GIDMZ6b5pnMbkqEtM/6WCOhvZar39oeMQP79gwvFUWjjptE7/KGcNqFg==", + "version": "12.20.48", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.48.tgz", + "integrity": "sha512-4kxzqkrpwYtn6okJUcb2lfUu9ilnb3yhUOH6qX3nug8D2DupZ2drIkff2yJzYcNJVl3begnlcaBJ7tqiTTzjnQ==", "dev": true } } @@ -21832,9 +21790,9 @@ }, "dependencies": { "@types/node": { - "version": "12.20.47", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.47.tgz", - "integrity": "sha512-BzcaRsnFuznzOItW1WpQrDHM7plAa7GIDMZ6b5pnMbkqEtM/6WCOhvZar39oeMQP79gwvFUWjjptE7/KGcNqFg==", + "version": "12.20.48", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.48.tgz", + "integrity": "sha512-4kxzqkrpwYtn6okJUcb2lfUu9ilnb3yhUOH6qX3nug8D2DupZ2drIkff2yJzYcNJVl3begnlcaBJ7tqiTTzjnQ==", "dev": true } } @@ -22038,9 +21996,9 @@ }, "dependencies": { "@types/node": { - "version": "12.20.47", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.47.tgz", - "integrity": "sha512-BzcaRsnFuznzOItW1WpQrDHM7plAa7GIDMZ6b5pnMbkqEtM/6WCOhvZar39oeMQP79gwvFUWjjptE7/KGcNqFg==", + "version": "12.20.48", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.48.tgz", + "integrity": "sha512-4kxzqkrpwYtn6okJUcb2lfUu9ilnb3yhUOH6qX3nug8D2DupZ2drIkff2yJzYcNJVl3begnlcaBJ7tqiTTzjnQ==", "dev": true } } diff --git a/package.json b/package.json index eb360bb5..6b98e24b 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,8 @@ "@typescript-eslint/parser": "^5.20.0", "body-parser": "^1.19.0", "dotenv": "^16.0.0", - "eslint": "^8.13.0", - "eslint-plugin-jest": "^26.1.4", + "eslint": "^8.14.0", + "eslint-plugin-jest": "^26.1.5", "ethers": "^5.6.4", "express": "^4.17.1", "husky": "^7.0.4", diff --git a/src/classes/test/Contract/crv.test.ts b/src/classes/test/Contract/crv.test.ts index 173fc538..c45e571a 100644 --- a/src/classes/test/Contract/crv.test.ts +++ b/src/classes/test/Contract/crv.test.ts @@ -37,9 +37,7 @@ describe('cRV contract', () => { gasLimit: 40955, }) as TinyBig, ]); - expect(ethersBalanceOf.toString()).toStrictEqual( - essentialEthBalanceOf.toString(), - ); + expect(ethersBalanceOf.toString()).toBe(essentialEthBalanceOf.toString()); }); it('should fetch "uint256" total_claimed', async () => { const [ethersTotalClaimed, essentialEthTotalClaimed] = await Promise.all([ @@ -47,10 +45,10 @@ describe('cRV contract', () => { ethersContract.total_claimed(address, {}) as TinyBig, essentialEthContract.total_claimed(address, {}) as TinyBig, ]); - expect(ethersTotalClaimed.toString()).toStrictEqual( + expect(ethersTotalClaimed.toString()).toBe( essentialEthTotalClaimed.toString(), ); - expect(ethersTotalClaimed.toNumber()).toStrictEqual( + expect(ethersTotalClaimed.toNumber()).toBe( essentialEthTotalClaimed.toNumber(), ); }); diff --git a/src/classes/test/Contract/fei.test.ts b/src/classes/test/Contract/fei.test.ts index 7bee7388..3ffe5ae0 100644 --- a/src/classes/test/Contract/fei.test.ts +++ b/src/classes/test/Contract/fei.test.ts @@ -47,13 +47,13 @@ describe('fEI contract', () => { '0xf5dBA31743ea341057280bb3AdD5c2Fb505BDC4C', ), ]); - expect(ethersResponse[0].toString()).toStrictEqual( + expect(ethersResponse[0].toString()).toBe( essentialEthResponse[0].toString(), ); - expect(ethersResponse[1].toString()).toStrictEqual( + expect(ethersResponse[1].toString()).toBe( essentialEthResponse[1].toString(), ); - expect(ethersResponse[2].toString()).toStrictEqual( + expect(ethersResponse[2].toString()).toBe( essentialEthResponse[2].toString(), ); diff --git a/src/classes/utils/fetchers.ts b/src/classes/utils/fetchers.ts index 7e20b42e..bce4d427 100644 --- a/src/classes/utils/fetchers.ts +++ b/src/classes/utils/fetchers.ts @@ -28,6 +28,7 @@ export function post(url: string, body: Record) { type RPCMethodName = | 'eth_getBlockByNumber' + | 'eth_getBlockByHash' | 'eth_call' | 'eth_chainId' | 'eth_gasPrice' diff --git a/src/providers/JsonRpcProvider.ts b/src/providers/JsonRpcProvider.ts index 4d17a5c9..8261ad51 100644 --- a/src/providers/JsonRpcProvider.ts +++ b/src/providers/JsonRpcProvider.ts @@ -28,8 +28,25 @@ export class JsonRpcProvider { } /** - * Returns the block requested - * Same as `web3.eth.getBlock` + * Gets information about a certain block. + * Same as `web3.eth.getBlock` and `ethers.providers.getBlock` + * + * @param timeFrame The number, hash, or text-based description ('latest', 'earliest', or 'pending') of the block to collect information on. + * + * @param returnTransactionObjects Whether to also return data about the transactions on the block. + * + * @returns A BlockResponse object with information about the specified block + * + * @example + * ```js + * await provider.getBlock(14645431); + * ``` + * + * @example + * ```js + * await provider.getBlock('0x3e5cea9c2be7e0ab4b0aa04c24dafddc37571db2d2d345caf7f88b3366ece0cf'); + * ``` + * * @example * ```js * await provider.getBlock('latest'); @@ -75,15 +92,20 @@ export class JsonRpcProvider { returnTransactionObjects = false, ): Promise { let rpcTimeFrame: string; + let type: 'Number' | 'Hash' = 'Number'; if (typeof timeFrame === 'number') { // exact block numbers require hex string format rpcTimeFrame = `0x${timeFrame.toString(16)}`; + } else if (timeFrame.startsWith('0x')) { + rpcTimeFrame = timeFrame; + // use endpoint that accepts string + type = 'Hash'; } else { - // "latest", "earliest", and "pending" require no manipulation + // "latest", "earliest", "pending", or hex string require no manipulation rpcTimeFrame = timeFrame; } const rpcBlock = (await this.post( - buildRPCPostBody('eth_getBlockByNumber', [ + buildRPCPostBody(`eth_getBlockBy${type}`, [ rpcTimeFrame, returnTransactionObjects, ]), diff --git a/src/providers/test/get-block.test.ts b/src/providers/test/get-block.test.ts index 98323457..f51e40f2 100644 --- a/src/providers/test/get-block.test.ts +++ b/src/providers/test/get-block.test.ts @@ -65,7 +65,15 @@ describe('provider.getBlock happy path', () => { web3Provider.eth.getBlock(blockNumber, true), ]); testBlockEquality(eeRandomBlock, web3RandomBlock); - // expect(eeRandomBlock).toStrictEqual(web3RandomBlock); + }); + const blockHash = + '0x4cbaa942e48a91108f38e2a250f6dbaff7fffe3027f5ebf76701929eed2b2970'; // Hash corresponds to block on RSK Mainnet + it(`should get block by hash. (hash = ${blockHash})`, async () => { + const [eeBlockByHash, web3BlockByHash] = await Promise.all([ + essentialEthProvider.getBlock(blockHash), + web3Provider.eth.getBlock(blockHash), + ]); + expect(eeBlockByHash).toStrictEqual(web3BlockByHash); }); }); diff --git a/src/providers/test/get-transaction.test.ts b/src/providers/test/get-transaction.test.ts index e89536b4..f7615624 100644 --- a/src/providers/test/get-transaction.test.ts +++ b/src/providers/test/get-transaction.test.ts @@ -40,7 +40,7 @@ describe('provider.getTransaction', () => { if (key === 'gas') { ethersKey = 'gasLimit'; } - expect((transaction1 as any)[ethersKey].toString()).toStrictEqual( + expect((transaction1 as any)[ethersKey].toString()).toBe( (transaction2 as any)[key].toString(), ); }); diff --git a/src/providers/utils/chains-info.ts b/src/providers/utils/chains-info.ts index b1c4938b..f0c97d0f 100644 --- a/src/providers/utils/chains-info.ts +++ b/src/providers/utils/chains-info.ts @@ -191,6 +191,9 @@ export default { "69": [ "okov" ], + "70": [ + "hsc" + ], "71": [ "cfxtest" ], @@ -1037,6 +1040,9 @@ export default { "444900": [ "wlkt" ], + "512512": [ + "cmp" + ], "666666": [ "vpioneer" ],