@@ -8,7 +8,7 @@ import type { Signer } from 'ethers'
8
8
import { useEffect , useMemo , useState } from 'react'
9
9
import { whenDefined , whenDefinedAll } from '@devprotocol/util-ts'
10
10
import { i18nFactory , Signal } from '@devprotocol/clubs-core'
11
- import type { connection as Connection } from '@devprotocol/clubs-core/connection'
11
+ import { connection } from '@devprotocol/clubs-core/connection'
12
12
import {
13
13
DynamicUserProfile ,
14
14
useDynamicContext ,
@@ -33,7 +33,6 @@ export default ({
33
33
buttonClassName ?: string
34
34
} ) => {
35
35
const dynamic = useDynamicContext ( )
36
- const [ connection , setConnection ] = useState < ReturnType < typeof Connection > > ( )
37
36
const [ signer , setSigner ] = useState < Signer > ( )
38
37
const [ walletName , setWalletName ] = useState < string > ( )
39
38
const [ isWalletNeeded , setIsWalletNeeded ] = useState < boolean > ( false )
@@ -55,7 +54,7 @@ export default ({
55
54
56
55
useEffect ( ( ) => {
57
56
const cryptoWallet = dynamic . user ?. verifiedCredentials . find (
58
- ( c ) => c . format === 'blockchain' ,
57
+ ( c ) => c . format === 'blockchain' && Boolean ( c . embeddedWalletId ) ,
59
58
)
60
59
61
60
if ( cryptoWallet ) {
@@ -85,7 +84,7 @@ export default ({
85
84
setUnexpectedNetwork (
86
85
typeof chainId === 'number' && connectedChain !== chainId ,
87
86
)
88
- whenDefinedAll ( [ connection ] , ( [ _connection ] ) =>
87
+ whenDefinedAll ( [ connection ( ) ] , ( [ _connection ] ) =>
89
88
_connection . chain . next ( Number ( dynamic . network ) ) ,
90
89
)
91
90
} , [ dynamic . network ] )
@@ -95,7 +94,7 @@ export default ({
95
94
( c ) => c . format === 'email' ,
96
95
)
97
96
console . log ( '**' , { emailCredential } )
98
- whenDefinedAll ( [ connection ] , ( [ _connection ] ) =>
97
+ whenDefinedAll ( [ connection ( ) ] , ( [ _connection ] ) =>
99
98
_connection . identifiers . next (
100
99
whenDefined ( emailCredential ?. publicIdentifier , ( email ) => ( {
101
100
email,
@@ -104,12 +103,6 @@ export default ({
104
103
)
105
104
} , [ dynamic . user ] )
106
105
107
- useEffect ( ( ) => {
108
- import ( '@devprotocol/clubs-core/connection' ) . then ( ( C ) => {
109
- setConnection ( C . connection ( ) )
110
- } )
111
- } , [ ] )
112
-
113
106
useEffect ( ( ) => {
114
107
const eoa = dynamic ?. primaryWallet ?. address
115
108
if ( eoa ) {
@@ -122,14 +115,14 @@ export default ({
122
115
} , [ dynamic ?. primaryWallet ?. address ] )
123
116
124
117
useEffect ( ( ) => {
125
- whenDefinedAll ( [ connection ] , ( [ _connection ] ) => {
118
+ whenDefinedAll ( [ connection ( ) ] , ( [ _connection ] ) => {
126
119
// console.log('Called here', signer)
127
120
_connection . signer . next ( signer )
128
121
} )
129
- } , [ signer , connection ] )
122
+ } , [ signer ] )
130
123
131
124
useEffect ( ( ) => {
132
- whenDefinedAll ( [ connection ] , ( [ _connection ] ) => {
125
+ whenDefinedAll ( [ connection ( ) ] , ( [ _connection ] ) => {
133
126
// console.log('$$$ Called here', signer)
134
127
135
128
// signal
@@ -151,7 +144,7 @@ export default ({
151
144
}
152
145
} )
153
146
} )
154
- } , [ connection ] )
147
+ } , [ ] )
155
148
156
149
return (
157
150
< span className = "group/awesome-onboarding relative block" >
0 commit comments