5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
7
8
- import React , { useEffect , useState } from 'react' ;
8
+ import React , { useEffect } from 'react' ;
9
9
import { useDispatch , useSelector } from 'react-redux' ;
10
10
import { types } from '../../actions' ;
11
11
import { getGlobalWallet } from '../../modules/wallet' ;
@@ -25,48 +25,20 @@ export const ReownModalTypes = {
25
25
26
26
export function ReownModal ( { manageDomLifecycle, data, type, onAcceptAction, onRejectAction } ) {
27
27
const modalDomId = 'reownModal' ;
28
- const dispatch = useDispatch ( ) ;
29
- const [ firstAddress , setFirstAddress ] = useState ( '' ) ;
30
28
31
29
useEffect ( ( ) => {
32
30
manageDomLifecycle ( `#${ modalDomId } ` ) ;
33
31
} , [ ] ) ;
34
32
35
- useEffect ( ( ) => {
36
- if ( data ?. data ?. blueprintId ) {
37
- dispatch ( {
38
- type : types . BLUEPRINT_FETCH_REQUESTED ,
39
- payload : data . data . blueprintId
40
- } ) ;
41
- }
42
- } , [ data ?. data ?. blueprintId ] ) ;
43
-
44
- useEffect ( ( ) => {
45
- const loadFirstAddress = async ( ) => {
46
- const wallet = getGlobalWallet ( ) ;
47
- if ( wallet . isReady ( ) ) {
48
- const address = await wallet . getAddressAtIndex ( 0 ) ;
49
- setFirstAddress ( address ) ;
50
- }
33
+ const handleAccept = ( acceptedData ) => {
34
+ const ncData = {
35
+ blueprintId : acceptedData . blueprintId ,
36
+ method : acceptedData . method ,
37
+ args : acceptedData . args ,
38
+ actions : acceptedData . actions ,
39
+ caller : acceptedData . caller ,
51
40
} ;
52
- loadFirstAddress ( ) ;
53
- } , [ ] ) ;
54
-
55
- const handleAccept = ( ) => {
56
- if ( type === ReownModalTypes . SEND_NANO_CONTRACT_TX ) {
57
- // Process the nano contract transaction
58
- // Create a new object with the same properties
59
- const ncData = {
60
- blueprintId : data . data . blueprintId ,
61
- method : data . data . method ,
62
- args : data . data . args ,
63
- actions : data . data . actions ,
64
- caller : firstAddress
65
- } ;
66
- onAcceptAction ( ncData ) ;
67
- } else {
68
- onAcceptAction ( data ) ;
69
- }
41
+ onAcceptAction ( ncData ) ;
70
42
} ;
71
43
72
44
const handleReject = ( ) => {
@@ -87,8 +59,7 @@ export function ReownModal({ manageDomLifecycle, data, type, onAcceptAction, onR
87
59
case ReownModalTypes . SEND_NANO_CONTRACT_TX :
88
60
return (
89
61
< SendNanoContractTxModal
90
- data = { data }
91
- firstAddress = { firstAddress }
62
+ data = { data }
92
63
onAccept = { handleAccept }
93
64
onReject = { handleReject }
94
65
/>
0 commit comments