@@ -39,6 +39,7 @@ public partial class EcosystemWallet : IThirdwebWallet
39
39
40
40
internal string Address ;
41
41
internal ExecutionMode ExecutionMode ;
42
+ internal string DelegationContractAddress ;
42
43
43
44
private readonly string _ecosystemId ;
44
45
private readonly string _ecosystemPartnerId ;
@@ -60,7 +61,8 @@ internal EcosystemWallet(
60
61
IThirdwebWallet siweSigner ,
61
62
string legacyEncryptionKey ,
62
63
string walletSecret ,
63
- ExecutionMode executionMode
64
+ ExecutionMode executionMode ,
65
+ string delegationContractAddress
64
66
)
65
67
{
66
68
this . Client = client ;
@@ -76,7 +78,7 @@ ExecutionMode executionMode
76
78
this . WalletSecret = walletSecret ;
77
79
this . ExecutionMode = executionMode ;
78
80
this . AccountType = executionMode == ExecutionMode . EOA ? ThirdwebAccountType . PrivateKeyAccount : ThirdwebAccountType . ExternalAccount ;
79
- ;
81
+ this . DelegationContractAddress = delegationContractAddress ;
80
82
}
81
83
82
84
#region Creation
@@ -118,6 +120,8 @@ public static async Task<EcosystemWallet> Create(
118
120
throw new ArgumentNullException ( nameof ( client ) , "Client cannot be null." ) ;
119
121
}
120
122
123
+ var delegationContractResponse = await BundlerClient . TwGetDelegationContract ( client : client , url : $ "https://1.bundler.thirdweb.com", requestId : 7702 ) ;
124
+
121
125
if ( string . IsNullOrEmpty ( email ) && string . IsNullOrEmpty ( phoneNumber ) && authProvider == Thirdweb . AuthProvider . Default )
122
126
{
123
127
throw new ArgumentException ( "Email, Phone Number, or OAuth Provider must be provided to login." ) ;
@@ -193,7 +197,8 @@ public static async Task<EcosystemWallet> Create(
193
197
siweSigner ,
194
198
legacyEncryptionKey ,
195
199
walletSecret ,
196
- executionMode
200
+ executionMode ,
201
+ delegationContractResponse . DelegationContract
197
202
)
198
203
{
199
204
Address = userAddress ,
@@ -214,7 +219,8 @@ public static async Task<EcosystemWallet> Create(
214
219
siweSigner ,
215
220
legacyEncryptionKey ,
216
221
walletSecret ,
217
- executionMode
222
+ executionMode ,
223
+ delegationContractResponse . DelegationContract
218
224
)
219
225
{
220
226
Address = null ,
@@ -1294,9 +1300,9 @@ public async Task<string> SendTransaction(ThirdwebTransactionInput transaction)
1294
1300
{
1295
1301
var userWalletAddress = await this . GetAddress ( ) ;
1296
1302
var userContract = await ThirdwebContract . Create ( this . Client , userWalletAddress , transaction . ChainId , Constants . MINIMAL_ACCOUNT_7702_ABI ) ;
1297
- var needsDelegation = ! await Utils . IsDelegatedAccount ( this . Client , transaction . ChainId , userWalletAddress ) ;
1303
+ var needsDelegation = ! await Utils . IsDelegatedAccount ( this . Client , transaction . ChainId , userWalletAddress , this . DelegationContractAddress ) ;
1298
1304
EIP7702Authorization ? authorization = needsDelegation
1299
- ? await this . SignAuthorization ( transaction . ChainId , Constants . MINIMAL_ACCOUNT_7702 , willSelfExecute : this . ExecutionMode != ExecutionMode . EIP7702Sponsored )
1305
+ ? await this . SignAuthorization ( transaction . ChainId , this . DelegationContractAddress , willSelfExecute : this . ExecutionMode != ExecutionMode . EIP7702Sponsored )
1300
1306
: null ;
1301
1307
1302
1308
var calls = new List < Call >
@@ -1337,7 +1343,7 @@ public async Task<string> SendTransaction(ThirdwebTransactionInput transaction)
1337
1343
eoaAddress : userWalletAddress ,
1338
1344
wrappedCalls : wrappedCalls ,
1339
1345
signature : signature ,
1340
- authorization : authorization != null && ! await Utils . IsDelegatedAccount ( this . Client , transaction . ChainId , userWalletAddress ) ? authorization : null
1346
+ authorization : authorization != null && ! await Utils . IsDelegatedAccount ( this . Client , transaction . ChainId , userWalletAddress , this . DelegationContractAddress ) ? authorization : null
1341
1347
) ;
1342
1348
var queueId = response ? . QueueId ;
1343
1349
string txHash = null ;
@@ -1473,7 +1479,7 @@ private async Task Ensure7702(BigInteger chainId, bool ensureDelegated)
1473
1479
throw new InvalidOperationException ( "This operation is only supported for EIP7702 and EIP7702Sponsored execution modes." ) ;
1474
1480
}
1475
1481
1476
- if ( ! await Utils . IsDelegatedAccount ( this . Client , chainId , this . Address ) . ConfigureAwait ( false ) )
1482
+ if ( ! await Utils . IsDelegatedAccount ( this . Client , chainId , this . Address , this . DelegationContractAddress ) . ConfigureAwait ( false ) )
1477
1483
{
1478
1484
if ( ensureDelegated )
1479
1485
{
0 commit comments