Class EngineWallet
- Namespace
- Thirdweb
- Assembly
- Thirdweb.dll
Enclave based secure cross ecosystem wallet.
public class EngineWallet : IThirdwebWallet
- Inheritance
-
EngineWallet
- Implements
- Inherited Members
- Extension Methods
Properties
AccountType
Gets the account type of the wallet.
public ThirdwebAccountType AccountType { get; }
Property Value
Client
Gets the Thirdweb client associated with the wallet.
public ThirdwebClient Client { get; }
Property Value
WalletId
String identifier for the wallet to be used in analytics.
public string WalletId { get; }
Property Value
Methods
Create(ThirdwebClient, string, string, string, int?, Dictionary<string, string>)
Creates an instance of the EngineWallet.
public static Task<EngineWallet> Create(ThirdwebClient client, string engineUrl, string authToken, string walletAddress, int? timeoutSeconds = null, Dictionary<string, string> additionalHeaders = null)
Parameters
client
ThirdwebClientThe Thirdweb client.
engineUrl
stringThe URL of the engine.
authToken
stringThe access token to use for the engine.
walletAddress
stringThe backend wallet address to use.
timeoutSeconds
int?The timeout in seconds for the transaction. Defaults to no timeout.
additionalHeaders
Dictionary<string, string>Additional headers to include in requests. Authorization and X-Backend-Wallet-Address automatically included.
Returns
Disconnect()
Disconnects the wallet (if using InAppWallet, clears session)
public Task Disconnect()
Returns
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
EthSign(string)
Signs a message using Ethereum's signing method.
public Task<string> EthSign(string message)
Parameters
message
stringThe message to sign.
Returns
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.
GetAddress()
Gets the address of the wallet.
public Task<string> GetAddress()
Returns
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.
IsConnected()
Checks if the wallet is connected.
public Task<bool> IsConnected()
Returns
LinkAccount(IThirdwebWallet, string, bool?, Action<string>, string, IThirdwebBrowser, BigInteger?, string, string, string, List<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, string defaultSessionIdOverride = null, List<string> forceWalletIds = null)
Parameters
walletToLink
IThirdwebWalletThe wallet to link.
otp
stringThe 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
stringThe redirect scheme if linking OAuth on mobile.
browser
IThirdwebBrowserThe browser to use if linking OAuth.
chainId
BigInteger?The chain ID if linking an external wallet (SIWE).
jwt
stringThe JWT token if linking custom JWT auth.
payload
stringThe login payload if linking custom AuthEndpoint auth.
defaultSessionIdOverride
stringThe default session ID override if linking Guest auth.
forceWalletIds
List<string>The wallet IDs to force display if linking using SiweExternal auth.
Returns
- Task<List<LinkedAccount>>
A list of LinkedAccount objects.
PersonalSign(byte[])
Signs a raw message using personal signing.
public Task<string> PersonalSign(byte[] rawMessage)
Parameters
rawMessage
byte[]The raw message to sign.
Returns
PersonalSign(string)
Signs a message using personal signing.
public Task<string> PersonalSign(string message)
Parameters
message
stringThe message to sign.
Returns
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
Returns
RecoverAddressFromPersonalSign(string, string)
Recovers the address from a signed message using personal signing.
public virtual Task<string> RecoverAddressFromPersonalSign(string message, string signature)
Parameters
Returns
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
TThe data to sign.
typedData
TypedData<TDomain>The typed data.
signature
stringThe signature.
Returns
Type Parameters
T
TDomain
SendTransaction(ThirdwebTransactionInput)
Sends a transaction.
public Task<string> SendTransaction(ThirdwebTransactionInput transaction)
Parameters
transaction
ThirdwebTransactionInputThe transaction to send.
Returns
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
BigIntegerThe chain ID of the contract.
contractAddress
stringThe address of the contract.
willSelfExecute
boolSet 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
ThirdwebTransactionInputThe transaction to sign.
Returns
SignTypedDataV4(string)
Signs typed data (version 4).
public Task<string> SignTypedDataV4(string json)
Parameters
json
stringThe JSON representation of the typed data.
Returns
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
TThe data to sign.
typedData
TypedData<TDomain>The typed data.
Returns
Type Parameters
T
The type of the data.
TDomain
The type of the domain.
SwitchNetwork(BigInteger)
Attempts to set the active network to the specified chain ID.
public Task SwitchNetwork(BigInteger chainId)
Parameters
chainId
BigIntegerThe chain ID to switch to.
Returns
UnlinkAccount(LinkedAccount)
Unlinks an account (auth method) from the current wallet.
public Task<List<LinkedAccount>> UnlinkAccount(LinkedAccount accountToUnlink)
Parameters
accountToUnlink
LinkedAccountThe linked account to unlink. Same type returned by GetLinkedAccounts().
Returns
WaitForQueueId(IThirdwebHttpClient, string, string)
public static Task<string> WaitForQueueId(IThirdwebHttpClient httpClient, string engineUrl, string queueId)
Parameters
httpClient
IThirdwebHttpClientengineUrl
stringqueueId
string