Skip to content

Commit

Permalink
chore: update starknetkit@next
Browse files Browse the repository at this point in the history
  • Loading branch information
bluecco committed Aug 12, 2024
1 parent 763f70c commit 3b94a06
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 42 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"starknet-react-chains-next": "npm:@starknet-react/chains@3.0.0-beta.1",
"starknet-react-core-next": "npm:@starknet-react/core@3.0.0-beta.1",
"starknetkit-latest": "npm:starknetkit@^1.1.9",
"starknetkit-next": "npm:starknetkit@^2.2.18"
"starknetkit-next": "npm:starknetkit@^2.2.19"
},
"devDependencies": {
"@types/lodash-es": "^4.17.12",
Expand Down
76 changes: 38 additions & 38 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/app/starknetkitLatest/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ export default function StarknetkitLatest() {
}
}, [wallet])

useEffect(() => {
if (typeof window !== "undefined") {
document.addEventListener("wallet_disconnected", async () => {
setWallet(RESET)
})
}
}, [])

return (
<Flex as="main" flexDirection="column" p="10" gap="4" w="dvw" h="100dvh">
{wallet && (
Expand Down
10 changes: 10 additions & 0 deletions src/app/starknetkitNext/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ export default function StarknetkitLatest() {
}
}, [wallet])

useEffect(() => {
if (typeof window !== "undefined") {
document.addEventListener("wallet_disconnected", async () => {
setWallet(RESET)
setConnectorData(RESET)
setConnector(RESET)
})
}
}, [])

return (
<Flex as="main" flexDirection="column" p="10" gap="4" w="dvw" h="100dvh">
{wallet && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/connect/ConnectStarknetReact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const ConnectStarknetReact = () => {
onClick={async () => {
const { connector } = await starknetkitConnectModal()
if (!connector) return // or throw error
await connectAsync({ connector: connector as any })
await connectAsync({ connector })
setStarknetkitVersion(
`starknetkit@latest (${process.env.starknetkitNextVersion})`,
)
Expand Down
2 changes: 0 additions & 2 deletions src/helpers/connectorsNext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const availableConnectors = isInArgentMobileAppBrowser()
dappName: "Example dapp",
chainId: CHAIN_ID,
},
inAppBrowserOptions: {},
}),
]
: [
Expand All @@ -24,7 +23,6 @@ export const availableConnectors = isInArgentMobileAppBrowser()
dappName: "Example dapp",
chainId: CHAIN_ID,
},
inAppBrowserOptions: {},
}),
new WebWalletConnector({ url: ARGENT_WEBWALLET_URL }),
]

0 comments on commit 3b94a06

Please sign in to comment.