Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adapt the "devreactnative" DApp for compatibility with new "metaMask/providers" version #757

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/devreactnative/src/views/DappView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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';
Expand All @@ -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.
};

Expand Down Expand Up @@ -234,7 +236,7 @@ export const DAPPView = (_props: DAPPViewProps) => {
};

const batch = async () => {
const selectedAddress = ethereum?.selectedAddress;
const selectedAddress = ethereum?.getSelectedAddress();

const rpcs = [
{
Expand Down
6 changes: 5 additions & 1 deletion packages/sdk-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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
},
Expand Down
31 changes: 16 additions & 15 deletions packages/sdk-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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/"
Expand Down
6 changes: 5 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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
},
Expand Down
28 changes: 12 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down
Loading