11import { useEffect , useState } from "react" ;
22import {
3- Web3AuthMPCCoreKit ,
43 WEB3AUTH_NETWORK ,
54 COREKIT_STATUS ,
65 makeEthereumSigner ,
@@ -11,9 +10,6 @@ import Web3 from "web3";
1110import { CHAIN_NAMESPACES , CustomChainConfig , IProvider } from "@web3auth/base" ;
1211import { EthereumSigningProvider } from "@web3auth/ethereum-mpc-provider" ;
1312import { KeyType } from "@tkey/common-types" ;
14- import { tssLib as tssLibDkls } from "@toruslabs/tss-dkls-lib" ;
15- import { tssLib as tssLibFrost } from "@toruslabs/tss-frost-lib" ;
16- import { tssLib as tssLibFrostBip340 } from "@toruslabs/tss-frost-lib-bip340" ;
1713
1814import bowser from "bowser" ;
1915
@@ -35,7 +31,6 @@ export const generateSecretKey = (): string => {
3531 return base32 . encode ( randomBytes ) . toString ( ) . replace ( / = / g, "" ) ;
3632} ;
3733
38- type TssLib = typeof tssLibDkls | typeof tssLibFrost | typeof tssLibFrostBip340 ;
3934const PASSKEYS_ALLOWED_MAP = [ bowser . OS_MAP . iOS , bowser . OS_MAP . MacOS , bowser . OS_MAP . Android , bowser . OS_MAP . Windows ] ;
4035
4136const getWindowsVersion = ( osVersion : string ) => {
@@ -102,25 +97,23 @@ const uiConsole = (...args: any[]): void => {
10297 console . log ( ...args ) ;
10398} ;
10499
105- const selectedNetwork = WEB3AUTH_NETWORK . MAINNET ;
106100
107101export const DEFAULT_CHAIN_CONFIG : CustomChainConfig = {
108102 chainNamespace : CHAIN_NAMESPACES . EIP155 ,
109- chainId : "0xaa36a7" ,
110- rpcTarget : "https://rpc.ankr.com/eth_sepolia " ,
111- displayName : "Ethereum Sepolia Testnet" ,
112- blockExplorerUrl : "https://sepolia.etherscan .io" ,
103+ chainId : "0x66eee" , // Arbitrum Sepolia chain ID
104+ rpcTarget : "https://arbitrum-sepolia.blockpi.network/v1/rpc/private " ,
105+ displayName : "Arbitrum Sepolia Testnet" ,
106+ blockExplorerUrl : "https://sepolia.arbiscan .io" , // Arbitrum Sepolia block explorer URL
113107 ticker : "ETH" ,
114108 tickerName : "Ethereum" ,
115109 decimals : 18 ,
116110} ;
117111
118112function App ( ) {
119- const { coreKitInstance, passkeyPlugin , setCoreKitInstance, coreKitStatus, setCoreKitStatus, provider , setProvider, setWeb3 , setUserInfo, globalLoading, getShareDescriptions } = useCoreKit ( ) ;
113+ const { coreKitInstance, setCoreKitInstance, coreKitStatus, setCoreKitStatus, setProvider, setUserInfo, globalLoading, getShareDescriptions, provider , setWeb3 } = useCoreKit ( ) ;
120114
121115 const [ isLoading , setIsLoading ] = useState ( true ) ;
122116 const navigate = useNavigate ( ) ;
123- const [ selectedTssLib , setSelectedTssLib ] = useState < TssLib > ( tssLibDkls ) ;
124117
125118 async function setupProvider ( chainConfig ?: CustomChainConfig ) {
126119 if ( coreKitInstance . keyType !== KeyType . secp256k1 ) {
@@ -139,10 +132,9 @@ function App() {
139132 if ( coreKitInstance . status === COREKIT_STATUS . NOT_INITIALIZED ) {
140133 await coreKitInstance . init ( { rehydrate : true , handleRedirectResult : false } ) ;
141134 setCoreKitInstance ( coreKitInstance ) ;
142- await passkeyPlugin . initWithMpcCoreKit ( coreKitInstance ) ;
143135 setIsLoading ( false ) ;
144136 }
145- setupProviderPostLogin ( ) ;
137+ await setupProviderPostLogin ( ) ;
146138
147139 if ( coreKitInstance . status === COREKIT_STATUS . REQUIRED_SHARE ) {
148140 navigate ( "/recovery" ) ;
@@ -176,24 +168,10 @@ function App() {
176168 } , [ coreKitStatus ] )
177169
178170 useEffect ( ( ) => {
179- setIsLoading ( globalLoading || false ) ;
180- } , [ globalLoading ] ) ;
181-
182- useEffect ( ( ) => {
183- const instance = new Web3AuthMPCCoreKit ( {
184- web3AuthClientId : "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ" ,
185- web3AuthNetwork : selectedNetwork ,
186- uxMode : "popup" ,
187- manualSync : false ,
188- storage : window . localStorage ,
189- tssLib : selectedTssLib ,
190- useDKG : false ,
191- } ) ;
192- setCoreKitInstance ( instance ) ;
193- if ( instance . status === COREKIT_STATUS . NOT_INITIALIZED ) {
171+ if ( coreKitInstance . status === COREKIT_STATUS . NOT_INITIALIZED ) {
194172 init ( ) ;
195173 }
196- } , [ selectedTssLib ] ) ;
174+ } , [ coreKitInstance ] ) ;
197175
198176 useEffect ( ( ) => {
199177 if ( provider ) {
@@ -286,7 +264,8 @@ function App() {
286264 }
287265 return (
288266 < div className = "container bg-app-gray-100 dark:bg-app-gray-900" >
289- { isLoading ? (
267+ { /* {JSON.stringify(isLoading)} {coreKitInstance.status} */ }
268+ { isLoading || globalLoading ? (
290269 < >
291270 < div className = "h-full flex-grow flex flex-col items-center justify-center" >
292271 < Loader size = { "lg" } showLogo = { true } />
0 commit comments