File tree Expand file tree Collapse file tree 2 files changed +48
-9
lines changed
Expand file tree Collapse file tree 2 files changed +48
-9
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,9 @@ export interface IIframeOptions {
8989 | 'exit_accounts'
9090 | 'logout'
9191 | 'check_auth'
92+ | 'check_identify'
93+ | 'identify'
94+ | 'check_login'
9295 waitResult ?: boolean
9396 silence ?: boolean
9497}
Original file line number Diff line number Diff line change @@ -255,15 +255,34 @@ export class Provider implements IProvider {
255255 this
256256 )
257257 case 'anyweb_identify' :
258- return await callIframe (
259- 'pages/user/identify' ,
260- {
261- appId : this . appId ,
262- chainId : this . chainId ,
263- params : params ? JSON . stringify ( params ) : '' ,
264- } ,
265- this
266- )
258+ let identifyResult
259+ try {
260+ identifyResult = await callIframe (
261+ 'pages/user/identify' ,
262+ {
263+ appId : this . appId ,
264+ chainId : this . chainId ,
265+ params : params ? JSON . stringify ( params ) : '' ,
266+ authType : 'check_identify' ,
267+ silence : true ,
268+ } ,
269+ this
270+ )
271+ console . debug ( '[AnyWeb]' , 'Check identify result' , identifyResult )
272+ } catch ( e ) {
273+ console . debug ( '[AnyWeb]' , 'need to identify' , e )
274+ identifyResult = await callIframe (
275+ 'pages/user/identify' ,
276+ {
277+ appId : this . appId ,
278+ chainId : this . chainId ,
279+ params : params ? JSON . stringify ( params ) : '' ,
280+ authType : 'identify' ,
281+ } ,
282+ this
283+ )
284+ }
285+ return identifyResult
267286 case 'anyweb_logout' :
268287 // Logout the account of AnyWeb
269288 return await callIframe (
@@ -277,6 +296,23 @@ export class Provider implements IProvider {
277296 } ,
278297 this
279298 )
299+ case 'anyweb_loginstate' :
300+ try {
301+ return await callIframe (
302+ 'pages/dapp/auth' ,
303+ {
304+ appId : this . appId ,
305+ params : '' ,
306+ chainId : this . chainId ,
307+ authType : 'check_login' ,
308+ silence : true ,
309+ } ,
310+ this
311+ )
312+ } catch ( e ) {
313+ console . debug ( '[AnyWeb]' , 'need to login' , e )
314+ return false
315+ }
280316 default :
281317 return 'Unsupported method'
282318 }
You can’t perform that action at this time.
0 commit comments