From 52b139cc1749c4cc545807b97200a82ebf0317e4 Mon Sep 17 00:00:00 2001 From: Omridan159 Date: Wed, 13 Mar 2024 10:30:33 +0000 Subject: [PATCH] fix: devreactnative dapp issues --- .../devreactnative/src/views/DappView.tsx | 10 +++--- packages/sdk-react/package.json | 6 +++- packages/sdk-ui/package.json | 31 ++++++++++--------- packages/sdk/package.json | 6 +++- yarn.lock | 28 +++++++---------- 5 files changed, 44 insertions(+), 37 deletions(-) diff --git a/packages/devreactnative/src/views/DappView.tsx b/packages/devreactnative/src/views/DappView.tsx index 3bd80fa0a..830e07cf1 100644 --- a/packages/devreactnative/src/views/DappView.tsx +++ b/packages/devreactnative/src/views/DappView.tsx @@ -108,7 +108,9 @@ export const DAPPView = (_props: DAPPViewProps) => { const msgParams = JSON.stringify({ domain: { // Defining the chain aka Rinkeby testnet or Ethereum Main Net - chainId: ethereum?.chainId ? parseInt(ethereum.chainId, 16) : 1, + chainId: ethereum?.getChainId() + ? parseInt(ethereum.getChainId(), 16) + : 1, // Give a user friendly name to the specific contract you are signing for. name: 'Ether Mail', // If name isn't enough add verifying contract to make sure you are establishing contracts with the proper entity @@ -174,7 +176,7 @@ export const DAPPView = (_props: DAPPViewProps) => { }, }); - const from = ethereum?.selectedAddress; + const from = ethereum?.getSelectedAddress(); const params = [from, msgParams]; const method = 'eth_signTypedData_v4'; @@ -189,7 +191,7 @@ export const DAPPView = (_props: DAPPViewProps) => { const to = '0x0000000000000000000000000000000000000000'; const transactionParameters = { to, // Required except during contract publications. - from: ethereum?.selectedAddress, // must match user's active address. + from: ethereum?.getSelectedAddress(), // must match user's active address. value: '0x5AF3107A4000', // Only required to send ether to the recipient from the initiating external account. }; @@ -234,7 +236,7 @@ export const DAPPView = (_props: DAPPViewProps) => { }; const batch = async () => { - const selectedAddress = ethereum?.selectedAddress; + const selectedAddress = ethereum?.getSelectedAddress(); const rpcs = [ { diff --git a/packages/sdk-react/package.json b/packages/sdk-react/package.json index ac87dbd85..2048f947d 100644 --- a/packages/sdk-react/package.json +++ b/packages/sdk-react/package.json @@ -46,7 +46,6 @@ }, "dependencies": { "@metamask/sdk": "workspace:^", - "@react-native-async-storage/async-storage": "^1.19.6", "debug": "^4.3.4", "eth-rpc-errors": "^4.0.3", "rollup-plugin-node-builtins": "^2.1.2", @@ -62,6 +61,7 @@ "@metamask/eslint-config": "^6.0.0", "@metamask/eslint-config-nodejs": "^6.0.0", "@metamask/eslint-config-typescript": "^6.0.0", + "@react-native-async-storage/async-storage": "^1.19.6", "@rollup/plugin-commonjs": "^22.0.1", "@rollup/plugin-json": "^6.0.1", "@rollup/plugin-node-resolve": "^13.3.0", @@ -102,11 +102,15 @@ "typescript": "^4.7.4" }, "peerDependencies": { + "@react-native-async-storage/async-storage": "^1.19.6", "react": "^18.2.0", "react-dom": "^18.2.0", "react-native": "*" }, "peerDependenciesMeta": { + "@react-native-async-storage/async-storage": { + "optional": true + }, "react": { "optional": false }, diff --git a/packages/sdk-ui/package.json b/packages/sdk-ui/package.json index 9ac97b39a..2c7b67801 100644 --- a/packages/sdk-ui/package.json +++ b/packages/sdk-ui/package.json @@ -46,7 +46,6 @@ "@metamask/sdk": "workspace:^", "@metamask/sdk-communication-layer": "workspace:^", "@metamask/sdk-react": "workspace:^", - "@react-native-async-storage/async-storage": "^1.19.5", "@react-navigation/native": "^6.1.9", "@testing-library/react-native": "^12.4.0", "babel-preset-expo": "^9.5.2", @@ -63,26 +62,13 @@ "react-native-qrcode-svg": "^6.2.0", "react-redux": "^8.1.3" }, - "peerDependencies": { - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-native": "^0.72.4", - "react-native-device-info": "^10.11.0", - "react-native-gesture-handler": "^2.13.4", - "react-native-jazzicon": "^0.1.2", - "react-native-paper": "^5.11.1", - "react-native-reanimated": "^3.5.4", - "react-native-safe-area-context": "^4.7.4", - "react-native-svg": "^14.0.0", - "react-native-vector-icons": "^10.0.2", - "react-native-web": "^0.19.9" - }, "devDependencies": { "@babel/plugin-proposal-object-rest-spread": "^7.20.7", "@babel/preset-flow": "^7.23.3", "@babel/preset-react": "^7.23.3", "@babel/preset-typescript": "^7.23.3", "@metamask/auto-changelog": "^3.4.3", + "@react-native-async-storage/async-storage": "^1.19.6", "@react-native-community/eslint-config": "^3.2.0", "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-commonjs": "^22.0.1", @@ -151,6 +137,21 @@ "typescript": "^5.2.2", "url-loader": "^4.1.1" }, + "peerDependencies": { + "@react-native-async-storage/async-storage": "^1.19.6", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-native": "^0.72.4", + "react-native-device-info": "^10.11.0", + "react-native-gesture-handler": "^2.13.4", + "react-native-jazzicon": "^0.1.2", + "react-native-paper": "^5.11.1", + "react-native-reanimated": "^3.5.4", + "react-native-safe-area-context": "^4.7.4", + "react-native-svg": "^14.0.0", + "react-native-vector-icons": "^10.0.2", + "react-native-web": "^0.19.9" + }, "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 41177b4bd..1380778c3 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -48,7 +48,6 @@ "@metamask/providers": "^15.0.0", "@metamask/sdk-communication-layer": "workspace:*", "@metamask/sdk-install-modal-web": "workspace:*", - "@react-native-async-storage/async-storage": "^1.17.11", "@types/dom-screen-wake-lock": "^1.0.0", "bowser": "^2.9.0", "cross-fetch": "^4.0.0", @@ -75,6 +74,7 @@ "@metamask/eslint-config": "^6.0.0", "@metamask/eslint-config-nodejs": "^6.0.0", "@metamask/eslint-config-typescript": "^6.0.0", + "@react-native-async-storage/async-storage": "^1.19.6", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-node-resolve": "^15.0.2", @@ -114,11 +114,15 @@ "typescript": "^4.3.2" }, "peerDependencies": { + "@react-native-async-storage/async-storage": "^1.19.6", "react": "^18.2.0", "react-dom": "^18.2.0", "react-native": "*" }, "peerDependenciesMeta": { + "@react-native-async-storage/async-storage": { + "optional": true + }, "react": { "optional": true }, diff --git a/yarn.lock b/yarn.lock index 556f01150..6b8d1e926 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8238,10 +8238,13 @@ __metadata: tailwindcss: ^3.1.4 typescript: ^4.7.4 peerDependencies: + "@react-native-async-storage/async-storage": ^1.19.6 react: ^18.2.0 react-dom: ^18.2.0 react-native: "*" peerDependenciesMeta: + "@react-native-async-storage/async-storage": + optional: true react: optional: false react-dom: @@ -8382,7 +8385,7 @@ __metadata: "@metamask/sdk": "workspace:^" "@metamask/sdk-communication-layer": "workspace:^" "@metamask/sdk-react": "workspace:^" - "@react-native-async-storage/async-storage": ^1.19.5 + "@react-native-async-storage/async-storage": ^1.19.6 "@react-native-community/eslint-config": ^3.2.0 "@react-navigation/native": ^6.1.9 "@rollup/plugin-babel": ^6.0.4 @@ -8466,6 +8469,7 @@ __metadata: typescript: ^5.2.2 url-loader: ^4.1.1 peerDependencies: + "@react-native-async-storage/async-storage": ^1.19.6 react: ^18.2.0 react-dom: ^18.2.0 react-native: ^0.72.4 @@ -8536,7 +8540,7 @@ __metadata: "@metamask/providers": ^15.0.0 "@metamask/sdk-communication-layer": "workspace:*" "@metamask/sdk-install-modal-web": "workspace:*" - "@react-native-async-storage/async-storage": ^1.17.11 + "@react-native-async-storage/async-storage": ^1.19.6 "@rollup/plugin-commonjs": ^25.0.7 "@rollup/plugin-json": ^6.0.0 "@rollup/plugin-node-resolve": ^15.0.2 @@ -8592,10 +8596,13 @@ __metadata: util: ^0.12.4 uuid: ^8.3.2 peerDependencies: + "@react-native-async-storage/async-storage": ^1.19.6 react: ^18.2.0 react-dom: ^18.2.0 react-native: "*" peerDependenciesMeta: + "@react-native-async-storage/async-storage": + optional: true react: optional: true react-dom: @@ -10123,25 +10130,14 @@ __metadata: languageName: node linkType: hard -"@react-native-async-storage/async-storage@npm:^1.19.5": - version: 1.19.5 - resolution: "@react-native-async-storage/async-storage@npm:1.19.5" - dependencies: - merge-options: ^3.0.4 - peerDependencies: - react-native: ^0.0.0-0 || 0.60 - 0.72 || 1000.0.0 - checksum: c0e9b58c8fcd2f14bfcf089d65a291cf795f391f5b3c84aaf0a04d9acdee47f99c26f0fa2ac63309097e6a4d2d08c823dce65af60b989659916e2be4a7b1d529 - languageName: node - linkType: hard - "@react-native-async-storage/async-storage@npm:^1.19.6": - version: 1.19.6 - resolution: "@react-native-async-storage/async-storage@npm:1.19.6" + version: 1.22.3 + resolution: "@react-native-async-storage/async-storage@npm:1.22.3" dependencies: merge-options: ^3.0.4 peerDependencies: react-native: ^0.0.0-0 || >=0.60 <1.0 - checksum: ecddc192a03854a0cca046379e971958300cad05d1558331d8dadeb56518feff34ab47aca666b5045946ec5c42efd21b774286d121e4034043cdba814dfb2a96 + checksum: bbf0f49c4441361d24f5c7a236862757d1addb7332d4c11ed7238b7023e882d2280290059602d9099cee094f60aeb11aad3f2017652ab6e143544e61dccadb73 languageName: node linkType: hard