Skip to content

Commit 2ff60a0

Browse files
committed
feat: wip
1 parent ee0d2ae commit 2ff60a0

File tree

5 files changed

+1826
-12
lines changed

5 files changed

+1826
-12
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {}
2+
const nextConfig = {
3+
webpack: (config) => {
4+
config.externals.push({
5+
'bufferutil': 'bufferutil',
6+
'utf-8-validate': 'utf-8-validate',
7+
})
8+
return config
9+
},
10+
}
311

4-
module.exports = nextConfig
12+
module.exports = nextConfig

packages/examples/nextjs-demo/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"allow-scripts": "echo 'n/a'"
1111
},
1212
"dependencies": {
13+
"@metamask/providers": "^18.3.1",
1314
"@metamask/sdk-react": "^0.30.0",
1415
"@types/node": "20.2.1",
1516
"@types/react": "18.2.6",
@@ -20,5 +21,15 @@
2021
"react": "18.2.0",
2122
"react-dom": "18.2.0",
2223
"typescript": "5.0.4"
24+
},
25+
"devDependencies": {
26+
"@babel/core": "^7.26.0",
27+
"@babel/plugin-proposal-json-modules": "^7.25.9",
28+
"@babel/plugin-syntax-import-assertions": "^7.26.0",
29+
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
30+
"@babel/preset-env": "^7.26.0",
31+
"babel-loader": "^9.2.1",
32+
"bufferutil": "^4.0.9",
33+
"utf-8-validate": "^6.0.5"
2334
}
2435
}

packages/examples/nextjs-demo/sdk-copy.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,35 @@ SDK_WORKSPACE_DIR="$( pwd; )";
77
COMM_LAYER_DIR="$SDK_WORKSPACE_DIR/packages/sdk-communication-layer"
88
SDK_DIR="$SDK_WORKSPACE_DIR/packages/sdk"
99
SDK_REACT_DIR="$SDK_WORKSPACE_DIR/packages/sdk-react"
10-
SDK_REACT_UI_DIR="$SDK_WORKSPACE_DIR/packages/sdk-react-ui"
10+
SDK_INSTALL_MODAL_WEB_DIR="$SDK_WORKSPACE_DIR/packages/sdk-install-modal-web"
1111

1212
DAPP_DIR="$SDK_WORKSPACE_DIR/packages/examples/nextjs-demo"
1313

1414
echo "SDK_DIR: $SDK_DIR"
1515
echo "COMM_LAYER_DIR: $COMM_LAYER_DIR"
1616
echo "DAPP_DIR: $DAPP_DIR"
1717
echo "SDK_REACT_DIR: $SDK_REACT_DIR"
18-
echo "SDK_REACT_UI_DIR: $SDK_REACT_UI_DIR"
18+
echo "SDK_INSTALL_MODAL_WEB_DIR: $SDK_INSTALL_MODAL_WEB_DIR"
1919

2020
echo "########### START REPLACING SDK_COMMUNICATION_LAYER #########"
2121

2222
cd $DAPP_DIR
2323
echo "Hack Metamask sdk && sdk-communication-layer packages..."
2424
## hack to debug to latest unpublished version of the sdk
25-
rm -rf node_modules/@metamask/sdk-communication-layer node_modules/@metamask/sdk node_modules/@metamask/sdk-react node_modules/@metamask/sdk-react-ui
26-
cp -rf $COMM_LAYER_DIR node_modules/@metamask/
27-
cp -rf $SDK_DIR node_modules/@metamask/
28-
cp -rf $SDK_REACT_DIR node_modules/@metamask/
29-
cp -rf $SDK_REACT_UI_DIR node_modules/@metamask/
25+
rm -rf node_modules/@metamask/sdk-communication-layer/dist node_modules/@metamask/sdk/dist node_modules/@metamask/sdk-react/dist node_modules/@metamask/sdk-install-modal-web/dist
26+
cp -rf $COMM_LAYER_DIR/dist node_modules/@metamask/sdk-communication-layer/dist
27+
cp -rf $COMM_LAYER_DIR/package.json node_modules/@metamask/sdk-communication-layer/package.json
3028

29+
cp -rf $SDK_DIR/dist node_modules/@metamask/sdk/dist
30+
cp -rf $SDK_DIR/package.json node_modules/@metamask/sdk/package.json
31+
32+
cp -rf $SDK_REACT_DIR/dist node_modules/@metamask/sdk-react/dist
33+
cp -rf $SDK_REACT_DIR/package.json node_modules/@metamask/sdk-react/package.json
34+
35+
cp -rf $SDK_INSTALL_MODAL_WEB_DIR/dist node_modules/@metamask/sdk-install-modal-web
36+
cp -rf $SDK_INSTALL_MODAL_WEB_DIR/package.json node_modules/@metamask/sdk-install-modal-web/package.json
37+
38+
# Remove vite cache
39+
rm -rf .next
3140

3241
echo "All done."

packages/examples/nextjs-demo/src/app/SDKContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function SDKContainer() {
3030
const [serviceStatus, setServiceStatus] = useState<ServiceStatus>();
3131
const [activeProvider, setActiveProvider] = useState<SDKProvider>();
3232
const [currentLanguage, setCurrentLanguage] = useState(
33-
localStorage.getItem('MetaMaskSDKLng') || 'en',
33+
'en',
3434
);
3535

3636
const languages = sdk?.availableLanguages ?? ['en'];

0 commit comments

Comments
 (0)