@@ -18,6 +18,8 @@ public partial class EcosystemWallet : PrivateKeyWallet
18
18
private readonly string _email ;
19
19
private readonly string _phoneNumber ;
20
20
private readonly string _authProvider ;
21
+ private readonly string _ecosystemId ;
22
+ private readonly string _ecosystemPartnerId ;
21
23
22
24
private string _address ;
23
25
@@ -26,9 +28,21 @@ public partial class EcosystemWallet : PrivateKeyWallet
26
28
private const string EMBEDDED_WALLET_PATH_V1 = $ "{ EMBEDDED_WALLET_BASE_PATH } /v1";
27
29
private const string ENCLAVE_PATH = $ "{ EMBEDDED_WALLET_PATH_V1 } /enclave-wallet";
28
30
29
- private EcosystemWallet ( ThirdwebClient client , EmbeddedWallet embeddedWallet , IThirdwebHttpClient httpClient , string email , string phoneNumber , string authProvider , IThirdwebWallet siweSigner )
31
+ private EcosystemWallet (
32
+ string ecosystemId ,
33
+ string ecosystemPartnerId ,
34
+ ThirdwebClient client ,
35
+ EmbeddedWallet embeddedWallet ,
36
+ IThirdwebHttpClient httpClient ,
37
+ string email ,
38
+ string phoneNumber ,
39
+ string authProvider ,
40
+ IThirdwebWallet siweSigner
41
+ )
30
42
: base ( client , null )
31
43
{
44
+ this . _ecosystemId = ecosystemId ;
45
+ this . _ecosystemPartnerId = ecosystemPartnerId ;
32
46
this . _embeddedWallet = embeddedWallet ;
33
47
this . _httpClient = httpClient ;
34
48
this . _email = email ;
@@ -79,6 +93,7 @@ public static async Task<EcosystemWallet> Create(
79
93
AuthProvider . Line => "Line" ,
80
94
AuthProvider . Guest => "Guest" ,
81
95
AuthProvider . X => "X" ,
96
+ AuthProvider . Coinbase => "Coinbase" ,
82
97
AuthProvider . Default => string . IsNullOrEmpty ( email ) ? "Phone" : "Email" ,
83
98
_ => throw new ArgumentException ( "Invalid AuthProvider" ) ,
84
99
} ;
@@ -113,12 +128,12 @@ public static async Task<EcosystemWallet> Create(
113
128
try
114
129
{
115
130
var userAddress = await ResumeEnclaveSession ( enclaveHttpClient , embeddedWallet , email , phoneNumber , authproviderStr ) . ConfigureAwait ( false ) ;
116
- return new EcosystemWallet ( client , embeddedWallet , enclaveHttpClient , email , phoneNumber , authproviderStr , siweSigner ) { _address = userAddress } ;
131
+ return new EcosystemWallet ( ecosystemId , ecosystemPartnerId , client , embeddedWallet , enclaveHttpClient , email , phoneNumber , authproviderStr , siweSigner ) { _address = userAddress } ;
117
132
}
118
133
catch
119
134
{
120
135
enclaveHttpClient . RemoveHeader ( "Authorization" ) ;
121
- return new EcosystemWallet ( client , embeddedWallet , enclaveHttpClient , email , phoneNumber , authproviderStr , siweSigner ) { _address = null } ;
136
+ return new EcosystemWallet ( ecosystemId , ecosystemPartnerId , client , embeddedWallet , enclaveHttpClient , email , phoneNumber , authproviderStr , siweSigner ) { _address = null } ;
122
137
}
123
138
}
124
139
@@ -329,6 +344,7 @@ public async Task<List<LinkedAccount>> LinkAccount(
329
344
case "Telegram" :
330
345
case "Line" :
331
346
case "X" :
347
+ case "Coinbase" :
332
348
serverRes = await walletToLink . PreAuth_OAuth ( isMobile ?? false , browserOpenAction , mobileRedirectScheme , browser ) . ConfigureAwait ( false ) ;
333
349
break ;
334
350
default :
@@ -450,6 +466,11 @@ public async Task<string> LoginWithOtp(string otp)
450
466
var redirectUrl = isMobile ? mobileRedirectScheme : "http://localhost:8789/" ;
451
467
var loginUrl = await this . _embeddedWallet . FetchHeadlessOauthLoginLinkAsync ( this . _authProvider , platform ) . ConfigureAwait ( false ) ;
452
468
loginUrl = platform == "web" ? loginUrl : $ "{ loginUrl } ?platform={ platform } &redirectUrl={ redirectUrl } &developerClientId={ this . Client . ClientId } &authOption={ this . _authProvider } ";
469
+ loginUrl = $ "{ loginUrl } &ecosystemId={ this . _ecosystemId } ";
470
+ if ( ! string . IsNullOrEmpty ( this . _ecosystemPartnerId ) )
471
+ {
472
+ loginUrl = $ "{ loginUrl } &ecosystemPartnerId={ this . _ecosystemPartnerId } ";
473
+ }
453
474
454
475
browser ??= new InAppWalletBrowser ( ) ;
455
476
var browserResult = await browser . Login ( this . Client , loginUrl , redirectUrl , browserOpenAction , cancellationToken ) . ConfigureAwait ( false ) ;
0 commit comments