Skip to content

Commit 5d29141

Browse files
committed
chore: update to use metamask
1 parent 6609f0c commit 5d29141

File tree

4 files changed

+59
-43
lines changed

4 files changed

+59
-43
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"@chakra-ui/react": "^2.8.2",
1717
"@emotion/react": "^11.11.4",
1818
"@emotion/styled": "^11.11.5",
19+
"@starknet-io/get-starknet-core": "^4.0.4",
1920
"@starknet-io/types-js": "^0.7.7",
2021
"@starknet-react/chains": "^0.1.7",
2122
"@starknet-react/core": "^2.8.2",
@@ -32,7 +33,7 @@
3233
"starknet-react-chains-next": "npm:@starknet-react/[email protected]",
3334
"starknet-react-core-next": "npm:@starknet-react/[email protected]",
3435
"starknetkit-latest": "npm:starknetkit@^1.1.9",
35-
"starknetkit-next": "npm:starknetkit@^2.6.0"
36+
"starknetkit-next": "npm:starknetkit@^2.6.1"
3637
},
3738
"devDependencies": {
3839
"@types/lodash-es": "^4.17.12",

pnpm-lock.yaml

Lines changed: 25 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/connect/ConnectButtonStarknetkitNext.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const ConnectButtonStarknetkitNext = () => {
3232
new InjectedConnector({ options: { id: "argentX" } }),
3333
new InjectedConnector({ options: { id: "braavos" } }),
3434
new InjectedConnector({ options: { id: "keplr" } }),
35+
new InjectedConnector({ options: { id: "metamask" } }),
3536
new InjectedConnector({ options: { id: "okxwallet" } }),
3637
new ArgentMobileBaseConnector({
3738
dappName: "Starknetkit example dapp",
@@ -85,7 +86,7 @@ const ConnectButtonStarknetkitNext = () => {
8586
checked={withAdditionalWallets}
8687
onChange={() => setWithAdditionalWallets(!withAdditionalWallets)}
8788
/>
88-
Include Keplr and OKX wallets with starknetkit@next (
89+
Include Metamask, Keplr and OKX wallets with starknetkit@next (
8990
{process.env.starknetkitNextVersion})
9091
</Flex>
9192
</>

src/helpers/connectorsNext.ts

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
11
import { ARGENT_WEBWALLET_URL, CHAIN_ID } from "@/constants"
2+
import { getStarknet } from "@starknet-io/get-starknet-core"
23
import {
34
isInArgentMobileAppBrowser,
45
ArgentMobileConnector,
56
} from "starknetkit-next/argentMobile"
67
import { InjectedConnector } from "starknetkit-next/injected"
78
import { WebWalletConnector } from "starknetkit-next/webwallet"
89

9-
export const availableConnectors = isInArgentMobileAppBrowser()
10-
? [
11-
ArgentMobileConnector.init({
12-
options: {
13-
url: typeof window !== "undefined" ? window.location.href : "",
14-
dappName: "Example dapp",
15-
chainId: CHAIN_ID,
16-
},
17-
}),
18-
]
19-
: [
20-
new InjectedConnector({ options: { id: "argentX" } }),
21-
new InjectedConnector({ options: { id: "braavos" } }),
22-
ArgentMobileConnector.init({
23-
options: {
24-
url: typeof window !== "undefined" ? window.location.href : "",
25-
dappName: "Example dapp",
26-
chainId: CHAIN_ID,
27-
},
28-
}),
29-
new WebWalletConnector({ url: ARGENT_WEBWALLET_URL }),
30-
]
10+
export const availableConnectors = () => {
11+
if (typeof window !== "undefined") {
12+
getStarknet()
13+
}
14+
return isInArgentMobileAppBrowser()
15+
? [
16+
ArgentMobileConnector.init({
17+
options: {
18+
url: typeof window !== "undefined" ? window.location.href : "",
19+
dappName: "Example dapp",
20+
chainId: CHAIN_ID,
21+
},
22+
}),
23+
]
24+
: [
25+
new InjectedConnector({ options: { id: "argentX" } }),
26+
new InjectedConnector({ options: { id: "braavos" } }),
27+
ArgentMobileConnector.init({
28+
options: {
29+
url: typeof window !== "undefined" ? window.location.href : "",
30+
dappName: "Example dapp",
31+
chainId: CHAIN_ID,
32+
},
33+
}),
34+
new WebWalletConnector({ url: ARGENT_WEBWALLET_URL }),
35+
]
36+
}
37+
38+
export const connectors = availableConnectors()

0 commit comments

Comments
 (0)