1
1
import { sha256 } from '@cosmjs/crypto' ;
2
2
import { toUtf8 } from '@cosmjs/encoding' ;
3
3
import eccrypto , { Ecies } from '@toruslabs/eccrypto' ;
4
+ import { AuthAdapter , AuthLoginParams } from '@web3auth/auth-adapter' ;
4
5
import {
5
6
ADAPTER_STATUS ,
6
7
CHAIN_NAMESPACES ,
7
8
CustomChainConfig ,
8
9
SafeEventEmitterProvider ,
10
+ UX_MODE ,
9
11
WALLET_ADAPTERS ,
10
12
} from '@web3auth/base' ;
11
13
import { CommonPrivateKeyProvider } from '@web3auth/base-provider' ;
12
14
import { Web3AuthNoModal } from '@web3auth/no-modal' ;
13
- import {
14
- OpenloginAdapter ,
15
- OpenloginLoginParams ,
16
- UX_MODE ,
17
- } from '@web3auth/openlogin-adapter' ;
18
15
19
16
import {
20
17
FromWorkerMessage ,
@@ -126,15 +123,21 @@ export const connectClientAndProvider = async (
126
123
chainId : 'other' ,
127
124
rpcTarget : 'other' ,
128
125
displayName : 'other' ,
129
- blockExplorer : 'other' ,
126
+ blockExplorerUrl : 'other' ,
130
127
ticker : 'other' ,
131
128
tickerName : 'other' ,
132
129
...options . client . chainConfig ,
133
130
chainNamespace : CHAIN_NAMESPACES . OTHER ,
134
131
} ;
132
+ const privateKeyProvider = new CommonPrivateKeyProvider ( {
133
+ config : {
134
+ chainConfig,
135
+ } ,
136
+ } ) ;
135
137
const client = new Web3AuthNoModal ( {
136
138
...options . client ,
137
139
chainConfig,
140
+ privateKeyProvider,
138
141
} ) ;
139
142
140
143
// Popups are blocked by default on mobile browsers, so use redirect. Popup is
@@ -154,29 +157,23 @@ export const connectClientAndProvider = async (
154
157
) ;
155
158
}
156
159
157
- const privateKeyProvider = new CommonPrivateKeyProvider ( {
158
- config : {
159
- chainConfig,
160
- } ,
161
- } ) ;
162
- const openloginAdapter = new OpenloginAdapter ( {
163
- privateKeyProvider,
160
+ const authAdapter = new AuthAdapter ( {
164
161
adapterSettings : {
165
162
uxMode,
166
163
} ,
167
164
} ) ;
168
- client . configureAdapter ( openloginAdapter ) ;
165
+ client . configureAdapter ( authAdapter ) ;
169
166
170
167
await client . init ( ) ;
171
168
172
169
let provider = client . connected ? client . provider : null ;
173
170
if ( ! client . connected && ! dontAttemptLogin ) {
174
171
try {
175
172
const loginHint = options . getLoginHint ?.( ) ;
176
- provider = await client . connectTo ( WALLET_ADAPTERS . OPENLOGIN , {
173
+ provider = await client . connectTo ( WALLET_ADAPTERS . AUTH , {
177
174
loginProvider : options . loginProvider ,
178
175
login_hint : loginHint ,
179
- } as OpenloginLoginParams ) ;
176
+ } as AuthLoginParams ) ;
180
177
} catch ( err ) {
181
178
// Unnecessary error thrown during redirect, so log and ignore it.
182
179
if (
0 commit comments