@@ -54,22 +54,22 @@ class _WebViewWithExtensionState extends State<WebViewWithExtension> {
5454 widget.checkAuth != null &&
5555 ! widget.checkAuth !(uri.host)) {
5656 return _controller.runJavascriptReturningResult (
57- 'walletExtension.onAppResponse("${msg ['msgType' ]}", null, new Error("Rejected"))' );
57+ 'walletExtension.onAppResponse("${msg ['msgType' ]}${ msg [ 'id' ]} ", null, new Error("Rejected"))' );
5858 }
5959
6060 switch (msg['msgType' ]) {
6161 case 'pub(authorize.tab)' :
6262 if (widget.onConnectRequest == null ) {
6363 return _controller.runJavascriptReturningResult (
64- 'walletExtension.onAppResponse("${msg ['msgType' ]}", true)' );
64+ 'walletExtension.onAppResponse("${msg ['msgType' ]}${ msg [ 'id' ]} ", true)' );
6565 }
6666 if (_signing) break ;
6767 _signing = true ;
6868 final accept = await widget.onConnectRequest !(
6969 DAppConnectParam .fromJson ({'id' : msg['id' ], 'url' : msg['url' ]}));
7070 _signing = false ;
7171 return _controller.runJavascriptReturningResult (
72- 'walletExtension.onAppResponse("${msg ['msgType' ]}", ${accept ?? false })' );
72+ 'walletExtension.onAppResponse("${msg ['msgType' ]}${ msg [ 'id' ]} ", ${accept ?? false }, null )' );
7373 case 'pub(accounts.list)' :
7474 case 'pub(accounts.subscribe)' :
7575 final List <KeyPairData > ls = widget.keyring.keyPairs;
@@ -82,7 +82,7 @@ class _WebViewWithExtensionState extends State<WebViewWithExtension> {
8282 };
8383 }).toList ();
8484 return _controller.runJavascriptReturningResult (
85- 'walletExtension.onAppResponse("${msg ['msgType' ]}", ${jsonEncode (res )})' );
85+ 'walletExtension.onAppResponse("${msg ['msgType' ]}${ msg [ 'id' ]} ", ${jsonEncode (res )})' );
8686 case 'pub(bytes.sign)' :
8787 if (_signing) break ;
8888 _signing = true ;
@@ -93,10 +93,10 @@ class _WebViewWithExtensionState extends State<WebViewWithExtension> {
9393 if (res == null || res.signature == null ) {
9494 // cancelled
9595 return _controller.runJavascriptReturningResult (
96- 'walletExtension.onAppResponse("${param .msgType }", null, new Error("Rejected"))' );
96+ 'walletExtension.onAppResponse("${param .msgType }${ msg [ 'id' ]} ", null, new Error("Rejected"))' );
9797 }
9898 return _controller.runJavascriptReturningResult (
99- 'walletExtension.onAppResponse("${param .msgType }", ${jsonEncode (res .toJson ())})' );
99+ 'walletExtension.onAppResponse("${param .msgType }${ msg [ 'id' ]} ", ${jsonEncode (res .toJson ())})' );
100100 case 'pub(extrinsic.sign)' :
101101 if (_signing) break ;
102102 _signing = true ;
@@ -107,10 +107,10 @@ class _WebViewWithExtensionState extends State<WebViewWithExtension> {
107107 if (result == null || result.signature == null ) {
108108 // cancelled
109109 return _controller.runJavascriptReturningResult (
110- 'walletExtension.onAppResponse("${params .msgType }", null, new Error("Rejected"))' );
110+ 'walletExtension.onAppResponse("${params .msgType }${ msg [ 'id' ]} ", null, new Error("Rejected"))' );
111111 }
112112 return _controller.runJavascriptReturningResult (
113- 'walletExtension.onAppResponse("${params .msgType }", ${jsonEncode (result .toJson ())})' );
113+ 'walletExtension.onAppResponse("${params .msgType }${ msg [ 'id' ]} ", ${jsonEncode (result .toJson ())})' );
114114 default :
115115 print ('Unknown message from dapp: ${msg ['msgType' ]}' );
116116 return Future (() => "" );
0 commit comments