@@ -54,22 +54,22 @@ class _WebViewWithExtensionState extends State<WebViewWithExtension> {
54
54
widget.checkAuth != null &&
55
55
! widget.checkAuth !(uri.host)) {
56
56
return _controller.runJavascriptReturningResult (
57
- 'walletExtension.onAppResponse("${msg ['msgType' ]}", null, new Error("Rejected"))' );
57
+ 'walletExtension.onAppResponse("${msg ['msgType' ]}${ msg [ 'id' ]} ", null, new Error("Rejected"))' );
58
58
}
59
59
60
60
switch (msg['msgType' ]) {
61
61
case 'pub(authorize.tab)' :
62
62
if (widget.onConnectRequest == null ) {
63
63
return _controller.runJavascriptReturningResult (
64
- 'walletExtension.onAppResponse("${msg ['msgType' ]}", true)' );
64
+ 'walletExtension.onAppResponse("${msg ['msgType' ]}${ msg [ 'id' ]} ", true)' );
65
65
}
66
66
if (_signing) break ;
67
67
_signing = true ;
68
68
final accept = await widget.onConnectRequest !(
69
69
DAppConnectParam .fromJson ({'id' : msg['id' ], 'url' : msg['url' ]}));
70
70
_signing = false ;
71
71
return _controller.runJavascriptReturningResult (
72
- 'walletExtension.onAppResponse("${msg ['msgType' ]}", ${accept ?? false })' );
72
+ 'walletExtension.onAppResponse("${msg ['msgType' ]}${ msg [ 'id' ]} ", ${accept ?? false }, null )' );
73
73
case 'pub(accounts.list)' :
74
74
case 'pub(accounts.subscribe)' :
75
75
final List <KeyPairData > ls = widget.keyring.keyPairs;
@@ -82,7 +82,7 @@ class _WebViewWithExtensionState extends State<WebViewWithExtension> {
82
82
};
83
83
}).toList ();
84
84
return _controller.runJavascriptReturningResult (
85
- 'walletExtension.onAppResponse("${msg ['msgType' ]}", ${jsonEncode (res )})' );
85
+ 'walletExtension.onAppResponse("${msg ['msgType' ]}${ msg [ 'id' ]} ", ${jsonEncode (res )})' );
86
86
case 'pub(bytes.sign)' :
87
87
if (_signing) break ;
88
88
_signing = true ;
@@ -93,10 +93,10 @@ class _WebViewWithExtensionState extends State<WebViewWithExtension> {
93
93
if (res == null || res.signature == null ) {
94
94
// cancelled
95
95
return _controller.runJavascriptReturningResult (
96
- 'walletExtension.onAppResponse("${param .msgType }", null, new Error("Rejected"))' );
96
+ 'walletExtension.onAppResponse("${param .msgType }${ msg [ 'id' ]} ", null, new Error("Rejected"))' );
97
97
}
98
98
return _controller.runJavascriptReturningResult (
99
- 'walletExtension.onAppResponse("${param .msgType }", ${jsonEncode (res .toJson ())})' );
99
+ 'walletExtension.onAppResponse("${param .msgType }${ msg [ 'id' ]} ", ${jsonEncode (res .toJson ())})' );
100
100
case 'pub(extrinsic.sign)' :
101
101
if (_signing) break ;
102
102
_signing = true ;
@@ -107,10 +107,10 @@ class _WebViewWithExtensionState extends State<WebViewWithExtension> {
107
107
if (result == null || result.signature == null ) {
108
108
// cancelled
109
109
return _controller.runJavascriptReturningResult (
110
- 'walletExtension.onAppResponse("${params .msgType }", null, new Error("Rejected"))' );
110
+ 'walletExtension.onAppResponse("${params .msgType }${ msg [ 'id' ]} ", null, new Error("Rejected"))' );
111
111
}
112
112
return _controller.runJavascriptReturningResult (
113
- 'walletExtension.onAppResponse("${params .msgType }", ${jsonEncode (result .toJson ())})' );
113
+ 'walletExtension.onAppResponse("${params .msgType }${ msg [ 'id' ]} ", ${jsonEncode (result .toJson ())})' );
114
114
default :
115
115
print ('Unknown message from dapp: ${msg ['msgType' ]}' );
116
116
return Future (() => "" );
0 commit comments