1
1
using System . Collections . Generic ;
2
2
using System . IO ;
3
+ using System . Linq ;
3
4
using TMPro ;
4
5
using UnityEngine ;
5
6
@@ -17,7 +18,7 @@ public class EcosystemWalletManager : MonoBehaviour
17
18
public TMP_Text LogText ;
18
19
19
20
private ThirdwebClient _client ;
20
- private EcosystemWallet _ecosystemWallet ;
21
+ private IThirdwebWallet _ecosystemWallet ;
21
22
22
23
private void Awake ( )
23
24
{
@@ -96,15 +97,16 @@ public async void Login()
96
97
}
97
98
98
99
string address ;
99
- if ( await _ecosystemWallet . IsConnected ( ) )
100
+ if ( ! await _ecosystemWallet . IsConnected ( ) && _ecosystemWallet is EcosystemWallet )
100
101
{
101
- address = await _ecosystemWallet . GetAddress ( ) ;
102
- Log ( $ "Connected with address: { address } ") ;
103
- return ;
102
+ _ = await ( _ecosystemWallet as EcosystemWallet ) . SendOTP ( ) ;
103
+ _ecosystemWallet = await EcosystemWalletModal . LoginWithOtp ( _ecosystemWallet as EcosystemWallet ) ;
104
104
}
105
105
106
- _ = await _ecosystemWallet . SendOTP ( ) ;
107
- _ecosystemWallet = await EcosystemWalletModal . LoginWithOtp ( _ecosystemWallet ) ;
106
+ if ( _ecosystemWallet is not SmartWallet )
107
+ {
108
+ _ecosystemWallet = await SmartWallet . Create ( _ecosystemWallet , 421614 , gasless : true ) ;
109
+ }
108
110
109
111
address = await _ecosystemWallet . GetAddress ( ) ;
110
112
Log ( $ "Connected with address: { address } ") ;
@@ -132,10 +134,9 @@ public async void SignTransaction()
132
134
}
133
135
134
136
var address = await _ecosystemWallet . GetAddress ( ) ;
135
- var nonce = await _ecosystemWallet . GetTransactionCount ( chainId : 421614 , blocktag : "pending" ) ;
136
- var tx = new ThirdwebTransactionInput ( chainId : 421614 , from : address , to : address , nonce : nonce , gas : 100000 , gasPrice : 200000000 , value : 0 , data : "0x" ) ;
137
- var signature = await _ecosystemWallet . SignTransaction ( tx ) ;
138
- Log ( $ "Transaction Signed: { signature } ") ;
137
+ var contract = await ThirdwebContract . Create ( _client , "0xEBB8a39D865465F289fa349A67B3391d8f910da9" , 421614 ) ;
138
+ var receipt = await contract . DropERC20_Claim ( _ecosystemWallet , address , "1" ) ;
139
+ Log ( $ "Hash: { receipt . TransactionHash } ") ;
139
140
}
140
141
141
142
private void Log ( string message )
0 commit comments