@@ -8,7 +8,11 @@ import { starknetkitVersionAtom } from "@/state/versionState"
88import { Button , Flex } from "@chakra-ui/react"
99import { useSetAtom } from "jotai"
1010import { useRouter } from "next/navigation"
11+ import { useState } from "react"
1112import { connect } from "starknetkit-next"
13+ import { ArgentMobileBaseConnector } from "starknetkit-next/argentMobile"
14+ import { InjectedConnector } from "starknetkit-next/injected"
15+ import { WebWalletConnector } from "starknetkit-next/webwallet"
1216
1317const ConnectButtonStarknetkitNext = ( ) => {
1418 const setWallet = useSetAtom ( walletStarknetkitNextAtom )
@@ -17,17 +21,38 @@ const ConnectButtonStarknetkitNext = () => {
1721 const setStarknetkitVersion = useSetAtom ( starknetkitVersionAtom )
1822 const navigate = useRouter ( )
1923
24+ const [ withAdditionalWallets , setWithAdditionalWallets ] = useState ( false )
25+
2026 const connectFn = async ( ) => {
21- const res = await connect ( {
22- modalMode : "alwaysAsk" ,
23- webWalletUrl : ARGENT_WEBWALLET_URL ,
24- argentMobileOptions : {
25- dappName : "Starknetkit example dapp" ,
26- url : window . location . hostname ,
27- chainId : CHAIN_ID ,
28- icons : [ ] ,
29- } ,
30- } )
27+ const res = await connect (
28+ withAdditionalWallets
29+ ? {
30+ modalMode : "alwaysAsk" ,
31+ connectors : [
32+ new InjectedConnector ( { options : { id : "argentX" } } ) ,
33+ new InjectedConnector ( { options : { id : "braavos" } } ) ,
34+ new InjectedConnector ( { options : { id : "keplr" } } ) ,
35+ new InjectedConnector ( { options : { id : "okxwallet" } } ) ,
36+ new ArgentMobileBaseConnector ( {
37+ dappName : "Starknetkit example dapp" ,
38+ url : window . location . hostname ,
39+ chainId : CHAIN_ID ,
40+ icons : [ ] ,
41+ } ) ,
42+ new WebWalletConnector ( { url : ARGENT_WEBWALLET_URL } ) ,
43+ ] ,
44+ }
45+ : {
46+ modalMode : "alwaysAsk" ,
47+ webWalletUrl : ARGENT_WEBWALLET_URL ,
48+ argentMobileOptions : {
49+ dappName : "Starknetkit example dapp" ,
50+ url : window . location . hostname ,
51+ chainId : CHAIN_ID ,
52+ icons : [ ] ,
53+ } ,
54+ } ,
55+ )
3156
3257 const { wallet, connectorData, connector } = res
3358 setWallet ( wallet )
@@ -40,19 +65,30 @@ const ConnectButtonStarknetkitNext = () => {
4065 }
4166
4267 return (
43- < Flex flexDirection = "column" alignItems = "center" >
44- < Button
45- p = "4"
46- rounded = "lg"
47- colorScheme = "primary"
48- onClick = { connectFn }
49- h = "20"
50- w = "full"
51- >
52- starknetkit@next ({ process . env . starknetkitNextVersion } )
53- </ Button >
54- < strong > (with session keys)</ strong > { /* TODO: will be removed */ }
55- </ Flex >
68+ < >
69+ < Flex flexDirection = "column" alignItems = "center" >
70+ < Button
71+ p = "4"
72+ rounded = "lg"
73+ colorScheme = "primary"
74+ onClick = { connectFn }
75+ h = "20"
76+ w = "full"
77+ >
78+ starknetkit@next ({ process . env . starknetkitNextVersion } ) +
79+ < strong > (with session keys)</ strong > { /* TODO: will be removed */ }
80+ </ Button >
81+ </ Flex >
82+ < Flex gap = "1" >
83+ < input
84+ type = "checkbox"
85+ checked = { withAdditionalWallets }
86+ onChange = { ( ) => setWithAdditionalWallets ( ! withAdditionalWallets ) }
87+ />
88+ Include Keplr and OKX wallets with starknetkit@next (
89+ { process . env . starknetkitNextVersion } )
90+ </ Flex >
91+ </ >
5692 )
5793}
5894
0 commit comments