@reown/appkit-react-native 0.0.0-develop-20251114152149 → 0.0.0-develop-20251114183547
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/views/w3m-connecting-view/index.js +10 -14
- package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-view/index.js +11 -15
- package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/views/w3m-connecting-view/index.tsx +12 -18
|
@@ -24,21 +24,20 @@ function ConnectingView() {
|
|
|
24
24
|
const {
|
|
25
25
|
data
|
|
26
26
|
} = _appkitCoreReactNative.RouterController.state;
|
|
27
|
-
const
|
|
27
|
+
const lastRetryRef = (0, _react.useRef)(Date.now());
|
|
28
28
|
const isQr = !data?.wallet;
|
|
29
29
|
const isInstalled = !!installed?.find(wallet => wallet.id === data?.wallet?.id);
|
|
30
30
|
const [platform, setPlatform] = (0, _react.useState)();
|
|
31
31
|
const [platforms, setPlatforms] = (0, _react.useState)([]);
|
|
32
32
|
const onRetry = () => {
|
|
33
|
-
if (_appkitCoreReactNative.CoreHelperUtil.isAllowedRetry(
|
|
34
|
-
|
|
35
|
-
_appkitCoreReactNative.WcController.clearUri();
|
|
33
|
+
if (_appkitCoreReactNative.CoreHelperUtil.isAllowedRetry(lastRetryRef.current)) {
|
|
34
|
+
lastRetryRef.current = Date.now();
|
|
36
35
|
initializeConnection(true);
|
|
37
36
|
} else {
|
|
38
37
|
_appkitCoreReactNative.SnackController.showError('Please wait a second before retrying');
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
|
-
const initializeConnection = async (retry = false
|
|
40
|
+
const initializeConnection = async (retry = false) => {
|
|
42
41
|
try {
|
|
43
42
|
const {
|
|
44
43
|
wcPairingExpiry
|
|
@@ -49,6 +48,7 @@ function ConnectingView() {
|
|
|
49
48
|
const isPairingExpired = _appkitCoreReactNative.CoreHelperUtil.isPairingExpired(wcPairingExpiry);
|
|
50
49
|
if (retry || isPairingExpired) {
|
|
51
50
|
_appkitCoreReactNative.WcController.setWcError(false);
|
|
51
|
+
_appkitCoreReactNative.WcController.clearUri();
|
|
52
52
|
const connectPromise = connect({
|
|
53
53
|
wallet: routeData?.wallet
|
|
54
54
|
});
|
|
@@ -58,14 +58,6 @@ function ConnectingView() {
|
|
|
58
58
|
} catch (error) {
|
|
59
59
|
_appkitCoreReactNative.LogController.sendError(error, 'ConnectingView.tsx', 'initializeConnection');
|
|
60
60
|
_appkitCoreReactNative.WcController.setWcError(true);
|
|
61
|
-
_appkitCoreReactNative.WcController.clearUri();
|
|
62
|
-
const currentRetryTime = retryTimestamp ?? lastRetry;
|
|
63
|
-
if (isQr && _appkitCoreReactNative.CoreHelperUtil.isAllowedRetry(currentRetryTime)) {
|
|
64
|
-
const newRetryTime = Date.now();
|
|
65
|
-
setLastRetry(newRetryTime);
|
|
66
|
-
initializeConnection(true, newRetryTime);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
61
|
const isUserRejected = _appkitCommonReactNative.ErrorUtil.isUserRejectedRequestError(error);
|
|
70
62
|
const isProposalExpired = _appkitCommonReactNative.ErrorUtil.isProposalExpiredError(error);
|
|
71
63
|
if (!isProposalExpired) {
|
|
@@ -78,6 +70,10 @@ function ConnectingView() {
|
|
|
78
70
|
message: error?.message ?? 'Unknown'
|
|
79
71
|
}
|
|
80
72
|
});
|
|
73
|
+
if (isQr && _appkitCoreReactNative.CoreHelperUtil.isAllowedRetry(lastRetryRef.current)) {
|
|
74
|
+
lastRetryRef.current = Date.now();
|
|
75
|
+
initializeConnection(true);
|
|
76
|
+
}
|
|
81
77
|
}
|
|
82
78
|
};
|
|
83
79
|
const onCopyUri = uri => {
|
|
@@ -101,7 +97,7 @@ function ConnectingView() {
|
|
|
101
97
|
setPlatform(_platforms[0]);
|
|
102
98
|
}, [data, isInstalled]);
|
|
103
99
|
(0, _react.useEffect)(() => {
|
|
104
|
-
initializeConnection();
|
|
100
|
+
initializeConnection(true);
|
|
105
101
|
let _interval;
|
|
106
102
|
|
|
107
103
|
// Check if the pairing expired every 10 seconds. If expired, it will create a new uri.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_valtio","require","_react","_appkitCommonReactNative","_appkitCoreReactNative","_AppKitContext","_w3mConnectingQrcode","_w3mConnectingMobile","_w3mConnectingWeb","_w3mConnectingHeader","_jsxRuntime","ConnectingView","connect","useInternalAppKit","installed","useSnapshot","ApiController","state","data","RouterController","
|
|
1
|
+
{"version":3,"names":["_valtio","require","_react","_appkitCommonReactNative","_appkitCoreReactNative","_AppKitContext","_w3mConnectingQrcode","_w3mConnectingMobile","_w3mConnectingWeb","_w3mConnectingHeader","_jsxRuntime","ConnectingView","connect","useInternalAppKit","installed","useSnapshot","ApiController","state","data","RouterController","lastRetryRef","useRef","Date","now","isQr","wallet","isInstalled","find","id","platform","setPlatform","useState","platforms","setPlatforms","onRetry","CoreHelperUtil","isAllowedRetry","current","initializeConnection","SnackController","showError","retry","wcPairingExpiry","WcController","routeData","isPairingExpired","setWcError","clearUri","connectPromise","setWcPromise","error","LogController","sendError","isUserRejected","ErrorUtil","isUserRejectedRequestError","isProposalExpired","isProposalExpiredError","EventsController","sendEvent","type","event","properties","message","onCopyUri","uri","OptionsController","isClipboardAvailable","copyToClipboard","showSuccess","onSelectPlatform","tab","useLayoutEffect","_platforms","mobile_link","push","webapp_link","useEffect","_interval","setInterval","ConstantsUtil","TEN_SEC_MS","clearInterval","jsxs","Fragment","children","length","jsx","ConnectingHeader","ConnectingQrCode","ConnectingMobile","ConnectingWeb"],"sourceRoot":"../../../../src","sources":["views/w3m-connecting-view/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;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GAAG,CAAC,gBACnB,IAAA5E,WAAA,CAAA6E,GAAA,EAAC9E,oBAAA,CAAA+E,gBAAgB;MAACxD,SAAS,EAAEA,SAAU;MAACsC,gBAAgB,EAAEA;IAAiB,CAAE,CAAC,GAC5E,IAAI,EACP9C,IAAI,gBACH,IAAAd,WAAA,CAAA6E,GAAA,EAACjF,oBAAA,CAAAmF,gBAAgB,IAAE,CAAC,GAClB5D,QAAQ,KAAK,QAAQ,gBACvB,IAAAnB,WAAA,CAAA6E,GAAA,EAAChF,oBAAA,CAAAmF,gBAAgB;MAACxD,OAAO,EAAEA,OAAQ;MAAC8B,SAAS,EAAEA,SAAU;MAACtC,WAAW,EAAEA;IAAY,CAAE,CAAC,GACpFG,QAAQ,KAAK,KAAK,gBACpB,IAAAnB,WAAA,CAAA6E,GAAA,EAAC/E,iBAAA,CAAAmF,aAAa;MAAC3B,SAAS,EAAEA;IAAU,CAAE,CAAC,GACrC,IAAI;EAAA,CACR,CAAC;AAEP","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useSnapshot } from 'valtio';
|
|
4
|
-
import { useEffect, useLayoutEffect, useState } from 'react';
|
|
4
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
5
5
|
import { ErrorUtil } from '@reown/appkit-common-react-native';
|
|
6
6
|
import { WcController, ConstantsUtil, CoreHelperUtil, RouterController, SnackController, OptionsController, ApiController, EventsController, LogController } from '@reown/appkit-core-react-native';
|
|
7
7
|
import { useInternalAppKit } from '../../AppKitContext';
|
|
@@ -20,21 +20,20 @@ export function ConnectingView() {
|
|
|
20
20
|
const {
|
|
21
21
|
data
|
|
22
22
|
} = RouterController.state;
|
|
23
|
-
const
|
|
23
|
+
const lastRetryRef = useRef(Date.now());
|
|
24
24
|
const isQr = !data?.wallet;
|
|
25
25
|
const isInstalled = !!installed?.find(wallet => wallet.id === data?.wallet?.id);
|
|
26
26
|
const [platform, setPlatform] = useState();
|
|
27
27
|
const [platforms, setPlatforms] = useState([]);
|
|
28
28
|
const onRetry = () => {
|
|
29
|
-
if (CoreHelperUtil.isAllowedRetry(
|
|
30
|
-
|
|
31
|
-
WcController.clearUri();
|
|
29
|
+
if (CoreHelperUtil.isAllowedRetry(lastRetryRef.current)) {
|
|
30
|
+
lastRetryRef.current = Date.now();
|
|
32
31
|
initializeConnection(true);
|
|
33
32
|
} else {
|
|
34
33
|
SnackController.showError('Please wait a second before retrying');
|
|
35
34
|
}
|
|
36
35
|
};
|
|
37
|
-
const initializeConnection = async (retry = false
|
|
36
|
+
const initializeConnection = async (retry = false) => {
|
|
38
37
|
try {
|
|
39
38
|
const {
|
|
40
39
|
wcPairingExpiry
|
|
@@ -45,6 +44,7 @@ export function ConnectingView() {
|
|
|
45
44
|
const isPairingExpired = CoreHelperUtil.isPairingExpired(wcPairingExpiry);
|
|
46
45
|
if (retry || isPairingExpired) {
|
|
47
46
|
WcController.setWcError(false);
|
|
47
|
+
WcController.clearUri();
|
|
48
48
|
const connectPromise = connect({
|
|
49
49
|
wallet: routeData?.wallet
|
|
50
50
|
});
|
|
@@ -54,14 +54,6 @@ export function ConnectingView() {
|
|
|
54
54
|
} catch (error) {
|
|
55
55
|
LogController.sendError(error, 'ConnectingView.tsx', 'initializeConnection');
|
|
56
56
|
WcController.setWcError(true);
|
|
57
|
-
WcController.clearUri();
|
|
58
|
-
const currentRetryTime = retryTimestamp ?? lastRetry;
|
|
59
|
-
if (isQr && CoreHelperUtil.isAllowedRetry(currentRetryTime)) {
|
|
60
|
-
const newRetryTime = Date.now();
|
|
61
|
-
setLastRetry(newRetryTime);
|
|
62
|
-
initializeConnection(true, newRetryTime);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
57
|
const isUserRejected = ErrorUtil.isUserRejectedRequestError(error);
|
|
66
58
|
const isProposalExpired = ErrorUtil.isProposalExpiredError(error);
|
|
67
59
|
if (!isProposalExpired) {
|
|
@@ -74,6 +66,10 @@ export function ConnectingView() {
|
|
|
74
66
|
message: error?.message ?? 'Unknown'
|
|
75
67
|
}
|
|
76
68
|
});
|
|
69
|
+
if (isQr && CoreHelperUtil.isAllowedRetry(lastRetryRef.current)) {
|
|
70
|
+
lastRetryRef.current = Date.now();
|
|
71
|
+
initializeConnection(true);
|
|
72
|
+
}
|
|
77
73
|
}
|
|
78
74
|
};
|
|
79
75
|
const onCopyUri = uri => {
|
|
@@ -97,7 +93,7 @@ export function ConnectingView() {
|
|
|
97
93
|
setPlatform(_platforms[0]);
|
|
98
94
|
}, [data, isInstalled]);
|
|
99
95
|
useEffect(() => {
|
|
100
|
-
initializeConnection();
|
|
96
|
+
initializeConnection(true);
|
|
101
97
|
let _interval;
|
|
102
98
|
|
|
103
99
|
// Check if the pairing expired every 10 seconds. If expired, it will create a new uri.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSnapshot","useEffect","useLayoutEffect","useState","ErrorUtil","WcController","ConstantsUtil","CoreHelperUtil","RouterController","SnackController","OptionsController","ApiController","EventsController","LogController","useInternalAppKit","ConnectingQrCode","ConnectingMobile","ConnectingWeb","ConnectingHeader","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ConnectingView","connect","installed","state","data","
|
|
1
|
+
{"version":3,"names":["useSnapshot","useEffect","useLayoutEffect","useRef","useState","ErrorUtil","WcController","ConstantsUtil","CoreHelperUtil","RouterController","SnackController","OptionsController","ApiController","EventsController","LogController","useInternalAppKit","ConnectingQrCode","ConnectingMobile","ConnectingWeb","ConnectingHeader","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ConnectingView","connect","installed","state","data","lastRetryRef","Date","now","isQr","wallet","isInstalled","find","id","platform","setPlatform","platforms","setPlatforms","onRetry","isAllowedRetry","current","initializeConnection","showError","retry","wcPairingExpiry","routeData","isPairingExpired","setWcError","clearUri","connectPromise","setWcPromise","error","sendError","isUserRejected","isUserRejectedRequestError","isProposalExpired","isProposalExpiredError","sendEvent","type","event","properties","message","onCopyUri","uri","isClipboardAvailable","copyToClipboard","showSuccess","onSelectPlatform","tab","_platforms","mobile_link","push","webapp_link","_interval","setInterval","TEN_SEC_MS","clearInterval","children","length"],"sourceRoot":"../../../../src","sources":["views/w3m-connecting-view/index.tsx"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,QAAQ;AACpC,SAASC,SAAS,EAAEC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACpE,SAASC,SAAS,QAAuB,mCAAmC;AAC5E,SACEC,YAAY,EACZC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,eAAe,EACfC,iBAAiB,EACjBC,aAAa,EACbC,gBAAgB,EAChBC,aAAa,QACR,iCAAiC;AACxC,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,SAASC,aAAa,QAAQ,mCAAmC;AACjE,SAASC,gBAAgB,QAAQ,sCAAsC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAExE,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,MAAM;IAAEC;EAAQ,CAAC,GAAGZ,iBAAiB,CAAC,CAAC;EACvC,MAAM;IAAEa;EAAU,CAAC,GAAG5B,WAAW,CAACY,aAAa,CAACiB,KAAK,CAAC;EACtD,MAAM;IAAEC;EAAK,CAAC,GAAGrB,gBAAgB,CAACoB,KAAK;EACvC,MAAME,YAAY,GAAG5B,MAAM,CAAS6B,IAAI,CAACC,GAAG,CAAC,CAAC,CAAC;EAC/C,MAAMC,IAAI,GAAG,CAACJ,IAAI,EAAEK,MAAM;EAC1B,MAAMC,WAAW,GAAG,CAAC,CAACR,SAAS,EAAES,IAAI,CAACF,MAAM,IAAIA,MAAM,CAACG,EAAE,KAAKR,IAAI,EAAEK,MAAM,EAAEG,EAAE,CAAC;EAE/E,MA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C,WAAW,CAACkC,UAAU,CAAC,CAAC,CAAC,CAAC;EAC5B,CAAC,EAAE,CAAC5C,IAAI,EAAEM,WAAW,CAAC,CAAC;EAEvBnC,SAAS,CAAC,MAAM;IACd6C,oBAAoB,CAAC,IAAI,CAAC;IAC1B,IAAIgC,SAAyB;;IAE7B;IACA,IAAI5C,IAAI,EAAE;MACR4C,SAAS,GAAGC,WAAW,CAACjC,oBAAoB,EAAEvC,aAAa,CAACyE,UAAU,CAAC;IACzE;IAEA,OAAO,MAAMC,aAAa,CAACH,SAAS,CAAC;IACrC;EACF,CAAC,EAAE,CAAC5C,IAAI,CAAC,CAAC;EAEV,oBACET,KAAA,CAAAF,SAAA;IAAA2D,QAAA,GACGzC,SAAS,CAAC0C,MAAM,GAAG,CAAC,gBACnB9D,IAAA,CAACF,gBAAgB;MAACsB,SAAS,EAAEA,SAAU;MAAC+B,gBAAgB,EAAEA;IAAiB,CAAE,CAAC,GAC5E,IAAI,EACPtC,IAAI,gBACHb,IAAA,CAACL,gBAAgB,IAAE,CAAC,GAClBuB,QAAQ,KAAK,QAAQ,gBACvBlB,IAAA,CAACJ,gBAAgB;MAAC0B,OAAO,EAAEA,OAAQ;MAACwB,SAAS,EAAEA,SAAU;MAAC/B,WAAW,EAAEA;IAAY,CAAE,CAAC,GACpFG,QAAQ,KAAK,KAAK,gBACpBlB,IAAA,CAACH,aAAa;MAACiD,SAAS,EAAEA;IAAU,CAAE,CAAC,GACrC,IAAI;EAAA,CACR,CAAC;AAEP","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-view/index.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-view/index.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,cAAc,4CAiH7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-react-native",
|
|
3
|
-
"version": "0.0.0-develop-
|
|
3
|
+
"version": "0.0.0-develop-20251114183547",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"provenance": true
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@reown/appkit-common-react-native": "0.0.0-develop-
|
|
44
|
-
"@reown/appkit-core-react-native": "0.0.0-develop-
|
|
45
|
-
"@reown/appkit-ui-react-native": "0.0.0-develop-
|
|
43
|
+
"@reown/appkit-common-react-native": "0.0.0-develop-20251114183547",
|
|
44
|
+
"@reown/appkit-core-react-native": "0.0.0-develop-20251114183547",
|
|
45
|
+
"@reown/appkit-ui-react-native": "0.0.0-develop-20251114183547",
|
|
46
46
|
"@walletconnect/universal-provider": "2.21.10",
|
|
47
47
|
"valtio": "2.1.8"
|
|
48
48
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
|
-
import { useEffect, useLayoutEffect, useState } from 'react';
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import { ErrorUtil, type Platform } from '@reown/appkit-common-react-native';
|
|
4
4
|
import {
|
|
5
5
|
WcController,
|
|
@@ -22,7 +22,7 @@ export function ConnectingView() {
|
|
|
22
22
|
const { connect } = useInternalAppKit();
|
|
23
23
|
const { installed } = useSnapshot(ApiController.state);
|
|
24
24
|
const { data } = RouterController.state;
|
|
25
|
-
const
|
|
25
|
+
const lastRetryRef = useRef<number>(Date.now());
|
|
26
26
|
const isQr = !data?.wallet;
|
|
27
27
|
const isInstalled = !!installed?.find(wallet => wallet.id === data?.wallet?.id);
|
|
28
28
|
|
|
@@ -30,22 +30,22 @@ export function ConnectingView() {
|
|
|
30
30
|
const [platforms, setPlatforms] = useState<Platform[]>([]);
|
|
31
31
|
|
|
32
32
|
const onRetry = () => {
|
|
33
|
-
if (CoreHelperUtil.isAllowedRetry(
|
|
34
|
-
|
|
35
|
-
WcController.clearUri();
|
|
33
|
+
if (CoreHelperUtil.isAllowedRetry(lastRetryRef.current)) {
|
|
34
|
+
lastRetryRef.current = Date.now();
|
|
36
35
|
initializeConnection(true);
|
|
37
36
|
} else {
|
|
38
37
|
SnackController.showError('Please wait a second before retrying');
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
|
|
42
|
-
const initializeConnection = async (retry = false
|
|
41
|
+
const initializeConnection = async (retry = false) => {
|
|
43
42
|
try {
|
|
44
43
|
const { wcPairingExpiry } = WcController.state;
|
|
45
44
|
const { data: routeData } = RouterController.state;
|
|
46
45
|
const isPairingExpired = CoreHelperUtil.isPairingExpired(wcPairingExpiry);
|
|
47
46
|
if (retry || isPairingExpired) {
|
|
48
47
|
WcController.setWcError(false);
|
|
48
|
+
WcController.clearUri();
|
|
49
49
|
|
|
50
50
|
const connectPromise = connect({
|
|
51
51
|
wallet: routeData?.wallet
|
|
@@ -56,17 +56,6 @@ export function ConnectingView() {
|
|
|
56
56
|
} catch (error) {
|
|
57
57
|
LogController.sendError(error, 'ConnectingView.tsx', 'initializeConnection');
|
|
58
58
|
WcController.setWcError(true);
|
|
59
|
-
WcController.clearUri();
|
|
60
|
-
|
|
61
|
-
const currentRetryTime = retryTimestamp ?? lastRetry;
|
|
62
|
-
|
|
63
|
-
if (isQr && CoreHelperUtil.isAllowedRetry(currentRetryTime)) {
|
|
64
|
-
const newRetryTime = Date.now();
|
|
65
|
-
setLastRetry(newRetryTime);
|
|
66
|
-
initializeConnection(true, newRetryTime);
|
|
67
|
-
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
59
|
|
|
71
60
|
const isUserRejected = ErrorUtil.isUserRejectedRequestError(error);
|
|
72
61
|
const isProposalExpired = ErrorUtil.isProposalExpiredError(error);
|
|
@@ -83,6 +72,11 @@ export function ConnectingView() {
|
|
|
83
72
|
message: (error as Error)?.message ?? 'Unknown'
|
|
84
73
|
}
|
|
85
74
|
});
|
|
75
|
+
|
|
76
|
+
if (isQr && CoreHelperUtil.isAllowedRetry(lastRetryRef.current)) {
|
|
77
|
+
lastRetryRef.current = Date.now();
|
|
78
|
+
initializeConnection(true);
|
|
79
|
+
}
|
|
86
80
|
}
|
|
87
81
|
};
|
|
88
82
|
|
|
@@ -111,7 +105,7 @@ export function ConnectingView() {
|
|
|
111
105
|
}, [data, isInstalled]);
|
|
112
106
|
|
|
113
107
|
useEffect(() => {
|
|
114
|
-
initializeConnection();
|
|
108
|
+
initializeConnection(true);
|
|
115
109
|
let _interval: NodeJS.Timeout;
|
|
116
110
|
|
|
117
111
|
// Check if the pairing expired every 10 seconds. If expired, it will create a new uri.
|