From 81f4a2cf884e1194b3dc16e38ccd6be49687baf7 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 19 Apr 2023 17:41:52 +0100 Subject: [PATCH 01/14] Format package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 65bee59c25f..e7ffbb35c02 100644 --- a/package.json +++ b/package.json @@ -146,8 +146,8 @@ "@metamask/contract-metadata": "^2.1.0", "@metamask/controller-utils": "^2.0.0", "@metamask/design-tokens": "^1.11.1", - "@metamask/etherscan-link": "^2.0.0", "@metamask/eth-sig-util": "^4.0.1", + "@metamask/etherscan-link": "^2.0.0", "@metamask/gas-fee-controller": "^3.0.0", "@metamask/keyring-controller": "^1.0.1", "@metamask/message-manager": "^1.0.2", From bdbe7abd7a8f6d2b497bf733f538a6c39fda69a4 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 19 Apr 2023 17:42:09 +0100 Subject: [PATCH 02/14] Add big-integer --- package.json | 1 + yarn.lock | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index e7ffbb35c02..c750561e4c2 100644 --- a/package.json +++ b/package.json @@ -188,6 +188,7 @@ "babel-plugin-transform-inline-environment-variables": "0.4.3", "babel-plugin-transform-remove-console": "6.9.4", "base-64": "1.0.0", + "big-integer": "^1.6.51", "bignumber.js": "^9.0.1", "buffer": "5.2.1", "compare-versions": "^3.6.0", diff --git a/yarn.lock b/yarn.lock index 35a4d22c7c2..0113002f82c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8429,7 +8429,7 @@ bech32@1.1.4: resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== -big-integer@1.6.x, big-integer@^1.6.17: +big-integer@1.6.x, big-integer@^1.6.17, big-integer@^1.6.51: version "1.6.51" resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686" integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg== From 706163afbbbc540f0a3d313aff2df434237a01cf Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 19 Apr 2023 17:42:25 +0100 Subject: [PATCH 03/14] Shim BigInt with big-integer --- shim.js | 1 + 1 file changed, 1 insertion(+) diff --git a/shim.js b/shim.js index 277f5936b17..ec2a6b250ea 100644 --- a/shim.js +++ b/shim.js @@ -29,6 +29,7 @@ if (typeof process === 'undefined') { process.browser = false; if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer; +if (typeof BigInt === 'undefined') global.BigInt = require('big-integer'); // global.location = global.location || { port: 80 } const isDev = typeof __DEV__ === 'boolean' && __DEV__; From 17d37881cf6d93d55d41c27d828042a1db3890ee Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 19 Apr 2023 18:14:47 +0100 Subject: [PATCH 04/14] Test 1n [SyntaxError: No identifiers allowed directly after numeric literal] Emu stacktrace: No identifiers allowed after numeric literal (x2), no stack (x2) --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index 041fc72a99b..61448210b56 100644 --- a/index.js +++ b/index.js @@ -78,3 +78,5 @@ if (IGNORE_BOXLOGS_DEVELOPMENT === 'true') { * Application entry point responsible for registering root component */ AppRegistry.registerComponent(name, () => Sentry.wrap(Root)); + +console.log(1n); // [SyntaxError: No identifiers allowed directly after numeric literal] From d867bc88bfc709e4c5fbc9a99d67415677bffae5 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 19 Apr 2023 18:14:57 +0100 Subject: [PATCH 05/14] Revert "Test 1n" This reverts commit 17d37881cf6d93d55d41c27d828042a1db3890ee. --- index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.js b/index.js index 61448210b56..041fc72a99b 100644 --- a/index.js +++ b/index.js @@ -78,5 +78,3 @@ if (IGNORE_BOXLOGS_DEVELOPMENT === 'true') { * Application entry point responsible for registering root component */ AppRegistry.registerComponent(name, () => Sentry.wrap(Root)); - -console.log(1n); // [SyntaxError: No identifiers allowed directly after numeric literal] From 521417a4f64cd2878188976c237e33ebd856807a Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 19 Apr 2023 18:17:37 +0100 Subject: [PATCH 06/14] Test BigInt(2) + BigInt(3) Received: 5 Expected: 5n --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index 041fc72a99b..7b7115ba7c2 100644 --- a/index.js +++ b/index.js @@ -78,3 +78,5 @@ if (IGNORE_BOXLOGS_DEVELOPMENT === 'true') { * Application entry point responsible for registering root component */ AppRegistry.registerComponent(name, () => Sentry.wrap(Root)); + +console.log(BigInt(2) + BigInt(3)); // 5, expected 5n From 0b6ce50110aced3dc774676d8f2fde51ed537570 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 19 Apr 2023 18:17:46 +0100 Subject: [PATCH 07/14] Revert "Test BigInt(2) + BigInt(3)" This reverts commit 521417a4f64cd2878188976c237e33ebd856807a. --- index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.js b/index.js index 7b7115ba7c2..041fc72a99b 100644 --- a/index.js +++ b/index.js @@ -78,5 +78,3 @@ if (IGNORE_BOXLOGS_DEVELOPMENT === 'true') { * Application entry point responsible for registering root component */ AppRegistry.registerComponent(name, () => Sentry.wrap(Root)); - -console.log(BigInt(2) + BigInt(3)); // 5, expected 5n From 4f737434514c068cb186b870ed796b277f1afe94 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 19 Apr 2023 18:20:27 +0100 Subject: [PATCH 08/14] Add @metamask/utils --- package.json | 1 + yarn.lock | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c750561e4c2..11a2b5acf51 100644 --- a/package.json +++ b/package.json @@ -158,6 +158,7 @@ "@metamask/sdk-communication-layer": "0.2.0", "@metamask/swaps-controller": "^6.8.0", "@metamask/transaction-controller": "^3.0.0", + "@metamask/utils": "^5.0.1", "@ngraveio/bc-ur": "^1.1.6", "@react-native-async-storage/async-storage": "1.17.10", "@react-native-clipboard/clipboard": "^1.8.4", diff --git a/yarn.lock b/yarn.lock index 0113002f82c..141b2a9c466 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1524,6 +1524,27 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@chainsafe/as-sha256@^0.3.1": + version "0.3.1" + resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz#3639df0e1435cab03f4d9870cc3ac079e57a6fc9" + integrity sha512-hldFFYuf49ed7DAakWVXSJODuq3pzJEguD8tQ7h+sGkM18vja+OFoJI9krnGmgzyuZC2ETX0NOIcCTy31v2Mtg== + +"@chainsafe/persistent-merkle-tree@^0.4.2": + version "0.4.2" + resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.4.2.tgz#4c9ee80cc57cd3be7208d98c40014ad38f36f7ff" + integrity sha512-lLO3ihKPngXLTus/L7WHKaw9PnNJWizlOF1H9NNzHP6Xvh82vzg9F2bzkXhYIFshMZ2gTCEz8tq6STe7r5NDfQ== + dependencies: + "@chainsafe/as-sha256" "^0.3.1" + +"@chainsafe/ssz@0.9.4": + version "0.9.4" + resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.9.4.tgz#696a8db46d6975b600f8309ad3a12f7c0e310497" + integrity sha512-77Qtg2N1ayqs4Bg/wvnWfg5Bta7iy7IRh8XqXh7oNMeP2HBbBwx8m6yTpA8p0EHItWPEBkgZd5S5/LSlp3GXuQ== + dependencies: + "@chainsafe/as-sha256" "^0.3.1" + "@chainsafe/persistent-merkle-tree" "^0.4.2" + case "^1.6.3" + "@cnakazawa/watch@^1.0.3": version "1.0.4" resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" @@ -1913,11 +1934,24 @@ crc-32 "^1.2.0" ethereumjs-util "^7.1.5" +"@ethereumjs/common@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-3.1.1.tgz#6f754c8933727ad781f63ca3929caab542fe184e" + integrity sha512-iEl4gQtcrj2udNhEizs04z7WA15ez1QoXL0XzaCyaNgwRyXezIg1DnfNeZUUpJnkrOF/0rYXyq2UFSLxt1NPQg== + dependencies: + "@ethereumjs/util" "^8.0.5" + crc-32 "^1.2.0" + "@ethereumjs/rlp@^4.0.0-beta.2": version "4.0.0" resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-4.0.0.tgz#66719891bd727251a7f233f9ca80212d1994f8c8" integrity sha512-LM4jS5n33bJN60fM5EC8VeyhUgga6/DjCPBV2vWjnfVtobqtOiNC4SQ1MRFqyBSmJGGdB533JZWewyvlcdJtkQ== +"@ethereumjs/rlp@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-4.0.1.tgz#626fabfd9081baab3d0a3074b0c7ecaf674aaa41" + integrity sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw== + "@ethereumjs/tx@3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.0.0.tgz#8dfd91ed6e91e63996e37b3ddc340821ebd48c81" @@ -1950,6 +1984,18 @@ "@ethereumjs/common" "^2.6.4" ethereumjs-util "^7.1.5" +"@ethereumjs/tx@^4.1.1": + version "4.1.1" + resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-4.1.1.tgz#d1b5bf2c4fd3618f2f333b66e262848530d4686a" + integrity sha512-QDj7nuROfoeyK83RObMA0XCZ+LUDdneNkSCIekO498uEKTY25FxI4Whduc/6j0wdd4IqpQvkq+/7vxSULjGIBQ== + dependencies: + "@chainsafe/ssz" "0.9.4" + "@ethereumjs/common" "^3.1.1" + "@ethereumjs/rlp" "^4.0.1" + "@ethereumjs/util" "^8.0.5" + "@ethersproject/providers" "^5.7.2" + ethereum-cryptography "^1.1.2" + "@ethereumjs/util@^8.0.0": version "8.0.2" resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-8.0.2.tgz#b7348fc7253649b0f00685a94546c6eee1fad819" @@ -1959,6 +2005,15 @@ async "^3.2.4" ethereum-cryptography "^1.1.2" +"@ethereumjs/util@^8.0.5": + version "8.0.5" + resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-8.0.5.tgz#b9088fc687cc13f0c1243d6133d145dfcf3fe446" + integrity sha512-259rXKK3b3D8HRVdRmlOEi6QFvwxdt304hhrEAmpZhsj7ufXEOTIc9JRZPMnXatKjECokdLNBcDOFBeBSzAIaw== + dependencies: + "@chainsafe/ssz" "0.9.4" + "@ethereumjs/rlp" "^4.0.1" + ethereum-cryptography "^1.1.2" + "@ethersproject/abi@5.4.1": version "5.4.1" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.4.1.tgz#6ac28fafc9ef6f5a7a37e30356a2eb31fa05d39b" @@ -2477,7 +2532,7 @@ bech32 "1.1.4" ws "7.4.6" -"@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.7.0": +"@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.7.0", "@ethersproject/providers@^5.7.2": version "5.7.2" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== @@ -4350,6 +4405,17 @@ semver "^7.3.8" superstruct "^1.0.3" +"@metamask/utils@^5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-5.0.1.tgz#8a60adcfeaa33f046dc66c0b9b02f2b172872d1b" + integrity sha512-8XCCYlLYoW4rZD2+QjEZ0UjOuvvS/EBmn89QwWW8A9+KVEO2B9HxXJFGZF/Rl+E4IoCxVczrjjIjXLg2kvkNPg== + dependencies: + "@ethereumjs/tx" "^4.1.1" + "@types/debug" "^4.1.7" + debug "^4.3.4" + semver "^7.3.8" + superstruct "^1.0.3" + "@ngraveio/bc-ur@^1.1.5", "@ngraveio/bc-ur@^1.1.6": version "1.1.6" resolved "https://registry.yarnpkg.com/@ngraveio/bc-ur/-/bc-ur-1.1.6.tgz#8f8c75fff22f6a5e4dfbc5a6b540d7fe8f42cd39" @@ -9116,6 +9182,11 @@ capture-exit@^2.0.0: dependencies: rsvp "^4.8.4" +case@^1.6.3: + version "1.6.3" + resolved "https://registry.yarnpkg.com/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9" + integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ== + caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" From d59853721e55d8acf36c9a6102c9d9f9f1470eca Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 19 Apr 2023 18:27:27 +0100 Subject: [PATCH 09/14] Test @metamask/utils Methods isObject and hasProperty behaving as expected --- index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.js b/index.js index 041fc72a99b..d095c699ae4 100644 --- a/index.js +++ b/index.js @@ -78,3 +78,14 @@ if (IGNORE_BOXLOGS_DEVELOPMENT === 'true') { * Application entry point responsible for registering root component */ AppRegistry.registerComponent(name, () => Sentry.wrap(Root)); + +import { isObject, hasProperty } from '@metamask/utils'; + +const obj = { a: 1, b: { c: 2 } }; +console.log(isObject(obj)); // true + +const propName = 'b'; +console.log(hasProperty(obj, propName)); // true + +const nonExistentPropName = 'd'; +console.log(hasProperty(obj, nonExistentPropName)); // false From cdc1fb09a78ac89a5ec275a9ea1da9bc926c7995 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 19 Apr 2023 18:28:13 +0100 Subject: [PATCH 10/14] Revert "Test @metamask/utils" This reverts commit d59853721e55d8acf36c9a6102c9d9f9f1470eca. --- index.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/index.js b/index.js index d095c699ae4..041fc72a99b 100644 --- a/index.js +++ b/index.js @@ -78,14 +78,3 @@ if (IGNORE_BOXLOGS_DEVELOPMENT === 'true') { * Application entry point responsible for registering root component */ AppRegistry.registerComponent(name, () => Sentry.wrap(Root)); - -import { isObject, hasProperty } from '@metamask/utils'; - -const obj = { a: 1, b: { c: 2 } }; -console.log(isObject(obj)); // true - -const propName = 'b'; -console.log(hasProperty(obj, propName)); // true - -const nonExistentPropName = 'd'; -console.log(hasProperty(obj, nonExistentPropName)); // false From 0dd5fa08858d47318a3ba40919c1eeadf05628b4 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Thu, 27 Apr 2023 13:00:22 +0100 Subject: [PATCH 11/14] Bump pod lockfile Cocoapods from 11.3 to 1.12.1 --- ios/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 332840b91a7..4f2ca475bdf 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -874,4 +874,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 74e503a275b4ed097cb01c171027882e9cdc699d -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 From 74a6aa4680652ee59d6c5f644fd3b21085de99a3 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Thu, 27 Apr 2023 13:00:36 +0100 Subject: [PATCH 12/14] Add @ethereumjs/util 8.0.6 --- package.json | 1 + yarn.lock | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/package.json b/package.json index 11a2b5acf51..4dee1ade954 100644 --- a/package.json +++ b/package.json @@ -134,6 +134,7 @@ "@eth-optimism/contracts": "0.0.0-2021919175625", "@ethereumjs/common": "^2.3.1", "@ethereumjs/tx": "^3.2.1", + "@ethereumjs/util": "^8.0.6", "@exodus/react-native-payments": "git+https://github.com/MetaMask/react-native-payments.git#dbc8cbbed570892d2fea5e3d183bf243e062c1e5", "@keystonehq/bc-ur-registry-eth": "^0.7.7", "@keystonehq/metamask-airgapped-keyring": "^0.3.0", diff --git a/yarn.lock b/yarn.lock index 141b2a9c466..eec607283c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1529,6 +1529,11 @@ resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz#3639df0e1435cab03f4d9870cc3ac079e57a6fc9" integrity sha512-hldFFYuf49ed7DAakWVXSJODuq3pzJEguD8tQ7h+sGkM18vja+OFoJI9krnGmgzyuZC2ETX0NOIcCTy31v2Mtg== +"@chainsafe/as-sha256@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.4.1.tgz#cfc0737e25f8c206767bdb6703e7943e5d44513e" + integrity sha512-IqeeGwQihK6Y2EYLFofqs2eY2ep1I2MvQXHzOAI+5iQN51OZlUkrLgyAugu2x86xZewDk5xas7lNczkzFzF62w== + "@chainsafe/persistent-merkle-tree@^0.4.2": version "0.4.2" resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.4.2.tgz#4c9ee80cc57cd3be7208d98c40014ad38f36f7ff" @@ -1536,6 +1541,14 @@ dependencies: "@chainsafe/as-sha256" "^0.3.1" +"@chainsafe/persistent-merkle-tree@^0.6.1": + version "0.6.1" + resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.6.1.tgz#37bde25cf6cbe1660ad84311aa73157dc86ec7f2" + integrity sha512-gcENLemRR13+1MED2NeZBMA7FRS0xQPM7L2vhMqvKkjqtFT4YfjSVADq5U0iLuQLhFUJEMVuA8fbv5v+TN6O9A== + dependencies: + "@chainsafe/as-sha256" "^0.4.1" + "@noble/hashes" "^1.3.0" + "@chainsafe/ssz@0.9.4": version "0.9.4" resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.9.4.tgz#696a8db46d6975b600f8309ad3a12f7c0e310497" @@ -1545,6 +1558,14 @@ "@chainsafe/persistent-merkle-tree" "^0.4.2" case "^1.6.3" +"@chainsafe/ssz@^0.11.1": + version "0.11.1" + resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.11.1.tgz#d4aec883af2ec5196ae67b96242c467da20b2476" + integrity sha512-cB8dBkgGN6ZoeOKuk+rIRHKN0L5i9JLGeC0Lui71QX0TuLcQKwgbfkUexpyJxnGFatWf8yeJxlOjozMn/OTP0g== + dependencies: + "@chainsafe/as-sha256" "^0.4.1" + "@chainsafe/persistent-merkle-tree" "^0.6.1" + "@cnakazawa/watch@^1.0.3": version "1.0.4" resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" @@ -2014,6 +2035,16 @@ "@ethereumjs/rlp" "^4.0.1" ethereum-cryptography "^1.1.2" +"@ethereumjs/util@^8.0.6": + version "8.0.6" + resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-8.0.6.tgz#f9716ed34235ea05eff8353bc5d483e5a6455989" + integrity sha512-zFLG/gXtF3QUC7iKFn4PT6HCr+DEnlCbwUGKGtXoqjA+64T+e0FuqMjlo4bQIY2ngRzk3EtudKdGYC4g31ehhg== + dependencies: + "@chainsafe/ssz" "^0.11.1" + "@ethereumjs/rlp" "^4.0.1" + ethereum-cryptography "^2.0.0" + micro-ftch "^0.3.1" + "@ethersproject/abi@5.4.1": version "5.4.1" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.4.1.tgz#6ac28fafc9ef6f5a7a37e30356a2eb31fa05d39b" @@ -4429,11 +4460,23 @@ jsbi "^3.1.5" sha.js "^2.4.11" +"@noble/curves@1.0.0", "@noble/curves@~1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.0.0.tgz#e40be8c7daf088aaf291887cbc73f43464a92932" + integrity sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw== + dependencies: + "@noble/hashes" "1.3.0" + "@noble/hashes@1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== +"@noble/hashes@1.3.0", "@noble/hashes@^1.3.0", "@noble/hashes@~1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" + integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== + "@noble/hashes@~1.1.1": version "1.1.3" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.3.tgz#360afc77610e0a61f3417e497dcf36862e4f8111" @@ -4811,6 +4854,15 @@ "@noble/secp256k1" "~1.6.0" "@scure/base" "~1.1.0" +"@scure/bip32@1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.0.tgz#6c8d980ef3f290987736acd0ee2e0f0d50068d87" + integrity sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q== + dependencies: + "@noble/curves" "~1.0.0" + "@noble/hashes" "~1.3.0" + "@scure/base" "~1.1.0" + "@scure/bip39@1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.0.tgz#92f11d095bae025f166bef3defcc5bf4945d419a" @@ -4819,6 +4871,14 @@ "@noble/hashes" "~1.1.1" "@scure/base" "~1.1.0" +"@scure/bip39@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.0.tgz#a207e2ef96de354de7d0002292ba1503538fc77b" + integrity sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg== + dependencies: + "@noble/hashes" "~1.3.0" + "@scure/base" "~1.1.0" + "@segment/analytics-react-native@2.13.0": version "2.13.0" resolved "https://registry.yarnpkg.com/@segment/analytics-react-native/-/analytics-react-native-2.13.0.tgz#2a612253219cd91ea3716f46d4fa837231d968d8" @@ -12316,6 +12376,16 @@ ethereum-cryptography@^1.1.2: "@scure/bip32" "1.1.0" "@scure/bip39" "1.1.0" +ethereum-cryptography@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.0.0.tgz#e052b49fa81affae29402e977b8d3a31f88612b6" + integrity sha512-g25m4EtfQGjstWgVE1aIz7XYYjf3kH5kG17ULWVB5dH6uLahsoltOhACzSxyDV+fhn4gbR4xRrOXGe6r2uh4Bg== + dependencies: + "@noble/curves" "1.0.0" + "@noble/hashes" "1.3.0" + "@scure/bip32" "1.3.0" + "@scure/bip39" "1.2.0" + ethereum-ens-network-map@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/ethereum-ens-network-map/-/ethereum-ens-network-map-1.0.2.tgz#4e27bad18dae7bd95d84edbcac2c9e739fc959b9" @@ -18007,6 +18077,11 @@ metro@0.72.3: ws "^7.5.1" yargs "^15.3.1" +micro-ftch@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" + integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg== + micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" From 436993f4074c799efdb8b42102cbfb3c5fb0c793 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Thu, 27 Apr 2023 14:05:58 +0100 Subject: [PATCH 13/14] Import @ethereumjs/util methods (no error) And create a new example Uint8Array --- index.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/index.js b/index.js index 041fc72a99b..1f5eeadef70 100644 --- a/index.js +++ b/index.js @@ -78,3 +78,43 @@ if (IGNORE_BOXLOGS_DEVELOPMENT === 'true') { * Application entry point responsible for registering root component */ AppRegistry.registerComponent(name, () => Sentry.wrap(Root)); + +import { + arrToBufArr, + bufferToHex, + ecsign, + publicToAddress, + toBuffer, + hashPersonalMessage, + privateToPublic, +} from '@ethereumjs/util'; + +// Test arrToBufArr fn +// const arr = [1, 2, 3, 4, 5]; // TypeError: The "value" argument must not be of type number. Received type number +const arr = new Uint8Array([1, 2, 3]); +// const bufArr = arrToBufArr(arr); +// console.log(bufArr); // {"data": [1, 2, 3], "type": "Buffer"} + +// Test bufferToHex fn +// const buffer = Buffer.from('Hello World', 'utf8'); +// const hex = bufferToHex(buffer); +// console.log(hex); // 0x48656c6c6f20576f726c64 + +// // Test ecsign fn +// const privateKey = Buffer.from( +// 'aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899', +// 'hex', +// ); +// const message = hashPersonalMessage(Buffer.from('Hello World', 'utf8')); +// const signature = ecsign(message, privateKey); +// console.log(signature); // {"r": {"data": [Array], "type": "Buffer"}, "s": {"data": [Array], "type": "Buffer"}, "v": 28n} + +// // Test publicToAddress fn +// const publicKey = privateToPublic(privateKey); +// const address = publicToAddress(publicKey); +// console.log(address); // {"data": [239, 192, 115, 33, 211, 214, 168, 250, 73, 97, 48, 108, 123, 245, 85, 240, 114, 63, 40, 193], "type": "Buffer"} + +// // Test toBuffer fn +// const int = 12345; +// const bufferInt = toBuffer(int); +// console.log(bufferInt); // {"data": [48, 57], "type": "Buffer"} From 64fb902082ae70f4d1fe13b35b787c981488d97b Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Thu, 27 Apr 2023 14:07:35 +0100 Subject: [PATCH 14/14] Test @ethereumjs/util arrToBufArr only (error) Error: Unable to resolve module zlib from .../metamask-mobile/node_modules/micro-ftch/index.js: zlib could not be found within the project or in these directories: node_modules @ethereumjs/util/src/index.ts exports * from './provider' './provider' imports fetch from 'micro-ftch' './provider' exports fetchFromProvider --- index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 1f5eeadef70..9e03e7a6ff6 100644 --- a/index.js +++ b/index.js @@ -81,18 +81,18 @@ AppRegistry.registerComponent(name, () => Sentry.wrap(Root)); import { arrToBufArr, - bufferToHex, - ecsign, - publicToAddress, - toBuffer, - hashPersonalMessage, - privateToPublic, + // bufferToHex, + // ecsign, + // publicToAddress, + // toBuffer, + // hashPersonalMessage, + // privateToPublic, } from '@ethereumjs/util'; // Test arrToBufArr fn // const arr = [1, 2, 3, 4, 5]; // TypeError: The "value" argument must not be of type number. Received type number const arr = new Uint8Array([1, 2, 3]); -// const bufArr = arrToBufArr(arr); +const bufArr = arrToBufArr(arr); // console.log(bufArr); // {"data": [1, 2, 3], "type": "Buffer"} // Test bufferToHex fn