Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
patch package based on jestjs/jest#9983 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafinskipg committed Oct 29, 2021
1 parent 9a3db41 commit 488f227
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"test:integration": "yarn testchain --ci yarn lerna --stream --concurrency 1 --no-bail run test:integration",
"test:build": "yarn testchain --ci yarn lerna run --stream --concurrency 1 --no-bail test:build",
"test:logs": "tail -f ./node_modules/@makerdao/testchain/var/ganache.out | grep -v 'eth_blockNumber'",
"update-addresses": "./scripts/install-testchain-outputs.sh"
"update-addresses": "./scripts/install-testchain-outputs.sh",
"postinstall": "patch-package"
},
"husky": {
"hooks": {
Expand Down
4 changes: 2 additions & 2 deletions packages/dai-plugin-scd/src/QueryApiScd.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ethUtil from 'ethereumjs-util';
import { toChecksumAddress } from 'ethereumjs-util';
import { getQueryResponse } from './utils/getQueryResponse';
import uniq from 'lodash/uniq';
const MAINNET_SERVER_URL = 'https://sai-mainnet.makerfoundation.com/v1';
Expand All @@ -19,7 +19,7 @@ export default class QueryApi {
}

async getCdpIdsForOwner(rawAddress) {
const address = ethUtil.toChecksumAddress(rawAddress);
const address = toChecksumAddress(rawAddress);
const query = `query ($lad: String) {
cups1: allCups(condition: { lad: $lad }) {
nodes {
Expand Down
6 changes: 3 additions & 3 deletions packages/dai/src/eth/accounts/factories.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ethUtil from 'ethereumjs-util';
import { privateToAddress } from 'ethereumjs-util';
import Wallet from 'web3-provider-engine/dist/es5/subproviders/wallet';
import { getBrowserProvider } from './setup';
import assert from 'assert';
Expand All @@ -8,12 +8,12 @@ export function privateKeyAccountFactory({ key }) {
throw new Error('Invalid private key format');
}

const [keyWithPrefix, keySansPrefix] = key.startsWith('0x')
const [, keySansPrefix] = key.startsWith('0x')
? [key, key.replace(/^0x/, '')]
: ['0x' + key, key];

const address =
'0x' + ethUtil.privateToAddress(keyWithPrefix).toString('hex');
'0x' + privateToAddress(Buffer.from(keySansPrefix, 'hex')).toString('hex');
const keyBuffer = Buffer.from(keySansPrefix, 'hex');

const subprovider = new Wallet(
Expand Down
12 changes: 12 additions & 0 deletions patches/jest-environment-jsdom+27.2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/node_modules/jest-environment-jsdom/build/index.js b/node_modules/jest-environment-jsdom/build/index.js
index 6695225..ae7e9e6 100644
--- a/node_modules/jest-environment-jsdom/build/index.js
+++ b/node_modules/jest-environment-jsdom/build/index.js
@@ -97,6 +97,7 @@ class JSDOMEnvironment {
(0, _jestUtil().installCommonGlobals)(global, config.globals); // TODO: remove this ASAP, but it currently causes tests to run really slow

global.Buffer = Buffer; // Report uncaught errors.
+ global.Uint8Array = Uint8Array;

this.errorEventListener = event => {
if (userErrorListenerCount === 0 && event.error) {

0 comments on commit 488f227

Please sign in to comment.