Skip to content

Commit

Permalink
latest wagmi + updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lochie committed Jul 17, 2024
1 parent f09a43e commit 63ba37a
Show file tree
Hide file tree
Showing 13 changed files with 2,751 additions and 2,656 deletions.
4 changes: 2 additions & 2 deletions examples/cra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-scripts": "5.0.1",
"viem": "^2.13.0",
"wagmi": "^2.10.2",
"viem": "^2.17.0",
"wagmi": "^2.11.0",
"web-vitals": "^2.1.4"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/nextjs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"next": "14.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "^2.13.0",
"wagmi": "^2.10.2"
"viem": "^2.17.0",
"wagmi": "^2.11.0"
},
"devDependencies": {
"@types/node": "^18.19.3",
Expand Down
4 changes: 2 additions & 2 deletions examples/nextjs-siwe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"react": "^18.0.0",
"react-dom": "^18.0.0",
"siwe": "^2.1.4",
"viem": "^2.13.0",
"wagmi": "^2.10.2"
"viem": "^2.17.0",
"wagmi": "^2.11.0"
},
"devDependencies": {
"@types/node": "18.7.18",
Expand Down
4 changes: 2 additions & 2 deletions examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"next": "14.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "^2.13.0",
"wagmi": "^2.10.2"
"viem": "^2.17.0",
"wagmi": "^2.11.0"
},
"devDependencies": {
"@types/node": "^18.19.3",
Expand Down
4 changes: 2 additions & 2 deletions examples/testbench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"next": "14.1.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"viem": "^2.13.6",
"wagmi": "^2.10.2"
"viem": "^2.17.0",
"wagmi": "^2.11.0"
},
"devDependencies": {
"@types/node": "18.7.18",
Expand Down
4 changes: 2 additions & 2 deletions examples/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"connectkit": "workspace:packages/connectkit",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "^2.13.0",
"wagmi": "^2.10.2"
"viem": "^2.17.0",
"wagmi": "^2.11.0"
},
"devDependencies": {
"@types/react": "^18.0.17",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"rollup-plugin-visualizer": "^5.5.4",
"tslib": "^1.9.3",
"typescript-plugin-styled-components": "^2.0.0",
"viem": "^2.13.0",
"wagmi": "^2.10.2"
"viem": "^2.17.0",
"wagmi": "^2.11.0"
},
"packageManager": "yarn@3.2.0",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/connectkit-next-siwe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
],
"dependencies": {
"iron-session": "^6.2.1",
"viem": "^2.13.0"
"viem": "^2.17.0"
},
"peerDependencies": {
"connectkit": ">=1.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/connectkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"resolutions": {
"react": "^18.0.0",
"react-dom": "^18.0.0",
"viem": "^2.13.0",
"wagmi": "^2.10.2"
"viem": "^2.17.0",
"wagmi": "^2.11.0"
}
}
9 changes: 3 additions & 6 deletions packages/connectkit/src/defaultConnectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,12 @@ const defaultConnectors = ({
dappMetadata: {
name: app.name,
iconUrl: app.icon,
//source: "connectkit"
},
// disables metamask modal /*
// disables metamask modal
extensionOnly: true,
modals: {
install: ({ link }) => {
console.log('dispatch metaMaskUri', link);
window.dispatchEvent(
new CustomEvent('metaMaskUri', { detail: link })
);
install: () => {
return {};
},
},
Expand Down
15 changes: 3 additions & 12 deletions packages/connectkit/src/hooks/connectors/useMetaMaskUri.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,16 @@ export function useMetaMaskUri(
const { isConnected } = useAccount();
const { connectAsync } = useConnect();

useEffect(() => {
window.addEventListener('metaMaskUri', (e: any) => {
console.log('link', e.detail);
setUri(e.detail);
});
}, []);

useEffect(() => {
if (typeof window !== 'undefined' && !window.mmsdk) return;
if (window.mmsdk?.isExtensionActive()) return;
if (!enabled) return;

async function handleMessage(message) {
const { type } = message;
const { type, data } = message;
log('MM Message', message);
if (type === 'connecting') {
const p: any = await connector.getProvider();
//if (p?.qrUrl) setUri(p.qrUrl);
if (type === 'display_uri') {
setUri(data);
}
}
async function handleDisconnect() {
Expand All @@ -67,7 +59,6 @@ export function useMetaMaskUri(
switch (error.code) {
case 4001:
log('error.code - User rejected');
tryConnect(connector); // Regenerate QR code
break;
default:
log('error.code - Unknown Error');
Expand Down
4 changes: 2 additions & 2 deletions packages/cra-template/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"@types/react-dom": "^18.0.0",
"connectkit": "latest",
"typescript": "^5.0.4",
"viem": "^2.13.0",
"wagmi": "^2.10.2",
"viem": "^2.17.0",
"wagmi": "^2.11.0",
"web-vitals": "^2.1.0"
},
"eslintConfig": {
Expand Down
Loading

0 comments on commit 63ba37a

Please sign in to comment.