Table of Contents

Class EcosystemWallet

Namespace
Thirdweb
Assembly
Thirdweb.dll

Enclave based secure cross ecosystem wallet.

public class EcosystemWallet : IThirdwebWallet
Inheritance
EcosystemWallet
Implements
Derived
Inherited Members
Extension Methods

Properties

AccountType

Gets the account type of the wallet.

public ThirdwebAccountType AccountType { get; }

Property Value

ThirdwebAccountType

Client

Gets the Thirdweb client associated with the wallet.

public ThirdwebClient Client { get; }

Property Value

ThirdwebClient

Methods

Create(ThirdwebClient, string, string, string, string, AuthProvider, string, IThirdwebWallet, string)

Creates a new instance of the EcosystemWallet class.

public static Task<EcosystemWallet> Create(ThirdwebClient client, string ecosystemId, string ecosystemPartnerId = null, string email = null, string phoneNumber = null, AuthProvider authProvider = AuthProvider.Default, string storageDirectoryPath = null, IThirdwebWallet siweSigner = null, string legacyEncryptionKey = null)

Parameters

client ThirdwebClient

The Thirdweb client instance.

ecosystemId string

Your ecosystem ID (see thirdweb dashboard e.g. ecosystem.the-bonfire).

ecosystemPartnerId string

Your ecosystem partner ID (required if you are integrating someone else's ecosystem).

email string

The email address for Email OTP authentication.

phoneNumber string

The phone number for Phone OTP authentication.

authProvider AuthProvider

The authentication provider to use.

storageDirectoryPath string

The path to the storage directory.

siweSigner IThirdwebWallet

The SIWE signer wallet for SIWE authentication.

legacyEncryptionKey string

The encryption key that is no longer required but was used in the past. Only pass this if you had used custom auth before this was deprecated.

Returns

Task<EcosystemWallet>

A task that represents the asynchronous operation. The task result contains the created in-app wallet.

Exceptions

ArgumentException

Thrown when required parameters are not provided.

Disconnect()

Disconnects the wallet (if using InAppWallet, clears session)

public Task Disconnect()

Returns

Task

EthSign(byte[])

Signs a raw message using Ethereum's signing method.

public Task<string> EthSign(byte[] rawMessage)

Parameters

rawMessage byte[]

The raw message to sign.

Returns

Task<string>

The signed message.

EthSign(string)

Signs a message using Ethereum's signing method.

public Task<string> EthSign(string message)

Parameters

message string

The message to sign.

Returns

Task<string>

The signed message.

ExecuteTransaction(ThirdwebTransactionInput)

Sends a transaction and waits for its receipt.

public Task<ThirdwebTransactionReceipt> ExecuteTransaction(ThirdwebTransactionInput transactionInput)

Parameters

transactionInput ThirdwebTransactionInput

Returns

Task<ThirdwebTransactionReceipt>

The transaction receipt.

public string GenerateExternalLoginLink(string redirectUrl)

Parameters

redirectUrl string

Returns

string

GetAddress()

Gets the address of the wallet.

public Task<string> GetAddress()

Returns

Task<string>

The wallet address.

GetEcosystemDetails()

public Task<EcosystemWallet.EcosystemDetails> GetEcosystemDetails()

Returns

Task<EcosystemWallet.EcosystemDetails>

GetEmail()

[Obsolete("Use GetUserDetails instead.")]
public string GetEmail()

Returns

string

GetLinkedAccounts()

Returns a list of linked accounts to the current wallet.

public Task<List<LinkedAccount>> GetLinkedAccounts()

Returns

Task<List<LinkedAccount>>

A list of LinkedAccount objects.

GetPhoneNumber()

[Obsolete("Use GetUserDetails instead.")]
public string GetPhoneNumber()

Returns

string

GetUserAuthDetails()

Gets the user auth details from the corresponding auth provider.

public JObject GetUserAuthDetails()

Returns

JObject

The user auth details as a JObject

GetUserDetails()

Gets the user details from the enclave wallet.

public Task<EcosystemWallet.UserStatusResponse> GetUserDetails()

Returns

Task<EcosystemWallet.UserStatusResponse>

A task that represents the asynchronous operation. The task result contains the user details.

IsConnected()

Checks if the wallet is connected.

public Task<bool> IsConnected()

Returns

Task<bool>

True if connected, otherwise false.

LinkAccount(IThirdwebWallet, string, bool?, Action<string>, string, IThirdwebBrowser, BigInteger?, string, string)

Links a new account (auth method) to the current wallet. The current wallet must be connected and the wallet being linked must not be fully connected ie created.

public Task<List<LinkedAccount>> LinkAccount(IThirdwebWallet walletToLink, string otp = null, bool? isMobile = null, Action<string> browserOpenAction = null, string mobileRedirectScheme = "thirdweb://", IThirdwebBrowser browser = null, BigInteger? chainId = null, string jwt = null, string payload = null)

Parameters

walletToLink IThirdwebWallet

The wallet to link.

otp string

The OTP code if the wallet to link is an email or phone wallet.

isMobile bool?

Set to true if linking OAuth on mobile.

browserOpenAction Action<string>

The action to open the browser if linking OAuth.

mobileRedirectScheme string

The redirect scheme if linking OAuth on mobile.

browser IThirdwebBrowser

The browser to use if linking OAuth.

chainId BigInteger?

The chain ID if linking an external wallet (SIWE).

jwt string

The JWT token if linking custom JWT auth.

payload string

The login payload if linking custom AuthEndpoint auth.

Returns

Task<List<LinkedAccount>>

A list of LinkedAccount objects.

LoginWithAuthEndpoint(string)

public Task<string> LoginWithAuthEndpoint(string payload)

Parameters

payload string

Returns

Task<string>

LoginWithGuest()

public Task<string> LoginWithGuest()

Returns

Task<string>

LoginWithJWT(string)

public Task<string> LoginWithJWT(string jwt)

Parameters

jwt string

Returns

Task<string>

LoginWithOauth(bool, Action<string>, string, IThirdwebBrowser, CancellationToken)

public Task<string> LoginWithOauth(bool isMobile, Action<string> browserOpenAction, string mobileRedirectScheme = "thirdweb://", IThirdwebBrowser browser = null, CancellationToken cancellationToken = default)

Parameters

isMobile bool
browserOpenAction Action<string>
mobileRedirectScheme string
browser IThirdwebBrowser
cancellationToken CancellationToken

Returns

Task<string>

LoginWithOtp(string)

public Task<string> LoginWithOtp(string otp)

Parameters

otp string

Returns

Task<string>

LoginWithSiwe(BigInteger)

public Task<string> LoginWithSiwe(BigInteger chainId)

Parameters

chainId BigInteger

Returns

Task<string>

PersonalSign(byte[])

Signs a raw message using personal signing.

public Task<string> PersonalSign(byte[] rawMessage)

Parameters

rawMessage byte[]

The raw message to sign.

Returns

Task<string>

The signed message.

PersonalSign(string)

Signs a message using personal signing.

public Task<string> PersonalSign(string message)

Parameters

message string

The message to sign.

Returns

Task<string>

The signed message.

RecoverAddressFromEthSign(string, string)

Recovers the address from a signed message using Ethereum's signing method.

public virtual Task<string> RecoverAddressFromEthSign(string message, string signature)

Parameters

message string

The UTF-8 encoded message.

signature string

The signature.

Returns

Task<string>

The recovered address.

RecoverAddressFromPersonalSign(string, string)

Recovers the address from a signed message using personal signing.

public virtual Task<string> RecoverAddressFromPersonalSign(string message, string signature)

Parameters

message string

The UTF-8 encoded and prefixed message.

signature string

The signature.

Returns

Task<string>

The recovered address.

RecoverAddressFromTypedDataV4<T, TDomain>(T, TypedData<TDomain>, string)

Recovers the address from a signed message using typed data (version 4).

public virtual Task<string> RecoverAddressFromTypedDataV4<T, TDomain>(T data, TypedData<TDomain> typedData, string signature) where TDomain : IDomain

Parameters

data T

The data to sign.

typedData TypedData<TDomain>

The typed data.

signature string

The signature.

Returns

Task<string>

The recovered address.

Type Parameters

T
TDomain

SendOTP()

public Task SendOTP()

Returns

Task

SendTransaction(ThirdwebTransactionInput)

Sends a transaction.

public Task<string> SendTransaction(ThirdwebTransactionInput transaction)

Parameters

transaction ThirdwebTransactionInput

The transaction to send.

Returns

Task<string>

The transaction hash.

SignAuthorization(BigInteger, string, bool)

Signs an EIP-7702 authorization to invoke contract functions to an externally owned account.

public Task<EIP7702Authorization> SignAuthorization(BigInteger chainId, string contractAddress, bool willSelfExecute)

Parameters

chainId BigInteger

The chain ID of the contract.

contractAddress string

The address of the contract.

willSelfExecute bool

Set to true if the wallet will also be the executor of the transaction, otherwise false.

Returns

Task<EIP7702Authorization>

The signed authorization as an EIP7702Authorization that can be used with AuthorizationList.

SignTransaction(ThirdwebTransactionInput)

Signs a transaction.

public Task<string> SignTransaction(ThirdwebTransactionInput transaction)

Parameters

transaction ThirdwebTransactionInput

The transaction to sign.

Returns

Task<string>

The signed transaction.

SignTypedDataV4(string)

Signs typed data (version 4).

public Task<string> SignTypedDataV4(string json)

Parameters

json string

The JSON representation of the typed data.

Returns

Task<string>

The signed data.

SignTypedDataV4<T, TDomain>(T, TypedData<TDomain>)

Signs typed data (version 4).

public Task<string> SignTypedDataV4<T, TDomain>(T data, TypedData<TDomain> typedData) where TDomain : IDomain

Parameters

data T

The data to sign.

typedData TypedData<TDomain>

The typed data.

Returns

Task<string>

The signed data.

Type Parameters

T

The type of the data.

TDomain

The type of the domain.

UnlinkAccount(LinkedAccount)

Unlinks an account (auth method) from the current wallet.

public Task<List<LinkedAccount>> UnlinkAccount(LinkedAccount accountToUnlink)

Parameters

accountToUnlink LinkedAccount

The linked account to unlink. Same type returned by GetLinkedAccounts().

Returns

Task<List<LinkedAccount>>